!function(e){function n(r){if(t[r])return t[r].exports;var a=t[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}var t={};return n.m=e,n.c=t,n.p="./dist/",n(0)}(function(e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))switch(typeof e[n]){case"function":break;case"object":e[n]=function(n){var t=n.slice(1),r=e[n[0]];return function(e,n,a){r.apply(this,[e,n,a].concat(t))}}(e[n]);break;default:e[n]=e[e[n]]}return e}([function(module,exports,__webpack_require__){eval("'use strict';\n\nvar _rxRun = __webpack_require__(301);\n\nvar _dom = __webpack_require__(16);\n\nvar _postMessageDriver = __webpack_require__(216);\n\nvar _postMessageDriver2 = _interopRequireDefault(_postMessageDriver);\n\nvar _addressbarDriver = __webpack_require__(208);\n\nvar _addressbarDriver2 = _interopRequireDefault(_addressbarDriver);\n\nvar _browserCapabilities = __webpack_require__(210);\n\nvar _browserCapabilities2 = _interopRequireDefault(_browserCapabilities);\n\nvar _appMetaDataDriver = __webpack_require__(209);\n\nvar _appMetaDataDriver2 = _interopRequireDefault(_appMetaDataDriver);\n\nvar _eventDriver = __webpack_require__(213);\n\nvar _eventDriver2 = _interopRequireDefault(_eventDriver);\n\nvar _cycleSimpleHttpDriver = __webpack_require__(305);\n\nvar _cycleSimpleHttpDriver2 = _interopRequireDefault(_cycleSimpleHttpDriver);\n\nvar _localStorageDriver = __webpack_require__(215);\n\nvar _localStorageDriver2 = _interopRequireDefault(_localStorageDriver);\n\nvar _desktopStoreDriver = __webpack_require__(212);\n\nvar _desktopStoreDriver2 = _interopRequireDefault(_desktopStoreDriver);\n\nvar _uscoYmStorage = __webpack_require__(329);\n\nvar _uscoYmStorage2 = _interopRequireDefault(_uscoYmStorage);\n\nvar _fileStorageDriver = __webpack_require__(214);\n\nvar _fileStorageDriver2 = _interopRequireDefault(_fileStorageDriver);\n\nvar _clipBoardDriver = __webpack_require__(211);\n\nvar _clipBoardDriver2 = _interopRequireDefault(_clipBoardDriver);\n\nvar _index = __webpack_require__(115);\n\nvar _index2 = _interopRequireDefault(_index);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// ////////setup drivers\nvar domDriver = (0, _dom.makeDOMDriver)('#jamRoot');\n// other drivers\nvar postMessage = _postMessageDriver2.default;\nvar localStorage = _localStorageDriver2.default;\nvar addressbar = _addressbarDriver2.default;\nvar browserCaps = _browserCapabilities2.default;\nvar httpDriver = (0, _cycleSimpleHttpDriver2.default)();\nvar desktopStoreDriver = (0, _desktopStoreDriver2.default)();\nvar ymDriver = (0, _uscoYmStorage2.default)(httpDriver);\nvar fileStorage = _fileStorageDriver2.default;\nvar clipBoard = _clipBoardDriver2.default;\n\nvar drivers = {\n  DOM: domDriver,\n  postMessage: postMessage,\n  addressbar: addressbar,\n  browserCaps: browserCaps,\n  events: _eventDriver2.default,\n  appMeta: _appMetaDataDriver2.default,\n  // storage etc\n  localStorage: localStorage,\n  http: httpDriver,\n  desktop: desktopStoreDriver,\n  fileStorage: fileStorage,\n  clipBoard: clipBoard,\n\n  ym: ymDriver\n};\n\nconsole.log('---READY TO START JAM!---');\nvar mode = \"production\";\nif (mode === 'production') {\n  // remove console.log statements // FIXME: temporary hack\n  console._log = console.log;\n  console._info = console.info;\n  console._warn = console.warn;\n  console.log = function () {};\n  console.info = function () {};\n  console.warn = function () {};\n}\n\n(0, _rxRun.run)(_index2.default, drivers);\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/index.js\n ** module id = 0\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/index.js?")},function(module,exports){eval('var self = self || {};// threejs.org/license\r\n\'use strict\';var THREE={REVISION:"70"};"object"===typeof module&&(module.exports=THREE);void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:0});THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;\r\nTHREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.MinEquation=103;THREE.MaxEquation=104;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;\r\nTHREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;THREE.RepeatWrapping=1E3;\r\nTHREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;\r\nTHREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGBEFormat=THREE.RGBAFormat;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;\r\nTHREE.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(a,b){console.warn("THREE.Projector: .projectVector() is now vector.project().");a.project(b)};this.unprojectVector=function(a,b){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");a.unproject(b)};this.pickingRay=function(a,b){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};\r\nTHREE.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}};THREE.Color=function(a){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(a)};\r\nTHREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a instanceof THREE.Color?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*\r\nc:.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a};b=.5>=c?c*(1+b):c+b-c*b;c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\\((\\d+), ?(\\d+), ?(\\d+)\\)$/i.test(a))return a=/^rgb\\((\\d+), ?(\\d+), ?(\\d+)\\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\\((\\d+)\\%, ?(\\d+)\\%, ?(\\d+)\\%\\)$/i.test(a))return a=/^rgb\\((\\d+)\\%, ?(\\d+)\\%, ?(\\d+)\\%\\)$/i.exec(a),this.r=\r\nMath.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\\#([0-9a-f]{6})$/i.test(a))return a=/^\\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;this.g=\r\na.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*this.r<<16^255*this.g<<\r\n8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(a){a=a||{h:0,s:0,l:0};var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var k=e-f,f=.5>=h?k/(e+f):k/(2-e-f);switch(e){case b:g=(c-d)/k+(c<d?6:0);break;case c:g=(d-b)/k+2;break;case d:g=(b-c)/k+4}g/=6}a.h=g;a.s=f;a.l=h;return a},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,\r\nb,c){var d=this.getHSL();d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;\r\nthis.b+=(a.b-this.b)*b;return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a){this.r=a[0];this.g=a[1];this.b=a[2];return this},toArray:function(){return[this.r,this.g,this.b]},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};\r\nTHREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,\r\ndarkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,\r\ngrey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,\r\nlime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,\r\npalegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,\r\ntomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1};\r\nTHREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get w(){return this._w},set w(a){this._w=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;\r\nthis._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!1===a instanceof THREE.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/2),g=Math.sin(a._y/2),h=Math.sin(a._z/2);"XYZ"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"YXZ"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=\r\nc*d*h-f*g*e,this._w=c*d*e+f*g*h):"ZXY"===a.order?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"ZYX"===a.order?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"YZX"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e-f*g*h):"XZY"===a.order&&(this._x=f*d*e-c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e+f*g*h);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,\r\nb){var c=b/2,d=Math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w=Math.cos(c);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6],b=b[10],n=c+f+b;0<n?(c=.5/Math.sqrt(n+1),this._w=.25/c,this._x=(k-g)*c,this._y=(d-h)*c,this._z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=\r\n.25*c,this._z=(g+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=\r\n-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},\r\nmultiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,k=b._z,n=b._w;this._x=c*n+f*g+d*k-e*h;this._y=d*n+f*h+e*g-c*k;this._z=e*n+f*k+c*h-d*g;this._w=f*n-c*g-d*h-e*k;this.onChangeCallback();return this},multiplyVector3:function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");\r\nreturn a.applyQuaternion(this)},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.acos(g),k=Math.sqrt(1-g*g);if(.001>Math.abs(k))return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;g=Math.sin((1-b)*h)/k;h=\r\nMath.sin(b*h)/k;this._w=f*g+this._w*h;this._x=c*g+this._x*h;this._y=d*g+this._y*h;this._z=e*g+this._z*h;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=\r\na;return this},onChangeCallback:function(){},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};\r\nTHREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,\r\nb){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},\r\nsubVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);return this},clamp:function(a,\r\nb){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector2,b=new THREE.Vector2);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},\r\nroundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=\r\nthis.x-a.x;a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+\r\nc;this.x=a.array[b];this.y=a.array[b+1];return this},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};\r\nTHREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+\r\na);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),\r\nthis.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=\r\na.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a;return function(b){!1===b instanceof THREE.Euler&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromEuler(b));return this}}(),applyAxisAngle:function(){var a;return function(b,c){void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromAxisAngle(b,c));return this}}(),applyMatrix3:function(a){var b=this.x,\r\nc=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=\r\n(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,n=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-n*-f;this.y=k*a+b*-f+n*-e-h*-g;this.z=n*a+b*-g+h*-f-k*-e;return this},project:function(){var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyProjection(a)}}(),unproject:function(){var a;return function(b){void 0===\r\na&&(a=new THREE.Matrix4);a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyProjection(a)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>\r\na.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3,b=new THREE.Vector3);a.set(c,c,c);b.set(d,d,d);return this.clamp(a,\r\nb)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);\r\nreturn this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/\r\nb);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g;this.y=e*f-c*h;this.z=c*g-d*f;return this},\r\nprojectOnVector:function(){var a,b;return function(c){void 0===a&&(a=new THREE.Vector3);a.copy(c).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new THREE.Vector3);a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0===a&&(a=new THREE.Vector3);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/(this.length()*a.length());\r\nreturn Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(a,b){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},\r\ngetPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(a,\r\nb)},setFromMatrixPosition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setFromMatrixScale:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length();a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===\r\nthis.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};\r\nTHREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};\r\nTHREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;\r\ncase 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},\r\naddVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=\r\nthis.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},\r\nsetAxisAngleFromRotationMatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],k=a[9];c=a[2];b=a[6];var n=a[10];if(.01>Math.abs(d-g)&&.01>Math.abs(f-c)&&.01>Math.abs(k-b)){if(.1>Math.abs(d+g)&&.1>Math.abs(f+c)&&.1>Math.abs(k+b)&&.1>Math.abs(e+h+n-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;n=(n+1)/2;d=(d+g)/4;f=(f+c)/4;k=(k+b)/4;e>h&&e>n?.01>e?(b=0,d=c=.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>n?.01>h?(b=.707106781,c=0,d=.707106781):(c=Math.sqrt(h),\r\nb=d/c,d=k/c):.01>n?(c=b=.707106781,d=0):(d=Math.sqrt(n),b=f/d,c=k/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(f-c)*(f-c)+(g-d)*(g-d));.001>Math.abs(a)&&(a=1);this.x=(b-k)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+n-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=a.w);\r\nreturn this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector4,b=new THREE.Vector4);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);\r\nreturn this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);\r\nreturn this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},\r\nsetLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=\r\nthis.z;a[b+3]=this.w;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w=a.array[b+3];return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ";\r\nTHREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this},copy:function(a){this._x=\r\na._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=THREE.Math.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],k=e[5],n=e[9],p=e[2],q=e[6],e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-n,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(q,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,\r\nk)):(this._y=Math.atan2(-p,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(q,-1,1)),.99999>Math.abs(q)?(this._y=Math.atan2(-p,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(p,-1,1)),.99999>Math.abs(p)?(this._x=Math.atan2(q,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-n,k),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=\r\nMath.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(q,k),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-n,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Matrix4);a.makeRotationFromQuaternion(b);this.setFromRotationMatrix(a,c,d);return this}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,\r\nb||this._order)},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(){return[this._x,this._y,this._z,this._order]},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new THREE.Vector3(this._x,\r\nthis._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3};\r\nTHREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,\r\nb){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);\r\nthis.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)};\r\nTHREE.Box2.prototype={constructor:THREE.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new THREE.Vector2;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=\r\nthis.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(a){return(a||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);\r\nthis.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector2).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>\r\nthis.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&\r\na.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};\r\nTHREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new THREE.Vector3;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),setFromObject:function(){var a=new THREE.Vector3;return function(b){var c=this;b.updateMatrixWorld(!0);\r\nthis.makeEmpty();b.traverse(function(b){var e=b.geometry;if(void 0!==e)if(e instanceof THREE.Geometry)for(var f=e.vertices,e=0,g=f.length;e<g;e++)a.copy(f[e]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a);else if(e instanceof THREE.BufferGeometry&&void 0!==e.attributes.position)for(f=e.attributes.position.array,e=0,g=f.length;e<g;e+=3)a.set(f[e],f[e+1],f[e+2]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a)});return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},\r\nmakeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);\r\nthis.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector3).set((a.x-this.min.x)/(this.max.x-\r\nthis.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=\r\nnew THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,\r\nthis.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);\r\nthis.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")};\r\nTHREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,k){var n=this.elements;n[0]=a;n[3]=b;n[6]=c;n[1]=d;n[4]=e;n[7]=f;n[2]=g;n[5]=h;n[8]=k;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},\r\nmultiplyVector3Array:function(a){console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=\r\na;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],k=a[7],a=a[8];return b*f*a-b*g*k-c*e*a+c*g*h+d*e*k-d*f*h},getInverse:function(a,b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];\r\nc=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can\'t invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can\'t invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];\r\na[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]]},clone:function(){return(new THREE.Matrix3).fromArray(this.elements)}};\r\nTHREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")};\r\nTHREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,n,p,q,m,t,s,r){var u=this.elements;u[0]=a;u[4]=b;u[8]=c;u[12]=d;u[1]=e;u[5]=f;u[9]=g;u[13]=h;u[2]=k;u[6]=n;u[10]=p;u[14]=q;u[3]=m;u[7]=t;u[11]=s;u[15]=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");return this.copyPosition(a)},\r\ncopyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){var d=this.elements;a.set(d[0],d[1],d[2]);b.set(d[4],d[5],d[6]);c.set(d[8],d[9],d[10]);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements;b=b.elements;var d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),\r\nf=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){!1===a instanceof THREE.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*\r\ne,n=c*h,p=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+n*d;b[5]=a-p*d;b[9]=-c*g;b[2]=p-a*d;b[6]=n+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,n=d*h,p=d*e,b[0]=a+p*c,b[4]=n*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-n,b[6]=p+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,n=d*h,p=d*e,b[0]=a-p*c,b[4]=-f*e,b[8]=n+k*c,b[1]=k+n*c,b[5]=f*h,b[9]=p-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,n=c*h,p=c*e,b[0]=g*h,b[4]=n*d-k,b[8]=a*d+p,b[1]=g*e,b[5]=p*d+a,b[9]=k*d-n,b[2]=-d,b[6]=c*g,b[10]=f*g):\r\n"YZX"===a.order?(a=f*g,k=f*d,n=c*g,p=c*d,b[0]=g*h,b[4]=p-a*e,b[8]=n*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+n,b[10]=a-p*e):"XZY"===a.order&&(a=f*g,k=f*d,n=c*g,p=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=f*h,b[9]=k*e-n,b[2]=n*e-k,b[6]=c*h,b[10]=p*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(a)},\r\nmakeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var n=c*h,c=c*k,p=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(p+e);b[4]=n-f;b[8]=c+h;b[1]=n+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+p);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,\r\nc).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],\r\nk=c[12],n=c[1],p=c[5],q=c[9],m=c[13],t=c[2],s=c[6],r=c[10],u=c[14],v=c[3],y=c[7],C=c[11],c=c[15],x=d[0],F=d[4],z=d[8],G=d[12],E=d[1],w=d[5],D=d[9],A=d[13],U=d[2],M=d[6],K=d[10],L=d[14],N=d[3],T=d[7],Q=d[11],d=d[15];e[0]=f*x+g*E+h*U+k*N;e[4]=f*F+g*w+h*M+k*T;e[8]=f*z+g*D+h*K+k*Q;e[12]=f*G+g*A+h*L+k*d;e[1]=n*x+p*E+q*U+m*N;e[5]=n*F+p*w+q*M+m*T;e[9]=n*z+p*D+q*K+m*Q;e[13]=n*G+p*A+q*L+m*d;e[2]=t*x+s*E+r*U+u*N;e[6]=t*F+s*w+r*M+u*T;e[10]=t*z+s*D+r*K+u*Q;e[14]=t*G+s*A+r*L+u*d;e[3]=v*x+y*E+C*U+c*N;e[7]=v*F+\r\ny*w+C*M+c*T;e[11]=v*z+y*D+C*K+c*Q;e[15]=v*G+y*A+C*L+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=\r\na;b[15]*=a;return this},multiplyVector3:function(a){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return a.applyProjection(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");\r\nreturn this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix4(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");\r\nreturn a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],k=a[13],n=a[2],p=a[6],q=a[10],m=a[14];return a[3]*(+e*h*p-d*k*p-e*g*q+c*k*q+d*g*m-c*h*m)+a[7]*(+b*h*m-b*k*q+e*f*q-d*f*m+d*k*n-e*h*n)+a[11]*(+b*k*p-b*g*m-e*f*p+c*f*m+e*g*n-c*k*n)+a[15]*(-d*g*n-b*h*p+b*g*q+d*f*p-c*f*q+c*h*n)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];\r\na[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var b=\r\nthis.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],k=d[1],n=d[5],p=d[9],q=d[13],m=d[2],t=d[6],s=d[10],r=d[14],u=d[3],v=d[7],y=d[11],d=d[15];c[0]=p*r*v-q*s*v+q*t*y-n*r*y-p*t*d+n*s*d;c[4]=h*s*v-g*r*v-h*t*y+f*r*y+g*t*d-f*s*d;c[8]=g*q*v-h*p*v+h*n*y-f*q*y-g*n*d+f*p*d;c[12]=h*p*t-g*q*t-h*n*s+f*q*s+g*n*r-f*p*r;c[1]=q*s*u-p*r*u-q*m*y+\r\nk*r*y+p*m*d-k*s*d;c[5]=g*r*u-h*s*u+h*m*y-e*r*y-g*m*d+e*s*d;c[9]=h*p*u-g*q*u-h*k*y+e*q*y+g*k*d-e*p*d;c[13]=g*q*m-h*p*m+h*k*s-e*q*s-g*k*r+e*p*r;c[2]=n*r*u-q*t*u+q*m*v-k*r*v-n*m*d+k*t*d;c[6]=h*t*u-f*r*u-h*m*v+e*r*v+f*m*d-e*t*d;c[10]=f*q*u-h*n*u+h*k*v-e*q*v-f*k*d+e*n*d;c[14]=h*n*m-f*q*m-h*k*t+e*q*t+f*k*r-e*n*r;c[3]=p*t*u-n*s*u-p*m*v+k*s*v+n*m*y-k*t*y;c[7]=f*s*u-g*t*u+g*m*v-e*s*v-f*m*y+e*t*y;c[11]=g*n*u-f*p*u-g*k*v+e*p*v+f*k*y-e*n*y;c[15]=f*p*m-g*n*m+g*k*t-e*p*t-f*k*s+e*n*s;c=e*c[0]+k*c[4]+m*c[8]+u*c[12];\r\nif(0==c){if(b)throw Error("Matrix4.getInverse(): can\'t invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can\'t invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(a){console.warn("THREE.Matrix4: .translate() has been removed.")},rotateX:function(a){console.warn("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(a){console.warn("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(a){console.warn("THREE.Matrix4: .rotateZ() has been removed.")},\r\nrotateByAxis:function(a,b){console.warn("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(a){var b=this.elements,c=a.x,d=a.y;a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,\r\n1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,n=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*\r\ng+d*h,n*g+c,n*h-d*f,0,k*h-d*g,n*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},decompose:function(){var a=new THREE.Vector3,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements,g=a.set(f[0],f[1],f[2]).length(),h=a.set(f[4],f[5],f[6]).length(),k=a.set(f[8],f[9],f[10]).length();0>this.determinant()&&(g=-g);c.x=f[12];\r\nc.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/h,n=1/k;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=n;b.elements[9]*=n;b.elements[10]*=n;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=k;return this}}(),makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;\r\ng[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){a=c*Math.tan(THREE.Math.degToRad(.5*a));var e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,k=c-d,n=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/n;g[14]=-((f+e)/n);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],\r\na[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)}};THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};\r\nTHREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);\r\nvar d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqToSegment:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);\r\nb.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),n=c.dot(this.direction),p=-c.dot(b),q=c.lengthSq(),m=Math.abs(1-k*k),t;0<m?(d=k*p-n,e=k*n-p,t=h*m,0<=d?e>=-t?e<=t?(h=1/m,d*=h,e*=h,k=d*(d+k*e+2*n)+e*(k*d+e+2*p)+q):(e=h,d=Math.max(0,-(k*e+n)),k=-d*d+e*(e+2*p)+q):(e=-h,d=Math.max(0,-(k*e+n)),k=-d*d+e*(e+2*p)+q):e<=-t?(d=Math.max(0,-(-k*h+n)),e=0<d?-h:Math.min(Math.max(-h,-p),h),k=-d*d+e*(e+2*p)+q):e<=t?(d=0,e=Math.min(Math.max(-h,-p),h),k=e*(e+\r\n2*p)+q):(d=Math.max(0,-(k*h+n)),e=0<d?h:Math.min(Math.max(-h,-p),h),k=-d*d+e*(e+2*p)+q)):(e=0<k?-h:h,d=Math.max(0,-(k*e+n)),k=-d*d+e*(e+2*p)+q);f&&f.copy(this.direction).multiplyScalar(d).add(this.origin);g&&g.copy(b).multiplyScalar(e).add(a);return k}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},intersectSphere:function(){var a=new THREE.Vector3;return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d,f=b.radius*b.radius;\r\nif(e>f)return null;f=Math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},\r\nisIntersectionBox:function(){var a=new THREE.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e;if(f<d||d!==d)d=f;0<=g?(e=(a.min.z-h.z)*g,g*=a.max.z-h.z):(e=(a.max.z-h.z)*\r\ng,g*=a.min.z-h.z);if(c>g||e>d)return null;if(e>c||c!==c)c=e;if(g<d||d!==d)d=g;return 0>d?null:this.at(0<=c?c:d,b)},intersectTriangle:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0<f){if(h)return null;h=1}else if(0>f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));\r\nif(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};\r\nTHREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,g=b.length;f<g;f++)e=Math.max(e,d.distanceToSquared(b[f]));this.radius=Math.sqrt(e);return this}}(),copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=\r\nthis.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);\r\nreturn a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};\r\nTHREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};\r\nTHREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],n=c[7],p=c[8],q=c[9],m=c[10],t=c[11],s=c[12],r=c[13],u=c[14],c=c[15];b[0].setComponents(f-a,n-g,t-p,c-s).normalize();b[1].setComponents(f+\r\na,n+g,t+p,c+s).normalize();b[2].setComponents(f+d,n+h,t+q,c+r).normalize();b[3].setComponents(f-d,n-h,t-q,c-r).normalize();b[4].setComponents(f-e,n-k,t-m,c-u).normalize();b[5].setComponents(f+e,n+k,t+m,c+u).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,\r\nc=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&0>f)return!1}return!0}}(),\r\ncontainsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};\r\nTHREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,\r\nc);return this}}(),copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,\r\nb){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);if(0==f){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}(),\r\ncoplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Matrix3;return function(d,e){var f=e||c.getNormalMatrix(d),f=a.copy(this.normal).applyMatrix3(f),g=this.coplanarPoint(b);g.applyMatrix4(d);this.setFromNormalAndCoplanarPoint(f,g);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&\r\na.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};\r\nTHREE.Math={generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d;return function(){for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<=\r\nb)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return Math.floor(this.randFloat(a,b))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=\r\n180/Math.PI;return function(b){return b*a}}(),isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a}};\r\nTHREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,k,n,p,q,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:f+\r\n2;n=this.points[c[0]];p=this.points[c[1]];q=this.points[c[2]];m=this.points[c[3]];h=g*g;k=g*h;d.x=b(n.x,p.x,q.x,m.x,g,h,k);d.y=b(n.y,p.y,q.y,m.y,g,h,k);d.z=b(n.z,p.z,q.z,m.z,g,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],k=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=\r\na/c,d=this.getPoint(b),g.copy(d),k+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=k,e=b);h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],k=new THREE.Vector3,m=this.getLength();h.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];g=Math.ceil(a*c/m.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+1/g*c*(f-e),d=this.getPoint(d),h.push(k.copy(d).clone());\r\nh.push(k.copy(this.points[b]).clone())}this.points=h}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();\r\nTHREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);d=a.dot(a);e=a.dot(b);f=a.dot(c);var k=b.dot(b);g=b.dot(c);var n=d*k-e*e;h=h||new THREE.Vector3;if(0==n)return h.set(-2,-1,-1);n=1/n;k=(k*f-e*g)*n;d=(d*g-e*f)*n;return h.set(1-k-d,d,k)}}();\r\nTHREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}();\r\nTHREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||\r\nnew THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},\r\nclone:function(){return(new THREE.Triangle).copy(this)}};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};\r\nTHREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),\r\na=.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){};\r\nTHREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&\r\nc[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=[],d=b.length,e=0;e<d;e++)c[e]=b[e];for(e=0;e<d;e++)c[e].call(this,a)}}}};\r\n(function(a){a.Raycaster=function(b,c,f,g){this.ray=new a.Ray(b,c);this.near=f||0;this.far=g||Infinity;this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var b=function(a,b){return a.distance-b.distance},c=function(a,b,f,g){a.raycast(b,f);if(!0===g){a=a.children;g=0;for(var h=a.length;g<h;g++)c(a[g],b,f,!0)}};a.Raycaster.prototype={constructor:a.Raycaster,precision:1E-4,linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(b,c){c instanceof a.PerspectiveCamera?\r\n(this.ray.origin.copy(c.position),this.ray.direction.set(b.x,b.y,.5).unproject(c).sub(c.position).normalize()):c instanceof a.OrthographicCamera?(this.ray.origin.set(b.x,b.y,-1).unproject(c),this.ray.direction.set(0,0,-1).transformDirection(c.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,e){var f=[];c(a,this,f,e);f.sort(b);return f},intersectObjects:function(a,e){var f=[];if(!1===a instanceof Array)return console.log("THREE.Raycaster.intersectObjects: objects is not an Array."),\r\nf;for(var g=0,h=a.length;g<h;g++)c(a[g],this,f,e);f.sort(b);return f}}})(THREE);\r\nTHREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Object3D";this.parent=void 0;this.children=[];this.up=THREE.Object3D.DefaultUp.clone();var a=new THREE.Vector3,b=new THREE.Euler,c=new THREE.Quaternion,d=new THREE.Vector3(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0,\r\nvalue:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d}});this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0);\r\nTHREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(a){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=a},get useQuaternion(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},\r\napplyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function(){var a=new THREE.Quaternion;return function(b,c){a.setFromAxisAngle(b,\r\nc);this.quaternion.multiply(a);return this}}(),rotateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateZ:function(){var a=new THREE.Vector3(0,0,1);return function(b){return this.rotateOnAxis(a,b)}}(),translateOnAxis:function(){var a=new THREE.Vector3;return function(b,c){a.copy(b).applyQuaternion(this.quaternion);this.position.add(a.multiplyScalar(c));\r\nreturn this}}(),translate:function(a,b){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)},translateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.translateOnAxis(a,b)}}(),translateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.translateOnAxis(a,b)}}(),translateZ:function(){var a=new THREE.Vector3(0,0,1);return function(b){return this.translateOnAxis(a,\r\nb)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var a=new THREE.Matrix4;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a=new THREE.Matrix4;return function(b){a.lookAt(b,this.position,this.up);this.quaternion.setFromRotationMatrix(a)}}(),add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}if(a===this)return console.error("THREE.Object3D.add:",\r\na,"can\'t be added as a child of itself."),this;a instanceof THREE.Object3D?(void 0!==a.parent&&a.parent.remove(a),a.parent=this,a.dispatchEvent({type:"added"}),this.children.push(a)):console.error("THREE.Object3D.add:",a,"is not an instance of THREE.Object3D.");return this},remove:function(a){if(1<arguments.length)for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);b=this.children.indexOf(a);-1!==b&&(a.parent=void 0,a.dispatchEvent({type:"removed"}),this.children.splice(b,1))},getChildByName:function(a,\r\nb){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a,b)},getObjectById:function(a,b){return this.getObjectByProperty("id",a,b)},getObjectByName:function(a,b){return this.getObjectByProperty("name",a,b)},getObjectByProperty:function(a,b,c){if(this[a]===b)return this;for(var d=0,e=this.children.length;d<e;d++){var f=this.children[d].getObjectByProperty(a,b,c);if(void 0!==f)return f}},getWorldPosition:function(a){a=a||new THREE.Vector3;\r\nthis.updateMatrixWorld(!0);return a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){c=c||new THREE.Quaternion;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,c,b);return c}}(),getWorldRotation:function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Euler;this.getWorldQuaternion(a);return b.setFromQuaternion(a,this.rotation.order,!1)}}(),getWorldScale:function(){var a=new THREE.Vector3,b=new THREE.Quaternion;\r\nreturn function(c){c=c||new THREE.Vector3;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,b,c);return c}}(),getWorldDirection:function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,1).applyQuaternion(a)}}(),raycast:function(){},traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=0,c=this.children.length;b<\r\nc;b++)this.children[b].traverseVisible(a)}},traverseAncestors:function(a){this.parent&&(a(this.parent),this.parent.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),\r\nthis.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},toJSON:function(){var a={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},b={},c=function(c){void 0===a.geometries&&(a.geometries=[]);if(void 0===b[c.uuid]){var d=c.toJSON();delete d.metadata;b[c.uuid]=d;a.geometries.push(d)}return c.uuid},d={},e=function(b){void 0===a.materials&&(a.materials=[]);if(void 0===d[b.uuid]){var c=b.toJSON();delete c.metadata;d[b.uuid]=c;\r\na.materials.push(c)}return b.uuid},f=function(a){var b={};b.uuid=a.uuid;b.type=a.type;""!==a.name&&(b.name=a.name);"{}"!==JSON.stringify(a.userData)&&(b.userData=a.userData);!0!==a.visible&&(b.visible=a.visible);a instanceof THREE.PerspectiveCamera?(b.fov=a.fov,b.aspect=a.aspect,b.near=a.near,b.far=a.far):a instanceof THREE.OrthographicCamera?(b.left=a.left,b.right=a.right,b.top=a.top,b.bottom=a.bottom,b.near=a.near,b.far=a.far):a instanceof THREE.AmbientLight?b.color=a.color.getHex():a instanceof\r\nTHREE.DirectionalLight?(b.color=a.color.getHex(),b.intensity=a.intensity):a instanceof THREE.PointLight?(b.color=a.color.getHex(),b.intensity=a.intensity,b.distance=a.distance):a instanceof THREE.SpotLight?(b.color=a.color.getHex(),b.intensity=a.intensity,b.distance=a.distance,b.angle=a.angle,b.exponent=a.exponent):a instanceof THREE.HemisphereLight?(b.color=a.color.getHex(),b.groundColor=a.groundColor.getHex()):a instanceof THREE.Mesh?(b.geometry=c(a.geometry),b.material=e(a.material)):a instanceof\r\nTHREE.Line?(b.geometry=c(a.geometry),b.material=e(a.material)):a instanceof THREE.Sprite&&(b.material=e(a.material));b.matrix=a.matrix.toArray();if(0<a.children.length){b.children=[];for(var d=0;d<a.children.length;d++)b.children.push(f(a.children[d]))}return b};a.object=f(this);return a},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.rotationAutoUpdate=\r\nthis.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);\r\nTHREE.Object3DIdCount=0;THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0};\r\nTHREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.materialIndex=this.materialIndex;for(var b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();return a}};\r\nTHREE.Face4=function(a,b,c,d,e,f,g){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,g)};THREE.BufferAttribute=function(a,b){this.array=a;this.itemSize=b;this.needsUpdate=!1};\r\nTHREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return this.array.length},copyAt:function(a,b,c){a*=this.itemSize;c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d]},set:function(a){this.array.set(a);return this},setX:function(a,b){this.array[a*this.itemSize]=b;return this},setY:function(a,b){this.array[a*this.itemSize+1]=b;return this},setZ:function(a,b){this.array[a*this.itemSize+2]=b;return this},setXY:function(a,b,c){a*=this.itemSize;\r\nthis.array[a]=b;this.array[a+1]=c;return this},setXYZ:function(a,b,c,d){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;this.array[a+2]=d;return this},setXYZW:function(a,b,c,d,e){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=e;return this},clone:function(){return new THREE.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}};\r\nTHREE.Int8Attribute=function(a,b){console.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Uint8Attribute=function(a,b){console.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};\r\nTHREE.Uint8ClampedAttribute=function(a,b){console.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Int16Attribute=function(a,b){console.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};\r\nTHREE.Uint16Attribute=function(a,b){console.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Int32Attribute=function(a,b){console.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};\r\nTHREE.Uint32Attribute=function(a,b){console.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Float32Attribute=function(a,b){console.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};\r\nTHREE.Float64Attribute=function(a,b){console.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="BufferGeometry";this.attributes={};this.attributesKeys=[];this.offsets=this.drawcalls=[];this.boundingSphere=this.boundingBox=null};\r\nTHREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.attributes[a]={array:b,itemSize:c}):(this.attributes[a]=b,this.attributesKeys=Object.keys(this.attributes))},getAttribute:function(a){return this.attributes[a]},addDrawCall:function(a,b,c){this.drawcalls.push({start:a,count:b,index:void 0!==c?c:0})},applyMatrix:function(a){var b=\r\nthis.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new THREE.Matrix3).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0)},center:function(){},fromGeometry:function(a,b){b=b||{vertexColors:THREE.NoColors};var c=a.vertices,d=a.faces,e=a.faceVertexUvs,f=b.vertexColors,g=0<e[0].length,h=3==d[0].vertexNormals.length,k=new Float32Array(9*d.length);this.addAttribute("position",new THREE.BufferAttribute(k,3));var n=\r\nnew Float32Array(9*d.length);this.addAttribute("normal",new THREE.BufferAttribute(n,3));if(f!==THREE.NoColors){var p=new Float32Array(9*d.length);this.addAttribute("color",new THREE.BufferAttribute(p,3))}if(!0===g){var q=new Float32Array(6*d.length);this.addAttribute("uv",new THREE.BufferAttribute(q,2))}for(var m=0,t=0,s=0;m<d.length;m++,t+=6,s+=9){var r=d[m],u=c[r.a],v=c[r.b],y=c[r.c];k[s]=u.x;k[s+1]=u.y;k[s+2]=u.z;k[s+3]=v.x;k[s+4]=v.y;k[s+5]=v.z;k[s+6]=y.x;k[s+7]=y.y;k[s+8]=y.z;!0===h?(u=r.vertexNormals[0],\r\nv=r.vertexNormals[1],y=r.vertexNormals[2],n[s]=u.x,n[s+1]=u.y,n[s+2]=u.z,n[s+3]=v.x,n[s+4]=v.y,n[s+5]=v.z,n[s+6]=y.x,n[s+7]=y.y,n[s+8]=y.z):(u=r.normal,n[s]=u.x,n[s+1]=u.y,n[s+2]=u.z,n[s+3]=u.x,n[s+4]=u.y,n[s+5]=u.z,n[s+6]=u.x,n[s+7]=u.y,n[s+8]=u.z);f===THREE.FaceColors?(r=r.color,p[s]=r.r,p[s+1]=r.g,p[s+2]=r.b,p[s+3]=r.r,p[s+4]=r.g,p[s+5]=r.b,p[s+6]=r.r,p[s+7]=r.g,p[s+8]=r.b):f===THREE.VertexColors&&(u=r.vertexColors[0],v=r.vertexColors[1],r=r.vertexColors[2],p[s]=u.r,p[s+1]=u.g,p[s+2]=u.b,p[s+3]=\r\nv.r,p[s+4]=v.g,p[s+5]=v.b,p[s+6]=r.r,p[s+7]=r.g,p[s+8]=r.b);!0===g&&(r=e[0][m][0],u=e[0][m][1],v=e[0][m][2],q[t]=r.x,q[t+1]=r.y,q[t+2]=u.x,q[t+3]=u.y,q[t+4]=v.x,q[t+5]=v.y)}this.computeBoundingSphere();return this},computeBoundingBox:function(){var a=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var b=this.attributes.position.array;if(b){var c=this.boundingBox;c.makeEmpty();for(var d=0,e=b.length;d<e;d+=3)a.set(b[d],b[d+1],b[d+2]),c.expandByPoint(a)}if(void 0===\r\nb||0===b.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error(\'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.\')}}(),computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;\r\nif(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g);isNaN(this.boundingSphere.radius)&&console.error(\'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.\')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=\r\nthis.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,f,g,h,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3;if(a.index)for(var t=a.index.array,s=0<this.offsets.length?this.offsets:[{start:0,count:t.length,index:0}],r=0,u=s.length;r<u;++r){e=s[r].start;f=s[r].count;\r\nfor(var v=s[r].index,d=e,e=e+f;d<e;d+=3)f=3*(v+t[d]),g=3*(v+t[d+1]),h=3*(v+t[d+2]),k.fromArray(b,f),n.fromArray(b,g),p.fromArray(b,h),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[f]+=q.x,c[f+1]+=q.y,c[f+2]+=q.z,c[g]+=q.x,c[g+1]+=q.y,c[g+2]+=q.z,c[h]+=q.x,c[h+1]+=q.y,c[h+2]+=q.z}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),n.fromArray(b,d+3),p.fromArray(b,d+6),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[d]=q.x,c[d+1]=q.y,c[d+2]=q.z,c[d+3]=q.x,c[d+4]=q.y,c[d+5]=q.z,c[d+6]=q.x,c[d+7]=q.y,\r\nc[d+8]=q.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q.fromArray(d,3*a);m.fromArray(d,3*b);t.fromArray(d,3*c);s.fromArray(f,2*a);r.fromArray(f,2*b);u.fromArray(f,2*c);v=m.x-q.x;y=t.x-q.x;C=m.y-q.y;x=t.y-q.y;F=m.z-q.z;z=t.z-q.z;G=r.x-s.x;E=u.x-s.x;w=r.y-s.y;D=u.y-s.y;A=1/(G*D-E*w);U.set((D*v-w*y)*A,(D*C-w*x)*A,(D*F-w*z)*A);M.set((G*y-E*v)*A,(G*x-E*C)*A,(G*z-E*F)*A);k[a].add(U);k[b].add(U);k[c].add(U);n[a].add(M);n[b].add(M);n[c].add(M)}function b(a){xa.fromArray(e,\r\n3*a);H.copy(xa);qa=k[a];ga.copy(qa);ga.sub(xa.multiplyScalar(xa.dot(qa))).normalize();ea.crossVectors(H,qa);ya=ea.dot(n[a]);$a=0>ya?-1:1;h[4*a]=ga.x;h[4*a+1]=ga.y;h[4*a+2]=ga.z;h[4*a+3]=$a}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,\r\ne=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],n=[],p=0;p<g;p++)k[p]=new THREE.Vector3,n[p]=new THREE.Vector3;var q=new THREE.Vector3,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector2,r=new THREE.Vector2,u=new THREE.Vector2,v,y,C,x,F,z,G,E,w,D,A,U=new THREE.Vector3,M=new THREE.Vector3,K,L,N,T,Q;0===this.drawcalls.length&&\r\nthis.addDrawCall(0,c.length,0);var W=this.drawcalls,p=0;for(L=W.length;p<L;++p){K=W[p].start;N=W[p].count;var O=W[p].index,g=K;for(K+=N;g<K;g+=3)N=O+c[g],T=O+c[g+1],Q=O+c[g+2],a(N,T,Q)}var ga=new THREE.Vector3,ea=new THREE.Vector3,xa=new THREE.Vector3,H=new THREE.Vector3,$a,qa,ya,p=0;for(L=W.length;p<L;++p)for(K=W[p].start,N=W[p].count,O=W[p].index,g=K,K+=N;g<K;g+=3)N=O+c[g],T=O+c[g+1],Q=O+c[g+2],b(N),b(T),b(Q)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;\r\nfor(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),f=0,g=0,h=[{start:0,count:0,index:0}],k=h[0],n=0,p=0,q=new Int32Array(6),m=new Int32Array(c.length),t=new Int32Array(c.length),s=0;s<c.length;s++)m[s]=-1,t[s]=-1;for(c=0;c<d;c++){for(var r=p=0;3>r;r++)s=a[3*c+r],-1==m[s]?(q[2*r]=s,q[2*r+1]=-1,p++):m[s]<k.index?(q[2*r]=s,q[2*r+1]=-1,n++):(q[2*r]=s,q[2*r+1]=m[s]);if(g+p>k.index+b)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)r=q[p+1],-1<r&&r<k.index&&(q[p+1]=\r\n-1);for(p=0;6>p;p+=2)s=q[p],r=q[p+1],-1===r&&(r=g++),m[s]=r,t[r]=s,e[f++]=r-k.index,k.count++}this.reorderBuffers(e,t,g);return this.offsets=h},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,f=a.attributes[d],g=f.array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}},\r\nnormalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!=e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize*c));for(var f=0;f<c;f++){var g=b[f];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,n=d[e],p=0;p<k;p++)n[f*k+p]=h[g*\r\nk+p]}this.attributes.index.array=a;for(e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function(){var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes,c=this.offsets,d=this.boundingSphere,e;for(e in b){for(var f=b[e],g=[],h=f.array,k=0,n=h.length;k<n;k++)g[k]=h[k];a.data.attributes[e]={itemSize:f.itemSize,type:f.array.constructor.name,\r\narray:g}}0<c.length&&(a.data.offsets=JSON.parse(JSON.stringify(c)));null!==d&&(a.data.boundingSphere={center:d.center.toArray(),radius:d.radius});return a},clone:function(){var a=new THREE.BufferGeometry,b;for(b in this.attributes)a.addAttribute(b,this.attributes[b].clone());b=0;for(var c=this.offsets.length;b<c;b++){var d=this.offsets[b];a.offsets.push({start:d.start,index:d.index,count:d.count})}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);\r\nTHREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=\r\nthis.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1};\r\nTHREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){a=this.faces[c];a.normal.applyMatrix3(b).normalize();for(var e=0,f=a.vertexNormals.length;e<f;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox();this.boundingSphere instanceof THREE.Sphere&&this.computeBoundingSphere()},\r\nfromBufferGeometry:function(a){for(var b=this,c=a.attributes,d=c.position.array,e=void 0!==c.index?c.index.array:void 0,f=void 0!==c.normal?c.normal.array:void 0,g=void 0!==c.color?c.color.array:void 0,h=void 0!==c.uv?c.uv.array:void 0,k=[],n=[],p=c=0;c<d.length;c+=3,p+=2)b.vertices.push(new THREE.Vector3(d[c],d[c+1],d[c+2])),void 0!==f&&k.push(new THREE.Vector3(f[c],f[c+1],f[c+2])),void 0!==g&&b.colors.push(new THREE.Color(g[c],g[c+1],g[c+2])),void 0!==h&&n.push(new THREE.Vector2(h[p],h[p+1]));p=\r\nfunction(a,c,d){var e=void 0!==f?[k[a].clone(),k[c].clone(),k[d].clone()]:[],p=void 0!==g?[b.colors[a].clone(),b.colors[c].clone(),b.colors[d].clone()]:[];b.faces.push(new THREE.Face3(a,c,d,e,p));void 0!==h&&b.faceVertexUvs[0].push([n[a].clone(),n[c].clone(),n[d].clone()])};if(void 0!==e)for(c=0;c<e.length;c+=3)p(e[c],e[c+1],e[c+2]);else for(c=0;c<d.length/3;c+=3)p(c,c+1,c+2);this.computeFaceNormals();null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=\r\na.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();var a=new THREE.Vector3;a.addVectors(this.boundingBox.min,this.boundingBox.max);a.multiplyScalar(-.5);this.applyMatrix((new THREE.Matrix4).makeTranslation(a.x,a.y,a.z));this.computeBoundingBox();return a},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,\r\ng);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d;d=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new THREE.Vector3;if(a){var e,f,g,h=new THREE.Vector3,k=new THREE.Vector3;new THREE.Vector3;new THREE.Vector3;new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.subVectors(g,f),k.subVectors(e,f),h.cross(k),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(a=\r\n0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[2]=d[c.c].clone()},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=\r\ne.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var g=\r\nthis.morphNormals[a].vertexNormals,h,k;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,k={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),g.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<\r\nd;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v=[],y=[];c=new THREE.Vector3;var C=new THREE.Vector3,x=new THREE.Vector3,F=new THREE.Vector3,z=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)v[a]=new THREE.Vector3,y[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,g=this.vertices[d],h=this.vertices[u],k=this.vertices[e],\r\nn=f[0],p=f[1],q=f[2],f=h.x-g.x,m=k.x-g.x,t=h.y-g.y,s=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=p.x-n.x,r=q.x-n.x,p=p.y-n.y,n=q.y-n.y,q=1/(k*n-r*p),c.set((n*f-p*m)*q,(n*t-p*s)*q,(n*h-p*g)*q),C.set((k*m-r*f)*q,(k*s-r*t)*q,(k*g-r*h)*q),v[d].add(c),v[u].add(c),v[e].add(c),y[d].add(C),y[u].add(C),y[e].add(C);C=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)z.copy(e.vertexNormals[c]),d=e[C[c]],u=v[d],x.copy(u),x.sub(z.multiplyScalar(z.dot(u))).normalize(),\r\nF.crossVectors(e.vertexNormals[c],u),d=F.dot(y[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(x.x,x.y,x.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);\r\nthis.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(!1===a instanceof THREE.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a);else{var d,e=this.vertices.length,f=this.vertices,g=a.vertices,h=this.faces,k=a.faces,n=this.faceVertexUvs[0];a=a.faceVertexUvs[0];void 0===c&&(c=0);void 0!==b&&(d=(new THREE.Matrix3).getNormalMatrix(b));for(var p=0,q=g.length;p<q;p++){var m=g[p].clone();void 0!==b&&m.applyMatrix4(b);f.push(m)}p=0;for(q=k.length;p<\r\nq;p++){var g=k[p],t,s=g.vertexNormals,r=g.vertexColors,m=new THREE.Face3(g.a+e,g.b+e,g.c+e);m.normal.copy(g.normal);void 0!==d&&m.normal.applyMatrix3(d).normalize();b=0;for(f=s.length;b<f;b++)t=s[b].clone(),void 0!==d&&t.applyMatrix3(d).normalize(),m.vertexNormals.push(t);m.color.copy(g.color);b=0;for(f=r.length;b<f;b++)t=r[b],m.vertexColors.push(t.clone());m.materialIndex=g.materialIndex+c;h.push(m)}p=0;for(q=a.length;p<q;p++)if(c=a[p],d=[],void 0!==c){b=0;for(f=c.length;b<f;b++)d.push(c[b].clone());\r\nn.push(d)}}},mergeMesh:function(a){!1===a instanceof THREE.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a):(a.matrixAutoUpdate&&a.updateMatrix(),this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<\r\ng;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==n[b])return n[b];n[b]=k.length/3;k.push(a.x,a.y,\r\na.z);return n[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==q[b])return q[b];q[b]=p.length;p.push(a.getHex());return q[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==t[b])return t[b];t[b]=m.length/2;m.push(a.x,a.y);return t[b]}var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!==\r\nf[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],k=[],n={},p=[],q={},m=[],t={};for(g=0;g<this.faces.length;g++){var s=this.faces[g],r=void 0!==this.faceVertexUvs[0][g],u=0<s.normal.length(),v=0<s.vertexNormals.length,y=1!==s.color.r||1!==s.color.g||1!==s.color.b,C=0<s.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!1),x=a(x,2,!1),x=a(x,3,r),x=a(x,4,u),x=a(x,5,v),x=a(x,6,y),x=a(x,7,C);h.push(x);h.push(s.a,s.b,s.c);r&&(r=this.faceVertexUvs[0][g],\r\nh.push(d(r[0]),d(r[1]),d(r[2])));u&&h.push(b(s.normal));v&&(u=s.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));y&&h.push(c(s.color));C&&(s=s.vertexColors,h.push(c(s[0]),c(s[1]),c(s[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<p.length&&(e.data.colors=p);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());c=0;\r\nfor(d=this.faceVertexUvs.length;c<d;c++){b=this.faceVertexUvs[c];void 0===a.faceVertexUvs[c]&&(a.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],h=[],k=0,n=g.length;k<n;k++)h.push(g[k].clone());a.faceVertexUvs[c].push(h)}}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;\r\nTHREE.Camera=function(){THREE.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.getWorldDirection=function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,-1).applyQuaternion(a)}}();\r\nTHREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a};\r\nTHREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);this.type="CubeCamera";var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));\r\nthis.add(g);var h=new THREE.PerspectiveCamera(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var k=new THREE.PerspectiveCamera(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new THREE.Vector3(0,0,-1));this.add(k);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,m=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=\r\n1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,k,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CubeCamera.prototype.constructor=THREE.CubeCamera;\r\nTHREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.type="OrthographicCamera";this.zoom=1;this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;\r\nTHREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(c-a,c+a,d+b,d-b,this.near,this.far)};\r\nTHREE.OrthographicCamera.prototype.clone=function(){var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.zoom=this.zoom;a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;a.projectionMatrix.copy(this.projectionMatrix);return a};\r\nTHREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.type="PerspectiveCamera";this.zoom=1;this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;\r\nTHREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};\r\nTHREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var a=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var b=this.fullWidth/this.fullHeight,a=Math.tan(THREE.Math.degToRad(.5*a))*this.near,c=-a,d=b*c,b=Math.abs(b*a-d),c=Math.abs(a-c);this.projectionMatrix.makeFrustum(d+this.x*b/this.fullWidth,d+(this.x+this.width)*b/this.fullWidth,a-(this.y+this.height)*c/this.fullHeight,a-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(a,\r\nthis.aspect,this.near,this.far)};THREE.PerspectiveCamera.prototype.clone=function(){var a=new THREE.PerspectiveCamera;THREE.Camera.prototype.clone.call(this,a);a.zoom=this.zoom;a.fov=this.fov;a.aspect=this.aspect;a.near=this.near;a.far=this.far;a.projectionMatrix.copy(this.projectionMatrix);return a};THREE.Light=function(a){THREE.Object3D.call(this);this.type="Light";this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.constructor=THREE.Light;\r\nTHREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a);this.type="AmbientLight"};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a};\r\nTHREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.type="AreaLight";this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=.5;this.quadraticAttenuation=.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight.prototype.constructor=THREE.AreaLight;\r\nTHREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.type="DirectionalLight";this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;\r\nthis.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,.99,.998];this.shadowCascadeFarZ=[.99,.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;\r\nTHREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;a.shadowCameraNear=this.shadowCameraNear;a.shadowCameraFar=this.shadowCameraFar;a.shadowCameraLeft=this.shadowCameraLeft;a.shadowCameraRight=this.shadowCameraRight;a.shadowCameraTop=this.shadowCameraTop;a.shadowCameraBottom=this.shadowCameraBottom;a.shadowCameraVisible=\r\nthis.shadowCameraVisible;a.shadowBias=this.shadowBias;a.shadowDarkness=this.shadowDarkness;a.shadowMapWidth=this.shadowMapWidth;a.shadowMapHeight=this.shadowMapHeight;a.shadowCascade=this.shadowCascade;a.shadowCascadeOffset.copy(this.shadowCascadeOffset);a.shadowCascadeCount=this.shadowCascadeCount;a.shadowCascadeBias=this.shadowCascadeBias.slice(0);a.shadowCascadeWidth=this.shadowCascadeWidth.slice(0);a.shadowCascadeHeight=this.shadowCascadeHeight.slice(0);a.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0);\r\na.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0);return a};THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.type="HemisphereLight";this.position.set(0,100,0);this.groundColor=new THREE.Color(b);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight.prototype.constructor=THREE.HemisphereLight;\r\nTHREE.HemisphereLight.prototype.clone=function(){var a=new THREE.HemisphereLight;THREE.Light.prototype.clone.call(this,a);a.groundColor.copy(this.groundColor);a.intensity=this.intensity;return a};THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.type="PointLight";this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight.prototype.constructor=THREE.PointLight;\r\nTHREE.PointLight.prototype.clone=function(){var a=new THREE.PointLight;THREE.Light.prototype.clone.call(this,a);a.intensity=this.intensity;a.distance=this.distance;return a};\r\nTHREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.type="SpotLight";this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=\r\nthis.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.constructor=THREE.SpotLight;\r\nTHREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;a.shadowCameraNear=this.shadowCameraNear;a.shadowCameraFar=this.shadowCameraFar;a.shadowCameraFov=this.shadowCameraFov;a.shadowCameraVisible=this.shadowCameraVisible;a.shadowBias=this.shadowBias;a.shadowDarkness=\r\nthis.shadowDarkness;a.shadowMapWidth=this.shadowMapWidth;a.shadowMapHeight=this.shadowMapHeight;return a};THREE.Cache=function(){this.files={}};THREE.Cache.prototype={constructor:THREE.Cache,add:function(a,b){this.files[a]=b},get:function(a){return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};\r\nTHREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.imageLoader=new THREE.ImageLoader;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};\r\nTHREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/a.total).toFixed(0)+\r\n"%"):b+((a.loaded/1024).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=this.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function d(a,\r\nd,e,g,h,k,r){var u=b+e,v,y=THREE.Loader.Handlers.get(u);null!==y?v=y.load(u):(v=new THREE.Texture,y=f.imageLoader,y.crossOrigin=f.crossOrigin,y.load(u,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=c(a.width),d=c(a.height),e=document.createElement("canvas");e.width=b;e.height=d;e.getContext("2d").drawImage(a,0,0,b,d);v.image=e}else v.image=a;v.needsUpdate=!0}));v.sourceFile=e;g&&(v.repeat.set(g[0],g[1]),1!==g[0]&&(v.wrapS=THREE.RepeatWrapping),\r\n1!==g[1]&&(v.wrapT=THREE.RepeatWrapping));h&&v.offset.set(h[0],h[1]);k&&(e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==e[k[0]]&&(v.wrapS=e[k[0]]),void 0!==e[k[1]]&&(v.wrapT=e[k[1]]));r&&(v.anisotropy=r);a[d]=v}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var f=this,g="MeshLambertMaterial",h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":\r\n"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(h.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)h.transparent=a.transparent;void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===\r\na.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorAmbient&&(h.ambient=e(a.colorAmbient));a.colorEmissive&&(h.emissive=e(a.colorEmissive));a.transparency&&(h.opacity=a.transparency);a.specularCoef&&(h.shininess=a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,\r\na.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&d(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapAlpha&&\r\nb&&d(h,"alphaMap",a.mapAlpha,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);a.mapBumpScale&&(h.bumpScale=a.mapBumpScale);a.mapNormalFactor&&(h.normalScale=new THREE.Vector2(a.mapNormalFactor,a.mapNormalFactor));g=new THREE[g](h);void 0!==a.DbgName&&(g.name=a.DbgName);return g}};THREE.Loader.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=0,c=this.handlers.length;b<c;b+=2){var d=this.handlers[b+1];if(this.handlers[b].test(a))return d}return null}};\r\nTHREE.XHRLoader=function(a){this.cache=new THREE.Cache;this.manager=void 0!==a?a:THREE.DefaultLoadingManager};\r\nTHREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){var e=this,f=e.cache.get(a);void 0!==f?b&&b(f):(f=new XMLHttpRequest,f.open("GET",a,!0),f.addEventListener("load",function(c){e.cache.add(a,this.response);b&&b(this.response);e.manager.itemEnd(a)},!1),void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1),void 0!==d&&f.addEventListener("error",function(a){d(a)},!1),void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(f.responseType=\r\nthis.responseType),f.send(null),e.manager.itemStart(a))},setResponseType:function(a){this.responseType=a},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.ImageLoader=function(a){this.cache=new THREE.Cache;this.manager=void 0!==a?a:THREE.DefaultLoadingManager};\r\nTHREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=e.cache.get(a);if(void 0!==f)b(f);else return f=document.createElement("img"),void 0!==b&&f.addEventListener("load",function(c){e.cache.add(a,this);b(this);e.manager.itemEnd(a)},!1),void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1),void 0!==d&&f.addEventListener("error",function(a){d(a)},!1),void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin),f.src=a,e.manager.itemStart(a),f},setCrossOrigin:function(a){this.crossOrigin=\r\na}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};\r\nTHREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);if(void 0!==h.metadata&&"scene"===h.metadata.type){console.error(\'THREE.JSONLoader: "\'+b+\'" seems to be a Scene. Use THREE.SceneLoader instead.\');return}h=a.parse(h,d);c(h.geometry,h.materials)}else console.error(\'THREE.JSONLoader: "\'+b+\'" seems to be unreachable or the file is empty.\');\r\na.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn\'t load \\""+b+\'" (\'+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};\r\nTHREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,n,p,q,m,t,s,r,u,v,y=a.faces;p=a.vertices;var C=a.normals,x=a.colors,F=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&F++;for(d=0;d<F;d++)c.faceVertexUvs[d]=[]}k=0;for(n=p.length;k<n;)d=new THREE.Vector3,d.x=p[k++]*b,d.y=p[k++]*b,d.z=p[k++]*b,c.vertices.push(d);k=0;for(n=y.length;k<n;)if(b=y[k++],t=b&1,h=b&2,d=b&8,q=b&16,s=b&32,p=b&64,b&=128,t){t=new THREE.Face3;\r\nt.a=y[k];t.b=y[k+1];t.c=y[k+3];r=new THREE.Face3;r.a=y[k+1];r.b=y[k+2];r.c=y[k+3];k+=4;h&&(h=y[k++],t.materialIndex=h,r.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],v=new THREE.Vector2(v,m),2!==g&&c.faceVertexUvs[d][h].push(v),0!==g&&c.faceVertexUvs[d][h+1].push(v);q&&(q=3*y[k++],t.normal.set(C[q++],C[q++],C[q]),r.normal.copy(t.normal));if(s)for(d=0;4>d;d++)q=3*y[k++],s=new THREE.Vector3(C[q++],\r\nC[q++],C[q]),2!==d&&t.vertexNormals.push(s),0!==d&&r.vertexNormals.push(s);p&&(p=y[k++],p=x[p],t.color.setHex(p),r.color.setHex(p));if(b)for(d=0;4>d;d++)p=y[k++],p=x[p],2!==d&&t.vertexColors.push(new THREE.Color(p)),0!==d&&r.vertexColors.push(new THREE.Color(p));c.faces.push(t);c.faces.push(r)}else{t=new THREE.Face3;t.a=y[k++];t.b=y[k++];t.c=y[k++];h&&(h=y[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],\r\nv=new THREE.Vector2(v,m),c.faceVertexUvs[d][h].push(v);q&&(q=3*y[k++],t.normal.set(C[q++],C[q++],C[q]));if(s)for(d=0;3>d;d++)q=3*y[k++],s=new THREE.Vector3(C[q++],C[q++],C[q]),t.vertexNormals.push(s);p&&(p=y[k++],t.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=y[k++],t.vertexColors.push(new THREE.Color(x[p]));c.faces.push(t)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],\r\n1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+2]:0,3<b?a.skinWeights[d+3]:0));if(a.skinIndices)for(d=0,g=a.skinIndices.length;d<g;d+=b)c.skinIndices.push(new THREE.Vector4(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+\r\n"), and skinWeights ("+c.skinWeights.length+") should match.");c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,g,h,k,n,p;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],n=c.morphTargets[d].vertices,p=a.morphTargets[d].vertices,h=0,k=p.length;h<k;h+=3){var q=new THREE.Vector3;q.x=p[h]*b;q.y=p[h+1]*b;q.z=p[h+2]*b;n.push(q)}}if(void 0!==a.morphColors)for(d=\r\n0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,n=a.morphColors[d].colors,b=0,h=n.length;b<h;b+=3)p=new THREE.Color(16755200),p.setRGB(n[b],n[b+1],n[b+2]),k.push(p)})(d);c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials||0===a.materials.length)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};\r\nTHREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};\r\nTHREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d;for(d in c){var e=c[d],f=new self[e.type](e.array);b.addAttribute(d,new THREE.BufferAttribute(f,e.itemSize))}c=a.offsets;void 0!==c&&(b.offsets=JSON.parse(JSON.stringify(c)));\r\na=a.boundingSphere;void 0!==a&&(c=new THREE.Vector3,void 0!==a.center&&c.fromArray(a.center),b.boundingSphere=new THREE.Sphere(c,a.radius));return b}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};\r\nTHREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);\r\nvoid 0!==a.shininess&&(b.shininess=a.shininess);void 0!==a.uniforms&&(b.uniforms=a.uniforms);void 0!==a.vertexShader&&(b.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(b.fragmentShader=a.fragmentShader);void 0!==a.vertexColors&&(b.vertexColors=a.vertexColors);void 0!==a.shading&&(b.shading=a.shading);void 0!==a.blending&&(b.blending=a.blending);void 0!==a.side&&(b.side=a.side);void 0!==a.opacity&&(b.opacity=a.opacity);void 0!==a.transparent&&(b.transparent=a.transparent);void 0!==a.wireframe&&\r\n(b.wireframe=a.wireframe);if(void 0!==a.materials)for(var c=0,d=a.materials.length;c<d;c++)b.materials.push(this.parse(a.materials[c]));return b}};THREE.ObjectLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};\r\nTHREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=this.parseGeometries(a.geometries),c=this.parseMaterials(a.materials);return this.parseObject(a.object,b,c)},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=new THREE.BufferGeometryLoader,\r\ne=0,f=a.length;e<f;e++){var g,h=a[e];switch(h.type){case "PlaneGeometry":g=new THREE.PlaneGeometry(h.width,h.height,h.widthSegments,h.heightSegments);break;case "BoxGeometry":case "CubeGeometry":g=new THREE.BoxGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case "CircleGeometry":g=new THREE.CircleGeometry(h.radius,h.segments);break;case "CylinderGeometry":g=new THREE.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded);\r\nbreak;case "SphereGeometry":g=new THREE.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case "IcosahedronGeometry":g=new THREE.IcosahedronGeometry(h.radius,h.detail);break;case "TorusGeometry":g=new THREE.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case "TorusKnotGeometry":g=new THREE.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case "BufferGeometry":g=\r\nd.parse(h.data);break;case "Geometry":g=c.parse(h.data).geometry}g.uuid=h.uuid;void 0!==h.name&&(g.name=h.name);b[h.uuid]=g}return b},parseMaterials:function(a){var b={};if(void 0!==a)for(var c=new THREE.MaterialLoader,d=0,e=a.length;d<e;d++){var f=a[d],g=c.parse(f);g.uuid=f.uuid;void 0!==f.name&&(g.name=f.name);b[f.uuid]=g}return b},parseObject:function(){var a=new THREE.Matrix4;return function(b,c,d){var e;switch(b.type){case "Scene":e=new THREE.Scene;break;case "PerspectiveCamera":e=new THREE.PerspectiveCamera(b.fov,\r\nb.aspect,b.near,b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance);break;case "SpotLight":e=new THREE.SpotLight(b.color,b.intensity,b.distance,b.angle,b.exponent);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,\r\nb.groundColor,b.intensity);break;case "Mesh":e=c[b.geometry];var f=d[b.material];void 0===e&&console.warn("THREE.ObjectLoader: Undefined geometry",b.geometry);void 0===f&&console.warn("THREE.ObjectLoader: Undefined material",b.material);e=new THREE.Mesh(e,f);break;case "Line":e=c[b.geometry];f=d[b.material];void 0===e&&console.warn("THREE.ObjectLoader: Undefined geometry",b.geometry);void 0===f&&console.warn("THREE.ObjectLoader: Undefined material",b.material);e=new THREE.Line(e,f);break;case "Sprite":f=\r\nd[b.material];void 0===f&&console.warn("THREE.ObjectLoader: Undefined material",b.material);e=new THREE.Sprite(f);break;case "Group":e=new THREE.Group;break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=\r\nb.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var g in b.children)e.add(this.parseObject(b.children[g],c,d));return e}}()};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};\r\nTHREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b,c,d){var e=new THREE.ImageLoader(this.manager);e.setCrossOrigin(this.crossOrigin);e.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)},c,d)},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.DataTextureLoader=THREE.BinaryTextureLoader=function(){this._parser=null};\r\nTHREE.BinaryTextureLoader.prototype={constructor:THREE.BinaryTextureLoader,load:function(a,b,c,d){var e=this,f=new THREE.DataTexture,g=new THREE.XHRLoader;g.setResponseType("arraybuffer");g.load(a,function(a){if(a=e._parser(a))void 0!==a.image?f.image=a.image:void 0!==a.data&&(f.image.width=a.width,f.image.height=a.height,f.image.data=a.data),f.wrapS=void 0!==a.wrapS?a.wrapS:THREE.ClampToEdgeWrapping,f.wrapT=void 0!==a.wrapT?a.wrapT:THREE.ClampToEdgeWrapping,f.magFilter=void 0!==a.magFilter?a.magFilter:\r\nTHREE.LinearFilter,f.minFilter=void 0!==a.minFilter?a.minFilter:THREE.LinearMipMapLinearFilter,f.anisotropy=void 0!==a.anisotropy?a.anisotropy:1,void 0!==a.format&&(f.format=a.format),void 0!==a.type&&(f.type=a.type),void 0!==a.mipmaps&&(f.mipmaps=a.mipmaps),1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.needsUpdate=!0,b&&b(f,a)},c,d);return f}};THREE.CompressedTextureLoader=function(){this._parser=null};\r\nTHREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(a,b,c){var d=this,e=[],f=new THREE.CompressedTexture;f.image=e;var g=new THREE.XHRLoader;g.setResponseType("arraybuffer");if(a instanceof Array){var h=0;c=function(c){g.load(a[c],function(a){a=d._parser(a,!0);e[c]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps};h+=1;6===h&&(1==a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.format=a.format,f.needsUpdate=!0,b&&b(f))})};for(var k=0,n=\r\na.length;k<n;++k)c(k)}else g.load(a,function(a){a=d._parser(a,!0);if(a.isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,g=0;g<c;g++){e[g]={mipmaps:[]};for(var h=0;h<a.mipmapCount;h++)e[g].mipmaps.push(a.mipmaps[g*a.mipmapCount+h]),e[g].format=a.format,e[g].width=a.width,e[g].height=a.height}else f.image.width=a.width,f.image.height=a.height,f.mipmaps=a.mipmaps;1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter);f.format=a.format;f.needsUpdate=!0;b&&b(f)});return f}};\r\nTHREE.Material=function(){Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Material";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=\r\n0;this.needsUpdate=this.visible=!0};\r\nTHREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: \'"+b+"\' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},toJSON:function(){var a={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};""!==this.name&&\r\n(a.name=this.name);this instanceof THREE.MeshBasicMaterial?(a.color=this.color.getHex(),this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshLambertMaterial?(a.color=this.color.getHex(),a.ambient=this.ambient.getHex(),a.emissive=this.emissive.getHex(),this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&\r\n(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshPhongMaterial?(a.color=this.color.getHex(),a.ambient=this.ambient.getHex(),a.emissive=this.emissive.getHex(),a.specular=this.specular.getHex(),a.shininess=this.shininess,this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshNormalMaterial?(this.shading!==\r\nTHREE.FlatShading&&(a.shading=this.shading),this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshDepthMaterial?(this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.ShaderMaterial?(a.uniforms=this.uniforms,a.vertexShader=this.vertexShader,a.fragmentShader=this.fragmentShader):this instanceof THREE.SpriteMaterial&&(a.color=this.color.getHex());\r\n1>this.opacity&&(a.opacity=this.opacity);!1!==this.transparent&&(a.transparent=this.transparent);!1!==this.wireframe&&(a.wireframe=this.wireframe);return a},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=\r\nthis.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);THREE.MaterialIdCount=0;\r\nTHREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.type="LineBasicMaterial";this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=THREE.NoColors;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;\r\nTHREE.LineBasicMaterial.prototype.clone=function(){var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.linecap=this.linecap;a.linejoin=this.linejoin;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};\r\nTHREE.LineDashedMaterial=function(a){THREE.Material.call(this);this.type="LineDashedMaterial";this.color=new THREE.Color(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype);THREE.LineDashedMaterial.prototype.constructor=THREE.LineDashedMaterial;\r\nTHREE.LineDashedMaterial.prototype.clone=function(){var a=new THREE.LineDashedMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.scale=this.scale;a.dashSize=this.dashSize;a.gapSize=this.gapSize;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};\r\nTHREE.MeshBasicMaterial=function(a){THREE.Material.call(this);this.type="MeshBasicMaterial";this.color=new THREE.Color(16777215);this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphTargets=this.skinning=!1;this.setValues(a)};\r\nTHREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;\r\nTHREE.MeshBasicMaterial.prototype.clone=function(){var a=new THREE.MeshBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;\r\na.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;return a};\r\nTHREE.MeshLambertMaterial=function(a){THREE.Material.call(this);this.type="MeshLambertMaterial";this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.wrapAround=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=\r\n1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;\r\nTHREE.MeshLambertMaterial.prototype.clone=function(){var a=new THREE.MeshLambertMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;\r\na.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};\r\nTHREE.MeshPhongMaterial=function(a){THREE.Material.call(this);this.type="MeshPhongMaterial";this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.specular=new THREE.Color(1118481);this.shininess=30;this.wrapAround=this.metal=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.bumpMap=this.lightMap=this.map=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new THREE.Vector2(1,1);this.envMap=this.alphaMap=this.specularMap=null;this.combine=\r\nTHREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;\r\nTHREE.MeshPhongMaterial.prototype.clone=function(){var a=new THREE.MeshPhongMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.specular.copy(this.specular);a.shininess=this.shininess;a.metal=this.metal;a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.bumpMap=this.bumpMap;a.bumpScale=this.bumpScale;a.normalMap=this.normalMap;a.normalScale.copy(this.normalScale);\r\na.specularMap=this.specularMap;a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};\r\nTHREE.MeshDepthMaterial=function(a){THREE.Material.call(this);this.type="MeshDepthMaterial";this.wireframe=this.morphTargets=!1;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;\r\nTHREE.MeshDepthMaterial.prototype.clone=function(){var a=new THREE.MeshDepthMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);this.type="MeshNormalMaterial";this.shading=THREE.FlatShading;this.wireframe=!1;this.wireframeLinewidth=1;this.morphTargets=!1;this.setValues(a)};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype);\r\nTHREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshNormalMaterial.prototype.clone=function(){var a=new THREE.MeshNormalMaterial;THREE.Material.prototype.clone.call(this,a);a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshFaceMaterial=function(a){this.uuid=THREE.Math.generateUUID();this.type="MeshFaceMaterial";this.materials=a instanceof Array?a:[]};\r\nTHREE.MeshFaceMaterial.prototype={constructor:THREE.MeshFaceMaterial,toJSON:function(){for(var a={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},b=0,c=this.materials.length;b<c;b++)a.materials.push(this.materials[b].toJSON());return a},clone:function(){for(var a=new THREE.MeshFaceMaterial,b=0;b<this.materials.length;b++)a.materials.push(this.materials[b].clone());return a}};\r\nTHREE.PointCloudMaterial=function(a){THREE.Material.call(this);this.type="PointCloudMaterial";this.color=new THREE.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.vertexColors=THREE.NoColors;this.fog=!0;this.setValues(a)};THREE.PointCloudMaterial.prototype=Object.create(THREE.Material.prototype);THREE.PointCloudMaterial.prototype.constructor=THREE.PointCloudMaterial;\r\nTHREE.PointCloudMaterial.prototype.clone=function(){var a=new THREE.PointCloudMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleBasicMaterial=function(a){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.");return new THREE.PointCloudMaterial(a)};\r\nTHREE.ParticleSystemMaterial=function(a){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.");return new THREE.PointCloudMaterial(a)};\r\nTHREE.ShaderMaterial=function(a){THREE.Material.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.attributes=null;this.vertexShader="void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}";this.fragmentShader="void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}";this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=\r\nthis.morphTargets=this.skinning=!1;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;\r\nTHREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=\r\nthis.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.RawShaderMaterial=function(a){THREE.ShaderMaterial.call(this,a);this.type="RawShaderMaterial"};THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype);THREE.RawShaderMaterial.prototype.constructor=THREE.RawShaderMaterial;THREE.RawShaderMaterial.prototype.clone=function(){var a=new THREE.RawShaderMaterial;THREE.ShaderMaterial.prototype.clone.call(this,a);return a};\r\nTHREE.SpriteMaterial=function(a){THREE.Material.call(this);this.type="SpriteMaterial";this.color=new THREE.Color(16777215);this.map=null;this.rotation=0;this.fog=!1;this.setValues(a)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteMaterial.prototype.constructor=THREE.SpriteMaterial;\r\nTHREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.rotation=this.rotation;a.fog=this.fog;return a};\r\nTHREE.Texture=function(a,b,c,d,e,f,g,h,k){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.image=void 0!==a?a:THREE.Texture.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:THREE.Texture.DEFAULT_MAPPING;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=\r\nvoid 0!==k?k:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this._needsUpdate=!1;this.onUpdate=null};THREE.Texture.DEFAULT_IMAGE=void 0;THREE.Texture.DEFAULT_MAPPING=THREE.UVMapping;\r\nTHREE.Texture.prototype={constructor:THREE.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(a){!0===a&&this.update();this._needsUpdate=a},clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=\r\nthis.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=this.unpackAlignment;return a},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype);THREE.TextureIdCount=0;THREE.CubeTexture=function(a,b,c,d,e,f,g,h,k){b=void 0!==b?b:THREE.CubeReflectionMapping;THREE.Texture.call(this,a,b,c,d,e,f,g,h,k);this.images=a};\r\nTHREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CubeTexture.prototype.constructor=THREE.CubeTexture;THREE.CubeTexture.clone=function(a){void 0===a&&(a=new THREE.CubeTexture);THREE.Texture.prototype.clone.call(this,a);a.images=this.images;return a};THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,k,n,p){THREE.Texture.call(this,null,f,g,h,k,n,d,e,p);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);\r\nTHREE.CompressedTexture.prototype.constructor=THREE.CompressedTexture;THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,k,n,p){THREE.Texture.call(this,null,f,g,h,k,n,d,e,p);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.constructor=THREE.DataTexture;\r\nTHREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.VideoTexture=function(a,b,c,d,e,f,g,h,k){THREE.Texture.call(this,a,b,c,d,e,f,g,h,k);this.generateMipmaps=!1;var n=this,p=function(){requestAnimationFrame(p);a.readyState===a.HAVE_ENOUGH_DATA&&(n.needsUpdate=!0)};p()};THREE.VideoTexture.prototype=Object.create(THREE.Texture.prototype);THREE.VideoTexture.prototype.constructor=THREE.VideoTexture;\r\nTHREE.Group=function(){THREE.Object3D.call(this);this.type="Group"};THREE.Group.prototype=Object.create(THREE.Object3D.prototype);THREE.Group.prototype.constructor=THREE.Group;THREE.PointCloud=function(a,b){THREE.Object3D.call(this);this.type="PointCloud";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.PointCloudMaterial({color:16777215*Math.random()})};THREE.PointCloud.prototype=Object.create(THREE.Object3D.prototype);THREE.PointCloud.prototype.constructor=THREE.PointCloud;\r\nTHREE.PointCloud.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray;return function(c,d){var e=this,f=e.geometry,g=c.params.PointCloud.threshold;a.getInverse(this.matrixWorld);b.copy(c.ray).applyMatrix4(a);if(null===f.boundingBox||!1!==b.isIntersectionBox(f.boundingBox)){var h=g/((this.scale.x+this.scale.y+this.scale.z)/3),k=new THREE.Vector3,g=function(a,f){var g=b.distanceToPoint(a);if(g<h){var k=b.closestPointToPoint(a);k.applyMatrix4(e.matrixWorld);var m=c.ray.origin.distanceTo(k);\r\nd.push({distance:m,distanceToRay:g,point:k.clone(),index:f,face:null,object:e})}};if(f instanceof THREE.BufferGeometry){var n=f.attributes,p=n.position.array;if(void 0!==n.index){var n=n.index.array,q=f.offsets;0===q.length&&(q=[{start:0,count:n.length,index:0}]);for(var m=0,t=q.length;m<t;++m)for(var s=q[m].start,r=q[m].index,f=s,s=s+q[m].count;f<s;f++){var u=r+n[f];k.fromArray(p,3*u);g(k,u)}}else for(n=p.length/3,f=0;f<n;f++)k.set(p[3*f],p[3*f+1],p[3*f+2]),g(k,f)}else for(k=this.geometry.vertices,\r\nf=0;f<k.length;f++)g(k[f],f)}}}();THREE.PointCloud.prototype.clone=function(a){void 0===a&&(a=new THREE.PointCloud(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){console.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud.");return new THREE.PointCloud(a,b)};\r\nTHREE.Line=function(a,b,c){THREE.Object3D.call(this);this.type="Line";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.mode=void 0!==c?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);THREE.Line.prototype.constructor=THREE.Line;\r\nTHREE.Line.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere;return function(d,e){var f=d.linePrecision,f=f*f,g=this.geometry;null===g.boundingSphere&&g.computeBoundingSphere();c.copy(g.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==d.ray.isIntersectionSphere(c)){a.getInverse(this.matrixWorld);b.copy(d.ray).applyMatrix4(a);var h=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,q=this.mode===THREE.LineStrip?1:2;if(g instanceof\r\nTHREE.BufferGeometry){var m=g.attributes;if(void 0!==m.index){var t=m.index.array,m=m.position.array,s=g.offsets;0===s.length&&(s=[{start:0,count:t.length,index:0}]);for(var r=0;r<s.length;r++)for(var u=s[r].start,v=s[r].count,y=s[r].index,g=u;g<u+v-1;g+=q){var C=y+t[g+1];h.fromArray(m,3*(y+t[g]));k.fromArray(m,3*C);C=b.distanceSqToSegment(h,k,p,n);C>f||(C=b.origin.distanceTo(p),C<d.near||C>d.far||e.push({distance:C,point:n.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this}))}}else for(m=\r\nm.position.array,g=0;g<m.length/3-1;g+=q)h.fromArray(m,3*g),k.fromArray(m,3*g+3),C=b.distanceSqToSegment(h,k,p,n),C>f||(C=b.origin.distanceTo(p),C<d.near||C>d.far||e.push({distance:C,point:n.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this}))}else if(g instanceof THREE.Geometry)for(h=g.vertices,k=h.length,g=0;g<k-1;g+=q)C=b.distanceSqToSegment(h[g],h[g+1],p,n),C>f||(C=b.origin.distanceTo(p),C<d.near||C>d.far||e.push({distance:C,point:n.clone().applyMatrix4(this.matrixWorld),\r\nface:null,faceIndex:null,object:this}))}}}();THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.mode));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);\r\nTHREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};\r\nTHREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};\r\nTHREE.Mesh.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g,h){var k=this.geometry;null===k.boundingSphere&&k.computeBoundingSphere();c.copy(k.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==g.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(g.ray).applyMatrix4(a),null===k.boundingBox||!1!==b.isIntersectionBox(k.boundingBox)))if(k instanceof THREE.BufferGeometry){var n=\r\nthis.material;if(void 0!==n){var p=k.attributes,q,m,t=g.precision;if(void 0!==p.index){var s=p.index.array,r=p.position.array,u=k.offsets;0===u.length&&(u=[{start:0,count:s.length,index:0}]);for(var v=0,y=u.length;v<y;++v)for(var p=u[v].start,C=u[v].index,k=p,x=p+u[v].count;k<x;k+=3){p=C+s[k];q=C+s[k+1];m=C+s[k+2];d.fromArray(r,3*p);e.fromArray(r,3*q);f.fromArray(r,3*m);var F=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide);if(null!==F){F.applyMatrix4(this.matrixWorld);\r\nvar z=g.ray.origin.distanceTo(F);z<t||z<g.near||z>g.far||h.push({distance:z,point:F,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this})}}}else for(r=p.position.array,s=k=0,x=r.length;k<x;k+=3,s+=9)p=k,q=k+1,m=k+2,d.fromArray(r,s),e.fromArray(r,s+3),f.fromArray(r,s+6),F=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide),null!==F&&(F.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(F),z<t||z<g.near||z>\r\ng.far||h.push({distance:z,point:F,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(s=this.material instanceof THREE.MeshFaceMaterial,r=!0===s?this.material.materials:null,t=g.precision,u=k.vertices,v=0,y=k.faces.length;v<y;v++)if(C=k.faces[v],n=!0===s?r[C.materialIndex]:this.material,void 0!==n){p=u[C.a];q=u[C.b];m=u[C.c];if(!0===n.morphTargets){F=k.morphTargets;z=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);f.set(0,\r\n0,0);for(var x=0,G=F.length;x<G;x++){var E=z[x];if(0!==E){var w=F[x].vertices;d.x+=(w[C.a].x-p.x)*E;d.y+=(w[C.a].y-p.y)*E;d.z+=(w[C.a].z-p.z)*E;e.x+=(w[C.b].x-q.x)*E;e.y+=(w[C.b].y-q.y)*E;e.z+=(w[C.b].z-q.z)*E;f.x+=(w[C.c].x-m.x)*E;f.y+=(w[C.c].y-m.y)*E;f.z+=(w[C.c].z-m.z)*E}}d.add(p);e.add(q);f.add(m);p=d;q=e;m=f}F=n.side===THREE.BackSide?b.intersectTriangle(m,q,p,!0):b.intersectTriangle(p,q,m,n.side!==THREE.DoubleSide);null!==F&&(F.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(F),z<t||\r\nz<g.near||z>g.far||h.push({distance:z,point:F,face:C,faceIndex:v,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;\r\nTHREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),\r\nthis.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new THREE.Matrix4)};\r\nTHREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new THREE.Matrix4;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}};\r\nTHREE.Skeleton.prototype.pose=function(){for(var a,b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&a.matrixWorld.getInverse(this.boneInverses[b]);b=0;for(c=this.bones.length;b<c;b++)if(a=this.bones[b])a.parent?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale)};\r\nTHREE.Skeleton.prototype.update=function(){var a=new THREE.Matrix4;return function(){for(var b=0,c=this.bones.length;b<c;b++)a.multiplyMatrices(this.bones[b]?this.bones[b].matrixWorld:this.identityMatrix,this.boneInverses[b]),a.flattenToArrayOffset(this.boneMatrices,16*b);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}();\r\nTHREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new THREE.Matrix4;this.bindMatrixInverse=new THREE.Matrix4;a=[];if(this.geometry&&void 0!==this.geometry.bones){for(var d,e,f,g,h=0,k=this.geometry.bones.length;h<k;++h)d=this.geometry.bones[h],e=d.pos,f=d.rotq,g=d.scl,b=new THREE.Bone(this),a.push(b),b.name=d.name,b.position.set(e[0],e[1],e[2]),b.quaternion.set(f[0],f[1],f[2],f[3]),void 0!==g?b.scale.set(g[0],g[1],g[2]):b.scale.set(1,\r\n1,1);h=0;for(k=this.geometry.bones.length;h<k;++h)d=this.geometry.bones[h],-1!==d.parent?a[d.parent].add(a[h]):this.add(a[h])}this.normalizeSkinWeights();this.updateMatrixWorld(!0);this.bind(new THREE.Skeleton(a,void 0,c))};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.bind=function(a,b){this.skeleton=a;void 0===b&&(this.updateMatrixWorld(!0),b=this.matrixWorld);this.bindMatrix.copy(b);this.bindMatrixInverse.getInverse(b)};\r\nTHREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()};THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.skinWeights[a],c=1/b.lengthManhattan();Infinity!==c?b.multiplyScalar(c):b.set(1)}};\r\nTHREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){THREE.Mesh.prototype.updateMatrixWorld.call(this,!0);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)};\r\nTHREE.SkinnedMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture));THREE.Mesh.prototype.clone.call(this,a);return a};THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.type="MorphAnimMesh";this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype);\r\nTHREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=!0};\r\nTHREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)_?(\\d+)/,e=0,f=a.morphTargets.length;e<f;e++){var g=a.morphTargets[e].name.match(d);if(g&&1<g.length){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var h=c[g];e<h.start&&(h.start=e);e>h.end&&(h.end=e);b||(b=g)}}a.firstAnimation=b};\r\nTHREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=(c.end-c.start)/b*1E3,this.time=0):console.warn("animation["+a+"] undefined")};\r\nTHREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&&\r\n(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};\r\nTHREE.MorphAnimMesh.prototype.interpolateTargets=function(a,b,c){for(var d=this.morphTargetInfluences,e=0,f=d.length;e<f;e++)d[e]=0;-1<a&&(d[a]=1-c);-1<b&&(d[b]=c)};\r\nTHREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);\r\nTHREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);b=Math.abs(b);for(var c=0;c<this.objects.length&&!(b<this.objects[c].distance);c++);this.objects.splice(c,0,{distance:b,object:a});this.add(a)};THREE.LOD.prototype.getObjectForDistance=function(a){for(var b=1,c=this.objects.length;b<c&&!(a<this.objects[b].distance);b++);return this.objects[b-1].object};\r\nTHREE.LOD.prototype.raycast=function(){var a=new THREE.Vector3;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.origin.distanceTo(a);this.getObjectForDistance(d).raycast(b,c)}}();\r\nTHREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.setFromMatrixPosition(c.matrixWorld);b.setFromMatrixPosition(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d<e;d++)this.objects[d].object.visible=!1}}}();\r\nTHREE.LOD.prototype.clone=function(a){void 0===a&&(a=new THREE.LOD);THREE.Object3D.prototype.clone.call(this,a);for(var b=0,c=this.objects.length;b<c;b++){var d=this.objects[b].object.clone();d.visible=0===b;a.addLevel(d,this.objects[b].distance)}return a};\r\nTHREE.Sprite=function(){var a=new Uint16Array([0,1,2,0,2,3]),b=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),c=new Float32Array([0,0,1,0,1,1,0,1]),d=new THREE.BufferGeometry;d.addAttribute("index",new THREE.BufferAttribute(a,1));d.addAttribute("position",new THREE.BufferAttribute(b,3));d.addAttribute("uv",new THREE.BufferAttribute(c,2));return function(a){THREE.Object3D.call(this);this.type="Sprite";this.geometry=d;this.material=void 0!==a?a:new THREE.SpriteMaterial}}();\r\nTHREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.raycast=function(){var a=new THREE.Vector3;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.distanceToPoint(a);d>this.scale.x||c.push({distance:d,point:this.position,face:null,object:this})}}();THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};\r\nTHREE.Particle=THREE.Sprite;THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare.prototype.constructor=THREE.LensFlare;\r\nTHREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};\r\nTHREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=c.x*Math.PI*.25,c.rotation+=.25*(c.wantedRotation-c.rotation)};THREE.Scene=function(){THREE.Object3D.call(this);this.type="Scene";this.overrideMaterial=this.fog=null;this.autoUpdate=!0};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);\r\nTHREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};\r\nTHREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.ShaderChunk={};THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\\n\\n\\tif ( gl_FragColor.a < ALPHATEST ) discard;\\n\\n#endif\\n";THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\\n\\n#ifdef DOUBLE_SIDED\\n\\n\\tvLightBack = vec3( 0.0 );\\n\\n#endif\\n\\ntransformedNormal = normalize( transformedNormal );\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\\n\\n\\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\\n\\tvec3 dirVector = normalize( lDirection.xyz );\\n\\n\\tfloat dotProduct = dot( transformedNormal, dirVector );\\n\\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\\n\\n\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\\n\\n\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\\n\\n\\t\\t#endif\\n\\n\\t#endif\\n\\n\\t#ifdef WRAP_AROUND\\n\\n\\t\\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\\n\\t\\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\\n\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\\n\\n\\t\\t#endif\\n\\n\\t#endif\\n\\n\\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\\n\\n\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\\n\\n\\t#endif\\n\\n}\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\\n\\n\\t\\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\\n\\t\\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\\n\\n\\t\\tfloat lDistance = 1.0;\\n\\t\\tif ( pointLightDistance[ i ] > 0.0 )\\n\\t\\t\\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\\n\\n\\t\\tlVector = normalize( lVector );\\n\\t\\tfloat dotProduct = dot( transformedNormal, lVector );\\n\\n\\t\\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\\n\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\\n\\n\\t\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\t\\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t#endif\\n\\n\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\\n\\t\\t\\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\\n\\n\\t\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\t\\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t#endif\\n\\n\\t\\tvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\\n\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\\n\\n\\t\\t#endif\\n\\n\\t}\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\\n\\n\\t\\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\\n\\t\\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\\n\\n\\t\\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\\n\\n\\t\\tif ( spotEffect > spotLightAngleCos[ i ] ) {\\n\\n\\t\\t\\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\\n\\n\\t\\t\\tfloat lDistance = 1.0;\\n\\t\\t\\tif ( spotLightDistance[ i ] > 0.0 )\\n\\t\\t\\t\\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\\n\\n\\t\\t\\tlVector = normalize( lVector );\\n\\n\\t\\t\\tfloat dotProduct = dot( transformedNormal, lVector );\\n\\t\\t\\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\\n\\n\\t\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\t\\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\\n\\n\\t\\t\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\t\\t\\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\\n\\n\\t\\t\\t\\t#endif\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\t\\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\\n\\t\\t\\t\\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\\n\\n\\t\\t\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\t\\t\\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\\n\\n\\t\\t\\t\\t#endif\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t\\tvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\\n\\n\\t\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\t\\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t}\\n\\n\\t}\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\\n\\n\\t\\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\\n\\t\\tvec3 lVector = normalize( lDirection.xyz );\\n\\n\\t\\tfloat dotProduct = dot( transformedNormal, lVector );\\n\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\\n\\t\\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\\n\\n\\t\\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\\n\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\n\\t\\t\\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\\n\\n\\t\\t#endif\\n\\n\\t}\\n\\n#endif\\n\\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\\n\\n#ifdef DOUBLE_SIDED\\n\\n\\tvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\\n\\n#endif";\r\nTHREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\\n\\n\\tuniform sampler2D map;\\n\\n#endif";THREE.ShaderChunk.default_vertex="#ifdef USE_SKINNING\\n\\n\\tvec4 mvPosition = modelViewMatrix * skinned;\\n\\n#elif defined( USE_MORPHTARGETS )\\n\\n\\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\\n\\n#else\\n\\n\\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\\n\\n#endif\\n\\ngl_Position = projectionMatrix * mvPosition;\\n";THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\\n\\n\\tvarying vec2 vUv;\\n\\n#endif\\n\\n#ifdef USE_MAP\\n\\n\\tuniform sampler2D map;\\n\\n#endif";\r\nTHREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\\n\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\n\\t#ifdef USE_MORPHNORMALS\\n\\n\\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\\n\\n\\t#else\\n\\n\\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\\n\\n\\t#endif\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\\n\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\n\\t\\tvarying float vFragDepth;\\n\\n\\t#endif\\n\\n\\tuniform float logDepthBufFC;\\n\\n#endif";THREE.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\\n\\n\\tvarying vec2 vUv2;\\n\\n#endif";THREE.ShaderChunk.lights_phong_fragment="vec3 normal = normalize( vNormal );\\nvec3 viewPosition = normalize( vViewPosition );\\n\\n#ifdef DOUBLE_SIDED\\n\\n\\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\\n\\n#endif\\n\\n#ifdef USE_NORMALMAP\\n\\n\\tnormal = perturbNormal2Arb( -vViewPosition, normal );\\n\\n#elif defined( USE_BUMPMAP )\\n\\n\\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\\tvec3 pointDiffuse = vec3( 0.0 );\\n\\tvec3 pointSpecular = vec3( 0.0 );\\n\\n\\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\\n\\n\\t\\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\\n\\t\\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\\n\\n\\t\\tfloat lDistance = 1.0;\\n\\t\\tif ( pointLightDistance[ i ] > 0.0 )\\n\\t\\t\\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\\n\\n\\t\\tlVector = normalize( lVector );\\n\\n\\t\\t\\t\\t// diffuse\\n\\n\\t\\tfloat dotProduct = dot( normal, lVector );\\n\\n\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\\n\\t\\t\\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\\n\\n\\t\\t\\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\\n\\n\\t\\t#else\\n\\n\\t\\t\\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\\n\\n\\t\\t#endif\\n\\n\\t\\tpointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\\n\\n\\t\\t\\t\\t// specular\\n\\n\\t\\tvec3 pointHalfVector = normalize( lVector + viewPosition );\\n\\t\\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\\n\\t\\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\\n\\n\\t\\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\\t\\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\\n\\t\\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\\n\\n\\t}\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\\tvec3 spotDiffuse = vec3( 0.0 );\\n\\tvec3 spotSpecular = vec3( 0.0 );\\n\\n\\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\\n\\n\\t\\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\\n\\t\\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\\n\\n\\t\\tfloat lDistance = 1.0;\\n\\t\\tif ( spotLightDistance[ i ] > 0.0 )\\n\\t\\t\\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\\n\\n\\t\\tlVector = normalize( lVector );\\n\\n\\t\\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\\n\\n\\t\\tif ( spotEffect > spotLightAngleCos[ i ] ) {\\n\\n\\t\\t\\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\\n\\n\\t\\t\\t\\t\\t// diffuse\\n\\n\\t\\t\\tfloat dotProduct = dot( normal, lVector );\\n\\n\\t\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\t\\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\\n\\t\\t\\t\\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\\n\\n\\t\\t\\t\\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\\n\\n\\t\\t\\t#else\\n\\n\\t\\t\\t\\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t\\tspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\\n\\n\\t\\t\\t\\t\\t// specular\\n\\n\\t\\t\\tvec3 spotHalfVector = normalize( lVector + viewPosition );\\n\\t\\t\\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\\n\\t\\t\\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\\n\\n\\t\\t\\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\\t\\t\\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\\n\\t\\t\\tspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\\n\\n\\t\\t}\\n\\n\\t}\\n\\n#endif\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\\tvec3 dirDiffuse = vec3( 0.0 );\\n\\tvec3 dirSpecular = vec3( 0.0 );\\n\\n\\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\\n\\n\\t\\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\\n\\t\\tvec3 dirVector = normalize( lDirection.xyz );\\n\\n\\t\\t\\t\\t// diffuse\\n\\n\\t\\tfloat dotProduct = dot( normal, dirVector );\\n\\n\\t\\t#ifdef WRAP_AROUND\\n\\n\\t\\t\\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\\n\\t\\t\\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\\n\\n\\t\\t\\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\\n\\n\\t\\t#else\\n\\n\\t\\t\\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\\n\\n\\t\\t#endif\\n\\n\\t\\tdirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\\n\\n\\t\\t// specular\\n\\n\\t\\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\\n\\t\\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\\n\\t\\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\\n\\n\\t\\t/*\\n\\t\\t// fresnel term from skin shader\\n\\t\\tconst float F0 = 0.128;\\n\\n\\t\\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\\n\\t\\tfloat exponential = pow( base, 5.0 );\\n\\n\\t\\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\\n\\t\\t*/\\n\\n\\t\\t/*\\n\\t\\t// fresnel term from fresnel shader\\n\\t\\tconst float mFresnelBias = 0.08;\\n\\t\\tconst float mFresnelScale = 0.3;\\n\\t\\tconst float mFresnelPower = 5.0;\\n\\n\\t\\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\\n\\t\\t*/\\n\\n\\t\\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\\t\\t// \\t\\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\\n\\n\\t\\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\\n\\t\\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\\n\\n\\n\\t}\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\\tvec3 hemiDiffuse = vec3( 0.0 );\\n\\tvec3 hemiSpecular = vec3( 0.0 );\\n\\n\\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\\n\\n\\t\\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\\n\\t\\tvec3 lVector = normalize( lDirection.xyz );\\n\\n\\t\\t// diffuse\\n\\n\\t\\tfloat dotProduct = dot( normal, lVector );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\\n\\n\\t\\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\\n\\n\\t\\themiDiffuse += diffuse * hemiColor;\\n\\n\\t\\t// specular (sky light)\\n\\n\\t\\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\\n\\t\\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\\n\\t\\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\\n\\n\\t\\t// specular (ground light)\\n\\n\\t\\tvec3 lVectorGround = -lVector;\\n\\n\\t\\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\\n\\t\\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\\n\\t\\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\\n\\n\\t\\tfloat dotProductGround = dot( normal, lVectorGround );\\n\\n\\t\\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\\t\\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\\n\\t\\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\\n\\t\\themiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\\n\\n\\t}\\n\\n#endif\\n\\nvec3 totalDiffuse = vec3( 0.0 );\\nvec3 totalSpecular = vec3( 0.0 );\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\\ttotalDiffuse += dirDiffuse;\\n\\ttotalSpecular += dirSpecular;\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\\ttotalDiffuse += hemiDiffuse;\\n\\ttotalSpecular += hemiSpecular;\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\\ttotalDiffuse += pointDiffuse;\\n\\ttotalSpecular += pointSpecular;\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\\ttotalDiffuse += spotDiffuse;\\n\\ttotalSpecular += spotSpecular;\\n\\n#endif\\n\\n#ifdef METAL\\n\\n\\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\\n\\n#else\\n\\n\\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\\n\\n#endif";\r\nTHREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\\n\\n\\tuniform vec3 fogColor;\\n\\n\\t#ifdef FOG_EXP2\\n\\n\\t\\tuniform float fogDensity;\\n\\n\\t#else\\n\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n\\n#endif";THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\\n\\n\\tvec3 morphedNormal = vec3( 0.0 );\\n\\n\\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\\n\\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\\n\\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\\n\\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\\n\\n\\tmorphedNormal += normal;\\n\\n#endif";\r\nTHREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\\n\\n\\tuniform float reflectivity;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\tuniform float flipEnvMap;\\n\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\\n\\n\\t\\tuniform float refractionRatio;\\n\\n\\t#else\\n\\n\\t\\tvarying vec3 vReflect;\\n\\n\\t#endif\\n\\n#endif\\n";THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\\n\\n\\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\\n\\n#endif";\r\nTHREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\\n\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n\\n\\t\\t\\t// Per-Pixel Tangent Space Normal Mapping\\n\\t\\t\\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\\n\\n\\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\\n\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( vUv.st );\\n\\t\\tvec2 st1 = dFdy( vUv.st );\\n\\n\\t\\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\\n\\t\\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\\n\\t\\tvec3 N = normalize( surf_norm );\\n\\n\\t\\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\\n\\t\\tmapN.xy = normalScale * mapN.xy;\\n\\t\\tmat3 tsn = mat3( S, T, N );\\n\\t\\treturn normalize( tsn * mapN );\\n\\n\\t}\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\\n\\n\\tvarying vec3 vWorldPosition;\\n\\n#endif\\n";THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\\n\\n\\tvarying vec2 vUv2;\\n\\tuniform sampler2D lightMap;\\n\\n#endif";THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\\n\\n\\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\\n\\n\\t\\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\\n\\n\\t}\\n\\n#endif";\r\nTHREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\\n\\n\\tvWorldPosition = worldPosition.xyz;\\n\\n#endif";THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\\n\\n\\tvec4 texelColor = texture2D( map, vUv );\\n\\n\\t#ifdef GAMMA_INPUT\\n\\n\\t\\ttexelColor.xyz *= texelColor.xyz;\\n\\n\\t#endif\\n\\n\\tgl_FragColor = gl_FragColor * texelColor;\\n\\n#endif";THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\\n\\n\\tvUv2 = uv2;\\n\\n#endif";\r\nTHREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\\n\\n\\tgl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\\n\\n#endif";THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\\n\\n\\tvarying vec3 vColor;\\n\\n#endif\\n";THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\\n\\n\\t#ifdef GAMMA_INPUT\\n\\n\\t\\tvColor = color * color;\\n\\n\\t#else\\n\\n\\t\\tvColor = color;\\n\\n\\t#endif\\n\\n#endif";THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\\n\\n\\t#ifdef USE_MORPHTARGETS\\n\\n\\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\\n\\n\\t#else\\n\\n\\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\\n\\n\\t#endif\\n\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\tskinned  = bindMatrixInverse * skinned;\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\\n\\n\\tvarying vec3 vReflect;\\n\\n\\tuniform float refractionRatio;\\n\\n#endif\\n";THREE.ShaderChunk.linear_to_gamma_fragment="#ifdef GAMMA_OUTPUT\\n\\n\\tgl_FragColor.xyz = sqrt( gl_FragColor.xyz );\\n\\n#endif";THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\\n\\n\\tvarying vec3 vColor;\\n\\n#endif";THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambient;\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\n\\nuniform vec3 ambientLightColor;\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\\n\\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\\n\\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\\n\\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\\n\\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\\n\\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\\n\\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\\n\\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\\n\\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\\n\\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\\n\\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\\n\\n#endif\\n\\n#ifdef WRAP_AROUND\\n\\n\\tuniform vec3 wrapRGB;\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\\n\\n\\tvarying vec2 vUv;\\n\\tuniform vec4 offsetRepeat;\\n\\n#endif\\n";THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\\n\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\\n\\n\\t\\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\\n\\n\\t\\t// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\\n\\t\\t// Transforming Normal Vectors with the Inverse Transformation\\n\\n\\t\\tvec3 worldNormal = normalize( vec3( vec4( normal, 0.0 ) * viewMatrix ) );\\n\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\\n\\n\\t\\t#else\\n\\n\\t\\t\\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\n\\t\\t#endif\\n\\n\\t#else\\n\\n\\t\\tvec3 reflectVec = vReflect;\\n\\n\\t#endif\\n\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\\n\\t#else\\n\\t\\tfloat flipNormal = 1.0;\\n\\t#endif\\n\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\n\\t#elif defined( ENVMAP_TYPE_EQUIREC )\\n\\t\\tvec2 sampleUV;\\n\\t\\tsampleUV.y = clamp( flipNormal * reflectVec.y * 0.5 + 0.5, 0.0, 1.0);\\n\\t\\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * 0.15915494309189533576888376337251 + 0.5; // reciprocal( 2 PI ) + 0.5\\n\\t\\tvec4 envColor = texture2D( envMap, sampleUV );\\n\\t\\t\\n\\t#elif defined( ENVMAP_TYPE_SPHERE )\\n\\t\\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\\n\\t\\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\\n\\t#endif\\n\\n\\t#ifdef GAMMA_INPUT\\n\\n\\t\\tenvColor.xyz *= envColor.xyz;\\n\\n\\t#endif\\n\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\n\\t\\tgl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * envColor.xyz, specularStrength * reflectivity );\\n\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\n\\t\\tgl_FragColor.xyz = mix( gl_FragColor.xyz, envColor.xyz, specularStrength * reflectivity );\\n\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\n\\t\\tgl_FragColor.xyz += envColor.xyz * specularStrength * reflectivity;\\n\\n\\t#endif\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\\n\\n\\tuniform sampler2D specularMap;\\n\\n#endif";THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\\n\\n\\tgl_Position.z = log2(max(1e-6, gl_Position.w + 1.0)) * logDepthBufFC;\\n\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\n\\t\\tvFragDepth = 1.0 + gl_Position.w;\\n\\n#else\\n\\n\\t\\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\\n\\n\\t#endif\\n\\n#endif";THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\\n\\n\\t#ifndef USE_MORPHNORMALS\\n\\n\\tuniform float morphTargetInfluences[ 8 ];\\n\\n\\t#else\\n\\n\\tuniform float morphTargetInfluences[ 4 ];\\n\\n\\t#endif\\n\\n#endif";\r\nTHREE.ShaderChunk.specularmap_fragment="float specularStrength;\\n\\n#ifdef USE_SPECULARMAP\\n\\n\\tvec4 texelSpecular = texture2D( specularMap, vUv );\\n\\tspecularStrength = texelSpecular.r;\\n\\n#else\\n\\n\\tspecularStrength = 1.0;\\n\\n#endif";THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\\n\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\n\\t\\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\\n\\n\\t#else\\n\\n\\t\\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\\n\\n\\t#endif\\n\\n\\t#ifdef FOG_EXP2\\n\\n\\t\\tconst float LOG2 = 1.442695;\\n\\t\\tfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\\n\\t\\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\\n\\n\\t#else\\n\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\\n\\n\\t#endif\\n\\t\\n\\tgl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\\n\\n#endif";\r\nTHREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\\n\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\n\\t\\t\\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\\n\\t\\t\\t//\\thttp://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\\n\\n\\t\\t\\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\\n\\n\\tvec2 dHdxy_fwd() {\\n\\n\\t\\tvec2 dSTdx = dFdx( vUv );\\n\\t\\tvec2 dSTdy = dFdy( vUv );\\n\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\\n\\n\\t\\treturn vec2( dBx, dBy );\\n\\n\\t}\\n\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\\n\\n\\t\\tvec3 vSigmaX = dFdx( surf_pos );\\n\\t\\tvec3 vSigmaY = dFdy( surf_pos );\\n\\t\\tvec3 vN = surf_norm;\\t\\t// normalized\\n\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\n\\t\\tfloat fDet = dot( vSigmaX, R1 );\\n\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\n\\t}\\n\\n#endif";\r\nTHREE.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\\n\\n\\tvec3 objectNormal = skinnedNormal.xyz;\\n\\n#elif defined( USE_MORPHNORMALS )\\n\\n\\tvec3 objectNormal = morphedNormal;\\n\\n#else\\n\\n\\tvec3 objectNormal = normal;\\n\\n#endif\\n\\n#ifdef FLIP_SIDED\\n\\n\\tobjectNormal = -objectNormal;\\n\\n#endif\\n\\nvec3 transformedNormal = normalMatrix * objectNormal;\\n";THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\\n\\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\\n\\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\\n\\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\\n\\n\\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\\n\\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\\n\\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\\n\\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\\n\\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\\n\\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\\n\\n\\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\\n\\n\\tvarying vec3 vWorldPosition;\\n\\n#endif\\n\\n#ifdef WRAP_AROUND\\n\\n\\tuniform vec3 wrapRGB;\\n\\n#endif\\n\\nvarying vec3 vViewPosition;\\nvarying vec3 vNormal;";\r\nTHREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\\n\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n\\n#endif";THREE.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\\n\\n\\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\\n\\n#endif";\r\nTHREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\\n\\n\\tgl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\\n\\n#endif";THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\\n\\n\\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\\n\\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\\n\\n#endif";THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\\n\\n\\tgl_FragColor = gl_FragColor * vec4( vColor, 1.0 );\\n\\n#endif";THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\\n\\n\\tvec3 morphed = vec3( 0.0 );\\n\\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\\n\\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\\n\\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\\n\\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\\n\\n\\t#ifndef USE_MORPHNORMALS\\n\\n\\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\\n\\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\\n\\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\\n\\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\\n\\n\\t#endif\\n\\n\\tmorphed += position;\\n\\n#endif";\r\nTHREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\\n\\n\\tvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\\n\\tworldNormal = normalize( worldNormal );\\n\\n\\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\n\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\n\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\n\\t#else\\n\\n\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\n\\t#endif\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\\n\\n\\t#ifdef SHADOWMAP_DEBUG\\n\\n\\t\\tvec3 frustumColors[3];\\n\\t\\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\\n\\t\\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\\n\\t\\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\\n\\n\\t#endif\\n\\n\\t#ifdef SHADOWMAP_CASCADE\\n\\n\\t\\tint inFrustumCount = 0;\\n\\n\\t#endif\\n\\n\\tfloat fDepth;\\n\\tvec3 shadowColor = vec3( 1.0 );\\n\\n\\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\\n\\n\\t\\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\\n\\n\\t\\t\\t\\t// if ( something && something ) breaks ATI OpenGL shader compiler\\n\\t\\t\\t\\t// if ( all( something, something ) ) using this instead\\n\\n\\t\\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\\n\\t\\tbool inFrustum = all( inFrustumVec );\\n\\n\\t\\t\\t\\t// don\'t shadow pixels outside of light frustum\\n\\t\\t\\t\\t// use just first frustum (for cascades)\\n\\t\\t\\t\\t// don\'t shadow pixels behind far plane of light frustum\\n\\n\\t\\t#ifdef SHADOWMAP_CASCADE\\n\\n\\t\\t\\tinFrustumCount += int( inFrustum );\\n\\t\\t\\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\\n\\n\\t\\t#else\\n\\n\\t\\t\\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\\n\\n\\t\\t#endif\\n\\n\\t\\tbool frustumTest = all( frustumTestVec );\\n\\n\\t\\tif ( frustumTest ) {\\n\\n\\t\\t\\tshadowCoord.z += shadowBias[ i ];\\n\\n\\t\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\n\\t\\t\\t\\t\\t\\t// Percentage-close filtering\\n\\t\\t\\t\\t\\t\\t// (9 pixel kernel)\\n\\t\\t\\t\\t\\t\\t// http://fabiensanglard.net/shadowmappingPCF/\\n\\n\\t\\t\\t\\tfloat shadow = 0.0;\\n\\n\\t\\t/*\\n\\t\\t\\t\\t\\t\\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\\n\\t\\t\\t\\t\\t\\t// must enroll loop manually\\n\\n\\t\\t\\t\\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\\n\\t\\t\\t\\t\\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\\n\\n\\t\\t\\t\\t\\t\\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t// doesn\'t seem to produce any noticeable visual difference compared to simple texture2D lookup\\n\\t\\t\\t\\t\\t\\t\\t\\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\\n\\n\\t\\t\\t\\t\\t\\tfloat fDepth = unpackDepth( rgbaDepth );\\n\\n\\t\\t\\t\\t\\t\\tif ( fDepth < shadowCoord.z )\\n\\t\\t\\t\\t\\t\\t\\tshadow += 1.0;\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\tshadow /= 9.0;\\n\\n\\t\\t*/\\n\\n\\t\\t\\t\\tconst float shadowDelta = 1.0 / 9.0;\\n\\n\\t\\t\\t\\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\\n\\t\\t\\t\\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\\n\\n\\t\\t\\t\\tfloat dx0 = -1.25 * xPixelOffset;\\n\\t\\t\\t\\tfloat dy0 = -1.25 * yPixelOffset;\\n\\t\\t\\t\\tfloat dx1 = 1.25 * xPixelOffset;\\n\\t\\t\\t\\tfloat dy1 = 1.25 * yPixelOffset;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\\t\\t\\t\\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\\n\\n\\t\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\n\\t\\t\\t\\t\\t\\t// Percentage-close filtering\\n\\t\\t\\t\\t\\t\\t// (9 pixel kernel)\\n\\t\\t\\t\\t\\t\\t// http://fabiensanglard.net/shadowmappingPCF/\\n\\n\\t\\t\\t\\tfloat shadow = 0.0;\\n\\n\\t\\t\\t\\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\\n\\t\\t\\t\\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\\n\\n\\t\\t\\t\\tfloat dx0 = -1.0 * xPixelOffset;\\n\\t\\t\\t\\tfloat dy0 = -1.0 * yPixelOffset;\\n\\t\\t\\t\\tfloat dx1 = 1.0 * xPixelOffset;\\n\\t\\t\\t\\tfloat dy1 = 1.0 * yPixelOffset;\\n\\n\\t\\t\\t\\tmat3 shadowKernel;\\n\\t\\t\\t\\tmat3 depthKernel;\\n\\n\\t\\t\\t\\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\\n\\t\\t\\t\\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\\n\\t\\t\\t\\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\\n\\t\\t\\t\\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\\n\\t\\t\\t\\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\\n\\t\\t\\t\\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\\n\\t\\t\\t\\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\\n\\t\\t\\t\\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\\n\\t\\t\\t\\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\\n\\n\\t\\t\\t\\tvec3 shadowZ = vec3( shadowCoord.z );\\n\\t\\t\\t\\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\\n\\t\\t\\t\\tshadowKernel[0] *= vec3(0.25);\\n\\n\\t\\t\\t\\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\\n\\t\\t\\t\\tshadowKernel[1] *= vec3(0.25);\\n\\n\\t\\t\\t\\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\\n\\t\\t\\t\\tshadowKernel[2] *= vec3(0.25);\\n\\n\\t\\t\\t\\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\\n\\n\\t\\t\\t\\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\\n\\t\\t\\t\\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\\n\\n\\t\\t\\t\\tvec4 shadowValues;\\n\\t\\t\\t\\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\\n\\t\\t\\t\\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\\n\\t\\t\\t\\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\\n\\t\\t\\t\\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\\n\\n\\t\\t\\t\\tshadow = dot( shadowValues, vec4( 1.0 ) );\\n\\n\\t\\t\\t\\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\\n\\n\\t\\t\\t#else\\n\\n\\t\\t\\t\\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\\n\\t\\t\\t\\tfloat fDepth = unpackDepth( rgbaDepth );\\n\\n\\t\\t\\t\\tif ( fDepth < shadowCoord.z )\\n\\n\\t\\t// spot with multiple shadows is darker\\n\\n\\t\\t\\t\\t\\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\\n\\n\\t\\t// spot with multiple shadows has the same color as single shadow spot\\n\\n\\t\\t// \\t\\t\\t\\t\\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t}\\n\\n\\n\\t\\t#ifdef SHADOWMAP_DEBUG\\n\\n\\t\\t\\t#ifdef SHADOWMAP_CASCADE\\n\\n\\t\\t\\t\\tif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\\n\\n\\t\\t\\t#else\\n\\n\\t\\t\\t\\tif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\\n\\n\\t\\t\\t#endif\\n\\n\\t\\t#endif\\n\\n\\t}\\n\\n\\t#ifdef GAMMA_OUTPUT\\n\\n\\t\\tshadowColor *= shadowColor;\\n\\n\\t#endif\\n\\n\\tgl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\\n\\n\\t#ifdef USE_SKINNING\\n\\n\\t\\tvec4 worldPosition = modelMatrix * skinned;\\n\\n\\t#elif defined( USE_MORPHTARGETS )\\n\\n\\t\\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\\n\\n\\t#else\\n\\n\\t\\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\\n\\n\\t#endif\\n\\n#endif\\n";THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\\n\\n\\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\\n\\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\\n\\n\\tuniform float shadowDarkness[ MAX_SHADOWS ];\\n\\tuniform float shadowBias[ MAX_SHADOWS ];\\n\\n\\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\\n\\n\\tfloat unpackDepth( const in vec4 rgba_depth ) {\\n\\n\\t\\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\\n\\t\\tfloat depth = dot( rgba_depth, bit_shift );\\n\\t\\treturn depth;\\n\\n\\t}\\n\\n#endif";\r\nTHREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\\n\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\n\\t#ifdef BONE_TEXTURE\\n\\n\\t\\tuniform sampler2D boneTexture;\\n\\t\\tuniform int boneTextureWidth;\\n\\t\\tuniform int boneTextureHeight;\\n\\n\\t\\tmat4 getBoneMatrix( const in float i ) {\\n\\n\\t\\t\\tfloat j = i * 4.0;\\n\\t\\t\\tfloat x = mod( j, float( boneTextureWidth ) );\\n\\t\\t\\tfloat y = floor( j / float( boneTextureWidth ) );\\n\\n\\t\\t\\tfloat dx = 1.0 / float( boneTextureWidth );\\n\\t\\t\\tfloat dy = 1.0 / float( boneTextureHeight );\\n\\n\\t\\t\\ty = dy * ( y + 0.5 );\\n\\n\\t\\t\\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\\t\\t\\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\\t\\t\\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\\t\\t\\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\\n\\t\\t\\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\\n\\t\\t\\treturn bone;\\n\\n\\t\\t}\\n\\n\\t#else\\n\\n\\t\\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\\n\\n\\t\\tmat4 getBoneMatrix( const in float i ) {\\n\\n\\t\\t\\tmat4 bone = boneGlobalMatrices[ int(i) ];\\n\\t\\t\\treturn bone;\\n\\n\\t\\t}\\n\\n\\t#endif\\n\\n#endif\\n";\r\nTHREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\\n\\n\\tuniform float logDepthBufFC;\\n\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\n\\t\\t#extension GL_EXT_frag_depth : enable\\n\\t\\tvarying float vFragDepth;\\n\\n\\t#endif\\n\\n#endif";THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\\n\\n\\tgl_FragColor.a *= texture2D( alphaMap, vUv ).g;\\n\\n#endif\\n";THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\\n\\n\\tuniform sampler2D alphaMap;\\n\\n#endif\\n";\r\nTHREE.UniformsUtils={merge:function(a){for(var b={},c=0;c<a.length;c++){var d=this.clone(a[c]),e;for(e in d)b[e]=d[e]}return b},clone:function(a){var b={},c;for(c in a){b[c]={};for(var d in a[c]){var e=a[c][d];b[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e}}return b}};\r\nTHREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",\r\nvalue:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new THREE.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",\r\nvalue:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},\r\nmap:{type:"t",value:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};\r\nTHREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,\r\nTHREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\\t#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\\t#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\\n"),\r\nfragmentShader:["uniform vec3 diffuse;\\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\n\\tgl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,\r\nTHREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,\r\n{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT\\nvarying vec3 vLightFront;\\n#ifdef DOUBLE_SIDED\\n\\tvarying vec3 vLightBack;\\n#endif",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,\r\nTHREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,\r\nTHREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\\n"),fragmentShader:["uniform float opacity;\\nvarying vec3 vLightFront;\\n#ifdef DOUBLE_SIDED\\n\\tvarying vec3 vLightBack;\\n#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,\r\nTHREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\n\\tgl_FragColor = vec4( vec3( 1.0 ), opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\\t#ifdef DOUBLE_SIDED\\n\\t\\tif ( gl_FrontFacing )\\n\\t\\t\\tgl_FragColor.xyz *= vLightFront;\\n\\t\\telse\\n\\t\\t\\tgl_FragColor.xyz *= vLightBack;\\n\\t#else\\n\\t\\tgl_FragColor.xyz *= vLightFront;\\n\\t#endif",\r\nTHREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.bump,THREE.UniformsLib.normalmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},\r\nspecular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG\\nvarying vec3 vViewPosition;\\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,\r\nTHREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\\tvNormal = normalize( transformedNormal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\\tvViewPosition = -mvPosition.xyz;",\r\nTHREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\\n"),fragmentShader:["#define PHONG\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform vec3 ambient;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,\r\nTHREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\n\\tgl_FragColor = vec4( vec3( 1.0 ), opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,\r\nTHREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,\r\nTHREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );\\n\\t#else\\n\\t\\tgl_PointSize = size;\\n\\t#endif\\n\\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\\n"),fragmentShader:["uniform vec3 psColor;\\nuniform float opacity;",\r\nTHREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\n\\tgl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,\r\nTHREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\\tvLineDistance = scale * lineDistance;\\n\\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\\n\\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,\r\n"}"].join("\\n"),fragmentShader:["uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tgl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,\r\n"}"].join("\\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\\n"),fragmentShader:["uniform float mNear;\\nuniform float mFar;\\nuniform float opacity;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,\r\n"\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\\n\\t#else\\n\\t\\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\\n\\t#endif\\n\\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\\n\\tgl_FragColor = vec4( vec3( color ), opacity );\\n}"].join("\\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\\n\\tvNormal = normalize( normalMatrix * normal );",\r\nTHREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\\n"),fragmentShader:["uniform float opacity;\\nvarying vec3 vNormal;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\n\\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_vertex,\r\n"void main() {\\n\\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\\n\\tvWorldPosition = worldPosition.xyz;\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\\n"),fragmentShader:["uniform samplerCube tCube;\\nuniform float tFlip;\\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\n\\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,\r\n"}"].join("\\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\\n\\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\\n\\tvWorldPosition = worldPosition.xyz;\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\\n"),fragmentShader:["uniform sampler2D tEquirect;\\nuniform float tFlip;\\nvarying vec3 vWorldPosition;",\r\nTHREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\\nvec3 direction = normalize( vWorldPosition );\\nvec2 sampleUV;\\nsampleUV.y = clamp( tFlip * direction.y * -0.5 + 0.5, 0.0, 1.0);\\nsampleUV.x = atan( direction.z, direction.x ) * 0.15915494309189533576888376337251 + 0.5;\\ngl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,\r\nTHREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\\n"),fragmentShader:[THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\\n\\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\\n\\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\\n\\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\\n\\tres -= res.xxyz * bit_mask;\\n\\treturn res;\\n}\\nvoid main() {",\r\nTHREE.ShaderChunk.logdepthbuf_fragment,"\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\\n\\t#else\\n\\t\\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\\n\\t#endif\\n}"].join("\\n")}};\r\nTHREE.WebGLRenderer=function(a){function b(a){var b=a.geometry;a=a.material;var c=b.vertices.length;if(a.attributes){void 0===b.__webglCustomAttributesList&&(b.__webglCustomAttributesList=[]);for(var d in a.attributes){var e=a.attributes[d];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var f=1;"v2"===e.type?f=2:"v3"===e.type?f=3:"v4"===e.type?f=4:"c"===e.type&&(f=3);e.size=f;e.array=new Float32Array(c*f);e.buffer=l.createBuffer();e.buffer.belongsToAttribute=d;e.needsUpdate=\r\n!0}b.__webglCustomAttributesList.push(e)}}}function c(a,b){var c=b.geometry,e=a.faces3,f=3*e.length,g=1*e.length,h=3*e.length,e=d(b,a);a.__vertexArray=new Float32Array(3*f);a.__normalArray=new Float32Array(3*f);a.__colorArray=new Float32Array(3*f);a.__uvArray=new Float32Array(2*f);1<c.faceVertexUvs.length&&(a.__uv2Array=new Float32Array(2*f));c.hasTangents&&(a.__tangentArray=new Float32Array(4*f));b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*\r\nf),a.__skinWeightArray=new Float32Array(4*f));c=null!==aa.get("OES_element_index_uint")&&21845<g?Uint32Array:Uint16Array;a.__typeArray=c;a.__faceArray=new c(3*g);a.__lineArray=new c(2*h);var k=a.numMorphTargets;if(k)for(a.__morphTargetsArrays=[],c=0;c<k;c++)a.__morphTargetsArrays.push(new Float32Array(3*f));if(k=a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0;c<k;c++)a.__morphNormalsArrays.push(new Float32Array(3*f));a.__webglFaceCount=3*g;a.__webglLineCount=2*h;if(e.attributes){void 0===a.__webglCustomAttributesList&&\r\n(a.__webglCustomAttributesList=[]);for(var m in e.attributes){var g=e.attributes[m],h={},n;for(n in g)h[n]=g[n];if(!h.__webglInitialized||h.createUniqueBuffers)h.__webglInitialized=!0,c=1,"v2"===h.type?c=2:"v3"===h.type?c=3:"v4"===h.type?c=4:"c"===h.type&&(c=3),h.size=c,h.array=new Float32Array(f*c),h.buffer=l.createBuffer(),h.buffer.belongsToAttribute=m,g.needsUpdate=!0,h.__original=g;a.__webglCustomAttributesList.push(h)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?\r\na.material.materials[b.materialIndex]:a.material}function e(a,b,c,d){c=c.attributes;var e=b.attributes;b=b.attributesKeys;for(var f=0,k=b.length;f<k;f++){var m=b[f],n=e[m];if(0<=n){var p=c[m];void 0!==p?(m=p.itemSize,l.bindBuffer(l.ARRAY_BUFFER,p.buffer),g(n),l.vertexAttribPointer(n,m,l.FLOAT,!1,0,d*m*4)):void 0!==a.defaultAttributeValues&&(2===a.defaultAttributeValues[m].length?l.vertexAttrib2fv(n,a.defaultAttributeValues[m]):3===a.defaultAttributeValues[m].length&&l.vertexAttrib3fv(n,a.defaultAttributeValues[m]))}}h()}\r\nfunction f(){for(var a=0,b=kb.length;a<b;a++)kb[a]=0}function g(a){kb[a]=1;0===Ma[a]&&(l.enableVertexAttribArray(a),Ma[a]=1)}function h(){for(var a=0,b=Ma.length;a<b;a++)Ma[a]!==kb[a]&&(l.disableVertexAttribArray(a),Ma[a]=0)}function k(a,b){return a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function n(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function p(a,b){return b[0]-a[0]}function q(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group)){void 0===\r\na.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",ic));var c=a.geometry;if(void 0!==c&&void 0===c.__webglInit)if(c.__webglInit=!0,c.addEventListener("dispose",jc),c instanceof THREE.BufferGeometry)I.info.memory.geometries++;else if(a instanceof THREE.Mesh)r(a,c);else if(a instanceof THREE.Line){if(void 0===c.__webglVertexBuffer){c.__webglVertexBuffer=l.createBuffer();c.__webglColorBuffer=l.createBuffer();c.__webglLineDistanceBuffer=\r\nl.createBuffer();I.info.memory.geometries++;var d=c.vertices.length;c.__vertexArray=new Float32Array(3*d);c.__colorArray=new Float32Array(3*d);c.__lineDistanceArray=new Float32Array(1*d);c.__webglLineCount=d;b(a);c.verticesNeedUpdate=!0;c.colorsNeedUpdate=!0;c.lineDistancesNeedUpdate=!0}}else a instanceof THREE.PointCloud&&void 0===c.__webglVertexBuffer&&(c.__webglVertexBuffer=l.createBuffer(),c.__webglColorBuffer=l.createBuffer(),I.info.memory.geometries++,d=c.vertices.length,c.__vertexArray=new Float32Array(3*\r\nd),c.__colorArray=new Float32Array(3*d),c.__sortArray=[],c.__webglParticleCount=d,b(a),c.verticesNeedUpdate=!0,c.colorsNeedUpdate=!0);if(void 0===a.__webglActive)if(a.__webglActive=!0,a instanceof THREE.Mesh)if(c instanceof THREE.BufferGeometry)u(Fa,c,a);else{if(c instanceof THREE.Geometry)for(var c=sb[c.id],d=0,e=c.length;d<e;d++)u(Fa,c[d],a)}else a instanceof THREE.Line||a instanceof THREE.PointCloud?u(Fa,c,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&Ga.push({id:null,\r\nobject:a,opaque:null,transparent:null,z:0});if(a instanceof THREE.Light)pa.push(a);else if(a instanceof THREE.Sprite)tb.push(a);else if(a instanceof THREE.LensFlare)eb.push(a);else if((c=Fa[a.id])&&(!1===a.frustumCulled||!0===ub.intersectsObject(a)))for(d=0,e=c.length;d<e;d++){var f=c[d],g=f,h=g.object,k=g.buffer,m=h.geometry,h=h.material;h instanceof THREE.MeshFaceMaterial?(h=h.materials[m instanceof THREE.BufferGeometry?0:k.materialIndex],g.material=h,h.transparent?za.push(g):Ta.push(g)):h&&(g.material=\r\nh,h.transparent?za.push(g):Ta.push(g));f.render=!0;!0===I.sortObjects&&(Da.setFromMatrixPosition(a.matrixWorld),Da.applyProjection(vb),f.z=Da.z)}}d=0;for(e=a.children.length;d<e;d++)q(a.children[d])}}function m(a,b,c,d,e,f){for(var g,h=0,l=a.length;h<l;h++){g=a[h];var k=g.object,m=g.buffer;G(k,b);if(f)g=f;else{g=g.material;if(!g)continue;e&&I.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);I.setDepthTest(g.depthTest);I.setDepthWrite(g.depthWrite);A(g.polygonOffset,g.polygonOffsetFactor,\r\ng.polygonOffsetUnits)}I.setMaterialFaces(g);m instanceof THREE.BufferGeometry?I.renderBufferDirect(b,c,d,g,m,k):I.renderBuffer(b,c,d,g,m,k)}}function t(a,b,c,d,e,f,g){for(var h,l=0,k=a.length;l<k;l++){h=a[l];var m=h.object;if(m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&I.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);I.setDepthTest(h.depthTest);I.setDepthWrite(h.depthWrite);A(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}I.renderImmediateObject(c,d,e,h,m)}}}function s(a){var b=\r\na.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function r(a,b){var d=a.material,e=!1;if(void 0===sb[b.id]||!0===b.groupsNeedUpdate){delete Fa[a.id];for(var f=sb,g=b.id,d=d instanceof THREE.MeshFaceMaterial,h=aa.get("OES_element_index_uint")?4294967296:65535,k,e={},m=b.morphTargets.length,n=b.morphNormals.length,p,q={},r=[],t=0,s=b.faces.length;t<s;t++){k=b.faces[t];var v=d?k.materialIndex:0;v in e||(e[v]={hash:v,counter:0});k=e[v].hash+"_"+e[v].counter;\r\nk in q||(p={id:kc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,r.push(p));q[k].vertices+3>h&&(e[v].counter+=1,k=e[v].hash+"_"+e[v].counter,k in q||(p={id:kc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,r.push(p)));q[k].faces3.push(t);q[k].vertices+=3}f[g]=r;b.groupsNeedUpdate=!1}f=sb[b.id];g=0;for(d=f.length;g<d;g++){h=f[g];if(void 0===h.__webglVertexBuffer){e=h;e.__webglVertexBuffer=l.createBuffer();e.__webglNormalBuffer=\r\nl.createBuffer();e.__webglTangentBuffer=l.createBuffer();e.__webglColorBuffer=l.createBuffer();e.__webglUVBuffer=l.createBuffer();e.__webglUV2Buffer=l.createBuffer();e.__webglSkinIndicesBuffer=l.createBuffer();e.__webglSkinWeightsBuffer=l.createBuffer();e.__webglFaceBuffer=l.createBuffer();e.__webglLineBuffer=l.createBuffer();if(n=e.numMorphTargets)for(e.__webglMorphTargetsBuffers=[],m=0;m<n;m++)e.__webglMorphTargetsBuffers.push(l.createBuffer());if(n=e.numMorphNormals)for(e.__webglMorphNormalsBuffers=\r\n[],m=0;m<n;m++)e.__webglMorphNormalsBuffers.push(l.createBuffer());I.info.memory.geometries++;c(h,a);b.verticesNeedUpdate=!0;b.morphTargetsNeedUpdate=!0;b.elementsNeedUpdate=!0;b.uvsNeedUpdate=!0;b.normalsNeedUpdate=!0;b.tangentsNeedUpdate=!0;e=b.colorsNeedUpdate=!0}else e=!1;(e||void 0===a.__webglActive)&&u(Fa,h,a)}a.__webglActive=!0}function u(a,b,c){var d=c.id;a[d]=a[d]||[];a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function v(a){var b=a.geometry;if(b instanceof THREE.BufferGeometry)for(var e=\r\nb.attributes,f=b.attributesKeys,g=0,h=f.length;g<h;g++){var k=f[g],m=e[k];void 0===m.buffer&&(m.buffer=l.createBuffer(),m.needsUpdate=!0);if(!0===m.needsUpdate){var n="index"===k?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;l.bindBuffer(n,m.buffer);l.bufferData(n,m.array,l.STATIC_DRAW);m.needsUpdate=!1}}else if(a instanceof THREE.Mesh){!0===b.groupsNeedUpdate&&r(a,b);for(var p=sb[b.id],g=0,q=p.length;g<q;g++){var t=p[g],s=d(a,t);!0===b.groupsNeedUpdate&&c(t,a);var u=s.attributes&&y(s);if(b.verticesNeedUpdate||\r\nb.morphTargetsNeedUpdate||b.elementsNeedUpdate||b.uvsNeedUpdate||b.normalsNeedUpdate||b.colorsNeedUpdate||b.tangentsNeedUpdate||u){var v=t,x=a,z=l.DYNAMIC_DRAW,G=!b.dynamic,E=s;if(v.__inittedArrays){var D=E&&void 0!==E.shading&&E.shading===THREE.SmoothShading,w=void 0,F=void 0,I=void 0,A=void 0,Q=void 0,M=void 0,K=void 0,N=void 0,O=void 0,T=void 0,U=void 0,H=void 0,L=void 0,X=void 0,W=void 0,pa=void 0,ta=void 0,Za=void 0,Fa=void 0,ga=void 0,Ta=void 0,aa=void 0,Ga=void 0,za=void 0,ha=void 0,P=void 0,\r\nea=void 0,fa=void 0,ma=void 0,Y=void 0,tb=void 0,qa=void 0,Da=void 0,Aa=void 0,Ha=void 0,xa=void 0,na=void 0,ab=void 0,eb=void 0,la=void 0,Na=0,Ua=0,mb=0,ya=0,Xa=0,Va=0,Ia=0,nb=0,Oa=0,ia=0,ra=0,J=0,Ba=void 0,bb=v.__vertexArray,wb=v.__uvArray,ob=v.__uv2Array,Pa=v.__normalArray,Ca=v.__tangentArray,cb=v.__colorArray,Ka=v.__skinIndexArray,La=v.__skinWeightArray,$a=v.__morphTargetsArrays,xb=v.__morphNormalsArrays,pb=v.__webglCustomAttributesList,B=void 0,db=v.__faceArray,sa=v.__lineArray,oa=x.geometry,\r\nSa=oa.elementsNeedUpdate,Ma=oa.uvsNeedUpdate,Ab=oa.normalsNeedUpdate,Hb=oa.tangentsNeedUpdate,Ib=oa.colorsNeedUpdate,lb=oa.morphTargetsNeedUpdate,Cb=oa.vertices,V=v.faces3,Ja=oa.faces,Wa=oa.faceVertexUvs[0],Db=oa.faceVertexUvs[1],Pb=oa.skinIndices,$=oa.skinWeights,Eb=oa.morphTargets,R=oa.morphNormals;if(oa.verticesNeedUpdate){w=0;for(F=V.length;w<F;w++)A=Ja[V[w]],H=Cb[A.a],L=Cb[A.b],X=Cb[A.c],bb[Ua]=H.x,bb[Ua+1]=H.y,bb[Ua+2]=H.z,bb[Ua+3]=L.x,bb[Ua+4]=L.y,bb[Ua+5]=L.z,bb[Ua+6]=X.x,bb[Ua+7]=X.y,bb[Ua+\r\n8]=X.z,Ua+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,bb,z)}if(lb)for(Ha=0,xa=Eb.length;Ha<xa;Ha++){w=ra=0;for(F=V.length;w<F;w++)eb=V[w],A=Ja[eb],H=Eb[Ha].vertices[A.a],L=Eb[Ha].vertices[A.b],X=Eb[Ha].vertices[A.c],na=$a[Ha],na[ra]=H.x,na[ra+1]=H.y,na[ra+2]=H.z,na[ra+3]=L.x,na[ra+4]=L.y,na[ra+5]=L.z,na[ra+6]=X.x,na[ra+7]=X.y,na[ra+8]=X.z,E.morphNormals&&(D?(la=R[Ha].vertexNormals[eb],Za=la.a,Fa=la.b,ga=la.c):ga=Fa=Za=R[Ha].faceNormals[eb],ab=xb[Ha],ab[ra]=Za.x,\r\nab[ra+1]=Za.y,ab[ra+2]=Za.z,ab[ra+3]=Fa.x,ab[ra+4]=Fa.y,ab[ra+5]=Fa.z,ab[ra+6]=ga.x,ab[ra+7]=ga.y,ab[ra+8]=ga.z),ra+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[Ha]);l.bufferData(l.ARRAY_BUFFER,$a[Ha],z);E.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphNormalsBuffers[Ha]),l.bufferData(l.ARRAY_BUFFER,xb[Ha],z))}if($.length){w=0;for(F=V.length;w<F;w++)A=Ja[V[w]],za=$[A.a],ha=$[A.b],P=$[A.c],La[ia]=za.x,La[ia+1]=za.y,La[ia+2]=za.z,La[ia+3]=za.w,La[ia+4]=ha.x,La[ia+5]=ha.y,La[ia+\r\n6]=ha.z,La[ia+7]=ha.w,La[ia+8]=P.x,La[ia+9]=P.y,La[ia+10]=P.z,La[ia+11]=P.w,ea=Pb[A.a],fa=Pb[A.b],ma=Pb[A.c],Ka[ia]=ea.x,Ka[ia+1]=ea.y,Ka[ia+2]=ea.z,Ka[ia+3]=ea.w,Ka[ia+4]=fa.x,Ka[ia+5]=fa.y,Ka[ia+6]=fa.z,Ka[ia+7]=fa.w,Ka[ia+8]=ma.x,Ka[ia+9]=ma.y,Ka[ia+10]=ma.z,Ka[ia+11]=ma.w,ia+=12;0<ia&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,Ka,z),l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,La,z))}if(Ib){w=0;for(F=V.length;w<F;w++)A=\r\nJa[V[w]],K=A.vertexColors,N=A.color,3===K.length&&E.vertexColors===THREE.VertexColors?(Ta=K[0],aa=K[1],Ga=K[2]):Ga=aa=Ta=N,cb[Oa]=Ta.r,cb[Oa+1]=Ta.g,cb[Oa+2]=Ta.b,cb[Oa+3]=aa.r,cb[Oa+4]=aa.g,cb[Oa+5]=aa.b,cb[Oa+6]=Ga.r,cb[Oa+7]=Ga.g,cb[Oa+8]=Ga.b,Oa+=9;0<Oa&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,cb,z))}if(Hb&&oa.hasTangents){w=0;for(F=V.length;w<F;w++)A=Ja[V[w]],O=A.vertexTangents,W=O[0],pa=O[1],ta=O[2],Ca[Ia]=W.x,Ca[Ia+1]=W.y,Ca[Ia+2]=W.z,Ca[Ia+3]=W.w,Ca[Ia+\r\n4]=pa.x,Ca[Ia+5]=pa.y,Ca[Ia+6]=pa.z,Ca[Ia+7]=pa.w,Ca[Ia+8]=ta.x,Ca[Ia+9]=ta.y,Ca[Ia+10]=ta.z,Ca[Ia+11]=ta.w,Ia+=12;l.bindBuffer(l.ARRAY_BUFFER,v.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,Ca,z)}if(Ab){w=0;for(F=V.length;w<F;w++)if(A=Ja[V[w]],Q=A.vertexNormals,M=A.normal,3===Q.length&&D)for(Y=0;3>Y;Y++)qa=Q[Y],Pa[Va]=qa.x,Pa[Va+1]=qa.y,Pa[Va+2]=qa.z,Va+=3;else for(Y=0;3>Y;Y++)Pa[Va]=M.x,Pa[Va+1]=M.y,Pa[Va+2]=M.z,Va+=3;l.bindBuffer(l.ARRAY_BUFFER,v.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,\r\nPa,z)}if(Ma&&Wa){w=0;for(F=V.length;w<F;w++)if(I=V[w],T=Wa[I],void 0!==T)for(Y=0;3>Y;Y++)Da=T[Y],wb[mb]=Da.x,wb[mb+1]=Da.y,mb+=2;0<mb&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,wb,z))}if(Ma&&Db){w=0;for(F=V.length;w<F;w++)if(I=V[w],U=Db[I],void 0!==U)for(Y=0;3>Y;Y++)Aa=U[Y],ob[ya]=Aa.x,ob[ya+1]=Aa.y,ya+=2;0<ya&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,ob,z))}if(Sa){w=0;for(F=V.length;w<F;w++)db[Xa]=Na,db[Xa+1]=Na+1,db[Xa+2]=Na+\r\n2,Xa+=3,sa[nb]=Na,sa[nb+1]=Na+1,sa[nb+2]=Na,sa[nb+3]=Na+2,sa[nb+4]=Na+1,sa[nb+5]=Na+2,nb+=6,Na+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,db,z);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,sa,z)}if(pb)for(Y=0,tb=pb.length;Y<tb;Y++)if(B=pb[Y],B.__original.needsUpdate){J=0;if(1===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,F=V.length;w<F;w++)A=Ja[V[w]],B.array[J]=B.value[A.a],B.array[J+\r\n1]=B.value[A.b],B.array[J+2]=B.value[A.c],J+=3;else{if("faces"===B.boundTo)for(w=0,F=V.length;w<F;w++)Ba=B.value[V[w]],B.array[J]=Ba,B.array[J+1]=Ba,B.array[J+2]=Ba,J+=3}else if(2===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,F=V.length;w<F;w++)A=Ja[V[w]],H=B.value[A.a],L=B.value[A.b],X=B.value[A.c],B.array[J]=H.x,B.array[J+1]=H.y,B.array[J+2]=L.x,B.array[J+3]=L.y,B.array[J+4]=X.x,B.array[J+5]=X.y,J+=6;else{if("faces"===B.boundTo)for(w=0,F=V.length;w<F;w++)X=L=H=Ba=B.value[V[w]],\r\nB.array[J]=H.x,B.array[J+1]=H.y,B.array[J+2]=L.x,B.array[J+3]=L.y,B.array[J+4]=X.x,B.array[J+5]=X.y,J+=6}else if(3===B.size){var S;S="c"===B.type?["r","g","b"]:["x","y","z"];if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,F=V.length;w<F;w++)A=Ja[V[w]],H=B.value[A.a],L=B.value[A.b],X=B.value[A.c],B.array[J]=H[S[0]],B.array[J+1]=H[S[1]],B.array[J+2]=H[S[2]],B.array[J+3]=L[S[0]],B.array[J+4]=L[S[1]],B.array[J+5]=L[S[2]],B.array[J+6]=X[S[0]],B.array[J+7]=X[S[1]],B.array[J+8]=X[S[2]],J+=9;else if("faces"===\r\nB.boundTo)for(w=0,F=V.length;w<F;w++)X=L=H=Ba=B.value[V[w]],B.array[J]=H[S[0]],B.array[J+1]=H[S[1]],B.array[J+2]=H[S[2]],B.array[J+3]=L[S[0]],B.array[J+4]=L[S[1]],B.array[J+5]=L[S[2]],B.array[J+6]=X[S[0]],B.array[J+7]=X[S[1]],B.array[J+8]=X[S[2]],J+=9;else if("faceVertices"===B.boundTo)for(w=0,F=V.length;w<F;w++)Ba=B.value[V[w]],H=Ba[0],L=Ba[1],X=Ba[2],B.array[J]=H[S[0]],B.array[J+1]=H[S[1]],B.array[J+2]=H[S[2]],B.array[J+3]=L[S[0]],B.array[J+4]=L[S[1]],B.array[J+5]=L[S[2]],B.array[J+6]=X[S[0]],B.array[J+\r\n7]=X[S[1]],B.array[J+8]=X[S[2]],J+=9}else if(4===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,F=V.length;w<F;w++)A=Ja[V[w]],H=B.value[A.a],L=B.value[A.b],X=B.value[A.c],B.array[J]=H.x,B.array[J+1]=H.y,B.array[J+2]=H.z,B.array[J+3]=H.w,B.array[J+4]=L.x,B.array[J+5]=L.y,B.array[J+6]=L.z,B.array[J+7]=L.w,B.array[J+8]=X.x,B.array[J+9]=X.y,B.array[J+10]=X.z,B.array[J+11]=X.w,J+=12;else if("faces"===B.boundTo)for(w=0,F=V.length;w<F;w++)X=L=H=Ba=B.value[V[w]],B.array[J]=H.x,B.array[J+1]=\r\nH.y,B.array[J+2]=H.z,B.array[J+3]=H.w,B.array[J+4]=L.x,B.array[J+5]=L.y,B.array[J+6]=L.z,B.array[J+7]=L.w,B.array[J+8]=X.x,B.array[J+9]=X.y,B.array[J+10]=X.z,B.array[J+11]=X.w,J+=12;else if("faceVertices"===B.boundTo)for(w=0,F=V.length;w<F;w++)Ba=B.value[V[w]],H=Ba[0],L=Ba[1],X=Ba[2],B.array[J]=H.x,B.array[J+1]=H.y,B.array[J+2]=H.z,B.array[J+3]=H.w,B.array[J+4]=L.x,B.array[J+5]=L.y,B.array[J+6]=L.z,B.array[J+7]=L.w,B.array[J+8]=X.x,B.array[J+9]=X.y,B.array[J+10]=X.z,B.array[J+11]=X.w,J+=12;l.bindBuffer(l.ARRAY_BUFFER,\r\nB.buffer);l.bufferData(l.ARRAY_BUFFER,B.array,z)}G&&(delete v.__inittedArrays,delete v.__colorArray,delete v.__normalArray,delete v.__tangentArray,delete v.__uvArray,delete v.__uv2Array,delete v.__faceArray,delete v.__vertexArray,delete v.__lineArray,delete v.__skinIndexArray,delete v.__skinWeightArray)}}}b.verticesNeedUpdate=!1;b.morphTargetsNeedUpdate=!1;b.elementsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.tangentsNeedUpdate=!1;s.attributes&&C(s)}else if(a instanceof\r\nTHREE.Line){s=d(a,b);u=s.attributes&&y(s);if(b.verticesNeedUpdate||b.colorsNeedUpdate||b.lineDistancesNeedUpdate||u){var Z=l.DYNAMIC_DRAW,Ea,ka,Bb,Fb,ba,gb,ua=b.vertices,Qb=b.colors,Rb=b.lineDistances,qb=ua.length,Sb=Qb.length,yb=Rb.length,Gb=b.__vertexArray,rb=b.__colorArray,kb=b.__lineDistanceArray,Mb=b.colorsNeedUpdate,Ob=b.lineDistancesNeedUpdate,hb=b.__webglCustomAttributesList,Ya,ib,va,Kb,Qa,ca;if(b.verticesNeedUpdate){for(Ea=0;Ea<qb;Ea++)Fb=ua[Ea],ba=3*Ea,Gb[ba]=Fb.x,Gb[ba+1]=Fb.y,Gb[ba+2]=\r\nFb.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Gb,Z)}if(Mb){for(ka=0;ka<Sb;ka++)gb=Qb[ka],ba=3*ka,rb[ba]=gb.r,rb[ba+1]=gb.g,rb[ba+2]=gb.b;l.bindBuffer(l.ARRAY_BUFFER,b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,rb,Z)}if(Ob){for(Bb=0;Bb<yb;Bb++)kb[Bb]=Rb[Bb];l.bindBuffer(l.ARRAY_BUFFER,b.__webglLineDistanceBuffer);l.bufferData(l.ARRAY_BUFFER,kb,Z)}if(hb)for(Ya=0,ib=hb.length;Ya<ib;Ya++)if(ca=hb[Ya],ca.needsUpdate&&(void 0===ca.boundTo||"vertices"===ca.boundTo)){ba=\r\n0;Kb=ca.value.length;if(1===ca.size)for(va=0;va<Kb;va++)ca.array[va]=ca.value[va];else if(2===ca.size)for(va=0;va<Kb;va++)Qa=ca.value[va],ca.array[ba]=Qa.x,ca.array[ba+1]=Qa.y,ba+=2;else if(3===ca.size)if("c"===ca.type)for(va=0;va<Kb;va++)Qa=ca.value[va],ca.array[ba]=Qa.r,ca.array[ba+1]=Qa.g,ca.array[ba+2]=Qa.b,ba+=3;else for(va=0;va<Kb;va++)Qa=ca.value[va],ca.array[ba]=Qa.x,ca.array[ba+1]=Qa.y,ca.array[ba+2]=Qa.z,ba+=3;else if(4===ca.size)for(va=0;va<Kb;va++)Qa=ca.value[va],ca.array[ba]=Qa.x,ca.array[ba+\r\n1]=Qa.y,ca.array[ba+2]=Qa.z,ca.array[ba+3]=Qa.w,ba+=4;l.bindBuffer(l.ARRAY_BUFFER,ca.buffer);l.bufferData(l.ARRAY_BUFFER,ca.array,Z);ca.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;b.lineDistancesNeedUpdate=!1;s.attributes&&C(s)}else if(a instanceof THREE.PointCloud){s=d(a,b);u=s.attributes&&y(s);if(b.verticesNeedUpdate||b.colorsNeedUpdate||u){var jb=l.DYNAMIC_DRAW,Tb,Ub,$b,ja,ac,ub=b.vertices,vb=ub.length,Nb=b.colors,Vb=Nb.length,bc=b.__vertexArray,cc=b.__colorArray,Wb=b.colorsNeedUpdate,\r\nJb=b.__webglCustomAttributesList,dc,zb,wa,Lb,Ra,da;if(b.verticesNeedUpdate){for(Tb=0;Tb<vb;Tb++)$b=ub[Tb],ja=3*Tb,bc[ja]=$b.x,bc[ja+1]=$b.y,bc[ja+2]=$b.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,bc,jb)}if(Wb){for(Ub=0;Ub<Vb;Ub++)ac=Nb[Ub],ja=3*Ub,cc[ja]=ac.r,cc[ja+1]=ac.g,cc[ja+2]=ac.b;l.bindBuffer(l.ARRAY_BUFFER,b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,cc,jb)}if(Jb)for(dc=0,zb=Jb.length;dc<zb;dc++){da=Jb[dc];if(da.needsUpdate&&(void 0===da.boundTo||\r\n"vertices"===da.boundTo))if(Lb=da.value.length,ja=0,1===da.size)for(wa=0;wa<Lb;wa++)da.array[wa]=da.value[wa];else if(2===da.size)for(wa=0;wa<Lb;wa++)Ra=da.value[wa],da.array[ja]=Ra.x,da.array[ja+1]=Ra.y,ja+=2;else if(3===da.size)if("c"===da.type)for(wa=0;wa<Lb;wa++)Ra=da.value[wa],da.array[ja]=Ra.r,da.array[ja+1]=Ra.g,da.array[ja+2]=Ra.b,ja+=3;else for(wa=0;wa<Lb;wa++)Ra=da.value[wa],da.array[ja]=Ra.x,da.array[ja+1]=Ra.y,da.array[ja+2]=Ra.z,ja+=3;else if(4===da.size)for(wa=0;wa<Lb;wa++)Ra=da.value[wa],\r\nda.array[ja]=Ra.x,da.array[ja+1]=Ra.y,da.array[ja+2]=Ra.z,da.array[ja+3]=Ra.w,ja+=4;l.bindBuffer(l.ARRAY_BUFFER,da.buffer);l.bufferData(l.ARRAY_BUFFER,da.array,jb);da.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;s.attributes&&C(s)}}function y(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function C(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b,c,d,e){var f,g,h,k;Mb=0;if(d.needsUpdate){d.program&&lc(d);d.addEventListener("dispose",\r\nmc);var m=Dc[d.type];if(m){var n=THREE.ShaderLib[m];d.__webglShader={uniforms:THREE.UniformsUtils.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,q=0,r=0,t=0,s=0,v=b.length;s<v;s++){var u=b[s];u.onlyShadow||!1===u.visible||(u instanceof THREE.DirectionalLight&&p++,u instanceof THREE.PointLight&&q++,u instanceof THREE.SpotLight&&r++,u instanceof THREE.HemisphereLight&&\r\nt++)}f=p;g=q;h=r;k=t;for(var x,y=0,C=0,G=b.length;C<G;C++){var A=b[C];A.castShadow&&(A instanceof THREE.SpotLight&&y++,A instanceof THREE.DirectionalLight&&!A.shadowCascade&&y++)}x=y;var D;if(Nb&&e&&e.skeleton&&e.skeleton.useVertexTexture)D=1024;else{var H=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),L=Math.floor((H-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(L=Math.min(e.skeleton.bones.length,L),L<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+\r\n", this GPU supports just "+L+" (try OpenGL instead of ANGLE)"));D=L}var K={precision:ga,supportsVertexTextures:Vb,map:!!d.map,envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,combine:d.combine,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:X,skinning:d.skinning,maxBones:D,useVertexTexture:Nb&&\r\ne&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:I.maxMorphTargets,maxMorphNormals:I.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:x,shadowMapEnabled:I.shadowMapEnabled&&e.receiveShadow&&0<x,shadowMapType:I.shadowMapType,shadowMapDebug:I.shadowMapDebug,shadowMapCascade:I.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===\r\nTHREE.BackSide},N=[];m?N.push(m):(N.push(d.fragmentShader),N.push(d.vertexShader));if(void 0!==d.defines)for(var O in d.defines)N.push(O),N.push(d.defines[O]);for(O in K)N.push(O),N.push(K[O]);for(var W=N.join(),pa,ta=0,Za=Xa.length;ta<Za;ta++){var Fa=Xa[ta];if(Fa.code===W){pa=Fa;pa.usedTimes++;break}}void 0===pa&&(pa=new THREE.WebGLProgram(I,W,d,K),Xa.push(pa),I.info.memory.programs=Xa.length);d.program=pa;var Ta=pa.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var aa,Ga="morphTarget",\r\nza=0;za<I.maxMorphTargets;za++)aa=Ga+za,0<=Ta[aa]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,Ga="morphNormal",za=0;za<I.maxMorphNormals;za++)aa=Ga+za,0<=Ta[aa]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var ea in d.__webglShader.uniforms){var tb=d.program.uniforms[ea];tb&&d.uniformsList.push([d.__webglShader.uniforms[ea],tb])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets));\r\nvar qa=!1,eb=!1,ya=!1,xa=d.program,ha=xa.uniforms,P=d.__webglShader.uniforms;xa.id!==Wb&&(l.useProgram(xa.program),Wb=xa.id,ya=eb=qa=!0);d.id!==Hb&&(-1===Hb&&(ya=!0),Hb=d.id,eb=!0);if(qa||a!==Ib)l.uniformMatrix4fv(ha.projectionMatrix,!1,a.projectionMatrix.elements),X&&l.uniform1f(ha.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Ib&&(Ib=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==ha.cameraPosition&&(Da.setFromMatrixPosition(a.matrixWorld),l.uniform3f(ha.cameraPosition,\r\nDa.x,Da.y,Da.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==ha.viewMatrix&&l.uniformMatrix4fv(ha.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==ha.bindMatrix&&l.uniformMatrix4fv(ha.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==ha.bindMatrixInverse&&l.uniformMatrix4fv(ha.bindMatrixInverse,!1,e.bindMatrixInverse.elements),\r\nNb&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==ha.boneTexture){var $a=z();l.uniform1i(ha.boneTexture,$a);I.setTexture(e.skeleton.boneTexture,$a)}null!==ha.boneTextureWidth&&l.uniform1i(ha.boneTextureWidth,e.skeleton.boneTextureWidth);null!==ha.boneTextureHeight&&l.uniform1i(ha.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ha.boneGlobalMatrices&&l.uniformMatrix4fv(ha.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(eb){c&&d.fog&&(P.fogColor.value=\r\nc.color,c instanceof THREE.Fog?(P.fogNear.value=c.near,P.fogFar.value=c.far):c instanceof THREE.FogExp2&&(P.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ob){var ya=!0,fa,fb,Y,Ma=0,Sa=0,Ya=0,Aa,Ha,hb,na,ab,jb,la=nc,Na=la.directional.colors,Ua=la.directional.positions,mb=la.point.colors,kb=la.point.positions,sb=la.point.distances,Va=la.spot.colors,Ia=la.spot.positions,nb=la.spot.distances,Oa=la.spot.directions,ia=la.spot.anglesCos,\r\nra=la.spot.exponents,J=la.hemi.skyColors,Ba=la.hemi.groundColors,bb=la.hemi.positions,wb=0,ob=0,Pa=0,Ca=0,cb=0,Ka=0,La=0,ib=0,xb=0,pb=0,B=0,db=0;fa=0;for(fb=b.length;fa<fb;fa++)Y=b[fa],Y.onlyShadow||(Aa=Y.color,na=Y.intensity,jb=Y.distance,Y instanceof THREE.AmbientLight?Y.visible&&(I.gammaInput?(Ma+=Aa.r*Aa.r,Sa+=Aa.g*Aa.g,Ya+=Aa.b*Aa.b):(Ma+=Aa.r,Sa+=Aa.g,Ya+=Aa.b)):Y instanceof THREE.DirectionalLight?(cb+=1,Y.visible&&(ma.setFromMatrixPosition(Y.matrixWorld),Da.setFromMatrixPosition(Y.target.matrixWorld),\r\nma.sub(Da),ma.normalize(),xb=3*wb,Ua[xb]=ma.x,Ua[xb+1]=ma.y,Ua[xb+2]=ma.z,I.gammaInput?E(Na,xb,Aa,na*na):w(Na,xb,Aa,na),wb+=1)):Y instanceof THREE.PointLight?(Ka+=1,Y.visible&&(pb=3*ob,I.gammaInput?E(mb,pb,Aa,na*na):w(mb,pb,Aa,na),Da.setFromMatrixPosition(Y.matrixWorld),kb[pb]=Da.x,kb[pb+1]=Da.y,kb[pb+2]=Da.z,sb[ob]=jb,ob+=1)):Y instanceof THREE.SpotLight?(La+=1,Y.visible&&(B=3*Pa,I.gammaInput?E(Va,B,Aa,na*na):w(Va,B,Aa,na),ma.setFromMatrixPosition(Y.matrixWorld),Ia[B]=ma.x,Ia[B+1]=ma.y,Ia[B+2]=ma.z,\r\nnb[Pa]=jb,Da.setFromMatrixPosition(Y.target.matrixWorld),ma.sub(Da),ma.normalize(),Oa[B]=ma.x,Oa[B+1]=ma.y,Oa[B+2]=ma.z,ia[Pa]=Math.cos(Y.angle),ra[Pa]=Y.exponent,Pa+=1)):Y instanceof THREE.HemisphereLight&&(ib+=1,Y.visible&&(ma.setFromMatrixPosition(Y.matrixWorld),ma.normalize(),db=3*Ca,bb[db]=ma.x,bb[db+1]=ma.y,bb[db+2]=ma.z,Ha=Y.color,hb=Y.groundColor,I.gammaInput?(ab=na*na,E(J,db,Ha,ab),E(Ba,db,hb,ab)):(w(J,db,Ha,na),w(Ba,db,hb,na)),Ca+=1)));fa=3*wb;for(fb=Math.max(Na.length,3*cb);fa<fb;fa++)Na[fa]=\r\n0;fa=3*ob;for(fb=Math.max(mb.length,3*Ka);fa<fb;fa++)mb[fa]=0;fa=3*Pa;for(fb=Math.max(Va.length,3*La);fa<fb;fa++)Va[fa]=0;fa=3*Ca;for(fb=Math.max(J.length,3*ib);fa<fb;fa++)J[fa]=0;fa=3*Ca;for(fb=Math.max(Ba.length,3*ib);fa<fb;fa++)Ba[fa]=0;la.directional.length=wb;la.point.length=ob;la.spot.length=Pa;la.hemi.length=Ca;la.ambient[0]=Ma;la.ambient[1]=Sa;la.ambient[2]=Ya;Ob=!1}if(ya){var sa=nc;P.ambientLightColor.value=sa.ambient;P.directionalLightColor.value=sa.directional.colors;P.directionalLightDirection.value=\r\nsa.directional.positions;P.pointLightColor.value=sa.point.colors;P.pointLightPosition.value=sa.point.positions;P.pointLightDistance.value=sa.point.distances;P.spotLightColor.value=sa.spot.colors;P.spotLightPosition.value=sa.spot.positions;P.spotLightDistance.value=sa.spot.distances;P.spotLightDirection.value=sa.spot.directions;P.spotLightAngleCos.value=sa.spot.anglesCos;P.spotLightExponent.value=sa.spot.exponents;P.hemisphereLightSkyColor.value=sa.hemi.skyColors;P.hemisphereLightGroundColor.value=\r\nsa.hemi.groundColors;P.hemisphereLightDirection.value=sa.hemi.positions;F(P,!0)}else F(P,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){P.opacity.value=d.opacity;I.gammaInput?P.diffuse.value.copyGammaToLinear(d.color):P.diffuse.value=d.color;P.map.value=d.map;P.lightMap.value=d.lightMap;P.specularMap.value=d.specularMap;P.alphaMap.value=d.alphaMap;d.bumpMap&&(P.bumpMap.value=d.bumpMap,P.bumpScale.value=d.bumpScale);d.normalMap&&\r\n(P.normalMap.value=d.normalMap,P.normalScale.value.copy(d.normalScale));var oa;d.map?oa=d.map:d.specularMap?oa=d.specularMap:d.normalMap?oa=d.normalMap:d.bumpMap?oa=d.bumpMap:d.alphaMap&&(oa=d.alphaMap);if(void 0!==oa){var ub=oa.offset,zb=oa.repeat;P.offsetRepeat.value.set(ub.x,ub.y,zb.x,zb.y)}P.envMap.value=d.envMap;P.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;P.reflectivity.value=d.reflectivity;P.refractionRatio.value=d.refractionRatio}d instanceof THREE.LineBasicMaterial?\r\n(P.diffuse.value=d.color,P.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(P.diffuse.value=d.color,P.opacity.value=d.opacity,P.dashSize.value=d.dashSize,P.totalSize.value=d.dashSize+d.gapSize,P.scale.value=d.scale):d instanceof THREE.PointCloudMaterial?(P.psColor.value=d.color,P.opacity.value=d.opacity,P.size.value=d.size,P.scale.value=Q.height/2,P.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(P.shininess.value=d.shininess,I.gammaInput?(P.ambient.value.copyGammaToLinear(d.ambient),\r\nP.emissive.value.copyGammaToLinear(d.emissive),P.specular.value.copyGammaToLinear(d.specular)):(P.ambient.value=d.ambient,P.emissive.value=d.emissive,P.specular.value=d.specular),d.wrapAround&&P.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(I.gammaInput?(P.ambient.value.copyGammaToLinear(d.ambient),P.emissive.value.copyGammaToLinear(d.emissive)):(P.ambient.value=d.ambient,P.emissive.value=d.emissive),d.wrapAround&&P.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?\r\n(P.mNear.value=a.near,P.mFar.value=a.far,P.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(P.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&P.shadowMatrix)for(var Ab=0,vb=0,Xb=b.length;vb<Xb;vb++){var lb=b[vb];lb.castShadow&&(lb instanceof THREE.SpotLight||lb instanceof THREE.DirectionalLight&&!lb.shadowCascade)&&(P.shadowMap.value[Ab]=lb.shadowMap,P.shadowMapSize.value[Ab]=lb.shadowMapSize,P.shadowMatrix.value[Ab]=lb.shadowMatrix,P.shadowDarkness.value[Ab]=lb.shadowDarkness,\r\nP.shadowBias.value[Ab]=lb.shadowBias,Ab++)}for(var Cb=d.uniformsList,V,Ja,Wa,Db=0,Pb=Cb.length;Db<Pb;Db++){var $=Cb[Db][0];if(!1!==$.needsUpdate){var Eb=$.type,R=$.value,S=Cb[Db][1];switch(Eb){case "1i":l.uniform1i(S,R);break;case "1f":l.uniform1f(S,R);break;case "2f":l.uniform2f(S,R[0],R[1]);break;case "3f":l.uniform3f(S,R[0],R[1],R[2]);break;case "4f":l.uniform4f(S,R[0],R[1],R[2],R[3]);break;case "1iv":l.uniform1iv(S,R);break;case "3iv":l.uniform3iv(S,R);break;case "1fv":l.uniform1fv(S,R);break;\r\ncase "2fv":l.uniform2fv(S,R);break;case "3fv":l.uniform3fv(S,R);break;case "4fv":l.uniform4fv(S,R);break;case "Matrix3fv":l.uniformMatrix3fv(S,!1,R);break;case "Matrix4fv":l.uniformMatrix4fv(S,!1,R);break;case "i":l.uniform1i(S,R);break;case "f":l.uniform1f(S,R);break;case "v2":l.uniform2f(S,R.x,R.y);break;case "v3":l.uniform3f(S,R.x,R.y,R.z);break;case "v4":l.uniform4f(S,R.x,R.y,R.z,R.w);break;case "c":l.uniform3f(S,R.r,R.g,R.b);break;case "iv1":l.uniform1iv(S,R);break;case "iv":l.uniform3iv(S,R);\r\nbreak;case "fv1":l.uniform1fv(S,R);break;case "fv":l.uniform3fv(S,R);break;case "v2v":void 0===$._array&&($._array=new Float32Array(2*R.length));for(var Z=0,Ea=R.length;Z<Ea;Z++)Wa=2*Z,$._array[Wa]=R[Z].x,$._array[Wa+1]=R[Z].y;l.uniform2fv(S,$._array);break;case "v3v":void 0===$._array&&($._array=new Float32Array(3*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)Wa=3*Z,$._array[Wa]=R[Z].x,$._array[Wa+1]=R[Z].y,$._array[Wa+2]=R[Z].z;l.uniform3fv(S,$._array);break;case "v4v":void 0===$._array&&($._array=new Float32Array(4*\r\nR.length));Z=0;for(Ea=R.length;Z<Ea;Z++)Wa=4*Z,$._array[Wa]=R[Z].x,$._array[Wa+1]=R[Z].y,$._array[Wa+2]=R[Z].z,$._array[Wa+3]=R[Z].w;l.uniform4fv(S,$._array);break;case "m3":l.uniformMatrix3fv(S,!1,R.elements);break;case "m3v":void 0===$._array&&($._array=new Float32Array(9*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)R[Z].flattenToArrayOffset($._array,9*Z);l.uniformMatrix3fv(S,!1,$._array);break;case "m4":l.uniformMatrix4fv(S,!1,R.elements);break;case "m4v":void 0===$._array&&($._array=new Float32Array(16*\r\nR.length));Z=0;for(Ea=R.length;Z<Ea;Z++)R[Z].flattenToArrayOffset($._array,16*Z);l.uniformMatrix4fv(S,!1,$._array);break;case "t":V=R;Ja=z();l.uniform1i(S,Ja);if(!V)continue;if(V instanceof THREE.CubeTexture||V.image instanceof Array&&6===V.image.length){var ka=V,Bb=Ja;if(6===ka.image.length)if(ka.needsUpdate){ka.image.__webglTextureCube||(ka.addEventListener("dispose",Jb),ka.image.__webglTextureCube=l.createTexture(),I.info.memory.textures++);l.activeTexture(l.TEXTURE0+Bb);l.bindTexture(l.TEXTURE_CUBE_MAP,\r\nka.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,ka.flipY);for(var Fb=ka instanceof THREE.CompressedTexture,ba=ka.image[0]instanceof THREE.DataTexture,gb=[],ua=0;6>ua;ua++)gb[ua]=!I.autoScaleCubemaps||Fb||ba?ba?ka.image[ua].image:ka.image[ua]:M(ka.image[ua],Ec);var Qb=gb[0],Rb=THREE.Math.isPowerOfTwo(Qb.width)&&THREE.Math.isPowerOfTwo(Qb.height),qb=T(ka.format),Sb=T(ka.type);U(l.TEXTURE_CUBE_MAP,ka,Rb);for(ua=0;6>ua;ua++)if(Fb)for(var yb,Gb=gb[ua].mipmaps,rb=0,Yb=Gb.length;rb<Yb;rb++)yb=\r\nGb[rb],ka.format!==THREE.RGBAFormat&&ka.format!==THREE.RGBFormat?-1<oc().indexOf(qb)?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ua,rb,qb,yb.width,yb.height,0,yb.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ua,rb,qb,yb.width,yb.height,0,qb,Sb,yb.data);else ba?l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ua,0,qb,gb[ua].width,gb[ua].height,0,qb,Sb,gb[ua].data):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ua,0,qb,qb,Sb,gb[ua]);\r\nka.generateMipmaps&&Rb&&l.generateMipmap(l.TEXTURE_CUBE_MAP);ka.needsUpdate=!1;if(ka.onUpdate)ka.onUpdate()}else l.activeTexture(l.TEXTURE0+Bb),l.bindTexture(l.TEXTURE_CUBE_MAP,ka.image.__webglTextureCube)}else if(V instanceof THREE.WebGLRenderTargetCube){var Zb=V;l.activeTexture(l.TEXTURE0+Ja);l.bindTexture(l.TEXTURE_CUBE_MAP,Zb.__webglTexture)}else I.setTexture(V,Ja);break;case "tv":void 0===$._array&&($._array=[]);Z=0;for(Ea=$.value.length;Z<Ea;Z++)$._array[Z]=z();l.uniform1iv(S,$._array);Z=0;\r\nfor(Ea=$.value.length;Z<Ea;Z++)V=$.value[Z],Ja=$._array[Z],V&&I.setTexture(V,Ja);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Eb)}}}}l.uniformMatrix4fv(ha.modelViewMatrix,!1,e._modelViewMatrix.elements);ha.normalMatrix&&l.uniformMatrix3fv(ha.normalMatrix,!1,e._normalMatrix.elements);null!==ha.modelMatrix&&l.uniformMatrix4fv(ha.modelMatrix,!1,e.matrixWorld.elements);return xa}function F(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=\r\nb;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function z(){var a=Mb;a>=pc&&console.warn("WebGLRenderer: trying to use "+\r\na+" texture units while this GPU supports only "+pc);Mb+=1;return a}function G(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function E(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function w(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a){a*=O;a!==qc&&(l.lineWidth(a),qc=a)}function A(a,b,c){rc!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),rc=a);!a||sc===b&&tc===c||\r\n(l.polygonOffset(b,c),sc=b,tc=c)}function U(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,T(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,T(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,T(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,T(b.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT is set to THREE.ClampToEdgeWrapping. ( "+\r\nb.sourceFile+" )"),l.texParameteri(a,l.TEXTURE_MAG_FILTER,N(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,N(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter is set to THREE.LinearFilter or THREE.NearestFilter. ( "+b.sourceFile+" )"));(c=aa.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(l.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,\r\nMath.min(b.anisotropy,I.getMaxAnisotropy())),b.__oldAnisotropy=b.anisotropy)}function M(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.log("THREE.WebGLRenderer:",a,"is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height+".");return d}return a}function K(a,b){l.bindRenderbuffer(l.RENDERBUFFER,\r\na);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function L(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,\r\na.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))}function N(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function T(a){var b;if(a===THREE.RepeatWrapping)return l.REPEAT;if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;\r\nif(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return l.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return l.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return l.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return l.UNSIGNED_SHORT_5_5_5_1;\r\nif(a===THREE.UnsignedShort565Type)return l.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return l.BYTE;if(a===THREE.ShortType)return l.SHORT;if(a===THREE.UnsignedShortType)return l.UNSIGNED_SHORT;if(a===THREE.IntType)return l.INT;if(a===THREE.UnsignedIntType)return l.UNSIGNED_INT;if(a===THREE.FloatType)return l.FLOAT;if(a===THREE.AlphaFormat)return l.ALPHA;if(a===THREE.RGBFormat)return l.RGB;if(a===THREE.RGBAFormat)return l.RGBA;if(a===THREE.LuminanceFormat)return l.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return l.LUMINANCE_ALPHA;\r\nif(a===THREE.AddEquation)return l.FUNC_ADD;if(a===THREE.SubtractEquation)return l.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return l.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return l.ZERO;if(a===THREE.OneFactor)return l.ONE;if(a===THREE.SrcColorFactor)return l.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return l.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return l.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return l.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return l.DST_ALPHA;\r\nif(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;b=aa.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;\r\nif(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=aa.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=aa.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;\r\nif(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var Q=void 0!==a.canvas?a.canvas:document.createElement("canvas"),W=void 0!==a.context?a.context:null,O=1,ga=void 0!==a.precision?a.precision:"highp",ea=void 0!==a.alpha?a.alpha:!1,xa=void 0!==a.depth?a.depth:!0,H=void 0!==a.stencil?a.stencil:!0,$a=void 0!==a.antialias?a.antialias:!1,qa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ya=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:\r\n!1,X=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,ta=new THREE.Color(0),Za=0,pa=[],Fa={},Ga=[],Ta=[],za=[],tb=[],eb=[];this.domElement=Q;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=\r\n!0;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var I=this,Xa=[],Wb=null,uc=null,Hb=-1,Sa="",Ib=null,Mb=0,zb=-1,Xb=-1,Yb=-1,Zb=-1,ec=-1,fc=-1,gc=-1,hc=-1,rc=null,sc=null,tc=null,qc=null,hb=0,Ya=0,ib=Q.width,jb=Q.height,vc=0,wc=0,kb=new Uint8Array(16),Ma=new Uint8Array(16),ub=new THREE.Frustum,vb=new THREE.Matrix4;new THREE.Matrix4;var Da=new THREE.Vector3,ma=new THREE.Vector3,Ob=!0,nc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},\r\npoint:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},l;try{var xc={alpha:ea,depth:xa,stencil:H,antialias:$a,premultipliedAlpha:qa,preserveDrawingBuffer:ya};l=W||Q.getContext("webgl",xc)||Q.getContext("experimental-webgl",xc);if(null===l){if(null!==Q.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";\r\n}Q.addEventListener("webglcontextlost",function(a){a.preventDefault();yc();zc();Fa={}},!1)}catch(Fc){console.error(Fc)}void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var aa=new THREE.WebGLExtensions(l);aa.get("OES_texture_float");aa.get("OES_texture_float_linear");aa.get("OES_standard_derivatives");X&&aa.get("EXT_frag_depth");var zc=function(){l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);\r\nl.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.viewport(hb,Ya,ib,jb);l.clearColor(ta.r,ta.g,ta.b,Za)},yc=function(){Ib=Wb=null;Xb=zb=hc=gc=Yb=-1;Sa="";Hb=-1;Ob=!0;for(var a=0;a<Ma.length;a++)Ma[a]=0};zc();this.context=l;var pc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Gc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Hc=l.getParameter(l.MAX_TEXTURE_SIZE),Ec=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),\r\nVb=0<Gc,Nb=Vb&&aa.get("OES_texture_float"),Ic=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),Jc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var Kc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),Lc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var oc=function(){var a;return function(){if(void 0!==a)return a;a=[];if(aa.get("WEBGL_compressed_texture_pvrtc")||\r\naa.get("WEBGL_compressed_texture_s3tc"))for(var b=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}}(),Mc=0<Ic.precision&&0<Kc.precision,Ac=0<Jc.precision&&0<Lc.precision;"highp"!==ga||Mc||(Ac?(ga="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(ga="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==ga||Ac||(ga="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));\r\nvar Nc=new THREE.ShadowMapPlugin(this,pa,Fa,Ga),Oc=new THREE.SpritePlugin(this,tb),Pc=new THREE.LensFlarePlugin(this,eb);this.getContext=function(){return l};this.forceContextLoss=function(){aa.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return Vb};this.supportsFloatTextures=function(){return aa.get("OES_texture_float")};this.supportsStandardDerivatives=function(){return aa.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return aa.get("WEBGL_compressed_texture_s3tc")};\r\nthis.supportsCompressedTexturePVRTC=function(){return aa.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){return aa.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=aa.get("EXT_texture_filter_anisotropic");return a=null!==b?l.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return ga};this.getPixelRatio=function(){return O};this.setPixelRatio=function(a){O=a};this.setSize=function(a,\r\nb,c){Q.width=a*O;Q.height=b*O;!1!==c&&(Q.style.width=a+"px",Q.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){hb=a*O;Ya=b*O;ib=c*O;jb=d*O;l.viewport(hb,Ya,ib,jb)};this.setScissor=function(a,b,c,d){l.scissor(a*O,b*O,c*O,d*O)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.getClearColor=function(){return ta};this.setClearColor=function(a,b){ta.set(a);Za=void 0!==b?b:1;l.clearColor(ta.r,ta.g,ta.b,Za)};this.getClearAlpha=\r\nfunction(){return Za};this.setClearAlpha=function(a){Za=a;l.clearColor(ta.r,ta.g,ta.b,Za)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,\r\nc,d)};this.resetGLState=yc;var ic=function(a){a.target.traverse(function(a){a.removeEventListener("remove",ic);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete Fa[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=Ga,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;delete a._normalMatrix;delete a.__webglActive})},jc=function(a){a=a.target;a.removeEventListener("dispose",\r\njc);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(l.deleteBuffer(c.buffer),delete c.buffer)}I.info.memory.geometries--}else if(b=sb[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)l.deleteBuffer(e.__webglMorphTargetsBuffers[f]);delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f=0;for(g=e.numMorphNormals;f<g;f++)l.deleteBuffer(e.__webglMorphNormalsBuffers[f]);\r\ndelete e.__webglMorphNormalsBuffers}Bc(e)}delete sb[a.id]}else Bc(a);Sa=""},Jb=function(a){a=a.target;a.removeEventListener("dispose",Jb);a.image&&a.image.__webglTextureCube?(l.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(l.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit);I.info.memory.textures--},Cc=function(a){a=a.target;a.removeEventListener("dispose",Cc);if(a&&void 0!==a.__webglTexture){l.deleteTexture(a.__webglTexture);\r\ndelete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}I.info.memory.textures--},mc=function(a){a=a.target;a.removeEventListener("dispose",mc);lc(a)},Bc=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),\r\nc=0,d=b.length;c<d;c++){var e=b[c];void 0!==a[e]&&(l.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[e].buffer);delete a.__webglCustomAttributesList}I.info.memory.geometries--},lc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Xa.length;a<c;a++)if(d=Xa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Xa.length;a<\r\nc;a++)d=Xa[a],d.program!==b&&e.push(d);Xa=e;l.deleteProgram(b);I.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){f();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=l.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=l.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=l.createBuffer());a.hasPositions&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),\r\nl.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),g(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,q,r,t,s,v,u=3*a.count;for(v=0;v<u;v+=9)s=a.normalArray,d=s[v],e=s[v+1],k=s[v+2],m=s[v+3],p=s[v+4],r=s[v+5],n=s[v+6],q=s[v+7],t=s[v+8],d=(d+m+n)/3,e=(e+p+q)/3,k=(k+r+t)/3,s[v]=d,s[v+1]=e,s[v+2]=k,s[v+3]=d,s[v+4]=e,s[v+5]=k,s[v+6]=d,s[v+\r\n7]=e,s[v+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);g(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),g(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),\r\ng(b.attributes.color),l.vertexAttribPointer(b.attributes.color,3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,g,h){if(!1!==d.visible)if(v(h),a=x(a,b,c,d,h),b=!1,c="direct_"+g.id+"_"+a.id+"_"+(d.wireframe?1:0),c!==Sa&&(Sa=c,b=!0),b&&f(),h instanceof THREE.Mesh){h=!0===d.wireframe?l.LINES:l.TRIANGLES;var k=g.attributes.index;if(k){var m,n;k.array instanceof Uint32Array&&aa.get("OES_element_index_uint")?(m=l.UNSIGNED_INT,n=4):(m=l.UNSIGNED_SHORT,\r\nn=2);c=g.offsets;if(0===c.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,k.buffer)),l.drawElements(h,k.array.length,m,0),I.info.render.calls++,I.info.render.vertices+=k.array.length,I.info.render.faces+=k.array.length/3;else{b=!0;for(var p=0,q=c.length;p<q;p++){var s=c[p].index;b&&(e(d,a,g,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,k.buffer));l.drawElements(h,c[p].count,m,c[p].start*n);I.info.render.calls++;I.info.render.vertices+=c[p].count;I.info.render.faces+=c[p].count/3}}}else b&&e(d,\r\na,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),I.info.render.calls++,I.info.render.vertices+=d.array.length/3,I.info.render.faces+=d.array.length/9}else if(h instanceof THREE.PointCloud)if(h=l.POINTS,k=g.attributes.index)if(k.array instanceof Uint32Array&&aa.get("OES_element_index_uint")?(m=l.UNSIGNED_INT,n=4):(m=l.UNSIGNED_SHORT,n=2),c=g.offsets,0===c.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,k.buffer)),l.drawElements(h,k.array.length,m,0),I.info.render.calls++,\r\nI.info.render.points+=k.array.length;else for(1<c.length&&(b=!0),p=0,q=c.length;p<q;p++)s=c[p].index,b&&(e(d,a,g,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,k.buffer)),l.drawElements(h,c[p].count,m,c[p].start*n),I.info.render.calls++,I.info.render.points+=c[p].count;else if(b&&e(d,a,g,0),d=g.attributes.position,c=g.offsets,0===c.length)l.drawArrays(h,0,d.array.length/3),I.info.render.calls++,I.info.render.points+=d.array.length/3;else for(p=0,q=c.length;p<q;p++)l.drawArrays(h,c[p].index,c[p].count),I.info.render.calls++,\r\nI.info.render.points+=c[p].count;else if(h instanceof THREE.Line)if(h=h.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,D(d.linewidth),k=g.attributes.index)if(k.array instanceof Uint32Array?(m=l.UNSIGNED_INT,n=4):(m=l.UNSIGNED_SHORT,n=2),c=g.offsets,0===c.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,k.buffer)),l.drawElements(h,k.array.length,m,0),I.info.render.calls++,I.info.render.vertices+=k.array.length;else for(1<c.length&&(b=!0),p=0,q=c.length;p<q;p++)s=c[p].index,b&&(e(d,a,g,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,\r\nk.buffer)),l.drawElements(h,c[p].count,m,c[p].start*n),I.info.render.calls++,I.info.render.vertices+=c[p].count;else if(b&&e(d,a,g,0),d=g.attributes.position,c=g.offsets,0===c.length)l.drawArrays(h,0,d.array.length/3),I.info.render.calls++,I.info.render.vertices+=d.array.length/3;else for(p=0,q=c.length;p<q;p++)l.drawArrays(h,c[p].index,c[p].count),I.info.render.calls++,I.info.render.vertices+=c[p].count};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){v(k);c=x(a,b,c,d,k);b=c.attributes;\r\na=!1;c=e.id+"_"+c.id+"_"+(d.wireframe?1:0);c!==Sa&&(Sa=c,a=!0);a&&f();if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),g(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),g(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,\r\ne.__webglVertexBuffer),g(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var m=0,n=k.morphTargetForcedOrder,q=k.morphTargetInfluences,s;m<d.numSupportedMorphTargets&&m<n.length;)s=c["morphTarget"+m],0<=s&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[m]]),g(s),l.vertexAttribPointer(s,3,l.FLOAT,!1,0,0)),s=c["morphNormal"+m],0<=s&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n[m]]),g(s),l.vertexAttribPointer(s,\r\n3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=q[n[m]],m++;else{n=[];q=k.morphTargetInfluences;m=0;for(s=q.length;m<s;m++)n.push([q[m],m]);n.length>d.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(var m=0,r=d.numSupportedMorphTargets;m<r;m++)if(n[m]){var t=n[m][1];s=c["morphTarget"+m];0<=s&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[t]),g(s),l.vertexAttribPointer(s,3,l.FLOAT,\r\n!1,0,0));s=c["morphNormal"+m];0<=s&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[t]),g(s),l.vertexAttribPointer(s,3,l.FLOAT,!1,0,0));k.__webglMorphTargetInfluences[m]=q[t]}else k.__webglMorphTargetInfluences[m]=0}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c=0,q=e.__webglCustomAttributesList.length;c<q;c++)n=e.__webglCustomAttributesList[c],\r\n0<=b[n.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,n.buffer),g(b[n.buffer.belongsToAttribute]),l.vertexAttribPointer(b[n.buffer.belongsToAttribute],n.size,l.FLOAT,!1,0,0));0<=b.color&&(0<k.geometry.colors.length||0<k.geometry.faces.length?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),g(b.color),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),\r\ng(b.normal),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),g(b.tangent),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),g(b.uv),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),\r\ng(b.uv2),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g(b.skinIndex),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g(b.skinWeight),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0));0<=b.lineDistance&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),\r\ng(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(D(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),I.info.render.calls++,I.info.render.vertices+=e.__webglFaceCount,I.info.render.faces+=\r\ne.__webglFaceCount/3):k instanceof THREE.Line?(k=k.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,D(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),I.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),I.info.render.calls++,I.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;Sa="";Hb=-1;\r\nIb=null;Ob=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);vb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);ub.setFromMatrix(vb);pa.length=0;Ta.length=0;za.length=0;tb.length=0;eb.length=0;q(a);!0===I.sortObjects&&(Ta.sort(k),za.sort(n));Nc.render(a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.info.render.points=\r\n0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var f=Ga.length;d<f;d++){var g=Ga[d],h=g.object;h.visible&&(G(h,b),s(g))}a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),A(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(Ta,b,pa,e,!0,d),m(za,b,pa,e,!0,d),t(Ga,"",b,pa,e,!1,d)):(d=null,\r\nthis.setBlending(THREE.NoBlending),m(Ta,b,pa,e,!1,d),t(Ga,"opaque",b,pa,e,!1,d),m(za,b,pa,e,!0,d),t(Ga,"transparent",b,pa,e,!0,d));Oc.render(a,b);Pc.render(a,b,vc,wc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&L(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);Sa="";I.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,ub):e.render(function(a){I.renderBufferImmediate(a,\r\nf,d)})};var sb={},kc=0,Dc={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),\r\nl.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;zb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),zb=b);Xb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),Xb=a)};this.setDepthTest=function(a){gc!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),gc=a)};this.setDepthWrite=function(a){hc!==a&&(l.depthMask(a),hc=a)};this.setBlending=function(a,b,c,d){a!==Yb&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?\r\n(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),Yb=\r\na);if(a===THREE.CustomBlending){if(b!==Zb&&(l.blendEquation(T(b)),Zb=b),c!==ec||d!==fc)l.blendFunc(T(c),T(d)),ec=c,fc=d}else fc=ec=Zb=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",Jb),a.__webglTexture=l.createTexture(),I.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);\r\na.image=M(a.image,Hc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=T(a.format),e=T(a.type);U(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&\r\na.format!==THREE.RGBFormat?-1<oc().indexOf(d)?l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};\r\nthis.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?I.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Cc);a.__webglTexture=l.createTexture();I.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),\r\nd=T(a.format),e=T(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);U(l.TEXTURE_CUBE_MAP,a,c);for(var g=0;6>g;g++){a.__webglFramebuffer[g]=l.createFramebuffer();a.__webglRenderbuffer[g]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,d,a.width,a.height,0,d,e,null);var f=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+g;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[g]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,\r\nh,f.__webglTexture,0);K(a.__webglRenderbuffer[g],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),U(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,\r\n0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):K(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?\r\n(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ib,a=jb,d=hb,e=Ya);b!==uc&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),uc=b);vc=c;wc=a};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};\r\nthis.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}};\r\nTHREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:\r\nTHREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};\r\nTHREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){this.width=a;this.height=b},clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;\r\na.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;\r\nTHREE.WebGLExtensions=function(a){var b={};this.get=function(c){if(void 0!==b[c])return b[c];var d;switch(c){case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");\r\nbreak;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:d=a.getExtension(c)}null===d&&console.log("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}};\r\nTHREE.WebGLProgram=function(){var a=0;return function(b,c,d,e){var f=b.context,g=d.defines,h=d.__webglShader.uniforms,k=d.attributes,n=d.__webglShader.vertexShader,p=d.__webglShader.fragmentShader,q=d.index0AttributeName;void 0===q&&!0===e.morphTargets&&(q="position");var m="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?m="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(m="SHADOWMAP_TYPE_PCF_SOFT");var t="ENVMAP_TYPE_CUBE",s="ENVMAP_MODE_REFLECTION",r="ENVMAP_BLENDING_MULTIPLY";\r\nif(e.envMap){switch(d.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:t="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:t="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:t="ENVMAP_TYPE_SPHERE"}switch(d.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:s="ENVMAP_MODE_REFRACTION"}switch(d.combine){case THREE.MultiplyOperation:r="ENVMAP_BLENDING_MULTIPLY";\r\nbreak;case THREE.MixOperation:r="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:r="ENVMAP_BLENDING_ADD"}}var u,v;u=[];for(var y in g)v=g[y],!1!==v&&(v="#define "+y+" "+v,u.push(v));u=u.join("\\n");g=f.createProgram();d instanceof THREE.RawShaderMaterial?b=d="":(d=["precision "+e.precision+" float;","precision "+e.precision+" int;",u,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,\r\n"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+s:"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":\r\n"",e.skinning?"#define USE_SKINNING":"",e.useVertexTexture?"#define BONE_TEXTURE":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals?"#define USE_MORPHNORMALS":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+m:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":\r\n"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 projectionMatrix;\\nuniform mat4 viewMatrix;\\nuniform mat3 normalMatrix;\\nuniform vec3 cameraPosition;\\nattribute vec3 position;\\nattribute vec3 normal;\\nattribute vec2 uv;\\nattribute vec2 uv2;\\n#ifdef USE_COLOR\\n\\tattribute vec3 color;\\n#endif\\n#ifdef USE_MORPHTARGETS\\n\\tattribute vec3 morphTarget0;\\n\\tattribute vec3 morphTarget1;\\n\\tattribute vec3 morphTarget2;\\n\\tattribute vec3 morphTarget3;\\n\\t#ifdef USE_MORPHNORMALS\\n\\t\\tattribute vec3 morphNormal0;\\n\\t\\tattribute vec3 morphNormal1;\\n\\t\\tattribute vec3 morphNormal2;\\n\\t\\tattribute vec3 morphNormal3;\\n\\t#else\\n\\t\\tattribute vec3 morphTarget4;\\n\\t\\tattribute vec3 morphTarget5;\\n\\t\\tattribute vec3 morphTarget6;\\n\\t\\tattribute vec3 morphTarget7;\\n\\t#endif\\n#endif\\n#ifdef USE_SKINNING\\n\\tattribute vec4 skinIndex;\\n\\tattribute vec4 skinWeight;\\n#endif\\n"].join("\\n"),\r\nb=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap||e.normalMap?"#extension GL_OES_standard_derivatives : enable":"",u,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"",e.useFog&&e.fog?"#define USE_FOG":\r\n"",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+t:"",e.envMap?"#define "+s:"",e.envMap?"#define "+r:"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.metal?"#define METAL":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":\r\n"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+m:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\\nuniform vec3 cameraPosition;\\n"].join("\\n"));n=new THREE.WebGLShader(f,f.VERTEX_SHADER,d+n);p=new THREE.WebGLShader(f,f.FRAGMENT_SHADER,b+p);f.attachShader(g,n);f.attachShader(g,p);void 0!==q&&f.bindAttribLocation(g,\r\n0,q);f.linkProgram(g);!1===f.getProgramParameter(g,f.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."),console.error("gl.VALIDATE_STATUS",f.getProgramParameter(g,f.VALIDATE_STATUS)),console.error("gl.getError()",f.getError()));""!==f.getProgramInfoLog(g)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",f.getProgramInfoLog(g));f.deleteShader(n);f.deleteShader(p);q="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences bindMatrix bindMatrixInverse".split(" ");\r\ne.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")):q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var C in h)q.push(C);h=q;C={};q=0;for(b=h.length;q<b;q++)m=h[q],C[m]=f.getUniformLocation(g,m);this.uniforms=C;q="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(h=0;h<e.maxMorphTargets;h++)q.push("morphTarget"+h);for(h=0;h<e.maxMorphNormals;h++)q.push("morphNormal"+h);for(var x in k)q.push(x);\r\ne=q;k={};x=0;for(h=e.length;x<h;x++)C=e[x],k[C]=f.getAttribLocation(g,C);this.attributes=k;this.attributesKeys=Object.keys(this.attributes);this.id=a++;this.code=c;this.usedTimes=1;this.program=g;this.vertexShader=n;this.fragmentShader=p;return this}}();\r\nTHREE.WebGLShader=function(){var a=function(a){a=a.split("\\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\\n")};return function(b,c,d){c=b.createShader(c);b.shaderSource(c,d);b.compileShader(c);!1===b.getShaderParameter(c,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn\'t compile.");""!==b.getShaderInfoLog(c)&&(console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",b.getShaderInfoLog(c)),console.warn(a(d)));return c}}();\r\nTHREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m=a.context,t,s,r,u,v,y;this.render=function(C,x,F,z){if(0!==b.length){C=new THREE.Vector3;var G=z/F,E=.5*F,w=.5*z,D=16/z,A=new THREE.Vector2(D*G,D),U=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1);if(void 0===r){var D=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),K=new Uint16Array([0,1,2,0,2,3]);t=m.createBuffer();s=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,t);m.bufferData(m.ARRAY_BUFFER,D,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,\r\ns);m.bufferData(m.ELEMENT_ARRAY_BUFFER,K,m.STATIC_DRAW);v=m.createTexture();y=m.createTexture();m.bindTexture(m.TEXTURE_2D,v);m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);m.bindTexture(m.TEXTURE_2D,y);m.texImage2D(m.TEXTURE_2D,0,\r\nm.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);var D=(u=0<m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\\nuniform vec3 screenPosition;\\nuniform vec2 scale;\\nuniform float rotation;\\nuniform sampler2D occlusionMap;\\nattribute vec2 position;\\nattribute vec2 uv;\\nvarying vec2 vUV;\\nvarying float vVisibility;\\nvoid main() {\\nvUV = uv;\\nvec2 pos = position;\\nif( renderType == 2 ) {\\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\\nvVisibility =        visibility.r / 9.0;\\nvVisibility *= 1.0 - visibility.g / 9.0;\\nvVisibility *=       visibility.b / 9.0;\\nvVisibility *= 1.0 - visibility.a / 9.0;\\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\\n}\\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\\n}",\r\nfragmentShader:"uniform lowp int renderType;\\nuniform sampler2D map;\\nuniform float opacity;\\nuniform vec3 color;\\nvarying vec2 vUV;\\nvarying float vVisibility;\\nvoid main() {\\nif( renderType == 0 ) {\\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\\n} else if( renderType == 1 ) {\\ngl_FragColor = texture2D( map, vUV );\\n} else {\\nvec4 texture = texture2D( map, vUV );\\ntexture.a *= opacity * vVisibility;\\ngl_FragColor = texture;\\ngl_FragColor.rgb *= color;\\n}\\n}"}:{vertexShader:"uniform lowp int renderType;\\nuniform vec3 screenPosition;\\nuniform vec2 scale;\\nuniform float rotation;\\nattribute vec2 position;\\nattribute vec2 uv;\\nvarying vec2 vUV;\\nvoid main() {\\nvUV = uv;\\nvec2 pos = position;\\nif( renderType == 2 ) {\\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\\n}\\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\\n}",\r\nfragmentShader:"precision mediump float;\\nuniform lowp int renderType;\\nuniform sampler2D map;\\nuniform sampler2D occlusionMap;\\nuniform float opacity;\\nuniform vec3 color;\\nvarying vec2 vUV;\\nvoid main() {\\nif( renderType == 0 ) {\\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\\n} else if( renderType == 1 ) {\\ngl_FragColor = texture2D( map, vUV );\\n} else {\\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\\nvisibility = ( 1.0 - visibility / 4.0 );\\nvec4 texture = texture2D( map, vUV );\\ntexture.a *= opacity * visibility;\\ngl_FragColor = texture;\\ngl_FragColor.rgb *= color;\\n}\\n}"},\r\nK=m.createProgram(),L=m.createShader(m.FRAGMENT_SHADER),N=m.createShader(m.VERTEX_SHADER),T="precision "+a.getPrecision()+" float;\\n";m.shaderSource(L,T+D.fragmentShader);m.shaderSource(N,T+D.vertexShader);m.compileShader(L);m.compileShader(N);m.attachShader(K,L);m.attachShader(K,N);m.linkProgram(K);r=K;p=m.getAttribLocation(r,"position");q=m.getAttribLocation(r,"uv");c=m.getUniformLocation(r,"renderType");d=m.getUniformLocation(r,"map");e=m.getUniformLocation(r,"occlusionMap");f=m.getUniformLocation(r,\r\n"opacity");g=m.getUniformLocation(r,"color");h=m.getUniformLocation(r,"scale");k=m.getUniformLocation(r,"rotation");n=m.getUniformLocation(r,"screenPosition")}m.useProgram(r);m.enableVertexAttribArray(p);m.enableVertexAttribArray(q);m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,t);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(q,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,s);m.disable(m.CULL_FACE);m.depthMask(!1);K=0;for(L=b.length;K<L;K++)if(D=16/z,A.set(D*\r\nG,D),N=b[K],C.set(N.matrixWorld.elements[12],N.matrixWorld.elements[13],N.matrixWorld.elements[14]),C.applyMatrix4(x.matrixWorldInverse),C.applyProjection(x.projectionMatrix),U.copy(C),M.x=U.x*E+E,M.y=U.y*w+w,u||0<M.x&&M.x<F&&0<M.y&&M.y<z){m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,M.x-8,M.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,A.x,A.y);m.uniform3f(n,U.x,U.y,U.z);m.disable(m.BLEND);m.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,\r\n0);m.activeTexture(m.TEXTURE0);m.bindTexture(m.TEXTURE_2D,y);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,M.x-8,M.y-8,16,16,0);m.uniform1i(c,1);m.disable(m.DEPTH_TEST);m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);N.positionScreen.copy(U);N.customUpdateCallback?N.customUpdateCallback(N):N.updateLensFlares();m.uniform1i(c,2);m.enable(m.BLEND);for(var T=0,Q=N.lensFlares.length;T<Q;T++){var W=N.lensFlares[T];.001<W.opacity&&.001<W.scale&&(U.x=W.x,\r\nU.y=W.y,U.z=W.z,D=W.size*W.scale/z,A.x=D*G,A.y=D,m.uniform3f(n,U.x,U.y,U.z),m.uniform2f(h,A.x,A.y),m.uniform1f(k,W.rotation),m.uniform1f(f,W.opacity),m.uniform3f(g,W.color.r,W.color.g,W.color.b),a.setBlending(W.blending,W.blendEquation,W.blendSrc,W.blendDst),a.setTexture(W.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(!0);a.resetGLState()}}};\r\nTHREE.ShadowMapPlugin=function(a,b,c,d){function e(a,b,d){if(b.visible){var g=c[b.id];if(g&&b.castShadow&&(!1===b.frustumCulled||!0===p.intersectsObject(b)))for(var f=0,h=g.length;f<h;f++){var k=g[f];b._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,b.matrixWorld);r.push(k)}f=0;for(h=b.children.length;f<h;f++)e(a,b.children[f],d)}}var f=a.context,g,h,k,n,p=new THREE.Frustum,q=new THREE.Matrix4,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,r=[],u=THREE.ShaderLib.depthRGBA,v=THREE.UniformsUtils.clone(u.uniforms);\r\ng=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader});h=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0});k=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,skinning:!0});n=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0,skinning:!0});g._shadowPass=!0;h._shadowPass=!0;k._shadowPass=\r\n!0;n._shadowPass=!0;this.render=function(c,v){if(!1!==a.shadowMapEnabled){var u,F,z,G,E,w,D,A,U=[];G=0;f.clearColor(1,1,1,1);f.disable(f.BLEND);f.enable(f.CULL_FACE);f.frontFace(f.CCW);a.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK);a.setDepthTest(!0);u=0;for(F=b.length;u<F;u++)if(z=b[u],z.castShadow)if(z instanceof THREE.DirectionalLight&&z.shadowCascade)for(E=0;E<z.shadowCascadeCount;E++){var M;if(z.shadowCascadeArray[E])M=z.shadowCascadeArray[E];else{D=z;var K=\r\nE;M=new THREE.DirectionalLight;M.isVirtual=!0;M.onlyShadow=!0;M.castShadow=!0;M.shadowCameraNear=D.shadowCameraNear;M.shadowCameraFar=D.shadowCameraFar;M.shadowCameraLeft=D.shadowCameraLeft;M.shadowCameraRight=D.shadowCameraRight;M.shadowCameraBottom=D.shadowCameraBottom;M.shadowCameraTop=D.shadowCameraTop;M.shadowCameraVisible=D.shadowCameraVisible;M.shadowDarkness=D.shadowDarkness;M.shadowBias=D.shadowCascadeBias[K];M.shadowMapWidth=D.shadowCascadeWidth[K];M.shadowMapHeight=D.shadowCascadeHeight[K];\r\nM.pointsWorld=[];M.pointsFrustum=[];A=M.pointsWorld;w=M.pointsFrustum;for(var L=0;8>L;L++)A[L]=new THREE.Vector3,w[L]=new THREE.Vector3;A=D.shadowCascadeNearZ[K];D=D.shadowCascadeFarZ[K];w[0].set(-1,-1,A);w[1].set(1,-1,A);w[2].set(-1,1,A);w[3].set(1,1,A);w[4].set(-1,-1,D);w[5].set(1,-1,D);w[6].set(-1,1,D);w[7].set(1,1,D);M.originalCamera=v;w=new THREE.Gyroscope;w.position.copy(z.shadowCascadeOffset);w.add(M);w.add(M.target);v.add(w);z.shadowCascadeArray[E]=M;console.log("Created virtualLight",M)}K=\r\nz;A=E;D=K.shadowCascadeArray[A];D.position.copy(K.position);D.target.position.copy(K.target.position);D.lookAt(D.target);D.shadowCameraVisible=K.shadowCameraVisible;D.shadowDarkness=K.shadowDarkness;D.shadowBias=K.shadowCascadeBias[A];w=K.shadowCascadeNearZ[A];K=K.shadowCascadeFarZ[A];D=D.pointsFrustum;D[0].z=w;D[1].z=w;D[2].z=w;D[3].z=w;D[4].z=K;D[5].z=K;D[6].z=K;D[7].z=K;U[G]=M;G++}else U[G]=z,G++;u=0;for(F=U.length;u<F;u++){z=U[u];z.shadowMap||(E=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&\r\n(E=THREE.NearestFilter),z.shadowMap=new THREE.WebGLRenderTarget(z.shadowMapWidth,z.shadowMapHeight,{minFilter:E,magFilter:E,format:THREE.RGBAFormat}),z.shadowMapSize=new THREE.Vector2(z.shadowMapWidth,z.shadowMapHeight),z.shadowMatrix=new THREE.Matrix4);if(!z.shadowCamera){if(z instanceof THREE.SpotLight)z.shadowCamera=new THREE.PerspectiveCamera(z.shadowCameraFov,z.shadowMapWidth/z.shadowMapHeight,z.shadowCameraNear,z.shadowCameraFar);else if(z instanceof THREE.DirectionalLight)z.shadowCamera=new THREE.OrthographicCamera(z.shadowCameraLeft,\r\nz.shadowCameraRight,z.shadowCameraTop,z.shadowCameraBottom,z.shadowCameraNear,z.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}c.add(z.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}z.shadowCameraVisible&&!z.cameraHelper&&(z.cameraHelper=new THREE.CameraHelper(z.shadowCamera),c.add(z.cameraHelper));if(z.isVirtual&&M.originalCamera==v){E=v;G=z.shadowCamera;w=z.pointsFrustum;D=z.pointsWorld;m.set(Infinity,Infinity,Infinity);t.set(-Infinity,-Infinity,-Infinity);\r\nfor(K=0;8>K;K++)A=D[K],A.copy(w[K]),A.unproject(E),A.applyMatrix4(G.matrixWorldInverse),A.x<m.x&&(m.x=A.x),A.x>t.x&&(t.x=A.x),A.y<m.y&&(m.y=A.y),A.y>t.y&&(t.y=A.y),A.z<m.z&&(m.z=A.z),A.z>t.z&&(t.z=A.z);G.left=m.x;G.right=t.x;G.top=t.y;G.bottom=m.y;G.updateProjectionMatrix()}G=z.shadowMap;w=z.shadowMatrix;E=z.shadowCamera;E.position.setFromMatrixPosition(z.matrixWorld);s.setFromMatrixPosition(z.target.matrixWorld);E.lookAt(s);E.updateMatrixWorld();E.matrixWorldInverse.getInverse(E.matrixWorld);z.cameraHelper&&\r\n(z.cameraHelper.visible=z.shadowCameraVisible);z.shadowCameraVisible&&z.cameraHelper.update();w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);w.multiply(E.projectionMatrix);w.multiply(E.matrixWorldInverse);q.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(G);a.clear();r.length=0;e(c,c,E);z=0;for(G=r.length;z<G;z++)D=r[z],w=D.object,D=D.buffer,K=w.material instanceof THREE.MeshFaceMaterial?w.material.materials[0]:w.material,A=void 0!==w.geometry.morphTargets&&\r\n0<w.geometry.morphTargets.length&&K.morphTargets,L=w instanceof THREE.SkinnedMesh&&K.skinning,A=w.customDepthMaterial?w.customDepthMaterial:L?A?n:k:A?h:g,a.setMaterialFaces(K),D instanceof THREE.BufferGeometry?a.renderBufferDirect(E,b,null,A,D,w):a.renderBuffer(E,b,null,A,D,w);z=0;for(G=d.length;z<G;z++)D=d[z],w=D.object,w.visible&&w.castShadow&&(w._modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,w.matrixWorld),a.renderImmediateObject(E,b,null,g,w))}u=a.getClearColor();F=a.getClearAlpha();f.clearColor(u.r,\r\nu.g,u.b,F);f.enable(f.BLEND);a.shadowMapCullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState()}}};\r\nTHREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v,y;function C(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,F,z,G,E,w=new THREE.Vector3,D=new THREE.Quaternion,A=new THREE.Vector3;this.render=function(U,M){if(0!==b.length){if(void 0===G){var K=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),L=new Uint16Array([0,1,2,0,2,3]);F=x.createBuffer();z=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,F);x.bufferData(x.ARRAY_BUFFER,K,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,\r\nz);x.bufferData(x.ELEMENT_ARRAY_BUFFER,L,x.STATIC_DRAW);var K=x.createProgram(),L=x.createShader(x.VERTEX_SHADER),N=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(L,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\\nuniform mat4 projectionMatrix;\\nuniform float rotation;\\nuniform vec2 scale;\\nuniform vec2 uvOffset;\\nuniform vec2 uvScale;\\nattribute vec2 position;\\nattribute vec2 uv;\\nvarying vec2 vUV;\\nvoid main() {\\nvUV = uvOffset + uv * uvScale;\\nvec2 alignedPosition = position * scale;\\nvec2 rotatedPosition;\\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\nvec4 finalPosition;\\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\nfinalPosition.xy += rotatedPosition;\\nfinalPosition = projectionMatrix * finalPosition;\\ngl_Position = finalPosition;\\n}"].join("\\n"));\r\nx.shaderSource(N,["precision "+a.getPrecision()+" float;","uniform vec3 color;\\nuniform sampler2D map;\\nuniform float opacity;\\nuniform int fogType;\\nuniform vec3 fogColor;\\nuniform float fogDensity;\\nuniform float fogNear;\\nuniform float fogFar;\\nuniform float alphaTest;\\nvarying vec2 vUV;\\nvoid main() {\\nvec4 texture = texture2D( map, vUV );\\nif ( texture.a < alphaTest ) discard;\\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\\nif ( fogType > 0 ) {\\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\\nfloat fogFactor = 0.0;\\nif ( fogType == 1 ) {\\nfogFactor = smoothstep( fogNear, fogFar, depth );\\n} else {\\nconst float LOG2 = 1.442695;\\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\\n}\\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\\n}\\n}"].join("\\n"));\r\nx.compileShader(L);x.compileShader(N);x.attachShader(K,L);x.attachShader(K,N);x.linkProgram(K);G=K;v=x.getAttribLocation(G,"position");y=x.getAttribLocation(G,"uv");c=x.getUniformLocation(G,"uvOffset");d=x.getUniformLocation(G,"uvScale");e=x.getUniformLocation(G,"rotation");f=x.getUniformLocation(G,"scale");g=x.getUniformLocation(G,"color");h=x.getUniformLocation(G,"map");k=x.getUniformLocation(G,"opacity");n=x.getUniformLocation(G,"modelViewMatrix");p=x.getUniformLocation(G,"projectionMatrix");q=\r\nx.getUniformLocation(G,"fogType");m=x.getUniformLocation(G,"fogDensity");t=x.getUniformLocation(G,"fogNear");s=x.getUniformLocation(G,"fogFar");r=x.getUniformLocation(G,"fogColor");u=x.getUniformLocation(G,"alphaTest");K=document.createElement("canvas");K.width=8;K.height=8;L=K.getContext("2d");L.fillStyle="white";L.fillRect(0,0,8,8);E=new THREE.Texture(K);E.needsUpdate=!0}x.useProgram(G);x.enableVertexAttribArray(v);x.enableVertexAttribArray(y);x.disable(x.CULL_FACE);x.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,\r\nF);x.vertexAttribPointer(v,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(y,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(p,!1,M.projectionMatrix.elements);x.activeTexture(x.TEXTURE0);x.uniform1i(h,0);L=K=0;(N=U.fog)?(x.uniform3f(r,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(x.uniform1f(t,N.near),x.uniform1f(s,N.far),x.uniform1i(q,1),L=K=1):N instanceof THREE.FogExp2&&(x.uniform1f(m,N.density),x.uniform1i(q,2),L=K=2)):(x.uniform1i(q,0),L=K=0);for(var N=0,T=b.length;N<\r\nT;N++){var Q=b[N];Q._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,Q.matrixWorld);Q.z=-Q._modelViewMatrix.elements[14]}b.sort(C);for(var W=[],N=0,T=b.length;N<T;N++){var Q=b[N],O=Q.material;x.uniform1f(u,O.alphaTest);x.uniformMatrix4fv(n,!1,Q._modelViewMatrix.elements);Q.matrixWorld.decompose(w,D,A);W[0]=A.x;W[1]=A.y;Q=0;U.fog&&O.fog&&(Q=L);K!==Q&&(x.uniform1i(q,Q),K=Q);null!==O.map?(x.uniform2f(c,O.map.offset.x,O.map.offset.y),x.uniform2f(d,O.map.repeat.x,O.map.repeat.y)):(x.uniform2f(c,\r\n0,0),x.uniform2f(d,1,1));x.uniform1f(k,O.opacity);x.uniform3f(g,O.color.r,O.color.g,O.color.b);x.uniform1f(e,O.rotation);x.uniform2fv(f,W);a.setBlending(O.blending,O.blendEquation,O.blendSrc,O.blendDst);a.setDepthTest(O.depthTest);a.setDepthWrite(O.depthWrite);O.map&&O.map.image&&O.map.image.width?a.setTexture(O.map,0):a.setTexture(E,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}x.enable(x.CULL_FACE);a.resetGLState()}}};\r\nTHREE.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return a.center()}};\r\nTHREE.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.Texture(void 0,b);e.load(a,function(a){f.image=a;f.needsUpdate=!0;c&&c(f)},void 0,function(a){d&&d(a)});f.sourceFile=a;return f},loadTextureCube:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.CubeTexture([],b);f.flipY=!1;var g=0;b=function(b){e.load(a[b],function(a){f.images[b]=a;g+=1;6===g&&(f.needsUpdate=!0,c&&\r\nc(f))},void 0,d)};for(var h=0,k=a.length;h<k;++h)b(h);return f},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,f=document.createElement("canvas");\r\nf.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),n=k.data,p=0;p<d;p++)for(var q=0;q<e;q++){var m=0>q-1?0:q-1,t=q+1>e-1?e-1:q+1,s=0>p-1?0:p-1,r=p+1>d-1?d-1:p+1,u=[],v=[0,0,h[4*(q*d+p)]/255*b];u.push([-1,0,h[4*(q*d+s)]/255*b]);u.push([-1,-1,h[4*(m*d+s)]/255*b]);u.push([0,-1,h[4*(m*d+p)]/255*b]);u.push([1,-1,h[4*(m*d+r)]/255*b]);u.push([1,0,h[4*(q*d+r)]/255*b]);u.push([1,1,h[4*(t*d+r)]/255*b]);u.push([0,1,h[4*(t*d+p)]/255*\r\nb]);u.push([-1,1,h[4*(t*d+s)]/255*b]);m=[];s=u.length;for(t=0;t<s;t++){var r=u[t],y=u[(t+1)%s],r=[r[0]-v[0],r[1]-v[1],r[2]-v[2]],y=[y[0]-v[0],y[1]-v[1],y[2]-v[2]];m.push(c([r[1]*y[2]-r[2]*y[1],r[2]*y[0]-r[0]*y[2],r[0]*y[1]-r[1]*y[0]]))}u=[0,0,0];for(t=0;t<m.length;t++)u[0]+=m[t][0],u[1]+=m[t][1],u[2]+=m[t][2];u[0]/=m.length;u[1]/=m.length;u[2]/=m.length;v=4*(q*d+p);n[v]=(u[0]+1)/2*255|0;n[v+1]=(u[1]+1)/2*255|0;n[v+2]=255*u[2]|0;n[v+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,\r\nb,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};\r\nTHREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};\r\nTHREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(a){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing.";}},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=\r\na},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,k,n,p,q,m,t,s,r,u,v=b.glyphs[a]||b.glyphs["?"];if(v){if(v.o)for(b=v._cachedOutline||(v._cachedOutline=v.o.split(" ")),n=b.length,a=0;a<n;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;p=b[a++]*c;e.moveTo(k,p);\r\nbreak;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d;p=b[a++]*c;t=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(t,s,k,p);if(g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++){var y=g/h;THREE.Shape.Utils.b2(y,q,t,k);THREE.Shape.Utils.b2(y,m,s,p)}break;case "b":if(k=b[a++]*c+d,p=b[a++]*c,t=b[a++]*c+d,s=b[a++]*c,r=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(t,s,r,u,k,p),g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++)y=g/h,THREE.Shape.Utils.b3(y,q,t,r,k),THREE.Shape.Utils.b3(y,\r\nm,s,u,p)}return{offset:v.ha*c,path:e}}}};\r\nTHREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};\r\n(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,n,p;if(0<b(a))for(n=0;n<e;n++)g[n]=n;else for(n=0;n<e;n++)g[n]=e-1-n;var q=2*e;for(n=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=n;e<=k&&(k=0);n=k+1;e<=n&&(n=0);p=n+1;e<=p&&(p=0);var m;a:{var t=m=void 0,s=void 0,r=void 0,u=void 0,v=void 0,y=void 0,C=void 0,x=void 0,\r\nt=a[g[k]].x,s=a[g[k]].y,r=a[g[n]].x,u=a[g[n]].y,v=a[g[p]].x,y=a[g[p]].y;if(1E-10>(r-t)*(y-s)-(u-s)*(v-t))m=!1;else{var F=void 0,z=void 0,G=void 0,E=void 0,w=void 0,D=void 0,A=void 0,U=void 0,M=void 0,K=void 0,M=U=A=x=C=void 0,F=v-r,z=y-u,G=t-v,E=s-y,w=r-t,D=u-s;for(m=0;m<e;m++)if(C=a[g[m]].x,x=a[g[m]].y,!(C===t&&x===s||C===r&&x===u||C===v&&x===y)&&(A=C-t,U=x-s,M=C-r,K=x-u,C-=v,x-=y,M=F*K-z*M,A=w*U-D*A,U=G*x-E*C,-1E-10<=M&&-1E-10<=U&&-1E-10<=A)){m=!1;break a}m=!0}}if(m){f.push([a[g[k]],a[g[n]],a[g[p]]]);\r\nh.push([g[k],g[n],g[p]]);k=n;for(p=n+1;p<e;k++,p++)g[k]=g[p];e--;q=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;\r\nTHREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain)};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);THREE.Audio.prototype.constructor=THREE.Audio;\r\nTHREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.source.connect(b.panner);b.source.start(0)})};c.send();return this};THREE.Audio.prototype.setLoop=function(a){this.source.loop=a};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};\r\nTHREE.Audio.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}();THREE.AudioListener=function(){THREE.Object3D.call(this);this.type="AudioListener";this.context=new (window.AudioContext||window.webkitAudioContext)};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);THREE.AudioListener.prototype.constructor=THREE.AudioListener;\r\nTHREE.AudioListener.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g){THREE.Object3D.prototype.updateMatrixWorld.call(this,g);g=this.context.listener;var h=this.up;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.subVectors(a,f);g.setPosition(a.x,a.y,a.z);g.setOrientation(d.x,d.y,d.z,h.x,h.y,h.z);g.setVelocity(e.x,e.y,e.z);f.copy(a)}}();\r\nTHREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(a){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};\r\nTHREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};\r\nTHREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,k;g<=h;)if(d=Math.floor(g+(h-g)/2),k=c[d]-f,0>k)g=d+1;else if(0<k)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};\r\nTHREE.Curve.prototype.getTangentAt=function(a){a=this.getUtoTmapping(a);return this.getTangent(a)};\r\nTHREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){a=.5*(c-a);d=.5*(d-b);var f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};\r\nTHREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};\r\nTHREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){var b=a*this.getLength(),c=this.getCurveLengths();for(a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};\r\nTHREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};\r\nTHREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,k,n,p,q=a[0]instanceof THREE.Vector3;p=q?new THREE.Vector3:new THREE.Vector2;k=0;for(n=a.length;k<n;k++)h=a[k],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),q&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),p.add(h);a={minX:e,minY:f,maxX:b,maxY:c};q&&(a.maxZ=d,a.minZ=g);return a};\r\nTHREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};\r\nTHREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};\r\nTHREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,k;d=0;for(e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,k=g/c.maxX,k=b.getUtoTmapping(k,g),g=b.getPoint(k),k=b.getTangent(k),k.set(-k.y,k.x).multiplyScalar(h),f.x=g.x+k.x,f.y=g.y+k.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;\r\nTHREE.Gyroscope.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Quaternion,f=new THREE.Vector3;return function(g){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||g)this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(d,e,f),this.matrix.decompose(a,b,c),this.matrixWorld.compose(d,b,f)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=\r\n!1,g=!0;for(var h=0,k=this.children.length;h<k;h++)this.children[h].updateMatrixWorld(g)}}();THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.Path.prototype.constructor=THREE.Path;THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"};\r\nTHREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};\r\nTHREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args,d=new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b));this.curves.push(d);this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};\r\nTHREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d));this.curves.push(f);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};\r\nTHREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f));this.curves.push(h);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};\r\nTHREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};\r\nTHREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),k=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(k);k=k.getPoint(1);h.push(k.x);h.push(k.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};\r\nTHREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c};\r\nTHREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,k,n,p,q,m,t,s,r;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];k=f[3];q=f[0];m=f[1];0<c.length?(g=c[c.length-1],t=g.x,\r\ns=g.y):(g=this.actions[d-1].args,t=g[g.length-2],s=g[g.length-1]);for(f=1;f<=a;f++)r=f/a,g=THREE.Shape.Utils.b2(r,t,q,h),r=THREE.Shape.Utils.b2(r,s,m,k),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];q=f[0];m=f[1];n=f[2];p=f[3];0<c.length?(g=c[c.length-1],t=g.x,s=g.y):(g=this.actions[d-1].args,t=g[g.length-2],s=g[g.length-1]);for(f=1;f<=a;f++)r=f/a,g=THREE.Shape.Utils.b3(r,t,q,n,h),r=THREE.Shape.Utils.b3(r,s,m,p,k),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.CSPLINE_THRU:g=\r\nthis.actions[d-1].args;r=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;r=r.concat(f[0]);r=new THREE.SplineCurve(r);for(f=1;f<=g;f++)c.push(r.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];k=f[1];m=f[2];n=f[3];g=f[4];q=!!f[5];t=g-n;s=2*a;for(f=1;f<=s;f++)r=f/s,q||(r=1-r),r=n+r*t,g=h+m*Math.cos(r),r=k+m*Math.sin(r),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.ELLIPSE:for(h=f[0],k=f[1],m=f[2],p=f[3],n=f[4],g=f[5],q=!!f[6],t=g-n,s=2*a,f=1;f<=s;f++)r=f/s,q||\r\n(r=1-r),r=n+r*t,g=h+m*Math.cos(r),r=k+p*Math.sin(r),c.push(new THREE.Vector2(g,r))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};\r\nTHREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves;b.push(g)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,g=0;g<c;e=g++){var f=b[e],h=b[g],k=h.x-f.x,m=h.y-f.y;if(1E-10<Math.abs(m)){if(0>m&&(f=b[g],k=-k,h=b[e],m=-m),!(a.y<f.y||a.y>h.y))if(a.y==f.y){if(a.x==f.x)return!0}else{e=m*(a.x-f.x)-k*(a.y-f.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==f.y&&(h.x<=a.x&&a.x<=f.x||f.x<=a.x&&a.x<=\r\nh.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;b<c;b++)d=a[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(f.push(g),g=new THREE.Path),g[d].apply(g,e);0!=g.actions.length&&f.push(g);return f}(this.actions);if(0==e.length)return[];if(!0===b)return c(e);var f,g,h,k=[];if(1==e.length)return g=e[0],h=new THREE.Shape,h.actions=g.actions,h.curves=g.curves,k.push(h),k;var n=!THREE.Shape.Utils.isClockWise(e[0].getPoints()),n=a?!n:n;\r\nh=[];var p=[],q=[],m=0,t;p[m]=void 0;q[m]=[];var s,r;s=0;for(r=e.length;s<r;s++)g=e[s],t=g.getPoints(),f=THREE.Shape.Utils.isClockWise(t),(f=a?!f:f)?(!n&&p[m]&&m++,p[m]={s:new THREE.Shape,p:t},p[m].s.actions=g.actions,p[m].s.curves=g.curves,n&&m++,q[m]=[]):q[m].push({h:g,p:t[0]});if(!p[0])return c(e);if(1<p.length){s=!1;r=[];g=0;for(e=p.length;g<e;g++)h[g]=[];g=0;for(e=p.length;g<e;g++)for(f=q[g],n=0;n<f.length;n++){m=f[n];t=!0;for(var u=0;u<p.length;u++)d(m.p,p[u].p)&&(g!=u&&r.push({froms:g,tos:u,\r\nhole:n}),t?(t=!1,h[u].push(m)):s=!0);t&&h[g].push(m)}0<r.length&&(s||(q=h))}s=0;for(r=p.length;s<r;s++)for(h=p[s].s,k.push(h),g=q[s],e=0,f=g.length;e<f;e++)h.holes.push(g[e].h);return k};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.constructor=THREE.Shape;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};\r\nTHREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};\r\nTHREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};\r\nTHREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,g){var f=b.x-a.x,h=b.y-a.y,k=e.x-d.x,n=e.y-d.y,p=a.x-d.x,q=a.y-d.y,G=h*k-f*n,E=h*p-f*q;if(1E-10<Math.abs(G)){if(0<G){if(0>E||E>G)return[];k=n*p-k*q;if(0>k||k>G)return[]}else{if(0<E||E<G)return[];k=n*p-k*q;if(0<k||k<G)return[]}if(0==k)return!g||0!=E&&E!=G?[a]:[];if(k==G)return!g||0!=E&&E!=G?[b]:[];if(0==E)return[d];\r\nif(E==G)return[e];g=k/G;return[{x:a.x+g*f,y:a.y+g*h}]}if(0!=E||n*p!=k*q)return[];h=0==f&&0==h;k=0==k&&0==n;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=f?(a.x<b.x?(f=a,k=a.x,h=b,a=b.x):(f=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,G=d.x,n=e,d=e.x):(b=e,G=e.x,n=d,d=d.x)):(a.y<b.y?(f=a,k=a.y,h=b,a=b.y):(f=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,G=d.y,n=e,d=e.y):(b=e,G=e.y,n=d,d=d.y));return k<=G?a<G?[]:a==G?g?[]:[b]:a<=d?[b,h]:[b,n]:k>d?[]:k==d?g?[]:[f]:a<=d?[f,h]:\r\n[f,n]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,k,n,p={};h=a.concat();f=0;for(g=b.length;f<g;f++)Array.prototype.push.apply(h,b[f]);f=0;for(g=h.length;f<g;f++)n=h[f].x+":"+h[f].y,void 0!==p[n]&&console.log("Duplicate point",n),p[n]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;\r\nd=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<n.length;e++)for(f=b[n[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,n=[],p,q,z,G,E,w=[],D,A,U,M=0;for(p=b.length;M<p;M++)n.push(M);D=0;for(var K=2*n.length;0<n.length;){K--;if(0>K){console.log("Infinite Loop! Holes left:"+\r\nn.length+", Probably Hole outside Shape!");break}for(q=D;q<h.length;q++){z=h[q];p=-1;for(M=0;M<n.length;M++)if(G=n[M],E=z.x+":"+z.y+":"+G,void 0===w[E]){k=b[G];for(A=0;A<k.length;A++)if(G=k[A],c(q,A)&&!f(z,G)&&!g(z,G)){p=A;n.splice(M,1);D=h.slice(0,q+1);G=h.slice(q);A=k.slice(p);U=k.slice(0,p+1);h=D.concat(A).concat(U).concat(G);D=q;break}if(0<=p)break;w[E]=!0}if(0<=p)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k=q[f],h=0;3>h;h++)n=k[h].x+":"+k[h].y,\r\nn=p[n],void 0!==n&&(k[h]=n);return q.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,\r\nb)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};\r\nTHREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return b};\r\nTHREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b=new THREE.Vector2;b.x=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);return b.normalize()};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;\r\nTHREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};\r\nTHREE.SplineCurve=function(a){this.points=void 0==a?[]:a};THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;\r\nTHREE.SplineCurve.prototype.getPoint=function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector2;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);return c};THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g};\r\nTHREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve;THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;0>b&&(b+=2*Math.PI);b>2*Math.PI&&(b-=2*Math.PI);a=!0===this.aClockwise?this.aEndAngle+(1-a)*(2*Math.PI-b):this.aStartAngle+a*b;b=new THREE.Vector2;b.x=this.aX+this.xRadius*Math.cos(a);b.y=this.aY+this.yRadius*Math.sin(a);return b};\r\nTHREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype);THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b});\r\nTHREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b=new THREE.Vector3;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);b.z=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return b});\r\nTHREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b=new THREE.Vector3;b.x=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b.y=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b.z=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return b});\r\nTHREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector3;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);c.z=THREE.Curve.Utils.interpolate(d.z,e.z,f.z,b.z,a);return c});\r\nTHREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=Math.floor(a);a-=c;var c=c+(0<c?0:(Math.floor(Math.abs(c)/b.length)+1)*b.length),d=b[(c-1)%b.length],e=b[c%b.length],f=b[(c+1)%b.length],b=b[(c+2)%b.length],c=new THREE.Vector3;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);c.z=THREE.Curve.Utils.interpolate(d.z,e.z,f.z,b.z,a);return c});\r\nTHREE.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){console.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){console.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){console.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(a){if(!0===a.initialized)return a;for(var b=0;b<a.hierarchy.length;b++){for(var c=0;c<a.hierarchy[b].keys.length;c++)if(0>a.hierarchy[b].keys[c].time&&(a.hierarchy[b].keys[c].time=\r\n0),void 0!==a.hierarchy[b].keys[c].rot&&!(a.hierarchy[b].keys[c].rot instanceof THREE.Quaternion)){var d=a.hierarchy[b].keys[c].rot;a.hierarchy[b].keys[c].rot=(new THREE.Quaternion).fromArray(d)}if(a.hierarchy[b].keys.length&&void 0!==a.hierarchy[b].keys[0].morphTargets){d={};for(c=0;c<a.hierarchy[b].keys.length;c++)for(var e=0;e<a.hierarchy[b].keys[c].morphTargets.length;e++){var f=a.hierarchy[b].keys[c].morphTargets[e];d[f]=-1}a.hierarchy[b].usedMorphTargets=d;for(c=0;c<a.hierarchy[b].keys.length;c++){var g=\r\n{};for(f in d){for(e=0;e<a.hierarchy[b].keys[c].morphTargets.length;e++)if(a.hierarchy[b].keys[c].morphTargets[e]===f){g[f]=a.hierarchy[b].keys[c].morphTargetsInfluences[e];break}e===a.hierarchy[b].keys[c].morphTargets.length&&(g[f]=0)}a.hierarchy[b].keys[c].morphTargetsInfluences=g}}for(c=1;c<a.hierarchy[b].keys.length;c++)a.hierarchy[b].keys[c].time===a.hierarchy[b].keys[c-1].time&&(a.hierarchy[b].keys.splice(c,1),c--);for(c=0;c<a.hierarchy[b].keys.length;c++)a.hierarchy[b].keys[c].index=c}a.initialized=\r\n!0;return a},parse:function(a){var b=function(a,c){c.push(a);for(var d=0;d<a.children.length;d++)b(a.children[d],c)},c=[];if(a instanceof THREE.SkinnedMesh)for(var d=0;d<a.skeleton.bones.length;d++)c.push(a.skeleton.bones[d]);else b(a,c);return c},play:function(a){-1===this.animations.indexOf(a)&&this.animations.push(a)},stop:function(a){a=this.animations.indexOf(a);-1!==a&&this.animations.splice(a,1)},update:function(a){for(var b=0;b<this.animations.length;b++)this.animations[b].resetBlendWeights();\r\nfor(b=0;b<this.animations.length;b++)this.animations[b].update(a)}};THREE.Animation=function(a,b){this.root=a;this.data=THREE.AnimationHandler.init(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=!0;this.weight=0;this.interpolationType=THREE.AnimationHandler.LINEAR};THREE.Animation.prototype.keyTypes=["pos","rot","scl"];\r\nTHREE.Animation.prototype.play=function(a,b){this.currentTime=void 0!==a?a:0;this.weight=void 0!==b?b:1;this.isPlaying=!0;this.reset();THREE.AnimationHandler.play(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.stop(this)};\r\nTHREE.Animation.prototype.reset=function(){for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a];void 0===c.animationCache&&(c.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});void 0===c.animationCache.animations[this.data.name]&&(c.animationCache.animations[this.data.name]={},c.animationCache.animations[this.data.name].prevKey={pos:0,rot:0,scl:0},c.animationCache.animations[this.data.name].nextKey={pos:0,rot:0,scl:0},c.animationCache.animations[this.data.name].originalMatrix=\r\nc.matrix);for(var c=c.animationCache.animations[this.data.name],d=0;3>d;d++){for(var e=this.keyTypes[d],f=this.data.hierarchy[a].keys[0],g=this.getNextKeyWith(e,a,1);g.time<this.currentTime&&g.index>f.index;)f=g,g=this.getNextKeyWith(e,a,g.index+1);c.prevKey[e]=f;c.nextKey[e]=g}}};\r\nTHREE.Animation.prototype.resetBlendWeights=function(){for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a];void 0!==c.animationCache&&(c.animationCache.blending.positionWeight=0,c.animationCache.blending.quaternionWeight=0,c.animationCache.blending.scaleWeight=0)}};\r\nTHREE.Animation.prototype.update=function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,q,m,t,s,r;e=(a.length-1)*b;q=Math.floor(e);e-=q;c[0]=0===q?q:q-1;c[1]=q;c[2]=q>a.length-2?q:q+1;c[3]=q>a.length-3?q:q+2;q=a[c[0]];t=a[c[1]];s=a[c[2]];r=a[c[3]];c=e*e;m=e*c;d[0]=f(q[0],t[0],s[0],r[0],e,c,m);d[1]=f(q[1],t[1],s[1],r[1],e,c,m);d[2]=f(q[2],t[2],s[2],r[2],e,c,m);return d},f=function(a,b,c,d,e,f,m){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*m+\r\n(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(this.currentTime>f||0>this.currentTime)this.loop?(this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset()):this.stop();f=0;for(var h=this.hierarchy.length;f<h;f++)for(var k=this.hierarchy[f],n=k.animationCache.animations[this.data.name],p=k.animationCache.blending,q=0;3>q;q++){var m=this.keyTypes[q],t=n.prevKey[m],s=n.nextKey[m];if(0<this.timeScale&&\r\ns.time<=this.currentTime||0>this.timeScale&&t.time>=this.currentTime){t=this.data.hierarchy[f].keys[0];for(s=this.getNextKeyWith(m,f,1);s.time<this.currentTime&&s.index>t.index;)t=s,s=this.getNextKeyWith(m,f,s.index+1);n.prevKey[m]=t;n.nextKey[m]=s}var r=(this.currentTime-t.time)/(s.time-t.time),u=t[m],v=s[m];0>r&&(r=0);1<r&&(r=1);if("pos"===m)if(this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=u[0]+(v[0]-u[0])*r,c.y=u[1]+(v[1]-u[1])*r,c.z=u[2]+(v[2]-u[2])*r,t=this.weight/(this.weight+p.positionWeight),\r\nk.position.lerp(c,t),p.positionWeight+=this.weight;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)a[0]=this.getPrevKeyWith("pos",f,t.index-1).pos,a[1]=u,a[2]=v,a[3]=this.getNextKeyWith("pos",f,s.index+1).pos,r=.33*r+.33,s=e(a,r),t=this.weight/(this.weight+p.positionWeight),p.positionWeight+=this.weight,m=k.position,m.x+=(s[0]-m.x)*t,m.y+=(s[1]-m.y)*t,m.z+=(s[2]-m.z)*t,this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&\r\n(r=e(a,1.01*r),b.set(r[0],r[1],r[2]),b.sub(m),b.y=0,b.normalize(),r=Math.atan2(b.x,b.z),k.rotation.set(0,r,0))}else"rot"===m?(THREE.Quaternion.slerp(u,v,d,r),0===p.quaternionWeight?(k.quaternion.copy(d),p.quaternionWeight=this.weight):(t=this.weight/(this.weight+p.quaternionWeight),THREE.Quaternion.slerp(k.quaternion,d,k.quaternion,t),p.quaternionWeight+=this.weight)):"scl"===m&&(c.x=u[0]+(v[0]-u[0])*r,c.y=u[1]+(v[1]-u[1])*r,c.z=u[2]+(v[2]-u[2])*r,t=this.weight/(this.weight+p.scaleWeight),k.scale.lerp(c,\r\nt),p.scaleWeight+=this.weight)}return!0}}}();THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};\r\nTHREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};\r\nTHREE.KeyFrameAnimation=function(a){this.root=a.node;this.data=THREE.AnimationHandler.init(a);this.hierarchy=THREE.AnimationHandler.parse(this.root);this.currentTime=0;this.timeScale=.001;this.isPlaying=!1;this.loop=this.isPaused=!0;a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();\r\nd.matrixWorldNeedsUpdate=!0}}};\r\nTHREE.KeyFrameAnimation.prototype.play=function(a){this.currentTime=void 0!==a?a:0;if(!1===this.isPlaying){this.isPlaying=!0;var b=this.hierarchy.length,c,d;for(a=0;a<b;a++)c=this.hierarchy[a],d=this.data.hierarchy[a],void 0===d.animationCache&&(d.animationCache={},d.animationCache.prevKey=null,d.animationCache.nextKey=null,d.animationCache.originalMatrix=c.matrix),c=this.data.hierarchy[a].keys,c.length&&(d.animationCache.prevKey=c[0],d.animationCache.nextKey=c[1],this.startTime=Math.min(c[0].time,\r\nthis.startTime),this.endTime=Math.max(c[c.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.play(this)};THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.stop(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;d.copy(b.matrix);b.matrix=d;delete c.animationCache}}};\r\nTHREE.KeyFrameAnimation.prototype.update=function(a){if(!1!==this.isPlaying){this.currentTime+=a*this.timeScale;a=this.data.length;!0===this.loop&&this.currentTime>a&&(this.currentTime%=a);this.currentTime=Math.min(this.currentTime,a);a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a],d=this.data.hierarchy[a],e=d.keys,d=d.animationCache;if(e.length){var f=d.prevKey,g=d.nextKey;if(g.time<=this.currentTime){for(;g.time<this.currentTime&&g.index>f.index;)f=g,g=e[f.index+1];d.prevKey=\r\nf;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime):f.interpolate(g,g.time);this.data.hierarchy[a].node.updateMatrix();c.matrixWorldNeedsUpdate=!0}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};\r\nTHREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.MorphAnimation=function(a){this.mesh=a;this.frames=a.morphTargetInfluences.length;this.currentTime=0;this.duration=1E3;this.loop=!0;this.currentFrame=this.lastFrame=0;this.isPlaying=!1};\r\nTHREE.MorphAnimation.prototype={constructor:THREE.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(a){if(!1!==this.isPlaying){this.currentTime+=a;!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);a=this.duration/this.frames;var b=Math.floor(this.currentTime/a);b!=this.currentFrame&&(this.mesh.morphTargetInfluences[this.lastFrame]=0,this.mesh.morphTargetInfluences[this.currentFrame]=\r\n1,this.mesh.morphTargetInfluences[b]=0,this.lastFrame=this.currentFrame,this.currentFrame=b);this.mesh.morphTargetInfluences[b]=this.currentTime%a/a;this.mesh.morphTargetInfluences[this.lastFrame]=1-this.mesh.morphTargetInfluences[b]}}};\r\nTHREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,r){var u,v=h.widthSegments,y=h.heightSegments,C=e/2,x=f/2,F=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)u="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)u="y",y=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",v=h.depthSegments;var z=v+1,G=y+1,E=e/v,w=f/y,D=new THREE.Vector3;D[u]=0<g?1:-1;for(e=0;e<G;e++)for(f=0;f<z;f++){var A=new THREE.Vector3;A[a]=(f*E-C)*c;A[b]=(e*w-x)*d;A[u]=g;h.vertices.push(A)}for(e=\r\n0;e<y;e++)for(f=0;f<v;f++)x=f+z*e,a=f+z*(e+1),b=f+1+z*(e+1),c=f+1+z*e,d=new THREE.Vector2(f/v,1-e/y),g=new THREE.Vector2(f/v,1-(e+1)/y),u=new THREE.Vector2((f+1)/v,1-(e+1)/y),C=new THREE.Vector2((f+1)/v,1-e/y),x=new THREE.Face3(x+F,a+F,c+F),x.normal.copy(D),x.vertexNormals.push(D.clone(),D.clone(),D.clone()),x.materialIndex=r,h.faces.push(x),h.faceVertexUvs[0].push([d,g,C]),x=new THREE.Face3(a+F,b+F,c+F),x.normal.copy(D),x.vertexNormals.push(D.clone(),D.clone(),D.clone()),x.materialIndex=r,h.faces.push(x),\r\nh.faceVertexUvs[0].push([g.clone(),u,C.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);\r\nTHREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry;\r\nTHREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(.5,.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,\r\n0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),g.clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry;\r\nTHREE.CubeGeometry=function(a,b,c,d,e,f){console.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry.");return new THREE.BoxGeometry(a,b,c,d,e,f)};\r\nTHREE.CylinderGeometry=function(a,b,c,d,e,f,g,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var k=c/2,n,p,q=[],m=[];for(p=0;p<=e;p++){var t=[],s=[],r=p/e,u=r*(b-a)+a;for(n=0;n<=d;n++){var v=n/d,y=new THREE.Vector3;y.x=u*Math.sin(v*h+\r\ng);y.y=-r*c+k;y.z=u*Math.cos(v*h+g);this.vertices.push(y);t.push(this.vertices.length-1);s.push(new THREE.Vector2(v,1-r))}q.push(t);m.push(s)}c=(b-a)/c;for(n=0;n<d;n++)for(0!==a?(g=this.vertices[q[0][n]].clone(),h=this.vertices[q[0][n+1]].clone()):(g=this.vertices[q[1][n]].clone(),h=this.vertices[q[1][n+1]].clone()),g.setY(Math.sqrt(g.x*g.x+g.z*g.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),p=0;p<e;p++){var t=q[p][n],s=q[p+1][n],r=q[p+1][n+1],u=q[p][n+1],v=g.clone(),y=g.clone(),\r\nC=h.clone(),x=h.clone(),F=m[p][n].clone(),z=m[p+1][n].clone(),G=m[p+1][n+1].clone(),E=m[p][n+1].clone();this.faces.push(new THREE.Face3(t,s,u,[v,y,x]));this.faceVertexUvs[0].push([F,z,E]);this.faces.push(new THREE.Face3(s,r,u,[y.clone(),C,x.clone()]));this.faceVertexUvs[0].push([z.clone(),G,E.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),n=0;n<d;n++)t=q[0][n],s=q[0][n+1],r=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),C=new THREE.Vector3(0,\r\n1,0),F=m[0][n].clone(),z=m[0][n+1].clone(),G=new THREE.Vector2(z.x,0),this.faces.push(new THREE.Face3(t,s,r,[v,y,C])),this.faceVertexUvs[0].push([F,z,G]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),n=0;n<d;n++)t=q[e][n+1],s=q[e][n],r=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),C=new THREE.Vector3(0,-1,0),F=m[e][n+1].clone(),z=m[e][n].clone(),G=new THREE.Vector2(z.x,1),this.faces.push(new THREE.Face3(t,s,r,[v,y,C])),this.faceVertexUvs[0].push([F,\r\nz,G]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=a instanceof Array?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;\r\nTHREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};\r\nTHREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),m=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=!0):-1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)==\r\nMath.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(H=a.length;0<=--H;){c=H;d=H-1;0>d&&(d=a.length-1);for(var e=0,f=t+2*p,e=0;e<f;e++){var g=ga*e,h=ga*(e+1),k=b+c+g,g=b+d+g,m=b+d+h,h=b+c+h,k=k+U,g=g+U,m=m+U,h=h+U;A.faces.push(new THREE.Face3(k,g,h,null,null,y));A.faces.push(new THREE.Face3(g,m,h,null,null,y));k=C.generateSideWallUV(A,k,g,m,h);A.faceVertexUvs[0].push([k[0],k[1],k[3]]);A.faceVertexUvs[0].push([k[1],\r\nk[2],k[3]])}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=U;b+=U;c+=U;A.faces.push(new THREE.Face3(a,b,c,null,null,v));a=C.generateTopUV(A,a,b,c);A.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,n=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,s=b.extrudePath,\r\nr,u=!1,v=b.material,y=b.extrudeMaterial,C=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,x,F,z,G;s&&(r=s.getSpacedPoints(t),u=!0,q=!1,x=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,t,!1),F=new THREE.Vector3,z=new THREE.Vector3,G=new THREE.Vector3);q||(n=k=p=0);var E,w,D,A=this,U=this.vertices.length,s=a.extractPoints(m),m=s.shape,M=s.holes;if(s=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();w=0;for(D=M.length;w<D;w++)E=M[w],THREE.Shape.Utils.isClockWise(E)&&\r\n(M[w]=E.reverse());s=!1}var K=THREE.Shape.Utils.triangulateShape(m,M),L=m;w=0;for(D=M.length;w<D;w++)E=M[w],m=m.concat(E);var N,T,Q,W,O,ga=m.length,ea,xa=K.length,s=[],H=0;Q=L.length;N=Q-1;for(T=H+1;H<Q;H++,N++,T++)N===Q&&(N=0),T===Q&&(T=0),s[H]=d(L[H],L[N],L[T]);var $a=[],qa,ya=s.concat();w=0;for(D=M.length;w<D;w++){E=M[w];qa=[];H=0;Q=E.length;N=Q-1;for(T=H+1;H<Q;H++,N++,T++)N===Q&&(N=0),T===Q&&(T=0),qa[H]=d(E[H],E[N],E[T]);$a.push(qa);ya=ya.concat(qa)}for(N=0;N<p;N++){Q=N/p;W=k*(1-Q);T=n*Math.sin(Q*\r\nMath.PI/2);H=0;for(Q=L.length;H<Q;H++)O=c(L[H],s[H],T),f(O.x,O.y,-W);w=0;for(D=M.length;w<D;w++)for(E=M[w],qa=$a[w],H=0,Q=E.length;H<Q;H++)O=c(E[H],qa[H],T),f(O.x,O.y,-W)}T=n;for(H=0;H<ga;H++)O=q?c(m[H],ya[H],T):m[H],u?(z.copy(x.normals[0]).multiplyScalar(O.x),F.copy(x.binormals[0]).multiplyScalar(O.y),G.copy(r[0]).add(z).add(F),f(G.x,G.y,G.z)):f(O.x,O.y,0);for(Q=1;Q<=t;Q++)for(H=0;H<ga;H++)O=q?c(m[H],ya[H],T):m[H],u?(z.copy(x.normals[Q]).multiplyScalar(O.x),F.copy(x.binormals[Q]).multiplyScalar(O.y),\r\nG.copy(r[Q]).add(z).add(F),f(G.x,G.y,G.z)):f(O.x,O.y,h/t*Q);for(N=p-1;0<=N;N--){Q=N/p;W=k*(1-Q);T=n*Math.sin(Q*Math.PI/2);H=0;for(Q=L.length;H<Q;H++)O=c(L[H],s[H],T),f(O.x,O.y,h+W);w=0;for(D=M.length;w<D;w++)for(E=M[w],qa=$a[w],H=0,Q=E.length;H<Q;H++)O=c(E[H],qa[H],T),u?f(O.x,O.y+r[t-1].y,r[t-1].x+W):f(O.x,O.y,h+W)}(function(){if(q){var a;a=0*ga;for(H=0;H<xa;H++)ea=K[H],g(ea[2]+a,ea[1]+a,ea[0]+a);a=t+2*p;a*=ga;for(H=0;H<xa;H++)ea=K[H],g(ea[0]+a,ea[1]+a,ea[2]+a)}else{for(H=0;H<xa;H++)ea=K[H],g(ea[2],\r\nea[1],ea[0]);for(H=0;H<xa;H++)ea=K[H],g(ea[0]+ga*t,ea[1]+ga*t,ea[2]+ga*t)}})();(function(){var a=0;e(L,a);a+=L.length;w=0;for(D=M.length;w<D;w++)E=M[w],e(E,a),a+=E.length})()};\r\nTHREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(c.x,c.y),new THREE.Vector2(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c];d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y,\r\n1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===a instanceof Array&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};\r\nTHREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,n=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,f=n.length;e<f;e++)g=n[e],THREE.Shape.Utils.isClockWise(g)&&(n[e]=g.reverse());var p=THREE.Shape.Utils.triangulateShape(k,n);e=0;for(f=n.length;e<f;e++)g=n[e],\r\nk=k.concat(g);n=k.length;f=p.length;for(e=0;e<n;e++)g=k[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)n=p[e],k=n[0]+h,g=n[1]+h,n=n[2]+h,this.faces.push(new THREE.Face3(k,g,n,null,null,c)),this.faceVertexUvs[0].push(d.generateTopUV(this,k,g,n))};\r\nTHREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="LatheGeometry";this.parameters={points:a,segments:b,phiStart:c,phiLength:d};b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var k=c+g*f*d,n=Math.cos(k),p=Math.sin(k),k=0,q=a.length;k<q;k++){var m=a[k],t=new THREE.Vector3;t.x=n*m.x-p*m.y;t.y=p*m.x+n*m.y;t.z=m.z;this.vertices.push(t)}c=a.length;g=0;for(h=b;g<h;g++)for(k=0,q=a.length-1;k<q;k++){b=p=k+c*g;d=p+c;var n=p+1+c,p=p+1,m=g*f,t=k*e,s=\r\nm+f,r=t+e;this.faces.push(new THREE.Face3(b,d,p));this.faceVertexUvs[0].push([new THREE.Vector2(m,t),new THREE.Vector2(s,t),new THREE.Vector2(m,r)]);this.faces.push(new THREE.Face3(d,n,p));this.faceVertexUvs[0].push([new THREE.Vector2(s,t),new THREE.Vector2(s,r),new THREE.Vector2(m,r)])}this.mergeVertices();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;\r\nTHREE.PlaneGeometry=function(a,b,c,d){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.");THREE.Geometry.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new THREE.PlaneBufferGeometry(a,b,c,d))};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;\r\nTHREE.PlaneBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=c||1;d=d||1;var g=c+1,h=d+1,k=a/c,n=b/d;b=new Float32Array(g*h*3);a=new Float32Array(g*h*3);for(var p=new Float32Array(g*h*2),q=0,m=0,t=0;t<h;t++)for(var s=t*n-f,r=0;r<g;r++)b[q]=r*k-e,b[q+1]=-s,a[q+2]=1,p[m]=r/c,p[m+1]=1-t/d,q+=3,m+=2;q=0;e=new (65535<b.length/3?Uint32Array:Uint16Array)(c*d*6);for(t=0;t<d;t++)for(r=\r\n0;r<c;r++)f=r+g*(t+1),h=r+1+g*(t+1),k=r+1+g*t,e[q]=r+g*t,e[q+1]=f,e[q+2]=k,e[q+3]=f,e[q+4]=h,e[q+5]=k,q+=6;this.addAttribute("index",new THREE.BufferAttribute(e,1));this.addAttribute("position",new THREE.BufferAttribute(b,3));this.addAttribute("normal",new THREE.BufferAttribute(a,3));this.addAttribute("uv",new THREE.BufferAttribute(p,2))};THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry;\r\nTHREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f};a=a||0;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(1,d):8;var g,h=[],k=a,n=(b-a)/d;for(a=0;a<d+1;a++){for(g=0;g<c+1;g++){var p=new THREE.Vector3,q=e+g/c*f;p.x=k*Math.cos(q);p.y=k*Math.sin(q);this.vertices.push(p);h.push(new THREE.Vector2((p.x/b+1)/2,\r\n(p.y/b+1)/2))}k+=n}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*(c+1),g=0;g<c;g++)f=q=g+e,n=q+c+1,p=q+c+2,this.faces.push(new THREE.Face3(f,n,p,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[n].clone(),h[p].clone()]),f=q,n=q+c+2,p=q+1,this.faces.push(new THREE.Face3(f,n,p,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[n].clone(),h[p].clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)};\r\nTHREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry.prototype.constructor=THREE.RingGeometry;\r\nTHREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;var h,k,n=[],p=[];for(k=0;k<=c;k++){var q=[],m=[];for(h=0;h<=b;h++){var t=h/b,s=k/c,r=new THREE.Vector3;r.x=-a*Math.cos(d+t*e)*Math.sin(f+s*g);\r\nr.y=a*Math.cos(f+s*g);r.z=a*Math.sin(d+t*e)*Math.sin(f+s*g);this.vertices.push(r);q.push(this.vertices.length-1);m.push(new THREE.Vector2(t,1-s))}n.push(q);p.push(m)}for(k=0;k<c;k++)for(h=0;h<b;h++){d=n[k][h+1];e=n[k][h];f=n[k+1][h];g=n[k+1][h+1];var q=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),t=this.vertices[f].clone().normalize(),s=this.vertices[g].clone().normalize(),r=p[k][h+1].clone(),u=p[k][h].clone(),v=p[k+1][h].clone(),y=p[k+1][h+1].clone();Math.abs(this.vertices[d].y)===\r\na?(r.x=(r.x+u.x)/2,this.faces.push(new THREE.Face3(d,f,g,[q,t,s])),this.faceVertexUvs[0].push([r,v,y])):Math.abs(this.vertices[f].y)===a?(v.x=(v.x+y.x)/2,this.faces.push(new THREE.Face3(d,e,f,[q,m,t])),this.faceVertexUvs[0].push([r,u,v])):(this.faces.push(new THREE.Face3(d,e,g,[q,m,s])),this.faceVertexUvs[0].push([r,u,y]),this.faces.push(new THREE.Face3(e,f,g,[m.clone(),t,s.clone()])),this.faceVertexUvs[0].push([u.clone(),v,y.clone()]))}this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,\r\na)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){b=b||{};var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b);this.type="TextGeometry"};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);\r\nTHREE.TextGeometry.prototype.constructor=THREE.TextGeometry;\r\nTHREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=c||8;d=d||6;e=e||2*Math.PI;for(var f=new THREE.Vector3,g=[],h=[],k=0;k<=c;k++)for(var n=0;n<=d;n++){var p=n/d*e,q=k/c*Math.PI*2;f.x=a*Math.cos(p);f.y=a*Math.sin(p);var m=new THREE.Vector3;m.x=(a+b*Math.cos(q))*Math.cos(p);m.y=(a+b*Math.cos(q))*Math.sin(p);m.z=b*Math.sin(q);this.vertices.push(m);g.push(new THREE.Vector2(n/\r\nd,k/c));h.push(m.clone().sub(f).normalize())}for(k=1;k<=c;k++)for(n=1;n<=d;n++)a=(d+1)*k+n-1,b=(d+1)*(k-1)+n-1,e=(d+1)*(k-1)+n,f=(d+1)*k+n,p=new THREE.Face3(a,b,f,[h[a].clone(),h[b].clone(),h[f].clone()]),this.faces.push(p),this.faceVertexUvs[0].push([g[a].clone(),g[b].clone(),g[f].clone()]),p=new THREE.Face3(b,e,f,[h[b].clone(),h[e].clone(),h[f].clone()]),this.faces.push(p),this.faceVertexUvs[0].push([g[b].clone(),g[e].clone(),g[f].clone()]);this.computeFaceNormals()};\r\nTHREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;\r\nTHREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a);a*=b/c;b=Math.cos(a);f*=d*(2+b)*.5;g=d*(2+b)*g*.5;d=e*d*Math.sin(a)*.5;return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,p:e,q:f,heightScale:g};a=a||100;b=b||40;c=c||64;d=d||8;e=e||2;f=f||3;g=g||1;for(var k=Array(c),n=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,m=0;m<c;++m){k[m]=\r\nArray(d);var t=m/c*2*e*Math.PI,s=h(t,f,e,a,g),t=h(t+.01,f,e,a,g);n.subVectors(t,s);p.addVectors(t,s);q.crossVectors(n,p);p.crossVectors(q,n);q.normalize();p.normalize();for(t=0;t<d;++t){var r=t/d*2*Math.PI,u=-b*Math.cos(r),r=b*Math.sin(r),v=new THREE.Vector3;v.x=s.x+u*p.x+r*q.x;v.y=s.y+u*p.y+r*q.y;v.z=s.z+u*p.z+r*q.z;k[m][t]=this.vertices.push(v)-1}}for(m=0;m<c;++m)for(t=0;t<d;++t)e=(m+1)%c,f=(t+1)%d,a=k[m][t],b=k[e][t],e=k[e][f],f=k[m][f],g=new THREE.Vector2(m/c,t/d),n=new THREE.Vector2((m+1)/c,\r\nt/d),p=new THREE.Vector2((m+1)/c,(t+1)/d),q=new THREE.Vector2(m/c,(t+1)/d),this.faces.push(new THREE.Face3(a,b,f)),this.faceVertexUvs[0].push([g,n,q]),this.faces.push(new THREE.Face3(b,e,f)),this.faceVertexUvs[0].push([n.clone(),p,q.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;\r\nTHREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;f=f||THREE.TubeGeometry.NoTaper;var g=[],h,k,n=b+1,p,q,m,t,s,r=new THREE.Vector3,u,v,y;u=new THREE.TubeGeometry.FrenetFrames(a,b,e);v=u.normals;y=u.binormals;this.tangents=u.tangents;this.normals=v;this.binormals=y;for(u=0;u<n;u++)for(g[u]=[],p=u/(n-1),s=a.getPointAt(p),h=v[u],k=y[u],m=c*f(p),p=0;p<d;p++)q=\r\np/d*2*Math.PI,t=-m*Math.cos(q),q=m*Math.sin(q),r.copy(s),r.x+=t*h.x+q*k.x,r.y+=t*h.y+q*k.y,r.z+=t*h.z+q*k.z,g[u][p]=this.vertices.push(new THREE.Vector3(r.x,r.y,r.z))-1;for(u=0;u<b;u++)for(p=0;p<d;p++)f=e?(u+1)%b:u+1,n=(p+1)%d,a=g[u][p],c=g[f][p],f=g[f][n],n=g[u][n],r=new THREE.Vector2(u/b,p/d),v=new THREE.Vector2((u+1)/b,p/d),y=new THREE.Vector2((u+1)/b,(p+1)/d),h=new THREE.Vector2(u/b,(p+1)/d),this.faces.push(new THREE.Face3(a,c,n)),this.faceVertexUvs[0].push([r,v,h]),this.faces.push(new THREE.Face3(c,\r\nf,n)),this.faceVertexUvs[0].push([v.clone(),y,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};\r\nTHREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var n,p,q;this.tangents=e;this.normals=f;this.binormals=g;for(n=0;n<b;n++)p=n/(b-1),e[n]=a.getTangentAt(p),e[n].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;n=Math.abs(e[0].x);p=Math.abs(e[0].y);q=Math.abs(e[0].z);n<=a&&(a=n,d.set(1,0,0));p<=a&&(a=p,d.set(0,1,0));q<=a&&d.set(0,0,1);h.crossVectors(e[0],\r\nd).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(n=1;n<b;n++)f[n]=f[n-1].clone(),g[n]=g[n-1].clone(),h.crossVectors(e[n-1],e[n]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[n-1].dot(e[n]),-1,1)),f[n].applyMatrix4(k.makeRotationAxis(h,d))),g[n].crossVectors(e[n],f[n]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),n=1;n<b;n++)f[n].applyMatrix4(k.makeRotationAxis(e[n],d*n)),g[n].crossVectors(e[n],\r\nf[n])};\r\nTHREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);k.faces.push(d);u.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(u.z,-u.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function g(a,b){var c=\r\nMath.pow(2,b);Math.pow(4,b);for(var d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),m=[],n=0;n<=c;n++){m[n]=[];for(var p=e(d.clone().lerp(h,n/c)),q=e(g.clone().lerp(h,n/c)),s=c-n,r=0;r<=s;r++)m[n][r]=0==r&&n==c?p:e(p.clone().lerp(q,r/s))}for(n=0;n<c;n++)for(r=0;r<2*(c-n)-1;r++)d=Math.floor(r/2),0==r%2?f(m[n][d+1],m[n+1][d],m[n][d]):f(m[n][d+1],m[n+1][d+1],m[n+1][d])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5,\r\na.y));return a.clone()}THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,n=0,p=a.length;n<p;n+=3)e(new THREE.Vector3(a[n],a[n+1],a[n+2]));a=this.vertices;for(var q=[],m=n=0,p=b.length;n<p;n+=3,m++){var t=a[b[n]],s=a[b[n+1]],r=a[b[n+2]];q[m]=new THREE.Face3(t.index,s.index,r.index,[t.clone(),s.clone(),r.clone()])}for(var u=new THREE.Vector3,n=0,p=q.length;n<p;n++)g(q[n],d);n=0;for(p=this.faceVertexUvs[0].length;n<\r\np;n++)b=this.faceVertexUvs[0][n],d=b[0].x,a=b[1].x,q=b[2].x,m=Math.max(d,Math.max(a,q)),t=Math.min(d,Math.min(a,q)),.9<m&&.1>t&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>q&&(b[2].x+=1));n=0;for(p=this.vertices.length;n<p;n++)this.vertices[n].multiplyScalar(c);this.mergeVertices();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;\r\nTHREE.DodecahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};var c=(1+Math.sqrt(5))/2,d=1/c;THREE.PolyhedronGeometry.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,\r\n11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b)};THREE.DodecahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry;\r\nTHREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b}};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);\r\nTHREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;THREE.OctahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};THREE.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b}};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;\r\nTHREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b}};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;\r\nTHREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,h,k,n,p=b+1;for(g=0;g<=c;g++)for(n=g/c,h=0;h<=b;h++)k=h/b,k=a(k,n),d.push(k);var q,m,t,s;for(g=0;g<c;g++)for(h=0;h<b;h++)a=g*p+h,d=g*p+h+1,n=(g+1)*p+h+1,k=(g+1)*p+h,q=new THREE.Vector2(h/b,g/c),m=new THREE.Vector2((h+1)/b,g/c),t=new THREE.Vector2((h+1)/b,(g+1)/c),s=new THREE.Vector2(h/b,(g+1)/c),e.push(new THREE.Face3(a,\r\nd,k)),f.push([q,m,s]),e.push(new THREE.Face3(d,n,k)),f.push([m.clone(),t,s.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry;\r\nTHREE.AxisHelper=function(a){a=a||1;var b=new Float32Array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new THREE.BufferGeometry;a.addAttribute("position",new THREE.BufferAttribute(b,3));a.addAttribute("color",new THREE.BufferAttribute(c,3));b=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,a,b,THREE.LinePieces)};THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);\r\nTHREE.AxisHelper.prototype.constructor=THREE.AxisHelper;\r\nTHREE.ArrowHelper=function(){var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0));var b=new THREE.CylinderGeometry(0,.5,1,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0));return function(c,d,e,f,g,h){THREE.Object3D.call(this);void 0===f&&(f=16776960);void 0===e&&(e=1);void 0===g&&(g=.2*e);void 0===h&&(h=.2*g);this.position.copy(d);this.line=new THREE.Line(a,new THREE.LineBasicMaterial({color:f}));this.line.matrixAutoUpdate=!1;this.add(this.line);\r\nthis.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:f}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(c);this.setLength(e,g,h)}}();THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;\r\nTHREE.ArrowHelper.prototype.setDirection=function(){var a=new THREE.Vector3,b;return function(c){.99999<c.y?this.quaternion.set(0,0,0,1):-.99999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,a-b,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};\r\nTHREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};THREE.BoxHelper=function(a){var b=new THREE.BufferGeometry;b.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3));THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);void 0!==a&&this.update(a)};THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype);THREE.BoxHelper.prototype.constructor=THREE.BoxHelper;\r\nTHREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox();var c=b.boundingBox.min,b=b.boundingBox.max,d=this.geometry.attributes.position.array;d[0]=b.x;d[1]=b.y;d[2]=b.z;d[3]=c.x;d[4]=b.y;d[5]=b.z;d[6]=c.x;d[7]=b.y;d[8]=b.z;d[9]=c.x;d[10]=c.y;d[11]=b.z;d[12]=c.x;d[13]=c.y;d[14]=b.z;d[15]=b.x;d[16]=c.y;d[17]=b.z;d[18]=b.x;d[19]=c.y;d[20]=b.z;d[21]=b.x;d[22]=b.y;d[23]=b.z;d[24]=b.x;d[25]=b.y;d[26]=c.z;d[27]=c.x;d[28]=b.y;d[29]=c.z;d[30]=c.x;d[31]=b.y;\r\nd[32]=c.z;d[33]=c.x;d[34]=c.y;d[35]=c.z;d[36]=c.x;d[37]=c.y;d[38]=c.z;d[39]=b.x;d[40]=c.y;d[41]=c.z;d[42]=b.x;d[43]=c.y;d[44]=c.z;d[45]=b.x;d[46]=b.y;d[47]=c.z;d[48]=b.x;d[49]=b.y;d[50]=b.z;d[51]=b.x;d[52]=b.y;d[53]=c.z;d[54]=c.x;d[55]=b.y;d[56]=b.z;d[57]=c.x;d[58]=b.y;d[59]=c.z;d[60]=c.x;d[61]=c.y;d[62]=b.z;d[63]=c.x;d[64]=c.y;d[65]=c.z;d[66]=b.x;d[67]=c.y;d[68]=b.z;d[69]=b.x;d[70]=c.y;d[71]=c.z;this.geometry.attributes.position.needsUpdate=!0;this.geometry.computeBoundingSphere();this.matrix=a.matrixWorld;\r\nthis.matrixAutoUpdate=!1};THREE.BoundingBoxHelper=function(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box=new THREE.Box3;THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:c,wireframe:!0}))};THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.BoundingBoxHelper.prototype.constructor=THREE.BoundingBoxHelper;THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)};\r\nTHREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);\r\nb("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()};\r\nTHREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);THREE.CameraHelper.prototype.constructor=THREE.CameraHelper;\r\nTHREE.CameraHelper.prototype.update=function(){var a,b,c=new THREE.Vector3,d=new THREE.Camera,e=function(e,g,h,k){c.set(g,h,k).unproject(d);e=b[e];if(void 0!==e)for(g=0,h=e.length;g<h;g++)a.vertices[e[g]].copy(c)};return function(){a=this.geometry;b=this.pointMap;d.projectionMatrix.copy(this.camera.projectionMatrix);e("c",0,0,-1);e("t",0,0,1);e("n1",-1,-1,-1);e("n2",1,-1,-1);e("n3",-1,1,-1);e("n4",1,1,-1);e("f1",-1,-1,1);e("f2",1,-1,1);e("f3",-1,1,1);e("f4",1,1,1);e("u1",.7,1.1,-1);e("u2",-.7,1.1,\r\n-1);e("u3",0,2,-1);e("cf1",-1,0,1);e("cf2",1,0,1);e("cf3",0,-1,1);e("cf4",0,1,1);e("cn1",-1,0,-1);e("cn2",1,0,-1);e("cn3",0,-1,-1);e("cn4",0,1,-1);a.verticesNeedUpdate=!0}}();\r\nTHREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;b=b||1;var c=new THREE.Geometry;c.vertices.push(new THREE.Vector3(-b,b,0),new THREE.Vector3(b,b,0),new THREE.Vector3(b,-b,0),new THREE.Vector3(-b,-b,0),new THREE.Vector3(-b,b,0));var d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightPlane=new THREE.Line(c,d);this.add(this.lightPlane);\r\nc=new THREE.Geometry;c.vertices.push(new THREE.Vector3,new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update()};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.DirectionalLightHelper.prototype.constructor=THREE.DirectionalLightHelper;\r\nTHREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()};\r\nTHREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();\r\nTHREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var n=k.vertices,k=k.faces,p=0,q=0,m=k.length;q<m;q++)for(var t=k[q],s=0;3>s;s++){d[0]=t[g[s]];d[1]=t[g[(s+1)%3]];d.sort(f);var r=d.toString();void 0===e[r]?(e[r]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},p++):e[r].face2=q}d=new Float32Array(6*p);f=0;for(r in e)if(g=e[r],void 0===g.face2||\r\n.9999>k[g.face1].normal.dot(k[g.face2].normal))p=n[g.vert1],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z,p=n[g.vert2],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3));THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper;\r\nTHREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;c<e;c++)b.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:a,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype);\r\nTHREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper;\r\nTHREE.FaceNormalsHelper.prototype.update=function(){var a=this.geometry.vertices,b=this.object,c=b.geometry.vertices,d=b.geometry.faces,e=b.matrixWorld;b.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(e);for(var f=b=0,g=d.length;b<g;b++,f+=2){var h=d[b];a[f].copy(c[h.a]).add(c[h.b]).add(c[h.c]).divideScalar(3).applyMatrix4(e);a[f+1].copy(h.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(a[f])}this.geometry.verticesNeedUpdate=!0;return this};\r\nTHREE.GridHelper=function(a,b){var c=new THREE.Geometry,d=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924);this.color2=new THREE.Color(8947848);for(var e=-a;e<=a;e+=b){c.vertices.push(new THREE.Vector3(-a,0,e),new THREE.Vector3(a,0,e),new THREE.Vector3(e,0,-a),new THREE.Vector3(e,0,a));var f=0===e?this.color1:this.color2;c.colors.push(f,f,f,f)}THREE.Line.call(this,c,d,THREE.LinePieces)};THREE.GridHelper.prototype=Object.create(THREE.Line.prototype);\r\nTHREE.GridHelper.prototype.constructor=THREE.GridHelper;THREE.GridHelper.prototype.setColors=function(a,b){this.color1.set(a);this.color2.set(b);this.geometry.colorsNeedUpdate=!0};\r\nTHREE.HemisphereLightHelper=function(a,b,c,d){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.colors=[new THREE.Color,new THREE.Color];a=new THREE.SphereGeometry(b,4,2);a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));for(b=0;8>b;b++)a.faces[b].color=this.colors[4>b?0:1];b=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(a,b);this.add(this.lightSphere);\r\nthis.update()};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.constructor=THREE.HemisphereLightHelper;THREE.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose();this.lightSphere.material.dispose()};\r\nTHREE.HemisphereLightHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity);this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity);this.lightSphere.lookAt(a.setFromMatrixPosition(this.light.matrixWorld).negate());this.lightSphere.geometry.colorsNeedUpdate=!0}}();\r\nTHREE.PointLightHelper=function(a,b){this.light=a;this.light.updateMatrixWorld();var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);THREE.Mesh.call(this,c,d);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1};THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.PointLightHelper.prototype.constructor=THREE.PointLightHelper;\r\nTHREE.PointLightHelper.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};\r\nTHREE.SkeletonHelper=function(a){this.bones=this.getBoneList(a);for(var b=new THREE.Geometry,c=0;c<this.bones.length;c++)this.bones[c].parent instanceof THREE.Bone&&(b.vertices.push(new THREE.Vector3),b.vertices.push(new THREE.Vector3),b.colors.push(new THREE.Color(0,0,1)),b.colors.push(new THREE.Color(0,1,0)));c=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});THREE.Line.call(this,b,c,THREE.LinePieces);this.root=a;this.matrix=a.matrixWorld;\r\nthis.matrixAutoUpdate=!1;this.update()};THREE.SkeletonHelper.prototype=Object.create(THREE.Line.prototype);THREE.SkeletonHelper.prototype.constructor=THREE.SkeletonHelper;THREE.SkeletonHelper.prototype.getBoneList=function(a){var b=[];a instanceof THREE.Bone&&b.push(a);for(var c=0;c<a.children.length;c++)b.push.apply(b,this.getBoneList(a.children[c]));return b};\r\nTHREE.SkeletonHelper.prototype.update=function(){for(var a=this.geometry,b=(new THREE.Matrix4).getInverse(this.root.matrixWorld),c=new THREE.Matrix4,d=0,e=0;e<this.bones.length;e++){var f=this.bones[e];f.parent instanceof THREE.Bone&&(c.multiplyMatrices(b,f.matrixWorld),a.vertices[d].setFromMatrixPosition(c),c.multiplyMatrices(b,f.parent.matrixWorld),a.vertices[d+1].setFromMatrixPosition(c),d+=2)}a.verticesNeedUpdate=!0;a.computeBoundingSphere()};\r\nTHREE.SpotLightHelper=function(a){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;a=new THREE.CylinderGeometry(0,1,1,8,1,!0);a.applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0));a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));var b=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(a,b);this.add(this.cone);this.update()};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype);\r\nTHREE.SpotLightHelper.prototype.constructor=THREE.SpotLightHelper;THREE.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};\r\nTHREE.SpotLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){var c=this.light.distance?this.light.distance:1E4,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c);a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(b.sub(a));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();\r\nTHREE.VertexNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:16711680;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexNormals.length;g<h;g++)c.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype);\r\nTHREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper;\r\nTHREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,n=f.length;k<n;k++)for(var p=f[k],q=0,m=p.vertexNormals.length;q<m;q++){var t=p.vertexNormals[q];d[h].copy(e[p[a[q]]]).applyMatrix4(g);b.copy(t).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);\r\nb.add(d[h]);h+=1;d[h].copy(b);h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();\r\nTHREE.VertexTangentsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:255;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexTangents.length;g<h;g++)c.vertices.push(new THREE.Vector3),c.vertices.push(new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.update()};THREE.VertexTangentsHelper.prototype=Object.create(THREE.Line.prototype);\r\nTHREE.VertexTangentsHelper.prototype.constructor=THREE.VertexTangentsHelper;\r\nTHREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,n=f.length;k<n;k++)for(var p=f[k],q=0,m=p.vertexTangents.length;q<m;q++){var t=p.vertexTangents[q];d[h].copy(e[p[a[q]]]).applyMatrix4(g);b.copy(t).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b);\r\nh+=1}this.geometry.verticesNeedUpdate=!0;return this}}();\r\nTHREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,n=a.geometry.faces,p=0,q=new Uint32Array(6*n.length),m=0,t=n.length;m<t;m++)for(var s=n[m],r=0;3>r;r++){d[0]=s[g[r]];d[1]=s[g[(r+1)%3]];d.sort(f);var u=d.toString();void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++)}d=new Float32Array(6*p);m=0;for(t=p;m<t;m++)for(r=0;2>r;r++)p=\r\nk[q[2*m+r]],g=6*m+3*r,d[g+0]=p.x,d[g+1]=p.y,d[g+2]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){k=a.geometry.attributes.position.array;t=a.geometry.attributes.index.array;n=a.geometry.drawcalls;p=0;0===n.length&&(n=[{count:t.length,index:0,start:0}]);for(var q=new Uint32Array(2*t.length),s=0,v=n.length;s<v;++s)for(var r=n[s].start,u=n[s].count,g=n[s].index,m=r,y=r+u;m<y;m+=3)for(r=0;3>r;r++)d[0]=\r\ng+t[m+r],d[1]=g+t[m+(r+1)%3],d.sort(f),u=d.toString(),void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++);d=new Float32Array(6*p);m=0;for(t=p;m<t;m++)for(r=0;2>r;r++)g=6*m+3*r,p=3*q[2*m+r],d[g+0]=k[p],d[g+1]=k[p+1],d[g+2]=k[p+2]}else for(k=a.geometry.attributes.position.array,p=k.length/3,q=p/3,d=new Float32Array(6*p),m=0,t=q;m<t;m++)for(r=0;3>r;r++)g=18*m+6*r,q=9*m+3*r,d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],p=9*m+(r+1)%3*3,d[g+3]=k[p],d[g+4]=k[p+1],d[g+5]=k[p+2];h.addAttribute("position",new THREE.BufferAttribute(d,\r\n3))}THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper;THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;\r\nTHREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;\r\nTHREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};\r\nTHREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)_?(\\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var k=h[1];d[k]||(d[k]={start:Infinity,end:-Infinity});h=d[k];f<h.start&&(h.start=f);f>h.end&&(h.end=f);c||(c=k)}}for(k in d)h=d[k],this.createAnimation(k,h.start,h.end,a);this.firstAnimation=c};\r\nTHREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)};\r\nTHREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};\r\nTHREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};\r\nTHREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;\r\nf!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};\r\n\r\n// Export the THREE object for **Node.js**, with\r\n// backwards-compatibility for the old `require()` API. If we\'re in\r\n// the browser, add `_` as a global object via a string identifier,\r\n// for Closure Compiler "advanced" mode.\r\nif (typeof exports !== \'undefined\') {\r\n  if (typeof module !== \'undefined\' && module.exports) {\r\n    exports = module.exports = THREE;\r\n  }\r\n  exports.THREE = THREE;\r\n} else {\r\n  this[\'THREE\'] = THREE;\r\n}\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/three/three.min.js\n ** module id = 1\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/three/three.min.js?');
},function(module,exports,__webpack_require__){eval("var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global, process) {// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information.\n\n;(function (undefined) {\n\n  var objectTypes = {\n    'function': true,\n    'object': true\n  };\n\n  function checkGlobal(value) {\n    return (value && value.Object === Object) ? value : null;\n  }\n\n  var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;\n  var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;\n  var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global);\n  var freeSelf = checkGlobal(objectTypes[typeof self] && self);\n  var freeWindow = checkGlobal(objectTypes[typeof window] && window);\n  var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null;\n  var thisGlobal = checkGlobal(objectTypes[typeof this] && this);\n  var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')();\n\n  var Rx = {\n    internals: {},\n    config: {\n      Promise: root.Promise\n    },\n    helpers: { }\n  };\n\n  // Defaults\n  var noop = Rx.helpers.noop = function () { },\n    identity = Rx.helpers.identity = function (x) { return x; },\n    defaultNow = Rx.helpers.defaultNow = Date.now,\n    defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },\n    defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },\n    defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },\n    defaultError = Rx.helpers.defaultError = function (err) { throw err; },\n    isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },\n    isFunction = Rx.helpers.isFunction = (function () {\n\n      var isFn = function (value) {\n        return typeof value == 'function' || false;\n      };\n\n      // fallback for older versions of Chrome and Safari\n      if (isFn(/x/)) {\n        isFn = function(value) {\n          return typeof value == 'function' && toString.call(value) == '[object Function]';\n        };\n      }\n\n      return isFn;\n    }());\n\n  function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;}\n\n  var errorObj = {e: {}};\n  \n  function tryCatcherGen(tryCatchTarget) {\n    return function tryCatcher() {\n      try {\n        return tryCatchTarget.apply(this, arguments);\n      } catch (e) {\n        errorObj.e = e;\n        return errorObj;\n      }\n    };\n  }\n\n  var tryCatch = Rx.internals.tryCatch = function tryCatch(fn) {\n    if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }\n    return tryCatcherGen(fn);\n  };\n\n  function thrower(e) {\n    throw e;\n  }\n\n  Rx.config.longStackSupport = false;\n  var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })();\n  hasStacks = !!stacks.e && !!stacks.e.stack;\n\n  // All code after this point will be filtered from stack traces reported by RxJS\n  var rStartingLine = captureLine(), rFileName;\n\n  var STACK_JUMP_SEPARATOR = 'From previous event:';\n\n  function makeStackTraceLong(error, observable) {\n    // If possible, transform the error stack trace by removing Node and RxJS\n    // cruft, then concatenating with the stack trace of `observable`.\n    if (hasStacks &&\n        observable.stack &&\n        typeof error === 'object' &&\n        error !== null &&\n        error.stack &&\n        error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1\n    ) {\n      var stacks = [];\n      for (var o = observable; !!o; o = o.source) {\n        if (o.stack) {\n          stacks.unshift(o.stack);\n        }\n      }\n      stacks.unshift(error.stack);\n\n      var concatedStacks = stacks.join('\\n' + STACK_JUMP_SEPARATOR + '\\n');\n      error.stack = filterStackString(concatedStacks);\n    }\n  }\n\n  function filterStackString(stackString) {\n    var lines = stackString.split('\\n'), desiredLines = [];\n    for (var i = 0, len = lines.length; i < len; i++) {\n      var line = lines[i];\n\n      if (!isInternalFrame(line) && !isNodeFrame(line) && line) {\n        desiredLines.push(line);\n      }\n    }\n    return desiredLines.join('\\n');\n  }\n\n  function isInternalFrame(stackLine) {\n    var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);\n    if (!fileNameAndLineNumber) {\n      return false;\n    }\n    var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];\n\n    return fileName === rFileName &&\n      lineNumber >= rStartingLine &&\n      lineNumber <= rEndingLine;\n  }\n\n  function isNodeFrame(stackLine) {\n    return stackLine.indexOf('(module.js:') !== -1 ||\n      stackLine.indexOf('(node.js:') !== -1;\n  }\n\n  function captureLine() {\n    if (!hasStacks) { return; }\n\n    try {\n      throw new Error();\n    } catch (e) {\n      var lines = e.stack.split('\\n');\n      var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2];\n      var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);\n      if (!fileNameAndLineNumber) { return; }\n\n      rFileName = fileNameAndLineNumber[0];\n      return fileNameAndLineNumber[1];\n    }\n  }\n\n  function getFileNameAndLineNumber(stackLine) {\n    // Named functions: 'at functionName (filename:lineNumber:columnNumber)'\n    var attempt1 = /at .+ \\((.+):(\\d+):(?:\\d+)\\)$/.exec(stackLine);\n    if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }\n\n    // Anonymous functions: 'at filename:lineNumber:columnNumber'\n    var attempt2 = /at ([^ ]+):(\\d+):(?:\\d+)$/.exec(stackLine);\n    if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }\n\n    // Firefox style: 'function@filename:lineNumber or @filename:lineNumber'\n    var attempt3 = /.*@(.+):(\\d+)$/.exec(stackLine);\n    if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }\n  }\n\n  var EmptyError = Rx.EmptyError = function() {\n    this.message = 'Sequence contains no elements.';\n    Error.call(this);\n  };\n  EmptyError.prototype = Object.create(Error.prototype);\n  EmptyError.prototype.name = 'EmptyError';\n\n  var ObjectDisposedError = Rx.ObjectDisposedError = function() {\n    this.message = 'Object has been disposed';\n    Error.call(this);\n  };\n  ObjectDisposedError.prototype = Object.create(Error.prototype);\n  ObjectDisposedError.prototype.name = 'ObjectDisposedError';\n\n  var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {\n    this.message = 'Argument out of range';\n    Error.call(this);\n  };\n  ArgumentOutOfRangeError.prototype = Object.create(Error.prototype);\n  ArgumentOutOfRangeError.prototype.name = 'ArgumentOutOfRangeError';\n\n  var NotSupportedError = Rx.NotSupportedError = function (message) {\n    this.message = message || 'This operation is not supported';\n    Error.call(this);\n  };\n  NotSupportedError.prototype = Object.create(Error.prototype);\n  NotSupportedError.prototype.name = 'NotSupportedError';\n\n  var NotImplementedError = Rx.NotImplementedError = function (message) {\n    this.message = message || 'This operation is not implemented';\n    Error.call(this);\n  };\n  NotImplementedError.prototype = Object.create(Error.prototype);\n  NotImplementedError.prototype.name = 'NotImplementedError';\n\n  var notImplemented = Rx.helpers.notImplemented = function () {\n    throw new NotImplementedError();\n  };\n\n  var notSupported = Rx.helpers.notSupported = function () {\n    throw new NotSupportedError();\n  };\n\n  // Shim in iterator support\n  var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||\n    '_es6shim_iterator_';\n  // Bug for mozilla version\n  if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {\n    $iterator$ = '@@iterator';\n  }\n\n  var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };\n\n  var isIterable = Rx.helpers.isIterable = function (o) {\n    return o && o[$iterator$] !== undefined;\n  };\n\n  var isArrayLike = Rx.helpers.isArrayLike = function (o) {\n    return o && o.length !== undefined;\n  };\n\n  Rx.helpers.iterator = $iterator$;\n\n  var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {\n    if (typeof thisArg === 'undefined') { return func; }\n    switch(argCount) {\n      case 0:\n        return function() {\n          return func.call(thisArg)\n        };\n      case 1:\n        return function(arg) {\n          return func.call(thisArg, arg);\n        };\n      case 2:\n        return function(value, index) {\n          return func.call(thisArg, value, index);\n        };\n      case 3:\n        return function(value, index, collection) {\n          return func.call(thisArg, value, index, collection);\n        };\n    }\n\n    return function() {\n      return func.apply(thisArg, arguments);\n    };\n  };\n\n  /** Used to determine if values are of the language type Object */\n  var dontEnums = ['toString',\n    'toLocaleString',\n    'valueOf',\n    'hasOwnProperty',\n    'isPrototypeOf',\n    'propertyIsEnumerable',\n    'constructor'],\n  dontEnumsLength = dontEnums.length;\n\nvar argsTag = '[object Arguments]',\n    arrayTag = '[object Array]',\n    boolTag = '[object Boolean]',\n    dateTag = '[object Date]',\n    errorTag = '[object Error]',\n    funcTag = '[object Function]',\n    mapTag = '[object Map]',\n    numberTag = '[object Number]',\n    objectTag = '[object Object]',\n    regexpTag = '[object RegExp]',\n    setTag = '[object Set]',\n    stringTag = '[object String]',\n    weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n    float32Tag = '[object Float32Array]',\n    float64Tag = '[object Float64Array]',\n    int8Tag = '[object Int8Array]',\n    int16Tag = '[object Int16Array]',\n    int32Tag = '[object Int32Array]',\n    uint8Tag = '[object Uint8Array]',\n    uint8ClampedTag = '[object Uint8ClampedArray]',\n    uint16Tag = '[object Uint16Array]',\n    uint32Tag = '[object Uint32Array]';\n\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\nvar objectProto = Object.prototype,\n    hasOwnProperty = objectProto.hasOwnProperty,\n    objToString = objectProto.toString,\n    MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;\n\nvar keys = Object.keys || (function() {\n    var hasOwnProperty = Object.prototype.hasOwnProperty,\n        hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),\n        dontEnums = [\n          'toString',\n          'toLocaleString',\n          'valueOf',\n          'hasOwnProperty',\n          'isPrototypeOf',\n          'propertyIsEnumerable',\n          'constructor'\n        ],\n        dontEnumsLength = dontEnums.length;\n\n    return function(obj) {\n      if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n        throw new TypeError('Object.keys called on non-object');\n      }\n\n      var result = [], prop, i;\n\n      for (prop in obj) {\n        if (hasOwnProperty.call(obj, prop)) {\n          result.push(prop);\n        }\n      }\n\n      if (hasDontEnumBug) {\n        for (i = 0; i < dontEnumsLength; i++) {\n          if (hasOwnProperty.call(obj, dontEnums[i])) {\n            result.push(dontEnums[i]);\n          }\n        }\n      }\n      return result;\n    };\n  }());\n\nfunction equalObjects(object, other, equalFunc, isLoose, stackA, stackB) {\n  var objProps = keys(object),\n      objLength = objProps.length,\n      othProps = keys(other),\n      othLength = othProps.length;\n\n  if (objLength !== othLength && !isLoose) {\n    return false;\n  }\n  var index = objLength, key;\n  while (index--) {\n    key = objProps[index];\n    if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {\n      return false;\n    }\n  }\n  var skipCtor = isLoose;\n  while (++index < objLength) {\n    key = objProps[index];\n    var objValue = object[key],\n        othValue = other[key],\n        result;\n\n    if (!(result === undefined ? equalFunc(objValue, othValue, isLoose, stackA, stackB) : result)) {\n      return false;\n    }\n    skipCtor || (skipCtor = key === 'constructor');\n  }\n  if (!skipCtor) {\n    var objCtor = object.constructor,\n        othCtor = other.constructor;\n\n    if (objCtor !== othCtor &&\n        ('constructor' in object && 'constructor' in other) &&\n        !(typeof objCtor === 'function' && objCtor instanceof objCtor &&\n          typeof othCtor === 'function' && othCtor instanceof othCtor)) {\n      return false;\n    }\n  }\n  return true;\n}\n\nfunction equalByTag(object, other, tag) {\n  switch (tag) {\n    case boolTag:\n    case dateTag:\n      return +object === +other;\n\n    case errorTag:\n      return object.name === other.name && object.message === other.message;\n\n    case numberTag:\n      return (object !== +object) ?\n        other !== +other :\n        object === +other;\n\n    case regexpTag:\n    case stringTag:\n      return object === (other + '');\n  }\n  return false;\n}\n\nvar isObject = Rx.internals.isObject = function(value) {\n  var type = typeof value;\n  return !!value && (type === 'object' || type === 'function');\n};\n\nfunction isObjectLike(value) {\n  return !!value && typeof value === 'object';\n}\n\nfunction isLength(value) {\n  return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= MAX_SAFE_INTEGER;\n}\n\nvar isHostObject = (function() {\n  try {\n    Object({ 'toString': 0 } + '');\n  } catch(e) {\n    return function() { return false; };\n  }\n  return function(value) {\n    return typeof value.toString !== 'function' && typeof (value + '') === 'string';\n  };\n}());\n\nfunction isTypedArray(value) {\n  return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n}\n\nvar isArray = Array.isArray || function(value) {\n  return isObjectLike(value) && isLength(value.length) && objToString.call(value) === arrayTag;\n};\n\nfunction arraySome (array, predicate) {\n  var index = -1,\n      length = array.length;\n\n  while (++index < length) {\n    if (predicate(array[index], index, array)) {\n      return true;\n    }\n  }\n  return false;\n}\n\nfunction equalArrays(array, other, equalFunc, isLoose, stackA, stackB) {\n  var index = -1,\n      arrLength = array.length,\n      othLength = other.length;\n\n  if (arrLength !== othLength && !(isLoose && othLength > arrLength)) {\n    return false;\n  }\n  // Ignore non-index properties.\n  while (++index < arrLength) {\n    var arrValue = array[index],\n        othValue = other[index],\n        result;\n\n    if (result !== undefined) {\n      if (result) {\n        continue;\n      }\n      return false;\n    }\n    // Recursively compare arrays (susceptible to call stack limits).\n    if (isLoose) {\n      if (!arraySome(other, function(othValue) {\n            return arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB);\n          })) {\n        return false;\n      }\n    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB))) {\n      return false;\n    }\n  }\n  return true;\n}\n\nfunction baseIsEqualDeep(object, other, equalFunc, isLoose, stackA, stackB) {\n  var objIsArr = isArray(object),\n      othIsArr = isArray(other),\n      objTag = arrayTag,\n      othTag = arrayTag;\n\n  if (!objIsArr) {\n    objTag = objToString.call(object);\n    if (objTag === argsTag) {\n      objTag = objectTag;\n    } else if (objTag !== objectTag) {\n      objIsArr = isTypedArray(object);\n    }\n  }\n  if (!othIsArr) {\n    othTag = objToString.call(other);\n    if (othTag === argsTag) {\n      othTag = objectTag;\n    }\n  }\n  var objIsObj = objTag === objectTag && !isHostObject(object),\n      othIsObj = othTag === objectTag && !isHostObject(other),\n      isSameTag = objTag === othTag;\n\n  if (isSameTag && !(objIsArr || objIsObj)) {\n    return equalByTag(object, other, objTag);\n  }\n  if (!isLoose) {\n    var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n        othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n    if (objIsWrapped || othIsWrapped) {\n      return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, isLoose, stackA, stackB);\n    }\n  }\n  if (!isSameTag) {\n    return false;\n  }\n  // Assume cyclic values are equal.\n  // For more information on detecting circular references see https://es5.github.io/#JO.\n  stackA || (stackA = []);\n  stackB || (stackB = []);\n\n  var length = stackA.length;\n  while (length--) {\n    if (stackA[length] === object) {\n      return stackB[length] === other;\n    }\n  }\n  // Add `object` and `other` to the stack of traversed objects.\n  stackA.push(object);\n  stackB.push(other);\n\n  var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, isLoose, stackA, stackB);\n\n  stackA.pop();\n  stackB.pop();\n\n  return result;\n}\n\nfunction baseIsEqual(value, other, isLoose, stackA, stackB) {\n  if (value === other) {\n    return true;\n  }\n  if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\n    return value !== value && other !== other;\n  }\n  return baseIsEqualDeep(value, other, baseIsEqual, isLoose, stackA, stackB);\n}\n\nvar isEqual = Rx.internals.isEqual = function (value, other) {\n  return baseIsEqual(value, other);\n};\n\n  var hasProp = {}.hasOwnProperty,\n      slice = Array.prototype.slice;\n\n  var inherits = Rx.internals.inherits = function (child, parent) {\n    function __() { this.constructor = child; }\n    __.prototype = parent.prototype;\n    child.prototype = new __();\n  };\n\n  var addProperties = Rx.internals.addProperties = function (obj) {\n    for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }\n    for (var idx = 0, ln = sources.length; idx < ln; idx++) {\n      var source = sources[idx];\n      for (var prop in source) {\n        obj[prop] = source[prop];\n      }\n    }\n  };\n\n  // Rx Utils\n  var addRef = Rx.internals.addRef = function (xs, r) {\n    return new AnonymousObservable(function (observer) {\n      return new BinaryDisposable(r.getDisposable(), xs.subscribe(observer));\n    });\n  };\n\n  function arrayInitialize(count, factory) {\n    var a = new Array(count);\n    for (var i = 0; i < count; i++) {\n      a[i] = factory();\n    }\n    return a;\n  }\n\n  function IndexedItem(id, value) {\n    this.id = id;\n    this.value = value;\n  }\n\n  IndexedItem.prototype.compareTo = function (other) {\n    var c = this.value.compareTo(other.value);\n    c === 0 && (c = this.id - other.id);\n    return c;\n  };\n\n  var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {\n    this.items = new Array(capacity);\n    this.length = 0;\n  };\n\n  var priorityProto = PriorityQueue.prototype;\n  priorityProto.isHigherPriority = function (left, right) {\n    return this.items[left].compareTo(this.items[right]) < 0;\n  };\n\n  priorityProto.percolate = function (index) {\n    if (index >= this.length || index < 0) { return; }\n    var parent = index - 1 >> 1;\n    if (parent < 0 || parent === index) { return; }\n    if (this.isHigherPriority(index, parent)) {\n      var temp = this.items[index];\n      this.items[index] = this.items[parent];\n      this.items[parent] = temp;\n      this.percolate(parent);\n    }\n  };\n\n  priorityProto.heapify = function (index) {\n    +index || (index = 0);\n    if (index >= this.length || index < 0) { return; }\n    var left = 2 * index + 1,\n        right = 2 * index + 2,\n        first = index;\n    if (left < this.length && this.isHigherPriority(left, first)) {\n      first = left;\n    }\n    if (right < this.length && this.isHigherPriority(right, first)) {\n      first = right;\n    }\n    if (first !== index) {\n      var temp = this.items[index];\n      this.items[index] = this.items[first];\n      this.items[first] = temp;\n      this.heapify(first);\n    }\n  };\n\n  priorityProto.peek = function () { return this.items[0].value; };\n\n  priorityProto.removeAt = function (index) {\n    this.items[index] = this.items[--this.length];\n    this.items[this.length] = undefined;\n    this.heapify();\n  };\n\n  priorityProto.dequeue = function () {\n    var result = this.peek();\n    this.removeAt(0);\n    return result;\n  };\n\n  priorityProto.enqueue = function (item) {\n    var index = this.length++;\n    this.items[index] = new IndexedItem(PriorityQueue.count++, item);\n    this.percolate(index);\n  };\n\n  priorityProto.remove = function (item) {\n    for (var i = 0; i < this.length; i++) {\n      if (this.items[i].value === item) {\n        this.removeAt(i);\n        return true;\n      }\n    }\n    return false;\n  };\n  PriorityQueue.count = 0;\n\n  /**\n   * Represents a group of disposable resources that are disposed together.\n   * @constructor\n   */\n  var CompositeDisposable = Rx.CompositeDisposable = function () {\n    var args = [], i, len;\n    if (Array.isArray(arguments[0])) {\n      args = arguments[0];\n    } else {\n      len = arguments.length;\n      args = new Array(len);\n      for(i = 0; i < len; i++) { args[i] = arguments[i]; }\n    }\n    this.disposables = args;\n    this.isDisposed = false;\n    this.length = args.length;\n  };\n\n  var CompositeDisposablePrototype = CompositeDisposable.prototype;\n\n  /**\n   * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.\n   * @param {Mixed} item Disposable to add.\n   */\n  CompositeDisposablePrototype.add = function (item) {\n    if (this.isDisposed) {\n      item.dispose();\n    } else {\n      this.disposables.push(item);\n      this.length++;\n    }\n  };\n\n  /**\n   * Removes and disposes the first occurrence of a disposable from the CompositeDisposable.\n   * @param {Mixed} item Disposable to remove.\n   * @returns {Boolean} true if found; false otherwise.\n   */\n  CompositeDisposablePrototype.remove = function (item) {\n    var shouldDispose = false;\n    if (!this.isDisposed) {\n      var idx = this.disposables.indexOf(item);\n      if (idx !== -1) {\n        shouldDispose = true;\n        this.disposables.splice(idx, 1);\n        this.length--;\n        item.dispose();\n      }\n    }\n    return shouldDispose;\n  };\n\n  /**\n   *  Disposes all disposables in the group and removes them from the group.\n   */\n  CompositeDisposablePrototype.dispose = function () {\n    if (!this.isDisposed) {\n      this.isDisposed = true;\n      var len = this.disposables.length, currentDisposables = new Array(len);\n      for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }\n      this.disposables = [];\n      this.length = 0;\n\n      for (i = 0; i < len; i++) {\n        currentDisposables[i].dispose();\n      }\n    }\n  };\n\n  /**\n   * Provides a set of static methods for creating Disposables.\n   * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.\n   */\n  var Disposable = Rx.Disposable = function (action) {\n    this.isDisposed = false;\n    this.action = action || noop;\n  };\n\n  /** Performs the task of cleaning up resources. */\n  Disposable.prototype.dispose = function () {\n    if (!this.isDisposed) {\n      this.action();\n      this.isDisposed = true;\n    }\n  };\n\n  /**\n   * Creates a disposable object that invokes the specified action when disposed.\n   * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.\n   * @return {Disposable} The disposable object that runs the given action upon disposal.\n   */\n  var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };\n\n  /**\n   * Gets the disposable that does nothing when disposed.\n   */\n  var disposableEmpty = Disposable.empty = { dispose: noop };\n\n  /**\n   * Validates whether the given object is a disposable\n   * @param {Object} Object to test whether it has a dispose method\n   * @returns {Boolean} true if a disposable object, else false.\n   */\n  var isDisposable = Disposable.isDisposable = function (d) {\n    return d && isFunction(d.dispose);\n  };\n\n  var checkDisposed = Disposable.checkDisposed = function (disposable) {\n    if (disposable.isDisposed) { throw new ObjectDisposedError(); }\n  };\n\n  var disposableFixup = Disposable._fixup = function (result) {\n    return isDisposable(result) ? result : disposableEmpty;\n  };\n\n  // Single assignment\n  var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {\n    this.isDisposed = false;\n    this.current = null;\n  };\n  SingleAssignmentDisposable.prototype.getDisposable = function () {\n    return this.current;\n  };\n  SingleAssignmentDisposable.prototype.setDisposable = function (value) {\n    if (this.current) { throw new Error('Disposable has already been assigned'); }\n    var shouldDispose = this.isDisposed;\n    !shouldDispose && (this.current = value);\n    shouldDispose && value && value.dispose();\n  };\n  SingleAssignmentDisposable.prototype.dispose = function () {\n    if (!this.isDisposed) {\n      this.isDisposed = true;\n      var old = this.current;\n      this.current = null;\n      old && old.dispose();\n    }\n  };\n\n  // Multiple assignment disposable\n  var SerialDisposable = Rx.SerialDisposable = function () {\n    this.isDisposed = false;\n    this.current = null;\n  };\n  SerialDisposable.prototype.getDisposable = function () {\n    return this.current;\n  };\n  SerialDisposable.prototype.setDisposable = function (value) {\n    var shouldDispose = this.isDisposed;\n    if (!shouldDispose) {\n      var old = this.current;\n      this.current = value;\n    }\n    old && old.dispose();\n    shouldDispose && value && value.dispose();\n  };\n  SerialDisposable.prototype.dispose = function () {\n    if (!this.isDisposed) {\n      this.isDisposed = true;\n      var old = this.current;\n      this.current = null;\n    }\n    old && old.dispose();\n  };\n\n  var BinaryDisposable = Rx.BinaryDisposable = function (first, second) {\n    this._first = first;\n    this._second = second;\n    this.isDisposed = false;\n  };\n\n  BinaryDisposable.prototype.dispose = function () {\n    if (!this.isDisposed) {\n      this.isDisposed = true;\n      var old1 = this._first;\n      this._first = null;\n      old1 && old1.dispose();\n      var old2 = this._second;\n      this._second = null;\n      old2 && old2.dispose();\n    }\n  };\n\n  var NAryDisposable = Rx.NAryDisposable = function (disposables) {\n    this._disposables = disposables;\n    this.isDisposed = false;\n  };\n\n  NAryDisposable.prototype.dispose = function () {\n    if (!this.isDisposed) {\n      this.isDisposed = true;\n      for (var i = 0, len = this._disposables.length; i < len; i++) {\n        this._disposables[i].dispose();\n      }\n      this._disposables.length = 0;\n    }\n  };\n\n  /**\n   * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.\n   */\n  var RefCountDisposable = Rx.RefCountDisposable = (function () {\n\n    function InnerDisposable(disposable) {\n      this.disposable = disposable;\n      this.disposable.count++;\n      this.isInnerDisposed = false;\n    }\n\n    InnerDisposable.prototype.dispose = function () {\n      if (!this.disposable.isDisposed && !this.isInnerDisposed) {\n        this.isInnerDisposed = true;\n        this.disposable.count--;\n        if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {\n          this.disposable.isDisposed = true;\n          this.disposable.underlyingDisposable.dispose();\n        }\n      }\n    };\n\n    /**\n     * Initializes a new instance of the RefCountDisposable with the specified disposable.\n     * @constructor\n     * @param {Disposable} disposable Underlying disposable.\n      */\n    function RefCountDisposable(disposable) {\n      this.underlyingDisposable = disposable;\n      this.isDisposed = false;\n      this.isPrimaryDisposed = false;\n      this.count = 0;\n    }\n\n    /**\n     * Disposes the underlying disposable only when all dependent disposables have been disposed\n     */\n    RefCountDisposable.prototype.dispose = function () {\n      if (!this.isDisposed && !this.isPrimaryDisposed) {\n        this.isPrimaryDisposed = true;\n        if (this.count === 0) {\n          this.isDisposed = true;\n          this.underlyingDisposable.dispose();\n        }\n      }\n    };\n\n    /**\n     * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.\n     * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.\n     */\n    RefCountDisposable.prototype.getDisposable = function () {\n      return this.isDisposed ? disposableEmpty : new InnerDisposable(this);\n    };\n\n    return RefCountDisposable;\n  })();\n\n  function ScheduledDisposable(scheduler, disposable) {\n    this.scheduler = scheduler;\n    this.disposable = disposable;\n    this.isDisposed = false;\n  }\n\n  function scheduleItem(s, self) {\n    if (!self.isDisposed) {\n      self.isDisposed = true;\n      self.disposable.dispose();\n    }\n  }\n\n  ScheduledDisposable.prototype.dispose = function () {\n    this.scheduler.schedule(this, scheduleItem);\n  };\n\n  var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {\n    this.scheduler = scheduler;\n    this.state = state;\n    this.action = action;\n    this.dueTime = dueTime;\n    this.comparer = comparer || defaultSubComparer;\n    this.disposable = new SingleAssignmentDisposable();\n  };\n\n  ScheduledItem.prototype.invoke = function () {\n    this.disposable.setDisposable(this.invokeCore());\n  };\n\n  ScheduledItem.prototype.compareTo = function (other) {\n    return this.comparer(this.dueTime, other.dueTime);\n  };\n\n  ScheduledItem.prototype.isCancelled = function () {\n    return this.disposable.isDisposed;\n  };\n\n  ScheduledItem.prototype.invokeCore = function () {\n    return disposableFixup(this.action(this.scheduler, this.state));\n  };\n\n  /** Provides a set of static properties to access commonly used schedulers. */\n  var Scheduler = Rx.Scheduler = (function () {\n\n    function Scheduler() { }\n\n    /** Determines whether the given object is a scheduler */\n    Scheduler.isScheduler = function (s) {\n      return s instanceof Scheduler;\n    };\n\n    var schedulerProto = Scheduler.prototype;\n\n    /**\n   * Schedules an action to be executed.\n   * @param state State passed to the action to be executed.\n   * @param {Function} action Action to be executed.\n   * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\n   */\n    schedulerProto.schedule = function (state, action) {\n      throw new NotImplementedError();\n    };\n\n  /**\n   * Schedules an action to be executed after dueTime.\n   * @param state State passed to the action to be executed.\n   * @param {Function} action Action to be executed.\n   * @param {Number} dueTime Relative time after which to execute the action.\n   * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\n   */\n    schedulerProto.scheduleFuture = function (state, dueTime, action) {\n      var dt = dueTime;\n      dt instanceof Date && (dt = dt - this.now());\n      dt = Scheduler.normalize(dt);\n\n      if (dt === 0) { return this.schedule(state, action); }\n\n      return this._scheduleFuture(state, dt, action);\n    };\n\n    schedulerProto._scheduleFuture = function (state, dueTime, action) {\n      throw new NotImplementedError();\n    };\n\n    /** Gets the current time according to the local machine's system clock. */\n    Scheduler.now = defaultNow;\n\n    /** Gets the current time according to the local machine's system clock. */\n    Scheduler.prototype.now = defaultNow;\n\n    /**\n     * Normalizes the specified TimeSpan value to a positive value.\n     * @param {Number} timeSpan The time span value to normalize.\n     * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0\n     */\n    Scheduler.normalize = function (timeSpan) {\n      timeSpan < 0 && (timeSpan = 0);\n      return timeSpan;\n    };\n\n    return Scheduler;\n  }());\n\n  var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler;\n\n  (function (schedulerProto) {\n\n    function invokeRecImmediate(scheduler, pair) {\n      var state = pair[0], action = pair[1], group = new CompositeDisposable();\n      action(state, innerAction);\n      return group;\n\n      function innerAction(state2) {\n        var isAdded = false, isDone = false;\n\n        var d = scheduler.schedule(state2, scheduleWork);\n        if (!isDone) {\n          group.add(d);\n          isAdded = true;\n        }\n\n        function scheduleWork(_, state3) {\n          if (isAdded) {\n            group.remove(d);\n          } else {\n            isDone = true;\n          }\n          action(state3, innerAction);\n          return disposableEmpty;\n        }\n      }\n    }\n\n    function invokeRecDate(scheduler, pair) {\n      var state = pair[0], action = pair[1], group = new CompositeDisposable();\n      action(state, innerAction);\n      return group;\n\n      function innerAction(state2, dueTime1) {\n        var isAdded = false, isDone = false;\n\n        var d = scheduler.scheduleFuture(state2, dueTime1, scheduleWork);\n        if (!isDone) {\n          group.add(d);\n          isAdded = true;\n        }\n\n        function scheduleWork(_, state3) {\n          if (isAdded) {\n            group.remove(d);\n          } else {\n            isDone = true;\n          }\n          action(state3, innerAction);\n          return disposableEmpty;\n        }\n      }\n    }\n\n    /**\n     * Schedules an action to be executed recursively.\n     * @param {Mixed} state State passed to the action to be executed.\n     * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\n     */\n    schedulerProto.scheduleRecursive = function (state, action) {\n      return this.schedule([state, action], invokeRecImmediate);\n    };\n\n    /**\n     * Schedules an action to be executed recursively after a specified relative or absolute due time.\n     * @param {Mixed} state State passed to the action to be executed.\n     * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.\n     * @param {Number | Date} dueTime Relative or absolute time after which to execute the action for the first time.\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\n     */\n    schedulerProto.scheduleRecursiveFuture = function (state, dueTime, action) {\n      return this.scheduleFuture([state, action], dueTime, invokeRecDate);\n    };\n\n  }(Scheduler.prototype));\n\n  (function (schedulerProto) {\n\n    /**\n     * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.\n     * @param {Mixed} state Initial state passed to the action upon the first iteration.\n     * @param {Number} period Period for running the work periodically.\n     * @param {Function} action Action to be executed, potentially updating the state.\n     * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).\n     */\n    schedulerProto.schedulePeriodic = function(state, period, action) {\n      if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }\n      period = normalizeTime(period);\n      var s = state, id = root.setInterval(function () { s = action(s); }, period);\n      return disposableCreate(function () { root.clearInterval(id); });\n    };\n\n  }(Scheduler.prototype));\n\n  (function (schedulerProto) {\n    /**\n     * Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.\n     * @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.\n     * @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.\n     */\n    schedulerProto.catchError = schedulerProto['catch'] = function (handler) {\n      return new CatchScheduler(this, handler);\n    };\n  }(Scheduler.prototype));\n\n  var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {\n    function createTick(self) {\n      return function tick(command, recurse) {\n        recurse(0, self._period);\n        var state = tryCatch(self._action)(self._state);\n        if (state === errorObj) {\n          self._cancel.dispose();\n          thrower(state.e);\n        }\n        self._state = state;\n      };\n    }\n\n    function SchedulePeriodicRecursive(scheduler, state, period, action) {\n      this._scheduler = scheduler;\n      this._state = state;\n      this._period = period;\n      this._action = action;\n    }\n\n    SchedulePeriodicRecursive.prototype.start = function () {\n      var d = new SingleAssignmentDisposable();\n      this._cancel = d;\n      d.setDisposable(this._scheduler.scheduleRecursiveFuture(0, this._period, createTick(this)));\n\n      return d;\n    };\n\n    return SchedulePeriodicRecursive;\n  }());\n\n  /** Gets a scheduler that schedules work immediately on the current thread. */\n   var ImmediateScheduler = (function (__super__) {\n    inherits(ImmediateScheduler, __super__);\n    function ImmediateScheduler() {\n      __super__.call(this);\n    }\n\n    ImmediateScheduler.prototype.schedule = function (state, action) {\n      return disposableFixup(action(this, state));\n    };\n\n    return ImmediateScheduler;\n  }(Scheduler));\n\n  var immediateScheduler = Scheduler.immediate = new ImmediateScheduler();\n\n  /**\n   * Gets a scheduler that schedules work as soon as possible on the current thread.\n   */\n  var CurrentThreadScheduler = (function (__super__) {\n    var queue;\n\n    function runTrampoline () {\n      while (queue.length > 0) {\n        var item = queue.dequeue();\n        !item.isCancelled() && item.invoke();\n      }\n    }\n\n    inherits(CurrentThreadScheduler, __super__);\n    function CurrentThreadScheduler() {\n      __super__.call(this);\n    }\n\n    CurrentThreadScheduler.prototype.schedule = function (state, action) {\n      var si = new ScheduledItem(this, state, action, this.now());\n\n      if (!queue) {\n        queue = new PriorityQueue(4);\n        queue.enqueue(si);\n\n        var result = tryCatch(runTrampoline)();\n        queue = null;\n        if (result === errorObj) { thrower(result.e); }\n      } else {\n        queue.enqueue(si);\n      }\n      return si.disposable;\n    };\n\n    CurrentThreadScheduler.prototype.scheduleRequired = function () { return !queue; };\n\n    return CurrentThreadScheduler;\n  }(Scheduler));\n\n  var currentThreadScheduler = Scheduler.currentThread = new CurrentThreadScheduler();\n\n  var scheduleMethod, clearMethod;\n\n  var localTimer = (function () {\n    var localSetTimeout, localClearTimeout = noop;\n    if (!!root.setTimeout) {\n      localSetTimeout = root.setTimeout;\n      localClearTimeout = root.clearTimeout;\n    } else if (!!root.WScript) {\n      localSetTimeout = function (fn, time) {\n        root.WScript.Sleep(time);\n        fn();\n      };\n    } else {\n      throw new NotSupportedError();\n    }\n\n    return {\n      setTimeout: localSetTimeout,\n      clearTimeout: localClearTimeout\n    };\n  }());\n  var localSetTimeout = localTimer.setTimeout,\n    localClearTimeout = localTimer.clearTimeout;\n\n  (function () {\n\n    var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;\n\n    clearMethod = function (handle) {\n      delete tasksByHandle[handle];\n    };\n\n    function runTask(handle) {\n      if (currentlyRunning) {\n        localSetTimeout(function () { runTask(handle); }, 0);\n      } else {\n        var task = tasksByHandle[handle];\n        if (task) {\n          currentlyRunning = true;\n          var result = tryCatch(task)();\n          clearMethod(handle);\n          currentlyRunning = false;\n          if (result === errorObj) { thrower(result.e); }\n        }\n      }\n    }\n\n    var reNative = new RegExp('^' +\n      String(toString)\n        .replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n        .replace(/toString| for [^\\]]+/g, '.*?') + '$'\n    );\n\n    var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&\n      !reNative.test(setImmediate) && setImmediate;\n\n    function postMessageSupported () {\n      // Ensure not in a worker\n      if (!root.postMessage || root.importScripts) { return false; }\n      var isAsync = false, oldHandler = root.onmessage;\n      // Test for async\n      root.onmessage = function () { isAsync = true; };\n      root.postMessage('', '*');\n      root.onmessage = oldHandler;\n\n      return isAsync;\n    }\n\n    // Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout\n    if (isFunction(setImmediate)) {\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        setImmediate(function () { runTask(id); });\n\n        return id;\n      };\n    } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        process.nextTick(function () { runTask(id); });\n\n        return id;\n      };\n    } else if (postMessageSupported()) {\n      var MSG_PREFIX = 'ms.rx.schedule' + Math.random();\n\n      var onGlobalPostMessage = function (event) {\n        // Only if we're a match to avoid any other global events\n        if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {\n          runTask(event.data.substring(MSG_PREFIX.length));\n        }\n      };\n\n      root.addEventListener('message', onGlobalPostMessage, false);\n\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        root.postMessage(MSG_PREFIX + currentId, '*');\n        return id;\n      };\n    } else if (!!root.MessageChannel) {\n      var channel = new root.MessageChannel();\n\n      channel.port1.onmessage = function (e) { runTask(e.data); };\n\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        channel.port2.postMessage(id);\n        return id;\n      };\n    } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {\n\n      scheduleMethod = function (action) {\n        var scriptElement = root.document.createElement('script');\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n\n        scriptElement.onreadystatechange = function () {\n          runTask(id);\n          scriptElement.onreadystatechange = null;\n          scriptElement.parentNode.removeChild(scriptElement);\n          scriptElement = null;\n        };\n        root.document.documentElement.appendChild(scriptElement);\n        return id;\n      };\n\n    } else {\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        localSetTimeout(function () {\n          runTask(id);\n        }, 0);\n\n        return id;\n      };\n    }\n  }());\n\n  /**\n   * Gets a scheduler that schedules work via a timed callback based upon platform.\n   */\n   var DefaultScheduler = (function (__super__) {\n     inherits(DefaultScheduler, __super__);\n     function DefaultScheduler() {\n       __super__.call(this);\n     }\n\n     function scheduleAction(disposable, action, scheduler, state) {\n       return function schedule() {\n         disposable.setDisposable(Disposable._fixup(action(scheduler, state)));\n       };\n     }\n\n     function ClearDisposable(id) {\n       this._id = id;\n       this.isDisposed = false;\n     }\n\n     ClearDisposable.prototype.dispose = function () {\n       if (!this.isDisposed) {\n         this.isDisposed = true;\n         clearMethod(this._id);\n       }\n     };\n\n     function LocalClearDisposable(id) {\n       this._id = id;\n       this.isDisposed = false;\n     }\n\n     LocalClearDisposable.prototype.dispose = function () {\n       if (!this.isDisposed) {\n         this.isDisposed = true;\n         localClearTimeout(this._id);\n       }\n     };\n\n    DefaultScheduler.prototype.schedule = function (state, action) {\n      var disposable = new SingleAssignmentDisposable(),\n          id = scheduleMethod(scheduleAction(disposable, action, this, state));\n      return new BinaryDisposable(disposable, new ClearDisposable(id));\n    };\n\n    DefaultScheduler.prototype._scheduleFuture = function (state, dueTime, action) {\n      if (dueTime === 0) { return this.schedule(state, action); }\n      var disposable = new SingleAssignmentDisposable(),\n          id = localSetTimeout(scheduleAction(disposable, action, this, state), dueTime);\n      return new BinaryDisposable(disposable, new LocalClearDisposable(id));\n    };\n\n    return DefaultScheduler;\n  }(Scheduler));\n\n  var defaultScheduler = Scheduler['default'] = Scheduler.async = new DefaultScheduler();\n\n  var CatchScheduler = (function (__super__) {\n    inherits(CatchScheduler, __super__);\n\n    function CatchScheduler(scheduler, handler) {\n      this._scheduler = scheduler;\n      this._handler = handler;\n      this._recursiveOriginal = null;\n      this._recursiveWrapper = null;\n      __super__.call(this);\n    }\n\n    CatchScheduler.prototype.schedule = function (state, action) {\n      return this._scheduler.schedule(state, this._wrap(action));\n    };\n\n    CatchScheduler.prototype._scheduleFuture = function (state, dueTime, action) {\n      return this._scheduler.schedule(state, dueTime, this._wrap(action));\n    };\n\n    CatchScheduler.prototype.now = function () { return this._scheduler.now(); };\n\n    CatchScheduler.prototype._clone = function (scheduler) {\n        return new CatchScheduler(scheduler, this._handler);\n    };\n\n    CatchScheduler.prototype._wrap = function (action) {\n      var parent = this;\n      return function (self, state) {\n        var res = tryCatch(action)(parent._getRecursiveWrapper(self), state);\n        if (res === errorObj) {\n          if (!parent._handler(res.e)) { thrower(res.e); }\n          return disposableEmpty;\n        }\n        return disposableFixup(res);\n      };\n    };\n\n    CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {\n      if (this._recursiveOriginal !== scheduler) {\n        this._recursiveOriginal = scheduler;\n        var wrapper = this._clone(scheduler);\n        wrapper._recursiveOriginal = scheduler;\n        wrapper._recursiveWrapper = wrapper;\n        this._recursiveWrapper = wrapper;\n      }\n      return this._recursiveWrapper;\n    };\n\n    CatchScheduler.prototype.schedulePeriodic = function (state, period, action) {\n      var self = this, failed = false, d = new SingleAssignmentDisposable();\n\n      d.setDisposable(this._scheduler.schedulePeriodic(state, period, function (state1) {\n        if (failed) { return null; }\n        var res = tryCatch(action)(state1);\n        if (res === errorObj) {\n          failed = true;\n          if (!self._handler(res.e)) { thrower(res.e); }\n          d.dispose();\n          return null;\n        }\n        return res;\n      }));\n\n      return d;\n    };\n\n    return CatchScheduler;\n  }(Scheduler));\n\n  /**\n   *  Represents a notification to an observer.\n   */\n  var Notification = Rx.Notification = (function () {\n    function Notification() {\n\n    }\n\n    Notification.prototype._accept = function (onNext, onError, onCompleted) {\n      throw new NotImplementedError();\n    };\n\n    Notification.prototype._acceptObserver = function (onNext, onError, onCompleted) {\n      throw new NotImplementedError();\n    };\n\n    /**\n     * Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.\n     * @param {Function | Observer} observerOrOnNext Function to invoke for an OnNext notification or Observer to invoke the notification on..\n     * @param {Function} onError Function to invoke for an OnError notification.\n     * @param {Function} onCompleted Function to invoke for an OnCompleted notification.\n     * @returns {Any} Result produced by the observation.\n     */\n    Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {\n      return observerOrOnNext && typeof observerOrOnNext === 'object' ?\n        this._acceptObserver(observerOrOnNext) :\n        this._accept(observerOrOnNext, onError, onCompleted);\n    };\n\n    /**\n     * Returns an observable sequence with a single notification.\n     *\n     * @memberOf Notifications\n     * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.\n     * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.\n     */\n    Notification.prototype.toObservable = function (scheduler) {\n      var self = this;\n      isScheduler(scheduler) || (scheduler = immediateScheduler);\n      return new AnonymousObservable(function (o) {\n        return scheduler.schedule(self, function (_, notification) {\n          notification._acceptObserver(o);\n          notification.kind === 'N' && o.onCompleted();\n        });\n      });\n    };\n\n    return Notification;\n  })();\n\n  var OnNextNotification = (function (__super__) {\n    inherits(OnNextNotification, __super__);\n    function OnNextNotification(value) {\n      this.value = value;\n      this.kind = 'N';\n    }\n\n    OnNextNotification.prototype._accept = function (onNext) {\n      return onNext(this.value);\n    };\n\n    OnNextNotification.prototype._acceptObserver = function (o) {\n      return o.onNext(this.value);\n    };\n\n    OnNextNotification.prototype.toString = function () {\n      return 'OnNext(' + this.value + ')';\n    };\n\n    return OnNextNotification;\n  }(Notification));\n\n  var OnErrorNotification = (function (__super__) {\n    inherits(OnErrorNotification, __super__);\n    function OnErrorNotification(error) {\n      this.error = error;\n      this.kind = 'E';\n    }\n\n    OnErrorNotification.prototype._accept = function (onNext, onError) {\n      return onError(this.error);\n    };\n\n    OnErrorNotification.prototype._acceptObserver = function (o) {\n      return o.onError(this.error);\n    };\n\n    OnErrorNotification.prototype.toString = function () {\n      return 'OnError(' + this.error + ')';\n    };\n\n    return OnErrorNotification;\n  }(Notification));\n\n  var OnCompletedNotification = (function (__super__) {\n    inherits(OnCompletedNotification, __super__);\n    function OnCompletedNotification() {\n      this.kind = 'C';\n    }\n\n    OnCompletedNotification.prototype._accept = function (onNext, onError, onCompleted) {\n      return onCompleted();\n    };\n\n    OnCompletedNotification.prototype._acceptObserver = function (o) {\n      return o.onCompleted();\n    };\n\n    OnCompletedNotification.prototype.toString = function () {\n      return 'OnCompleted()';\n    };\n\n    return OnCompletedNotification;\n  }(Notification));\n\n  /**\n   * Creates an object that represents an OnNext notification to an observer.\n   * @param {Any} value The value contained in the notification.\n   * @returns {Notification} The OnNext notification containing the value.\n   */\n  var notificationCreateOnNext = Notification.createOnNext = function (value) {\n    return new OnNextNotification(value);\n  };\n\n  /**\n   * Creates an object that represents an OnError notification to an observer.\n   * @param {Any} error The exception contained in the notification.\n   * @returns {Notification} The OnError notification containing the exception.\n   */\n  var notificationCreateOnError = Notification.createOnError = function (error) {\n    return new OnErrorNotification(error);\n  };\n\n  /**\n   * Creates an object that represents an OnCompleted notification to an observer.\n   * @returns {Notification} The OnCompleted notification.\n   */\n  var notificationCreateOnCompleted = Notification.createOnCompleted = function () {\n    return new OnCompletedNotification();\n  };\n\n  /**\n   * Supports push-style iteration over an observable sequence.\n   */\n  var Observer = Rx.Observer = function () { };\n\n  /**\n   *  Creates a notification callback from an observer.\n   * @returns The action that forwards its input notification to the underlying observer.\n   */\n  Observer.prototype.toNotifier = function () {\n    var observer = this;\n    return function (n) { return n.accept(observer); };\n  };\n\n  /**\n   *  Hides the identity of an observer.\n   * @returns An observer that hides the identity of the specified observer.\n   */\n  Observer.prototype.asObserver = function () {\n    var self = this;\n    return new AnonymousObserver(\n      function (x) { self.onNext(x); },\n      function (err) { self.onError(err); },\n      function () { self.onCompleted(); });\n  };\n\n  /**\n   *  Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.\n   *  If a violation is detected, an Error is thrown from the offending observer method call.\n   * @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.\n   */\n  Observer.prototype.checked = function () { return new CheckedObserver(this); };\n\n  /**\n   *  Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.\n   * @param {Function} [onNext] Observer's OnNext action implementation.\n   * @param {Function} [onError] Observer's OnError action implementation.\n   * @param {Function} [onCompleted] Observer's OnCompleted action implementation.\n   * @returns {Observer} The observer object implemented using the given actions.\n   */\n  var observerCreate = Observer.create = function (onNext, onError, onCompleted) {\n    onNext || (onNext = noop);\n    onError || (onError = defaultError);\n    onCompleted || (onCompleted = noop);\n    return new AnonymousObserver(onNext, onError, onCompleted);\n  };\n\n  /**\n   *  Creates an observer from a notification callback.\n   * @param {Function} handler Action that handles a notification.\n   * @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.\n   */\n  Observer.fromNotifier = function (handler, thisArg) {\n    var cb = bindCallback(handler, thisArg, 1);\n    return new AnonymousObserver(function (x) {\n      return cb(notificationCreateOnNext(x));\n    }, function (e) {\n      return cb(notificationCreateOnError(e));\n    }, function () {\n      return cb(notificationCreateOnCompleted());\n    });\n  };\n\n  /**\n   * Schedules the invocation of observer methods on the given scheduler.\n   * @param {Scheduler} scheduler Scheduler to schedule observer messages on.\n   * @returns {Observer} Observer whose messages are scheduled on the given scheduler.\n   */\n  Observer.prototype.notifyOn = function (scheduler) {\n    return new ObserveOnObserver(scheduler, this);\n  };\n\n  Observer.prototype.makeSafe = function(disposable) {\n    return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable);\n  };\n\n  /**\n   * Abstract base class for implementations of the Observer class.\n   * This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.\n   */\n  var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {\n    inherits(AbstractObserver, __super__);\n\n    /**\n     * Creates a new observer in a non-stopped state.\n     */\n    function AbstractObserver() {\n      this.isStopped = false;\n    }\n\n    // Must be implemented by other observers\n    AbstractObserver.prototype.next = notImplemented;\n    AbstractObserver.prototype.error = notImplemented;\n    AbstractObserver.prototype.completed = notImplemented;\n\n    /**\n     * Notifies the observer of a new element in the sequence.\n     * @param {Any} value Next element in the sequence.\n     */\n    AbstractObserver.prototype.onNext = function (value) {\n      !this.isStopped && this.next(value);\n    };\n\n    /**\n     * Notifies the observer that an exception has occurred.\n     * @param {Any} error The error that has occurred.\n     */\n    AbstractObserver.prototype.onError = function (error) {\n      if (!this.isStopped) {\n        this.isStopped = true;\n        this.error(error);\n      }\n    };\n\n    /**\n     * Notifies the observer of the end of the sequence.\n     */\n    AbstractObserver.prototype.onCompleted = function () {\n      if (!this.isStopped) {\n        this.isStopped = true;\n        this.completed();\n      }\n    };\n\n    /**\n     * Disposes the observer, causing it to transition to the stopped state.\n     */\n    AbstractObserver.prototype.dispose = function () { this.isStopped = true; };\n\n    AbstractObserver.prototype.fail = function (e) {\n      if (!this.isStopped) {\n        this.isStopped = true;\n        this.error(e);\n        return true;\n      }\n\n      return false;\n    };\n\n    return AbstractObserver;\n  }(Observer));\n\n  /**\n   * Class to create an Observer instance from delegate-based implementations of the on* methods.\n   */\n  var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {\n    inherits(AnonymousObserver, __super__);\n\n    /**\n     * Creates an observer from the specified OnNext, OnError, and OnCompleted actions.\n     * @param {Any} onNext Observer's OnNext action implementation.\n     * @param {Any} onError Observer's OnError action implementation.\n     * @param {Any} onCompleted Observer's OnCompleted action implementation.\n     */\n    function AnonymousObserver(onNext, onError, onCompleted) {\n      __super__.call(this);\n      this._onNext = onNext;\n      this._onError = onError;\n      this._onCompleted = onCompleted;\n    }\n\n    /**\n     * Calls the onNext action.\n     * @param {Any} value Next element in the sequence.\n     */\n    AnonymousObserver.prototype.next = function (value) {\n      this._onNext(value);\n    };\n\n    /**\n     * Calls the onError action.\n     * @param {Any} error The error that has occurred.\n     */\n    AnonymousObserver.prototype.error = function (error) {\n      this._onError(error);\n    };\n\n    /**\n     *  Calls the onCompleted action.\n     */\n    AnonymousObserver.prototype.completed = function () {\n      this._onCompleted();\n    };\n\n    return AnonymousObserver;\n  }(AbstractObserver));\n\n  var CheckedObserver = (function (__super__) {\n    inherits(CheckedObserver, __super__);\n\n    function CheckedObserver(observer) {\n      __super__.call(this);\n      this._observer = observer;\n      this._state = 0; // 0 - idle, 1 - busy, 2 - done\n    }\n\n    var CheckedObserverPrototype = CheckedObserver.prototype;\n\n    CheckedObserverPrototype.onNext = function (value) {\n      this.checkAccess();\n      var res = tryCatch(this._observer.onNext).call(this._observer, value);\n      this._state = 0;\n      res === errorObj && thrower(res.e);\n    };\n\n    CheckedObserverPrototype.onError = function (err) {\n      this.checkAccess();\n      var res = tryCatch(this._observer.onError).call(this._observer, err);\n      this._state = 2;\n      res === errorObj && thrower(res.e);\n    };\n\n    CheckedObserverPrototype.onCompleted = function () {\n      this.checkAccess();\n      var res = tryCatch(this._observer.onCompleted).call(this._observer);\n      this._state = 2;\n      res === errorObj && thrower(res.e);\n    };\n\n    CheckedObserverPrototype.checkAccess = function () {\n      if (this._state === 1) { throw new Error('Re-entrancy detected'); }\n      if (this._state === 2) { throw new Error('Observer completed'); }\n      if (this._state === 0) { this._state = 1; }\n    };\n\n    return CheckedObserver;\n  }(Observer));\n\n  var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {\n    inherits(ScheduledObserver, __super__);\n\n    function ScheduledObserver(scheduler, observer) {\n      __super__.call(this);\n      this.scheduler = scheduler;\n      this.observer = observer;\n      this.isAcquired = false;\n      this.hasFaulted = false;\n      this.queue = [];\n      this.disposable = new SerialDisposable();\n    }\n\n    function enqueueNext(observer, x) { return function () { observer.onNext(x); }; }\n    function enqueueError(observer, e) { return function () { observer.onError(e); }; }\n    function enqueueCompleted(observer) { return function () { observer.onCompleted(); }; }\n\n    ScheduledObserver.prototype.next = function (x) {\n      this.queue.push(enqueueNext(this.observer, x));\n    };\n\n    ScheduledObserver.prototype.error = function (e) {\n      this.queue.push(enqueueError(this.observer, e));\n    };\n\n    ScheduledObserver.prototype.completed = function () {\n      this.queue.push(enqueueCompleted(this.observer));\n    };\n\n\n    function scheduleMethod(state, recurse) {\n      var work;\n      if (state.queue.length > 0) {\n        work = state.queue.shift();\n      } else {\n        state.isAcquired = false;\n        return;\n      }\n      var res = tryCatch(work)();\n      if (res === errorObj) {\n        state.queue = [];\n        state.hasFaulted = true;\n        return thrower(res.e);\n      }\n      recurse(state);\n    }\n\n    ScheduledObserver.prototype.ensureActive = function () {\n      var isOwner = false;\n      if (!this.hasFaulted && this.queue.length > 0) {\n        isOwner = !this.isAcquired;\n        this.isAcquired = true;\n      }\n      isOwner &&\n        this.disposable.setDisposable(this.scheduler.scheduleRecursive(this, scheduleMethod));\n    };\n\n    ScheduledObserver.prototype.dispose = function () {\n      __super__.prototype.dispose.call(this);\n      this.disposable.dispose();\n    };\n\n    return ScheduledObserver;\n  }(AbstractObserver));\n\n  var ObserveOnObserver = (function (__super__) {\n    inherits(ObserveOnObserver, __super__);\n\n    function ObserveOnObserver(scheduler, observer, cancel) {\n      __super__.call(this, scheduler, observer);\n      this._cancel = cancel;\n    }\n\n    ObserveOnObserver.prototype.next = function (value) {\n      __super__.prototype.next.call(this, value);\n      this.ensureActive();\n    };\n\n    ObserveOnObserver.prototype.error = function (e) {\n      __super__.prototype.error.call(this, e);\n      this.ensureActive();\n    };\n\n    ObserveOnObserver.prototype.completed = function () {\n      __super__.prototype.completed.call(this);\n      this.ensureActive();\n    };\n\n    ObserveOnObserver.prototype.dispose = function () {\n      __super__.prototype.dispose.call(this);\n      this._cancel && this._cancel.dispose();\n      this._cancel = null;\n    };\n\n    return ObserveOnObserver;\n  })(ScheduledObserver);\n\n  var observableProto;\n\n  /**\n   * Represents a push-style collection.\n   */\n  var Observable = Rx.Observable = (function () {\n\n    function makeSubscribe(self, subscribe) {\n      return function (o) {\n        var oldOnError = o.onError;\n        o.onError = function (e) {\n          makeStackTraceLong(e, self);\n          oldOnError.call(o, e);\n        };\n\n        return subscribe.call(self, o);\n      };\n    }\n\n    function Observable() {\n      if (Rx.config.longStackSupport && hasStacks) {\n        var oldSubscribe = this._subscribe;\n        var e = tryCatch(thrower)(new Error()).e;\n        this.stack = e.stack.substring(e.stack.indexOf('\\n') + 1);\n        this._subscribe = makeSubscribe(this, oldSubscribe);\n      }\n    }\n\n    observableProto = Observable.prototype;\n\n    /**\n    * Determines whether the given object is an Observable\n    * @param {Any} An object to determine whether it is an Observable\n    * @returns {Boolean} true if an Observable, else false.\n    */\n    Observable.isObservable = function (o) {\n      return o && isFunction(o.subscribe);\n    };\n\n    /**\n     *  Subscribes an o to the observable sequence.\n     *  @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.\n     *  @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.\n     *  @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.\n     *  @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.\n     */\n    observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) {\n      return this._subscribe(typeof oOrOnNext === 'object' ?\n        oOrOnNext :\n        observerCreate(oOrOnNext, onError, onCompleted));\n    };\n\n    /**\n     * Subscribes to the next value in the sequence with an optional \"this\" argument.\n     * @param {Function} onNext The function to invoke on each element in the observable sequence.\n     * @param {Any} [thisArg] Object to use as this when executing callback.\n     * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.\n     */\n    observableProto.subscribeOnNext = function (onNext, thisArg) {\n      return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));\n    };\n\n    /**\n     * Subscribes to an exceptional condition in the sequence with an optional \"this\" argument.\n     * @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.\n     * @param {Any} [thisArg] Object to use as this when executing callback.\n     * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.\n     */\n    observableProto.subscribeOnError = function (onError, thisArg) {\n      return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));\n    };\n\n    /**\n     * Subscribes to the next value in the sequence with an optional \"this\" argument.\n     * @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.\n     * @param {Any} [thisArg] Object to use as this when executing callback.\n     * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.\n     */\n    observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {\n      return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));\n    };\n\n    return Observable;\n  })();\n\n  var ObservableBase = Rx.ObservableBase = (function (__super__) {\n    inherits(ObservableBase, __super__);\n\n    function fixSubscriber(subscriber) {\n      return subscriber && isFunction(subscriber.dispose) ? subscriber :\n        isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;\n    }\n\n    function setDisposable(s, state) {\n      var ado = state[0], self = state[1];\n      var sub = tryCatch(self.subscribeCore).call(self, ado);\n      if (sub === errorObj && !ado.fail(errorObj.e)) { thrower(errorObj.e); }\n      ado.setDisposable(fixSubscriber(sub));\n    }\n\n    function ObservableBase() {\n      __super__.call(this);\n    }\n\n    ObservableBase.prototype._subscribe = function (o) {\n      var ado = new AutoDetachObserver(o), state = [ado, this];\n\n      if (currentThreadScheduler.scheduleRequired()) {\n        currentThreadScheduler.schedule(state, setDisposable);\n      } else {\n        setDisposable(null, state);\n      }\n      return ado;\n    };\n\n    ObservableBase.prototype.subscribeCore = notImplemented;\n\n    return ObservableBase;\n  }(Observable));\n\nvar FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {\n\n    inherits(FlatMapObservable, __super__);\n\n    function FlatMapObservable(source, selector, resultSelector, thisArg) {\n      this.resultSelector = isFunction(resultSelector) ? resultSelector : null;\n      this.selector = bindCallback(isFunction(selector) ? selector : function() { return selector; }, thisArg, 3);\n      this.source = source;\n      __super__.call(this);\n    }\n\n    FlatMapObservable.prototype.subscribeCore = function(o) {\n      return this.source.subscribe(new InnerObserver(o, this.selector, this.resultSelector, this));\n    };\n\n    inherits(InnerObserver, AbstractObserver);\n    function InnerObserver(observer, selector, resultSelector, source) {\n      this.i = 0;\n      this.selector = selector;\n      this.resultSelector = resultSelector;\n      this.source = source;\n      this.o = observer;\n      AbstractObserver.call(this);\n    }\n\n    InnerObserver.prototype._wrapResult = function(result, x, i) {\n      return this.resultSelector ?\n        result.map(function(y, i2) { return this.resultSelector(x, y, i, i2); }, this) :\n        result;\n    };\n\n    InnerObserver.prototype.next = function(x) {\n      var i = this.i++;\n      var result = tryCatch(this.selector)(x, i, this.source);\n      if (result === errorObj) { return this.o.onError(result.e); }\n\n      isPromise(result) && (result = observableFromPromise(result));\n      (isArrayLike(result) || isIterable(result)) && (result = Observable.from(result));\n      this.o.onNext(this._wrapResult(result, x, i));\n    };\n\n    InnerObserver.prototype.error = function(e) { this.o.onError(e); };\n\n    InnerObserver.prototype.completed = function() { this.o.onCompleted(); };\n\n    return FlatMapObservable;\n\n}(ObservableBase));\n\n  var Enumerable = Rx.internals.Enumerable = function () { };\n\n  function IsDisposedDisposable(state) {\n    this._s = state;\n    this.isDisposed = false;\n  }\n\n  IsDisposedDisposable.prototype.dispose = function () {\n    if (!this.isDisposed) {\n      this.isDisposed = true;\n      this._s.isDisposed = true;\n    }\n  };\n\n  var ConcatEnumerableObservable = (function(__super__) {\n    inherits(ConcatEnumerableObservable, __super__);\n    function ConcatEnumerableObservable(sources) {\n      this.sources = sources;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(state, recurse) {\n      if (state.isDisposed) { return; }\n      var currentItem = tryCatch(state.e.next).call(state.e);\n      if (currentItem === errorObj) { return state.o.onError(currentItem.e); }\n      if (currentItem.done) { return state.o.onCompleted(); }\n\n      // Check if promise\n      var currentValue = currentItem.value;\n      isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\n\n      var d = new SingleAssignmentDisposable();\n      state.subscription.setDisposable(d);\n      d.setDisposable(currentValue.subscribe(new InnerObserver(state, recurse)));\n    }\n\n    ConcatEnumerableObservable.prototype.subscribeCore = function (o) {\n      var subscription = new SerialDisposable();\n      var state = {\n        isDisposed: false,\n        o: o,\n        subscription: subscription,\n        e: this.sources[$iterator$]()\n      };\n\n      var cancelable = currentThreadScheduler.scheduleRecursive(state, scheduleMethod);\n      return new NAryDisposable([subscription, cancelable, new IsDisposedDisposable(state)]);\n    };\n\n    function InnerObserver(state, recurse) {\n      this._state = state;\n      this._recurse = recurse;\n      AbstractObserver.call(this);\n    }\n\n    inherits(InnerObserver, AbstractObserver);\n\n    InnerObserver.prototype.next = function (x) { this._state.o.onNext(x); };\n    InnerObserver.prototype.error = function (e) { this._state.o.onError(e); };\n    InnerObserver.prototype.completed = function () { this._recurse(this._state); };\n\n    return ConcatEnumerableObservable;\n  }(ObservableBase));\n\n  Enumerable.prototype.concat = function () {\n    return new ConcatEnumerableObservable(this);\n  };\n\n  var CatchErrorObservable = (function(__super__) {\n    function CatchErrorObservable(sources) {\n      this.sources = sources;\n      __super__.call(this);\n    }\n\n    inherits(CatchErrorObservable, __super__);\n\n    function scheduleMethod(state, recurse) {\n      if (state.isDisposed) { return; }\n      var currentItem = tryCatch(state.e.next).call(state.e);\n      if (currentItem === errorObj) { return state.o.onError(currentItem.e); }\n      if (currentItem.done) { return state.lastError !== null ? state.o.onError(state.lastError) : state.o.onCompleted(); }\n\n      var currentValue = currentItem.value;\n      isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\n\n      var d = new SingleAssignmentDisposable();\n      state.subscription.setDisposable(d);\n      d.setDisposable(currentValue.subscribe(new InnerObserver(state, recurse)));\n    }\n\n    CatchErrorObservable.prototype.subscribeCore = function (o) {\n      var subscription = new SerialDisposable();\n      var state = {\n        isDisposed: false,\n        e: this.sources[$iterator$](),\n        subscription: subscription,\n        lastError: null,\n        o: o\n      };\n\n      var cancelable = currentThreadScheduler.scheduleRecursive(state, scheduleMethod);\n      return new NAryDisposable([subscription, cancelable, new IsDisposedDisposable(state)]);\n    };\n\n    function InnerObserver(state, recurse) {\n      this._state = state;\n      this._recurse = recurse;\n      AbstractObserver.call(this);\n    }\n\n    inherits(InnerObserver, AbstractObserver);\n\n    InnerObserver.prototype.next = function (x) { this._state.o.onNext(x); };\n    InnerObserver.prototype.error = function (e) { this._state.lastError = e; this._recurse(this._state); };\n    InnerObserver.prototype.completed = function () { this._state.o.onCompleted(); };\n\n    return CatchErrorObservable;\n  }(ObservableBase));\n\n  Enumerable.prototype.catchError = function () {\n    return new CatchErrorObservable(this);\n  };\n\n  Enumerable.prototype.catchErrorWhen = function (notificationHandler) {\n    var sources = this;\n    return new AnonymousObservable(function (o) {\n      var exceptions = new Subject(),\n        notifier = new Subject(),\n        handled = notificationHandler(exceptions),\n        notificationDisposable = handled.subscribe(notifier);\n\n      var e = sources[$iterator$]();\n\n      var state = { isDisposed: false },\n        lastError,\n        subscription = new SerialDisposable();\n      var cancelable = currentThreadScheduler.scheduleRecursive(null, function (_, self) {\n        if (state.isDisposed) { return; }\n        var currentItem = tryCatch(e.next).call(e);\n        if (currentItem === errorObj) { return o.onError(currentItem.e); }\n\n        if (currentItem.done) {\n          if (lastError) {\n            o.onError(lastError);\n          } else {\n            o.onCompleted();\n          }\n          return;\n        }\n\n        // Check if promise\n        var currentValue = currentItem.value;\n        isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\n\n        var outer = new SingleAssignmentDisposable();\n        var inner = new SingleAssignmentDisposable();\n        subscription.setDisposable(new BinaryDisposable(inner, outer));\n        outer.setDisposable(currentValue.subscribe(\n          function(x) { o.onNext(x); },\n          function (exn) {\n            inner.setDisposable(notifier.subscribe(self, function(ex) {\n              o.onError(ex);\n            }, function() {\n              o.onCompleted();\n            }));\n\n            exceptions.onNext(exn);\n          },\n          function() { o.onCompleted(); }));\n      });\n\n      return new NAryDisposable([notificationDisposable, subscription, cancelable, new IsDisposedDisposable(state)]);\n    });\n  };\n\n  var RepeatEnumerable = (function (__super__) {\n    inherits(RepeatEnumerable, __super__);\n    function RepeatEnumerable(v, c) {\n      this.v = v;\n      this.c = c == null ? -1 : c;\n    }\n\n    RepeatEnumerable.prototype[$iterator$] = function () {\n      return new RepeatEnumerator(this);\n    };\n\n    function RepeatEnumerator(p) {\n      this.v = p.v;\n      this.l = p.c;\n    }\n\n    RepeatEnumerator.prototype.next = function () {\n      if (this.l === 0) { return doneEnumerator; }\n      if (this.l > 0) { this.l--; }\n      return { done: false, value: this.v };\n    };\n\n    return RepeatEnumerable;\n  }(Enumerable));\n\n  var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {\n    return new RepeatEnumerable(value, repeatCount);\n  };\n\n  var OfEnumerable = (function(__super__) {\n    inherits(OfEnumerable, __super__);\n    function OfEnumerable(s, fn, thisArg) {\n      this.s = s;\n      this.fn = fn ? bindCallback(fn, thisArg, 3) : null;\n    }\n    OfEnumerable.prototype[$iterator$] = function () {\n      return new OfEnumerator(this);\n    };\n\n    function OfEnumerator(p) {\n      this.i = -1;\n      this.s = p.s;\n      this.l = this.s.length;\n      this.fn = p.fn;\n    }\n\n    OfEnumerator.prototype.next = function () {\n     return ++this.i < this.l ?\n       { done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } :\n       doneEnumerator;\n    };\n\n    return OfEnumerable;\n  }(Enumerable));\n\n  var enumerableOf = Enumerable.of = function (source, selector, thisArg) {\n    return new OfEnumerable(source, selector, thisArg);\n  };\n\nvar ObserveOnObservable = (function (__super__) {\n  inherits(ObserveOnObservable, __super__);\n  function ObserveOnObservable(source, s) {\n    this.source = source;\n    this._s = s;\n    __super__.call(this);\n  }\n\n  ObserveOnObservable.prototype.subscribeCore = function (o) {\n    return this.source.subscribe(new ObserveOnObserver(this._s, o));\n  };\n\n  return ObserveOnObservable;\n}(ObservableBase));\n\n   /**\n   *  Wraps the source sequence in order to run its observer callbacks on the specified scheduler.\n   *\n   *  This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects\n   *  that require to be run on a scheduler, use subscribeOn.\n   *\n   *  @param {Scheduler} scheduler Scheduler to notify observers on.\n   *  @returns {Observable} The source sequence whose observations happen on the specified scheduler.\n   */\n  observableProto.observeOn = function (scheduler) {\n    return new ObserveOnObservable(this, scheduler);\n  };\n\n  var SubscribeOnObservable = (function (__super__) {\n    inherits(SubscribeOnObservable, __super__);\n    function SubscribeOnObservable(source, s) {\n      this.source = source;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(scheduler, state) {\n      var source = state[0], d = state[1], o = state[2];\n      d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(o)));\n    }\n\n    SubscribeOnObservable.prototype.subscribeCore = function (o) {\n      var m = new SingleAssignmentDisposable(), d = new SerialDisposable();\n      d.setDisposable(m);\n      m.setDisposable(this._s.schedule([this.source, d, o], scheduleMethod));\n      return d;\n    };\n\n    return SubscribeOnObservable;\n  }(ObservableBase));\n\n   /**\n   *  Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;\n   *  see the remarks section for more information on the distinction between subscribeOn and observeOn.\n\n   *  This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer\n   *  callbacks on a scheduler, use observeOn.\n\n   *  @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.\n   *  @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.\n   */\n  observableProto.subscribeOn = function (scheduler) {\n    return new SubscribeOnObservable(this, scheduler);\n  };\n\n  var FromPromiseObservable = (function(__super__) {\n    inherits(FromPromiseObservable, __super__);\n    function FromPromiseObservable(p, s) {\n      this._p = p;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    function scheduleNext(s, state) {\n      var o = state[0], data = state[1];\n      o.onNext(data);\n      o.onCompleted();\n    }\n\n    function scheduleError(s, state) {\n      var o = state[0], err = state[1];\n      o.onError(err);\n    }\n\n    FromPromiseObservable.prototype.subscribeCore = function(o) {\n      var sad = new SingleAssignmentDisposable(), self = this;\n\n      this._p\n        .then(function (data) {\n          sad.setDisposable(self._s.schedule([o, data], scheduleNext));\n        }, function (err) {\n          sad.setDisposable(self._s.schedule([o, err], scheduleError));\n        });\n\n      return sad;\n    };\n\n    return FromPromiseObservable;\n  }(ObservableBase));\n\n  /**\n  * Converts a Promise to an Observable sequence\n  * @param {Promise} An ES6 Compliant promise.\n  * @returns {Observable} An Observable sequence which wraps the existing promise success and failure.\n  */\n  var observableFromPromise = Observable.fromPromise = function (promise, scheduler) {\n    scheduler || (scheduler = defaultScheduler);\n    return new FromPromiseObservable(promise, scheduler);\n  };\n\n  /*\n   * Converts an existing observable sequence to an ES6 Compatible Promise\n   * @example\n   * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);\n   *\n   * // With config\n   * Rx.config.Promise = RSVP.Promise;\n   * var promise = Rx.Observable.return(42).toPromise();\n   * @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.\n   * @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.\n   */\n  observableProto.toPromise = function (promiseCtor) {\n    promiseCtor || (promiseCtor = Rx.config.Promise);\n    if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); }\n    var source = this;\n    return new promiseCtor(function (resolve, reject) {\n      // No cancellation can be done\n      var value;\n      source.subscribe(function (v) {\n        value = v;\n      }, reject, function () {\n        resolve(value);\n      });\n    });\n  };\n\n  var ToArrayObservable = (function(__super__) {\n    inherits(ToArrayObservable, __super__);\n    function ToArrayObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    ToArrayObservable.prototype.subscribeCore = function(o) {\n      return this.source.subscribe(new InnerObserver(o));\n    };\n\n    inherits(InnerObserver, AbstractObserver);\n    function InnerObserver(o) {\n      this.o = o;\n      this.a = [];\n      AbstractObserver.call(this);\n    }\n    \n    InnerObserver.prototype.next = function (x) { this.a.push(x); };\n    InnerObserver.prototype.error = function (e) { this.o.onError(e);  };\n    InnerObserver.prototype.completed = function () { this.o.onNext(this.a); this.o.onCompleted(); };\n\n    return ToArrayObservable;\n  }(ObservableBase));\n\n  /**\n  * Creates an array from an observable sequence.\n  * @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.\n  */\n  observableProto.toArray = function () {\n    return new ToArrayObservable(this);\n  };\n\n  /**\n   *  Creates an observable sequence from a specified subscribe method implementation.\n   * @example\n   *  var res = Rx.Observable.create(function (observer) { return function () { } );\n   *  var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );\n   *  var res = Rx.Observable.create(function (observer) { } );\n   * @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.\n   * @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.\n   */\n  Observable.create = function (subscribe, parent) {\n    return new AnonymousObservable(subscribe, parent);\n  };\n\n  var Defer = (function(__super__) {\n    inherits(Defer, __super__);\n    function Defer(factory) {\n      this._f = factory;\n      __super__.call(this);\n    }\n\n    Defer.prototype.subscribeCore = function (o) {\n      var result = tryCatch(this._f)();\n      if (result === errorObj) { return observableThrow(result.e).subscribe(o);}\n      isPromise(result) && (result = observableFromPromise(result));\n      return result.subscribe(o);\n    };\n\n    return Defer;\n  }(ObservableBase));\n\n  /**\n   *  Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.\n   *\n   * @example\n   *  var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });\n   * @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.\n   * @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.\n   */\n  var observableDefer = Observable.defer = function (observableFactory) {\n    return new Defer(observableFactory);\n  };\n\n  var EmptyObservable = (function(__super__) {\n    inherits(EmptyObservable, __super__);\n    function EmptyObservable(scheduler) {\n      this.scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    EmptyObservable.prototype.subscribeCore = function (observer) {\n      var sink = new EmptySink(observer, this.scheduler);\n      return sink.run();\n    };\n\n    function EmptySink(observer, scheduler) {\n      this.observer = observer;\n      this.scheduler = scheduler;\n    }\n\n    function scheduleItem(s, state) {\n      state.onCompleted();\n      return disposableEmpty;\n    }\n\n    EmptySink.prototype.run = function () {\n      var state = this.observer;\n      return this.scheduler === immediateScheduler ?\n        scheduleItem(null, state) :\n        this.scheduler.schedule(state, scheduleItem);\n    };\n\n    return EmptyObservable;\n  }(ObservableBase));\n\n  var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler);\n\n  /**\n   *  Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.\n   *\n   * @example\n   *  var res = Rx.Observable.empty();\n   *  var res = Rx.Observable.empty(Rx.Scheduler.timeout);\n   * @param {Scheduler} [scheduler] Scheduler to send the termination call on.\n   * @returns {Observable} An observable sequence with no elements.\n   */\n  var observableEmpty = Observable.empty = function (scheduler) {\n    isScheduler(scheduler) || (scheduler = immediateScheduler);\n    return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler);\n  };\n\n  var FromObservable = (function(__super__) {\n    inherits(FromObservable, __super__);\n    function FromObservable(iterable, fn, scheduler) {\n      this._iterable = iterable;\n      this._fn = fn;\n      this._scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    function createScheduleMethod(o, it, fn) {\n      return function loopRecursive(i, recurse) {\n        var next = tryCatch(it.next).call(it);\n        if (next === errorObj) { return o.onError(next.e); }\n        if (next.done) { return o.onCompleted(); }\n\n        var result = next.value;\n\n        if (isFunction(fn)) {\n          result = tryCatch(fn)(result, i);\n          if (result === errorObj) { return o.onError(result.e); }\n        }\n\n        o.onNext(result);\n        recurse(i + 1);\n      };\n    }\n\n    FromObservable.prototype.subscribeCore = function (o) {\n      var list = Object(this._iterable),\n          it = getIterable(list);\n\n      return this._scheduler.scheduleRecursive(0, createScheduleMethod(o, it, this._fn));\n    };\n\n    return FromObservable;\n  }(ObservableBase));\n\n  var maxSafeInteger = Math.pow(2, 53) - 1;\n\n  function StringIterable(s) {\n    this._s = s;\n  }\n\n  StringIterable.prototype[$iterator$] = function () {\n    return new StringIterator(this._s);\n  };\n\n  function StringIterator(s) {\n    this._s = s;\n    this._l = s.length;\n    this._i = 0;\n  }\n\n  StringIterator.prototype[$iterator$] = function () {\n    return this;\n  };\n\n  StringIterator.prototype.next = function () {\n    return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;\n  };\n\n  function ArrayIterable(a) {\n    this._a = a;\n  }\n\n  ArrayIterable.prototype[$iterator$] = function () {\n    return new ArrayIterator(this._a);\n  };\n\n  function ArrayIterator(a) {\n    this._a = a;\n    this._l = toLength(a);\n    this._i = 0;\n  }\n\n  ArrayIterator.prototype[$iterator$] = function () {\n    return this;\n  };\n\n  ArrayIterator.prototype.next = function () {\n    return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;\n  };\n\n  function numberIsFinite(value) {\n    return typeof value === 'number' && root.isFinite(value);\n  }\n\n  function isNan(n) {\n    return n !== n;\n  }\n\n  function getIterable(o) {\n    var i = o[$iterator$], it;\n    if (!i && typeof o === 'string') {\n      it = new StringIterable(o);\n      return it[$iterator$]();\n    }\n    if (!i && o.length !== undefined) {\n      it = new ArrayIterable(o);\n      return it[$iterator$]();\n    }\n    if (!i) { throw new TypeError('Object is not iterable'); }\n    return o[$iterator$]();\n  }\n\n  function sign(value) {\n    var number = +value;\n    if (number === 0) { return number; }\n    if (isNaN(number)) { return number; }\n    return number < 0 ? -1 : 1;\n  }\n\n  function toLength(o) {\n    var len = +o.length;\n    if (isNaN(len)) { return 0; }\n    if (len === 0 || !numberIsFinite(len)) { return len; }\n    len = sign(len) * Math.floor(Math.abs(len));\n    if (len <= 0) { return 0; }\n    if (len > maxSafeInteger) { return maxSafeInteger; }\n    return len;\n  }\n\n  /**\n  * This method creates a new Observable sequence from an array-like or iterable object.\n  * @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.\n  * @param {Function} [mapFn] Map function to call on every element of the array.\n  * @param {Any} [thisArg] The context to use calling the mapFn if provided.\n  * @param {Scheduler} [scheduler] Optional scheduler to use for scheduling.  If not provided, defaults to Scheduler.currentThread.\n  */\n  var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {\n    if (iterable == null) {\n      throw new Error('iterable cannot be null.')\n    }\n    if (mapFn && !isFunction(mapFn)) {\n      throw new Error('mapFn when provided must be a function');\n    }\n    if (mapFn) {\n      var mapper = bindCallback(mapFn, thisArg, 2);\n    }\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\n    return new FromObservable(iterable, mapper, scheduler);\n  }\n\n  var FromArrayObservable = (function(__super__) {\n    inherits(FromArrayObservable, __super__);\n    function FromArrayObservable(args, scheduler) {\n      this._args = args;\n      this._scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(o, args) {\n      var len = args.length;\n      return function loopRecursive (i, recurse) {\n        if (i < len) {\n          o.onNext(args[i]);\n          recurse(i + 1);\n        } else {\n          o.onCompleted();\n        }\n      };\n    }\n\n    FromArrayObservable.prototype.subscribeCore = function (o) {\n      return this._scheduler.scheduleRecursive(0, scheduleMethod(o, this._args));\n    };\n\n    return FromArrayObservable;\n  }(ObservableBase));\n\n  /**\n  *  Converts an array to an observable sequence, using an optional scheduler to enumerate the array.\n  * @deprecated use Observable.from or Observable.of\n  * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.\n  * @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.\n  */\n  var observableFromArray = Observable.fromArray = function (array, scheduler) {\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\n    return new FromArrayObservable(array, scheduler)\n  };\n\n  var GenerateObservable = (function (__super__) {\n    inherits(GenerateObservable, __super__);\n    function GenerateObservable(state, cndFn, itrFn, resFn, s) {\n      this._state = state;\n      this._cndFn = cndFn;\n      this._itrFn = itrFn;\n      this._resFn = resFn;\n      this._s = s;\n      this._first = true;\n      __super__.call(this);\n    }\n\n    function scheduleRecursive(self, recurse) {\n      if (self._first) {\n        self._first = false;\n      } else {\n        self._state = tryCatch(self._itrFn)(self._state);\n        if (self._state === errorObj) { return self._o.onError(self._state.e); }\n      }\n      var hasResult = tryCatch(self._cndFn)(self._state);\n      if (hasResult === errorObj) { return self._o.onError(hasResult.e); }\n      if (hasResult) {\n        var result = tryCatch(self._resFn)(self._state);\n        if (result === errorObj) { return self._o.onError(result.e); }\n        self._o.onNext(result);\n        recurse(self);\n      } else {\n        self._o.onCompleted();\n      }\n    }\n\n    GenerateObservable.prototype.subscribeCore = function (o) {\n      this._o = o;\n      return this._s.scheduleRecursive(this, scheduleRecursive);\n    };\n\n    return GenerateObservable;\n  }(ObservableBase));\n\n  /**\n   *  Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.\n   *\n   * @example\n   *  var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });\n   *  var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);\n   * @param {Mixed} initialState Initial state.\n   * @param {Function} condition Condition to terminate generation (upon returning false).\n   * @param {Function} iterate Iteration step function.\n   * @param {Function} resultSelector Selector function for results produced in the sequence.\n   * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.\n   * @returns {Observable} The generated sequence.\n   */\n  Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\n    return new GenerateObservable(initialState, condition, iterate, resultSelector, scheduler);\n  };\n\n  function observableOf (scheduler, array) {\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\n    return new FromArrayObservable(array, scheduler);\n  }\n\n  /**\n  *  This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.\n  * @returns {Observable} The observable sequence whose elements are pulled from the given arguments.\n  */\n  Observable.of = function () {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    return new FromArrayObservable(args, currentThreadScheduler);\n  };\n\n  /**\n  *  This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.\n  * @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.\n  * @returns {Observable} The observable sequence whose elements are pulled from the given arguments.\n  */\n  Observable.ofWithScheduler = function (scheduler) {\n    var len = arguments.length, args = new Array(len - 1);\n    for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }\n    return new FromArrayObservable(args, scheduler);\n  };\n\n  /**\n   * Creates an Observable sequence from changes to an array using Array.observe.\n   * @param {Array} array An array to observe changes.\n   * @returns {Observable} An observable sequence containing changes to an array from Array.observe.\n   */\n  Observable.ofArrayChanges = function(array) {\n    if (!Array.isArray(array)) { throw new TypeError('Array.observe only accepts arrays.'); }\n    if (typeof Array.observe !== 'function' && typeof Array.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') }\n    return new AnonymousObservable(function(observer) {\n      function observerFn(changes) {\n        for(var i = 0, len = changes.length; i < len; i++) {\n          observer.onNext(changes[i]);\n        }\n      }\n      \n      Array.observe(array, observerFn);\n\n      return function () {\n        Array.unobserve(array, observerFn);\n      };\n    });\n  };\n\n  /**\n   * Creates an Observable sequence from changes to an object using Object.observe.\n   * @param {Object} obj An object to observe changes.\n   * @returns {Observable} An observable sequence containing changes to an object from Object.observe.\n   */\n  Observable.ofObjectChanges = function(obj) {\n    if (obj == null) { throw new TypeError('object must not be null or undefined.'); }\n    if (typeof Object.observe !== 'function' && typeof Object.unobserve !== 'function') { throw new TypeError('Object.observe is not supported on your platform') }\n    return new AnonymousObservable(function(observer) {\n      function observerFn(changes) {\n        for(var i = 0, len = changes.length; i < len; i++) {\n          observer.onNext(changes[i]);\n        }\n      }\n\n      Object.observe(obj, observerFn);\n\n      return function () {\n        Object.unobserve(obj, observerFn);\n      };\n    });\n  };\n\n  var NeverObservable = (function(__super__) {\n    inherits(NeverObservable, __super__);\n    function NeverObservable() {\n      __super__.call(this);\n    }\n\n    NeverObservable.prototype.subscribeCore = function (observer) {\n      return disposableEmpty;\n    };\n\n    return NeverObservable;\n  }(ObservableBase));\n\n  var NEVER_OBSERVABLE = new NeverObservable();\n\n  /**\n   * Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).\n   * @returns {Observable} An observable sequence whose observers will never get called.\n   */\n  var observableNever = Observable.never = function () {\n    return NEVER_OBSERVABLE;\n  };\n\n  var PairsObservable = (function(__super__) {\n    inherits(PairsObservable, __super__);\n    function PairsObservable(o, scheduler) {\n      this._o = o;\n      this._keys = Object.keys(o);\n      this._scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(o, obj, keys) {\n      return function loopRecursive(i, recurse) {\n        if (i < keys.length) {\n          var key = keys[i];\n          o.onNext([key, obj[key]]);\n          recurse(i + 1);\n        } else {\n          o.onCompleted();\n        }\n      };\n    }\n\n    PairsObservable.prototype.subscribeCore = function (o) {\n      return this._scheduler.scheduleRecursive(0, scheduleMethod(o, this._o, this._keys));\n    };\n\n    return PairsObservable;\n  }(ObservableBase));\n\n  /**\n   * Convert an object into an observable sequence of [key, value] pairs.\n   * @param {Object} obj The object to inspect.\n   * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.\n   * @returns {Observable} An observable sequence of [key, value] pairs from the object.\n   */\n  Observable.pairs = function (obj, scheduler) {\n    scheduler || (scheduler = currentThreadScheduler);\n    return new PairsObservable(obj, scheduler);\n  };\n\n    var RangeObservable = (function(__super__) {\n    inherits(RangeObservable, __super__);\n    function RangeObservable(start, count, scheduler) {\n      this.start = start;\n      this.rangeCount = count;\n      this.scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    function loopRecursive(start, count, o) {\n      return function loop (i, recurse) {\n        if (i < count) {\n          o.onNext(start + i);\n          recurse(i + 1);\n        } else {\n          o.onCompleted();\n        }\n      };\n    }\n\n    RangeObservable.prototype.subscribeCore = function (o) {\n      return this.scheduler.scheduleRecursive(\n        0,\n        loopRecursive(this.start, this.rangeCount, o)\n      );\n    };\n\n    return RangeObservable;\n  }(ObservableBase));\n\n  /**\n  *  Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.\n  * @param {Number} start The value of the first integer in the sequence.\n  * @param {Number} count The number of sequential integers to generate.\n  * @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.\n  * @returns {Observable} An observable sequence that contains a range of sequential integral numbers.\n  */\n  Observable.range = function (start, count, scheduler) {\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\n    return new RangeObservable(start, count, scheduler);\n  };\n\n  var RepeatObservable = (function(__super__) {\n    inherits(RepeatObservable, __super__);\n    function RepeatObservable(value, repeatCount, scheduler) {\n      this.value = value;\n      this.repeatCount = repeatCount == null ? -1 : repeatCount;\n      this.scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    RepeatObservable.prototype.subscribeCore = function (observer) {\n      var sink = new RepeatSink(observer, this);\n      return sink.run();\n    };\n\n    return RepeatObservable;\n  }(ObservableBase));\n\n  function RepeatSink(observer, parent) {\n    this.observer = observer;\n    this.parent = parent;\n  }\n\n  RepeatSink.prototype.run = function () {\n    var observer = this.observer, value = this.parent.value;\n    function loopRecursive(i, recurse) {\n      if (i === -1 || i > 0) {\n        observer.onNext(value);\n        i > 0 && i--;\n      }\n      if (i === 0) { return observer.onCompleted(); }\n      recurse(i);\n    }\n\n    return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount, loopRecursive);\n  };\n\n  /**\n   *  Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.\n   * @param {Mixed} value Element to repeat.\n   * @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.\n   * @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.\n   * @returns {Observable} An observable sequence that repeats the given element the specified number of times.\n   */\n  Observable.repeat = function (value, repeatCount, scheduler) {\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\n    return new RepeatObservable(value, repeatCount, scheduler);\n  };\n\n  var JustObservable = (function(__super__) {\n    inherits(JustObservable, __super__);\n    function JustObservable(value, scheduler) {\n      this._value = value;\n      this._scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    JustObservable.prototype.subscribeCore = function (o) {\n      var state = [this._value, o];\n      return this._scheduler === immediateScheduler ?\n        scheduleItem(null, state) :\n        this._scheduler.schedule(state, scheduleItem);\n    };\n\n    function scheduleItem(s, state) {\n      var value = state[0], observer = state[1];\n      observer.onNext(value);\n      observer.onCompleted();\n      return disposableEmpty;\n    }\n\n    return JustObservable;\n  }(ObservableBase));\n\n  /**\n   *  Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.\n   *  There is an alias called 'just' or browsers <IE9.\n   * @param {Mixed} value Single element in the resulting observable sequence.\n   * @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.\n   * @returns {Observable} An observable sequence containing the single specified element.\n   */\n  var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {\n    isScheduler(scheduler) || (scheduler = immediateScheduler);\n    return new JustObservable(value, scheduler);\n  };\n\n  var ThrowObservable = (function(__super__) {\n    inherits(ThrowObservable, __super__);\n    function ThrowObservable(error, scheduler) {\n      this._error = error;\n      this._scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    ThrowObservable.prototype.subscribeCore = function (o) {\n      var state = [this._error, o];\n      return this._scheduler === immediateScheduler ?\n        scheduleItem(null, state) :\n        this._scheduler.schedule(state, scheduleItem);\n    };\n\n    function scheduleItem(s, state) {\n      var e = state[0], o = state[1];\n      o.onError(e);\n      return disposableEmpty;\n    }\n\n    return ThrowObservable;\n  }(ObservableBase));\n\n  /**\n   *  Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.\n   *  There is an alias to this method called 'throwError' for browsers <IE9.\n   * @param {Mixed} error An object used for the sequence's termination.\n   * @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.\n   * @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.\n   */\n  var observableThrow = Observable['throw'] = function (error, scheduler) {\n    isScheduler(scheduler) || (scheduler = immediateScheduler);\n    return new ThrowObservable(error, scheduler);\n  };\n\n  var UsingObservable = (function (__super__) {\n    inherits(UsingObservable, __super__);\n    function UsingObservable(resFn, obsFn) {\n      this._resFn = resFn;\n      this._obsFn = obsFn;\n      __super__.call(this);\n    }\n\n    UsingObservable.prototype.subscribeCore = function (o) {\n      var disposable = disposableEmpty;\n      var resource = tryCatch(this._resFn)();\n      if (resource === errorObj) {\n        return new BinaryDisposable(observableThrow(resource.e).subscribe(o), disposable);\n      }\n      resource && (disposable = resource);\n      var source = tryCatch(this._obsFn)(resource);\n      if (source === errorObj) {\n        return new BinaryDisposable(observableThrow(source.e).subscribe(o), disposable);\n      }\n      return new BinaryDisposable(source.subscribe(o), disposable);\n    };\n\n    return UsingObservable;\n  }(ObservableBase));\n\n  /**\n   * Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.\n   * @param {Function} resourceFactory Factory function to obtain a resource object.\n   * @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.\n   * @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.\n   */\n  Observable.using = function (resourceFactory, observableFactory) {\n    return new UsingObservable(resourceFactory, observableFactory);\n  };\n\n  /**\n   * Propagates the observable sequence or Promise that reacts first.\n   * @param {Observable} rightSource Second observable sequence or Promise.\n   * @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.\n   */\n  observableProto.amb = function (rightSource) {\n    var leftSource = this;\n    return new AnonymousObservable(function (observer) {\n      var choice,\n        leftChoice = 'L', rightChoice = 'R',\n        leftSubscription = new SingleAssignmentDisposable(),\n        rightSubscription = new SingleAssignmentDisposable();\n\n      isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));\n\n      function choiceL() {\n        if (!choice) {\n          choice = leftChoice;\n          rightSubscription.dispose();\n        }\n      }\n\n      function choiceR() {\n        if (!choice) {\n          choice = rightChoice;\n          leftSubscription.dispose();\n        }\n      }\n\n      var leftSubscribe = observerCreate(\n        function (left) {\n          choiceL();\n          choice === leftChoice && observer.onNext(left);\n        },\n        function (e) {\n          choiceL();\n          choice === leftChoice && observer.onError(e);\n        },\n        function () {\n          choiceL();\n          choice === leftChoice && observer.onCompleted();\n        }\n      );\n      var rightSubscribe = observerCreate(\n        function (right) {\n          choiceR();\n          choice === rightChoice && observer.onNext(right);\n        },\n        function (e) {\n          choiceR();\n          choice === rightChoice && observer.onError(e);\n        },\n        function () {\n          choiceR();\n          choice === rightChoice && observer.onCompleted();\n        }\n      );\n\n      leftSubscription.setDisposable(leftSource.subscribe(leftSubscribe));\n      rightSubscription.setDisposable(rightSource.subscribe(rightSubscribe));\n\n      return new BinaryDisposable(leftSubscription, rightSubscription);\n    });\n  };\n\n  function amb(p, c) { return p.amb(c); }\n\n  /**\n   * Propagates the observable sequence or Promise that reacts first.\n   * @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.\n   */\n  Observable.amb = function () {\n    var acc = observableNever(), items;\n    if (Array.isArray(arguments[0])) {\n      items = arguments[0];\n    } else {\n      var len = arguments.length;\n      items = new Array(items);\n      for(var i = 0; i < len; i++) { items[i] = arguments[i]; }\n    }\n    for (var i = 0, len = items.length; i < len; i++) {\n      acc = amb(acc, items[i]);\n    }\n    return acc;\n  };\n\n  var CatchObservable = (function (__super__) {\n    inherits(CatchObservable, __super__);\n    function CatchObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    CatchObservable.prototype.subscribeCore = function (o) {\n      var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();\n      subscription.setDisposable(d1);\n      d1.setDisposable(this.source.subscribe(new CatchObserver(o, subscription, this._fn)));\n      return subscription;\n    };\n\n    return CatchObservable;\n  }(ObservableBase));\n\n  var CatchObserver = (function(__super__) {\n    inherits(CatchObserver, __super__);\n    function CatchObserver(o, s, fn) {\n      this._o = o;\n      this._s = s;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    CatchObserver.prototype.next = function (x) { this._o.onNext(x); };\n    CatchObserver.prototype.completed = function () { return this._o.onCompleted(); };\n    CatchObserver.prototype.error = function (e) {\n      var result = tryCatch(this._fn)(e);\n      if (result === errorObj) { return this._o.onError(result.e); }\n      isPromise(result) && (result = observableFromPromise(result));\n\n      var d = new SingleAssignmentDisposable();\n      this._s.setDisposable(d);\n      d.setDisposable(result.subscribe(this._o));\n    };\n\n    return CatchObserver;\n  }(AbstractObserver));\n\n  /**\n   * Continues an observable sequence that is terminated by an exception with the next observable sequence.\n   * @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.\n   * @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.\n   */\n  observableProto['catch'] = function (handlerOrSecond) {\n    return isFunction(handlerOrSecond) ? new CatchObservable(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]);\n  };\n\n  /**\n   * Continues an observable sequence that is terminated by an exception with the next observable sequence.\n   * @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.\n   * @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.\n   */\n  var observableCatch = Observable['catch'] = function () {\n    var items;\n    if (Array.isArray(arguments[0])) {\n      items = arguments[0];\n    } else {\n      var len = arguments.length;\n      items = new Array(len);\n      for(var i = 0; i < len; i++) { items[i] = arguments[i]; }\n    }\n    return enumerableOf(items).catchError();\n  };\n\n  /**\n   * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.\n   * This can be in the form of an argument list of observables or an array.\n   *\n   * @example\n   * 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });\n   * 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });\n   * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n   */\n  observableProto.combineLatest = function () {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    if (Array.isArray(args[0])) {\n      args[0].unshift(this);\n    } else {\n      args.unshift(this);\n    }\n    return combineLatest.apply(this, args);\n  };\n\n  function falseFactory() { return false; }\n  function argumentsToArray() {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    return args;\n  }\n\n  var CombineLatestObservable = (function(__super__) {\n    inherits(CombineLatestObservable, __super__);\n    function CombineLatestObservable(params, cb) {\n      this._params = params;\n      this._cb = cb;\n      __super__.call(this);\n    }\n\n    CombineLatestObservable.prototype.subscribeCore = function(observer) {\n      var len = this._params.length,\n          subscriptions = new Array(len);\n\n      var state = {\n        hasValue: arrayInitialize(len, falseFactory),\n        hasValueAll: false,\n        isDone: arrayInitialize(len, falseFactory),\n        values: new Array(len)\n      };\n\n      for (var i = 0; i < len; i++) {\n        var source = this._params[i], sad = new SingleAssignmentDisposable();\n        subscriptions[i] = sad;\n        isPromise(source) && (source = observableFromPromise(source));\n        sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this._cb, state)));\n      }\n\n      return new NAryDisposable(subscriptions);\n    };\n\n    return CombineLatestObservable;\n  }(ObservableBase));\n\n  var CombineLatestObserver = (function (__super__) {\n    inherits(CombineLatestObserver, __super__);\n    function CombineLatestObserver(o, i, cb, state) {\n      this._o = o;\n      this._i = i;\n      this._cb = cb;\n      this._state = state;\n      __super__.call(this);\n    }\n\n    function notTheSame(i) {\n      return function (x, j) {\n        return j !== i;\n      };\n    }\n\n    CombineLatestObserver.prototype.next = function (x) {\n      this._state.values[this._i] = x;\n      this._state.hasValue[this._i] = true;\n      if (this._state.hasValueAll || (this._state.hasValueAll = this._state.hasValue.every(identity))) {\n        var res = tryCatch(this._cb).apply(null, this._state.values);\n        if (res === errorObj) { return this._o.onError(res.e); }\n        this._o.onNext(res);\n      } else if (this._state.isDone.filter(notTheSame(this._i)).every(identity)) {\n        this._o.onCompleted();\n      }\n    };\n\n    CombineLatestObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    CombineLatestObserver.prototype.completed = function () {\n      this._state.isDone[this._i] = true;\n      this._state.isDone.every(identity) && this._o.onCompleted();\n    };\n\n    return CombineLatestObserver;\n  }(AbstractObserver));\n\n  /**\n  * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.\n  *\n  * @example\n  * 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });\n  * 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });\n  * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n  */\n  var combineLatest = Observable.combineLatest = function () {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\n    Array.isArray(args[0]) && (args = args[0]);\n    return new CombineLatestObservable(args, resultSelector);\n  };\n\n  /**\n   * Concatenates all the observable sequences.  This takes in either an array or variable arguments to concatenate.\n   * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.\n   */\n  observableProto.concat = function () {\n    for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\n    args.unshift(this);\n    return observableConcat.apply(null, args);\n  };\n\n  var ConcatObserver = (function(__super__) {\n    inherits(ConcatObserver, __super__);\n    function ConcatObserver(s, fn) {\n      this._s = s;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    ConcatObserver.prototype.next = function (x) { this._s.o.onNext(x); };\n    ConcatObserver.prototype.error = function (e) { this._s.o.onError(e); };\n    ConcatObserver.prototype.completed = function () { this._s.i++; this._fn(this._s); };\n\n    return ConcatObserver;\n  }(AbstractObserver));\n\n  var ConcatObservable = (function(__super__) {\n    inherits(ConcatObservable, __super__);\n    function ConcatObservable(sources) {\n      this._sources = sources;\n      __super__.call(this);\n    }\n\n    function scheduleRecursive (state, recurse) {\n      if (state.disposable.isDisposed) { return; }\n      if (state.i === state.sources.length) { return state.o.onCompleted(); }\n\n      // Check if promise\n      var currentValue = state.sources[state.i];\n      isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\n\n      var d = new SingleAssignmentDisposable();\n      state.subscription.setDisposable(d);\n      d.setDisposable(currentValue.subscribe(new ConcatObserver(state, recurse)));\n    }\n\n    ConcatObservable.prototype.subscribeCore = function(o) {\n      var subscription = new SerialDisposable();\n      var disposable = disposableCreate(noop);\n      var state = {\n        o: o,\n        i: 0,\n        subscription: subscription,\n        disposable: disposable,\n        sources: this._sources\n      };\n\n      var cancelable = immediateScheduler.scheduleRecursive(state, scheduleRecursive);\n      return new NAryDisposable([subscription, disposable, cancelable]);\n    };\n\n    return ConcatObservable;\n  }(ObservableBase));\n\n  /**\n   * Concatenates all the observable sequences.\n   * @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.\n   * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.\n   */\n  var observableConcat = Observable.concat = function () {\n    var args;\n    if (Array.isArray(arguments[0])) {\n      args = arguments[0];\n    } else {\n      args = new Array(arguments.length);\n      for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }\n    }\n    return new ConcatObservable(args);\n  };\n\n  /**\n   * Concatenates an observable sequence of observable sequences.\n   * @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.\n   */\n  observableProto.concatAll = function () {\n    return this.merge(1);\n  };\n\n  var MergeObservable = (function (__super__) {\n    inherits(MergeObservable, __super__);\n\n    function MergeObservable(source, maxConcurrent) {\n      this.source = source;\n      this.maxConcurrent = maxConcurrent;\n      __super__.call(this);\n    }\n\n    MergeObservable.prototype.subscribeCore = function(observer) {\n      var g = new CompositeDisposable();\n      g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));\n      return g;\n    };\n\n    return MergeObservable;\n\n  }(ObservableBase));\n\n  var MergeObserver = (function (__super__) {\n    function MergeObserver(o, max, g) {\n      this.o = o;\n      this.max = max;\n      this.g = g;\n      this.done = false;\n      this.q = [];\n      this.activeCount = 0;\n      __super__.call(this);\n    }\n\n    inherits(MergeObserver, __super__);\n\n    MergeObserver.prototype.handleSubscribe = function (xs) {\n      var sad = new SingleAssignmentDisposable();\n      this.g.add(sad);\n      isPromise(xs) && (xs = observableFromPromise(xs));\n      sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));\n    };\n\n    MergeObserver.prototype.next = function (innerSource) {\n      if(this.activeCount < this.max) {\n        this.activeCount++;\n        this.handleSubscribe(innerSource);\n      } else {\n        this.q.push(innerSource);\n      }\n    };\n    MergeObserver.prototype.error = function (e) { this.o.onError(e); };\n    MergeObserver.prototype.completed = function () { this.done = true; this.activeCount === 0 && this.o.onCompleted(); };\n\n    function InnerObserver(parent, sad) {\n      this.parent = parent;\n      this.sad = sad;\n      __super__.call(this);\n    }\n\n    inherits(InnerObserver, __super__);\n\n    InnerObserver.prototype.next = function (x) { this.parent.o.onNext(x); };\n    InnerObserver.prototype.error = function (e) { this.parent.o.onError(e); };\n    InnerObserver.prototype.completed = function () {\n      this.parent.g.remove(this.sad);\n      if (this.parent.q.length > 0) {\n        this.parent.handleSubscribe(this.parent.q.shift());\n      } else {\n        this.parent.activeCount--;\n        this.parent.done && this.parent.activeCount === 0 && this.parent.o.onCompleted();\n      }\n    };\n\n    return MergeObserver;\n  }(AbstractObserver));\n\n  /**\n  * Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.\n  * Or merges two observable sequences into a single observable sequence.\n  * @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.\n  * @returns {Observable} The observable sequence that merges the elements of the inner sequences.\n  */\n  observableProto.merge = function (maxConcurrentOrOther) {\n    return typeof maxConcurrentOrOther !== 'number' ?\n      observableMerge(this, maxConcurrentOrOther) :\n      new MergeObservable(this, maxConcurrentOrOther);\n  };\n\n  /**\n   * Merges all the observable sequences into a single observable sequence.\n   * The scheduler is optional and if not specified, the immediate scheduler is used.\n   * @returns {Observable} The observable sequence that merges the elements of the observable sequences.\n   */\n  var observableMerge = Observable.merge = function () {\n    var scheduler, sources = [], i, len = arguments.length;\n    if (!arguments[0]) {\n      scheduler = immediateScheduler;\n      for(i = 1; i < len; i++) { sources.push(arguments[i]); }\n    } else if (isScheduler(arguments[0])) {\n      scheduler = arguments[0];\n      for(i = 1; i < len; i++) { sources.push(arguments[i]); }\n    } else {\n      scheduler = immediateScheduler;\n      for(i = 0; i < len; i++) { sources.push(arguments[i]); }\n    }\n    if (Array.isArray(sources[0])) {\n      sources = sources[0];\n    }\n    return observableOf(scheduler, sources).mergeAll();\n  };\n\n  var MergeAllObservable = (function (__super__) {\n    inherits(MergeAllObservable, __super__);\n\n    function MergeAllObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    MergeAllObservable.prototype.subscribeCore = function (o) {\n      var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();\n      g.add(m);\n      m.setDisposable(this.source.subscribe(new MergeAllObserver(o, g)));\n      return g;\n    };\n\n    return MergeAllObservable;\n  }(ObservableBase));\n\n  var MergeAllObserver = (function (__super__) {\n    function MergeAllObserver(o, g) {\n      this.o = o;\n      this.g = g;\n      this.done = false;\n      __super__.call(this);\n    }\n\n    inherits(MergeAllObserver, __super__);\n\n    MergeAllObserver.prototype.next = function(innerSource) {\n      var sad = new SingleAssignmentDisposable();\n      this.g.add(sad);\n      isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));\n      sad.setDisposable(innerSource.subscribe(new InnerObserver(this, sad)));\n    };\n\n    MergeAllObserver.prototype.error = function (e) {\n      this.o.onError(e);\n    };\n\n    MergeAllObserver.prototype.completed = function () {\n      this.done = true;\n      this.g.length === 1 && this.o.onCompleted();\n    };\n\n    function InnerObserver(parent, sad) {\n      this.parent = parent;\n      this.sad = sad;\n      __super__.call(this);\n    }\n\n    inherits(InnerObserver, __super__);\n\n    InnerObserver.prototype.next = function (x) {\n      this.parent.o.onNext(x);\n    };\n    InnerObserver.prototype.error = function (e) {\n      this.parent.o.onError(e);\n    };\n    InnerObserver.prototype.completed = function () {\n      this.parent.g.remove(this.sad);\n      this.parent.done && this.parent.g.length === 1 && this.parent.o.onCompleted();\n    };\n\n    return MergeAllObserver;\n  }(AbstractObserver));\n\n  /**\n  * Merges an observable sequence of observable sequences into an observable sequence.\n  * @returns {Observable} The observable sequence that merges the elements of the inner sequences.\n  */\n  observableProto.mergeAll = function () {\n    return new MergeAllObservable(this);\n  };\n\n  var CompositeError = Rx.CompositeError = function(errors) {\n    this.innerErrors = errors;\n    this.message = 'This contains multiple errors. Check the innerErrors';\n    Error.call(this);\n  };\n  CompositeError.prototype = Object.create(Error.prototype);\n  CompositeError.prototype.name = 'CompositeError';\n\n  var MergeDelayErrorObservable = (function(__super__) {\n    inherits(MergeDelayErrorObservable, __super__);\n    function MergeDelayErrorObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    MergeDelayErrorObservable.prototype.subscribeCore = function (o) {\n      var group = new CompositeDisposable(),\n        m = new SingleAssignmentDisposable(),\n        state = { isStopped: false, errors: [], o: o };\n\n      group.add(m);\n      m.setDisposable(this.source.subscribe(new MergeDelayErrorObserver(group, state)));\n\n      return group;\n    };\n\n    return MergeDelayErrorObservable;\n  }(ObservableBase));\n\n  var MergeDelayErrorObserver = (function(__super__) {\n    inherits(MergeDelayErrorObserver, __super__);\n    function MergeDelayErrorObserver(group, state) {\n      this._group = group;\n      this._state = state;\n      __super__.call(this);\n    }\n\n    function setCompletion(o, errors) {\n      if (errors.length === 0) {\n        o.onCompleted();\n      } else if (errors.length === 1) {\n        o.onError(errors[0]);\n      } else {\n        o.onError(new CompositeError(errors));\n      }\n    }\n\n    MergeDelayErrorObserver.prototype.next = function (x) {\n      var inner = new SingleAssignmentDisposable();\n      this._group.add(inner);\n\n      // Check for promises support\n      isPromise(x) && (x = observableFromPromise(x));\n      inner.setDisposable(x.subscribe(new InnerObserver(inner, this._group, this._state)));\n    };\n\n    MergeDelayErrorObserver.prototype.error = function (e) {\n      this._state.errors.push(e);\n      this._state.isStopped = true;\n      this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\n    };\n\n    MergeDelayErrorObserver.prototype.completed = function () {\n      this._state.isStopped = true;\n      this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\n    };\n\n    inherits(InnerObserver, __super__);\n    function InnerObserver(inner, group, state) {\n      this._inner = inner;\n      this._group = group;\n      this._state = state;\n      __super__.call(this);\n    }\n\n    InnerObserver.prototype.next = function (x) { this._state.o.onNext(x); };\n    InnerObserver.prototype.error = function (e) {\n      this._state.errors.push(e);\n      this._group.remove(this._inner);\n      this._state.isStopped && this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\n    };\n    InnerObserver.prototype.completed = function () {\n      this._group.remove(this._inner);\n      this._state.isStopped && this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\n    };\n\n    return MergeDelayErrorObserver;\n  }(AbstractObserver));\n\n  /**\n  * Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to\n  * receive all successfully emitted items from all of the source Observables without being interrupted by\n  * an error notification from one of them.\n  *\n  * This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an\n  * error via the Observer's onError, mergeDelayError will refrain from propagating that\n  * error notification until all of the merged Observables have finished emitting items.\n  * @param {Array | Arguments} args Arguments or an array to merge.\n  * @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable\n  */\n  Observable.mergeDelayError = function() {\n    var args;\n    if (Array.isArray(arguments[0])) {\n      args = arguments[0];\n    } else {\n      var len = arguments.length;\n      args = new Array(len);\n      for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    }\n    var source = observableOf(null, args);\n    return new MergeDelayErrorObservable(source);\n  };\n\n  /**\n   * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.\n   * @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.\n   * @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.\n   */\n  observableProto.onErrorResumeNext = function (second) {\n    if (!second) { throw new Error('Second observable is required'); }\n    return onErrorResumeNext([this, second]);\n  };\n\n  var OnErrorResumeNextObservable = (function(__super__) {\n    inherits(OnErrorResumeNextObservable, __super__);\n    function OnErrorResumeNextObservable(sources) {\n      this.sources = sources;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(state, recurse) {\n      if (state.pos < state.sources.length) {\n        var current = state.sources[state.pos++];\n        isPromise(current) && (current = observableFromPromise(current));\n        var d = new SingleAssignmentDisposable();\n        state.subscription.setDisposable(d);\n        d.setDisposable(current.subscribe(new OnErrorResumeNextObserver(state, recurse)));\n      } else {\n        state.o.onCompleted();\n      }\n    }\n\n    OnErrorResumeNextObservable.prototype.subscribeCore = function (o) {\n      var subscription = new SerialDisposable(),\n          state = {pos: 0, subscription: subscription, o: o, sources: this.sources },\n          cancellable = immediateScheduler.scheduleRecursive(state, scheduleMethod);\n\n      return new BinaryDisposable(subscription, cancellable);\n    };\n\n    return OnErrorResumeNextObservable;\n  }(ObservableBase));\n\n  var OnErrorResumeNextObserver = (function(__super__) {\n    inherits(OnErrorResumeNextObserver, __super__);\n    function OnErrorResumeNextObserver(state, recurse) {\n      this._state = state;\n      this._recurse = recurse;\n      __super__.call(this);\n    }\n\n    OnErrorResumeNextObserver.prototype.next = function (x) { this._state.o.onNext(x); };\n    OnErrorResumeNextObserver.prototype.error = function () { this._recurse(this._state); };\n    OnErrorResumeNextObserver.prototype.completed = function () { this._recurse(this._state); };\n\n    return OnErrorResumeNextObserver;\n  }(AbstractObserver));\n\n  /**\n   * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.\n   * @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.\n   */\n  var onErrorResumeNext = Observable.onErrorResumeNext = function () {\n    var sources = [];\n    if (Array.isArray(arguments[0])) {\n      sources = arguments[0];\n    } else {\n      var len = arguments.length;\n      sources = new Array(len);\n      for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }\n    }\n    return new OnErrorResumeNextObservable(sources);\n  };\n\n  var SkipUntilObservable = (function(__super__) {\n    inherits(SkipUntilObservable, __super__);\n\n    function SkipUntilObservable(source, other) {\n      this._s = source;\n      this._o = isPromise(other) ? observableFromPromise(other) : other;\n      this._open = false;\n      __super__.call(this);\n    }\n\n    SkipUntilObservable.prototype.subscribeCore = function(o) {\n      var leftSubscription = new SingleAssignmentDisposable();\n      leftSubscription.setDisposable(this._s.subscribe(new SkipUntilSourceObserver(o, this)));\n\n      isPromise(this._o) && (this._o = observableFromPromise(this._o));\n\n      var rightSubscription = new SingleAssignmentDisposable();\n      rightSubscription.setDisposable(this._o.subscribe(new SkipUntilOtherObserver(o, this, rightSubscription)));\n\n      return new BinaryDisposable(leftSubscription, rightSubscription);\n    };\n\n    return SkipUntilObservable;\n  }(ObservableBase));\n\n  var SkipUntilSourceObserver = (function(__super__) {\n    inherits(SkipUntilSourceObserver, __super__);\n    function SkipUntilSourceObserver(o, p) {\n      this._o = o;\n      this._p = p;\n      __super__.call(this);\n    }\n\n    SkipUntilSourceObserver.prototype.next = function (x) {\n      this._p._open && this._o.onNext(x);\n    };\n\n    SkipUntilSourceObserver.prototype.error = function (err) {\n      this._o.onError(err);\n    };\n\n    SkipUntilSourceObserver.prototype.onCompleted = function () {\n      this._p._open && this._o.onCompleted();\n    };\n\n    return SkipUntilSourceObserver;\n  }(AbstractObserver));\n\n  var SkipUntilOtherObserver = (function(__super__) {\n    inherits(SkipUntilOtherObserver, __super__);\n    function SkipUntilOtherObserver(o, p, r) {\n      this._o = o;\n      this._p = p;\n      this._r = r;\n      __super__.call(this);\n    }\n\n    SkipUntilOtherObserver.prototype.next = function () {\n      this._p._open = true;\n      this._r.dispose();\n    };\n\n    SkipUntilOtherObserver.prototype.error = function (err) {\n      this._o.onError(err);\n    };\n\n    SkipUntilOtherObserver.prototype.onCompleted = function () {\n      this._r.dispose();\n    };\n\n    return SkipUntilOtherObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns the values from the source observable sequence only after the other observable sequence produces a value.\n   * @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.\n   * @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.\n   */\n  observableProto.skipUntil = function (other) {\n    return new SkipUntilObservable(this, other);\n  };\n\n  var SwitchObservable = (function(__super__) {\n    inherits(SwitchObservable, __super__);\n    function SwitchObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    SwitchObservable.prototype.subscribeCore = function (o) {\n      var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner));\n      return new BinaryDisposable(s, inner);\n    };\n\n    inherits(SwitchObserver, AbstractObserver);\n    function SwitchObserver(o, inner) {\n      this.o = o;\n      this.inner = inner;\n      this.stopped = false;\n      this.latest = 0;\n      this.hasLatest = false;\n      AbstractObserver.call(this);\n    }\n\n    SwitchObserver.prototype.next = function (innerSource) {\n      var d = new SingleAssignmentDisposable(), id = ++this.latest;\n      this.hasLatest = true;\n      this.inner.setDisposable(d);\n      isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));\n      d.setDisposable(innerSource.subscribe(new InnerObserver(this, id)));\n    };\n\n    SwitchObserver.prototype.error = function (e) {\n      this.o.onError(e);\n    };\n\n    SwitchObserver.prototype.completed = function () {\n      this.stopped = true;\n      !this.hasLatest && this.o.onCompleted();\n    };\n\n    inherits(InnerObserver, AbstractObserver);\n    function InnerObserver(parent, id) {\n      this.parent = parent;\n      this.id = id;\n      AbstractObserver.call(this);\n    }\n    InnerObserver.prototype.next = function (x) {\n      this.parent.latest === this.id && this.parent.o.onNext(x);\n    };\n\n    InnerObserver.prototype.error = function (e) {\n      this.parent.latest === this.id && this.parent.o.onError(e);\n    };\n\n    InnerObserver.prototype.completed = function () {\n      if (this.parent.latest === this.id) {\n        this.parent.hasLatest = false;\n        this.parent.stopped && this.parent.o.onCompleted();\n      }\n    };\n\n    return SwitchObservable;\n  }(ObservableBase));\n\n  /**\n  * Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.\n  * @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.\n  */\n  observableProto['switch'] = observableProto.switchLatest = function () {\n    return new SwitchObservable(this);\n  };\n\n  var TakeUntilObservable = (function(__super__) {\n    inherits(TakeUntilObservable, __super__);\n\n    function TakeUntilObservable(source, other) {\n      this.source = source;\n      this.other = isPromise(other) ? observableFromPromise(other) : other;\n      __super__.call(this);\n    }\n\n    TakeUntilObservable.prototype.subscribeCore = function(o) {\n      return new BinaryDisposable(\n        this.source.subscribe(o),\n        this.other.subscribe(new TakeUntilObserver(o))\n      );\n    };\n\n    return TakeUntilObservable;\n  }(ObservableBase));\n\n  var TakeUntilObserver = (function(__super__) {\n    inherits(TakeUntilObserver, __super__);\n    function TakeUntilObserver(o) {\n      this._o = o;\n      __super__.call(this);\n    }\n\n    TakeUntilObserver.prototype.next = function () {\n      this._o.onCompleted();\n    };\n\n    TakeUntilObserver.prototype.error = function (err) {\n      this._o.onError(err);\n    };\n\n    TakeUntilObserver.prototype.onCompleted = noop;\n\n    return TakeUntilObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns the values from the source observable sequence until the other observable sequence produces a value.\n   * @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.\n   * @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.\n   */\n  observableProto.takeUntil = function (other) {\n    return new TakeUntilObservable(this, other);\n  };\n\n  function falseFactory() { return false; }\n  function argumentsToArray() {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    return args;\n  }\n\n  var WithLatestFromObservable = (function(__super__) {\n    inherits(WithLatestFromObservable, __super__);\n    function WithLatestFromObservable(source, sources, resultSelector) {\n      this._s = source;\n      this._ss = sources;\n      this._cb = resultSelector;\n      __super__.call(this);\n    }\n\n    WithLatestFromObservable.prototype.subscribeCore = function (o) {\n      var len = this._ss.length;\n      var state = {\n        hasValue: arrayInitialize(len, falseFactory),\n        hasValueAll: false,\n        values: new Array(len)\n      };\n\n      var n = this._ss.length, subscriptions = new Array(n + 1);\n      for (var i = 0; i < n; i++) {\n        var other = this._ss[i], sad = new SingleAssignmentDisposable();\n        isPromise(other) && (other = observableFromPromise(other));\n        sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, state)));\n        subscriptions[i] = sad;\n      }\n\n      var outerSad = new SingleAssignmentDisposable();\n      outerSad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this._cb, state)));\n      subscriptions[n] = outerSad;\n\n      return new NAryDisposable(subscriptions);\n    };\n\n    return WithLatestFromObservable;\n  }(ObservableBase));\n\n  var WithLatestFromOtherObserver = (function (__super__) {\n    inherits(WithLatestFromOtherObserver, __super__);\n    function WithLatestFromOtherObserver(o, i, state) {\n      this._o = o;\n      this._i = i;\n      this._state = state;\n      __super__.call(this);\n    }\n\n    WithLatestFromOtherObserver.prototype.next = function (x) {\n      this._state.values[this._i] = x;\n      this._state.hasValue[this._i] = true;\n      this._state.hasValueAll = this._state.hasValue.every(identity);\n    };\n\n    WithLatestFromOtherObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    WithLatestFromOtherObserver.prototype.completed = noop;\n\n    return WithLatestFromOtherObserver;\n  }(AbstractObserver));\n\n  var WithLatestFromSourceObserver = (function (__super__) {\n    inherits(WithLatestFromSourceObserver, __super__);\n    function WithLatestFromSourceObserver(o, cb, state) {\n      this._o = o;\n      this._cb = cb;\n      this._state = state;\n      __super__.call(this);\n    }\n\n    WithLatestFromSourceObserver.prototype.next = function (x) {\n      var allValues = [x].concat(this._state.values);\n      if (!this._state.hasValueAll) { return; }\n      var res = tryCatch(this._cb).apply(null, allValues);\n      if (res === errorObj) { return this._o.onError(res.e); }\n      this._o.onNext(res);\n    };\n\n    WithLatestFromSourceObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    WithLatestFromSourceObserver.prototype.completed = function () {\n      this._o.onCompleted();\n    };\n\n    return WithLatestFromSourceObserver;\n  }(AbstractObserver));\n\n  /**\n   * Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.\n   * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n   */\n  observableProto.withLatestFrom = function () {\n    if (arguments.length === 0) { throw new Error('invalid arguments'); }\n\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\n    Array.isArray(args[0]) && (args = args[0]);\n\n    return new WithLatestFromObservable(this, args, resultSelector);\n  };\n\n  function falseFactory() { return false; }\n  function emptyArrayFactory() { return []; }\n\n  var ZipObservable = (function(__super__) {\n    inherits(ZipObservable, __super__);\n    function ZipObservable(sources, resultSelector) {\n      this._s = sources;\n      this._cb = resultSelector;\n      __super__.call(this);\n    }\n\n    ZipObservable.prototype.subscribeCore = function(observer) {\n      var n = this._s.length,\n          subscriptions = new Array(n),\n          done = arrayInitialize(n, falseFactory),\n          q = arrayInitialize(n, emptyArrayFactory);\n\n      for (var i = 0; i < n; i++) {\n        var source = this._s[i], sad = new SingleAssignmentDisposable();\n        subscriptions[i] = sad;\n        isPromise(source) && (source = observableFromPromise(source));\n        sad.setDisposable(source.subscribe(new ZipObserver(observer, i, this, q, done)));\n      }\n\n      return new NAryDisposable(subscriptions);\n    };\n\n    return ZipObservable;\n  }(ObservableBase));\n\n  var ZipObserver = (function (__super__) {\n    inherits(ZipObserver, __super__);\n    function ZipObserver(o, i, p, q, d) {\n      this._o = o;\n      this._i = i;\n      this._p = p;\n      this._q = q;\n      this._d = d;\n      __super__.call(this);\n    }\n\n    function notEmpty(x) { return x.length > 0; }\n    function shiftEach(x) { return x.shift(); }\n    function notTheSame(i) {\n      return function (x, j) {\n        return j !== i;\n      };\n    }\n\n    ZipObserver.prototype.next = function (x) {\n      this._q[this._i].push(x);\n      if (this._q.every(notEmpty)) {\n        var queuedValues = this._q.map(shiftEach);\n        var res = tryCatch(this._p._cb).apply(null, queuedValues);\n        if (res === errorObj) { return this._o.onError(res.e); }\n        this._o.onNext(res);\n      } else if (this._d.filter(notTheSame(this._i)).every(identity)) {\n        this._o.onCompleted();\n      }\n    };\n\n    ZipObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    ZipObserver.prototype.completed = function () {\n      this._d[this._i] = true;\n      this._d.every(identity) && this._o.onCompleted();\n    };\n\n    return ZipObserver;\n  }(AbstractObserver));\n\n  /**\n   * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.\n   * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.\n   * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.\n   */\n  observableProto.zip = function () {\n    if (arguments.length === 0) { throw new Error('invalid arguments'); }\n\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\n    Array.isArray(args[0]) && (args = args[0]);\n\n    var parent = this;\n    args.unshift(parent);\n\n    return new ZipObservable(args, resultSelector);\n  };\n\n  /**\n   * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n   * @param arguments Observable sources.\n   * @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.\n   * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n   */\n  Observable.zip = function () {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    if (Array.isArray(args[0])) {\n      args = isFunction(args[1]) ? args[0].concat(args[1]) : args[0];\n    }\n    var first = args.shift();\n    return first.zip.apply(first, args);\n  };\n\nfunction falseFactory() { return false; }\nfunction emptyArrayFactory() { return []; }\nfunction argumentsToArray() {\n  var len = arguments.length, args = new Array(len);\n  for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n  return args;\n}\n\nvar ZipIterableObservable = (function(__super__) {\n  inherits(ZipIterableObservable, __super__);\n  function ZipIterableObservable(sources, cb) {\n    this.sources = sources;\n    this._cb = cb;\n    __super__.call(this);\n  }\n\n  ZipIterableObservable.prototype.subscribeCore = function (o) {\n    var sources = this.sources, len = sources.length, subscriptions = new Array(len);\n\n    var state = {\n      q: arrayInitialize(len, emptyArrayFactory),\n      done: arrayInitialize(len, falseFactory),\n      cb: this._cb,\n      o: o\n    };\n\n    for (var i = 0; i < len; i++) {\n      (function (i) {\n        var source = sources[i], sad = new SingleAssignmentDisposable();\n        (isArrayLike(source) || isIterable(source)) && (source = observableFrom(source));\n\n        subscriptions[i] = sad;\n        sad.setDisposable(source.subscribe(new ZipIterableObserver(state, i)));\n      }(i));\n    }\n\n    return new NAryDisposable(subscriptions);\n  };\n\n  return ZipIterableObservable;\n}(ObservableBase));\n\nvar ZipIterableObserver = (function (__super__) {\n  inherits(ZipIterableObserver, __super__);\n  function ZipIterableObserver(s, i) {\n    this._s = s;\n    this._i = i;\n    __super__.call(this);\n  }\n\n  function notEmpty(x) { return x.length > 0; }\n  function shiftEach(x) { return x.shift(); }\n  function notTheSame(i) {\n    return function (x, j) {\n      return j !== i;\n    };\n  }\n\n  ZipIterableObserver.prototype.next = function (x) {\n    this._s.q[this._i].push(x);\n    if (this._s.q.every(notEmpty)) {\n      var queuedValues = this._s.q.map(shiftEach),\n          res = tryCatch(this._s.cb).apply(null, queuedValues);\n      if (res === errorObj) { return this._s.o.onError(res.e); }\n      this._s.o.onNext(res);\n    } else if (this._s.done.filter(notTheSame(this._i)).every(identity)) {\n      this._s.o.onCompleted();\n    }\n  };\n\n  ZipIterableObserver.prototype.error = function (e) { this._s.o.onError(e); };\n\n  ZipIterableObserver.prototype.completed = function () {\n    this._s.done[this._i] = true;\n    this._s.done.every(identity) && this._s.o.onCompleted();\n  };\n\n  return ZipIterableObserver;\n}(AbstractObserver));\n\n/**\n * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.\n * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.\n * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.\n */\nobservableProto.zipIterable = function () {\n  if (arguments.length === 0) { throw new Error('invalid arguments'); }\n\n  var len = arguments.length, args = new Array(len);\n  for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n  var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\n\n  var parent = this;\n  args.unshift(parent);\n  return new ZipIterableObservable(args, resultSelector);\n};\n\n  function asObservable(source) {\n    return function subscribe(o) { return source.subscribe(o); };\n  }\n\n  /**\n   *  Hides the identity of an observable sequence.\n   * @returns {Observable} An observable sequence that hides the identity of the source sequence.\n   */\n  observableProto.asObservable = function () {\n    return new AnonymousObservable(asObservable(this), this);\n  };\n\n  function toArray(x) { return x.toArray(); }\n  function notEmpty(x) { return x.length > 0; }\n\n  /**\n   *  Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.\n   * @param {Number} count Length of each buffer.\n   * @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.\n   * @returns {Observable} An observable sequence of buffers.\n   */\n  observableProto.bufferWithCount = function (count, skip) {\n    typeof skip !== 'number' && (skip = count);\n    return this.windowWithCount(count, skip)\n      .flatMap(toArray)\n      .filter(notEmpty);\n  };\n\n  var DematerializeObservable = (function (__super__) {\n    inherits(DematerializeObservable, __super__);\n    function DematerializeObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    DematerializeObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new DematerializeObserver(o));\n    };\n\n    return DematerializeObservable;\n  }(ObservableBase));\n\n  var DematerializeObserver = (function (__super__) {\n    inherits(DematerializeObserver, __super__);\n\n    function DematerializeObserver(o) {\n      this._o = o;\n      __super__.call(this);\n    }\n\n    DematerializeObserver.prototype.next = function (x) { x.accept(this._o); };\n    DematerializeObserver.prototype.error = function (e) { this._o.onError(e); };\n    DematerializeObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return DematerializeObserver;\n  }(AbstractObserver));\n\n  /**\n   * Dematerializes the explicit notification values of an observable sequence as implicit notifications.\n   * @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.\n   */\n  observableProto.dematerialize = function () {\n    return new DematerializeObservable(this);\n  };\n\n  var DistinctUntilChangedObservable = (function(__super__) {\n    inherits(DistinctUntilChangedObservable, __super__);\n    function DistinctUntilChangedObservable(source, keyFn, comparer) {\n      this.source = source;\n      this.keyFn = keyFn;\n      this.comparer = comparer;\n      __super__.call(this);\n    }\n\n    DistinctUntilChangedObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new DistinctUntilChangedObserver(o, this.keyFn, this.comparer));\n    };\n\n    return DistinctUntilChangedObservable;\n  }(ObservableBase));\n\n  var DistinctUntilChangedObserver = (function(__super__) {\n    inherits(DistinctUntilChangedObserver, __super__);\n    function DistinctUntilChangedObserver(o, keyFn, comparer) {\n      this.o = o;\n      this.keyFn = keyFn;\n      this.comparer = comparer;\n      this.hasCurrentKey = false;\n      this.currentKey = null;\n      __super__.call(this);\n    }\n\n    DistinctUntilChangedObserver.prototype.next = function (x) {\n      var key = x, comparerEquals;\n      if (isFunction(this.keyFn)) {\n        key = tryCatch(this.keyFn)(x);\n        if (key === errorObj) { return this.o.onError(key.e); }\n      }\n      if (this.hasCurrentKey) {\n        comparerEquals = tryCatch(this.comparer)(this.currentKey, key);\n        if (comparerEquals === errorObj) { return this.o.onError(comparerEquals.e); }\n      }\n      if (!this.hasCurrentKey || !comparerEquals) {\n        this.hasCurrentKey = true;\n        this.currentKey = key;\n        this.o.onNext(x);\n      }\n    };\n    DistinctUntilChangedObserver.prototype.error = function(e) {\n      this.o.onError(e);\n    };\n    DistinctUntilChangedObserver.prototype.completed = function () {\n      this.o.onCompleted();\n    };\n\n    return DistinctUntilChangedObserver;\n  }(AbstractObserver));\n\n  /**\n  *  Returns an observable sequence that contains only distinct contiguous elements according to the keyFn and the comparer.\n  * @param {Function} [keyFn] A function to compute the comparison key for each element. If not provided, it projects the value.\n  * @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.\n  * @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.\n  */\n  observableProto.distinctUntilChanged = function (keyFn, comparer) {\n    comparer || (comparer = defaultComparer);\n    return new DistinctUntilChangedObservable(this, keyFn, comparer);\n  };\n\n  var TapObservable = (function(__super__) {\n    inherits(TapObservable,__super__);\n    function TapObservable(source, observerOrOnNext, onError, onCompleted) {\n      this.source = source;\n      this._oN = observerOrOnNext;\n      this._oE = onError;\n      this._oC = onCompleted;\n      __super__.call(this);\n    }\n\n    TapObservable.prototype.subscribeCore = function(o) {\n      return this.source.subscribe(new InnerObserver(o, this));\n    };\n\n    inherits(InnerObserver, AbstractObserver);\n    function InnerObserver(o, p) {\n      this.o = o;\n      this.t = !p._oN || isFunction(p._oN) ?\n        observerCreate(p._oN || noop, p._oE || noop, p._oC || noop) :\n        p._oN;\n      this.isStopped = false;\n      AbstractObserver.call(this);\n    }\n    InnerObserver.prototype.next = function(x) {\n      var res = tryCatch(this.t.onNext).call(this.t, x);\n      if (res === errorObj) { this.o.onError(res.e); }\n      this.o.onNext(x);\n    };\n    InnerObserver.prototype.error = function(err) {\n      var res = tryCatch(this.t.onError).call(this.t, err);\n      if (res === errorObj) { return this.o.onError(res.e); }\n      this.o.onError(err);\n    };\n    InnerObserver.prototype.completed = function() {\n      var res = tryCatch(this.t.onCompleted).call(this.t);\n      if (res === errorObj) { return this.o.onError(res.e); }\n      this.o.onCompleted();\n    };\n\n    return TapObservable;\n  }(ObservableBase));\n\n  /**\n  *  Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\n  * @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.\n  * @param {Function} [onError]  Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.\n  * @param {Function} [onCompleted]  Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\n  */\n  observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {\n    return new TapObservable(this, observerOrOnNext, onError, onCompleted);\n  };\n\n  /**\n  *  Invokes an action for each element in the observable sequence.\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\n  * @param {Function} onNext Action to invoke for each element in the observable sequence.\n  * @param {Any} [thisArg] Object to use as this when executing callback.\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\n  */\n  observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {\n    return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);\n  };\n\n  /**\n  *  Invokes an action upon exceptional termination of the observable sequence.\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\n  * @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.\n  * @param {Any} [thisArg] Object to use as this when executing callback.\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\n  */\n  observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {\n    return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);\n  };\n\n  /**\n  *  Invokes an action upon graceful termination of the observable sequence.\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\n  * @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.\n  * @param {Any} [thisArg] Object to use as this when executing callback.\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\n  */\n  observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {\n    return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);\n  };\n\n  var FinallyObservable = (function (__super__) {\n    inherits(FinallyObservable, __super__);\n    function FinallyObservable(source, fn, thisArg) {\n      this.source = source;\n      this._fn = bindCallback(fn, thisArg, 0);\n      __super__.call(this);\n    }\n\n    FinallyObservable.prototype.subscribeCore = function (o) {\n      var d = tryCatch(this.source.subscribe).call(this.source, o);\n      if (d === errorObj) {\n        this._fn();\n        thrower(d.e);\n      }\n\n      return new FinallyDisposable(d, this._fn);\n    };\n\n    function FinallyDisposable(s, fn) {\n      this.isDisposed = false;\n      this._s = s;\n      this._fn = fn;\n    }\n    FinallyDisposable.prototype.dispose = function () {\n      if (!this.isDisposed) {\n        var res = tryCatch(this._s.dispose).call(this._s);\n        this._fn();\n        res === errorObj && thrower(res.e);\n      }\n    };\n\n    return FinallyObservable;\n\n  }(ObservableBase));\n\n  /**\n   *  Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.\n   * @param {Function} finallyAction Action to invoke after the source observable sequence terminates.\n   * @returns {Observable} Source sequence with the action-invoking termination behavior applied.\n   */\n  observableProto['finally'] = function (action, thisArg) {\n    return new FinallyObservable(this, action, thisArg);\n  };\n\n  var IgnoreElementsObservable = (function(__super__) {\n    inherits(IgnoreElementsObservable, __super__);\n\n    function IgnoreElementsObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    IgnoreElementsObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new InnerObserver(o));\n    };\n\n    function InnerObserver(o) {\n      this.o = o;\n      this.isStopped = false;\n    }\n    InnerObserver.prototype.onNext = noop;\n    InnerObserver.prototype.onError = function (err) {\n      if(!this.isStopped) {\n        this.isStopped = true;\n        this.o.onError(err);\n      }\n    };\n    InnerObserver.prototype.onCompleted = function () {\n      if(!this.isStopped) {\n        this.isStopped = true;\n        this.o.onCompleted();\n      }\n    };\n    InnerObserver.prototype.dispose = function() { this.isStopped = true; };\n    InnerObserver.prototype.fail = function (e) {\n      if (!this.isStopped) {\n        this.isStopped = true;\n        this.observer.onError(e);\n        return true;\n      }\n\n      return false;\n    };\n\n    return IgnoreElementsObservable;\n  }(ObservableBase));\n\n  /**\n   *  Ignores all elements in an observable sequence leaving only the termination messages.\n   * @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.\n   */\n  observableProto.ignoreElements = function () {\n    return new IgnoreElementsObservable(this);\n  };\n\n  var MaterializeObservable = (function (__super__) {\n    inherits(MaterializeObservable, __super__);\n    function MaterializeObservable(source, fn) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    MaterializeObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new MaterializeObserver(o));\n    };\n\n    return MaterializeObservable;\n  }(ObservableBase));\n\n  var MaterializeObserver = (function (__super__) {\n    inherits(MaterializeObserver, __super__);\n\n    function MaterializeObserver(o) {\n      this._o = o;\n      __super__.call(this);\n    }\n\n    MaterializeObserver.prototype.next = function (x) { this._o.onNext(notificationCreateOnNext(x)) };\n    MaterializeObserver.prototype.error = function (e) { this._o.onNext(notificationCreateOnError(e)); this._o.onCompleted(); };\n    MaterializeObserver.prototype.completed = function () { this._o.onNext(notificationCreateOnCompleted()); this._o.onCompleted(); };\n\n    return MaterializeObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Materializes the implicit notifications of an observable sequence as explicit notification values.\n   * @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.\n   */\n  observableProto.materialize = function () {\n    return new MaterializeObservable(this);\n  };\n\n  /**\n   *  Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.\n   * @param {Number} [repeatCount]  Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.\n   * @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.\n   */\n  observableProto.repeat = function (repeatCount) {\n    return enumerableRepeat(this, repeatCount).concat();\n  };\n\n  /**\n   *  Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.\n   *  Note if you encounter an error and want it to retry once, then you must use .retry(2);\n   *\n   * @example\n   *  var res = retried = retry.repeat();\n   *  var res = retried = retry.repeat(2);\n   * @param {Number} [retryCount]  Number of times to retry the sequence. If not provided, retry the sequence indefinitely.\n   * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.\n   */\n  observableProto.retry = function (retryCount) {\n    return enumerableRepeat(this, retryCount).catchError();\n  };\n\n  /**\n   *  Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates. \n   *  if the notifier completes, the observable sequence completes.\n   *\n   * @example\n   *  var timer = Observable.timer(500);\n   *  var source = observable.retryWhen(timer);\n   * @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively.\n   * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.\n   */\n  observableProto.retryWhen = function (notifier) {\n    return enumerableRepeat(this).catchErrorWhen(notifier);\n  };\n  var ScanObservable = (function(__super__) {\n    inherits(ScanObservable, __super__);\n    function ScanObservable(source, accumulator, hasSeed, seed) {\n      this.source = source;\n      this.accumulator = accumulator;\n      this.hasSeed = hasSeed;\n      this.seed = seed;\n      __super__.call(this);\n    }\n\n    ScanObservable.prototype.subscribeCore = function(o) {\n      return this.source.subscribe(new ScanObserver(o,this));\n    };\n\n    return ScanObservable;\n  }(ObservableBase));\n\n  var ScanObserver = (function (__super__) {\n    inherits(ScanObserver, __super__);\n    function ScanObserver(o, parent) {\n      this._o = o;\n      this._p = parent;\n      this._fn = parent.accumulator;\n      this._hs = parent.hasSeed;\n      this._s = parent.seed;\n      this._ha = false;\n      this._a = null;\n      this._hv = false;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    ScanObserver.prototype.next = function (x) {\n      !this._hv && (this._hv = true);\n      if (this._ha) {\n        this._a = tryCatch(this._fn)(this._a, x, this._i, this._p);\n      } else {\n        this._a = this._hs ? tryCatch(this._fn)(this._s, x, this._i, this._p) : x;\n        this._ha = true;\n      }\n      if (this._a === errorObj) { return this._o.onError(this._a.e); }\n      this._o.onNext(this._a);\n      this._i++;\n    };\n\n    ScanObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    ScanObserver.prototype.completed = function () {\n      !this._hv && this._hs && this._o.onNext(this._s);\n      this._o.onCompleted();\n    };\n\n    return ScanObserver;\n  }(AbstractObserver));\n\n  /**\n  *  Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.\n  *  For aggregation behavior with no intermediate results, see Observable.aggregate.\n  * @param {Mixed} [seed] The initial accumulator value.\n  * @param {Function} accumulator An accumulator function to be invoked on each element.\n  * @returns {Observable} An observable sequence containing the accumulated values.\n  */\n  observableProto.scan = function () {\n    var hasSeed = false, seed, accumulator = arguments[0];\n    if (arguments.length === 2) {\n      hasSeed = true;\n      seed = arguments[1];\n    }\n    return new ScanObservable(this, accumulator, hasSeed, seed);\n  };\n\n  var SkipLastObservable = (function (__super__) {\n    inherits(SkipLastObservable, __super__);\n    function SkipLastObservable(source, c) {\n      this.source = source;\n      this._c = c;\n      __super__.call(this);\n    }\n\n    SkipLastObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new SkipLastObserver(o, this._c));\n    };\n\n    return SkipLastObservable;\n  }(ObservableBase));\n\n  var SkipLastObserver = (function (__super__) {\n    inherits(SkipLastObserver, __super__);\n    function SkipLastObserver(o, c) {\n      this._o = o;\n      this._c = c;\n      this._q = [];\n      __super__.call(this);\n    }\n\n    SkipLastObserver.prototype.next = function (x) {\n      this._q.push(x);\n      this._q.length > this._c && this._o.onNext(this._q.shift());\n    };\n\n    SkipLastObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    SkipLastObserver.prototype.completed = function () {\n      this._o.onCompleted();\n    };\n\n    return SkipLastObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Bypasses a specified number of elements at the end of an observable sequence.\n   * @description\n   *  This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are\n   *  received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.\n   * @param count Number of elements to bypass at the end of the source sequence.\n   * @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.\n   */\n  observableProto.skipLast = function (count) {\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\n    return new SkipLastObservable(this, count);\n  };\n\n  /**\n   *  Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.\n   *  @example\n   *  var res = source.startWith(1, 2, 3);\n   *  var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);\n   * @param {Arguments} args The specified values to prepend to the observable sequence\n   * @returns {Observable} The source sequence prepended with the specified values.\n   */\n  observableProto.startWith = function () {\n    var values, scheduler, start = 0;\n    if (!!arguments.length && isScheduler(arguments[0])) {\n      scheduler = arguments[0];\n      start = 1;\n    } else {\n      scheduler = immediateScheduler;\n    }\n    for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\n    return enumerableOf([observableFromArray(args, scheduler), this]).concat();\n  };\n\n  var TakeLastObserver = (function (__super__) {\n    inherits(TakeLastObserver, __super__);\n    function TakeLastObserver(o, c) {\n      this._o = o;\n      this._c = c;\n      this._q = [];\n      __super__.call(this);\n    }\n\n    TakeLastObserver.prototype.next = function (x) {\n      this._q.push(x);\n      this._q.length > this._c && this._q.shift();\n    };\n\n    TakeLastObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    TakeLastObserver.prototype.completed = function () {\n      while (this._q.length > 0) { this._o.onNext(this._q.shift()); }\n      this._o.onCompleted();\n    };\n\n    return TakeLastObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Returns a specified number of contiguous elements from the end of an observable sequence.\n   * @description\n   *  This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of\n   *  the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.\n   * @param {Number} count Number of elements to take from the end of the source sequence.\n   * @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.\n   */\n  observableProto.takeLast = function (count) {\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\n    var source = this;\n    return new AnonymousObservable(function (o) {\n      return source.subscribe(new TakeLastObserver(o, count));\n    }, source);\n  };\n\n  var TakeLastBufferObserver = (function (__super__) {\n    inherits(TakeLastBufferObserver, __super__);\n    function TakeLastBufferObserver(o, c) {\n      this._o = o;\n      this._c = c;\n      this._q = [];\n      __super__.call(this);\n    }\n\n    TakeLastBufferObserver.prototype.next = function (x) {\n      this._q.push(x);\n      this._q.length > this._c && this._q.shift();\n    };\n\n    TakeLastBufferObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    TakeLastBufferObserver.prototype.completed = function () {\n      this._o.onNext(this._q);\n      this._o.onCompleted();\n    };\n\n    return TakeLastBufferObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Returns an array with the specified number of contiguous elements from the end of an observable sequence.\n   *\n   * @description\n   *  This operator accumulates a buffer with a length enough to store count elements. Upon completion of the\n   *  source sequence, this buffer is produced on the result sequence.\n   * @param {Number} count Number of elements to take from the end of the source sequence.\n   * @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.\n   */\n  observableProto.takeLastBuffer = function (count) {\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\n    var source = this;\n    return new AnonymousObservable(function (o) {\n      return source.subscribe(new TakeLastBufferObserver(o, count));\n    }, source);\n  };\n\n  /**\n   *  Projects each element of an observable sequence into zero or more windows which are produced based on element count information.\n   * @param {Number} count Length of each window.\n   * @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.\n   * @returns {Observable} An observable sequence of windows.\n   */\n  observableProto.windowWithCount = function (count, skip) {\n    var source = this;\n    +count || (count = 0);\n    Math.abs(count) === Infinity && (count = 0);\n    if (count <= 0) { throw new ArgumentOutOfRangeError(); }\n    skip == null && (skip = count);\n    +skip || (skip = 0);\n    Math.abs(skip) === Infinity && (skip = 0);\n\n    if (skip <= 0) { throw new ArgumentOutOfRangeError(); }\n    return new AnonymousObservable(function (observer) {\n      var m = new SingleAssignmentDisposable(),\n        refCountDisposable = new RefCountDisposable(m),\n        n = 0,\n        q = [];\n\n      function createWindow () {\n        var s = new Subject();\n        q.push(s);\n        observer.onNext(addRef(s, refCountDisposable));\n      }\n\n      createWindow();\n\n      m.setDisposable(source.subscribe(\n        function (x) {\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }\n          var c = n - count + 1;\n          c >= 0 && c % skip === 0 && q.shift().onCompleted();\n          ++n % skip === 0 && createWindow();\n        },\n        function (e) {\n          while (q.length > 0) { q.shift().onError(e); }\n          observer.onError(e);\n        },\n        function () {\n          while (q.length > 0) { q.shift().onCompleted(); }\n          observer.onCompleted();\n        }\n      ));\n      return refCountDisposable;\n    }, source);\n  };\n\n  function concatMap(source, selector, thisArg) {\n    var selectorFunc = bindCallback(selector, thisArg, 3);\n    return source.map(function (x, i) {\n      var result = selectorFunc(x, i, source);\n      isPromise(result) && (result = observableFromPromise(result));\n      (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));\n      return result;\n    }).concatAll();\n  }\n\n  /**\n   *  One of the Following:\n   *  Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n   *\n   * @example\n   *  var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });\n   *  Or:\n   *  Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.\n   *\n   *  var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });\n   *  Or:\n   *  Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.\n   *\n   *  var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));\n   * @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the\n   * source sequence onto which could be either an observable or Promise.\n   * @param {Function} [resultSelector]  A transform function to apply to each element of the intermediate sequence.\n   * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.\n   */\n  observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {\n    if (isFunction(selector) && isFunction(resultSelector)) {\n      return this.concatMap(function (x, i) {\n        var selectorResult = selector(x, i);\n        isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));\n        (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));\n\n        return selectorResult.map(function (y, i2) {\n          return resultSelector(x, y, i, i2);\n        });\n      });\n    }\n    return isFunction(selector) ?\n      concatMap(this, selector, thisArg) :\n      concatMap(this, function () { return selector; });\n  };\n\n  /**\n   * Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.\n   * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.\n   * @param {Function} onError A transform function to apply when an error occurs in the source sequence.\n   * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.\n   * @param {Any} [thisArg] An optional \"this\" to use to invoke each transform.\n   * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.\n   */\n  observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {\n    var source = this,\n        onNextFunc = bindCallback(onNext, thisArg, 2),\n        onErrorFunc = bindCallback(onError, thisArg, 1),\n        onCompletedFunc = bindCallback(onCompleted, thisArg, 0);\n    return new AnonymousObservable(function (observer) {\n      var index = 0;\n      return source.subscribe(\n        function (x) {\n          var result;\n          try {\n            result = onNextFunc(x, index++);\n          } catch (e) {\n            observer.onError(e);\n            return;\n          }\n          isPromise(result) && (result = observableFromPromise(result));\n          observer.onNext(result);\n        },\n        function (err) {\n          var result;\n          try {\n            result = onErrorFunc(err);\n          } catch (e) {\n            observer.onError(e);\n            return;\n          }\n          isPromise(result) && (result = observableFromPromise(result));\n          observer.onNext(result);\n          observer.onCompleted();\n        },\n        function () {\n          var result;\n          try {\n            result = onCompletedFunc();\n          } catch (e) {\n            observer.onError(e);\n            return;\n          }\n          isPromise(result) && (result = observableFromPromise(result));\n          observer.onNext(result);\n          observer.onCompleted();\n        });\n    }, this).concatAll();\n  };\n\n  var DefaultIfEmptyObserver = (function (__super__) {\n    inherits(DefaultIfEmptyObserver, __super__);\n    function DefaultIfEmptyObserver(o, d) {\n      this._o = o;\n      this._d = d;\n      this._f = false;\n      __super__.call(this);\n    }\n\n    DefaultIfEmptyObserver.prototype.next = function (x) {\n      this._f = true;\n      this._o.onNext(x);\n    };\n\n    DefaultIfEmptyObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    DefaultIfEmptyObserver.prototype.completed = function () {\n      !this._f && this._o.onNext(this._d);\n      this._o.onCompleted();\n    };\n\n    return DefaultIfEmptyObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.\n   *\n   *  var res = obs = xs.defaultIfEmpty();\n   *  2 - obs = xs.defaultIfEmpty(false);\n   *\n   * @memberOf Observable#\n   * @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.\n   * @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.\n   */\n    observableProto.defaultIfEmpty = function (defaultValue) {\n      var source = this;\n      defaultValue === undefined && (defaultValue = null);\n      return new AnonymousObservable(function (o) {\n        return source.subscribe(new DefaultIfEmptyObserver(o, defaultValue));\n      }, source);\n    };\n\n  // Swap out for Array.findIndex\n  function arrayIndexOfComparer(array, item, comparer) {\n    for (var i = 0, len = array.length; i < len; i++) {\n      if (comparer(array[i], item)) { return i; }\n    }\n    return -1;\n  }\n\n  function HashSet(comparer) {\n    this.comparer = comparer;\n    this.set = [];\n  }\n  HashSet.prototype.push = function(value) {\n    var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;\n    retValue && this.set.push(value);\n    return retValue;\n  };\n\n  var DistinctObservable = (function (__super__) {\n    inherits(DistinctObservable, __super__);\n    function DistinctObservable(source, keyFn, cmpFn) {\n      this.source = source;\n      this._keyFn = keyFn;\n      this._cmpFn = cmpFn;\n      __super__.call(this);\n    }\n\n    DistinctObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new DistinctObserver(o, this._keyFn, this._cmpFn));\n    };\n\n    return DistinctObservable;\n  }(ObservableBase));\n\n  var DistinctObserver = (function (__super__) {\n    inherits(DistinctObserver, __super__);\n    function DistinctObserver(o, keyFn, cmpFn) {\n      this._o = o;\n      this._keyFn = keyFn;\n      this._h = new HashSet(cmpFn);\n      __super__.call(this);\n    }\n\n    DistinctObserver.prototype.next = function (x) {\n      var key = x;\n      if (isFunction(this._keyFn)) {\n        key = tryCatch(this._keyFn)(x);\n        if (key === errorObj) { return this._o.onError(key.e); }\n      }\n      this._h.push(key) && this._o.onNext(x);\n    };\n\n    DistinctObserver.prototype.error = function (e) { this._o.onError(e); };\n    DistinctObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return DistinctObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.\n   *  Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.\n   *\n   * @example\n   *  var res = obs = xs.distinct();\n   *  2 - obs = xs.distinct(function (x) { return x.id; });\n   *  2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });\n   * @param {Function} [keySelector]  A function to compute the comparison key for each element.\n   * @param {Function} [comparer]  Used to compare items in the collection.\n   * @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.\n   */\n  observableProto.distinct = function (keySelector, comparer) {\n    comparer || (comparer = defaultComparer);\n    return new DistinctObservable(this, keySelector, comparer);\n  };\n\n  /**\n   *  Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.\n   *\n   * @example\n   *  var res = observable.groupBy(function (x) { return x.id; });\n   *  2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });\n   *  3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });\n   * @param {Function} keySelector A function to extract the key for each element.\n   * @param {Function} [elementSelector]  A function to map each source element to an element in an observable group.\n   * @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.\n   */\n  observableProto.groupBy = function (keySelector, elementSelector) {\n    return this.groupByUntil(keySelector, elementSelector, observableNever);\n  };\n\n    /**\n     *  Groups the elements of an observable sequence according to a specified key selector function.\n     *  A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same\n     *  key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.\n     *\n     * @example\n     *  var res = observable.groupByUntil(function (x) { return x.id; }, null,  function () { return Rx.Observable.never(); });\n     *  2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; },  function () { return Rx.Observable.never(); });\n     *  3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; },  function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });\n     * @param {Function} keySelector A function to extract the key for each element.\n     * @param {Function} durationSelector A function to signal the expiration of a group.\n     * @returns {Observable}\n     *  A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.\n     *  If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.\n     *\n     */\n    observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector) {\n      var source = this;\n      return new AnonymousObservable(function (o) {\n        var map = new Map(),\n          groupDisposable = new CompositeDisposable(),\n          refCountDisposable = new RefCountDisposable(groupDisposable),\n          handleError = function (e) { return function (item) { item.onError(e); }; };\n\n        groupDisposable.add(\n          source.subscribe(function (x) {\n            var key = tryCatch(keySelector)(x);\n            if (key === errorObj) {\n              map.forEach(handleError(key.e));\n              return o.onError(key.e);\n            }\n\n            var fireNewMapEntry = false, writer = map.get(key);\n            if (writer === undefined) {\n              writer = new Subject();\n              map.set(key, writer);\n              fireNewMapEntry = true;\n            }\n\n            if (fireNewMapEntry) {\n              var group = new GroupedObservable(key, writer, refCountDisposable),\n                durationGroup = new GroupedObservable(key, writer);\n              var duration = tryCatch(durationSelector)(durationGroup);\n              if (duration === errorObj) {\n                map.forEach(handleError(duration.e));\n                return o.onError(duration.e);\n              }\n\n              o.onNext(group);\n\n              var md = new SingleAssignmentDisposable();\n              groupDisposable.add(md);\n\n              md.setDisposable(duration.take(1).subscribe(\n                noop,\n                function (e) {\n                  map.forEach(handleError(e));\n                  o.onError(e);\n                },\n                function () {\n                  if (map['delete'](key)) { writer.onCompleted(); }\n                  groupDisposable.remove(md);\n                }));\n            }\n\n            var element = x;\n            if (isFunction(elementSelector)) {\n              element = tryCatch(elementSelector)(x);\n              if (element === errorObj) {\n                map.forEach(handleError(element.e));\n                return o.onError(element.e);\n              }\n            }\n\n            writer.onNext(element);\n        }, function (e) {\n          map.forEach(handleError(e));\n          o.onError(e);\n        }, function () {\n          map.forEach(function (item) { item.onCompleted(); });\n          o.onCompleted();\n        }));\n\n      return refCountDisposable;\n    }, source);\n  };\n\n  var MapObservable = (function (__super__) {\n    inherits(MapObservable, __super__);\n\n    function MapObservable(source, selector, thisArg) {\n      this.source = source;\n      this.selector = bindCallback(selector, thisArg, 3);\n      __super__.call(this);\n    }\n\n    function innerMap(selector, self) {\n      return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); };\n    }\n\n    MapObservable.prototype.internalMap = function (selector, thisArg) {\n      return new MapObservable(this.source, innerMap(selector, this), thisArg);\n    };\n\n    MapObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new InnerObserver(o, this.selector, this));\n    };\n\n    inherits(InnerObserver, AbstractObserver);\n    function InnerObserver(o, selector, source) {\n      this.o = o;\n      this.selector = selector;\n      this.source = source;\n      this.i = 0;\n      AbstractObserver.call(this);\n    }\n\n    InnerObserver.prototype.next = function(x) {\n      var result = tryCatch(this.selector)(x, this.i++, this.source);\n      if (result === errorObj) { return this.o.onError(result.e); }\n      this.o.onNext(result);\n    };\n\n    InnerObserver.prototype.error = function (e) {\n      this.o.onError(e);\n    };\n\n    InnerObserver.prototype.completed = function () {\n      this.o.onCompleted();\n    };\n\n    return MapObservable;\n\n  }(ObservableBase));\n\n  /**\n  * Projects each element of an observable sequence into a new form by incorporating the element's index.\n  * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.\n  * @param {Any} [thisArg] Object to use as this when executing callback.\n  * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.\n  */\n  observableProto.map = observableProto.select = function (selector, thisArg) {\n    var selectorFn = typeof selector === 'function' ? selector : function () { return selector; };\n    return this instanceof MapObservable ?\n      this.internalMap(selectorFn, thisArg) :\n      new MapObservable(this, selectorFn, thisArg);\n  };\n\n  function plucker(args, len) {\n    return function mapper(x) {\n      var currentProp = x;\n      for (var i = 0; i < len; i++) {\n        var p = currentProp[args[i]];\n        if (typeof p !== 'undefined') {\n          currentProp = p;\n        } else {\n          return undefined;\n        }\n      }\n      return currentProp;\n    }\n  }\n\n  /**\n   * Retrieves the value of a specified nested property from all elements in\n   * the Observable sequence.\n   * @param {Arguments} arguments The nested properties to pluck.\n   * @returns {Observable} Returns a new Observable sequence of property values.\n   */\n  observableProto.pluck = function () {\n    var len = arguments.length, args = new Array(len);\n    if (len === 0) { throw new Error('List of properties cannot be empty.'); }\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    return this.map(plucker(args, len));\n  };\n\nobservableProto.flatMap = observableProto.selectMany = function(selector, resultSelector, thisArg) {\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll();\n};\n\n  /**\n   * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n   * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.\n   * @param {Function} onError A transform function to apply when an error occurs in the source sequence.\n   * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.\n   * @param {Any} [thisArg] An optional \"this\" to use to invoke each transform.\n   * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.\n   */\n  observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {\n    var source = this;\n    return new AnonymousObservable(function (observer) {\n      var index = 0;\n\n      return source.subscribe(\n        function (x) {\n          var result;\n          try {\n            result = onNext.call(thisArg, x, index++);\n          } catch (e) {\n            observer.onError(e);\n            return;\n          }\n          isPromise(result) && (result = observableFromPromise(result));\n          observer.onNext(result);\n        },\n        function (err) {\n          var result;\n          try {\n            result = onError.call(thisArg, err);\n          } catch (e) {\n            observer.onError(e);\n            return;\n          }\n          isPromise(result) && (result = observableFromPromise(result));\n          observer.onNext(result);\n          observer.onCompleted();\n        },\n        function () {\n          var result;\n          try {\n            result = onCompleted.call(thisArg);\n          } catch (e) {\n            observer.onError(e);\n            return;\n          }\n          isPromise(result) && (result = observableFromPromise(result));\n          observer.onNext(result);\n          observer.onCompleted();\n        });\n    }, source).mergeAll();\n  };\n\nRx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisArg) {\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).switchLatest();\n};\n  var SkipObservable = (function(__super__) {\n    inherits(SkipObservable, __super__);\n    function SkipObservable(source, count) {\n      this.source = source;\n      this._count = count;\n      __super__.call(this);\n    }\n\n    SkipObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new SkipObserver(o, this._count));\n    };\n\n    function SkipObserver(o, c) {\n      this._o = o;\n      this._r = c;\n      AbstractObserver.call(this);\n    }\n\n    inherits(SkipObserver, AbstractObserver);\n\n    SkipObserver.prototype.next = function (x) {\n      if (this._r <= 0) {\n        this._o.onNext(x);\n      } else {\n        this._r--;\n      }\n    };\n    SkipObserver.prototype.error = function(e) { this._o.onError(e); };\n    SkipObserver.prototype.completed = function() { this._o.onCompleted(); };\n\n    return SkipObservable;\n  }(ObservableBase));\n\n  /**\n   * Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.\n   * @param {Number} count The number of elements to skip before returning the remaining elements.\n   * @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.\n   */\n  observableProto.skip = function (count) {\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\n    return new SkipObservable(this, count);\n  };\n\n  var SkipWhileObservable = (function (__super__) {\n    inherits(SkipWhileObservable, __super__);\n    function SkipWhileObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    SkipWhileObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new SkipWhileObserver(o, this));\n    };\n\n    return SkipWhileObservable;\n  }(ObservableBase));\n\n  var SkipWhileObserver = (function (__super__) {\n    inherits(SkipWhileObserver, __super__);\n\n    function SkipWhileObserver(o, p) {\n      this._o = o;\n      this._p = p;\n      this._i = 0;\n      this._r = false;\n      __super__.call(this);\n    }\n\n    SkipWhileObserver.prototype.next = function (x) {\n      if (!this._r) {\n        var res = tryCatch(this._p._fn)(x, this._i++, this._p);\n        if (res === errorObj) { return this._o.onError(res.e); }\n        this._r = !res;\n      }\n      this._r && this._o.onNext(x);\n    };\n    SkipWhileObserver.prototype.error = function (e) { this._o.onError(e); };\n    SkipWhileObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return SkipWhileObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.\n   *  The element's index is used in the logic of the predicate function.\n   *\n   *  var res = source.skipWhile(function (value) { return value < 10; });\n   *  var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });\n   * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.\n   * @param {Any} [thisArg] Object to use as this when executing callback.\n   * @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.\n   */\n  observableProto.skipWhile = function (predicate, thisArg) {\n    var fn = bindCallback(predicate, thisArg, 3);\n    return new SkipWhileObservable(this, fn);\n  };\n\n  var TakeObservable = (function(__super__) {\n    inherits(TakeObservable, __super__);\n    function TakeObservable(source, count) {\n      this.source = source;\n      this._count = count;\n      __super__.call(this);\n    }\n\n    TakeObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new TakeObserver(o, this._count));\n    };\n\n    function TakeObserver(o, c) {\n      this._o = o;\n      this._c = c;\n      this._r = c;\n      AbstractObserver.call(this);\n    }\n\n    inherits(TakeObserver, AbstractObserver);\n\n    TakeObserver.prototype.next = function (x) {\n      if (this._r-- > 0) {\n        this._o.onNext(x);\n        this._r <= 0 && this._o.onCompleted();\n      }\n    };\n\n    TakeObserver.prototype.error = function (e) { this._o.onError(e); };\n    TakeObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return TakeObservable;\n  }(ObservableBase));\n\n  /**\n   *  Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).\n   * @param {Number} count The number of elements to return.\n   * @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name=\"count count</paramref> is set to 0.\n   * @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.\n   */\n  observableProto.take = function (count, scheduler) {\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\n    if (count === 0) { return observableEmpty(scheduler); }\n    return new TakeObservable(this, count);\n  };\n\n  var TakeWhileObservable = (function (__super__) {\n    inherits(TakeWhileObservable, __super__);\n    function TakeWhileObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    TakeWhileObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new TakeWhileObserver(o, this));\n    };\n\n    return TakeWhileObservable;\n  }(ObservableBase));\n\n  var TakeWhileObserver = (function (__super__) {\n    inherits(TakeWhileObserver, __super__);\n\n    function TakeWhileObserver(o, p) {\n      this._o = o;\n      this._p = p;\n      this._i = 0;\n      this._r = true;\n      __super__.call(this);\n    }\n\n    TakeWhileObserver.prototype.next = function (x) {\n      if (this._r) {\n        this._r = tryCatch(this._p._fn)(x, this._i++, this._p);\n        if (this._r === errorObj) { return this._o.onError(this._r.e); }\n      }\n      if (this._r) {\n        this._o.onNext(x);\n      } else {\n        this._o.onCompleted();\n      }\n    };\n    TakeWhileObserver.prototype.error = function (e) { this._o.onError(e); };\n    TakeWhileObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return TakeWhileObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Returns elements from an observable sequence as long as a specified condition is true.\n   *  The element's index is used in the logic of the predicate function.\n   * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.\n   * @param {Any} [thisArg] Object to use as this when executing callback.\n   * @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.\n   */\n  observableProto.takeWhile = function (predicate, thisArg) {\n    var fn = bindCallback(predicate, thisArg, 3);\n    return new TakeWhileObservable(this, fn);\n  };\n\n  var FilterObservable = (function (__super__) {\n    inherits(FilterObservable, __super__);\n\n    function FilterObservable(source, predicate, thisArg) {\n      this.source = source;\n      this.predicate = bindCallback(predicate, thisArg, 3);\n      __super__.call(this);\n    }\n\n    FilterObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new InnerObserver(o, this.predicate, this));\n    };\n\n    function innerPredicate(predicate, self) {\n      return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }\n    }\n\n    FilterObservable.prototype.internalFilter = function(predicate, thisArg) {\n      return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);\n    };\n\n    inherits(InnerObserver, AbstractObserver);\n    function InnerObserver(o, predicate, source) {\n      this.o = o;\n      this.predicate = predicate;\n      this.source = source;\n      this.i = 0;\n      AbstractObserver.call(this);\n    }\n\n    InnerObserver.prototype.next = function(x) {\n      var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);\n      if (shouldYield === errorObj) {\n        return this.o.onError(shouldYield.e);\n      }\n      shouldYield && this.o.onNext(x);\n    };\n\n    InnerObserver.prototype.error = function (e) {\n      this.o.onError(e);\n    };\n\n    InnerObserver.prototype.completed = function () {\n      this.o.onCompleted();\n    };\n\n    return FilterObservable;\n\n  }(ObservableBase));\n\n  /**\n  *  Filters the elements of an observable sequence based on a predicate by incorporating the element's index.\n  * @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.\n  * @param {Any} [thisArg] Object to use as this when executing callback.\n  * @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.\n  */\n  observableProto.filter = observableProto.where = function (predicate, thisArg) {\n    return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :\n      new FilterObservable(this, predicate, thisArg);\n  };\n\n  var ExtremaByObservable = (function (__super__) {\n    inherits(ExtremaByObservable, __super__);\n    function ExtremaByObservable(source, k, c) {\n      this.source = source;\n      this._k = k;\n      this._c = c;\n      __super__.call(this);\n    }\n\n    ExtremaByObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new ExtremaByObserver(o, this._k, this._c));\n    };\n\n    return ExtremaByObservable;\n  }(ObservableBase));\n\n  var ExtremaByObserver = (function (__super__) {\n    inherits(ExtremaByObserver, __super__);\n    function ExtremaByObserver(o, k, c) {\n      this._o = o;\n      this._k = k;\n      this._c = c;\n      this._v = null;\n      this._hv = false;\n      this._l = [];\n      __super__.call(this);\n    }\n\n    ExtremaByObserver.prototype.next = function (x) {\n      var key = tryCatch(this._k)(x);\n      if (key === errorObj) { return this._o.onError(key.e); }\n      var comparison = 0;\n      if (!this._hv) {\n        this._hv = true;\n        this._v = key;\n      } else {\n        comparison = tryCatch(this._c)(key, this._v);\n        if (comparison === errorObj) { return this._o.onError(comparison.e); }\n      }\n      if (comparison > 0) {\n        this._v = key;\n        this._l = [];\n      }\n      if (comparison >= 0) { this._l.push(x); }\n    };\n\n    ExtremaByObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    ExtremaByObserver.prototype.completed = function () {\n      this._o.onNext(this._l);\n      this._o.onCompleted();\n    };\n\n    return ExtremaByObserver;\n  }(AbstractObserver));\n\n  function firstOnly(x) {\n    if (x.length === 0) { throw new EmptyError(); }\n    return x[0];\n  }\n\n  var ReduceObservable = (function(__super__) {\n    inherits(ReduceObservable, __super__);\n    function ReduceObservable(source, accumulator, hasSeed, seed) {\n      this.source = source;\n      this.accumulator = accumulator;\n      this.hasSeed = hasSeed;\n      this.seed = seed;\n      __super__.call(this);\n    }\n\n    ReduceObservable.prototype.subscribeCore = function(observer) {\n      return this.source.subscribe(new ReduceObserver(observer,this));\n    };\n\n    return ReduceObservable;\n  }(ObservableBase));\n\n  var ReduceObserver = (function (__super__) {\n    inherits(ReduceObserver, __super__);\n    function ReduceObserver(o, parent) {\n      this._o = o;\n      this._p = parent;\n      this._fn = parent.accumulator;\n      this._hs = parent.hasSeed;\n      this._s = parent.seed;\n      this._ha = false;\n      this._a = null;\n      this._hv = false;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    ReduceObserver.prototype.next = function (x) {\n      !this._hv && (this._hv = true);\n      if (this._ha) {\n        this._a = tryCatch(this._fn)(this._a, x, this._i, this._p);\n      } else {\n        this._a = this._hs ? tryCatch(this._fn)(this._s, x, this._i, this._p) : x;\n        this._ha = true;\n      }\n      if (this._a === errorObj) { return this._o.onError(this._a.e); }\n      this._i++;\n    };\n\n    ReduceObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    ReduceObserver.prototype.completed = function () {\n      this._hv && this._o.onNext(this._a);\n      !this._hv && this._hs && this._o.onNext(this._s);\n      !this._hv && !this._hs && this._o.onError(new EmptyError());\n      this._o.onCompleted();\n    };\n\n    return ReduceObserver;\n  }(AbstractObserver));\n\n  /**\n  * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.\n  * For aggregation behavior with incremental intermediate results, see Observable.scan.\n  * @param {Function} accumulator An accumulator function to be invoked on each element.\n  * @param {Any} [seed] The initial accumulator value.\n  * @returns {Observable} An observable sequence containing a single element with the final accumulator value.\n  */\n  observableProto.reduce = function () {\n    var hasSeed = false, seed, accumulator = arguments[0];\n    if (arguments.length === 2) {\n      hasSeed = true;\n      seed = arguments[1];\n    }\n    return new ReduceObservable(this, accumulator, hasSeed, seed);\n  };\n\n  var SomeObservable = (function (__super__) {\n    inherits(SomeObservable, __super__);\n    function SomeObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    SomeObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new SomeObserver(o, this._fn, this.source));\n    };\n\n    return SomeObservable;\n  }(ObservableBase));\n\n  var SomeObserver = (function (__super__) {\n    inherits(SomeObserver, __super__);\n\n    function SomeObserver(o, fn, s) {\n      this._o = o;\n      this._fn = fn;\n      this._s = s;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    SomeObserver.prototype.next = function (x) {\n      var result = tryCatch(this._fn)(x, this._i++, this._s);\n      if (result === errorObj) { return this._o.onError(result.e); }\n      if (Boolean(result)) {\n        this._o.onNext(true);\n        this._o.onCompleted();\n      }\n    };\n    SomeObserver.prototype.error = function (e) { this._o.onError(e); };\n    SomeObserver.prototype.completed = function () {\n      this._o.onNext(false);\n      this._o.onCompleted();\n    };\n\n    return SomeObserver;\n  }(AbstractObserver));\n\n  /**\n   * Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.\n   * @param {Function} [predicate] A function to test each element for a condition.\n   * @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.\n   */\n  observableProto.some = function (predicate, thisArg) {\n    var fn = bindCallback(predicate, thisArg, 3);\n    return new SomeObservable(this, fn);\n  };\n\n  var IsEmptyObservable = (function (__super__) {\n    inherits(IsEmptyObservable, __super__);\n    function IsEmptyObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    IsEmptyObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new IsEmptyObserver(o));\n    };\n\n    return IsEmptyObservable;\n  }(ObservableBase));\n\n  var IsEmptyObserver = (function(__super__) {\n    inherits(IsEmptyObserver, __super__);\n    function IsEmptyObserver(o) {\n      this._o = o;\n      __super__.call(this);\n    }\n\n    IsEmptyObserver.prototype.next = function () {\n      this._o.onNext(false);\n      this._o.onCompleted();\n    };\n    IsEmptyObserver.prototype.error = function (e) { this._o.onError(e); };\n    IsEmptyObserver.prototype.completed = function () {\n      this._o.onNext(true);\n      this._o.onCompleted();\n    };\n\n    return IsEmptyObserver;\n  }(AbstractObserver));\n\n  /**\n   * Determines whether an observable sequence is empty.\n   * @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.\n   */\n  observableProto.isEmpty = function () {\n    return new IsEmptyObservable(this);\n  };\n\n  var EveryObservable = (function (__super__) {\n    inherits(EveryObservable, __super__);\n    function EveryObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    EveryObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new EveryObserver(o, this._fn, this.source));\n    };\n\n    return EveryObservable;\n  }(ObservableBase));\n\n  var EveryObserver = (function (__super__) {\n    inherits(EveryObserver, __super__);\n\n    function EveryObserver(o, fn, s) {\n      this._o = o;\n      this._fn = fn;\n      this._s = s;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    EveryObserver.prototype.next = function (x) {\n      var result = tryCatch(this._fn)(x, this._i++, this._s);\n      if (result === errorObj) { return this._o.onError(result.e); }\n      if (!Boolean(result)) {\n        this._o.onNext(false);\n        this._o.onCompleted();\n      }\n    };\n    EveryObserver.prototype.error = function (e) { this._o.onError(e); };\n    EveryObserver.prototype.completed = function () {\n      this._o.onNext(true);\n      this._o.onCompleted();\n    };\n\n    return EveryObserver;\n  }(AbstractObserver));\n\n  /**\n   * Determines whether all elements of an observable sequence satisfy a condition.\n   * @param {Function} [predicate] A function to test each element for a condition.\n   * @param {Any} [thisArg] Object to use as this when executing callback.\n   * @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.\n   */\n  observableProto.every = function (predicate, thisArg) {\n    var fn = bindCallback(predicate, thisArg, 3);\n    return new EveryObservable(this, fn);\n  };\n\n  var IncludesObservable = (function (__super__) {\n    inherits(IncludesObservable, __super__);\n    function IncludesObservable(source, elem, idx) {\n      var n = +idx || 0;\n      Math.abs(n) === Infinity && (n = 0);\n\n      this.source = source;\n      this._elem = elem;\n      this._n = n;\n      __super__.call(this);\n    }\n\n    IncludesObservable.prototype.subscribeCore = function (o) {\n      if (this._n < 0) {\n        o.onNext(false);\n        o.onCompleted();\n        return disposableEmpty;\n      }\n\n      return this.source.subscribe(new IncludesObserver(o, this._elem, this._n));\n    };\n\n    return IncludesObservable;\n  }(ObservableBase));\n\n  var IncludesObserver = (function (__super__) {\n    inherits(IncludesObserver, __super__);\n    function IncludesObserver(o, elem, n) {\n      this._o = o;\n      this._elem = elem;\n      this._n = n;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    function comparer(a, b) {\n      return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));\n    }\n\n    IncludesObserver.prototype.next = function (x) {\n      if (this._i++ >= this._n && comparer(x, this._elem)) {\n        this._o.onNext(true);\n        this._o.onCompleted();\n      }\n    };\n    IncludesObserver.prototype.error = function (e) { this._o.onError(e); };\n    IncludesObserver.prototype.completed = function () { this._o.onNext(false); this._o.onCompleted(); };\n\n    return IncludesObserver;\n  }(AbstractObserver));\n\n  /**\n   * Determines whether an observable sequence includes a specified element with an optional equality comparer.\n   * @param searchElement The value to locate in the source sequence.\n   * @param {Number} [fromIndex] An equality comparer to compare elements.\n   * @returns {Observable} An observable sequence containing a single element determining whether the source sequence includes an element that has the specified value from the given index.\n   */\n  observableProto.includes = function (searchElement, fromIndex) {\n    return new IncludesObservable(this, searchElement, fromIndex);\n  };\n\n  var CountObservable = (function (__super__) {\n    inherits(CountObservable, __super__);\n    function CountObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    CountObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new CountObserver(o, this._fn, this.source));\n    };\n\n    return CountObservable;\n  }(ObservableBase));\n\n  var CountObserver = (function (__super__) {\n    inherits(CountObserver, __super__);\n\n    function CountObserver(o, fn, s) {\n      this._o = o;\n      this._fn = fn;\n      this._s = s;\n      this._i = 0;\n      this._c = 0;\n      __super__.call(this);\n    }\n\n    CountObserver.prototype.next = function (x) {\n      if (this._fn) {\n        var result = tryCatch(this._fn)(x, this._i++, this._s);\n        if (result === errorObj) { return this._o.onError(result.e); }\n        Boolean(result) && (this._c++);\n      } else {\n        this._c++;\n      }\n    };\n    CountObserver.prototype.error = function (e) { this._o.onError(e); };\n    CountObserver.prototype.completed = function () {\n      this._o.onNext(this._c);\n      this._o.onCompleted();\n    };\n\n    return CountObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.\n   * @example\n   * res = source.count();\n   * res = source.count(function (x) { return x > 3; });\n   * @param {Function} [predicate]A function to test each element for a condition.\n   * @param {Any} [thisArg] Object to use as this when executing callback.\n   * @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.\n   */\n  observableProto.count = function (predicate, thisArg) {\n    var fn = bindCallback(predicate, thisArg, 3);\n    return new CountObservable(this, fn);\n  };\n\n  var IndexOfObservable = (function (__super__) {\n    inherits(IndexOfObservable, __super__);\n    function IndexOfObservable(source, e, n) {\n      this.source = source;\n      this._e = e;\n      this._n = n;\n      __super__.call(this);\n    }\n\n    IndexOfObservable.prototype.subscribeCore = function (o) {\n      if (this._n < 0) {\n        o.onNext(-1);\n        o.onCompleted();\n        return disposableEmpty;\n      }\n\n      return this.source.subscribe(new IndexOfObserver(o, this._e, this._n));\n    };\n\n    return IndexOfObservable;\n  }(ObservableBase));\n\n  var IndexOfObserver = (function (__super__) {\n    inherits(IndexOfObserver, __super__);\n    function IndexOfObserver(o, e, n) {\n      this._o = o;\n      this._e = e;\n      this._n = n;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    IndexOfObserver.prototype.next = function (x) {\n      if (this._i >= this._n && x === this._e) {\n        this._o.onNext(this._i);\n        this._o.onCompleted();\n      }\n      this._i++;\n    };\n    IndexOfObserver.prototype.error = function (e) { this._o.onError(e); };\n    IndexOfObserver.prototype.completed = function () { this._o.onNext(-1); this._o.onCompleted(); };\n\n    return IndexOfObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.\n   * @param {Any} searchElement Element to locate in the array.\n   * @param {Number} [fromIndex] The index to start the search.  If not specified, defaults to 0.\n   * @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.\n   */\n  observableProto.indexOf = function(searchElement, fromIndex) {\n    var n = +fromIndex || 0;\n    Math.abs(n) === Infinity && (n = 0);\n    return new IndexOfObservable(this, searchElement, n);\n  };\n\n  var SumObservable = (function (__super__) {\n    inherits(SumObservable, __super__);\n    function SumObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    SumObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new SumObserver(o, this._fn, this.source));\n    };\n\n    return SumObservable;\n  }(ObservableBase));\n\n  var SumObserver = (function (__super__) {\n    inherits(SumObserver, __super__);\n\n    function SumObserver(o, fn, s) {\n      this._o = o;\n      this._fn = fn;\n      this._s = s;\n      this._i = 0;\n      this._c = 0;\n      __super__.call(this);\n    }\n\n    SumObserver.prototype.next = function (x) {\n      if (this._fn) {\n        var result = tryCatch(this._fn)(x, this._i++, this._s);\n        if (result === errorObj) { return this._o.onError(result.e); }\n        this._c += result;\n      } else {\n        this._c += x;\n      }\n    };\n    SumObserver.prototype.error = function (e) { this._o.onError(e); };\n    SumObserver.prototype.completed = function () {\n      this._o.onNext(this._c);\n      this._o.onCompleted();\n    };\n\n    return SumObserver;\n  }(AbstractObserver));\n\n  /**\n   * Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.\n   * @param {Function} [selector] A transform function to apply to each element.\n   * @param {Any} [thisArg] Object to use as this when executing callback.\n   * @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.\n   */\n  observableProto.sum = function (keySelector, thisArg) {\n    var fn = bindCallback(keySelector, thisArg, 3);\n    return new SumObservable(this, fn);\n  };\n\n  /**\n   * Returns the elements in an observable sequence with the minimum key value according to the specified comparer.\n   * @example\n   * var res = source.minBy(function (x) { return x.value; });\n   * var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });\n   * @param {Function} keySelector Key selector function.\n   * @param {Function} [comparer] Comparer used to compare key values.\n   * @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.\n   */\n  observableProto.minBy = function (keySelector, comparer) {\n    comparer || (comparer = defaultSubComparer);\n    return new ExtremaByObservable(this, keySelector, function (x, y) { return comparer(x, y) * -1; });\n  };\n\n  /**\n   * Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.\n   * @example\n   * var res = source.min();\n   * var res = source.min(function (x, y) { return x.value - y.value; });\n   * @param {Function} [comparer] Comparer used to compare elements.\n   * @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.\n   */\n  observableProto.min = function (comparer) {\n    return this.minBy(identity, comparer).map(function (x) { return firstOnly(x); });\n  };\n\n  /**\n   * Returns the elements in an observable sequence with the maximum  key value according to the specified comparer.\n   * @example\n   * var res = source.maxBy(function (x) { return x.value; });\n   * var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });\n   * @param {Function} keySelector Key selector function.\n   * @param {Function} [comparer]  Comparer used to compare key values.\n   * @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.\n   */\n  observableProto.maxBy = function (keySelector, comparer) {\n    comparer || (comparer = defaultSubComparer);\n    return new ExtremaByObservable(this, keySelector, comparer);\n  };\n\n  /**\n   * Returns the maximum value in an observable sequence according to the specified comparer.\n   * @example\n   * var res = source.max();\n   * var res = source.max(function (x, y) { return x.value - y.value; });\n   * @param {Function} [comparer] Comparer used to compare elements.\n   * @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.\n   */\n  observableProto.max = function (comparer) {\n    return this.maxBy(identity, comparer).map(function (x) { return firstOnly(x); });\n  };\n\n  var AverageObservable = (function (__super__) {\n    inherits(AverageObservable, __super__);\n    function AverageObservable(source, fn) {\n      this.source = source;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    AverageObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new AverageObserver(o, this._fn, this.source));\n    };\n\n    return AverageObservable;\n  }(ObservableBase));\n\n  var AverageObserver = (function(__super__) {\n    inherits(AverageObserver, __super__);\n    function AverageObserver(o, fn, s) {\n      this._o = o;\n      this._fn = fn;\n      this._s = s;\n      this._c = 0;\n      this._t = 0;\n      __super__.call(this);\n    }\n\n    AverageObserver.prototype.next = function (x) {\n      if(this._fn) {\n        var r = tryCatch(this._fn)(x, this._c++, this._s);\n        if (r === errorObj) { return this._o.onError(r.e); }\n        this._t += r;\n      } else {\n        this._c++;\n        this._t += x;\n      }\n    };\n    AverageObserver.prototype.error = function (e) { this._o.onError(e); };\n    AverageObserver.prototype.completed = function () {\n      if (this._c === 0) { return this._o.onError(new EmptyError()); }\n      this._o.onNext(this._t / this._c);\n      this._o.onCompleted();\n    };\n\n    return AverageObserver;\n  }(AbstractObserver));\n\n  /**\n   * Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.\n   * @param {Function} [selector] A transform function to apply to each element.\n   * @param {Any} [thisArg] Object to use as this when executing callback.\n   * @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.\n   */\n  observableProto.average = function (keySelector, thisArg) {\n    var source = this, fn;\n    if (isFunction(keySelector)) {\n      fn = bindCallback(keySelector, thisArg, 3);\n    }\n    return new AverageObservable(source, fn);\n  };\n\n  /**\n   *  Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.\n   *\n   * @example\n   * var res = res = source.sequenceEqual([1,2,3]);\n   * var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });\n   * 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));\n   * 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });\n   * @param {Observable} second Second observable sequence or array to compare.\n   * @param {Function} [comparer] Comparer used to compare elements of both sequences.\n   * @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.\n   */\n  observableProto.sequenceEqual = function (second, comparer) {\n    var first = this;\n    comparer || (comparer = defaultComparer);\n    return new AnonymousObservable(function (o) {\n      var donel = false, doner = false, ql = [], qr = [];\n      var subscription1 = first.subscribe(function (x) {\n        if (qr.length > 0) {\n          var v = qr.shift();\n          var equal = tryCatch(comparer)(v, x);\n          if (equal === errorObj) { return o.onError(equal.e); }\n          if (!equal) {\n            o.onNext(false);\n            o.onCompleted();\n          }\n        } else if (doner) {\n          o.onNext(false);\n          o.onCompleted();\n        } else {\n          ql.push(x);\n        }\n      }, function(e) { o.onError(e); }, function () {\n        donel = true;\n        if (ql.length === 0) {\n          if (qr.length > 0) {\n            o.onNext(false);\n            o.onCompleted();\n          } else if (doner) {\n            o.onNext(true);\n            o.onCompleted();\n          }\n        }\n      });\n\n      (isArrayLike(second) || isIterable(second)) && (second = observableFrom(second));\n      isPromise(second) && (second = observableFromPromise(second));\n      var subscription2 = second.subscribe(function (x) {\n        if (ql.length > 0) {\n          var v = ql.shift();\n          var equal = tryCatch(comparer)(v, x);\n          if (equal === errorObj) { return o.onError(equal.e); }\n          if (!equal) {\n            o.onNext(false);\n            o.onCompleted();\n          }\n        } else if (donel) {\n          o.onNext(false);\n          o.onCompleted();\n        } else {\n          qr.push(x);\n        }\n      }, function(e) { o.onError(e); }, function () {\n        doner = true;\n        if (qr.length === 0) {\n          if (ql.length > 0) {\n            o.onNext(false);\n            o.onCompleted();\n          } else if (donel) {\n            o.onNext(true);\n            o.onCompleted();\n          }\n        }\n      });\n      return new BinaryDisposable(subscription1, subscription2);\n    }, first);\n  };\n\n  var ElementAtObservable = (function (__super__) {\n    inherits(ElementAtObservable, __super__);\n    function ElementAtObservable(source, i, d) {\n      this.source = source;\n      this._i = i;\n      this._d = d;\n      __super__.call(this);\n    }\n\n    ElementAtObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new ElementAtObserver(o, this._i, this._d));\n    };\n\n    return ElementAtObservable;\n  }(ObservableBase));\n\n  var ElementAtObserver = (function (__super__) {\n    inherits(ElementAtObserver, __super__);\n\n    function ElementAtObserver(o, i, d) {\n      this._o = o;\n      this._i = i;\n      this._d = d;\n      __super__.call(this);\n    }\n\n    ElementAtObserver.prototype.next = function (x) {\n      if (this._i-- === 0) {\n        this._o.onNext(x);\n        this._o.onCompleted();\n      }\n    };\n    ElementAtObserver.prototype.error = function (e) { this._o.onError(e); };\n    ElementAtObserver.prototype.completed = function () {\n      if (this._d === undefined) {\n        this._o.onError(new ArgumentOutOfRangeError());\n      } else {\n        this._o.onNext(this._d);\n        this._o.onCompleted();\n      }\n    };\n\n    return ElementAtObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns the element at a specified index in a sequence or default value if not found.\n   * @param {Number} index The zero-based index of the element to retrieve.\n   * @param {Any} [defaultValue] The default value to use if elementAt does not find a value.\n   * @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.\n   */\n  observableProto.elementAt =  function (index, defaultValue) {\n    if (index < 0) { throw new ArgumentOutOfRangeError(); }\n    return new ElementAtObservable(this, index, defaultValue);\n  };\n\n  var SingleObserver = (function(__super__) {\n    inherits(SingleObserver, __super__);\n    function SingleObserver(o, obj, s) {\n      this._o = o;\n      this._obj = obj;\n      this._s = s;\n      this._i = 0;\n      this._hv = false;\n      this._v = null;\n      __super__.call(this);\n    }\n\n    SingleObserver.prototype.next = function (x) {\n      var shouldYield = false;\n      if (this._obj.predicate) {\n        var res = tryCatch(this._obj.predicate)(x, this._i++, this._s);\n        if (res === errorObj) { return this._o.onError(res.e); }\n        Boolean(res) && (shouldYield = true);\n      } else if (!this._obj.predicate) {\n        shouldYield = true;\n      }\n      if (shouldYield) {\n        if (this._hv) {\n          return this._o.onError(new Error('Sequence contains more than one matching element'));\n        }\n        this._hv = true;\n        this._v = x;\n      }\n    };\n    SingleObserver.prototype.error = function (e) { this._o.onError(e); };\n    SingleObserver.prototype.completed = function () {\n      if (this._hv) {\n        this._o.onNext(this._v);\n        this._o.onCompleted();\n      }\n      else if (this._obj.defaultValue === undefined) {\n        this._o.onError(new EmptyError());\n      } else {\n        this._o.onNext(this._obj.defaultValue);\n        this._o.onCompleted();\n      }\n    };\n\n    return SingleObserver;\n  }(AbstractObserver));\n\n\n    /**\n     * Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.\n     * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.\n     */\n    observableProto.single = function (predicate, thisArg) {\n      var obj = {}, source = this;\n      if (typeof arguments[0] === 'object') {\n        obj = arguments[0];\n      } else {\n        obj = {\n          predicate: arguments[0],\n          thisArg: arguments[1],\n          defaultValue: arguments[2]\n        };\n      }\n      if (isFunction (obj.predicate)) {\n        var fn = obj.predicate;\n        obj.predicate = bindCallback(fn, obj.thisArg, 3);\n      }\n      return new AnonymousObservable(function (o) {\n        return source.subscribe(new SingleObserver(o, obj, source));\n      }, source);\n    };\n\n  var FirstObservable = (function (__super__) {\n    inherits(FirstObservable, __super__);\n    function FirstObservable(source, obj) {\n      this.source = source;\n      this._obj = obj;\n      __super__.call(this);\n    }\n\n    FirstObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new FirstObserver(o, this._obj, this.source));\n    };\n\n    return FirstObservable;\n  }(ObservableBase));\n\n  var FirstObserver = (function(__super__) {\n    inherits(FirstObserver, __super__);\n    function FirstObserver(o, obj, s) {\n      this._o = o;\n      this._obj = obj;\n      this._s = s;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    FirstObserver.prototype.next = function (x) {\n      if (this._obj.predicate) {\n        var res = tryCatch(this._obj.predicate)(x, this._i++, this._s);\n        if (res === errorObj) { return this._o.onError(res.e); }\n        if (Boolean(res)) {\n          this._o.onNext(x);\n          this._o.onCompleted();\n        }\n      } else if (!this._obj.predicate) {\n        this._o.onNext(x);\n        this._o.onCompleted();\n      }\n    };\n    FirstObserver.prototype.error = function (e) { this._o.onError(e); };\n    FirstObserver.prototype.completed = function () {\n      if (this._obj.defaultValue === undefined) {\n        this._o.onError(new EmptyError());\n      } else {\n        this._o.onNext(this._obj.defaultValue);\n        this._o.onCompleted();\n      }\n    };\n\n    return FirstObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.\n   * @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.\n   */\n  observableProto.first = function () {\n    var obj = {}, source = this;\n    if (typeof arguments[0] === 'object') {\n      obj = arguments[0];\n    } else {\n      obj = {\n        predicate: arguments[0],\n        thisArg: arguments[1],\n        defaultValue: arguments[2]\n      };\n    }\n    if (isFunction (obj.predicate)) {\n      var fn = obj.predicate;\n      obj.predicate = bindCallback(fn, obj.thisArg, 3);\n    }\n    return new FirstObservable(this, obj);\n  };\n\n  var LastObservable = (function (__super__) {\n    inherits(LastObservable, __super__);\n    function LastObservable(source, obj) {\n      this.source = source;\n      this._obj = obj;\n      __super__.call(this);\n    }\n\n    LastObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new LastObserver(o, this._obj, this.source));\n    };\n\n    return LastObservable;\n  }(ObservableBase));\n\n  var LastObserver = (function(__super__) {\n    inherits(LastObserver, __super__);\n    function LastObserver(o, obj, s) {\n      this._o = o;\n      this._obj = obj;\n      this._s = s;\n      this._i = 0;\n      this._hv = false;\n      this._v = null;\n      __super__.call(this);\n    }\n\n    LastObserver.prototype.next = function (x) {\n      var shouldYield = false;\n      if (this._obj.predicate) {\n        var res = tryCatch(this._obj.predicate)(x, this._i++, this._s);\n        if (res === errorObj) { return this._o.onError(res.e); }\n        Boolean(res) && (shouldYield = true);\n      } else if (!this._obj.predicate) {\n        shouldYield = true;\n      }\n      if (shouldYield) {\n        this._hv = true;\n        this._v = x;\n      }\n    };\n    LastObserver.prototype.error = function (e) { this._o.onError(e); };\n    LastObserver.prototype.completed = function () {\n      if (this._hv) {\n        this._o.onNext(this._v);\n        this._o.onCompleted();\n      }\n      else if (this._obj.defaultValue === undefined) {\n        this._o.onError(new EmptyError());\n      } else {\n        this._o.onNext(this._obj.defaultValue);\n        this._o.onCompleted();\n      }\n    };\n\n    return LastObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.\n   * @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.\n   */\n  observableProto.last = function () {\n    var obj = {}, source = this;\n    if (typeof arguments[0] === 'object') {\n      obj = arguments[0];\n    } else {\n      obj = {\n        predicate: arguments[0],\n        thisArg: arguments[1],\n        defaultValue: arguments[2]\n      };\n    }\n    if (isFunction (obj.predicate)) {\n      var fn = obj.predicate;\n      obj.predicate = bindCallback(fn, obj.thisArg, 3);\n    }\n    return new LastObservable(this, obj);\n  };\n\n  var FindValueObserver = (function(__super__) {\n    inherits(FindValueObserver, __super__);\n    function FindValueObserver(observer, source, callback, yieldIndex) {\n      this._o = observer;\n      this._s = source;\n      this._cb = callback;\n      this._y = yieldIndex;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    FindValueObserver.prototype.next = function (x) {\n      var shouldRun = tryCatch(this._cb)(x, this._i, this._s);\n      if (shouldRun === errorObj) { return this._o.onError(shouldRun.e); }\n      if (shouldRun) {\n        this._o.onNext(this._y ? this._i : x);\n        this._o.onCompleted();\n      } else {\n        this._i++;\n      }\n    };\n\n    FindValueObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    FindValueObserver.prototype.completed = function () {\n      this._y && this._o.onNext(-1);\n      this._o.onCompleted();\n    };\n\n    return FindValueObserver;\n  }(AbstractObserver));\n\n  function findValue (source, predicate, thisArg, yieldIndex) {\n    var callback = bindCallback(predicate, thisArg, 3);\n    return new AnonymousObservable(function (o) {\n      return source.subscribe(new FindValueObserver(o, source, callback, yieldIndex));\n    }, source);\n  }\n\n  /**\n   * Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.\n   * @param {Function} predicate The predicate that defines the conditions of the element to search for.\n   * @param {Any} [thisArg] Object to use as `this` when executing the predicate.\n   * @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.\n   */\n  observableProto.find = function (predicate, thisArg) {\n    return findValue(this, predicate, thisArg, false);\n  };\n\n  /**\n   * Searches for an element that matches the conditions defined by the specified predicate, and returns\n   * an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.\n   * @param {Function} predicate The predicate that defines the conditions of the element to search for.\n   * @param {Any} [thisArg] Object to use as `this` when executing the predicate.\n   * @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.\n  */\n  observableProto.findIndex = function (predicate, thisArg) {\n    return findValue(this, predicate, thisArg, true);\n  };\n\n  var ToSetObservable = (function (__super__) {\n    inherits(ToSetObservable, __super__);\n    function ToSetObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    ToSetObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new ToSetObserver(o));\n    };\n\n    return ToSetObservable;\n  }(ObservableBase));\n\n  var ToSetObserver = (function (__super__) {\n    inherits(ToSetObserver, __super__);\n    function ToSetObserver(o) {\n      this._o = o;\n      this._s = new root.Set();\n      __super__.call(this);\n    }\n\n    ToSetObserver.prototype.next = function (x) {\n      this._s.add(x);\n    };\n\n    ToSetObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    ToSetObserver.prototype.completed = function () {\n      this._o.onNext(this._s);\n      this._o.onCompleted();\n    };\n\n    return ToSetObserver;\n  }(AbstractObserver));\n\n  /**\n   * Converts the observable sequence to a Set if it exists.\n   * @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.\n   */\n  observableProto.toSet = function () {\n    if (typeof root.Set === 'undefined') { throw new TypeError(); }\n    return new ToSetObservable(this);\n  };\n\n  var ToMapObservable = (function (__super__) {\n    inherits(ToMapObservable, __super__);\n    function ToMapObservable(source, k, e) {\n      this.source = source;\n      this._k = k;\n      this._e = e;\n      __super__.call(this);\n    }\n\n    ToMapObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new ToMapObserver(o, this._k, this._e));\n    };\n\n    return ToMapObservable;\n  }(ObservableBase));\n\n  var ToMapObserver = (function (__super__) {\n    inherits(ToMapObserver, __super__);\n    function ToMapObserver(o, k, e) {\n      this._o = o;\n      this._k = k;\n      this._e = e;\n      this._m = new root.Map();\n      __super__.call(this);\n    }\n\n    ToMapObserver.prototype.next = function (x) {\n      var key = tryCatch(this._k)(x);\n      if (key === errorObj) { return this._o.onError(key.e); }\n      var elem = x;\n      if (this._e) {\n        elem = tryCatch(this._e)(x);\n        if (elem === errorObj) { return this._o.onError(elem.e); }\n      }\n\n      this._m.set(key, elem);\n    };\n\n    ToMapObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    ToMapObserver.prototype.completed = function () {\n      this._o.onNext(this._m);\n      this._o.onCompleted();\n    };\n\n    return ToMapObserver;\n  }(AbstractObserver));\n\n  /**\n  * Converts the observable sequence to a Map if it exists.\n  * @param {Function} keySelector A function which produces the key for the Map.\n  * @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence.\n  * @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.\n  */\n  observableProto.toMap = function (keySelector, elementSelector) {\n    if (typeof root.Map === 'undefined') { throw new TypeError(); }\n    return new ToMapObservable(this, keySelector, elementSelector);\n  };\n\n  var SliceObservable = (function (__super__) {\n    inherits(SliceObservable, __super__);\n    function SliceObservable(source, b, e) {\n      this.source = source;\n      this._b = b;\n      this._e = e;\n      __super__.call(this);\n    }\n\n    SliceObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new SliceObserver(o, this._b, this._e));\n    };\n\n    return SliceObservable;\n  }(ObservableBase));\n\n  var SliceObserver = (function (__super__) {\n    inherits(SliceObserver, __super__);\n\n    function SliceObserver(o, b, e) {\n      this._o = o;\n      this._b = b;\n      this._e = e;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    SliceObserver.prototype.next = function (x) {\n      if (this._i >= this._b) {\n        if (this._e === this._i) {\n          this._o.onCompleted();\n        } else {\n          this._o.onNext(x);\n        }\n      }\n      this._i++;\n    };\n    SliceObserver.prototype.error = function (e) { this._o.onError(e); };\n    SliceObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return SliceObserver;\n  }(AbstractObserver));\n\n  /*\n  * The slice() method returns a shallow copy of a portion of an Observable into a new Observable object.\n  * Unlike the array version, this does not support negative numbers for being or end.\n  * @param {Number} [begin] Zero-based index at which to begin extraction. If omitted, this will default to zero.\n  * @param {Number} [end] Zero-based index at which to end extraction. slice extracts up to but not including end.\n  * If omitted, this will emit the rest of the Observable object.\n  * @returns {Observable} A shallow copy of a portion of an Observable into a new Observable object.\n  */\n  observableProto.slice = function (begin, end) {\n    var start = begin || 0;\n    if (start < 0) { throw new Rx.ArgumentOutOfRangeError(); }\n    if (typeof end === 'number' && end < start) {\n      throw new Rx.ArgumentOutOfRangeError();\n    }\n    return new SliceObservable(this, start, end);\n  };\n\n  var LastIndexOfObservable = (function (__super__) {\n    inherits(LastIndexOfObservable, __super__);\n    function LastIndexOfObservable(source, e, n) {\n      this.source = source;\n      this._e = e;\n      this._n = n;\n      __super__.call(this);\n    }\n\n    LastIndexOfObservable.prototype.subscribeCore = function (o) {\n      if (this._n < 0) {\n        o.onNext(-1);\n        o.onCompleted();\n        return disposableEmpty;\n      }\n\n      return this.source.subscribe(new LastIndexOfObserver(o, this._e, this._n));\n    };\n\n    return LastIndexOfObservable;\n  }(ObservableBase));\n\n  var LastIndexOfObserver = (function (__super__) {\n    inherits(LastIndexOfObserver, __super__);\n    function LastIndexOfObserver(o, e, n) {\n      this._o = o;\n      this._e = e;\n      this._n = n;\n      this._v = 0;\n      this._hv = false;\n      this._i = 0;\n      __super__.call(this);\n    }\n\n    LastIndexOfObserver.prototype.next = function (x) {\n      if (this._i >= this._n && x === this._e) {\n        this._hv = true;\n        this._v = this._i;\n      }\n      this._i++;\n    };\n    LastIndexOfObserver.prototype.error = function (e) { this._o.onError(e); };\n    LastIndexOfObserver.prototype.completed = function () {\n      if (this._hv) {\n        this._o.onNext(this._v);\n      } else {\n        this._o.onNext(-1);\n      }\n      this._o.onCompleted();\n    };\n\n    return LastIndexOfObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns the last index at which a given element can be found in the observable sequence, or -1 if it is not present.\n   * @param {Any} searchElement Element to locate in the array.\n   * @param {Number} [fromIndex] The index to start the search.  If not specified, defaults to 0.\n   * @returns {Observable} And observable sequence containing the last index at which a given element can be found in the observable sequence, or -1 if it is not present.\n   */\n  observableProto.lastIndexOf = function(searchElement, fromIndex) {\n    var n = +fromIndex || 0;\n    Math.abs(n) === Infinity && (n = 0);\n    return new LastIndexOfObservable(this, searchElement, n);\n  };\n\n  Observable.wrap = function (fn) {\n    function createObservable() {\n      return Observable.spawn.call(this, fn.apply(this, arguments));\n    }\n\n    createObservable.__generatorFunction__ = fn;\n    return createObservable;\n  };\n\n  var spawn = Observable.spawn = function () {\n    var gen = arguments[0], self = this, args = [];\n    for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\n\n    return new AnonymousObservable(function (o) {\n      var g = new CompositeDisposable();\n\n      if (isFunction(gen)) { gen = gen.apply(self, args); }\n      if (!gen || !isFunction(gen.next)) {\n        o.onNext(gen);\n        return o.onCompleted();\n      }\n\n      function processGenerator(res) {\n        var ret = tryCatch(gen.next).call(gen, res);\n        if (ret === errorObj) { return o.onError(ret.e); }\n        next(ret);\n      }\n\n      processGenerator();\n\n      function onError(err) {\n        var ret = tryCatch(gen.next).call(gen, err);\n        if (ret === errorObj) { return o.onError(ret.e); }\n        next(ret);\n      }\n\n      function next(ret) {\n        if (ret.done) {\n          o.onNext(ret.value);\n          o.onCompleted();\n          return;\n        }\n        var obs = toObservable.call(self, ret.value);\n        var value = null;\n        var hasValue = false;\n        if (Observable.isObservable(obs)) {\n          g.add(obs.subscribe(function(val) {\n            hasValue = true;\n            value = val;\n          }, onError, function() {\n            hasValue && processGenerator(value);\n          }));\n        } else {\n          onError(new TypeError('type not supported'));\n        }\n      }\n\n      return g;\n    });\n  };\n\n  function toObservable(obj) {\n    if (!obj) { return obj; }\n    if (Observable.isObservable(obj)) { return obj; }\n    if (isPromise(obj)) { return Observable.fromPromise(obj); }\n    if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }\n    if (isFunction(obj)) { return thunkToObservable.call(this, obj); }\n    if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }\n    if (isObject(obj)) {return objectToObservable.call(this, obj);}\n    return obj;\n  }\n\n  function arrayToObservable (obj) {\n    return Observable.from(obj).concatMap(function(o) {\n      if(Observable.isObservable(o) || isObject(o)) {\n        return toObservable.call(null, o);\n      } else {\n        return Rx.Observable.just(o);\n      }\n    }).toArray();\n  }\n\n  function objectToObservable (obj) {\n    var results = new obj.constructor(), keys = Object.keys(obj), observables = [];\n    for (var i = 0, len = keys.length; i < len; i++) {\n      var key = keys[i];\n      var observable = toObservable.call(this, obj[key]);\n\n      if(observable && Observable.isObservable(observable)) {\n        defer(observable, key);\n      } else {\n        results[key] = obj[key];\n      }\n    }\n\n    return Observable.forkJoin.apply(Observable, observables).map(function() {\n      return results;\n    });\n\n\n    function defer (observable, key) {\n      results[key] = undefined;\n      observables.push(observable.map(function (next) {\n        results[key] = next;\n      }));\n    }\n  }\n\n  function thunkToObservable(fn) {\n    var self = this;\n    return new AnonymousObservable(function (o) {\n      fn.call(self, function () {\n        var err = arguments[0], res = arguments[1];\n        if (err) { return o.onError(err); }\n        if (arguments.length > 2) {\n          var args = [];\n          for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\n          res = args;\n        }\n        o.onNext(res);\n        o.onCompleted();\n      });\n    });\n  }\n\n  function isGenerator(obj) {\n    return isFunction (obj.next) && isFunction (obj['throw']);\n  }\n\n  function isGeneratorFunction(obj) {\n    var ctor = obj.constructor;\n    if (!ctor) { return false; }\n    if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }\n    return isGenerator(ctor.prototype);\n  }\n\n  function isObject(val) {\n    return Object == val.constructor;\n  }\n\n  /**\n   * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.\n   *\n   * @example\n   * var res = Rx.Observable.start(function () { console.log('hello'); });\n   * var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);\n   * var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);\n   *\n   * @param {Function} func Function to run asynchronously.\n   * @param {Scheduler} [scheduler]  Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.\n   * @param [context]  The context for the func parameter to be executed.  If not specified, defaults to undefined.\n   * @returns {Observable} An observable sequence exposing the function's result value, or an exception.\n   *\n   * Remarks\n   * * The function is called immediately, not during the subscription of the resulting sequence.\n   * * Multiple subscriptions to the resulting sequence can observe the function's result.\n   */\n  Observable.start = function (func, context, scheduler) {\n    return observableToAsync(func, context, scheduler)();\n  };\n\n  /**\n   * Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.\n   * @param {Function} function Function to convert to an asynchronous function.\n   * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.\n   * @param {Mixed} [context] The context for the func parameter to be executed.  If not specified, defaults to undefined.\n   * @returns {Function} Asynchronous function.\n   */\n  var observableToAsync = Observable.toAsync = function (func, context, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return function () {\n      var args = arguments,\n        subject = new AsyncSubject();\n\n      scheduler.schedule(null, function () {\n        var result;\n        try {\n          result = func.apply(context, args);\n        } catch (e) {\n          subject.onError(e);\n          return;\n        }\n        subject.onNext(result);\n        subject.onCompleted();\n      });\n      return subject.asObservable();\n    };\n  };\n\nfunction createCbObservable(fn, ctx, selector, args) {\n  var o = new AsyncSubject();\n\n  args.push(createCbHandler(o, ctx, selector));\n  fn.apply(ctx, args);\n\n  return o.asObservable();\n}\n\nfunction createCbHandler(o, ctx, selector) {\n  return function handler () {\n    var len = arguments.length, results = new Array(len);\n    for(var i = 0; i < len; i++) { results[i] = arguments[i]; }\n\n    if (isFunction(selector)) {\n      results = tryCatch(selector).apply(ctx, results);\n      if (results === errorObj) { return o.onError(results.e); }\n      o.onNext(results);\n    } else {\n      if (results.length <= 1) {\n        o.onNext(results[0]);\n      } else {\n        o.onNext(results);\n      }\n    }\n\n    o.onCompleted();\n  };\n}\n\n/**\n * Converts a callback function to an observable sequence.\n *\n * @param {Function} fn Function with a callback as the last parameter to convert to an Observable sequence.\n * @param {Mixed} [ctx] The context for the func parameter to be executed.  If not specified, defaults to undefined.\n * @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.\n * @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.\n */\nObservable.fromCallback = function (fn, ctx, selector) {\n  return function () {\n    typeof ctx === 'undefined' && (ctx = this); \n\n    var len = arguments.length, args = new Array(len)\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    return createCbObservable(fn, ctx, selector, args);\n  };\n};\n\nfunction createNodeObservable(fn, ctx, selector, args) {\n  var o = new AsyncSubject();\n\n  args.push(createNodeHandler(o, ctx, selector));\n  fn.apply(ctx, args);\n\n  return o.asObservable();\n}\n\nfunction createNodeHandler(o, ctx, selector) {\n  return function handler () {\n    var err = arguments[0];\n    if (err) { return o.onError(err); }\n\n    var len = arguments.length, results = [];\n    for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }\n\n    if (isFunction(selector)) {\n      var results = tryCatch(selector).apply(ctx, results);\n      if (results === errorObj) { return o.onError(results.e); }\n      o.onNext(results);\n    } else {\n      if (results.length <= 1) {\n        o.onNext(results[0]);\n      } else {\n        o.onNext(results);\n      }\n    }\n\n    o.onCompleted();\n  };\n}\n\n/**\n * Converts a Node.js callback style function to an observable sequence.  This must be in function (err, ...) format.\n * @param {Function} fn The function to call\n * @param {Mixed} [ctx] The context for the func parameter to be executed.  If not specified, defaults to undefined.\n * @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.\n * @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.\n */\nObservable.fromNodeCallback = function (fn, ctx, selector) {\n  return function () {\n    typeof ctx === 'undefined' && (ctx = this); \n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    return createNodeObservable(fn, ctx, selector, args);\n  };\n};\n\n  function isNodeList(el) {\n    if (root.StaticNodeList) {\n      // IE8 Specific\n      // instanceof is slower than Object#toString, but Object#toString will not work as intended in IE8\n      return el instanceof root.StaticNodeList || el instanceof root.NodeList;\n    } else {\n      return Object.prototype.toString.call(el) === '[object NodeList]';\n    }\n  }\n\n  function ListenDisposable(e, n, fn) {\n    this._e = e;\n    this._n = n;\n    this._fn = fn;\n    this._e.addEventListener(this._n, this._fn, false);\n    this.isDisposed = false;\n  }\n  ListenDisposable.prototype.dispose = function () {\n    if (!this.isDisposed) {\n      this._e.removeEventListener(this._n, this._fn, false);\n      this.isDisposed = true;\n    }\n  };\n\n  function createEventListener (el, eventName, handler) {\n    var disposables = new CompositeDisposable();\n\n    // Asume NodeList or HTMLCollection\n    var elemToString = Object.prototype.toString.call(el);\n    if (isNodeList(el) || elemToString === '[object HTMLCollection]') {\n      for (var i = 0, len = el.length; i < len; i++) {\n        disposables.add(createEventListener(el.item(i), eventName, handler));\n      }\n    } else if (el) {\n      disposables.add(new ListenDisposable(el, eventName, handler));\n    }\n\n    return disposables;\n  }\n\n  /**\n   * Configuration option to determine whether to use native events only\n   */\n  Rx.config.useNativeEvents = false;\n\n  var EventObservable = (function(__super__) {\n    inherits(EventObservable, __super__);\n    function EventObservable(el, name, fn) {\n      this._el = el;\n      this._n = name;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    function createHandler(o, fn) {\n      return function handler () {\n        var results = arguments[0];\n        if (isFunction(fn)) {\n          results = tryCatch(fn).apply(null, arguments);\n          if (results === errorObj) { return o.onError(results.e); }\n        }\n        o.onNext(results);\n      };\n    }\n\n    EventObservable.prototype.subscribeCore = function (o) {\n      return createEventListener(\n        this._el,\n        this._n,\n        createHandler(o, this._fn));\n    };\n\n    return EventObservable;\n  }(ObservableBase));\n\n  /**\n   * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.\n   * @param {Object} element The DOMElement or NodeList to attach a listener.\n   * @param {String} eventName The event name to attach the observable sequence.\n   * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.\n   * @returns {Observable} An observable sequence of events from the specified element and the specified event.\n   */\n  Observable.fromEvent = function (element, eventName, selector) {\n    // Node.js specific\n    if (element.addListener) {\n      return fromEventPattern(\n        function (h) { element.addListener(eventName, h); },\n        function (h) { element.removeListener(eventName, h); },\n        selector);\n    }\n\n    // Use only if non-native events are allowed\n    if (!Rx.config.useNativeEvents) {\n      // Handles jq, Angular.js, Zepto, Marionette, Ember.js\n      if (typeof element.on === 'function' && typeof element.off === 'function') {\n        return fromEventPattern(\n          function (h) { element.on(eventName, h); },\n          function (h) { element.off(eventName, h); },\n          selector);\n      }\n    }\n\n    return new EventObservable(element, eventName, selector).publish().refCount();\n  };\n\n  var EventPatternObservable = (function(__super__) {\n    inherits(EventPatternObservable, __super__);\n    function EventPatternObservable(add, del, fn) {\n      this._add = add;\n      this._del = del;\n      this._fn = fn;\n      __super__.call(this);\n    }\n\n    function createHandler(o, fn) {\n      return function handler () {\n        var results = arguments[0];\n        if (isFunction(fn)) {\n          results = tryCatch(fn).apply(null, arguments);\n          if (results === errorObj) { return o.onError(results.e); }\n        }\n        o.onNext(results);\n      };\n    }\n\n    EventPatternObservable.prototype.subscribeCore = function (o) {\n      var fn = createHandler(o, this._fn);\n      var returnValue = this._add(fn);\n      return new EventPatternDisposable(this._del, fn, returnValue);\n    };\n\n    function EventPatternDisposable(del, fn, ret) {\n      this._del = del;\n      this._fn = fn;\n      this._ret = ret;\n      this.isDisposed = false;\n    }\n\n    EventPatternDisposable.prototype.dispose = function () {\n      if(!this.isDisposed) {\n        isFunction(this._del) && this._del(this._fn, this._ret);\n      }\n    };\n\n    return EventPatternObservable;\n  }(ObservableBase));\n\n  /**\n   * Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.\n   * @param {Function} addHandler The function to add a handler to the emitter.\n   * @param {Function} [removeHandler] The optional function to remove a handler from an emitter.\n   * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.\n   * @returns {Observable} An observable sequence which wraps an event from an event emitter\n   */\n  var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {\n    return new EventPatternObservable(addHandler, removeHandler, selector).publish().refCount();\n  };\n\n  /**\n   * Invokes the asynchronous function, surfacing the result through an observable sequence.\n   * @param {Function} functionAsync Asynchronous function which returns a Promise to run.\n   * @returns {Observable} An observable sequence exposing the function's result value, or an exception.\n   */\n  Observable.startAsync = function (functionAsync) {\n    var promise = tryCatch(functionAsync)();\n    if (promise === errorObj) { return observableThrow(promise.e); }\n    return observableFromPromise(promise);\n  };\n\n  var PausableObservable = (function (__super__) {\n    inherits(PausableObservable, __super__);\n    function PausableObservable(source, pauser) {\n      this.source = source;\n      this.controller = new Subject();\n\n      if (pauser && pauser.subscribe) {\n        this.pauser = this.controller.merge(pauser);\n      } else {\n        this.pauser = this.controller;\n      }\n\n      __super__.call(this);\n    }\n\n    PausableObservable.prototype._subscribe = function (o) {\n      var conn = this.source.publish(),\n        subscription = conn.subscribe(o),\n        connection = disposableEmpty;\n\n      var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {\n        if (b) {\n          connection = conn.connect();\n        } else {\n          connection.dispose();\n          connection = disposableEmpty;\n        }\n      });\n\n      return new NAryDisposable([subscription, connection, pausable]);\n    };\n\n    PausableObservable.prototype.pause = function () {\n      this.controller.onNext(false);\n    };\n\n    PausableObservable.prototype.resume = function () {\n      this.controller.onNext(true);\n    };\n\n    return PausableObservable;\n\n  }(Observable));\n\n  /**\n   * Pauses the underlying observable sequence based upon the observable sequence which yields true/false.\n   * @example\n   * var pauser = new Rx.Subject();\n   * var source = Rx.Observable.interval(100).pausable(pauser);\n   * @param {Observable} pauser The observable sequence used to pause the underlying sequence.\n   * @returns {Observable} The observable sequence which is paused based upon the pauser.\n   */\n  observableProto.pausable = function (pauser) {\n    return new PausableObservable(this, pauser);\n  };\n\n  function combineLatestSource(source, subject, resultSelector) {\n    return new AnonymousObservable(function (o) {\n      var hasValue = [false, false],\n        hasValueAll = false,\n        isDone = false,\n        values = new Array(2),\n        err;\n\n      function next(x, i) {\n        values[i] = x;\n        hasValue[i] = true;\n        if (hasValueAll || (hasValueAll = hasValue.every(identity))) {\n          if (err) { return o.onError(err); }\n          var res = tryCatch(resultSelector).apply(null, values);\n          if (res === errorObj) { return o.onError(res.e); }\n          o.onNext(res);\n        }\n        isDone && values[1] && o.onCompleted();\n      }\n\n      return new BinaryDisposable(\n        source.subscribe(\n          function (x) {\n            next(x, 0);\n          },\n          function (e) {\n            if (values[1]) {\n              o.onError(e);\n            } else {\n              err = e;\n            }\n          },\n          function () {\n            isDone = true;\n            values[1] && o.onCompleted();\n          }),\n        subject.subscribe(\n          function (x) {\n            next(x, 1);\n          },\n          function (e) { o.onError(e); },\n          function () {\n            isDone = true;\n            next(true, 1);\n          })\n        );\n    }, source);\n  }\n\n  var PausableBufferedObservable = (function (__super__) {\n    inherits(PausableBufferedObservable, __super__);\n    function PausableBufferedObservable(source, pauser) {\n      this.source = source;\n      this.controller = new Subject();\n\n      if (pauser && pauser.subscribe) {\n        this.pauser = this.controller.merge(pauser);\n      } else {\n        this.pauser = this.controller;\n      }\n\n      __super__.call(this);\n    }\n\n    PausableBufferedObservable.prototype._subscribe = function (o) {\n      var q = [], previousShouldFire;\n\n      function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }\n\n      var subscription =\n        combineLatestSource(\n          this.source,\n          this.pauser.startWith(false).distinctUntilChanged(),\n          function (data, shouldFire) {\n            return { data: data, shouldFire: shouldFire };\n          })\n          .subscribe(\n            function (results) {\n              if (previousShouldFire !== undefined && results.shouldFire !== previousShouldFire) {\n                previousShouldFire = results.shouldFire;\n                // change in shouldFire\n                if (results.shouldFire) { drainQueue(); }\n              } else {\n                previousShouldFire = results.shouldFire;\n                // new data\n                if (results.shouldFire) {\n                  o.onNext(results.data);\n                } else {\n                  q.push(results.data);\n                }\n              }\n            },\n            function (err) {\n              drainQueue();\n              o.onError(err);\n            },\n            function () {\n              drainQueue();\n              o.onCompleted();\n            }\n          );\n      return subscription;      \n    };\n\n    PausableBufferedObservable.prototype.pause = function () {\n      this.controller.onNext(false);\n    };\n\n    PausableBufferedObservable.prototype.resume = function () {\n      this.controller.onNext(true);\n    };\n\n    return PausableBufferedObservable;\n\n  }(Observable));\n\n  /**\n   * Pauses the underlying observable sequence based upon the observable sequence which yields true/false,\n   * and yields the values that were buffered while paused.\n   * @example\n   * var pauser = new Rx.Subject();\n   * var source = Rx.Observable.interval(100).pausableBuffered(pauser);\n   * @param {Observable} pauser The observable sequence used to pause the underlying sequence.\n   * @returns {Observable} The observable sequence which is paused based upon the pauser.\n   */\n  observableProto.pausableBuffered = function (pauser) {\n    return new PausableBufferedObservable(this, pauser);\n  };\n\n  var ControlledObservable = (function (__super__) {\n    inherits(ControlledObservable, __super__);\n    function ControlledObservable (source, enableQueue, scheduler) {\n      __super__.call(this);\n      this.subject = new ControlledSubject(enableQueue, scheduler);\n      this.source = source.multicast(this.subject).refCount();\n    }\n\n    ControlledObservable.prototype._subscribe = function (o) {\n      return this.source.subscribe(o);\n    };\n\n    ControlledObservable.prototype.request = function (numberOfItems) {\n      return this.subject.request(numberOfItems == null ? -1 : numberOfItems);\n    };\n\n    return ControlledObservable;\n\n  }(Observable));\n\n  var ControlledSubject = (function (__super__) {\n    inherits(ControlledSubject, __super__);\n    function ControlledSubject(enableQueue, scheduler) {\n      enableQueue == null && (enableQueue = true);\n\n      __super__.call(this);\n      this.subject = new Subject();\n      this.enableQueue = enableQueue;\n      this.queue = enableQueue ? [] : null;\n      this.requestedCount = 0;\n      this.requestedDisposable = null;\n      this.error = null;\n      this.hasFailed = false;\n      this.hasCompleted = false;\n      this.scheduler = scheduler || currentThreadScheduler;\n    }\n\n    addProperties(ControlledSubject.prototype, Observer, {\n      _subscribe: function (o) {\n        return this.subject.subscribe(o);\n      },\n      onCompleted: function () {\n        this.hasCompleted = true;\n        if (!this.enableQueue || this.queue.length === 0) {\n          this.subject.onCompleted();\n          this.disposeCurrentRequest();\n        } else {\n          this.queue.push(Notification.createOnCompleted());\n        }\n      },\n      onError: function (error) {\n        this.hasFailed = true;\n        this.error = error;\n        if (!this.enableQueue || this.queue.length === 0) {\n          this.subject.onError(error);\n          this.disposeCurrentRequest();\n        } else {\n          this.queue.push(Notification.createOnError(error));\n        }\n      },\n      onNext: function (value) {\n        if (this.requestedCount <= 0) {\n          this.enableQueue && this.queue.push(Notification.createOnNext(value));\n        } else {\n          (this.requestedCount-- === 0) && this.disposeCurrentRequest();\n          this.subject.onNext(value);\n        }\n      },\n      _processRequest: function (numberOfItems) {\n        if (this.enableQueue) {\n          while (this.queue.length > 0 && (numberOfItems > 0 || this.queue[0].kind !== 'N')) {\n            var first = this.queue.shift();\n            first.accept(this.subject);\n            if (first.kind === 'N') {\n              numberOfItems--;\n            } else {\n              this.disposeCurrentRequest();\n              this.queue = [];\n            }\n          }\n        }\n\n        return numberOfItems;\n      },\n      request: function (number) {\n        this.disposeCurrentRequest();\n        var self = this;\n\n        this.requestedDisposable = this.scheduler.schedule(number,\n        function(s, i) {\n          var remaining = self._processRequest(i);\n          var stopped = self.hasCompleted || self.hasFailed;\n          if (!stopped && remaining > 0) {\n            self.requestedCount = remaining;\n\n            return disposableCreate(function () {\n              self.requestedCount = 0;\n            });\n              // Scheduled item is still in progress. Return a new\n              // disposable to allow the request to be interrupted\n              // via dispose.\n          }\n        });\n\n        return this.requestedDisposable;\n      },\n      disposeCurrentRequest: function () {\n        if (this.requestedDisposable) {\n          this.requestedDisposable.dispose();\n          this.requestedDisposable = null;\n        }\n      }\n    });\n\n    return ControlledSubject;\n  }(Observable));\n\n  /**\n   * Attaches a controller to the observable sequence with the ability to queue.\n   * @example\n   * var source = Rx.Observable.interval(100).controlled();\n   * source.request(3); // Reads 3 values\n   * @param {bool} enableQueue truthy value to determine if values should be queued pending the next request\n   * @param {Scheduler} scheduler determines how the requests will be scheduled\n   * @returns {Observable} The observable sequence which only propagates values on request.\n   */\n  observableProto.controlled = function (enableQueue, scheduler) {\n\n    if (enableQueue && isScheduler(enableQueue)) {\n      scheduler = enableQueue;\n      enableQueue = true;\n    }\n\n    if (enableQueue == null) {  enableQueue = true; }\n    return new ControlledObservable(this, enableQueue, scheduler);\n  };\n\n  var StopAndWaitObservable = (function (__super__) {\n    inherits(StopAndWaitObservable, __super__);\n    function StopAndWaitObservable (source) {\n      __super__.call(this);\n      this.source = source;\n    }\n\n    function scheduleMethod(s, self) {\n      self.source.request(1);\n    }\n\n    StopAndWaitObservable.prototype._subscribe = function (o) {\n      this.subscription = this.source.subscribe(new StopAndWaitObserver(o, this, this.subscription));\n      return new BinaryDisposable(\n        this.subscription,\n        defaultScheduler.schedule(this, scheduleMethod)\n      );\n    };\n\n    var StopAndWaitObserver = (function (__sub__) {\n      inherits(StopAndWaitObserver, __sub__);\n      function StopAndWaitObserver (observer, observable, cancel) {\n        __sub__.call(this);\n        this.observer = observer;\n        this.observable = observable;\n        this.cancel = cancel;\n        this.scheduleDisposable = null;\n      }\n\n      StopAndWaitObserver.prototype.completed = function () {\n        this.observer.onCompleted();\n        this.dispose();\n      };\n\n      StopAndWaitObserver.prototype.error = function (error) {\n        this.observer.onError(error);\n        this.dispose();\n      };\n\n      function innerScheduleMethod(s, self) {\n        self.observable.source.request(1);\n      }\n\n      StopAndWaitObserver.prototype.next = function (value) {\n        this.observer.onNext(value);\n        this.scheduleDisposable = defaultScheduler.schedule(this, innerScheduleMethod);\n      };\n\n      StopAndWaitObservable.dispose = function () {\n        this.observer = null;\n        if (this.cancel) {\n          this.cancel.dispose();\n          this.cancel = null;\n        }\n        if (this.scheduleDisposable) {\n          this.scheduleDisposable.dispose();\n          this.scheduleDisposable = null;\n        }\n        __sub__.prototype.dispose.call(this);\n      };\n\n      return StopAndWaitObserver;\n    }(AbstractObserver));\n\n    return StopAndWaitObservable;\n  }(Observable));\n\n\n  /**\n   * Attaches a stop and wait observable to the current observable.\n   * @returns {Observable} A stop and wait observable.\n   */\n  ControlledObservable.prototype.stopAndWait = function () {\n    return new StopAndWaitObservable(this);\n  };\n\n  var WindowedObservable = (function (__super__) {\n    inherits(WindowedObservable, __super__);\n    function WindowedObservable(source, windowSize) {\n      __super__.call(this);\n      this.source = source;\n      this.windowSize = windowSize;\n    }\n\n    function scheduleMethod(s, self) {\n      self.source.request(self.windowSize);\n    }\n\n    WindowedObservable.prototype._subscribe = function (o) {\n      this.subscription = this.source.subscribe(new WindowedObserver(o, this, this.subscription));\n      return new BinaryDisposable(\n        this.subscription,\n        defaultScheduler.schedule(this, scheduleMethod)\n      );\n    };\n\n    var WindowedObserver = (function (__sub__) {\n      inherits(WindowedObserver, __sub__);\n      function WindowedObserver(observer, observable, cancel) {\n        this.observer = observer;\n        this.observable = observable;\n        this.cancel = cancel;\n        this.received = 0;\n        this.scheduleDisposable = null;\n        __sub__.call(this);\n      }\n\n      WindowedObserver.prototype.completed = function () {\n        this.observer.onCompleted();\n        this.dispose();\n      };\n\n      WindowedObserver.prototype.error = function (error) {\n        this.observer.onError(error);\n        this.dispose();\n      };\n\n      function innerScheduleMethod(s, self) {\n        self.observable.source.request(self.observable.windowSize);\n      }\n\n      WindowedObserver.prototype.next = function (value) {\n        this.observer.onNext(value);\n        this.received = ++this.received % this.observable.windowSize;\n        this.received === 0 && (this.scheduleDisposable = defaultScheduler.schedule(this, innerScheduleMethod));\n      };\n\n      WindowedObserver.prototype.dispose = function () {\n        this.observer = null;\n        if (this.cancel) {\n          this.cancel.dispose();\n          this.cancel = null;\n        }\n        if (this.scheduleDisposable) {\n          this.scheduleDisposable.dispose();\n          this.scheduleDisposable = null;\n        }\n        __sub__.prototype.dispose.call(this);\n      };\n\n      return WindowedObserver;\n    }(AbstractObserver));\n\n    return WindowedObservable;\n  }(Observable));\n\n  /**\n   * Creates a sliding windowed observable based upon the window size.\n   * @param {Number} windowSize The number of items in the window\n   * @returns {Observable} A windowed observable based upon the window size.\n   */\n  ControlledObservable.prototype.windowed = function (windowSize) {\n    return new WindowedObservable(this, windowSize);\n  };\n\n  /**\n   * Pipes the existing Observable sequence into a Node.js Stream.\n   * @param {Stream} dest The destination Node.js stream.\n   * @returns {Stream} The destination stream.\n   */\n  observableProto.pipe = function (dest) {\n    var source = this.pausableBuffered();\n\n    function onDrain() {\n      source.resume();\n    }\n\n    dest.addListener('drain', onDrain);\n\n    source.subscribe(\n      function (x) {\n        !dest.write(String(x)) && source.pause();\n      },\n      function (err) {\n        dest.emit('error', err);\n      },\n      function () {\n        // Hack check because STDIO is not closable\n        !dest._isStdio && dest.end();\n        dest.removeListener('drain', onDrain);\n      });\n\n    source.resume();\n\n    return dest;\n  };\n\n  var MulticastObservable = (function (__super__) {\n    inherits(MulticastObservable, __super__);\n    function MulticastObservable(source, fn1, fn2) {\n      this.source = source;\n      this._fn1 = fn1;\n      this._fn2 = fn2;\n      __super__.call(this);\n    }\n\n    MulticastObservable.prototype.subscribeCore = function (o) {\n      var connectable = this.source.multicast(this._fn1());\n      return new BinaryDisposable(this._fn2(connectable).subscribe(o), connectable.connect());\n    };\n\n    return MulticastObservable;\n  }(ObservableBase));\n\n  /**\n   * Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each\n   * subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's\n   * invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.\n   *\n   * @example\n   * 1 - res = source.multicast(observable);\n   * 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });\n   *\n   * @param {Function|Subject} subjectOrSubjectSelector\n   * Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.\n   * Or:\n   * Subject to push source elements into.\n   *\n   * @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name=\"subjectOrSubjectSelector\" is a factory function.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\n   */\n  observableProto.multicast = function (subjectOrSubjectSelector, selector) {\n    return isFunction(subjectOrSubjectSelector) ?\n      new MulticastObservable(this, subjectOrSubjectSelector, selector) :\n      new ConnectableObservable(this, subjectOrSubjectSelector);\n  };\n\n  /**\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.\n   * This operator is a specialization of Multicast using a regular Subject.\n   *\n   * @example\n   * var resres = source.publish();\n   * var res = source.publish(function (x) { return x; });\n   *\n   * @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\n   */\n  observableProto.publish = function (selector) {\n    return selector && isFunction(selector) ?\n      this.multicast(function () { return new Subject(); }, selector) :\n      this.multicast(new Subject());\n  };\n\n  /**\n   * Returns an observable sequence that shares a single subscription to the underlying sequence.\n   * This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\n   */\n  observableProto.share = function () {\n    return this.publish().refCount();\n  };\n\n  /**\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.\n   * This operator is a specialization of Multicast using a AsyncSubject.\n   *\n   * @example\n   * var res = source.publishLast();\n   * var res = source.publishLast(function (x) { return x; });\n   *\n   * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\n   */\n  observableProto.publishLast = function (selector) {\n    return selector && isFunction(selector) ?\n      this.multicast(function () { return new AsyncSubject(); }, selector) :\n      this.multicast(new AsyncSubject());\n  };\n\n  /**\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.\n   * This operator is a specialization of Multicast using a BehaviorSubject.\n   *\n   * @example\n   * var res = source.publishValue(42);\n   * var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);\n   *\n   * @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.\n   * @param {Mixed} initialValue Initial value received by observers upon subscription.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\n   */\n  observableProto.publishValue = function (initialValueOrSelector, initialValue) {\n    return arguments.length === 2 ?\n      this.multicast(function () {\n        return new BehaviorSubject(initialValue);\n      }, initialValueOrSelector) :\n      this.multicast(new BehaviorSubject(initialValueOrSelector));\n  };\n\n  /**\n   * Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.\n   * This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.\n   * @param {Mixed} initialValue Initial value received by observers upon subscription.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\n   */\n  observableProto.shareValue = function (initialValue) {\n    return this.publishValue(initialValue).refCount();\n  };\n\n  /**\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.\n   * This operator is a specialization of Multicast using a ReplaySubject.\n   *\n   * @example\n   * var res = source.replay(null, 3);\n   * var res = source.replay(null, 3, 500);\n   * var res = source.replay(null, 3, 500, scheduler);\n   * var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);\n   *\n   * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.\n   * @param bufferSize [Optional] Maximum element count of the replay buffer.\n   * @param windowSize [Optional] Maximum time length of the replay buffer.\n   * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\n   */\n  observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {\n    return selector && isFunction(selector) ?\n      this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :\n      this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));\n  };\n\n  /**\n   * Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.\n   * This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.\n   *\n   * @example\n   * var res = source.shareReplay(3);\n   * var res = source.shareReplay(3, 500);\n   * var res = source.shareReplay(3, 500, scheduler);\n   *\n\n   * @param bufferSize [Optional] Maximum element count of the replay buffer.\n   * @param window [Optional] Maximum time length of the replay buffer.\n   * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\n   */\n  observableProto.shareReplay = function (bufferSize, windowSize, scheduler) {\n    return this.replay(null, bufferSize, windowSize, scheduler).refCount();\n  };\n\n  var InnerSubscription = function (s, o) {\n    this._s = s;\n    this._o = o;\n  };\n\n  InnerSubscription.prototype.dispose = function () {\n    if (!this._s.isDisposed && this._o !== null) {\n      var idx = this._s.observers.indexOf(this._o);\n      this._s.observers.splice(idx, 1);\n      this._o = null;\n    }\n  };\n\n  var RefCountObservable = (function (__super__) {\n    inherits(RefCountObservable, __super__);\n    function RefCountObservable(source) {\n      this.source = source;\n      this._count = 0;\n      this._connectableSubscription = null;\n      __super__.call(this);\n    }\n\n    RefCountObservable.prototype.subscribeCore = function (o) {\n      var subscription = this.source.subscribe(o);\n      ++this._count === 1 && (this._connectableSubscription = this.source.connect());\n      return new RefCountDisposable(this, subscription);\n    };\n\n    function RefCountDisposable(p, s) {\n      this._p = p;\n      this._s = s;\n      this.isDisposed = false;\n    }\n\n    RefCountDisposable.prototype.dispose = function () {\n      if (!this.isDisposed) {\n        this.isDisposed = true;\n        this._s.dispose();\n        --this._p._count === 0 && this._p._connectableSubscription.dispose();\n      }\n    };\n\n    return RefCountObservable;\n  }(ObservableBase));\n\n  var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {\n    inherits(ConnectableObservable, __super__);\n    function ConnectableObservable(source, subject) {\n      this.source = source;\n      this._connection = null;\n      this._source = source.asObservable();\n      this._subject = subject;\n      __super__.call(this);\n    }\n\n    function ConnectDisposable(parent, subscription) {\n      this._p = parent;\n      this._s = subscription;\n    }\n\n    ConnectDisposable.prototype.dispose = function () {\n      if (this._s) {\n        this._s.dispose();\n        this._s = null;\n        this._p._connection = null;\n      }\n    };\n\n    ConnectableObservable.prototype.connect = function () {\n      if (!this._connection) {\n        var subscription = this._source.subscribe(this._subject);\n        this._connection = new ConnectDisposable(this, subscription);\n      }\n      return this._connection;\n    };\n\n    ConnectableObservable.prototype._subscribe = function (o) {\n      return this._subject.subscribe(o);\n    };\n\n    ConnectableObservable.prototype.refCount = function () {\n      return new RefCountObservable(this);\n    };\n\n    return ConnectableObservable;\n  }(Observable));\n\n  /**\n   * Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence\n   * can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.\n   */\n  observableProto.singleInstance = function() {\n    var source = this, hasObservable = false, observable;\n\n    function getObservable() {\n      if (!hasObservable) {\n        hasObservable = true;\n        observable = source['finally'](function() { hasObservable = false; }).publish().refCount();\n      }\n      return observable;\n    }\n\n    return new AnonymousObservable(function(o) {\n      return getObservable().subscribe(o);\n    });\n  };\n\n  /**\n   *  Correlates the elements of two sequences based on overlapping durations.\n   *\n   *  @param {Observable} right The right observable sequence to join elements for.\n   *  @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.\n   *  @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.\n   *  @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.\n   *  @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.\n   */\n  observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {\n    var left = this;\n    return new AnonymousObservable(function (o) {\n      var group = new CompositeDisposable();\n      var leftDone = false, rightDone = false;\n      var leftId = 0, rightId = 0;\n      var leftMap = new Map(), rightMap = new Map();\n      var handleError = function (e) { o.onError(e); };\n\n      group.add(left.subscribe(\n        function (value) {\n          var id = leftId++, md = new SingleAssignmentDisposable();\n\n          leftMap.set(id, value);\n          group.add(md);\n\n          var duration = tryCatch(leftDurationSelector)(value);\n          if (duration === errorObj) { return o.onError(duration.e); }\n\n          md.setDisposable(duration.take(1).subscribe(\n            noop,\n            handleError,\n            function () {\n              leftMap['delete'](id) && leftMap.size === 0 && leftDone && o.onCompleted();\n              group.remove(md);\n            }));\n\n          rightMap.forEach(function (v) {\n            var result = tryCatch(resultSelector)(value, v);\n            if (result === errorObj) { return o.onError(result.e); }\n            o.onNext(result);\n          });\n        },\n        handleError,\n        function () {\n          leftDone = true;\n          (rightDone || leftMap.size === 0) && o.onCompleted();\n        })\n      );\n\n      group.add(right.subscribe(\n        function (value) {\n          var id = rightId++, md = new SingleAssignmentDisposable();\n\n          rightMap.set(id, value);\n          group.add(md);\n\n          var duration = tryCatch(rightDurationSelector)(value);\n          if (duration === errorObj) { return o.onError(duration.e); }\n\n          md.setDisposable(duration.take(1).subscribe(\n            noop,\n            handleError,\n            function () {\n              rightMap['delete'](id) && rightMap.size === 0 && rightDone && o.onCompleted();\n              group.remove(md);\n            }));\n\n          leftMap.forEach(function (v) {\n            var result = tryCatch(resultSelector)(v, value);\n            if (result === errorObj) { return o.onError(result.e); }\n            o.onNext(result);\n          });\n        },\n        handleError,\n        function () {\n          rightDone = true;\n          (leftDone || rightMap.size === 0) && o.onCompleted();\n        })\n      );\n      return group;\n    }, left);\n  };\n\n  /**\n   *  Correlates the elements of two sequences based on overlapping durations, and groups the results.\n   *\n   *  @param {Observable} right The right observable sequence to join elements for.\n   *  @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.\n   *  @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.\n   *  @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.\n   *  @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.\n   */\n  observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {\n    var left = this;\n    return new AnonymousObservable(function (o) {\n      var group = new CompositeDisposable();\n      var r = new RefCountDisposable(group);\n      var leftMap = new Map(), rightMap = new Map();\n      var leftId = 0, rightId = 0;\n      var handleError = function (e) { return function (v) { v.onError(e); }; };\n\n      function handleError(e) { };\n\n      group.add(left.subscribe(\n        function (value) {\n          var s = new Subject();\n          var id = leftId++;\n          leftMap.set(id, s);\n\n          var result = tryCatch(resultSelector)(value, addRef(s, r));\n          if (result === errorObj) {\n            leftMap.forEach(handleError(result.e));\n            return o.onError(result.e);\n          }\n          o.onNext(result);\n\n          rightMap.forEach(function (v) { s.onNext(v); });\n\n          var md = new SingleAssignmentDisposable();\n          group.add(md);\n\n          var duration = tryCatch(leftDurationSelector)(value);\n          if (duration === errorObj) {\n            leftMap.forEach(handleError(duration.e));\n            return o.onError(duration.e);\n          }\n\n          md.setDisposable(duration.take(1).subscribe(\n            noop,\n            function (e) {\n              leftMap.forEach(handleError(e));\n              o.onError(e);\n            },\n            function () {\n              leftMap['delete'](id) && s.onCompleted();\n              group.remove(md);\n            }));\n        },\n        function (e) {\n          leftMap.forEach(handleError(e));\n          o.onError(e);\n        },\n        function () { o.onCompleted(); })\n      );\n\n      group.add(right.subscribe(\n        function (value) {\n          var id = rightId++;\n          rightMap.set(id, value);\n\n          var md = new SingleAssignmentDisposable();\n          group.add(md);\n\n          var duration = tryCatch(rightDurationSelector)(value);\n          if (duration === errorObj) {\n            leftMap.forEach(handleError(duration.e));\n            return o.onError(duration.e);\n          }\n\n          md.setDisposable(duration.take(1).subscribe(\n            noop,\n            function (e) {\n              leftMap.forEach(handleError(e));\n              o.onError(e);\n            },\n            function () {\n              rightMap['delete'](id);\n              group.remove(md);\n            }));\n\n          leftMap.forEach(function (v) { v.onNext(value); });\n        },\n        function (e) {\n          leftMap.forEach(handleError(e));\n          o.onError(e);\n        })\n      );\n\n      return r;\n    }, left);\n  };\n\n  function toArray(x) { return x.toArray(); }\n\n  /**\n   *  Projects each element of an observable sequence into zero or more buffers.\n   *  @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).\n   *  @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.\n   *  @returns {Observable} An observable sequence of windows.\n   */\n  observableProto.buffer = function () {\n    return this.window.apply(this, arguments)\n      .flatMap(toArray);\n  };\n\n  /**\n   *  Projects each element of an observable sequence into zero or more windows.\n   *\n   *  @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).\n   *  @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.\n   *  @returns {Observable} An observable sequence of windows.\n   */\n  observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {\n    if (arguments.length === 1 && typeof arguments[0] !== 'function') {\n      return observableWindowWithBoundaries.call(this, windowOpeningsOrClosingSelector);\n    }\n    return typeof windowOpeningsOrClosingSelector === 'function' ?\n      observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :\n      observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);\n  };\n\n  function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {\n    return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) {\n      return win;\n    });\n  }\n\n  function observableWindowWithBoundaries(windowBoundaries) {\n    var source = this;\n    return new AnonymousObservable(function (observer) {\n      var win = new Subject(),\n        d = new CompositeDisposable(),\n        r = new RefCountDisposable(d);\n\n      observer.onNext(addRef(win, r));\n\n      d.add(source.subscribe(function (x) {\n        win.onNext(x);\n      }, function (err) {\n        win.onError(err);\n        observer.onError(err);\n      }, function () {\n        win.onCompleted();\n        observer.onCompleted();\n      }));\n\n      isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries));\n\n      d.add(windowBoundaries.subscribe(function (w) {\n        win.onCompleted();\n        win = new Subject();\n        observer.onNext(addRef(win, r));\n      }, function (err) {\n        win.onError(err);\n        observer.onError(err);\n      }, function () {\n        win.onCompleted();\n        observer.onCompleted();\n      }));\n\n      return r;\n    }, source);\n  }\n\n  function observableWindowWithClosingSelector(windowClosingSelector) {\n    var source = this;\n    return new AnonymousObservable(function (observer) {\n      var m = new SerialDisposable(),\n        d = new CompositeDisposable(m),\n        r = new RefCountDisposable(d),\n        win = new Subject();\n      observer.onNext(addRef(win, r));\n      d.add(source.subscribe(function (x) {\n          win.onNext(x);\n      }, function (err) {\n          win.onError(err);\n          observer.onError(err);\n      }, function () {\n          win.onCompleted();\n          observer.onCompleted();\n      }));\n\n      function createWindowClose () {\n        var windowClose;\n        try {\n          windowClose = windowClosingSelector();\n        } catch (e) {\n          observer.onError(e);\n          return;\n        }\n\n        isPromise(windowClose) && (windowClose = observableFromPromise(windowClose));\n\n        var m1 = new SingleAssignmentDisposable();\n        m.setDisposable(m1);\n        m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) {\n          win.onError(err);\n          observer.onError(err);\n        }, function () {\n          win.onCompleted();\n          win = new Subject();\n          observer.onNext(addRef(win, r));\n          createWindowClose();\n        }));\n      }\n\n      createWindowClose();\n      return r;\n    }, source);\n  }\n\n  var PairwiseObservable = (function (__super__) {\n    inherits(PairwiseObservable, __super__);\n    function PairwiseObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    PairwiseObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new PairwiseObserver(o));\n    };\n\n    return PairwiseObservable;\n  }(ObservableBase));\n\n  var PairwiseObserver = (function(__super__) {\n    inherits(PairwiseObserver, __super__);\n    function PairwiseObserver(o) {\n      this._o = o;\n      this._p = null;\n      this._hp = false;\n    }\n\n    PairwiseObserver.prototype.next = function (x) {\n      if (this._hp) {\n        this._o.onNext([this._p, x]);\n      } else {\n        this._hp = true;\n      }\n      this._p = x;\n    };\n    PairwiseObserver.prototype.error = function (err) { this._o.onError(err); };\n    PairwiseObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return PairwiseObserver;\n  }(AbstractObserver));\n\n  /**\n   * Returns a new observable that triggers on the second and subsequent triggerings of the input observable.\n   * The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.\n   * The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.\n   * @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.\n   */\n  observableProto.pairwise = function () {\n    return new PairwiseObservable(this);\n  };\n\n  /**\n   * Returns two observables which partition the observations of the source by the given function.\n   * The first will trigger observations for those values for which the predicate returns true.\n   * The second will trigger observations for those values where the predicate returns false.\n   * The predicate is executed once for each subscribed observer.\n   * Both also propagate all error observations arising from the source and each completes\n   * when the source completes.\n   * @param {Function} predicate\n   *    The function to determine which output Observable will trigger a particular observation.\n   * @returns {Array}\n   *    An array of observables. The first triggers when the predicate returns true,\n   *    and the second triggers when the predicate returns false.\n  */\n  observableProto.partition = function(predicate, thisArg) {\n    var fn = bindCallback(predicate, thisArg, 3);\n    return [\n      this.filter(predicate, thisArg),\n      this.filter(function (x, i, o) { return !fn(x, i, o); })\n    ];\n  };\n\n  var WhileEnumerable = (function(__super__) {\n    inherits(WhileEnumerable, __super__);\n    function WhileEnumerable(c, s) {\n      this.c = c;\n      this.s = s;\n    }\n    WhileEnumerable.prototype[$iterator$] = function () {\n      var self = this;\n      return {\n        next: function () {\n          return self.c() ?\n           { done: false, value: self.s } :\n           { done: true, value: void 0 };\n        }\n      };\n    };\n    return WhileEnumerable;\n  }(Enumerable));\n  \n  function enumerableWhile(condition, source) {\n    return new WhileEnumerable(condition, source);\n  }  \n\n   /**\n   *  Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.\n   *  This operator allows for a fluent style of writing queries that use the same sequence multiple times.\n   *\n   * @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\n   */\n  observableProto.letBind = observableProto['let'] = function (func) {\n    return func(this);\n  };\n\n   /**\n   *  Determines whether an observable collection contains values. \n   *\n   * @example\n   *  1 - res = Rx.Observable.if(condition, obs1);\n   *  2 - res = Rx.Observable.if(condition, obs1, obs2);\n   *  3 - res = Rx.Observable.if(condition, obs1, scheduler);\n   * @param {Function} condition The condition which determines if the thenSource or elseSource will be run.\n   * @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.\n   * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.\n   * @returns {Observable} An observable sequence which is either the thenSource or elseSource.\n   */\n  Observable['if'] = function (condition, thenSource, elseSourceOrScheduler) {\n    return observableDefer(function () {\n      elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());\n\n      isPromise(thenSource) && (thenSource = observableFromPromise(thenSource));\n      isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler));\n\n      // Assume a scheduler for empty only\n      typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler));\n      return condition() ? thenSource : elseSourceOrScheduler;\n    });\n  };\n\n   /**\n   *  Concatenates the observable sequences obtained by running the specified result selector for each element in source.\n   * There is an alias for this method called 'forIn' for browsers <IE9\n   * @param {Array} sources An array of values to turn into an observable sequence.\n   * @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.\n   * @returns {Observable} An observable sequence from the concatenated observable sequences.\n   */\n  Observable['for'] = Observable.forIn = function (sources, resultSelector, thisArg) {\n    return enumerableOf(sources, resultSelector, thisArg).concat();\n  };\n\n   /**\n   *  Repeats source as long as condition holds emulating a while loop.\n   * There is an alias for this method called 'whileDo' for browsers <IE9\n   *\n   * @param {Function} condition The condition which determines if the source will be repeated.\n   * @param {Observable} source The observable sequence that will be run if the condition function returns true.\n   * @returns {Observable} An observable sequence which is repeated as long as the condition holds.\n   */\n  var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {\n    isPromise(source) && (source = observableFromPromise(source));\n    return enumerableWhile(condition, source).concat();\n  };\n\n   /**\n   *  Repeats source as long as condition holds emulating a do while loop.\n   *\n   * @param {Function} condition The condition which determines if the source will be repeated.\n   * @param {Observable} source The observable sequence that will be run if the condition function returns true.\n   * @returns {Observable} An observable sequence which is repeated as long as the condition holds.\n   */\n  observableProto.doWhile = function (condition) {\n    return observableConcat([this, observableWhileDo(condition, this)]);\n  };\n\n   /**\n   *  Uses selector to determine which source in sources to use.\n   * @param {Function} selector The function which extracts the value for to test in a case statement.\n   * @param {Array} sources A object which has keys which correspond to the case statement labels.\n   * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.\n   *\n   * @returns {Observable} An observable sequence which is determined by a case statement.\n   */\n  Observable['case'] = function (selector, sources, defaultSourceOrScheduler) {\n    return observableDefer(function () {\n      isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));\n      defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());\n\n      isScheduler(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));\n\n      var result = sources[selector()];\n      isPromise(result) && (result = observableFromPromise(result));\n\n      return result || defaultSourceOrScheduler;\n    });\n  };\n\n  var ExpandObservable = (function(__super__) {\n    inherits(ExpandObservable, __super__);\n    function ExpandObservable(source, fn, scheduler) {\n      this.source = source;\n      this._fn = fn;\n      this._scheduler = scheduler;\n      __super__.call(this);\n    }\n\n    function scheduleRecursive(args, recurse) {\n      var state = args[0], self = args[1];\n      var work;\n      if (state.q.length > 0) {\n        work = state.q.shift();\n      } else {\n        state.isAcquired = false;\n        return;\n      }\n      var m1 = new SingleAssignmentDisposable();\n      state.d.add(m1);\n      m1.setDisposable(work.subscribe(new ExpandObserver(state, self, m1)));\n      recurse([state, self]);\n    }\n\n    ExpandObservable.prototype._ensureActive = function (state) {\n      var isOwner = false;\n      if (state.q.length > 0) {\n        isOwner = !state.isAcquired;\n        state.isAcquired = true;\n      }\n      isOwner && state.m.setDisposable(this._scheduler.scheduleRecursive([state, this], scheduleRecursive));\n    };\n\n    ExpandObservable.prototype.subscribeCore = function (o) {\n      var m = new SerialDisposable(),\n        d = new CompositeDisposable(m),\n        state = {\n          q: [],\n          m: m,\n          d: d,\n          activeCount: 0,\n          isAcquired: false,\n          o: o\n        };\n\n      state.q.push(this.source);\n      state.activeCount++;\n      this._ensureActive(state);\n      return d;\n    };\n\n    return ExpandObservable;\n  }(ObservableBase));\n\n  var ExpandObserver = (function(__super__) {\n    inherits(ExpandObserver, __super__);\n    function ExpandObserver(state, parent, m1) {\n      this._s = state;\n      this._p = parent;\n      this._m1 = m1;\n      __super__.call(this);\n    }\n\n    ExpandObserver.prototype.next = function (x) {\n      this._s.o.onNext(x);\n      var result = tryCatch(this._p._fn)(x);\n      if (result === errorObj) { return this._s.o.onError(result.e); }\n      this._s.q.push(result);\n      this._s.activeCount++;\n      this._p._ensureActive(this._s);\n    };\n\n    ExpandObserver.prototype.error = function (e) {\n      this._s.o.onError(e);\n    };\n\n    ExpandObserver.prototype.completed = function () {\n      this._s.d.remove(this._m1);\n      this._s.activeCount--;\n      this._s.activeCount === 0 && this._s.o.onCompleted();\n    };\n\n    return ExpandObserver;\n  }(AbstractObserver));\n\n   /**\n   *  Expands an observable sequence by recursively invoking selector.\n   *\n   * @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.\n   * @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.\n   * @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.\n   */\n  observableProto.expand = function (selector, scheduler) {\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\n    return new ExpandObservable(this, selector, scheduler);\n  };\n\n  function argumentsToArray() {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    return args;\n  }\n\n  var ForkJoinObservable = (function (__super__) {\n    inherits(ForkJoinObservable, __super__);\n    function ForkJoinObservable(sources, cb) {\n      this._sources = sources;\n      this._cb = cb;\n      __super__.call(this);\n    }\n\n    ForkJoinObservable.prototype.subscribeCore = function (o) {\n      if (this._sources.length === 0) {\n        o.onCompleted();\n        return disposableEmpty;\n      }\n\n      var count = this._sources.length;\n      var state = {\n        finished: false,\n        hasResults: new Array(count),\n        hasCompleted: new Array(count),\n        results: new Array(count)\n      };\n\n      var subscriptions = new CompositeDisposable();\n      for (var i = 0, len = this._sources.length; i < len; i++) {\n        var source = this._sources[i];\n        isPromise(source) && (source = observableFromPromise(source));\n        subscriptions.add(source.subscribe(new ForkJoinObserver(o, state, i, this._cb, subscriptions)));\n      }\n\n      return subscriptions;\n    };\n\n    return ForkJoinObservable;\n  }(ObservableBase));\n\n  var ForkJoinObserver = (function(__super__) {\n    inherits(ForkJoinObserver, __super__);\n    function ForkJoinObserver(o, s, i, cb, subs) {\n      this._o = o;\n      this._s = s;\n      this._i = i;\n      this._cb = cb;\n      this._subs = subs;\n      __super__.call(this);\n    }\n\n    ForkJoinObserver.prototype.next = function (x) {\n      if (!this._s.finished) {\n        this._s.hasResults[this._i] = true;\n        this._s.results[this._i] = x;\n      }\n    };\n\n    ForkJoinObserver.prototype.error = function (e) {\n      this._s.finished = true;\n      this._o.onError(e);\n      this._subs.dispose();\n    };\n\n    ForkJoinObserver.prototype.completed = function () {\n      if (!this._s.finished) {\n        if (!this._s.hasResults[this._i]) {\n          return this._o.onCompleted();\n        }\n        this._s.hasCompleted[this._i] = true;\n        for (var i = 0; i < this._s.results.length; i++) {\n          if (!this._s.hasCompleted[i]) { return; }\n        }\n        this._s.finished = true;\n\n        var res = tryCatch(this._cb).apply(null, this._s.results);\n        if (res === errorObj) { return this._o.onError(res.e); }\n\n        this._o.onNext(res);\n        this._o.onCompleted();\n      }\n    };\n\n    return ForkJoinObserver;\n  }(AbstractObserver));\n\n   /**\n   *  Runs all observable sequences in parallel and collect their last elements.\n   *\n   * @example\n   *  1 - res = Rx.Observable.forkJoin([obs1, obs2]);\n   *  1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);\n   * @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.\n   */\n  Observable.forkJoin = function () {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\n    Array.isArray(args[0]) && (args = args[0]);\n    return new ForkJoinObservable(args, resultSelector);\n  };\n\n   /**\n   *  Runs two observable sequences in parallel and combines their last elemenets.\n   * @param {Observable} second Second observable sequence.\n   * @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.\n   * @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.\n   */\n  observableProto.forkJoin = function () {\n    var len = arguments.length, args = new Array(len);\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\n    if (Array.isArray(args[0])) {\n      args[0].unshift(this);\n    } else {\n      args.unshift(this);\n    }\n    return Observable.forkJoin.apply(null, args);\n  };\n\n  /**\n   * Comonadic bind operator.\n   * @param {Function} selector A transform function to apply to each element.\n   * @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.\n   * @returns {Observable} An observable sequence which results from the comonadic bind operation.\n   */\n  observableProto.manySelect = observableProto.extend = function (selector, scheduler) {\n    isScheduler(scheduler) || (scheduler = Rx.Scheduler.immediate);\n    var source = this;\n    return observableDefer(function () {\n      var chain;\n\n      return source\n        .map(function (x) {\n          var curr = new ChainObservable(x);\n\n          chain && chain.onNext(x);\n          chain = curr;\n\n          return curr;\n        })\n        .tap(\n          noop,\n          function (e) { chain && chain.onError(e); },\n          function () { chain && chain.onCompleted(); }\n        )\n        .observeOn(scheduler)\n        .map(selector);\n    }, source);\n  };\n\n  var ChainObservable = (function (__super__) {\n    inherits(ChainObservable, __super__);\n    function ChainObservable(head) {\n      __super__.call(this);\n      this.head = head;\n      this.tail = new AsyncSubject();\n    }\n\n    addProperties(ChainObservable.prototype, Observer, {\n      _subscribe: function (o) {\n        var g = new CompositeDisposable();\n        g.add(currentThreadScheduler.schedule(this, function (_, self) {\n          o.onNext(self.head);\n          g.add(self.tail.mergeAll().subscribe(o));\n        }));\n\n        return g;\n      },\n      onCompleted: function () {\n        this.onNext(Observable.empty());\n      },\n      onError: function (e) {\n        this.onNext(Observable['throw'](e));\n      },\n      onNext: function (v) {\n        this.tail.onNext(v);\n        this.tail.onCompleted();\n      }\n    });\n\n    return ChainObservable;\n\n  }(Observable));\n\n  var Map = root.Map || (function () {\n    function Map() {\n      this.size = 0;\n      this._values = [];\n      this._keys = [];\n    }\n\n    Map.prototype['delete'] = function (key) {\n      var i = this._keys.indexOf(key);\n      if (i === -1) { return false; }\n      this._values.splice(i, 1);\n      this._keys.splice(i, 1);\n      this.size--;\n      return true;\n    };\n\n    Map.prototype.get = function (key) {\n      var i = this._keys.indexOf(key);\n      return i === -1 ? undefined : this._values[i];\n    };\n\n    Map.prototype.set = function (key, value) {\n      var i = this._keys.indexOf(key);\n      if (i === -1) {\n        this._keys.push(key);\n        this._values.push(value);\n        this.size++;\n      } else {\n        this._values[i] = value;\n      }\n      return this;\n    };\n\n    Map.prototype.forEach = function (cb, thisArg) {\n      for (var i = 0; i < this.size; i++) {\n        cb.call(thisArg, this._values[i], this._keys[i]);\n      }\n    };\n\n    return Map;\n  }());\n\n  /**\n   * @constructor\n   * Represents a join pattern over observable sequences.\n   */\n  function Pattern(patterns) {\n    this.patterns = patterns;\n  }\n\n  /**\n   *  Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.\n   *  @param other Observable sequence to match in addition to the current pattern.\n   *  @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.\n   */\n  Pattern.prototype.and = function (other) {\n    return new Pattern(this.patterns.concat(other));\n  };\n\n  /**\n   *  Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.\n   *  @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.\n   *  @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.\n   */\n  Pattern.prototype.thenDo = function (selector) {\n    return new Plan(this, selector);\n  };\n\n  function Plan(expression, selector) {\n    this.expression = expression;\n    this.selector = selector;\n  }\n\n  function handleOnError(o) { return function (e) { o.onError(e); }; }\n  function handleOnNext(self, observer) {\n    return function onNext () {\n      var result = tryCatch(self.selector).apply(self, arguments);\n      if (result === errorObj) { return observer.onError(result.e); }\n      observer.onNext(result);\n    };\n  }\n\n  Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {\n    var joinObservers = [], errHandler = handleOnError(observer);\n    for (var i = 0, len = this.expression.patterns.length; i < len; i++) {\n      joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], errHandler));\n    }\n    var activePlan = new ActivePlan(joinObservers, handleOnNext(this, observer), function () {\n      for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {\n        joinObservers[j].removeActivePlan(activePlan);\n      }\n      deactivate(activePlan);\n    });\n    for (i = 0, len = joinObservers.length; i < len; i++) {\n      joinObservers[i].addActivePlan(activePlan);\n    }\n    return activePlan;\n  };\n\n  function planCreateObserver(externalSubscriptions, observable, onError) {\n    var entry = externalSubscriptions.get(observable);\n    if (!entry) {\n      var observer = new JoinObserver(observable, onError);\n      externalSubscriptions.set(observable, observer);\n      return observer;\n    }\n    return entry;\n  }\n\n  function ActivePlan(joinObserverArray, onNext, onCompleted) {\n    this.joinObserverArray = joinObserverArray;\n    this.onNext = onNext;\n    this.onCompleted = onCompleted;\n    this.joinObservers = new Map();\n    for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {\n      var joinObserver = this.joinObserverArray[i];\n      this.joinObservers.set(joinObserver, joinObserver);\n    }\n  }\n\n  ActivePlan.prototype.dequeue = function () {\n    this.joinObservers.forEach(function (v) { v.queue.shift(); });\n  };\n\n  ActivePlan.prototype.match = function () {\n    var i, len, hasValues = true;\n    for (i = 0, len = this.joinObserverArray.length; i < len; i++) {\n      if (this.joinObserverArray[i].queue.length === 0) {\n        hasValues = false;\n        break;\n      }\n    }\n    if (hasValues) {\n      var firstValues = [],\n          isCompleted = false;\n      for (i = 0, len = this.joinObserverArray.length; i < len; i++) {\n        firstValues.push(this.joinObserverArray[i].queue[0]);\n        this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true);\n      }\n      if (isCompleted) {\n        this.onCompleted();\n      } else {\n        this.dequeue();\n        var values = [];\n        for (i = 0, len = firstValues.length; i < firstValues.length; i++) {\n          values.push(firstValues[i].value);\n        }\n        this.onNext.apply(this, values);\n      }\n    }\n  };\n\n  var JoinObserver = (function (__super__) {\n    inherits(JoinObserver, __super__);\n\n    function JoinObserver(source, onError) {\n      __super__.call(this);\n      this.source = source;\n      this.onError = onError;\n      this.queue = [];\n      this.activePlans = [];\n      this.subscription = new SingleAssignmentDisposable();\n      this.isDisposed = false;\n    }\n\n    var JoinObserverPrototype = JoinObserver.prototype;\n\n    JoinObserverPrototype.next = function (notification) {\n      if (!this.isDisposed) {\n        if (notification.kind === 'E') {\n          return this.onError(notification.error);\n        }\n        this.queue.push(notification);\n        var activePlans = this.activePlans.slice(0);\n        for (var i = 0, len = activePlans.length; i < len; i++) {\n          activePlans[i].match();\n        }\n      }\n    };\n\n    JoinObserverPrototype.error = noop;\n    JoinObserverPrototype.completed = noop;\n\n    JoinObserverPrototype.addActivePlan = function (activePlan) {\n      this.activePlans.push(activePlan);\n    };\n\n    JoinObserverPrototype.subscribe = function () {\n      this.subscription.setDisposable(this.source.materialize().subscribe(this));\n    };\n\n    JoinObserverPrototype.removeActivePlan = function (activePlan) {\n      this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);\n      this.activePlans.length === 0 && this.dispose();\n    };\n\n    JoinObserverPrototype.dispose = function () {\n      __super__.prototype.dispose.call(this);\n      if (!this.isDisposed) {\n        this.isDisposed = true;\n        this.subscription.dispose();\n      }\n    };\n\n    return JoinObserver;\n  } (AbstractObserver));\n\n  /**\n   *  Creates a pattern that matches when both observable sequences have an available value.\n   *\n   *  @param right Observable sequence to match with the current sequence.\n   *  @return {Pattern} Pattern object that matches when both observable sequences have an available value.\n   */\n  observableProto.and = function (right) {\n    return new Pattern([this, right]);\n  };\n\n  /**\n   *  Matches when the observable sequence has an available value and projects the value.\n   *\n   *  @param {Function} selector Selector that will be invoked for values in the source sequence.\n   *  @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.\n   */\n  observableProto.thenDo = function (selector) {\n    return new Pattern([this]).thenDo(selector);\n  };\n\n  /**\n   *  Joins together the results from several patterns.\n   *\n   *  @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.\n   *  @returns {Observable} Observable sequence with the results form matching several patterns.\n   */\n  Observable.when = function () {\n    var len = arguments.length, plans;\n    if (Array.isArray(arguments[0])) {\n      plans = arguments[0];\n    } else {\n      plans = new Array(len);\n      for(var i = 0; i < len; i++) { plans[i] = arguments[i]; }\n    }\n    return new AnonymousObservable(function (o) {\n      var activePlans = [],\n          externalSubscriptions = new Map();\n      var outObserver = observerCreate(\n        function (x) { o.onNext(x); },\n        function (err) {\n          externalSubscriptions.forEach(function (v) { v.onError(err); });\n          o.onError(err);\n        },\n        function (x) { o.onCompleted(); }\n      );\n      try {\n        for (var i = 0, len = plans.length; i < len; i++) {\n          activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {\n            var idx = activePlans.indexOf(activePlan);\n            activePlans.splice(idx, 1);\n            activePlans.length === 0 && o.onCompleted();\n          }));\n        }\n      } catch (e) {\n        observableThrow(e).subscribe(o);\n      }\n      var group = new CompositeDisposable();\n      externalSubscriptions.forEach(function (joinObserver) {\n        joinObserver.subscribe();\n        group.add(joinObserver);\n      });\n\n      return group;\n    });\n  };\n\n  var TimerObservable = (function(__super__) {\n    inherits(TimerObservable, __super__);\n    function TimerObservable(dt, s) {\n      this._dt = dt;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    TimerObservable.prototype.subscribeCore = function (o) {\n      return this._s.scheduleFuture(o, this._dt, scheduleMethod);\n    };\n\n    function scheduleMethod(s, o) {\n      o.onNext(0);\n      o.onCompleted();\n    }\n\n    return TimerObservable;\n  }(ObservableBase));\n\n  function _observableTimer(dueTime, scheduler) {\n    return new TimerObservable(dueTime, scheduler);\n  }\n\n  function observableTimerDateAndPeriod(dueTime, period, scheduler) {\n    return new AnonymousObservable(function (observer) {\n      var d = dueTime, p = normalizeTime(period);\n      return scheduler.scheduleRecursiveFuture(0, d, function (count, self) {\n        if (p > 0) {\n          var now = scheduler.now();\n          d = new Date(d.getTime() + p);\n          d.getTime() <= now && (d = new Date(now + p));\n        }\n        observer.onNext(count);\n        self(count + 1, new Date(d));\n      });\n    });\n  }\n\n  function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {\n    return dueTime === period ?\n      new AnonymousObservable(function (observer) {\n        return scheduler.schedulePeriodic(0, period, function (count) {\n          observer.onNext(count);\n          return count + 1;\n        });\n      }) :\n      observableDefer(function () {\n        return observableTimerDateAndPeriod(new Date(scheduler.now() + dueTime), period, scheduler);\n      });\n  }\n\n  /**\n   *  Returns an observable sequence that produces a value after each period.\n   *\n   * @example\n   *  1 - res = Rx.Observable.interval(1000);\n   *  2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);\n   *\n   * @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).\n   * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.\n   * @returns {Observable} An observable sequence that produces a value after each period.\n   */\n  var observableinterval = Observable.interval = function (period, scheduler) {\n    return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : defaultScheduler);\n  };\n\n  /**\n   *  Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.\n   * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.\n   * @param {Mixed} [periodOrScheduler]  Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.\n   * @param {Scheduler} [scheduler]  Scheduler to run the timer on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.\n   */\n  var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {\n    var period;\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    if (periodOrScheduler != null && typeof periodOrScheduler === 'number') {\n      period = periodOrScheduler;\n    } else if (isScheduler(periodOrScheduler)) {\n      scheduler = periodOrScheduler;\n    }\n    if ((dueTime instanceof Date || typeof dueTime === 'number') && period === undefined) {\n      return _observableTimer(dueTime, scheduler);\n    }\n    if (dueTime instanceof Date && period !== undefined) {\n      return observableTimerDateAndPeriod(dueTime.getTime(), periodOrScheduler, scheduler);\n    }\n    return observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);\n  };\n\n  function observableDelayRelative(source, dueTime, scheduler) {\n    return new AnonymousObservable(function (o) {\n      var active = false,\n        cancelable = new SerialDisposable(),\n        exception = null,\n        q = [],\n        running = false,\n        subscription;\n      subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {\n        var d, shouldRun;\n        if (notification.value.kind === 'E') {\n          q = [];\n          q.push(notification);\n          exception = notification.value.error;\n          shouldRun = !running;\n        } else {\n          q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });\n          shouldRun = !active;\n          active = true;\n        }\n        if (shouldRun) {\n          if (exception !== null) {\n            o.onError(exception);\n          } else {\n            d = new SingleAssignmentDisposable();\n            cancelable.setDisposable(d);\n            d.setDisposable(scheduler.scheduleRecursiveFuture(null, dueTime, function (_, self) {\n              var e, recurseDueTime, result, shouldRecurse;\n              if (exception !== null) {\n                return;\n              }\n              running = true;\n              do {\n                result = null;\n                if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {\n                  result = q.shift().value;\n                }\n                if (result !== null) {\n                  result.accept(o);\n                }\n              } while (result !== null);\n              shouldRecurse = false;\n              recurseDueTime = 0;\n              if (q.length > 0) {\n                shouldRecurse = true;\n                recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());\n              } else {\n                active = false;\n              }\n              e = exception;\n              running = false;\n              if (e !== null) {\n                o.onError(e);\n              } else if (shouldRecurse) {\n                self(null, recurseDueTime);\n              }\n            }));\n          }\n        }\n      });\n      return new BinaryDisposable(subscription, cancelable);\n    }, source);\n  }\n\n  function observableDelayAbsolute(source, dueTime, scheduler) {\n    return observableDefer(function () {\n      return observableDelayRelative(source, dueTime - scheduler.now(), scheduler);\n    });\n  }\n\n  function delayWithSelector(source, subscriptionDelay, delayDurationSelector) {\n    var subDelay, selector;\n    if (isFunction(subscriptionDelay)) {\n      selector = subscriptionDelay;\n    } else {\n      subDelay = subscriptionDelay;\n      selector = delayDurationSelector;\n    }\n    return new AnonymousObservable(function (o) {\n      var delays = new CompositeDisposable(), atEnd = false, subscription = new SerialDisposable();\n\n      function start() {\n        subscription.setDisposable(source.subscribe(\n          function (x) {\n            var delay = tryCatch(selector)(x);\n            if (delay === errorObj) { return o.onError(delay.e); }\n            var d = new SingleAssignmentDisposable();\n            delays.add(d);\n            d.setDisposable(delay.subscribe(\n              function () {\n                o.onNext(x);\n                delays.remove(d);\n                done();\n              },\n              function (e) { o.onError(e); },\n              function () {\n                o.onNext(x);\n                delays.remove(d);\n                done();\n              }\n            ));\n          },\n          function (e) { o.onError(e); },\n          function () {\n            atEnd = true;\n            subscription.dispose();\n            done();\n          }\n        ));\n      }\n\n      function done () {\n        atEnd && delays.length === 0 && o.onCompleted();\n      }\n\n      if (!subDelay) {\n        start();\n      } else {\n        subscription.setDisposable(subDelay.subscribe(start, function (e) { o.onError(e); }, start));\n      }\n\n      return new BinaryDisposable(subscription, delays);\n    }, this);\n  }\n\n  /**\n   *  Time shifts the observable sequence by dueTime.\n   *  The relative time intervals between the values are preserved.\n   *\n   * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.\n   * @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} Time-shifted sequence.\n   */\n  observableProto.delay = function () {\n    var firstArg = arguments[0];\n    if (typeof firstArg === 'number' || firstArg instanceof Date) {\n      var dueTime = firstArg, scheduler = arguments[1];\n      isScheduler(scheduler) || (scheduler = defaultScheduler);\n      return dueTime instanceof Date ?\n        observableDelayAbsolute(this, dueTime, scheduler) :\n        observableDelayRelative(this, dueTime, scheduler);\n    } else if (Observable.isObservable(firstArg) || isFunction(firstArg)) {\n      return delayWithSelector(this, firstArg, arguments[1]);\n    } else {\n      throw new Error('Invalid arguments');\n    }\n  };\n\n  var DebounceObservable = (function (__super__) {\n    inherits(DebounceObservable, __super__);\n    function DebounceObservable(source, dt, s) {\n      isScheduler(s) || (s = defaultScheduler);\n      this.source = source;\n      this._dt = dt;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    DebounceObservable.prototype.subscribeCore = function (o) {\n      var cancelable = new SerialDisposable();\n      return new BinaryDisposable(\n        this.source.subscribe(new DebounceObserver(o, this.source, this._dt, this._s, cancelable)),\n        cancelable);\n    };\n\n    return DebounceObservable;\n  }(ObservableBase));\n\n  var DebounceObserver = (function (__super__) {\n    inherits(DebounceObserver, __super__);\n    function DebounceObserver(observer, source, dueTime, scheduler, cancelable) {\n      this._o = observer;\n      this._s = source;\n      this._d = dueTime;\n      this._scheduler = scheduler;\n      this._c = cancelable;\n      this._v = null;\n      this._hv = false;\n      this._id = 0;\n      __super__.call(this);\n    }\n\n    DebounceObserver.prototype.next = function (x) {\n      this._hv = true;\n      this._v = x;\n      var currentId = ++this._id, d = new SingleAssignmentDisposable();\n      this._c.setDisposable(d);\n      d.setDisposable(this._scheduler.scheduleFuture(this, this._d, function (_, self) {\n        self._hv && self._id === currentId && self._o.onNext(x);\n        self._hv = false;\n      }));\n    };\n\n    DebounceObserver.prototype.error = function (e) {\n      this._c.dispose();\n      this._o.onError(e);\n      this._hv = false;\n      this._id++;\n    };\n\n    DebounceObserver.prototype.completed = function () {\n      this._c.dispose();\n      this._hv && this._o.onNext(this._v);\n      this._o.onCompleted();\n      this._hv = false;\n      this._id++;\n    };\n\n    return DebounceObserver;\n  }(AbstractObserver));\n\n  function debounceWithSelector(source, durationSelector) {\n    return new AnonymousObservable(function (o) {\n      var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;\n      var subscription = source.subscribe(\n        function (x) {\n          var throttle = tryCatch(durationSelector)(x);\n          if (throttle === errorObj) { return o.onError(throttle.e); }\n\n          isPromise(throttle) && (throttle = observableFromPromise(throttle));\n\n          hasValue = true;\n          value = x;\n          id++;\n          var currentid = id, d = new SingleAssignmentDisposable();\n          cancelable.setDisposable(d);\n          d.setDisposable(throttle.subscribe(\n            function () {\n              hasValue && id === currentid && o.onNext(value);\n              hasValue = false;\n              d.dispose();\n            },\n            function (e) { o.onError(e); },\n            function () {\n              hasValue && id === currentid && o.onNext(value);\n              hasValue = false;\n              d.dispose();\n            }\n          ));\n        },\n        function (e) {\n          cancelable.dispose();\n          o.onError(e);\n          hasValue = false;\n          id++;\n        },\n        function () {\n          cancelable.dispose();\n          hasValue && o.onNext(value);\n          o.onCompleted();\n          hasValue = false;\n          id++;\n        }\n      );\n      return new BinaryDisposable(subscription, cancelable);\n    }, source);\n  }\n\n  observableProto.debounce = function () {\n    if (isFunction (arguments[0])) {\n      return debounceWithSelector(this, arguments[0]);\n    } else if (typeof arguments[0] === 'number') {\n      return new DebounceObservable(this, arguments[0], arguments[1]);\n    } else {\n      throw new Error('Invalid arguments');\n    }\n  };\n\n  /**\n   *  Projects each element of an observable sequence into zero or more windows which are produced based on timing information.\n   * @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).\n   * @param {Mixed} [timeShiftOrScheduler]  Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.\n   * @param {Scheduler} [scheduler]  Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} An observable sequence of windows.\n   */\n  observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {\n    var source = this, timeShift;\n    timeShiftOrScheduler == null && (timeShift = timeSpan);\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    if (typeof timeShiftOrScheduler === 'number') {\n      timeShift = timeShiftOrScheduler;\n    } else if (isScheduler(timeShiftOrScheduler)) {\n      timeShift = timeSpan;\n      scheduler = timeShiftOrScheduler;\n    }\n    return new AnonymousObservable(function (observer) {\n      var groupDisposable,\n        nextShift = timeShift,\n        nextSpan = timeSpan,\n        q = [],\n        refCountDisposable,\n        timerD = new SerialDisposable(),\n        totalTime = 0;\n        groupDisposable = new CompositeDisposable(timerD),\n        refCountDisposable = new RefCountDisposable(groupDisposable);\n\n       function createTimer () {\n        var m = new SingleAssignmentDisposable(),\n          isSpan = false,\n          isShift = false;\n        timerD.setDisposable(m);\n        if (nextSpan === nextShift) {\n          isSpan = true;\n          isShift = true;\n        } else if (nextSpan < nextShift) {\n            isSpan = true;\n        } else {\n          isShift = true;\n        }\n        var newTotalTime = isSpan ? nextSpan : nextShift,\n          ts = newTotalTime - totalTime;\n        totalTime = newTotalTime;\n        if (isSpan) {\n          nextSpan += timeShift;\n        }\n        if (isShift) {\n          nextShift += timeShift;\n        }\n        m.setDisposable(scheduler.scheduleFuture(null, ts, function () {\n          if (isShift) {\n            var s = new Subject();\n            q.push(s);\n            observer.onNext(addRef(s, refCountDisposable));\n          }\n          isSpan && q.shift().onCompleted();\n          createTimer();\n        }));\n      };\n      q.push(new Subject());\n      observer.onNext(addRef(q[0], refCountDisposable));\n      createTimer();\n      groupDisposable.add(source.subscribe(\n        function (x) {\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }\n        },\n        function (e) {\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }\n          observer.onError(e);\n        },\n        function () {\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }\n          observer.onCompleted();\n        }\n      ));\n      return refCountDisposable;\n    }, source);\n  };\n\n  /**\n   *  Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.\n   * @param {Number} timeSpan Maximum time length of a window.\n   * @param {Number} count Maximum element count of a window.\n   * @param {Scheduler} [scheduler]  Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} An observable sequence of windows.\n   */\n  observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {\n    var source = this;\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new AnonymousObservable(function (observer) {\n      var timerD = new SerialDisposable(),\n          groupDisposable = new CompositeDisposable(timerD),\n          refCountDisposable = new RefCountDisposable(groupDisposable),\n          n = 0,\n          windowId = 0,\n          s = new Subject();\n\n      function createTimer(id) {\n        var m = new SingleAssignmentDisposable();\n        timerD.setDisposable(m);\n        m.setDisposable(scheduler.scheduleFuture(null, timeSpan, function () {\n          if (id !== windowId) { return; }\n          n = 0;\n          var newId = ++windowId;\n          s.onCompleted();\n          s = new Subject();\n          observer.onNext(addRef(s, refCountDisposable));\n          createTimer(newId);\n        }));\n      }\n\n      observer.onNext(addRef(s, refCountDisposable));\n      createTimer(0);\n\n      groupDisposable.add(source.subscribe(\n        function (x) {\n          var newId = 0, newWindow = false;\n          s.onNext(x);\n          if (++n === count) {\n            newWindow = true;\n            n = 0;\n            newId = ++windowId;\n            s.onCompleted();\n            s = new Subject();\n            observer.onNext(addRef(s, refCountDisposable));\n          }\n          newWindow && createTimer(newId);\n        },\n        function (e) {\n          s.onError(e);\n          observer.onError(e);\n        }, function () {\n          s.onCompleted();\n          observer.onCompleted();\n        }\n      ));\n      return refCountDisposable;\n    }, source);\n  };\n\n  function toArray(x) { return x.toArray(); }\n\n  /**\n   *  Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.\n   * @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).\n   * @param {Mixed} [timeShiftOrScheduler]  Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.\n   * @param {Scheduler} [scheduler]  Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} An observable sequence of buffers.\n   */\n  observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {\n    return this.windowWithTime(timeSpan, timeShiftOrScheduler, scheduler).flatMap(toArray);\n  };\n\n  function toArray(x) { return x.toArray(); }\n\n  /**\n   *  Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.\n   * @param {Number} timeSpan Maximum time length of a buffer.\n   * @param {Number} count Maximum element count of a buffer.\n   * @param {Scheduler} [scheduler]  Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} An observable sequence of buffers.\n   */\n  observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {\n    return this.windowWithTimeOrCount(timeSpan, count, scheduler).flatMap(toArray);\n  };\n\n  var TimeIntervalObservable = (function (__super__) {\n    inherits(TimeIntervalObservable, __super__);\n    function TimeIntervalObservable(source, s) {\n      this.source = source;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    TimeIntervalObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new TimeIntervalObserver(o, this._s));\n    };\n\n    return TimeIntervalObservable;\n  }(ObservableBase));\n\n  var TimeIntervalObserver = (function (__super__) {\n    inherits(TimeIntervalObserver, __super__);\n\n    function TimeIntervalObserver(o, s) {\n      this._o = o;\n      this._s = s;\n      this._l = s.now();\n      __super__.call(this);\n    }\n\n    TimeIntervalObserver.prototype.next = function (x) {\n      var now = this._s.now(), span = now - this._l;\n      this._l = now;\n      this._o.onNext({ value: x, interval: span });\n    };\n    TimeIntervalObserver.prototype.error = function (e) { this._o.onError(e); };\n    TimeIntervalObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return TimeIntervalObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Records the time interval between consecutive values in an observable sequence.\n   *\n   * @example\n   *  1 - res = source.timeInterval();\n   *  2 - res = source.timeInterval(Rx.Scheduler.timeout);\n   *\n   * @param [scheduler]  Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.\n   * @returns {Observable} An observable sequence with time interval information on values.\n   */\n  observableProto.timeInterval = function (scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new TimeIntervalObservable(this, scheduler);\n  };\n\n  var TimestampObservable = (function (__super__) {\n    inherits(TimestampObservable, __super__);\n    function TimestampObservable(source, s) {\n      this.source = source;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    TimestampObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new TimestampObserver(o, this._s));\n    };\n\n    return TimestampObservable;\n  }(ObservableBase));\n\n  var TimestampObserver = (function (__super__) {\n    inherits(TimestampObserver, __super__);\n    function TimestampObserver(o, s) {\n      this._o = o;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    TimestampObserver.prototype.next = function (x) {\n      this._o.onNext({ value: x, timestamp: this._s.now() });\n    };\n\n    TimestampObserver.prototype.error = function (e) {\n      this._o.onError(e);\n    };\n\n    TimestampObserver.prototype.completed = function () {\n      this._o.onCompleted();\n    };\n\n    return TimestampObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Records the timestamp for each value in an observable sequence.\n   *\n   * @example\n   *  1 - res = source.timestamp(); // produces { value: x, timestamp: ts }\n   *  2 - res = source.timestamp(Rx.Scheduler.default);\n   *\n   * @param {Scheduler} [scheduler]  Scheduler used to compute timestamps. If not specified, the default scheduler is used.\n   * @returns {Observable} An observable sequence with timestamp information on values.\n   */\n  observableProto.timestamp = function (scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new TimestampObservable(this, scheduler);\n  };\n\n  function sampleObservable(source, sampler) {\n    return new AnonymousObservable(function (o) {\n      var atEnd = false, value, hasValue = false;\n\n      function sampleSubscribe() {\n        if (hasValue) {\n          hasValue = false;\n          o.onNext(value);\n        }\n        atEnd && o.onCompleted();\n      }\n\n      var sourceSubscription = new SingleAssignmentDisposable();\n      sourceSubscription.setDisposable(source.subscribe(\n        function (newValue) {\n          hasValue = true;\n          value = newValue;\n        },\n        function (e) { o.onError(e); },\n        function () {\n          atEnd = true;\n          sourceSubscription.dispose();\n        }\n      ));\n\n      return new BinaryDisposable(\n        sourceSubscription,\n        sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe)\n      );\n    }, source);\n  }\n\n  /**\n   *  Samples the observable sequence at each interval.\n   *\n   * @example\n   *  1 - res = source.sample(sampleObservable); // Sampler tick sequence\n   *  2 - res = source.sample(5000); // 5 seconds\n   *  2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds\n   *\n   * @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.\n   * @param {Scheduler} [scheduler]  Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} Sampled observable sequence.\n   */\n  observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return typeof intervalOrSampler === 'number' ?\n      sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :\n      sampleObservable(this, intervalOrSampler);\n  };\n\n  var TimeoutError = Rx.TimeoutError = function(message) {\n    this.message = message || 'Timeout has occurred';\n    this.name = 'TimeoutError';\n    Error.call(this);\n  };\n  TimeoutError.prototype = Object.create(Error.prototype);\n\n  function timeoutWithSelector(source, firstTimeout, timeoutDurationSelector, other) {\n    if (isFunction(firstTimeout)) {\n      other = timeoutDurationSelector;\n      timeoutDurationSelector = firstTimeout;\n      firstTimeout = observableNever();\n    }\n    Observable.isObservable(other) || (other = observableThrow(new TimeoutError()));\n    return new AnonymousObservable(function (o) {\n      var subscription = new SerialDisposable(),\n        timer = new SerialDisposable(),\n        original = new SingleAssignmentDisposable();\n\n      subscription.setDisposable(original);\n\n      var id = 0, switched = false;\n\n      function setTimer(timeout) {\n        var myId = id, d = new SingleAssignmentDisposable();\n\n        function timerWins() {\n          switched = (myId === id);\n          return switched;\n        }\n\n        timer.setDisposable(d);\n        d.setDisposable(timeout.subscribe(function () {\n          timerWins() && subscription.setDisposable(other.subscribe(o));\n          d.dispose();\n        }, function (e) {\n          timerWins() && o.onError(e);\n        }, function () {\n          timerWins() && subscription.setDisposable(other.subscribe(o));\n        }));\n      };\n\n      setTimer(firstTimeout);\n\n      function oWins() {\n        var res = !switched;\n        if (res) { id++; }\n        return res;\n      }\n\n      original.setDisposable(source.subscribe(function (x) {\n        if (oWins()) {\n          o.onNext(x);\n          var timeout = tryCatch(timeoutDurationSelector)(x);\n          if (timeout === errorObj) { return o.onError(timeout.e); }\n          setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout);\n        }\n      }, function (e) {\n        oWins() && o.onError(e);\n      }, function () {\n        oWins() && o.onCompleted();\n      }));\n      return new BinaryDisposable(subscription, timer);\n    }, source);\n  }\n\n  function timeout(source, dueTime, other, scheduler) {\n    if (isScheduler(other)) {\n      scheduler = other;\n      other = observableThrow(new TimeoutError());\n    }\n    if (other instanceof Error) { other = observableThrow(other); }\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    Observable.isObservable(other) || (other = observableThrow(new TimeoutError()));\n    return new AnonymousObservable(function (o) {\n      var id = 0,\n        original = new SingleAssignmentDisposable(),\n        subscription = new SerialDisposable(),\n        switched = false,\n        timer = new SerialDisposable();\n\n      subscription.setDisposable(original);\n\n      function createTimer() {\n        var myId = id;\n        timer.setDisposable(scheduler.scheduleFuture(null, dueTime, function () {\n          switched = id === myId;\n          if (switched) {\n            isPromise(other) && (other = observableFromPromise(other));\n            subscription.setDisposable(other.subscribe(o));\n          }\n        }));\n      }\n\n      createTimer();\n\n      original.setDisposable(source.subscribe(function (x) {\n        if (!switched) {\n          id++;\n          o.onNext(x);\n          createTimer();\n        }\n      }, function (e) {\n        if (!switched) {\n          id++;\n          o.onError(e);\n        }\n      }, function () {\n        if (!switched) {\n          id++;\n          o.onCompleted();\n        }\n      }));\n      return new BinaryDisposable(subscription, timer);\n    }, source);\n  }\n\n  observableProto.timeout = function () {\n    var firstArg = arguments[0];\n    if (firstArg instanceof Date || typeof firstArg === 'number') {\n      return timeout(this, firstArg, arguments[1], arguments[2]);\n    } else if (Observable.isObservable(firstArg) || isFunction(firstArg)) {\n      return timeoutWithSelector(this, firstArg, arguments[1], arguments[2]);\n    } else {\n      throw new Error('Invalid arguments');\n    }\n  };\n\n  var GenerateAbsoluteObservable = (function (__super__) {\n    inherits(GenerateAbsoluteObservable, __super__);\n    function GenerateAbsoluteObservable(state, cndFn, itrFn, resFn, timeFn, s) {\n      this._state = state;\n      this._cndFn = cndFn;\n      this._itrFn = itrFn;\n      this._resFn = resFn;\n      this._timeFn = timeFn;\n      this._s = s;\n      this._first = true;\n      this._hasResult = false;\n      __super__.call(this);\n    }\n\n    function scheduleRecursive(self, recurse) {\n      self._hasResult && self._o.onNext(self._state);\n\n      if (self._first) {\n        self._first = false;\n      } else {\n        self._state = tryCatch(self._itrFn)(self._state);\n        if (self._state === errorObj) { return self._o.onError(self._state.e); }\n      }\n      self._hasResult = tryCatch(self._cndFn)(self._state);\n      if (self._hasResult === errorObj) { return self._o.onError(self._hasResult.e); }\n      if (self._hasResult) {\n        var result = tryCatch(self._resFn)(self._state);\n        if (result === errorObj) { return self._o.onError(result.e); }\n        var time = tryCatch(self._timeFn)(self._state);\n        if (time === errorObj) { return self._o.onError(time.e); }\n        recurse(self, time);\n      } else {\n        self._o.onCompleted();\n      }\n    }\n\n    GenerateAbsoluteObservable.prototype.subscribeCore = function (o) {\n      this._o = o;\n      return this._s.scheduleRecursiveFuture(this, new Date(this._s.now()), scheduleRecursive);\n    };\n\n    return GenerateAbsoluteObservable;\n  }(ObservableBase));\n\n  /**\n   *  GenerateAbsolutes an observable sequence by iterating a state from an initial state until the condition fails.\n   *\n   * @example\n   *  res = source.generateWithAbsoluteTime(0,\n   *      function (x) { return return true; },\n   *      function (x) { return x + 1; },\n   *      function (x) { return x; },\n   *      function (x) { return new Date(); }\n   *  });\n   *\n   * @param {Mixed} initialState Initial state.\n   * @param {Function} condition Condition to terminate generation (upon returning false).\n   * @param {Function} iterate Iteration step function.\n   * @param {Function} resultSelector Selector function for results produced in the sequence.\n   * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.\n   * @param {Scheduler} [scheduler]  Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.\n   * @returns {Observable} The generated sequence.\n   */\n  Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new GenerateAbsoluteObservable(initialState, condition, iterate, resultSelector, timeSelector, scheduler);\n  };\n\n  var GenerateRelativeObservable = (function (__super__) {\n    inherits(GenerateRelativeObservable, __super__);\n    function GenerateRelativeObservable(state, cndFn, itrFn, resFn, timeFn, s) {\n      this._state = state;\n      this._cndFn = cndFn;\n      this._itrFn = itrFn;\n      this._resFn = resFn;\n      this._timeFn = timeFn;\n      this._s = s;\n      this._first = true;\n      this._hasResult = false;\n      __super__.call(this);\n    }\n\n    function scheduleRecursive(self, recurse) {\n      self._hasResult && self._o.onNext(self._state);\n\n      if (self._first) {\n        self._first = false;\n      } else {\n        self._state = tryCatch(self._itrFn)(self._state);\n        if (self._state === errorObj) { return self._o.onError(self._state.e); }\n      }\n      self._hasResult = tryCatch(self._cndFn)(self._state);\n      if (self._hasResult === errorObj) { return self._o.onError(self._hasResult.e); }\n      if (self._hasResult) {\n        var result = tryCatch(self._resFn)(self._state);\n        if (result === errorObj) { return self._o.onError(result.e); }\n        var time = tryCatch(self._timeFn)(self._state);\n        if (time === errorObj) { return self._o.onError(time.e); }\n        recurse(self, time);\n      } else {\n        self._o.onCompleted();\n      }\n    }\n\n    GenerateRelativeObservable.prototype.subscribeCore = function (o) {\n      this._o = o;\n      return this._s.scheduleRecursiveFuture(this, 0, scheduleRecursive);\n    };\n\n    return GenerateRelativeObservable;\n  }(ObservableBase));\n\n  /**\n   *  Generates an observable sequence by iterating a state from an initial state until the condition fails.\n   *\n   * @example\n   *  res = source.generateWithRelativeTime(0,\n   *      function (x) { return return true; },\n   *      function (x) { return x + 1; },\n   *      function (x) { return x; },\n   *      function (x) { return 500; }\n   *  );\n   *\n   * @param {Mixed} initialState Initial state.\n   * @param {Function} condition Condition to terminate generation (upon returning false).\n   * @param {Function} iterate Iteration step function.\n   * @param {Function} resultSelector Selector function for results produced in the sequence.\n   * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.\n   * @param {Scheduler} [scheduler]  Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.\n   * @returns {Observable} The generated sequence.\n   */\n  Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new GenerateRelativeObservable(initialState, condition, iterate, resultSelector, timeSelector, scheduler);\n  };\n\n  var DelaySubscription = (function(__super__) {\n    inherits(DelaySubscription, __super__);\n    function DelaySubscription(source, dt, s) {\n      this.source = source;\n      this._dt = dt;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    DelaySubscription.prototype.subscribeCore = function (o) {\n      var d = new SerialDisposable();\n\n      d.setDisposable(this._s.scheduleFuture([this.source, o, d], this._dt, scheduleMethod));\n\n      return d;\n    };\n\n    function scheduleMethod(s, state) {\n      var source = state[0], o = state[1], d = state[2];\n      d.setDisposable(source.subscribe(o));\n    }\n\n    return DelaySubscription;\n  }(ObservableBase));\n\n  /**\n   *  Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.\n   *\n   * @example\n   *  1 - res = source.delaySubscription(5000); // 5s\n   *  2 - res = source.delaySubscription(5000, Rx.Scheduler.default); // 5 seconds\n   *\n   * @param {Number} dueTime Relative or absolute time shift of the subscription.\n   * @param {Scheduler} [scheduler]  Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.\n   * @returns {Observable} Time-shifted sequence.\n   */\n  observableProto.delaySubscription = function (dueTime, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new DelaySubscription(this, dueTime, scheduler);\n  };\n\n  var SkipLastWithTimeObservable = (function (__super__) {\n    inherits(SkipLastWithTimeObservable, __super__);\n    function SkipLastWithTimeObservable(source, d, s) {\n      this.source = source;\n      this._d = d;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    SkipLastWithTimeObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new SkipLastWithTimeObserver(o, this));\n    };\n\n    return SkipLastWithTimeObservable;\n  }(ObservableBase));\n\n  var SkipLastWithTimeObserver = (function (__super__) {\n    inherits(SkipLastWithTimeObserver, __super__);\n\n    function SkipLastWithTimeObserver(o, p) {\n      this._o = o;\n      this._s = p._s;\n      this._d = p._d;\n      this._q = [];\n      __super__.call(this);\n    }\n\n    SkipLastWithTimeObserver.prototype.next = function (x) {\n      var now = this._s.now();\n      this._q.push({ interval: now, value: x });\n      while (this._q.length > 0 && now - this._q[0].interval >= this._d) {\n        this._o.onNext(this._q.shift().value);\n      }\n    };\n    SkipLastWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\n    SkipLastWithTimeObserver.prototype.completed = function () {\n      var now = this._s.now();\n      while (this._q.length > 0 && now - this._q[0].interval >= this._d) {\n        this._o.onNext(this._q.shift().value);\n      }\n      this._o.onCompleted();\n    };\n\n    return SkipLastWithTimeObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.\n   * @description\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\n   *  result sequence. This causes elements to be delayed with duration.\n   * @param {Number} duration Duration for skipping elements from the end of the sequence.\n   * @param {Scheduler} [scheduler]  Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout\n   * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.\n   */\n  observableProto.skipLastWithTime = function (duration, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new SkipLastWithTimeObservable(this, duration, scheduler);\n  };\n\n  var TakeLastWithTimeObservable = (function (__super__) {\n    inherits(TakeLastWithTimeObservable, __super__);\n    function TakeLastWithTimeObservable(source, d, s) {\n      this.source = source;\n      this._d = d;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    TakeLastWithTimeObservable.prototype.subscribeCore = function (o) {\n      return this.source.subscribe(new TakeLastWithTimeObserver(o, this._d, this._s));\n    };\n\n    return TakeLastWithTimeObservable;\n  }(ObservableBase));\n\n  var TakeLastWithTimeObserver = (function (__super__) {\n    inherits(TakeLastWithTimeObserver, __super__);\n\n    function TakeLastWithTimeObserver(o, d, s) {\n      this._o = o;\n      this._d = d;\n      this._s = s;\n      this._q = [];\n      __super__.call(this);\n    }\n\n    TakeLastWithTimeObserver.prototype.next = function (x) {\n      var now = this._s.now();\n      this._q.push({ interval: now, value: x });\n      while (this._q.length > 0 && now - this._q[0].interval >= this._d) {\n        this._q.shift();\n      }\n    };\n    TakeLastWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\n    TakeLastWithTimeObserver.prototype.completed = function () {\n      var now = this._s.now();\n      while (this._q.length > 0) {\n        var next = this._q.shift();\n        if (now - next.interval <= this._d) { this._o.onNext(next.value); }\n      }\n      this._o.onCompleted();\n    };\n\n    return TakeLastWithTimeObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.\n   * @description\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\n   *  result sequence. This causes elements to be delayed with duration.\n   * @param {Number} duration Duration for taking elements from the end of the sequence.\n   * @param {Scheduler} [scheduler]  Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\n   * @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.\n   */\n  observableProto.takeLastWithTime = function (duration, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new TakeLastWithTimeObservable(this, duration, scheduler);\n  };\n\n  /**\n   *  Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.\n   * @description\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\n   *  result sequence. This causes elements to be delayed with duration.\n   * @param {Number} duration Duration for taking elements from the end of the sequence.\n   * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\n   * @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.\n   */\n  observableProto.takeLastBufferWithTime = function (duration, scheduler) {\n    var source = this;\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new AnonymousObservable(function (o) {\n      var q = [];\n      return source.subscribe(function (x) {\n        var now = scheduler.now();\n        q.push({ interval: now, value: x });\n        while (q.length > 0 && now - q[0].interval >= duration) {\n          q.shift();\n        }\n      }, function (e) { o.onError(e); }, function () {\n        var now = scheduler.now(), res = [];\n        while (q.length > 0) {\n          var next = q.shift();\n          now - next.interval <= duration && res.push(next.value);\n        }\n        o.onNext(res);\n        o.onCompleted();\n      });\n    }, source);\n  };\n\n  var TakeWithTimeObservable = (function (__super__) {\n    inherits(TakeWithTimeObservable, __super__);\n    function TakeWithTimeObservable(source, d, s) {\n      this.source = source;\n      this._d = d;\n      this._s = s;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(s, o) {\n      o.onCompleted();\n    }\n\n    TakeWithTimeObservable.prototype.subscribeCore = function (o) {\n      return new BinaryDisposable(\n        this._s.scheduleFuture(o, this._d, scheduleMethod),\n        this.source.subscribe(o)\n      );\n    };\n\n    return TakeWithTimeObservable;\n  }(ObservableBase));\n\n  /**\n   *  Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.\n   *\n   * @example\n   *  1 - res = source.takeWithTime(5000,  [optional scheduler]);\n   * @description\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\n   *  result sequence. This causes elements to be delayed with duration.\n   * @param {Number} duration Duration for taking elements from the start of the sequence.\n   * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\n   * @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.\n   */\n  observableProto.takeWithTime = function (duration, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new TakeWithTimeObservable(this, duration, scheduler);\n  };\n\n  var SkipWithTimeObservable = (function (__super__) {\n    inherits(SkipWithTimeObservable, __super__);\n    function SkipWithTimeObservable(source, d, s) {\n      this.source = source;\n      this._d = d;\n      this._s = s;\n      this._open = false;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(s, self) {\n      self._open = true;\n    }\n\n    SkipWithTimeObservable.prototype.subscribeCore = function (o) {\n      return new BinaryDisposable(\n        this._s.scheduleFuture(this, this._d, scheduleMethod),\n        this.source.subscribe(new SkipWithTimeObserver(o, this))\n      );\n    };\n\n    return SkipWithTimeObservable;\n  }(ObservableBase));\n\n  var SkipWithTimeObserver = (function (__super__) {\n    inherits(SkipWithTimeObserver, __super__);\n\n    function SkipWithTimeObserver(o, p) {\n      this._o = o;\n      this._p = p;\n      __super__.call(this);\n    }\n\n    SkipWithTimeObserver.prototype.next = function (x) { this._p._open && this._o.onNext(x); };\n    SkipWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\n    SkipWithTimeObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return SkipWithTimeObserver;\n  }(AbstractObserver));\n\n  /**\n   *  Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.\n   * @description\n   *  Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.\n   *  This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded\n   *  may not execute immediately, despite the zero due time.\n   *\n   *  Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.\n   * @param {Number} duration Duration for skipping elements from the start of the sequence.\n   * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\n   * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.\n   */\n  observableProto.skipWithTime = function (duration, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new SkipWithTimeObservable(this, duration, scheduler);\n  };\n\n  var SkipUntilWithTimeObservable = (function (__super__) {\n    inherits(SkipUntilWithTimeObservable, __super__);\n    function SkipUntilWithTimeObservable(source, startTime, scheduler) {\n      this.source = source;\n      this._st = startTime;\n      this._s = scheduler;\n      __super__.call(this);\n    }\n\n    function scheduleMethod(s, state) {\n      state._open = true;\n    }\n\n    SkipUntilWithTimeObservable.prototype.subscribeCore = function (o) {\n      this._open = false;\n      return new BinaryDisposable(\n        this._s.scheduleFuture(this, this._st, scheduleMethod),\n        this.source.subscribe(new SkipUntilWithTimeObserver(o, this))\n      );\n    };\n\n    return SkipUntilWithTimeObservable;\n  }(ObservableBase));\n\n  var SkipUntilWithTimeObserver = (function (__super__) {\n    inherits(SkipUntilWithTimeObserver, __super__);\n\n    function SkipUntilWithTimeObserver(o, p) {\n      this._o = o;\n      this._p = p;\n      __super__.call(this);\n    }\n\n    SkipUntilWithTimeObserver.prototype.next = function (x) { this._p._open && this._o.onNext(x); };\n    SkipUntilWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\n    SkipUntilWithTimeObserver.prototype.completed = function () { this._o.onCompleted(); };\n\n    return SkipUntilWithTimeObserver;\n  }(AbstractObserver));\n\n\n  /**\n   *  Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.\n   *  Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.\n   *\n   * @examples\n   *  1 - res = source.skipUntilWithTime(new Date(), [scheduler]);\n   *  2 - res = source.skipUntilWithTime(5000, [scheduler]);\n   * @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.\n   * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\n   * @returns {Observable} An observable sequence with the elements skipped until the specified start time.\n   */\n  observableProto.skipUntilWithTime = function (startTime, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    return new SkipUntilWithTimeObservable(this, startTime, scheduler);\n  };\n\n  /**\n   *  Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.\n   * @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.\n   * @param {Scheduler} [scheduler] Scheduler to run the timer on.\n   * @returns {Observable} An observable sequence with the elements taken until the specified end time.\n   */\n  observableProto.takeUntilWithTime = function (endTime, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    var source = this;\n    return new AnonymousObservable(function (o) {\n      return new BinaryDisposable(\n        scheduler.scheduleFuture(o, endTime, function (_, o) { o.onCompleted(); }),\n        source.subscribe(o));\n    }, source);\n  };\n\n  /**\n   * Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.\n   * @param {Number} windowDuration time to wait before emitting another item after emitting the last item\n   * @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.\n   * @returns {Observable} An Observable that performs the throttle operation.\n   */\n  observableProto.throttle = function (windowDuration, scheduler) {\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\n    var duration = +windowDuration || 0;\n    if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }\n    var source = this;\n    return new AnonymousObservable(function (o) {\n      var lastOnNext = 0;\n      return source.subscribe(\n        function (x) {\n          var now = scheduler.now();\n          if (lastOnNext === 0 || now - lastOnNext >= duration) {\n            lastOnNext = now;\n            o.onNext(x);\n          }\n        },function (e) { o.onError(e); }, function () { o.onCompleted(); }\n      );\n    }, source);\n  };\n\n  var TransduceObserver = (function (__super__) {\n    inherits(TransduceObserver, __super__);\n    function TransduceObserver(o, xform) {\n      this._o = o;\n      this._xform = xform;\n      __super__.call(this);\n    }\n\n    TransduceObserver.prototype.next = function (x) {\n      var res = tryCatch(this._xform['@@transducer/step']).call(this._xform, this._o, x);\n      if (res === errorObj) { this._o.onError(res.e); }\n    };\n\n    TransduceObserver.prototype.error = function (e) { this._o.onError(e); };\n\n    TransduceObserver.prototype.completed = function () {\n      this._xform['@@transducer/result'](this._o);\n    };\n\n    return TransduceObserver;\n  }(AbstractObserver));\n\n  function transformForObserver(o) {\n    return {\n      '@@transducer/init': function() {\n        return o;\n      },\n      '@@transducer/step': function(obs, input) {\n        return obs.onNext(input);\n      },\n      '@@transducer/result': function(obs) {\n        return obs.onCompleted();\n      }\n    };\n  }\n\n  /**\n   * Executes a transducer to transform the observable sequence\n   * @param {Transducer} transducer A transducer to execute\n   * @returns {Observable} An Observable sequence containing the results from the transducer.\n   */\n  observableProto.transduce = function(transducer) {\n    var source = this;\n    return new AnonymousObservable(function(o) {\n      var xform = transducer(transformForObserver(o));\n      return source.subscribe(new TransduceObserver(o, xform));\n    }, source);\n  };\n\n  var SwitchFirstObservable = (function (__super__) {\n    inherits(SwitchFirstObservable, __super__);\n    function SwitchFirstObservable(source) {\n      this.source = source;\n      __super__.call(this);\n    }\n\n    SwitchFirstObservable.prototype.subscribeCore = function (o) {\n      var m = new SingleAssignmentDisposable(),\n        g = new CompositeDisposable(),\n        state = {\n          hasCurrent: false,\n          isStopped: false,\n          o: o,\n          g: g\n        };\n\n      g.add(m);\n      m.setDisposable(this.source.subscribe(new SwitchFirstObserver(state)));\n      return g;\n    };\n\n    return SwitchFirstObservable;\n  }(ObservableBase));\n\n  var SwitchFirstObserver = (function(__super__) {\n    inherits(SwitchFirstObserver, __super__);\n    function SwitchFirstObserver(state) {\n      this._s = state;\n      __super__.call(this);\n    }\n\n    SwitchFirstObserver.prototype.next = function (x) {\n      if (!this._s.hasCurrent) {\n        this._s.hasCurrent = true;\n        isPromise(x) && (x = observableFromPromise(x));\n        var inner = new SingleAssignmentDisposable();\n        this._s.g.add(inner);\n        inner.setDisposable(x.subscribe(new InnerObserver(this._s, inner)));\n      }\n    };\n\n    SwitchFirstObserver.prototype.error = function (e) {\n      this._s.o.onError(e);\n    };\n\n    SwitchFirstObserver.prototype.completed = function () {\n      this._s.isStopped = true;\n      !this._s.hasCurrent && this._s.g.length === 1 && this._s.o.onCompleted();\n    };\n\n    inherits(InnerObserver, __super__);\n    function InnerObserver(state, inner) {\n      this._s = state;\n      this._i = inner;\n      __super__.call(this);\n    }\n\n    InnerObserver.prototype.next = function (x) { this._s.o.onNext(x); };\n    InnerObserver.prototype.error = function (e) { this._s.o.onError(e); };\n    InnerObserver.prototype.completed = function () {\n      this._s.g.remove(this._i);\n      this._s.hasCurrent = false;\n      this._s.isStopped && this._s.g.length === 1 && this._s.o.onCompleted();\n    };\n\n    return SwitchFirstObserver;\n  }(AbstractObserver));\n\n  /**\n   * Performs a exclusive waiting for the first to finish before subscribing to another observable.\n   * Observables that come in between subscriptions will be dropped on the floor.\n   * @returns {Observable} A exclusive observable with only the results that happen when subscribed.\n   */\n  observableProto.switchFirst = function () {\n    return new SwitchFirstObservable(this);\n  };\n\nobservableProto.flatMapFirst = observableProto.selectManyFirst = function(selector, resultSelector, thisArg) {\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).switchFirst();\n};\n\nRx.Observable.prototype.flatMapWithMaxConcurrent = function(limit, selector, resultSelector, thisArg) {\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit);\n};\n  /** Provides a set of extension methods for virtual time scheduling. */\n  var VirtualTimeScheduler = Rx.VirtualTimeScheduler = (function (__super__) {\n    inherits(VirtualTimeScheduler, __super__);\n\n    /**\n     * Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.\n     *\n     * @constructor\n     * @param {Number} initialClock Initial value for the clock.\n     * @param {Function} comparer Comparer to determine causality of events based on absolute time.\n     */\n    function VirtualTimeScheduler(initialClock, comparer) {\n      this.clock = initialClock;\n      this.comparer = comparer;\n      this.isEnabled = false;\n      this.queue = new PriorityQueue(1024);\n      __super__.call(this);\n    }\n\n    var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;\n\n    VirtualTimeSchedulerPrototype.now = function () {\n      return this.toAbsoluteTime(this.clock);\n    };\n\n    VirtualTimeSchedulerPrototype.schedule = function (state, action) {\n      return this.scheduleAbsolute(state, this.clock, action);\n    };\n\n    VirtualTimeSchedulerPrototype.scheduleFuture = function (state, dueTime, action) {\n      var dt = dueTime instanceof Date ?\n        this.toRelativeTime(dueTime - this.now()) :\n        this.toRelativeTime(dueTime);\n\n      return this.scheduleRelative(state, dt, action);\n    };\n\n    /**\n     * Adds a relative time value to an absolute time value.\n     * @param {Number} absolute Absolute virtual time value.\n     * @param {Number} relative Relative virtual time value to add.\n     * @return {Number} Resulting absolute virtual time sum value.\n     */\n    VirtualTimeSchedulerPrototype.add = notImplemented;\n\n    /**\n     * Converts an absolute time to a number\n     * @param {Any} The absolute time.\n     * @returns {Number} The absolute time in ms\n     */\n    VirtualTimeSchedulerPrototype.toAbsoluteTime = notImplemented;\n\n    /**\n     * Converts the TimeSpan value to a relative virtual time value.\n     * @param {Number} timeSpan TimeSpan value to convert.\n     * @return {Number} Corresponding relative virtual time value.\n     */\n    VirtualTimeSchedulerPrototype.toRelativeTime = notImplemented;\n\n    /**\n     * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.\n     * @param {Mixed} state Initial state passed to the action upon the first iteration.\n     * @param {Number} period Period for running the work periodically.\n     * @param {Function} action Action to be executed, potentially updating the state.\n     * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).\n     */\n    VirtualTimeSchedulerPrototype.schedulePeriodic = function (state, period, action) {\n      var s = new SchedulePeriodicRecursive(this, state, period, action);\n      return s.start();\n    };\n\n    /**\n     * Schedules an action to be executed after dueTime.\n     * @param {Mixed} state State passed to the action to be executed.\n     * @param {Number} dueTime Relative time after which to execute the action.\n     * @param {Function} action Action to be executed.\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\n     */\n    VirtualTimeSchedulerPrototype.scheduleRelative = function (state, dueTime, action) {\n      var runAt = this.add(this.clock, dueTime);\n      return this.scheduleAbsolute(state, runAt, action);\n    };\n\n    /**\n     * Starts the virtual time scheduler.\n     */\n    VirtualTimeSchedulerPrototype.start = function () {\n      if (!this.isEnabled) {\n        this.isEnabled = true;\n        do {\n          var next = this.getNext();\n          if (next !== null) {\n            this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);\n            next.invoke();\n          } else {\n            this.isEnabled = false;\n          }\n        } while (this.isEnabled);\n      }\n    };\n\n    /**\n     * Stops the virtual time scheduler.\n     */\n    VirtualTimeSchedulerPrototype.stop = function () {\n      this.isEnabled = false;\n    };\n\n    /**\n     * Advances the scheduler's clock to the specified time, running all work till that point.\n     * @param {Number} time Absolute time to advance the scheduler's clock to.\n     */\n    VirtualTimeSchedulerPrototype.advanceTo = function (time) {\n      var dueToClock = this.comparer(this.clock, time);\n      if (this.comparer(this.clock, time) > 0) { throw new ArgumentOutOfRangeError(); }\n      if (dueToClock === 0) { return; }\n      if (!this.isEnabled) {\n        this.isEnabled = true;\n        do {\n          var next = this.getNext();\n          if (next !== null && this.comparer(next.dueTime, time) <= 0) {\n            this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);\n            next.invoke();\n          } else {\n            this.isEnabled = false;\n          }\n        } while (this.isEnabled);\n        this.clock = time;\n      }\n    };\n\n    /**\n     * Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.\n     * @param {Number} time Relative time to advance the scheduler's clock by.\n     */\n    VirtualTimeSchedulerPrototype.advanceBy = function (time) {\n      var dt = this.add(this.clock, time),\n          dueToClock = this.comparer(this.clock, dt);\n      if (dueToClock > 0) { throw new ArgumentOutOfRangeError(); }\n      if (dueToClock === 0) {  return; }\n\n      this.advanceTo(dt);\n    };\n\n    /**\n     * Advances the scheduler's clock by the specified relative time.\n     * @param {Number} time Relative time to advance the scheduler's clock by.\n     */\n    VirtualTimeSchedulerPrototype.sleep = function (time) {\n      var dt = this.add(this.clock, time);\n      if (this.comparer(this.clock, dt) >= 0) { throw new ArgumentOutOfRangeError(); }\n\n      this.clock = dt;\n    };\n\n    /**\n     * Gets the next scheduled item to be executed.\n     * @returns {ScheduledItem} The next scheduled item.\n     */\n    VirtualTimeSchedulerPrototype.getNext = function () {\n      while (this.queue.length > 0) {\n        var next = this.queue.peek();\n        if (next.isCancelled()) {\n          this.queue.dequeue();\n        } else {\n          return next;\n        }\n      }\n      return null;\n    };\n\n    /**\n     * Schedules an action to be executed at dueTime.\n     * @param {Mixed} state State passed to the action to be executed.\n     * @param {Number} dueTime Absolute time at which to execute the action.\n     * @param {Function} action Action to be executed.\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\n     */\n    VirtualTimeSchedulerPrototype.scheduleAbsolute = function (state, dueTime, action) {\n      var self = this;\n\n      function run(scheduler, state1) {\n        self.queue.remove(si);\n        return action(scheduler, state1);\n      }\n\n      var si = new ScheduledItem(this, state, run, dueTime, this.comparer);\n      this.queue.enqueue(si);\n\n      return si.disposable;\n    };\n\n    return VirtualTimeScheduler;\n  }(Scheduler));\n\n  /** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */\n  Rx.HistoricalScheduler = (function (__super__) {\n    inherits(HistoricalScheduler, __super__);\n\n    /**\n     * Creates a new historical scheduler with the specified initial clock value.\n     * @constructor\n     * @param {Number} initialClock Initial value for the clock.\n     * @param {Function} comparer Comparer to determine causality of events based on absolute time.\n     */\n    function HistoricalScheduler(initialClock, comparer) {\n      var clock = initialClock == null ? 0 : initialClock;\n      var cmp = comparer || defaultSubComparer;\n      __super__.call(this, clock, cmp);\n    }\n\n    var HistoricalSchedulerProto = HistoricalScheduler.prototype;\n\n    /**\n     * Adds a relative time value to an absolute time value.\n     * @param {Number} absolute Absolute virtual time value.\n     * @param {Number} relative Relative virtual time value to add.\n     * @return {Number} Resulting absolute virtual time sum value.\n     */\n    HistoricalSchedulerProto.add = function (absolute, relative) {\n      return absolute + relative;\n    };\n\n    HistoricalSchedulerProto.toAbsoluteTime = function (absolute) {\n      return new Date(absolute).getTime();\n    };\n\n    /**\n     * Converts the TimeSpan value to a relative virtual time value.\n     * @memberOf HistoricalScheduler\n     * @param {Number} timeSpan TimeSpan value to convert.\n     * @return {Number} Corresponding relative virtual time value.\n     */\n    HistoricalSchedulerProto.toRelativeTime = function (timeSpan) {\n      return timeSpan;\n    };\n\n    return HistoricalScheduler;\n  }(Rx.VirtualTimeScheduler));\n\nfunction OnNextPredicate(predicate) {\n    this.predicate = predicate;\n}\n\nOnNextPredicate.prototype.equals = function (other) {\n  if (other === this) { return true; }\n  if (other == null) { return false; }\n  if (other.kind !== 'N') { return false; }\n  return this.predicate(other.value);\n};\n\nfunction OnErrorPredicate(predicate) {\n  this.predicate = predicate;\n}\n\nOnErrorPredicate.prototype.equals = function (other) {\n  if (other === this) { return true; }\n  if (other == null) { return false; }\n  if (other.kind !== 'E') { return false; }\n  return this.predicate(other.error);\n};\n\nvar ReactiveTest = Rx.ReactiveTest = {\n  /** Default virtual time used for creation of observable sequences in unit tests. */\n  created: 100,\n  /** Default virtual time used to subscribe to observable sequences in unit tests. */\n  subscribed: 200,\n  /** Default virtual time used to dispose subscriptions in unit tests. */\n  disposed: 1000,\n\n  /**\n   * Factory method for an OnNext notification record at a given time with a given value or a predicate function.\n   *\n   * 1 - ReactiveTest.onNext(200, 42);\n   * 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });\n   *\n   * @param ticks Recorded virtual time the OnNext notification occurs.\n   * @param value Recorded value stored in the OnNext notification or a predicate.\n   * @return Recorded OnNext notification.\n   */\n  onNext: function (ticks, value) {\n    return typeof value === 'function' ?\n      new Recorded(ticks, new OnNextPredicate(value)) :\n      new Recorded(ticks, Notification.createOnNext(value));\n  },\n  /**\n   * Factory method for an OnError notification record at a given time with a given error.\n   *\n   * 1 - ReactiveTest.onNext(200, new Error('error'));\n   * 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });\n   *\n   * @param ticks Recorded virtual time the OnError notification occurs.\n   * @param exception Recorded exception stored in the OnError notification.\n   * @return Recorded OnError notification.\n   */\n  onError: function (ticks, error) {\n    return typeof error === 'function' ?\n      new Recorded(ticks, new OnErrorPredicate(error)) :\n      new Recorded(ticks, Notification.createOnError(error));\n  },\n  /**\n   * Factory method for an OnCompleted notification record at a given time.\n   *\n   * @param ticks Recorded virtual time the OnCompleted notification occurs.\n   * @return Recorded OnCompleted notification.\n   */\n  onCompleted: function (ticks) {\n    return new Recorded(ticks, Notification.createOnCompleted());\n  },\n  /**\n   * Factory method for a subscription record based on a given subscription and disposal time.\n   *\n   * @param start Virtual time indicating when the subscription was created.\n   * @param end Virtual time indicating when the subscription was disposed.\n   * @return Subscription object.\n   */\n  subscribe: function (start, end) {\n    return new Subscription(start, end);\n  }\n};\n\n  /**\n   * Creates a new object recording the production of the specified value at the given virtual time.\n   *\n   * @constructor\n   * @param {Number} time Virtual time the value was produced on.\n   * @param {Mixed} value Value that was produced.\n   * @param {Function} comparer An optional comparer.\n   */\n  var Recorded = Rx.Recorded = function (time, value, comparer) {\n    this.time = time;\n    this.value = value;\n    this.comparer = comparer || defaultComparer;\n  };\n\n  /**\n   * Checks whether the given recorded object is equal to the current instance.\n   *\n   * @param {Recorded} other Recorded object to check for equality.\n   * @returns {Boolean} true if both objects are equal; false otherwise.\n   */\n  Recorded.prototype.equals = function (other) {\n    return this.time === other.time && this.comparer(this.value, other.value);\n  };\n\n  /**\n   * Returns a string representation of the current Recorded value.\n   *\n   * @returns {String} String representation of the current Recorded value.\n   */\n  Recorded.prototype.toString = function () {\n    return this.value.toString() + '@' + this.time;\n  };\n\n  /**\n   * Creates a new subscription object with the given virtual subscription and unsubscription time.\n   *\n   * @constructor\n   * @param {Number} subscribe Virtual time at which the subscription occurred.\n   * @param {Number} unsubscribe Virtual time at which the unsubscription occurred.\n   */\n  var Subscription = Rx.Subscription = function (start, end) {\n    this.subscribe = start;\n    this.unsubscribe = end || Number.MAX_VALUE;\n  };\n\n  /**\n   * Checks whether the given subscription is equal to the current instance.\n   * @param other Subscription object to check for equality.\n   * @returns {Boolean} true if both objects are equal; false otherwise.\n   */\n  Subscription.prototype.equals = function (other) {\n    return this.subscribe === other.subscribe && this.unsubscribe === other.unsubscribe;\n  };\n\n  /**\n   * Returns a string representation of the current Subscription value.\n   * @returns {String} String representation of the current Subscription value.\n   */\n  Subscription.prototype.toString = function () {\n    return '(' + this.subscribe + ', ' + (this.unsubscribe === Number.MAX_VALUE ? 'Infinite' : this.unsubscribe) + ')';\n  };\n\n  var MockDisposable = Rx.MockDisposable = function (scheduler) {\n    this.scheduler = scheduler;\n    this.disposes = [];\n    this.disposes.push(this.scheduler.clock);\n  };\n\n  MockDisposable.prototype.dispose = function () {\n    this.disposes.push(this.scheduler.clock);\n  };\n\n  var MockObserver = (function (__super__) {\n    inherits(MockObserver, __super__);\n\n    function MockObserver(scheduler) {\n      __super__.call(this);\n      this.scheduler = scheduler;\n      this.messages = [];\n    }\n\n    var MockObserverPrototype = MockObserver.prototype;\n\n    MockObserverPrototype.onNext = function (value) {\n      this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));\n    };\n\n    MockObserverPrototype.onError = function (e) {\n      this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(e)));\n    };\n\n    MockObserverPrototype.onCompleted = function () {\n      this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));\n    };\n\n    return MockObserver;\n  })(Observer);\n\n  function MockPromise(scheduler, messages) {\n    var self = this;\n    this.scheduler = scheduler;\n    this.messages = messages;\n    this.subscriptions = [];\n    this.observers = [];\n    for (var i = 0, len = this.messages.length; i < len; i++) {\n      var message = this.messages[i],\n          notification = message.value;\n      (function (innerNotification) {\n        scheduler.scheduleAbsolute(null, message.time, function () {\n          var obs = self.observers.slice(0);\n\n          for (var j = 0, jLen = obs.length; j < jLen; j++) {\n            innerNotification.accept(obs[j]);\n          }\n          return disposableEmpty;\n        });\n      })(notification);\n    }\n  }\n\n  MockPromise.prototype.then = function (onResolved, onRejected) {\n    var self = this;\n\n    this.subscriptions.push(new Subscription(this.scheduler.clock));\n    var index = this.subscriptions.length - 1;\n\n    var newPromise;\n\n    var observer = Rx.Observer.create(\n      function (x) {\n        var retValue = onResolved(x);\n        if (retValue && typeof retValue.then === 'function') {\n          newPromise = retValue;\n        } else {\n          var ticks = self.scheduler.clock;\n          newPromise = new MockPromise(self.scheduler, [Rx.ReactiveTest.onNext(ticks, undefined), Rx.ReactiveTest.onCompleted(ticks)]);\n        }\n        var idx = self.observers.indexOf(observer);\n        self.observers.splice(idx, 1);\n        self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);\n      },\n      function (err) {\n        onRejected(err);\n        var idx = self.observers.indexOf(observer);\n        self.observers.splice(idx, 1);\n        self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);\n      }\n    );\n    this.observers.push(observer);\n\n    return newPromise || new MockPromise(this.scheduler, this.messages);\n  };\n\n  var HotObservable = (function (__super__) {\n    inherits(HotObservable, __super__);\n\n    function HotObservable(scheduler, messages) {\n      __super__.call(this);\n      var message, notification, observable = this;\n      this.scheduler = scheduler;\n      this.messages = messages;\n      this.subscriptions = [];\n      this.observers = [];\n      for (var i = 0, len = this.messages.length; i < len; i++) {\n        message = this.messages[i];\n        notification = message.value;\n        (function (innerNotification) {\n          scheduler.scheduleAbsolute(null, message.time, function () {\n            var obs = observable.observers.slice(0);\n\n            for (var j = 0, jLen = obs.length; j < jLen; j++) {\n              innerNotification.accept(obs[j]);\n            }\n            return disposableEmpty;\n          });\n        })(notification);\n      }\n    }\n\n    HotObservable.prototype._subscribe = function (o) {\n      var observable = this;\n      this.observers.push(o);\n      this.subscriptions.push(new Subscription(this.scheduler.clock));\n      var index = this.subscriptions.length - 1;\n      return disposableCreate(function () {\n        var idx = observable.observers.indexOf(o);\n        observable.observers.splice(idx, 1);\n        observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);\n      });\n    };\n\n    return HotObservable;\n  })(Observable);\n\n  var ColdObservable = (function (__super__) {\n    inherits(ColdObservable, __super__);\n\n    function ColdObservable(scheduler, messages) {\n      __super__.call(this);\n      this.scheduler = scheduler;\n      this.messages = messages;\n      this.subscriptions = [];\n    }\n\n    ColdObservable.prototype._subscribe = function (o) {\n      var message, notification, observable = this;\n      this.subscriptions.push(new Subscription(this.scheduler.clock));\n      var index = this.subscriptions.length - 1;\n      var d = new CompositeDisposable();\n      for (var i = 0, len = this.messages.length; i < len; i++) {\n        message = this.messages[i];\n        notification = message.value;\n        (function (innerNotification) {\n          d.add(observable.scheduler.scheduleRelative(null, message.time, function () {\n            innerNotification.accept(o);\n            return disposableEmpty;\n          }));\n        })(notification);\n      }\n      return disposableCreate(function () {\n        observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);\n        d.dispose();\n      });\n    };\n\n    return ColdObservable;\n  })(Observable);\n\n  /** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */\n  Rx.TestScheduler = (function (__super__) {\n    inherits(TestScheduler, __super__);\n\n    function baseComparer(x, y) {\n      return x > y ? 1 : (x < y ? -1 : 0);\n    }\n\n    function TestScheduler() {\n      __super__.call(this, 0, baseComparer);\n    }\n\n    /**\n     * Schedules an action to be executed at the specified virtual time.\n     *\n     * @param state State passed to the action to be executed.\n     * @param dueTime Absolute virtual time at which to execute the action.\n     * @param action Action to be executed.\n     * @return Disposable object used to cancel the scheduled action (best effort).\n     */\n    TestScheduler.prototype.scheduleAbsolute = function (state, dueTime, action) {\n      dueTime <= this.clock && (dueTime = this.clock + 1);\n      return __super__.prototype.scheduleAbsolute.call(this, state, dueTime, action);\n    };\n    /**\n     * Adds a relative virtual time to an absolute virtual time value.\n     *\n     * @param absolute Absolute virtual time value.\n     * @param relative Relative virtual time value to add.\n     * @return Resulting absolute virtual time sum value.\n     */\n    TestScheduler.prototype.add = function (absolute, relative) {\n      return absolute + relative;\n    };\n    /**\n     * Converts the absolute virtual time value to a DateTimeOffset value.\n     *\n     * @param absolute Absolute virtual time value to convert.\n     * @return Corresponding DateTimeOffset value.\n     */\n    TestScheduler.prototype.toAbsoluteTime = function (absolute) {\n      return new Date(absolute).getTime();\n    };\n    /**\n     * Converts the TimeSpan value to a relative virtual time value.\n     *\n     * @param timeSpan TimeSpan value to convert.\n     * @return Corresponding relative virtual time value.\n     */\n    TestScheduler.prototype.toRelativeTime = function (timeSpan) {\n      return timeSpan;\n    };\n    /**\n     * Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.\n     *\n     * @param create Factory method to create an observable sequence.\n     * @param created Virtual time at which to invoke the factory to create an observable sequence.\n     * @param subscribed Virtual time at which to subscribe to the created observable sequence.\n     * @param disposed Virtual time at which to dispose the subscription.\n     * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.\n     */\n    TestScheduler.prototype.startScheduler = function (createFn, settings) {\n      settings || (settings = {});\n      settings.created == null && (settings.created = ReactiveTest.created);\n      settings.subscribed == null && (settings.subscribed = ReactiveTest.subscribed);\n      settings.disposed == null && (settings.disposed = ReactiveTest.disposed);\n\n      var observer = this.createObserver(), source, subscription;\n\n      this.scheduleAbsolute(null, settings.created, function () {\n        source = createFn();\n        return disposableEmpty;\n      });\n\n      this.scheduleAbsolute(null, settings.subscribed, function () {\n        subscription = source.subscribe(observer);\n        return disposableEmpty;\n      });\n\n      this.scheduleAbsolute(null, settings.disposed, function () {\n        subscription.dispose();\n        return disposableEmpty;\n      });\n\n      this.start();\n\n      return observer;\n    };\n\n    /**\n     * Creates a hot observable using the specified timestamped notification messages either as an array or arguments.\n     * @param messages Notifications to surface through the created sequence at their specified absolute virtual times.\n     * @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.\n     */\n    TestScheduler.prototype.createHotObservable = function () {\n      var len = arguments.length, args;\n      if (Array.isArray(arguments[0])) {\n        args = arguments[0];\n      } else {\n        args = new Array(len);\n        for (var i = 0; i < len; i++) { args[i] = arguments[i]; }\n      }\n      return new HotObservable(this, args);\n    };\n\n    /**\n     * Creates a cold observable using the specified timestamped notification messages either as an array or arguments.\n     * @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.\n     * @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.\n     */\n    TestScheduler.prototype.createColdObservable = function () {\n      var len = arguments.length, args;\n      if (Array.isArray(arguments[0])) {\n        args = arguments[0];\n      } else {\n        args = new Array(len);\n        for (var i = 0; i < len; i++) { args[i] = arguments[i]; }\n      }\n      return new ColdObservable(this, args);\n    };\n\n    /**\n     * Creates a resolved promise with the given value and ticks\n     * @param {Number} ticks The absolute time of the resolution.\n     * @param {Any} value The value to yield at the given tick.\n     * @returns {MockPromise} A mock Promise which fulfills with the given value.\n     */\n    TestScheduler.prototype.createResolvedPromise = function (ticks, value) {\n      return new MockPromise(this, [Rx.ReactiveTest.onNext(ticks, value), Rx.ReactiveTest.onCompleted(ticks)]);\n    };\n\n    /**\n     * Creates a rejected promise with the given reason and ticks\n     * @param {Number} ticks The absolute time of the resolution.\n     * @param {Any} reason The reason for rejection to yield at the given tick.\n     * @returns {MockPromise} A mock Promise which rejects with the given reason.\n     */\n    TestScheduler.prototype.createRejectedPromise = function (ticks, reason) {\n      return new MockPromise(this, [Rx.ReactiveTest.onError(ticks, reason)]);\n    };\n\n    /**\n     * Creates an observer that records received notification messages and timestamps those.\n     * @return Observer that can be used to assert the timing of received notifications.\n     */\n    TestScheduler.prototype.createObserver = function () {\n      return new MockObserver(this);\n    };\n\n    return TestScheduler;\n  })(VirtualTimeScheduler);\n\n  var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {\n    inherits(AnonymousObservable, __super__);\n\n    // Fix subscriber to check for undefined or function returned to decorate as Disposable\n    function fixSubscriber(subscriber) {\n      return subscriber && isFunction(subscriber.dispose) ? subscriber :\n        isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;\n    }\n\n    function setDisposable(s, state) {\n      var ado = state[0], self = state[1];\n      var sub = tryCatch(self.__subscribe).call(self, ado);\n      if (sub === errorObj && !ado.fail(errorObj.e)) { thrower(errorObj.e); }\n      ado.setDisposable(fixSubscriber(sub));\n    }\n\n    function AnonymousObservable(subscribe, parent) {\n      this.source = parent;\n      this.__subscribe = subscribe;\n      __super__.call(this);\n    }\n\n    AnonymousObservable.prototype._subscribe = function (o) {\n      var ado = new AutoDetachObserver(o), state = [ado, this];\n\n      if (currentThreadScheduler.scheduleRequired()) {\n        currentThreadScheduler.schedule(state, setDisposable);\n      } else {\n        setDisposable(null, state);\n      }\n      return ado;\n    };\n\n    return AnonymousObservable;\n\n  }(Observable));\n\n  var AutoDetachObserver = (function (__super__) {\n    inherits(AutoDetachObserver, __super__);\n\n    function AutoDetachObserver(observer) {\n      __super__.call(this);\n      this.observer = observer;\n      this.m = new SingleAssignmentDisposable();\n    }\n\n    var AutoDetachObserverPrototype = AutoDetachObserver.prototype;\n\n    AutoDetachObserverPrototype.next = function (value) {\n      var result = tryCatch(this.observer.onNext).call(this.observer, value);\n      if (result === errorObj) {\n        this.dispose();\n        thrower(result.e);\n      }\n    };\n\n    AutoDetachObserverPrototype.error = function (err) {\n      var result = tryCatch(this.observer.onError).call(this.observer, err);\n      this.dispose();\n      result === errorObj && thrower(result.e);\n    };\n\n    AutoDetachObserverPrototype.completed = function () {\n      var result = tryCatch(this.observer.onCompleted).call(this.observer);\n      this.dispose();\n      result === errorObj && thrower(result.e);\n    };\n\n    AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };\n    AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };\n\n    AutoDetachObserverPrototype.dispose = function () {\n      __super__.prototype.dispose.call(this);\n      this.m.dispose();\n    };\n\n    return AutoDetachObserver;\n  }(AbstractObserver));\n\n  var UnderlyingObservable = (function (__super__) {\n    inherits(UnderlyingObservable, __super__);\n    function UnderlyingObservable(m, u) {\n      this._m = m;\n      this._u = u;\n      __super__.call(this);\n    }\n\n    UnderlyingObservable.prototype.subscribeCore = function (o) {\n      return new BinaryDisposable(this._m.getDisposable(), this._u.subscribe(o));\n    };\n\n    return UnderlyingObservable;\n  }(ObservableBase));\n\n  var GroupedObservable = (function (__super__) {\n    inherits(GroupedObservable, __super__);\n    function GroupedObservable(key, underlyingObservable, mergedDisposable) {\n      __super__.call(this);\n      this.key = key;\n      this.underlyingObservable = !mergedDisposable ?\n        underlyingObservable :\n        new UnderlyingObservable(mergedDisposable, underlyingObservable);\n    }\n\n    GroupedObservable.prototype._subscribe = function (o) {\n      return this.underlyingObservable.subscribe(o);\n    };\n\n    return GroupedObservable;\n  }(Observable));\n\n  /**\n   *  Represents an object that is both an observable sequence as well as an observer.\n   *  Each notification is broadcasted to all subscribed observers.\n   */\n  var Subject = Rx.Subject = (function (__super__) {\n    inherits(Subject, __super__);\n    function Subject() {\n      __super__.call(this);\n      this.isDisposed = false;\n      this.isStopped = false;\n      this.observers = [];\n      this.hasError = false;\n    }\n\n    addProperties(Subject.prototype, Observer.prototype, {\n      _subscribe: function (o) {\n        checkDisposed(this);\n        if (!this.isStopped) {\n          this.observers.push(o);\n          return new InnerSubscription(this, o);\n        }\n        if (this.hasError) {\n          o.onError(this.error);\n          return disposableEmpty;\n        }\n        o.onCompleted();\n        return disposableEmpty;\n      },\n      /**\n       * Indicates whether the subject has observers subscribed to it.\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\n       */\n      hasObservers: function () { return this.observers.length > 0; },\n      /**\n       * Notifies all subscribed observers about the end of the sequence.\n       */\n      onCompleted: function () {\n        checkDisposed(this);\n        if (!this.isStopped) {\n          this.isStopped = true;\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n            os[i].onCompleted();\n          }\n\n          this.observers.length = 0;\n        }\n      },\n      /**\n       * Notifies all subscribed observers about the exception.\n       * @param {Mixed} error The exception to send to all observers.\n       */\n      onError: function (error) {\n        checkDisposed(this);\n        if (!this.isStopped) {\n          this.isStopped = true;\n          this.error = error;\n          this.hasError = true;\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n            os[i].onError(error);\n          }\n\n          this.observers.length = 0;\n        }\n      },\n      /**\n       * Notifies all subscribed observers about the arrival of the specified element in the sequence.\n       * @param {Mixed} value The value to send to all observers.\n       */\n      onNext: function (value) {\n        checkDisposed(this);\n        if (!this.isStopped) {\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n            os[i].onNext(value);\n          }\n        }\n      },\n      /**\n       * Unsubscribe all observers and release resources.\n       */\n      dispose: function () {\n        this.isDisposed = true;\n        this.observers = null;\n      }\n    });\n\n    /**\n     * Creates a subject from the specified observer and observable.\n     * @param {Observer} observer The observer used to send messages to the subject.\n     * @param {Observable} observable The observable used to subscribe to messages sent from the subject.\n     * @returns {Subject} Subject implemented using the given observer and observable.\n     */\n    Subject.create = function (observer, observable) {\n      return new AnonymousSubject(observer, observable);\n    };\n\n    return Subject;\n  }(Observable));\n\n  /**\n   *  Represents the result of an asynchronous operation.\n   *  The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.\n   */\n  var AsyncSubject = Rx.AsyncSubject = (function (__super__) {\n    inherits(AsyncSubject, __super__);\n\n    /**\n     * Creates a subject that can only receive one value and that value is cached for all future observations.\n     * @constructor\n     */\n    function AsyncSubject() {\n      __super__.call(this);\n      this.isDisposed = false;\n      this.isStopped = false;\n      this.hasValue = false;\n      this.observers = [];\n      this.hasError = false;\n    }\n\n    addProperties(AsyncSubject.prototype, Observer.prototype, {\n      _subscribe: function (o) {\n        checkDisposed(this);\n\n        if (!this.isStopped) {\n          this.observers.push(o);\n          return new InnerSubscription(this, o);\n        }\n\n        if (this.hasError) {\n          o.onError(this.error);\n        } else if (this.hasValue) {\n          o.onNext(this.value);\n          o.onCompleted();\n        } else {\n          o.onCompleted();\n        }\n\n        return disposableEmpty;\n      },\n      /**\n       * Indicates whether the subject has observers subscribed to it.\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\n       */\n      hasObservers: function () {\n        checkDisposed(this);\n        return this.observers.length > 0;\n      },\n      /**\n       * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).\n       */\n      onCompleted: function () {\n        var i, len;\n        checkDisposed(this);\n        if (!this.isStopped) {\n          this.isStopped = true;\n          var os = cloneArray(this.observers), len = os.length;\n\n          if (this.hasValue) {\n            for (i = 0; i < len; i++) {\n              var o = os[i];\n              o.onNext(this.value);\n              o.onCompleted();\n            }\n          } else {\n            for (i = 0; i < len; i++) {\n              os[i].onCompleted();\n            }\n          }\n\n          this.observers.length = 0;\n        }\n      },\n      /**\n       * Notifies all subscribed observers about the error.\n       * @param {Mixed} error The Error to send to all observers.\n       */\n      onError: function (error) {\n        checkDisposed(this);\n        if (!this.isStopped) {\n          this.isStopped = true;\n          this.hasError = true;\n          this.error = error;\n\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n            os[i].onError(error);\n          }\n\n          this.observers.length = 0;\n        }\n      },\n      /**\n       * Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.\n       * @param {Mixed} value The value to store in the subject.\n       */\n      onNext: function (value) {\n        checkDisposed(this);\n        if (this.isStopped) { return; }\n        this.value = value;\n        this.hasValue = true;\n      },\n      /**\n       * Unsubscribe all observers and release resources.\n       */\n      dispose: function () {\n        this.isDisposed = true;\n        this.observers = null;\n        this.error = null;\n        this.value = null;\n      }\n    });\n\n    return AsyncSubject;\n  }(Observable));\n\n  /**\n   *  Represents a value that changes over time.\n   *  Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.\n   */\n  var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {\n    inherits(BehaviorSubject, __super__);\n    function BehaviorSubject(value) {\n      __super__.call(this);\n      this.value = value;\n      this.observers = [];\n      this.isDisposed = false;\n      this.isStopped = false;\n      this.hasError = false;\n    }\n\n    addProperties(BehaviorSubject.prototype, Observer.prototype, {\n      _subscribe: function (o) {\n        checkDisposed(this);\n        if (!this.isStopped) {\n          this.observers.push(o);\n          o.onNext(this.value);\n          return new InnerSubscription(this, o);\n        }\n        if (this.hasError) {\n          o.onError(this.error);\n        } else {\n          o.onCompleted();\n        }\n        return disposableEmpty;\n      },\n      /**\n       * Gets the current value or throws an exception.\n       * Value is frozen after onCompleted is called.\n       * After onError is called always throws the specified exception.\n       * An exception is always thrown after dispose is called.\n       * @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.\n       */\n      getValue: function () {\n        checkDisposed(this);\n        if (this.hasError) { thrower(this.error); }\n        return this.value;\n      },\n      /**\n       * Indicates whether the subject has observers subscribed to it.\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\n       */\n      hasObservers: function () { return this.observers.length > 0; },\n      /**\n       * Notifies all subscribed observers about the end of the sequence.\n       */\n      onCompleted: function () {\n        checkDisposed(this);\n        if (this.isStopped) { return; }\n        this.isStopped = true;\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n          os[i].onCompleted();\n        }\n\n        this.observers.length = 0;\n      },\n      /**\n       * Notifies all subscribed observers about the exception.\n       * @param {Mixed} error The exception to send to all observers.\n       */\n      onError: function (error) {\n        checkDisposed(this);\n        if (this.isStopped) { return; }\n        this.isStopped = true;\n        this.hasError = true;\n        this.error = error;\n\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n          os[i].onError(error);\n        }\n\n        this.observers.length = 0;\n      },\n      /**\n       * Notifies all subscribed observers about the arrival of the specified element in the sequence.\n       * @param {Mixed} value The value to send to all observers.\n       */\n      onNext: function (value) {\n        checkDisposed(this);\n        if (this.isStopped) { return; }\n        this.value = value;\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n          os[i].onNext(value);\n        }\n      },\n      /**\n       * Unsubscribe all observers and release resources.\n       */\n      dispose: function () {\n        this.isDisposed = true;\n        this.observers = null;\n        this.value = null;\n        this.error = null;\n      }\n    });\n\n    return BehaviorSubject;\n  }(Observable));\n\n  /**\n   * Represents an object that is both an observable sequence as well as an observer.\n   * Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.\n   */\n  var ReplaySubject = Rx.ReplaySubject = (function (__super__) {\n\n    var maxSafeInteger = Math.pow(2, 53) - 1;\n\n    function createRemovableDisposable(subject, observer) {\n      return disposableCreate(function () {\n        observer.dispose();\n        !subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);\n      });\n    }\n\n    inherits(ReplaySubject, __super__);\n\n    /**\n     *  Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.\n     *  @param {Number} [bufferSize] Maximum element count of the replay buffer.\n     *  @param {Number} [windowSize] Maximum time length of the replay buffer.\n     *  @param {Scheduler} [scheduler] Scheduler the observers are invoked on.\n     */\n    function ReplaySubject(bufferSize, windowSize, scheduler) {\n      this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize;\n      this.windowSize = windowSize == null ? maxSafeInteger : windowSize;\n      this.scheduler = scheduler || currentThreadScheduler;\n      this.q = [];\n      this.observers = [];\n      this.isStopped = false;\n      this.isDisposed = false;\n      this.hasError = false;\n      this.error = null;\n      __super__.call(this);\n    }\n\n    addProperties(ReplaySubject.prototype, Observer.prototype, {\n      _subscribe: function (o) {\n        checkDisposed(this);\n        var so = new ScheduledObserver(this.scheduler, o), subscription = createRemovableDisposable(this, so);\n\n        this._trim(this.scheduler.now());\n        this.observers.push(so);\n\n        for (var i = 0, len = this.q.length; i < len; i++) {\n          so.onNext(this.q[i].value);\n        }\n\n        if (this.hasError) {\n          so.onError(this.error);\n        } else if (this.isStopped) {\n          so.onCompleted();\n        }\n\n        so.ensureActive();\n        return subscription;\n      },\n      /**\n       * Indicates whether the subject has observers subscribed to it.\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\n       */\n      hasObservers: function () {\n        return this.observers.length > 0;\n      },\n      _trim: function (now) {\n        while (this.q.length > this.bufferSize) {\n          this.q.shift();\n        }\n        while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {\n          this.q.shift();\n        }\n      },\n      /**\n       * Notifies all subscribed observers about the arrival of the specified element in the sequence.\n       * @param {Mixed} value The value to send to all observers.\n       */\n      onNext: function (value) {\n        checkDisposed(this);\n        if (this.isStopped) { return; }\n        var now = this.scheduler.now();\n        this.q.push({ interval: now, value: value });\n        this._trim(now);\n\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n          var observer = os[i];\n          observer.onNext(value);\n          observer.ensureActive();\n        }\n      },\n      /**\n       * Notifies all subscribed observers about the exception.\n       * @param {Mixed} error The exception to send to all observers.\n       */\n      onError: function (error) {\n        checkDisposed(this);\n        if (this.isStopped) { return; }\n        this.isStopped = true;\n        this.error = error;\n        this.hasError = true;\n        var now = this.scheduler.now();\n        this._trim(now);\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n          var observer = os[i];\n          observer.onError(error);\n          observer.ensureActive();\n        }\n        this.observers.length = 0;\n      },\n      /**\n       * Notifies all subscribed observers about the end of the sequence.\n       */\n      onCompleted: function () {\n        checkDisposed(this);\n        if (this.isStopped) { return; }\n        this.isStopped = true;\n        var now = this.scheduler.now();\n        this._trim(now);\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\n          var observer = os[i];\n          observer.onCompleted();\n          observer.ensureActive();\n        }\n        this.observers.length = 0;\n      },\n      /**\n       * Unsubscribe all observers and release resources.\n       */\n      dispose: function () {\n        this.isDisposed = true;\n        this.observers = null;\n      }\n    });\n\n    return ReplaySubject;\n  }(Observable));\n\n  var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {\n    inherits(AnonymousSubject, __super__);\n    function AnonymousSubject(observer, observable) {\n      this.observer = observer;\n      this.observable = observable;\n      __super__.call(this);\n    }\n\n    addProperties(AnonymousSubject.prototype, Observer.prototype, {\n      _subscribe: function (o) {\n        return this.observable.subscribe(o);\n      },\n      onCompleted: function () {\n        this.observer.onCompleted();\n      },\n      onError: function (error) {\n        this.observer.onError(error);\n      },\n      onNext: function (value) {\n        this.observer.onNext(value);\n      }\n    });\n\n    return AnonymousSubject;\n  }(Observable));\n\n  /**\n  * Used to pause and resume streams.\n  */\n  Rx.Pauser = (function (__super__) {\n    inherits(Pauser, __super__);\n    function Pauser() {\n      __super__.call(this);\n    }\n\n    /**\n     * Pauses the underlying sequence.\n     */\n    Pauser.prototype.pause = function () { this.onNext(false); };\n\n    /**\n    * Resumes the underlying sequence.\n    */\n    Pauser.prototype.resume = function () { this.onNext(true); };\n\n    return Pauser;\n  }(Subject));\n\n  if (true) {\n    root.Rx = Rx;\n\n    !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n      return Rx;\n    }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n  } else if (freeExports && freeModule) {\n    // in Node.js or RingoJS\n    if (moduleExports) {\n      (freeModule.exports = Rx).Rx = Rx;\n    } else {\n      freeExports.Rx = Rx;\n    }\n  } else {\n    // in a browser or Rhino\n    root.Rx = Rx;\n  }\n\n  // All code before this point will be filtered from stack traces.\n  var rEndingLine = captureLine();\n\n}.call(this));\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module), (function() { return this; }()), __webpack_require__(33)))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/rx/dist/rx.all.js\n ** module id = 2\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/rx/dist/rx.all.js?");
},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.trim = trim;\nexports.exists = exists;\nexports.isEmpty = isEmpty;\nexports.itemsEqual = itemsEqual;\nexports.toArray = toArray;\nexports.safeJSONParse = safeJSONParse;\nexports.getExtension = getExtension;\nexports.getNameAndExtension = getNameAndExtension;\nexports.isValidFile = isValidFile;\nexports.isValidUrl = isValidUrl;\nexports.generateUUID = generateUUID;\nexports.stringToBoolean = stringToBoolean;\nexports.remapJson = remapJson;\nexports.coerceTypes = coerceTypes;\nfunction trim(string) {\n  return String(string).replace(/^\\s+|\\s+$/g, '');\n}\n\nfunction exists(input) {\n  return input !== null && input !== undefined;\n}\n\n// utiity to determine if a string is empty, null, or full of whitespaces\nfunction isEmpty(str) {\n  if (!(typeof str === 'string')) return false; // UUUGH bad way of checking not a string\n  return !str || /^\\s*$/.test(str) || str.length === 0 || !str.trim();\n}\n\nfunction itemsEqual(a, b) {\n  // perhaps an immutable library would not require such horrors?\n  if (JSON.stringify(a) === JSON.stringify(b)) {\n    return true;\n  }\n  return false;\n}\n\n/* converts input data to array if it is not already an array*/\nfunction toArray(data) {\n  if (!data) return [];\n  if (data.constructor !== Array) return [data];\n  return data;\n}\n\n/* JSON parse that always returns an object*/\nfunction safeJSONParse(str) {\n  try {\n    return JSON.parse(str) || {}; // from cycle.js\n  } catch (error) {\n    throw new Error('Error parsing data', JSON.stringify(str));\n  }\n}\n\n// file utils ??\nfunction getExtension(fname) {\n  return fname.substr((~ -fname.lastIndexOf('.') >>> 0) + 2).toLowerCase();\n}\n\nfunction getNameAndExtension(uri) {\n  var _uriElems = uri.split('?');\n  var name = _uriElems.shift().split('/').pop();\n  var ext = getExtension(uri);\n  return { name: name, ext: ext };\n}\n\nfunction isValidFile(file) {\n  return typeof file !== 'undefined' && file !== null && file instanceof File;\n}\n\n// from http://stackoverflow.com/questions/1701898/how-to-detect-whether-a-string-is-in-url-format-using-javascript\nfunction isValidUrl(url) {\n  /* var strRegex = \"^((https|http|ftp|rtsp|mms)?://)\"\n      + \"?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?\" //ftp的user@\n      + \"(([0-9]{1,3}\\.){3}[0-9]{1,3}\" // IP形式的URL- 199.194.52.184\n      + \"|\" // 允许IP和DOMAIN（域名）\n      + \"([0-9a-z_!~*'()-]+\\.)*\" // 域名- www.\n      + \"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\.\" // 二级域名\n      + \"[a-z]{2,6})\" // first level domain- .com or .museum\n      + \"(:[0-9]{1,4})?\" // 端口- :80\n      + \"((/?)|\" // a slash isn't required if there is no file name\n      + \"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$\"\n   var re=new RegExp(strRegex)\n   return re.test(url)*/\n  var regexp = /(file|ftp|http|https|localhost):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\n  return regexp.test(url);\n}\n\n// TODO: taken from three.js ,do correct attribution\nfunction generateUUID() {\n  // http://www.broofa.com/Tools/Math.uuid.htm\n\n  var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');\n  var uuid = new Array(36);\n  var rnd = 0;\n  var r = void 0;\n\n  return function () {\n    for (var i = 0; i < 36; i++) {\n      if (i === 8 || i === 13 || i === 18 || i === 23) {\n        uuid[i] = '-';\n      } else if (i === 14) {\n        uuid[i] = '4';\n      } else {\n        if (rnd <= 0x02) rnd = 0x2000000 + Math.random() * 0x1000000 | 0;\n        r = rnd & 0xf;\n        rnd = rnd >> 4;\n        uuid[i] = chars[i === 19 ? r & 0x3 | 0x8 : r];\n      }\n    }\n    return uuid.join('');\n  }();\n}\n\n// convert a string to a boolean\nfunction stringToBoolean(string) {\n  if (!string) return string;\n  switch (string.toLowerCase().trim()) {\n    case 'true':case 'yes':case '1':\n      return true;\n    case 'false':case 'no':case '0':case null:\n      return false;\n    default:\n      return Boolean(string);\n  }\n}\n\n/*\nRemap the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:42}\nremapJson({foo:baz},input) => {baz:42}\n*/\nfunction remapJson(mapping, input) {\n  var result = Object.keys(input).reduce(function (obj, key) {\n    if (key in mapping) {\n      obj[mapping[key]] = input[key];\n    } else {\n      obj[key] = input[key];\n    }\n    return obj;\n  }, {});\n  return result;\n}\n\n/*\nconvert the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:\"42\"}\nremapJson({foo:parseFloat},input) => {baz:42}\n*/\nfunction coerceTypes(mapping, input) {\n  var result = Object.keys(input).reduce(function (obj, key) {\n    if (key in mapping && input[key] !== null && input[key] !== undefined) {\n      obj[key] = mapping[key](input[key]);\n    } else {\n      obj[key] = input[key];\n    }\n    return obj;\n  }, {});\n  return result;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/utils.js\n ** module id = 3\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/utils.js?")},function(module,exports,__webpack_require__){eval("//  Ramda v0.21.0\n//  https://github.com/ramda/ramda\n//  (c) 2013-2016 Scott Sauyet, Michael Hurley, and David Chambers\n//  Ramda may be freely distributed under the MIT license.\n\n;(function() {\n\n  'use strict';\n\n  /**\n     * A special placeholder value used to specify \"gaps\" within curried functions,\n     * allowing partial application of any combination of arguments, regardless of\n     * their positions.\n     *\n     * If `g` is a curried ternary function and `_` is `R.__`, the following are\n     * equivalent:\n     *\n     *   - `g(1, 2, 3)`\n     *   - `g(_, 2, 3)(1)`\n     *   - `g(_, _, 3)(1)(2)`\n     *   - `g(_, _, 3)(1, 2)`\n     *   - `g(_, 2, _)(1, 3)`\n     *   - `g(_, 2)(1)(3)`\n     *   - `g(_, 2)(1, 3)`\n     *   - `g(_, 2)(_, 3)(1)`\n     *\n     * @constant\n     * @memberOf R\n     * @since v0.6.0\n     * @category Function\n     * @example\n     *\n     *      var greet = R.replace('{name}', R.__, 'Hello, {name}!');\n     *      greet('Alice'); //=> 'Hello, Alice!'\n     */\n    var __ = { '@@functional/placeholder': true };\n\n    /* eslint-disable no-unused-vars */\n    var _arity = function _arity(n, fn) {\n        /* eslint-disable no-unused-vars */\n        switch (n) {\n        case 0:\n            return function () {\n                return fn.apply(this, arguments);\n            };\n        case 1:\n            return function (a0) {\n                return fn.apply(this, arguments);\n            };\n        case 2:\n            return function (a0, a1) {\n                return fn.apply(this, arguments);\n            };\n        case 3:\n            return function (a0, a1, a2) {\n                return fn.apply(this, arguments);\n            };\n        case 4:\n            return function (a0, a1, a2, a3) {\n                return fn.apply(this, arguments);\n            };\n        case 5:\n            return function (a0, a1, a2, a3, a4) {\n                return fn.apply(this, arguments);\n            };\n        case 6:\n            return function (a0, a1, a2, a3, a4, a5) {\n                return fn.apply(this, arguments);\n            };\n        case 7:\n            return function (a0, a1, a2, a3, a4, a5, a6) {\n                return fn.apply(this, arguments);\n            };\n        case 8:\n            return function (a0, a1, a2, a3, a4, a5, a6, a7) {\n                return fn.apply(this, arguments);\n            };\n        case 9:\n            return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {\n                return fn.apply(this, arguments);\n            };\n        case 10:\n            return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {\n                return fn.apply(this, arguments);\n            };\n        default:\n            throw new Error('First argument to _arity must be a non-negative integer no greater than ten');\n        }\n    };\n\n    var _arrayFromIterator = function _arrayFromIterator(iter) {\n        var list = [];\n        var next;\n        while (!(next = iter.next()).done) {\n            list.push(next.value);\n        }\n        return list;\n    };\n\n    var _arrayOf = function _arrayOf() {\n        return Array.prototype.slice.call(arguments);\n    };\n\n    var _cloneRegExp = function _cloneRegExp(pattern) {\n        return new RegExp(pattern.source, (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : ''));\n    };\n\n    var _complement = function _complement(f) {\n        return function () {\n            return !f.apply(this, arguments);\n        };\n    };\n\n    /**\n     * Private `concat` function to merge two array-like objects.\n     *\n     * @private\n     * @param {Array|Arguments} [set1=[]] An array-like object.\n     * @param {Array|Arguments} [set2=[]] An array-like object.\n     * @return {Array} A new, merged array.\n     * @example\n     *\n     *      _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]\n     */\n    var _concat = function _concat(set1, set2) {\n        set1 = set1 || [];\n        set2 = set2 || [];\n        var idx;\n        var len1 = set1.length;\n        var len2 = set2.length;\n        var result = [];\n        idx = 0;\n        while (idx < len1) {\n            result[result.length] = set1[idx];\n            idx += 1;\n        }\n        idx = 0;\n        while (idx < len2) {\n            result[result.length] = set2[idx];\n            idx += 1;\n        }\n        return result;\n    };\n\n    var _containsWith = function _containsWith(pred, x, list) {\n        var idx = 0;\n        var len = list.length;\n        while (idx < len) {\n            if (pred(x, list[idx])) {\n                return true;\n            }\n            idx += 1;\n        }\n        return false;\n    };\n\n    var _filter = function _filter(fn, list) {\n        var idx = 0;\n        var len = list.length;\n        var result = [];\n        while (idx < len) {\n            if (fn(list[idx])) {\n                result[result.length] = list[idx];\n            }\n            idx += 1;\n        }\n        return result;\n    };\n\n    var _forceReduced = function _forceReduced(x) {\n        return {\n            '@@transducer/value': x,\n            '@@transducer/reduced': true\n        };\n    };\n\n    // String(x => x) evaluates to \"x => x\", so the pattern may not match.\n    var _functionName = function _functionName(f) {\n        // String(x => x) evaluates to \"x => x\", so the pattern may not match.\n        var match = String(f).match(/^function (\\w*)/);\n        return match == null ? '' : match[1];\n    };\n\n    var _has = function _has(prop, obj) {\n        return Object.prototype.hasOwnProperty.call(obj, prop);\n    };\n\n    var _identity = function _identity(x) {\n        return x;\n    };\n\n    var _isArguments = function () {\n        var toString = Object.prototype.toString;\n        return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {\n            return toString.call(x) === '[object Arguments]';\n        } : function _isArguments(x) {\n            return _has('callee', x);\n        };\n    }();\n\n    /**\n     * Tests whether or not an object is an array.\n     *\n     * @private\n     * @param {*} val The object to test.\n     * @return {Boolean} `true` if `val` is an array, `false` otherwise.\n     * @example\n     *\n     *      _isArray([]); //=> true\n     *      _isArray(null); //=> false\n     *      _isArray({}); //=> false\n     */\n    var _isArray = Array.isArray || function _isArray(val) {\n        return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';\n    };\n\n    var _isFunction = function _isNumber(x) {\n        return Object.prototype.toString.call(x) === '[object Function]';\n    };\n\n    /**\n     * Determine if the passed argument is an integer.\n     *\n     * @private\n     * @param {*} n\n     * @category Type\n     * @return {Boolean}\n     */\n    var _isInteger = Number.isInteger || function _isInteger(n) {\n        return n << 0 === n;\n    };\n\n    var _isNumber = function _isNumber(x) {\n        return Object.prototype.toString.call(x) === '[object Number]';\n    };\n\n    var _isObject = function _isObject(x) {\n        return Object.prototype.toString.call(x) === '[object Object]';\n    };\n\n    var _isPlaceholder = function _isPlaceholder(a) {\n        return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true;\n    };\n\n    var _isRegExp = function _isRegExp(x) {\n        return Object.prototype.toString.call(x) === '[object RegExp]';\n    };\n\n    var _isString = function _isString(x) {\n        return Object.prototype.toString.call(x) === '[object String]';\n    };\n\n    var _isTransformer = function _isTransformer(obj) {\n        return typeof obj['@@transducer/step'] === 'function';\n    };\n\n    var _map = function _map(fn, functor) {\n        var idx = 0;\n        var len = functor.length;\n        var result = Array(len);\n        while (idx < len) {\n            result[idx] = fn(functor[idx]);\n            idx += 1;\n        }\n        return result;\n    };\n\n    // Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n    var _objectAssign = function _objectAssign(target) {\n        if (target == null) {\n            throw new TypeError('Cannot convert undefined or null to object');\n        }\n        var output = Object(target);\n        var idx = 1;\n        var length = arguments.length;\n        while (idx < length) {\n            var source = arguments[idx];\n            if (source != null) {\n                for (var nextKey in source) {\n                    if (_has(nextKey, source)) {\n                        output[nextKey] = source[nextKey];\n                    }\n                }\n            }\n            idx += 1;\n        }\n        return output;\n    };\n\n    var _of = function _of(x) {\n        return [x];\n    };\n\n    var _pipe = function _pipe(f, g) {\n        return function () {\n            return g.call(this, f.apply(this, arguments));\n        };\n    };\n\n    var _pipeP = function _pipeP(f, g) {\n        return function () {\n            var ctx = this;\n            return f.apply(ctx, arguments).then(function (x) {\n                return g.call(ctx, x);\n            });\n        };\n    };\n\n    // \\b matches word boundary; [\\b] matches backspace\n    var _quote = function _quote(s) {\n        var escaped = s.replace(/\\\\/g, '\\\\\\\\').replace(/[\\b]/g, '\\\\b')    // \\b matches word boundary; [\\b] matches backspace\n    .replace(/\\f/g, '\\\\f').replace(/\\n/g, '\\\\n').replace(/\\r/g, '\\\\r').replace(/\\t/g, '\\\\t').replace(/\\v/g, '\\\\v').replace(/\\0/g, '\\\\0');\n        return '\"' + escaped.replace(/\"/g, '\\\\\"') + '\"';\n    };\n\n    var _reduced = function _reduced(x) {\n        return x && x['@@transducer/reduced'] ? x : {\n            '@@transducer/value': x,\n            '@@transducer/reduced': true\n        };\n    };\n\n    /**\n     * An optimized, private array `slice` implementation.\n     *\n     * @private\n     * @param {Arguments|Array} args The array or arguments object to consider.\n     * @param {Number} [from=0] The array index to slice from, inclusive.\n     * @param {Number} [to=args.length] The array index to slice to, exclusive.\n     * @return {Array} A new, sliced array.\n     * @example\n     *\n     *      _slice([1, 2, 3, 4, 5], 1, 3); //=> [2, 3]\n     *\n     *      var firstThreeArgs = function(a, b, c, d) {\n     *        return _slice(arguments, 0, 3);\n     *      };\n     *      firstThreeArgs(1, 2, 3, 4); //=> [1, 2, 3]\n     */\n    var _slice = function _slice(args, from, to) {\n        switch (arguments.length) {\n        case 1:\n            return _slice(args, 0, args.length);\n        case 2:\n            return _slice(args, from, args.length);\n        default:\n            var list = [];\n            var idx = 0;\n            var len = Math.max(0, Math.min(args.length, to) - from);\n            while (idx < len) {\n                list[idx] = args[from + idx];\n                idx += 1;\n            }\n            return list;\n        }\n    };\n\n    /**\n     * Polyfill from <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString>.\n     */\n    var _toISOString = function () {\n        var pad = function pad(n) {\n            return (n < 10 ? '0' : '') + n;\n        };\n        return typeof Date.prototype.toISOString === 'function' ? function _toISOString(d) {\n            return d.toISOString();\n        } : function _toISOString(d) {\n            return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z';\n        };\n    }();\n\n    var _xfBase = {\n        init: function () {\n            return this.xf['@@transducer/init']();\n        },\n        result: function (result) {\n            return this.xf['@@transducer/result'](result);\n        }\n    };\n\n    var _xwrap = function () {\n        function XWrap(fn) {\n            this.f = fn;\n        }\n        XWrap.prototype['@@transducer/init'] = function () {\n            throw new Error('init not implemented on XWrap');\n        };\n        XWrap.prototype['@@transducer/result'] = function (acc) {\n            return acc;\n        };\n        XWrap.prototype['@@transducer/step'] = function (acc, x) {\n            return this.f(acc, x);\n        };\n        return function _xwrap(fn) {\n            return new XWrap(fn);\n        };\n    }();\n\n    var _aperture = function _aperture(n, list) {\n        var idx = 0;\n        var limit = list.length - (n - 1);\n        var acc = new Array(limit >= 0 ? limit : 0);\n        while (idx < limit) {\n            acc[idx] = _slice(list, idx, idx + n);\n            idx += 1;\n        }\n        return acc;\n    };\n\n    var _assign = typeof Object.assign === 'function' ? Object.assign : _objectAssign;\n\n    /**\n     * Similar to hasMethod, this checks whether a function has a [methodname]\n     * function. If it isn't an array it will execute that function otherwise it\n     * will default to the ramda implementation.\n     *\n     * @private\n     * @param {Function} fn ramda implemtation\n     * @param {String} methodname property to check for a custom implementation\n     * @return {Object} Whatever the return value of the method is.\n     */\n    var _checkForMethod = function _checkForMethod(methodname, fn) {\n        return function () {\n            var length = arguments.length;\n            if (length === 0) {\n                return fn();\n            }\n            var obj = arguments[length - 1];\n            return _isArray(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, _slice(arguments, 0, length - 1));\n        };\n    };\n\n    /**\n     * Optimized internal one-arity curry function.\n     *\n     * @private\n     * @category Function\n     * @param {Function} fn The function to curry.\n     * @return {Function} The curried function.\n     */\n    var _curry1 = function _curry1(fn) {\n        return function f1(a) {\n            if (arguments.length === 0 || _isPlaceholder(a)) {\n                return f1;\n            } else {\n                return fn.apply(this, arguments);\n            }\n        };\n    };\n\n    /**\n     * Optimized internal two-arity curry function.\n     *\n     * @private\n     * @category Function\n     * @param {Function} fn The function to curry.\n     * @return {Function} The curried function.\n     */\n    var _curry2 = function _curry2(fn) {\n        return function f2(a, b) {\n            switch (arguments.length) {\n            case 0:\n                return f2;\n            case 1:\n                return _isPlaceholder(a) ? f2 : _curry1(function (_b) {\n                    return fn(a, _b);\n                });\n            default:\n                return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {\n                    return fn(_a, b);\n                }) : _isPlaceholder(b) ? _curry1(function (_b) {\n                    return fn(a, _b);\n                }) : fn(a, b);\n            }\n        };\n    };\n\n    /**\n     * Optimized internal three-arity curry function.\n     *\n     * @private\n     * @category Function\n     * @param {Function} fn The function to curry.\n     * @return {Function} The curried function.\n     */\n    var _curry3 = function _curry3(fn) {\n        return function f3(a, b, c) {\n            switch (arguments.length) {\n            case 0:\n                return f3;\n            case 1:\n                return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {\n                    return fn(a, _b, _c);\n                });\n            case 2:\n                return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {\n                    return fn(_a, b, _c);\n                }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {\n                    return fn(a, _b, _c);\n                }) : _curry1(function (_c) {\n                    return fn(a, b, _c);\n                });\n            default:\n                return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {\n                    return fn(_a, _b, c);\n                }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {\n                    return fn(_a, b, _c);\n                }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {\n                    return fn(a, _b, _c);\n                }) : _isPlaceholder(a) ? _curry1(function (_a) {\n                    return fn(_a, b, c);\n                }) : _isPlaceholder(b) ? _curry1(function (_b) {\n                    return fn(a, _b, c);\n                }) : _isPlaceholder(c) ? _curry1(function (_c) {\n                    return fn(a, b, _c);\n                }) : fn(a, b, c);\n            }\n        };\n    };\n\n    /**\n     * Internal curryN function.\n     *\n     * @private\n     * @category Function\n     * @param {Number} length The arity of the curried function.\n     * @param {Array} received An array of arguments received thus far.\n     * @param {Function} fn The function to curry.\n     * @return {Function} The curried function.\n     */\n    var _curryN = function _curryN(length, received, fn) {\n        return function () {\n            var combined = [];\n            var argsIdx = 0;\n            var left = length;\n            var combinedIdx = 0;\n            while (combinedIdx < received.length || argsIdx < arguments.length) {\n                var result;\n                if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {\n                    result = received[combinedIdx];\n                } else {\n                    result = arguments[argsIdx];\n                    argsIdx += 1;\n                }\n                combined[combinedIdx] = result;\n                if (!_isPlaceholder(result)) {\n                    left -= 1;\n                }\n                combinedIdx += 1;\n            }\n            return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));\n        };\n    };\n\n    /**\n     * Returns a function that dispatches with different strategies based on the\n     * object in list position (last argument). If it is an array, executes [fn].\n     * Otherwise, if it has a function with [methodname], it will execute that\n     * function (functor case). Otherwise, if it is a transformer, uses transducer\n     * [xf] to return a new transformer (transducer case). Otherwise, it will\n     * default to executing [fn].\n     *\n     * @private\n     * @param {String} methodname property to check for a custom implementation\n     * @param {Function} xf transducer to initialize if object is transformer\n     * @param {Function} fn default ramda implementation\n     * @return {Function} A function that dispatches on object in list position\n     */\n    var _dispatchable = function _dispatchable(methodname, xf, fn) {\n        return function () {\n            var length = arguments.length;\n            if (length === 0) {\n                return fn();\n            }\n            var obj = arguments[length - 1];\n            if (!_isArray(obj)) {\n                var args = _slice(arguments, 0, length - 1);\n                if (typeof obj[methodname] === 'function') {\n                    return obj[methodname].apply(obj, args);\n                }\n                if (_isTransformer(obj)) {\n                    var transducer = xf.apply(null, args);\n                    return transducer(obj);\n                }\n            }\n            return fn.apply(this, arguments);\n        };\n    };\n\n    var _dropLastWhile = function dropLastWhile(pred, list) {\n        var idx = list.length - 1;\n        while (idx >= 0 && pred(list[idx])) {\n            idx -= 1;\n        }\n        return _slice(list, 0, idx + 1);\n    };\n\n    var _xall = function () {\n        function XAll(f, xf) {\n            this.xf = xf;\n            this.f = f;\n            this.all = true;\n        }\n        XAll.prototype['@@transducer/init'] = _xfBase.init;\n        XAll.prototype['@@transducer/result'] = function (result) {\n            if (this.all) {\n                result = this.xf['@@transducer/step'](result, true);\n            }\n            return this.xf['@@transducer/result'](result);\n        };\n        XAll.prototype['@@transducer/step'] = function (result, input) {\n            if (!this.f(input)) {\n                this.all = false;\n                result = _reduced(this.xf['@@transducer/step'](result, false));\n            }\n            return result;\n        };\n        return _curry2(function _xall(f, xf) {\n            return new XAll(f, xf);\n        });\n    }();\n\n    var _xany = function () {\n        function XAny(f, xf) {\n            this.xf = xf;\n            this.f = f;\n            this.any = false;\n        }\n        XAny.prototype['@@transducer/init'] = _xfBase.init;\n        XAny.prototype['@@transducer/result'] = function (result) {\n            if (!this.any) {\n                result = this.xf['@@transducer/step'](result, false);\n            }\n            return this.xf['@@transducer/result'](result);\n        };\n        XAny.prototype['@@transducer/step'] = function (result, input) {\n            if (this.f(input)) {\n                this.any = true;\n                result = _reduced(this.xf['@@transducer/step'](result, true));\n            }\n            return result;\n        };\n        return _curry2(function _xany(f, xf) {\n            return new XAny(f, xf);\n        });\n    }();\n\n    var _xaperture = function () {\n        function XAperture(n, xf) {\n            this.xf = xf;\n            this.pos = 0;\n            this.full = false;\n            this.acc = new Array(n);\n        }\n        XAperture.prototype['@@transducer/init'] = _xfBase.init;\n        XAperture.prototype['@@transducer/result'] = function (result) {\n            this.acc = null;\n            return this.xf['@@transducer/result'](result);\n        };\n        XAperture.prototype['@@transducer/step'] = function (result, input) {\n            this.store(input);\n            return this.full ? this.xf['@@transducer/step'](result, this.getCopy()) : result;\n        };\n        XAperture.prototype.store = function (input) {\n            this.acc[this.pos] = input;\n            this.pos += 1;\n            if (this.pos === this.acc.length) {\n                this.pos = 0;\n                this.full = true;\n            }\n        };\n        XAperture.prototype.getCopy = function () {\n            return _concat(_slice(this.acc, this.pos), _slice(this.acc, 0, this.pos));\n        };\n        return _curry2(function _xaperture(n, xf) {\n            return new XAperture(n, xf);\n        });\n    }();\n\n    var _xdrop = function () {\n        function XDrop(n, xf) {\n            this.xf = xf;\n            this.n = n;\n        }\n        XDrop.prototype['@@transducer/init'] = _xfBase.init;\n        XDrop.prototype['@@transducer/result'] = _xfBase.result;\n        XDrop.prototype['@@transducer/step'] = function (result, input) {\n            if (this.n > 0) {\n                this.n -= 1;\n                return result;\n            }\n            return this.xf['@@transducer/step'](result, input);\n        };\n        return _curry2(function _xdrop(n, xf) {\n            return new XDrop(n, xf);\n        });\n    }();\n\n    var _xdropLast = function () {\n        function XDropLast(n, xf) {\n            this.xf = xf;\n            this.pos = 0;\n            this.full = false;\n            this.acc = new Array(n);\n        }\n        XDropLast.prototype['@@transducer/init'] = _xfBase.init;\n        XDropLast.prototype['@@transducer/result'] = function (result) {\n            this.acc = null;\n            return this.xf['@@transducer/result'](result);\n        };\n        XDropLast.prototype['@@transducer/step'] = function (result, input) {\n            if (this.full) {\n                result = this.xf['@@transducer/step'](result, this.acc[this.pos]);\n            }\n            this.store(input);\n            return result;\n        };\n        XDropLast.prototype.store = function (input) {\n            this.acc[this.pos] = input;\n            this.pos += 1;\n            if (this.pos === this.acc.length) {\n                this.pos = 0;\n                this.full = true;\n            }\n        };\n        return _curry2(function _xdropLast(n, xf) {\n            return new XDropLast(n, xf);\n        });\n    }();\n\n    var _xdropRepeatsWith = function () {\n        function XDropRepeatsWith(pred, xf) {\n            this.xf = xf;\n            this.pred = pred;\n            this.lastValue = undefined;\n            this.seenFirstValue = false;\n        }\n        XDropRepeatsWith.prototype['@@transducer/init'] = function () {\n            return this.xf['@@transducer/init']();\n        };\n        XDropRepeatsWith.prototype['@@transducer/result'] = function (result) {\n            return this.xf['@@transducer/result'](result);\n        };\n        XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) {\n            var sameAsLast = false;\n            if (!this.seenFirstValue) {\n                this.seenFirstValue = true;\n            } else if (this.pred(this.lastValue, input)) {\n                sameAsLast = true;\n            }\n            this.lastValue = input;\n            return sameAsLast ? result : this.xf['@@transducer/step'](result, input);\n        };\n        return _curry2(function _xdropRepeatsWith(pred, xf) {\n            return new XDropRepeatsWith(pred, xf);\n        });\n    }();\n\n    var _xdropWhile = function () {\n        function XDropWhile(f, xf) {\n            this.xf = xf;\n            this.f = f;\n        }\n        XDropWhile.prototype['@@transducer/init'] = _xfBase.init;\n        XDropWhile.prototype['@@transducer/result'] = _xfBase.result;\n        XDropWhile.prototype['@@transducer/step'] = function (result, input) {\n            if (this.f) {\n                if (this.f(input)) {\n                    return result;\n                }\n                this.f = null;\n            }\n            return this.xf['@@transducer/step'](result, input);\n        };\n        return _curry2(function _xdropWhile(f, xf) {\n            return new XDropWhile(f, xf);\n        });\n    }();\n\n    var _xfilter = function () {\n        function XFilter(f, xf) {\n            this.xf = xf;\n            this.f = f;\n        }\n        XFilter.prototype['@@transducer/init'] = _xfBase.init;\n        XFilter.prototype['@@transducer/result'] = _xfBase.result;\n        XFilter.prototype['@@transducer/step'] = function (result, input) {\n            return this.f(input) ? this.xf['@@transducer/step'](result, input) : result;\n        };\n        return _curry2(function _xfilter(f, xf) {\n            return new XFilter(f, xf);\n        });\n    }();\n\n    var _xfind = function () {\n        function XFind(f, xf) {\n            this.xf = xf;\n            this.f = f;\n            this.found = false;\n        }\n        XFind.prototype['@@transducer/init'] = _xfBase.init;\n        XFind.prototype['@@transducer/result'] = function (result) {\n            if (!this.found) {\n                result = this.xf['@@transducer/step'](result, void 0);\n            }\n            return this.xf['@@transducer/result'](result);\n        };\n        XFind.prototype['@@transducer/step'] = function (result, input) {\n            if (this.f(input)) {\n                this.found = true;\n                result = _reduced(this.xf['@@transducer/step'](result, input));\n            }\n            return result;\n        };\n        return _curry2(function _xfind(f, xf) {\n            return new XFind(f, xf);\n        });\n    }();\n\n    var _xfindIndex = function () {\n        function XFindIndex(f, xf) {\n            this.xf = xf;\n            this.f = f;\n            this.idx = -1;\n            this.found = false;\n        }\n        XFindIndex.prototype['@@transducer/init'] = _xfBase.init;\n        XFindIndex.prototype['@@transducer/result'] = function (result) {\n            if (!this.found) {\n                result = this.xf['@@transducer/step'](result, -1);\n            }\n            return this.xf['@@transducer/result'](result);\n        };\n        XFindIndex.prototype['@@transducer/step'] = function (result, input) {\n            this.idx += 1;\n            if (this.f(input)) {\n                this.found = true;\n                result = _reduced(this.xf['@@transducer/step'](result, this.idx));\n            }\n            return result;\n        };\n        return _curry2(function _xfindIndex(f, xf) {\n            return new XFindIndex(f, xf);\n        });\n    }();\n\n    var _xfindLast = function () {\n        function XFindLast(f, xf) {\n            this.xf = xf;\n            this.f = f;\n        }\n        XFindLast.prototype['@@transducer/init'] = _xfBase.init;\n        XFindLast.prototype['@@transducer/result'] = function (result) {\n            return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last));\n        };\n        XFindLast.prototype['@@transducer/step'] = function (result, input) {\n            if (this.f(input)) {\n                this.last = input;\n            }\n            return result;\n        };\n        return _curry2(function _xfindLast(f, xf) {\n            return new XFindLast(f, xf);\n        });\n    }();\n\n    var _xfindLastIndex = function () {\n        function XFindLastIndex(f, xf) {\n            this.xf = xf;\n            this.f = f;\n            this.idx = -1;\n            this.lastIdx = -1;\n        }\n        XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init;\n        XFindLastIndex.prototype['@@transducer/result'] = function (result) {\n            return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx));\n        };\n        XFindLastIndex.prototype['@@transducer/step'] = function (result, input) {\n            this.idx += 1;\n            if (this.f(input)) {\n                this.lastIdx = this.idx;\n            }\n            return result;\n        };\n        return _curry2(function _xfindLastIndex(f, xf) {\n            return new XFindLastIndex(f, xf);\n        });\n    }();\n\n    var _xmap = function () {\n        function XMap(f, xf) {\n            this.xf = xf;\n            this.f = f;\n        }\n        XMap.prototype['@@transducer/init'] = _xfBase.init;\n        XMap.prototype['@@transducer/result'] = _xfBase.result;\n        XMap.prototype['@@transducer/step'] = function (result, input) {\n            return this.xf['@@transducer/step'](result, this.f(input));\n        };\n        return _curry2(function _xmap(f, xf) {\n            return new XMap(f, xf);\n        });\n    }();\n\n    var _xtake = function () {\n        function XTake(n, xf) {\n            this.xf = xf;\n            this.n = n;\n        }\n        XTake.prototype['@@transducer/init'] = _xfBase.init;\n        XTake.prototype['@@transducer/result'] = _xfBase.result;\n        XTake.prototype['@@transducer/step'] = function (result, input) {\n            if (this.n === 0) {\n                return _reduced(result);\n            } else {\n                this.n -= 1;\n                return this.xf['@@transducer/step'](result, input);\n            }\n        };\n        return _curry2(function _xtake(n, xf) {\n            return new XTake(n, xf);\n        });\n    }();\n\n    var _xtakeWhile = function () {\n        function XTakeWhile(f, xf) {\n            this.xf = xf;\n            this.f = f;\n        }\n        XTakeWhile.prototype['@@transducer/init'] = _xfBase.init;\n        XTakeWhile.prototype['@@transducer/result'] = _xfBase.result;\n        XTakeWhile.prototype['@@transducer/step'] = function (result, input) {\n            return this.f(input) ? this.xf['@@transducer/step'](result, input) : _reduced(result);\n        };\n        return _curry2(function _xtakeWhile(f, xf) {\n            return new XTakeWhile(f, xf);\n        });\n    }();\n\n    /**\n     * Adds two values.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Math\n     * @sig Number -> Number -> Number\n     * @param {Number} a\n     * @param {Number} b\n     * @return {Number}\n     * @see R.subtract\n     * @example\n     *\n     *      R.add(2, 3);       //=>  5\n     *      R.add(7)(10);      //=> 17\n     */\n    var add = _curry2(function add(a, b) {\n        return Number(a) + Number(b);\n    });\n\n    /**\n     * Applies a function to the value at the given index of an array, returning a\n     * new copy of the array with the element at the given index replaced with the\n     * result of the function application.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category List\n     * @sig (a -> a) -> Number -> [a] -> [a]\n     * @param {Function} fn The function to apply.\n     * @param {Number} idx The index.\n     * @param {Array|Arguments} list An array-like object whose value\n     *        at the supplied index will be replaced.\n     * @return {Array} A copy of the supplied array-like object with\n     *         the element at index `idx` replaced with the value\n     *         returned by applying `fn` to the existing element.\n     * @see R.update\n     * @example\n     *\n     *      R.adjust(R.add(10), 1, [0, 1, 2]);     //=> [0, 11, 2]\n     *      R.adjust(R.add(10))(1)([0, 1, 2]);     //=> [0, 11, 2]\n     */\n    var adjust = _curry3(function adjust(fn, idx, list) {\n        if (idx >= list.length || idx < -list.length) {\n            return list;\n        }\n        var start = idx < 0 ? list.length : 0;\n        var _idx = start + idx;\n        var _list = _concat(list);\n        _list[_idx] = fn(list[_idx]);\n        return _list;\n    });\n\n    /**\n     * Returns `true` if all elements of the list match the predicate, `false` if\n     * there are any that don't.\n     *\n     * Dispatches to the `all` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> Boolean\n     * @param {Function} fn The predicate function.\n     * @param {Array} list The array to consider.\n     * @return {Boolean} `true` if the predicate is satisfied by every element, `false`\n     *         otherwise.\n     * @see R.any, R.none, R.transduce\n     * @example\n     *\n     *      var lessThan2 = R.flip(R.lt)(2);\n     *      var lessThan3 = R.flip(R.lt)(3);\n     *      R.all(lessThan2)([1, 2]); //=> false\n     *      R.all(lessThan3)([1, 2]); //=> true\n     */\n    var all = _curry2(_dispatchable('all', _xall, function all(fn, list) {\n        var idx = 0;\n        while (idx < list.length) {\n            if (!fn(list[idx])) {\n                return false;\n            }\n            idx += 1;\n        }\n        return true;\n    }));\n\n    /**\n     * Returns a function that always returns the given value. Note that for\n     * non-primitives the value returned is a reference to the original value.\n     *\n     * This function is known as `const`, `constant`, or `K` (for K combinator) in\n     * other languages and libraries.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig a -> (* -> a)\n     * @param {*} val The value to wrap in a function\n     * @return {Function} A Function :: * -> val.\n     * @example\n     *\n     *      var t = R.always('Tee');\n     *      t(); //=> 'Tee'\n     */\n    var always = _curry1(function always(val) {\n        return function () {\n            return val;\n        };\n    });\n\n    /**\n     * Returns `true` if both arguments are `true`; `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Logic\n     * @sig * -> * -> *\n     * @param {Boolean} a A boolean value\n     * @param {Boolean} b A boolean value\n     * @return {Boolean} `true` if both arguments are `true`, `false` otherwise\n     * @see R.both\n     * @example\n     *\n     *      R.and(true, true); //=> true\n     *      R.and(true, false); //=> false\n     *      R.and(false, true); //=> false\n     *      R.and(false, false); //=> false\n     */\n    var and = _curry2(function and(a, b) {\n        return a && b;\n    });\n\n    /**\n     * Returns `true` if at least one of elements of the list match the predicate,\n     * `false` otherwise.\n     *\n     * Dispatches to the `any` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> Boolean\n     * @param {Function} fn The predicate function.\n     * @param {Array} list The array to consider.\n     * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false`\n     *         otherwise.\n     * @see R.all, R.none, R.transduce\n     * @example\n     *\n     *      var lessThan0 = R.flip(R.lt)(0);\n     *      var lessThan2 = R.flip(R.lt)(2);\n     *      R.any(lessThan0)([1, 2]); //=> false\n     *      R.any(lessThan2)([1, 2]); //=> true\n     */\n    var any = _curry2(_dispatchable('any', _xany, function any(fn, list) {\n        var idx = 0;\n        while (idx < list.length) {\n            if (fn(list[idx])) {\n                return true;\n            }\n            idx += 1;\n        }\n        return false;\n    }));\n\n    /**\n     * Returns a new list, composed of n-tuples of consecutive elements If `n` is\n     * greater than the length of the list, an empty list is returned.\n     *\n     * Dispatches to the `aperture` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category List\n     * @sig Number -> [a] -> [[a]]\n     * @param {Number} n The size of the tuples to create\n     * @param {Array} list The list to split into `n`-tuples\n     * @return {Array} The new list.\n     * @see R.transduce\n     * @example\n     *\n     *      R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]]\n     *      R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]]\n     *      R.aperture(7, [1, 2, 3, 4, 5]); //=> []\n     */\n    var aperture = _curry2(_dispatchable('aperture', _xaperture, _aperture));\n\n    /**\n     * Returns a new list containing the contents of the given list, followed by\n     * the given element.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig a -> [a] -> [a]\n     * @param {*} el The element to add to the end of the new list.\n     * @param {Array} list The list whose contents will be added to the beginning of the output\n     *        list.\n     * @return {Array} A new list containing the contents of the old list followed by `el`.\n     * @see R.prepend\n     * @example\n     *\n     *      R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests']\n     *      R.append('tests', []); //=> ['tests']\n     *      R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']]\n     */\n    var append = _curry2(function append(el, list) {\n        return _concat(list, [el]);\n    });\n\n    /**\n     * Applies function `fn` to the argument list `args`. This is useful for\n     * creating a fixed-arity function from a variadic function. `fn` should be a\n     * bound function if context is significant.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.7.0\n     * @category Function\n     * @sig (*... -> a) -> [*] -> a\n     * @param {Function} fn\n     * @param {Array} args\n     * @return {*}\n     * @see R.call, R.unapply\n     * @example\n     *\n     *      var nums = [1, 2, 3, -99, 42, 6, 7];\n     *      R.apply(Math.max, nums); //=> 42\n     */\n    var apply = _curry2(function apply(fn, args) {\n        return fn.apply(this, args);\n    });\n\n    /**\n     * Makes a shallow clone of an object, setting or overriding the specified\n     * property with the given value. Note that this copies and flattens prototype\n     * properties onto the new object as well. All non-primitive properties are\n     * copied by reference.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Object\n     * @sig String -> a -> {k: v} -> {k: v}\n     * @param {String} prop the property name to set\n     * @param {*} val the new value\n     * @param {Object} obj the object to clone\n     * @return {Object} a new object similar to the original except for the specified property.\n     * @see R.dissoc\n     * @example\n     *\n     *      R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}\n     */\n    var assoc = _curry3(function assoc(prop, val, obj) {\n        var result = {};\n        for (var p in obj) {\n            result[p] = obj[p];\n        }\n        result[prop] = val;\n        return result;\n    });\n\n    /**\n     * Makes a shallow clone of an object, setting or overriding the nodes required\n     * to create the given path, and placing the specific value at the tail end of\n     * that path. Note that this copies and flattens prototype properties onto the\n     * new object as well. All non-primitive properties are copied by reference.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Object\n     * @sig [String] -> a -> {k: v} -> {k: v}\n     * @param {Array} path the path to set\n     * @param {*} val the new value\n     * @param {Object} obj the object to clone\n     * @return {Object} a new object similar to the original except along the specified path.\n     * @see R.dissocPath\n     * @example\n     *\n     *      R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}}\n     */\n    var assocPath = _curry3(function assocPath(path, val, obj) {\n        switch (path.length) {\n        case 0:\n            return val;\n        case 1:\n            return assoc(path[0], val, obj);\n        default:\n            return assoc(path[0], assocPath(_slice(path, 1), val, Object(obj[path[0]])), obj);\n        }\n    });\n\n    /**\n     * Creates a function that is bound to a context.\n     * Note: `R.bind` does not provide the additional argument-binding capabilities of\n     * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).\n     *\n     * @func\n     * @memberOf R\n     * @since v0.6.0\n     * @category Function\n     * @category Object\n     * @sig (* -> *) -> {*} -> (* -> *)\n     * @param {Function} fn The function to bind to context\n     * @param {Object} thisObj The context to bind `fn` to\n     * @return {Function} A function that will execute in the context of `thisObj`.\n     * @see R.partial\n     */\n    var bind = _curry2(function bind(fn, thisObj) {\n        return _arity(fn.length, function () {\n            return fn.apply(thisObj, arguments);\n        });\n    });\n\n    /**\n     * Restricts a number to be within a range.\n     *\n     * Also works for other ordered types such as Strings and Dates.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.20.0\n     * @category Relation\n     * @sig Ord a => a -> a -> a -> a\n     * @param {Number} minimum number\n     * @param {Number} maximum number\n     * @param {Number} value to be clamped\n     * @return {Number} Returns the clamped value\n     * @example\n     *\n     *      R.clamp(1, 10, -1) // => 1\n     *      R.clamp(1, 10, 11) // => 10\n     *      R.clamp(1, 10, 4)  // => 4\n     */\n    var clamp = _curry3(function clamp(min, max, value) {\n        if (min > max) {\n            throw new Error('min must not be greater than max in clamp(min, max, value)');\n        }\n        return value < min ? min : value > max ? max : value;\n    });\n\n    /**\n     * Makes a comparator function out of a function that reports whether the first\n     * element is less than the second.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (a, b -> Boolean) -> (a, b -> Number)\n     * @param {Function} pred A predicate function of arity two.\n     * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0`.\n     * @example\n     *\n     *      var cmp = R.comparator((a, b) => a.age < b.age);\n     *      var people = [\n     *        // ...\n     *      ];\n     *      R.sort(cmp, people);\n     */\n    var comparator = _curry1(function comparator(pred) {\n        return function (a, b) {\n            return pred(a, b) ? -1 : pred(b, a) ? 1 : 0;\n        };\n    });\n\n    /**\n     * Returns a curried equivalent of the provided function, with the specified\n     * arity. The curried function has two unusual capabilities. First, its\n     * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the\n     * following are equivalent:\n     *\n     *   - `g(1)(2)(3)`\n     *   - `g(1)(2, 3)`\n     *   - `g(1, 2)(3)`\n     *   - `g(1, 2, 3)`\n     *\n     * Secondly, the special placeholder value `R.__` may be used to specify\n     * \"gaps\", allowing partial application of any combination of arguments,\n     * regardless of their positions. If `g` is as above and `_` is `R.__`, the\n     * following are equivalent:\n     *\n     *   - `g(1, 2, 3)`\n     *   - `g(_, 2, 3)(1)`\n     *   - `g(_, _, 3)(1)(2)`\n     *   - `g(_, _, 3)(1, 2)`\n     *   - `g(_, 2)(1)(3)`\n     *   - `g(_, 2)(1, 3)`\n     *   - `g(_, 2)(_, 3)(1)`\n     *\n     * @func\n     * @memberOf R\n     * @since v0.5.0\n     * @category Function\n     * @sig Number -> (* -> a) -> (* -> a)\n     * @param {Number} length The arity for the returned function.\n     * @param {Function} fn The function to curry.\n     * @return {Function} A new, curried function.\n     * @see R.curry\n     * @example\n     *\n     *      var sumArgs = (...args) => R.sum(args);\n     *\n     *      var curriedAddFourNumbers = R.curryN(4, sumArgs);\n     *      var f = curriedAddFourNumbers(1, 2);\n     *      var g = f(3);\n     *      g(4); //=> 10\n     */\n    var curryN = _curry2(function curryN(length, fn) {\n        if (length === 1) {\n            return _curry1(fn);\n        }\n        return _arity(length, _curryN(length, [], fn));\n    });\n\n    /**\n     * Decrements its argument.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Math\n     * @sig Number -> Number\n     * @param {Number} n\n     * @return {Number}\n     * @see R.inc\n     * @example\n     *\n     *      R.dec(42); //=> 41\n     */\n    var dec = add(-1);\n\n    /**\n     * Returns the second argument if it is not `null`, `undefined` or `NaN`\n     * otherwise the first argument is returned.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category Logic\n     * @sig a -> b -> a | b\n     * @param {a} val The default value.\n     * @param {b} val The value to return if it is not null or undefined\n     * @return {*} The the second value or the default value\n     * @example\n     *\n     *      var defaultTo42 = R.defaultTo(42);\n     *\n     *      defaultTo42(null);  //=> 42\n     *      defaultTo42(undefined);  //=> 42\n     *      defaultTo42('Ramda');  //=> 'Ramda'\n     *      defaultTo42(parseInt('string')); //=> 42\n     */\n    var defaultTo = _curry2(function defaultTo(d, v) {\n        return v == null || v !== v ? d : v;\n    });\n\n    /**\n     * Finds the set (i.e. no duplicates) of all elements in the first list not\n     * contained in the second list. Duplication is determined according to the\n     * value returned by applying the supplied predicate to two list elements.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig (a -> a -> Boolean) -> [*] -> [*] -> [*]\n     * @param {Function} pred A predicate used to test whether two items are equal.\n     * @param {Array} list1 The first list.\n     * @param {Array} list2 The second list.\n     * @return {Array} The elements in `list1` that are not in `list2`.\n     * @see R.difference\n     * @example\n     *\n     *      var cmp = (x, y) => x.a === y.a;\n     *      var l1 = [{a: 1}, {a: 2}, {a: 3}];\n     *      var l2 = [{a: 3}, {a: 4}];\n     *      R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}]\n     */\n    var differenceWith = _curry3(function differenceWith(pred, first, second) {\n        var out = [];\n        var idx = 0;\n        var firstLen = first.length;\n        while (idx < firstLen) {\n            if (!_containsWith(pred, first[idx], second) && !_containsWith(pred, first[idx], out)) {\n                out.push(first[idx]);\n            }\n            idx += 1;\n        }\n        return out;\n    });\n\n    /**\n     * Returns a new object that does not contain a `prop` property.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category Object\n     * @sig String -> {k: v} -> {k: v}\n     * @param {String} prop the name of the property to dissociate\n     * @param {Object} obj the object to clone\n     * @return {Object} a new object similar to the original but without the specified property\n     * @see R.assoc\n     * @example\n     *\n     *      R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3}\n     */\n    var dissoc = _curry2(function dissoc(prop, obj) {\n        var result = {};\n        for (var p in obj) {\n            if (p !== prop) {\n                result[p] = obj[p];\n            }\n        }\n        return result;\n    });\n\n    /**\n     * Makes a shallow clone of an object, omitting the property at the given path.\n     * Note that this copies and flattens prototype properties onto the new object\n     * as well. All non-primitive properties are copied by reference.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.11.0\n     * @category Object\n     * @sig [String] -> {k: v} -> {k: v}\n     * @param {Array} path the path to set\n     * @param {Object} obj the object to clone\n     * @return {Object} a new object without the property at path\n     * @see R.assocPath\n     * @example\n     *\n     *      R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}}\n     */\n    var dissocPath = _curry2(function dissocPath(path, obj) {\n        switch (path.length) {\n        case 0:\n            return obj;\n        case 1:\n            return dissoc(path[0], obj);\n        default:\n            var head = path[0];\n            var tail = _slice(path, 1);\n            return obj[head] == null ? obj : assoc(head, dissocPath(tail, obj[head]), obj);\n        }\n    });\n\n    /**\n     * Divides two numbers. Equivalent to `a / b`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Math\n     * @sig Number -> Number -> Number\n     * @param {Number} a The first value.\n     * @param {Number} b The second value.\n     * @return {Number} The result of `a / b`.\n     * @see R.multiply\n     * @example\n     *\n     *      R.divide(71, 100); //=> 0.71\n     *\n     *      var half = R.divide(R.__, 2);\n     *      half(42); //=> 21\n     *\n     *      var reciprocal = R.divide(1);\n     *      reciprocal(4);   //=> 0.25\n     */\n    var divide = _curry2(function divide(a, b) {\n        return a / b;\n    });\n\n    /**\n     * Returns a new list containing the last `n` elements of a given list, passing\n     * each value to the supplied predicate function, skipping elements while the\n     * predicate function returns `true`. The predicate function is passed one\n     * argument: *(value)*.\n     *\n     * Dispatches to the `dropWhile` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> [a]\n     * @param {Function} fn The function called per iteration.\n     * @param {Array} list The collection to iterate over.\n     * @return {Array} A new array.\n     * @see R.takeWhile, R.transduce, R.addIndex\n     * @example\n     *\n     *      var lteTwo = x => x <= 2;\n     *\n     *      R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1]\n     */\n    var dropWhile = _curry2(_dispatchable('dropWhile', _xdropWhile, function dropWhile(pred, list) {\n        var idx = 0;\n        var len = list.length;\n        while (idx < len && pred(list[idx])) {\n            idx += 1;\n        }\n        return _slice(list, idx);\n    }));\n\n    /**\n     * Returns the empty value of its argument's type. Ramda defines the empty\n     * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other\n     * types are supported if they define `<Type>.empty` and/or\n     * `<Type>.prototype.empty`.\n     *\n     * Dispatches to the `empty` method of the first argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category Function\n     * @sig a -> a\n     * @param {*} x\n     * @return {*}\n     * @example\n     *\n     *      R.empty(Just(42));      //=> Nothing()\n     *      R.empty([1, 2, 3]);     //=> []\n     *      R.empty('unicorns');    //=> ''\n     *      R.empty({x: 1, y: 2});  //=> {}\n     */\n    // else\n    var empty = _curry1(function empty(x) {\n        return x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () {\n            return arguments;\n        }() : // else\n        void 0;\n    });\n\n    /**\n     * Creates a new object by recursively evolving a shallow copy of `object`,\n     * according to the `transformation` functions. All non-primitive properties\n     * are copied by reference.\n     *\n     * A `transformation` function will not be invoked if its corresponding key\n     * does not exist in the evolved object.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Object\n     * @sig {k: (v -> v)} -> {k: v} -> {k: v}\n     * @param {Object} transformations The object specifying transformation functions to apply\n     *        to the object.\n     * @param {Object} object The object to be transformed.\n     * @return {Object} The transformed object.\n     * @example\n     *\n     *      var tomato  = {firstName: '  Tomato ', data: {elapsed: 100, remaining: 1400}, id:123};\n     *      var transformations = {\n     *        firstName: R.trim,\n     *        lastName: R.trim, // Will not get invoked.\n     *        data: {elapsed: R.add(1), remaining: R.add(-1)}\n     *      };\n     *      R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123}\n     */\n    var evolve = _curry2(function evolve(transformations, object) {\n        var result = {};\n        var transformation, key, type;\n        for (key in object) {\n            transformation = transformations[key];\n            type = typeof transformation;\n            result[key] = type === 'function' ? transformation(object[key]) : type === 'object' ? evolve(transformations[key], object[key]) : object[key];\n        }\n        return result;\n    });\n\n    /**\n     * Returns the first element of the list which matches the predicate, or\n     * `undefined` if no element matches.\n     *\n     * Dispatches to the `find` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> a | undefined\n     * @param {Function} fn The predicate function used to determine if the element is the\n     *        desired one.\n     * @param {Array} list The array to consider.\n     * @return {Object} The element found, or `undefined`.\n     * @see R.transduce\n     * @example\n     *\n     *      var xs = [{a: 1}, {a: 2}, {a: 3}];\n     *      R.find(R.propEq('a', 2))(xs); //=> {a: 2}\n     *      R.find(R.propEq('a', 4))(xs); //=> undefined\n     */\n    var find = _curry2(_dispatchable('find', _xfind, function find(fn, list) {\n        var idx = 0;\n        var len = list.length;\n        while (idx < len) {\n            if (fn(list[idx])) {\n                return list[idx];\n            }\n            idx += 1;\n        }\n    }));\n\n    /**\n     * Returns the index of the first element of the list which matches the\n     * predicate, or `-1` if no element matches.\n     *\n     * Dispatches to the `findIndex` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.1\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> Number\n     * @param {Function} fn The predicate function used to determine if the element is the\n     * desired one.\n     * @param {Array} list The array to consider.\n     * @return {Number} The index of the element found, or `-1`.\n     * @see R.transduce\n     * @example\n     *\n     *      var xs = [{a: 1}, {a: 2}, {a: 3}];\n     *      R.findIndex(R.propEq('a', 2))(xs); //=> 1\n     *      R.findIndex(R.propEq('a', 4))(xs); //=> -1\n     */\n    var findIndex = _curry2(_dispatchable('findIndex', _xfindIndex, function findIndex(fn, list) {\n        var idx = 0;\n        var len = list.length;\n        while (idx < len) {\n            if (fn(list[idx])) {\n                return idx;\n            }\n            idx += 1;\n        }\n        return -1;\n    }));\n\n    /**\n     * Returns the last element of the list which matches the predicate, or\n     * `undefined` if no element matches.\n     *\n     * Dispatches to the `findLast` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.1\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> a | undefined\n     * @param {Function} fn The predicate function used to determine if the element is the\n     * desired one.\n     * @param {Array} list The array to consider.\n     * @return {Object} The element found, or `undefined`.\n     * @see R.transduce\n     * @example\n     *\n     *      var xs = [{a: 1, b: 0}, {a:1, b: 1}];\n     *      R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1}\n     *      R.findLast(R.propEq('a', 4))(xs); //=> undefined\n     */\n    var findLast = _curry2(_dispatchable('findLast', _xfindLast, function findLast(fn, list) {\n        var idx = list.length - 1;\n        while (idx >= 0) {\n            if (fn(list[idx])) {\n                return list[idx];\n            }\n            idx -= 1;\n        }\n    }));\n\n    /**\n     * Returns the index of the last element of the list which matches the\n     * predicate, or `-1` if no element matches.\n     *\n     * Dispatches to the `findLastIndex` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.1\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> Number\n     * @param {Function} fn The predicate function used to determine if the element is the\n     * desired one.\n     * @param {Array} list The array to consider.\n     * @return {Number} The index of the element found, or `-1`.\n     * @see R.transduce\n     * @example\n     *\n     *      var xs = [{a: 1, b: 0}, {a:1, b: 1}];\n     *      R.findLastIndex(R.propEq('a', 1))(xs); //=> 1\n     *      R.findLastIndex(R.propEq('a', 4))(xs); //=> -1\n     */\n    var findLastIndex = _curry2(_dispatchable('findLastIndex', _xfindLastIndex, function findLastIndex(fn, list) {\n        var idx = list.length - 1;\n        while (idx >= 0) {\n            if (fn(list[idx])) {\n                return idx;\n            }\n            idx -= 1;\n        }\n        return -1;\n    }));\n\n    /**\n     * Iterate over an input `list`, calling a provided function `fn` for each\n     * element in the list.\n     *\n     * `fn` receives one argument: *(value)*.\n     *\n     * Note: `R.forEach` does not skip deleted or unassigned indices (sparse\n     * arrays), unlike the native `Array.prototype.forEach` method. For more\n     * details on this behavior, see:\n     * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description\n     *\n     * Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns\n     * the original array. In some libraries this function is named `each`.\n     *\n     * Dispatches to the `forEach` method of the second argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.1\n     * @category List\n     * @sig (a -> *) -> [a] -> [a]\n     * @param {Function} fn The function to invoke. Receives one argument, `value`.\n     * @param {Array} list The list to iterate over.\n     * @return {Array} The original list.\n     * @see R.addIndex\n     * @example\n     *\n     *      var printXPlusFive = x => console.log(x + 5);\n     *      R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3]\n     *      //-> 6\n     *      //-> 7\n     *      //-> 8\n     */\n    var forEach = _curry2(_checkForMethod('forEach', function forEach(fn, list) {\n        var len = list.length;\n        var idx = 0;\n        while (idx < len) {\n            fn(list[idx]);\n            idx += 1;\n        }\n        return list;\n    }));\n\n    /**\n     * Creates a new object out of a list key-value pairs.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category List\n     * @sig [[k,v]] -> {k: v}\n     * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object.\n     * @return {Object} The object made by pairing up `keys` and `values`.\n     * @see R.toPairs, R.pair\n     * @example\n     *\n     *      R.fromPairs([['a', 1], ['b', 2],  ['c', 3]]); //=> {a: 1, b: 2, c: 3}\n     */\n    var fromPairs = _curry1(function fromPairs(pairs) {\n        var idx = 0;\n        var len = pairs.length;\n        var out = {};\n        while (idx < len) {\n            if (_isArray(pairs[idx]) && pairs[idx].length) {\n                out[pairs[idx][0]] = pairs[idx][1];\n            }\n            idx += 1;\n        }\n        return out;\n    });\n\n    /**\n     * Takes a list and returns a list of lists where each sublist's elements are\n     * all \"equal\" according to the provided equality function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.21.0\n     * @category List\n     * @sig (a, a -> Boolean) -> [a] -> [[a]]\n     * @param {Function} fn Function for determining whether two given (adjacent)\n     *        elements should be in the same group\n     * @param {Array} list The array to group. Also accepts a string, which will be\n     *        treated as a list of characters.\n     * @return {List} A list that contains sublists of equal elements,\n     *         whose concatenations is equal to the original list.\n     * @example\n     *\n     *    groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21])\n     *    // [[0], [1, 1], [2, 3, 5, 8, 13, 21]]\n     *\n     *    groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21])\n     *    // [[0], [1, 1], [2], [3, 5], [8], [13, 21]]\n     *\n     *    R.groupWith(R.eqBy(isVowel), 'aestiou')\n     *    // ['ae', 'st', 'iou']\n     */\n    var groupWith = _curry2(function (fn, list) {\n        var res = [];\n        var idx = 0;\n        var len = list.length;\n        while (idx < len) {\n            var nextidx = idx + 1;\n            while (nextidx < len && fn(list[idx], list[nextidx])) {\n                nextidx += 1;\n            }\n            res.push(list.slice(idx, nextidx));\n            idx = nextidx;\n        }\n        return res;\n    });\n\n    /**\n     * Returns `true` if the first argument is greater than the second; `false`\n     * otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig Ord a => a -> a -> Boolean\n     * @param {*} a\n     * @param {*} b\n     * @return {Boolean}\n     * @see R.lt\n     * @example\n     *\n     *      R.gt(2, 1); //=> true\n     *      R.gt(2, 2); //=> false\n     *      R.gt(2, 3); //=> false\n     *      R.gt('a', 'z'); //=> false\n     *      R.gt('z', 'a'); //=> true\n     */\n    var gt = _curry2(function gt(a, b) {\n        return a > b;\n    });\n\n    /**\n     * Returns `true` if the first argument is greater than or equal to the second;\n     * `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig Ord a => a -> a -> Boolean\n     * @param {Number} a\n     * @param {Number} b\n     * @return {Boolean}\n     * @see R.lte\n     * @example\n     *\n     *      R.gte(2, 1); //=> true\n     *      R.gte(2, 2); //=> true\n     *      R.gte(2, 3); //=> false\n     *      R.gte('a', 'z'); //=> false\n     *      R.gte('z', 'a'); //=> true\n     */\n    var gte = _curry2(function gte(a, b) {\n        return a >= b;\n    });\n\n    /**\n     * Returns whether or not an object has an own property with the specified name\n     *\n     * @func\n     * @memberOf R\n     * @since v0.7.0\n     * @category Object\n     * @sig s -> {s: x} -> Boolean\n     * @param {String} prop The name of the property to check for.\n     * @param {Object} obj The object to query.\n     * @return {Boolean} Whether the property exists.\n     * @example\n     *\n     *      var hasName = R.has('name');\n     *      hasName({name: 'alice'});   //=> true\n     *      hasName({name: 'bob'});     //=> true\n     *      hasName({});                //=> false\n     *\n     *      var point = {x: 0, y: 0};\n     *      var pointHas = R.has(R.__, point);\n     *      pointHas('x');  //=> true\n     *      pointHas('y');  //=> true\n     *      pointHas('z');  //=> false\n     */\n    var has = _curry2(_has);\n\n    /**\n     * Returns whether or not an object or its prototype chain has a property with\n     * the specified name\n     *\n     * @func\n     * @memberOf R\n     * @since v0.7.0\n     * @category Object\n     * @sig s -> {s: x} -> Boolean\n     * @param {String} prop The name of the property to check for.\n     * @param {Object} obj The object to query.\n     * @return {Boolean} Whether the property exists.\n     * @example\n     *\n     *      function Rectangle(width, height) {\n     *        this.width = width;\n     *        this.height = height;\n     *      }\n     *      Rectangle.prototype.area = function() {\n     *        return this.width * this.height;\n     *      };\n     *\n     *      var square = new Rectangle(2, 2);\n     *      R.hasIn('width', square);  //=> true\n     *      R.hasIn('area', square);  //=> true\n     */\n    var hasIn = _curry2(function hasIn(prop, obj) {\n        return prop in obj;\n    });\n\n    /**\n     * Returns true if its arguments are identical, false otherwise. Values are\n     * identical if they reference the same memory. `NaN` is identical to `NaN`;\n     * `0` and `-0` are not identical.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.15.0\n     * @category Relation\n     * @sig a -> a -> Boolean\n     * @param {*} a\n     * @param {*} b\n     * @return {Boolean}\n     * @example\n     *\n     *      var o = {};\n     *      R.identical(o, o); //=> true\n     *      R.identical(1, 1); //=> true\n     *      R.identical(1, '1'); //=> false\n     *      R.identical([], []); //=> false\n     *      R.identical(0, -0); //=> false\n     *      R.identical(NaN, NaN); //=> true\n     */\n    // SameValue algorithm\n    // Steps 1-5, 7-10\n    // Steps 6.b-6.e: +0 != -0\n    // Step 6.a: NaN == NaN\n    var identical = _curry2(function identical(a, b) {\n        // SameValue algorithm\n        if (a === b) {\n            // Steps 1-5, 7-10\n            // Steps 6.b-6.e: +0 != -0\n            return a !== 0 || 1 / a === 1 / b;\n        } else {\n            // Step 6.a: NaN == NaN\n            return a !== a && b !== b;\n        }\n    });\n\n    /**\n     * A function that does nothing but return the parameter supplied to it. Good\n     * as a default or placeholder function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig a -> a\n     * @param {*} x The value to return.\n     * @return {*} The input value, `x`.\n     * @example\n     *\n     *      R.identity(1); //=> 1\n     *\n     *      var obj = {};\n     *      R.identity(obj) === obj; //=> true\n     */\n    var identity = _curry1(_identity);\n\n    /**\n     * Creates a function that will process either the `onTrue` or the `onFalse`\n     * function depending upon the result of the `condition` predicate.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Logic\n     * @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *)\n     * @param {Function} condition A predicate function\n     * @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value.\n     * @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value.\n     * @return {Function} A new unary function that will process either the `onTrue` or the `onFalse`\n     *                    function depending upon the result of the `condition` predicate.\n     * @see R.unless, R.when\n     * @example\n     *\n     *      var incCount = R.ifElse(\n     *        R.has('count'),\n     *        R.over(R.lensProp('count'), R.inc),\n     *        R.assoc('count', 1)\n     *      );\n     *      incCount({});           //=> { count: 1 }\n     *      incCount({ count: 1 }); //=> { count: 2 }\n     */\n    var ifElse = _curry3(function ifElse(condition, onTrue, onFalse) {\n        return curryN(Math.max(condition.length, onTrue.length, onFalse.length), function _ifElse() {\n            return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments);\n        });\n    });\n\n    /**\n     * Increments its argument.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Math\n     * @sig Number -> Number\n     * @param {Number} n\n     * @return {Number}\n     * @see R.dec\n     * @example\n     *\n     *      R.inc(42); //=> 43\n     */\n    var inc = add(1);\n\n    /**\n     * Inserts the supplied element into the list, at index `index`. _Note that\n     * this is not destructive_: it returns a copy of the list with the changes.\n     * <small>No lists have been harmed in the application of this function.</small>\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.2\n     * @category List\n     * @sig Number -> a -> [a] -> [a]\n     * @param {Number} index The position to insert the element\n     * @param {*} elt The element to insert into the Array\n     * @param {Array} list The list to insert into\n     * @return {Array} A new Array with `elt` inserted at `index`.\n     * @example\n     *\n     *      R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4]\n     */\n    var insert = _curry3(function insert(idx, elt, list) {\n        idx = idx < list.length && idx >= 0 ? idx : list.length;\n        var result = _slice(list);\n        result.splice(idx, 0, elt);\n        return result;\n    });\n\n    /**\n     * Inserts the sub-list into the list, at index `index`. _Note that this is not\n     * destructive_: it returns a copy of the list with the changes.\n     * <small>No lists have been harmed in the application of this function.</small>\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category List\n     * @sig Number -> [a] -> [a] -> [a]\n     * @param {Number} index The position to insert the sub-list\n     * @param {Array} elts The sub-list to insert into the Array\n     * @param {Array} list The list to insert the sub-list into\n     * @return {Array} A new Array with `elts` inserted starting at `index`.\n     * @example\n     *\n     *      R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4]\n     */\n    var insertAll = _curry3(function insertAll(idx, elts, list) {\n        idx = idx < list.length && idx >= 0 ? idx : list.length;\n        return _concat(_concat(_slice(list, 0, idx), elts), _slice(list, idx));\n    });\n\n    /**\n     * Creates a new list with the separator interposed between elements.\n     *\n     * Dispatches to the `intersperse` method of the second argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category List\n     * @sig a -> [a] -> [a]\n     * @param {*} separator The element to add to the list.\n     * @param {Array} list The list to be interposed.\n     * @return {Array} The new list.\n     * @example\n     *\n     *      R.intersperse('n', ['ba', 'a', 'a']); //=> ['ba', 'n', 'a', 'n', 'a']\n     */\n    var intersperse = _curry2(_checkForMethod('intersperse', function intersperse(separator, list) {\n        var out = [];\n        var idx = 0;\n        var length = list.length;\n        while (idx < length) {\n            if (idx === length - 1) {\n                out.push(list[idx]);\n            } else {\n                out.push(list[idx], separator);\n            }\n            idx += 1;\n        }\n        return out;\n    }));\n\n    /**\n     * See if an object (`val`) is an instance of the supplied constructor. This\n     * function will check up the inheritance chain, if any.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category Type\n     * @sig (* -> {*}) -> a -> Boolean\n     * @param {Object} ctor A constructor\n     * @param {*} val The value to test\n     * @return {Boolean}\n     * @example\n     *\n     *      R.is(Object, {}); //=> true\n     *      R.is(Number, 1); //=> true\n     *      R.is(Object, 1); //=> false\n     *      R.is(String, 's'); //=> true\n     *      R.is(String, new String('')); //=> true\n     *      R.is(Object, new String('')); //=> true\n     *      R.is(Object, 's'); //=> false\n     *      R.is(Number, {}); //=> false\n     */\n    var is = _curry2(function is(Ctor, val) {\n        return val != null && val.constructor === Ctor || val instanceof Ctor;\n    });\n\n    /**\n     * Tests whether or not an object is similar to an array.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.5.0\n     * @category Type\n     * @category List\n     * @sig * -> Boolean\n     * @param {*} x The object to test.\n     * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.\n     * @example\n     *\n     *      R.isArrayLike([]); //=> true\n     *      R.isArrayLike(true); //=> false\n     *      R.isArrayLike({}); //=> false\n     *      R.isArrayLike({length: 10}); //=> false\n     *      R.isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true\n     */\n    var isArrayLike = _curry1(function isArrayLike(x) {\n        if (_isArray(x)) {\n            return true;\n        }\n        if (!x) {\n            return false;\n        }\n        if (typeof x !== 'object') {\n            return false;\n        }\n        if (x instanceof String) {\n            return false;\n        }\n        if (x.nodeType === 1) {\n            return !!x.length;\n        }\n        if (x.length === 0) {\n            return true;\n        }\n        if (x.length > 0) {\n            return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);\n        }\n        return false;\n    });\n\n    /**\n     * Checks if the input value is `null` or `undefined`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Type\n     * @sig * -> Boolean\n     * @param {*} x The value to test.\n     * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`.\n     * @example\n     *\n     *      R.isNil(null); //=> true\n     *      R.isNil(undefined); //=> true\n     *      R.isNil(0); //=> false\n     *      R.isNil([]); //=> false\n     */\n    var isNil = _curry1(function isNil(x) {\n        return x == null;\n    });\n\n    /**\n     * Returns a list containing the names of all the enumerable own properties of\n     * the supplied object.\n     * Note that the order of the output array is not guaranteed to be consistent\n     * across different JS platforms.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig {k: v} -> [k]\n     * @param {Object} obj The object to extract properties from\n     * @return {Array} An array of the object's own properties.\n     * @example\n     *\n     *      R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']\n     */\n    // cover IE < 9 keys issues\n    // Safari bug\n    var keys = function () {\n        // cover IE < 9 keys issues\n        var hasEnumBug = !{ toString: null }.propertyIsEnumerable('toString');\n        var nonEnumerableProps = [\n            'constructor',\n            'valueOf',\n            'isPrototypeOf',\n            'toString',\n            'propertyIsEnumerable',\n            'hasOwnProperty',\n            'toLocaleString'\n        ];\n        // Safari bug\n        var hasArgsEnumBug = function () {\n            'use strict';\n            return arguments.propertyIsEnumerable('length');\n        }();\n        var contains = function contains(list, item) {\n            var idx = 0;\n            while (idx < list.length) {\n                if (list[idx] === item) {\n                    return true;\n                }\n                idx += 1;\n            }\n            return false;\n        };\n        return typeof Object.keys === 'function' && !hasArgsEnumBug ? _curry1(function keys(obj) {\n            return Object(obj) !== obj ? [] : Object.keys(obj);\n        }) : _curry1(function keys(obj) {\n            if (Object(obj) !== obj) {\n                return [];\n            }\n            var prop, nIdx;\n            var ks = [];\n            var checkArgsLength = hasArgsEnumBug && _isArguments(obj);\n            for (prop in obj) {\n                if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {\n                    ks[ks.length] = prop;\n                }\n            }\n            if (hasEnumBug) {\n                nIdx = nonEnumerableProps.length - 1;\n                while (nIdx >= 0) {\n                    prop = nonEnumerableProps[nIdx];\n                    if (_has(prop, obj) && !contains(ks, prop)) {\n                        ks[ks.length] = prop;\n                    }\n                    nIdx -= 1;\n                }\n            }\n            return ks;\n        });\n    }();\n\n    /**\n     * Returns a list containing the names of all the properties of the supplied\n     * object, including prototype properties.\n     * Note that the order of the output array is not guaranteed to be consistent\n     * across different JS platforms.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.0\n     * @category Object\n     * @sig {k: v} -> [k]\n     * @param {Object} obj The object to extract properties from\n     * @return {Array} An array of the object's own and prototype properties.\n     * @example\n     *\n     *      var F = function() { this.x = 'X'; };\n     *      F.prototype.y = 'Y';\n     *      var f = new F();\n     *      R.keysIn(f); //=> ['x', 'y']\n     */\n    var keysIn = _curry1(function keysIn(obj) {\n        var prop;\n        var ks = [];\n        for (prop in obj) {\n            ks[ks.length] = prop;\n        }\n        return ks;\n    });\n\n    /**\n     * Returns the number of elements in the array by returning `list.length`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category List\n     * @sig [a] -> Number\n     * @param {Array} list The array to inspect.\n     * @return {Number} The length of the array.\n     * @example\n     *\n     *      R.length([]); //=> 0\n     *      R.length([1, 2, 3]); //=> 3\n     */\n    var length = _curry1(function length(list) {\n        return list != null && is(Number, list.length) ? list.length : NaN;\n    });\n\n    /**\n     * Returns `true` if the first argument is less than the second; `false`\n     * otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig Ord a => a -> a -> Boolean\n     * @param {*} a\n     * @param {*} b\n     * @return {Boolean}\n     * @see R.gt\n     * @example\n     *\n     *      R.lt(2, 1); //=> false\n     *      R.lt(2, 2); //=> false\n     *      R.lt(2, 3); //=> true\n     *      R.lt('a', 'z'); //=> true\n     *      R.lt('z', 'a'); //=> false\n     */\n    var lt = _curry2(function lt(a, b) {\n        return a < b;\n    });\n\n    /**\n     * Returns `true` if the first argument is less than or equal to the second;\n     * `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig Ord a => a -> a -> Boolean\n     * @param {Number} a\n     * @param {Number} b\n     * @return {Boolean}\n     * @see R.gte\n     * @example\n     *\n     *      R.lte(2, 1); //=> false\n     *      R.lte(2, 2); //=> true\n     *      R.lte(2, 3); //=> true\n     *      R.lte('a', 'z'); //=> true\n     *      R.lte('z', 'a'); //=> false\n     */\n    var lte = _curry2(function lte(a, b) {\n        return a <= b;\n    });\n\n    /**\n     * The mapAccum function behaves like a combination of map and reduce; it\n     * applies a function to each element of a list, passing an accumulating\n     * parameter from left to right, and returning a final value of this\n     * accumulator together with the new list.\n     *\n     * The iterator function receives two arguments, *acc* and *value*, and should\n     * return a tuple *[acc, value]*.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category List\n     * @sig (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])\n     * @param {Function} fn The function to be called on every element of the input `list`.\n     * @param {*} acc The accumulator value.\n     * @param {Array} list The list to iterate over.\n     * @return {*} The final, accumulated value.\n     * @see R.addIndex\n     * @example\n     *\n     *      var digits = ['1', '2', '3', '4'];\n     *      var appender = (a, b) => [a + b, a + b];\n     *\n     *      R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']]\n     */\n    var mapAccum = _curry3(function mapAccum(fn, acc, list) {\n        var idx = 0;\n        var len = list.length;\n        var result = [];\n        var tuple = [acc];\n        while (idx < len) {\n            tuple = fn(tuple[0], list[idx]);\n            result[idx] = tuple[1];\n            idx += 1;\n        }\n        return [\n            tuple[0],\n            result\n        ];\n    });\n\n    /**\n     * The mapAccumRight function behaves like a combination of map and reduce; it\n     * applies a function to each element of a list, passing an accumulating\n     * parameter from right to left, and returning a final value of this\n     * accumulator together with the new list.\n     *\n     * Similar to `mapAccum`, except moves through the input list from the right to\n     * the left.\n     *\n     * The iterator function receives two arguments, *acc* and *value*, and should\n     * return a tuple *[acc, value]*.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category List\n     * @sig (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])\n     * @param {Function} fn The function to be called on every element of the input `list`.\n     * @param {*} acc The accumulator value.\n     * @param {Array} list The list to iterate over.\n     * @return {*} The final, accumulated value.\n     * @see R.addIndex\n     * @example\n     *\n     *      var digits = ['1', '2', '3', '4'];\n     *      var append = (a, b) => [a + b, a + b];\n     *\n     *      R.mapAccumRight(append, 0, digits); //=> ['04321', ['04321', '0432', '043', '04']]\n     */\n    var mapAccumRight = _curry3(function mapAccumRight(fn, acc, list) {\n        var idx = list.length - 1;\n        var result = [];\n        var tuple = [acc];\n        while (idx >= 0) {\n            tuple = fn(tuple[0], list[idx]);\n            result[idx] = tuple[1];\n            idx -= 1;\n        }\n        return [\n            tuple[0],\n            result\n        ];\n    });\n\n    /**\n     * Tests a regular expression against a String. Note that this function will\n     * return an empty array when there are no matches. This differs from\n     * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)\n     * which returns `null` when there are no matches.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category String\n     * @sig RegExp -> String -> [String | Undefined]\n     * @param {RegExp} rx A regular expression.\n     * @param {String} str The string to match against\n     * @return {Array} The list of matches or empty array.\n     * @see R.test\n     * @example\n     *\n     *      R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na']\n     *      R.match(/a/, 'b'); //=> []\n     *      R.match(/a/, null); //=> TypeError: null does not have a method named \"match\"\n     */\n    var match = _curry2(function match(rx, str) {\n        return str.match(rx) || [];\n    });\n\n    /**\n     * mathMod behaves like the modulo operator should mathematically, unlike the\n     * `%` operator (and by extension, R.modulo). So while \"-17 % 5\" is -2,\n     * mathMod(-17, 5) is 3. mathMod requires Integer arguments, and returns NaN\n     * when the modulus is zero or negative.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category Math\n     * @sig Number -> Number -> Number\n     * @param {Number} m The dividend.\n     * @param {Number} p the modulus.\n     * @return {Number} The result of `b mod a`.\n     * @example\n     *\n     *      R.mathMod(-17, 5);  //=> 3\n     *      R.mathMod(17, 5);   //=> 2\n     *      R.mathMod(17, -5);  //=> NaN\n     *      R.mathMod(17, 0);   //=> NaN\n     *      R.mathMod(17.2, 5); //=> NaN\n     *      R.mathMod(17, 5.3); //=> NaN\n     *\n     *      var clock = R.mathMod(R.__, 12);\n     *      clock(15); //=> 3\n     *      clock(24); //=> 0\n     *\n     *      var seventeenMod = R.mathMod(17);\n     *      seventeenMod(3);  //=> 2\n     *      seventeenMod(4);  //=> 1\n     *      seventeenMod(10); //=> 7\n     */\n    var mathMod = _curry2(function mathMod(m, p) {\n        if (!_isInteger(m)) {\n            return NaN;\n        }\n        if (!_isInteger(p) || p < 1) {\n            return NaN;\n        }\n        return (m % p + p) % p;\n    });\n\n    /**\n     * Returns the larger of its two arguments.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig Ord a => a -> a -> a\n     * @param {*} a\n     * @param {*} b\n     * @return {*}\n     * @see R.maxBy, R.min\n     * @example\n     *\n     *      R.max(789, 123); //=> 789\n     *      R.max('a', 'b'); //=> 'b'\n     */\n    var max = _curry2(function max(a, b) {\n        return b > a ? b : a;\n    });\n\n    /**\n     * Takes a function and two values, and returns whichever value produces the\n     * larger result when passed to the provided function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Relation\n     * @sig Ord b => (a -> b) -> a -> a -> a\n     * @param {Function} f\n     * @param {*} a\n     * @param {*} b\n     * @return {*}\n     * @see R.max, R.minBy\n     * @example\n     *\n     *      //  square :: Number -> Number\n     *      var square = n => n * n;\n     *\n     *      R.maxBy(square, -3, 2); //=> -3\n     *\n     *      R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5\n     *      R.reduce(R.maxBy(square), 0, []); //=> 0\n     */\n    var maxBy = _curry3(function maxBy(f, a, b) {\n        return f(b) > f(a) ? b : a;\n    });\n\n    /**\n     * Create a new object with the own properties of the first object merged with\n     * the own properties of the second object. If a key exists in both objects,\n     * the value from the second object will be used.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig {k: v} -> {k: v} -> {k: v}\n     * @param {Object} l\n     * @param {Object} r\n     * @return {Object}\n     * @see R.mergeWith, R.mergeWithKey\n     * @example\n     *\n     *      R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 });\n     *      //=> { 'name': 'fred', 'age': 40 }\n     *\n     *      var resetToDefault = R.merge(R.__, {x: 0});\n     *      resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2}\n     */\n    var merge = _curry2(function merge(l, r) {\n        return _assign({}, l, r);\n    });\n\n    /**\n     * Merges a list of objects together into one object.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category List\n     * @sig [{k: v}] -> {k: v}\n     * @param {Array} list An array of objects\n     * @return {Object} A merged object.\n     * @see R.reduce\n     * @example\n     *\n     *      R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3}\n     *      R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2}\n     */\n    var mergeAll = _curry1(function mergeAll(list) {\n        return _assign.apply(null, [{}].concat(list));\n    });\n\n    /**\n     * Creates a new object with the own properties of the two provided objects. If\n     * a key exists in both objects, the provided function is applied to the key\n     * and the values associated with the key in each object, with the result being\n     * used as the value associated with the key in the returned object. The key\n     * will be excluded from the returned object if the resulting value is\n     * `undefined`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category Object\n     * @sig (String -> a -> a -> a) -> {a} -> {a} -> {a}\n     * @param {Function} fn\n     * @param {Object} l\n     * @param {Object} r\n     * @return {Object}\n     * @see R.merge, R.mergeWith\n     * @example\n     *\n     *      let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r\n     *      R.mergeWithKey(concatValues,\n     *                     { a: true, thing: 'foo', values: [10, 20] },\n     *                     { b: true, thing: 'bar', values: [15, 35] });\n     *      //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }\n     */\n    var mergeWithKey = _curry3(function mergeWithKey(fn, l, r) {\n        var result = {};\n        var k;\n        for (k in l) {\n            if (_has(k, l)) {\n                result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];\n            }\n        }\n        for (k in r) {\n            if (_has(k, r) && !_has(k, result)) {\n                result[k] = r[k];\n            }\n        }\n        return result;\n    });\n\n    /**\n     * Returns the smaller of its two arguments.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig Ord a => a -> a -> a\n     * @param {*} a\n     * @param {*} b\n     * @return {*}\n     * @see R.minBy, R.max\n     * @example\n     *\n     *      R.min(789, 123); //=> 123\n     *      R.min('a', 'b'); //=> 'a'\n     */\n    var min = _curry2(function min(a, b) {\n        return b < a ? b : a;\n    });\n\n    /**\n     * Takes a function and two values, and returns whichever value produces the\n     * smaller result when passed to the provided function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Relation\n     * @sig Ord b => (a -> b) -> a -> a -> a\n     * @param {Function} f\n     * @param {*} a\n     * @param {*} b\n     * @return {*}\n     * @see R.min, R.maxBy\n     * @example\n     *\n     *      //  square :: Number -> Number\n     *      var square = n => n * n;\n     *\n     *      R.minBy(square, -3, 2); //=> 2\n     *\n     *      R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1\n     *      R.reduce(R.minBy(square), Infinity, []); //=> Infinity\n     */\n    var minBy = _curry3(function minBy(f, a, b) {\n        return f(b) < f(a) ? b : a;\n    });\n\n    /**\n     * Divides the second parameter by the first and returns the remainder. Note\n     * that this function preserves the JavaScript-style behavior for modulo. For\n     * mathematical modulo see `mathMod`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.1\n     * @category Math\n     * @sig Number -> Number -> Number\n     * @param {Number} a The value to the divide.\n     * @param {Number} b The pseudo-modulus\n     * @return {Number} The result of `b % a`.\n     * @see R.mathMod\n     * @example\n     *\n     *      R.modulo(17, 3); //=> 2\n     *      // JS behavior:\n     *      R.modulo(-17, 3); //=> -2\n     *      R.modulo(17, -3); //=> 2\n     *\n     *      var isOdd = R.modulo(R.__, 2);\n     *      isOdd(42); //=> 0\n     *      isOdd(21); //=> 1\n     */\n    var modulo = _curry2(function modulo(a, b) {\n        return a % b;\n    });\n\n    /**\n     * Multiplies two numbers. Equivalent to `a * b` but curried.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Math\n     * @sig Number -> Number -> Number\n     * @param {Number} a The first value.\n     * @param {Number} b The second value.\n     * @return {Number} The result of `a * b`.\n     * @see R.divide\n     * @example\n     *\n     *      var double = R.multiply(2);\n     *      var triple = R.multiply(3);\n     *      double(3);       //=>  6\n     *      triple(4);       //=> 12\n     *      R.multiply(2, 5);  //=> 10\n     */\n    var multiply = _curry2(function multiply(a, b) {\n        return a * b;\n    });\n\n    /**\n     * Wraps a function of any arity (including nullary) in a function that accepts\n     * exactly `n` parameters. Any extraneous parameters will not be passed to the\n     * supplied function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig Number -> (* -> a) -> (* -> a)\n     * @param {Number} n The desired arity of the new function.\n     * @param {Function} fn The function to wrap.\n     * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of\n     *         arity `n`.\n     * @example\n     *\n     *      var takesTwoArgs = (a, b) => [a, b];\n     *\n     *      takesTwoArgs.length; //=> 2\n     *      takesTwoArgs(1, 2); //=> [1, 2]\n     *\n     *      var takesOneArg = R.nAry(1, takesTwoArgs);\n     *      takesOneArg.length; //=> 1\n     *      // Only `n` arguments are passed to the wrapped function\n     *      takesOneArg(1, 2); //=> [1, undefined]\n     */\n    var nAry = _curry2(function nAry(n, fn) {\n        switch (n) {\n        case 0:\n            return function () {\n                return fn.call(this);\n            };\n        case 1:\n            return function (a0) {\n                return fn.call(this, a0);\n            };\n        case 2:\n            return function (a0, a1) {\n                return fn.call(this, a0, a1);\n            };\n        case 3:\n            return function (a0, a1, a2) {\n                return fn.call(this, a0, a1, a2);\n            };\n        case 4:\n            return function (a0, a1, a2, a3) {\n                return fn.call(this, a0, a1, a2, a3);\n            };\n        case 5:\n            return function (a0, a1, a2, a3, a4) {\n                return fn.call(this, a0, a1, a2, a3, a4);\n            };\n        case 6:\n            return function (a0, a1, a2, a3, a4, a5) {\n                return fn.call(this, a0, a1, a2, a3, a4, a5);\n            };\n        case 7:\n            return function (a0, a1, a2, a3, a4, a5, a6) {\n                return fn.call(this, a0, a1, a2, a3, a4, a5, a6);\n            };\n        case 8:\n            return function (a0, a1, a2, a3, a4, a5, a6, a7) {\n                return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7);\n            };\n        case 9:\n            return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {\n                return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8);\n            };\n        case 10:\n            return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {\n                return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);\n            };\n        default:\n            throw new Error('First argument to nAry must be a non-negative integer no greater than ten');\n        }\n    });\n\n    /**\n     * Negates its argument.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Math\n     * @sig Number -> Number\n     * @param {Number} n\n     * @return {Number}\n     * @example\n     *\n     *      R.negate(42); //=> -42\n     */\n    var negate = _curry1(function negate(n) {\n        return -n;\n    });\n\n    /**\n     * Returns `true` if no elements of the list match the predicate, `false`\n     * otherwise.\n     *\n     * Dispatches to the `any` method of the second argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> Boolean\n     * @param {Function} fn The predicate function.\n     * @param {Array} list The array to consider.\n     * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise.\n     * @see R.all, R.any\n     * @example\n     *\n     *      var isEven = n => n % 2 === 0;\n     *\n     *      R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true\n     *      R.none(isEven, [1, 3, 5, 7, 8, 11]); //=> false\n     */\n    var none = _curry2(_complement(_dispatchable('any', _xany, any)));\n\n    /**\n     * A function that returns the `!` of its argument. It will return `true` when\n     * passed false-y value, and `false` when passed a truth-y one.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Logic\n     * @sig * -> Boolean\n     * @param {*} a any value\n     * @return {Boolean} the logical inverse of passed argument.\n     * @see R.complement\n     * @example\n     *\n     *      R.not(true); //=> false\n     *      R.not(false); //=> true\n     *      R.not(0); => true\n     *      R.not(1); => false\n     */\n    var not = _curry1(function not(a) {\n        return !a;\n    });\n\n    /**\n     * Returns the nth element of the given list or string. If n is negative the\n     * element at index length + n is returned.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig Number -> [a] -> a | Undefined\n     * @sig Number -> String -> String\n     * @param {Number} offset\n     * @param {*} list\n     * @return {*}\n     * @example\n     *\n     *      var list = ['foo', 'bar', 'baz', 'quux'];\n     *      R.nth(1, list); //=> 'bar'\n     *      R.nth(-1, list); //=> 'quux'\n     *      R.nth(-99, list); //=> undefined\n     *\n     *      R.nth(2, 'abc'); //=> 'c'\n     *      R.nth(3, 'abc'); //=> ''\n     */\n    var nth = _curry2(function nth(offset, list) {\n        var idx = offset < 0 ? list.length + offset : offset;\n        return _isString(list) ? list.charAt(idx) : list[idx];\n    });\n\n    /**\n     * Returns a function which returns its nth argument.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Function\n     * @sig Number -> *... -> *\n     * @param {Number} n\n     * @return {Function}\n     * @example\n     *\n     *      R.nthArg(1)('a', 'b', 'c'); //=> 'b'\n     *      R.nthArg(-1)('a', 'b', 'c'); //=> 'c'\n     */\n    var nthArg = _curry1(function nthArg(n) {\n        return function () {\n            return nth(n, arguments);\n        };\n    });\n\n    /**\n     * Creates an object containing a single key:value pair.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.18.0\n     * @category Object\n     * @sig String -> a -> {String:a}\n     * @param {String} key\n     * @param {*} val\n     * @return {Object}\n     * @see R.pair\n     * @example\n     *\n     *      var matchPhrases = R.compose(\n     *        R.objOf('must'),\n     *        R.map(R.objOf('match_phrase'))\n     *      );\n     *      matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]}\n     */\n    var objOf = _curry2(function objOf(key, val) {\n        var obj = {};\n        obj[key] = val;\n        return obj;\n    });\n\n    /**\n     * Returns a singleton array containing the value provided.\n     *\n     * Note this `of` is different from the ES6 `of`; See\n     * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category Function\n     * @sig a -> [a]\n     * @param {*} x any value\n     * @return {Array} An array wrapping `x`.\n     * @example\n     *\n     *      R.of(null); //=> [null]\n     *      R.of([42]); //=> [[42]]\n     */\n    var of = _curry1(_of);\n\n    /**\n     * Accepts a function `fn` and returns a function that guards invocation of\n     * `fn` such that `fn` can only ever be called once, no matter how many times\n     * the returned function is invoked. The first value calculated is returned in\n     * subsequent invocations.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (a... -> b) -> (a... -> b)\n     * @param {Function} fn The function to wrap in a call-only-once wrapper.\n     * @return {Function} The wrapped function.\n     * @example\n     *\n     *      var addOneOnce = R.once(x => x + 1);\n     *      addOneOnce(10); //=> 11\n     *      addOneOnce(addOneOnce(50)); //=> 11\n     */\n    var once = _curry1(function once(fn) {\n        var called = false;\n        var result;\n        return _arity(fn.length, function () {\n            if (called) {\n                return result;\n            }\n            called = true;\n            result = fn.apply(this, arguments);\n            return result;\n        });\n    });\n\n    /**\n     * Returns `true` if one or both of its arguments are `true`. Returns `false`\n     * if both arguments are `false`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Logic\n     * @sig * -> * -> *\n     * @param {Boolean} a A boolean value\n     * @param {Boolean} b A boolean value\n     * @return {Boolean} `true` if one or both arguments are `true`, `false` otherwise\n     * @see R.either\n     * @example\n     *\n     *      R.or(true, true); //=> true\n     *      R.or(true, false); //=> true\n     *      R.or(false, true); //=> true\n     *      R.or(false, false); //=> false\n     */\n    var or = _curry2(function or(a, b) {\n        return a || b;\n    });\n\n    /**\n     * Returns the result of \"setting\" the portion of the given data structure\n     * focused by the given lens to the result of applying the given function to\n     * the focused value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category Object\n     * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s\n     * @sig Lens s a -> (a -> a) -> s -> s\n     * @param {Lens} lens\n     * @param {*} v\n     * @param {*} x\n     * @return {*}\n     * @see R.prop, R.lensIndex, R.lensProp\n     * @example\n     *\n     *      var headLens = R.lensIndex(0);\n     *\n     *      R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz']\n     */\n    // `Identity` is a functor that holds a single value, where `map` simply\n    // transforms the held value with the provided function.\n    // The value returned by the getter function is first transformed with `f`,\n    // then set as the value of an `Identity`. This is then mapped over with the\n    // setter function of the lens.\n    var over = function () {\n        // `Identity` is a functor that holds a single value, where `map` simply\n        // transforms the held value with the provided function.\n        var Identity = function (x) {\n            return {\n                value: x,\n                map: function (f) {\n                    return Identity(f(x));\n                }\n            };\n        };\n        return _curry3(function over(lens, f, x) {\n            // The value returned by the getter function is first transformed with `f`,\n            // then set as the value of an `Identity`. This is then mapped over with the\n            // setter function of the lens.\n            return lens(function (y) {\n                return Identity(f(y));\n            })(x).value;\n        });\n    }();\n\n    /**\n     * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.18.0\n     * @category List\n     * @sig a -> b -> (a,b)\n     * @param {*} fst\n     * @param {*} snd\n     * @return {Array}\n     * @see R.objOf, R.of\n     * @example\n     *\n     *      R.pair('foo', 'bar'); //=> ['foo', 'bar']\n     */\n    var pair = _curry2(function pair(fst, snd) {\n        return [\n            fst,\n            snd\n        ];\n    });\n\n    /**\n     * Retrieve the value at a given path.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.0\n     * @category Object\n     * @sig [String] -> {k: v} -> v | Undefined\n     * @param {Array} path The path to use.\n     * @param {Object} obj The object to retrieve the nested property from.\n     * @return {*} The data at `path`.\n     * @example\n     *\n     *      R.path(['a', 'b'], {a: {b: 2}}); //=> 2\n     *      R.path(['a', 'b'], {c: {b: 2}}); //=> undefined\n     */\n    var path = _curry2(function path(paths, obj) {\n        var val = obj;\n        var idx = 0;\n        while (idx < paths.length) {\n            if (val == null) {\n                return;\n            }\n            val = val[paths[idx]];\n            idx += 1;\n        }\n        return val;\n    });\n\n    /**\n     * If the given, non-null object has a value at the given path, returns the\n     * value at that path. Otherwise returns the provided default value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.18.0\n     * @category Object\n     * @sig a -> [String] -> Object -> a\n     * @param {*} d The default value.\n     * @param {Array} p The path to use.\n     * @param {Object} obj The object to retrieve the nested property from.\n     * @return {*} The data at `path` of the supplied object or the default value.\n     * @example\n     *\n     *      R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2\n     *      R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> \"N/A\"\n     */\n    var pathOr = _curry3(function pathOr(d, p, obj) {\n        return defaultTo(d, path(p, obj));\n    });\n\n    /**\n     * Returns `true` if the specified object property at given path satisfies the\n     * given predicate; `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category Logic\n     * @sig (a -> Boolean) -> [String] -> Object -> Boolean\n     * @param {Function} pred\n     * @param {Array} propPath\n     * @param {*} obj\n     * @return {Boolean}\n     * @see R.propSatisfies, R.path\n     * @example\n     *\n     *      R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true\n     */\n    var pathSatisfies = _curry3(function pathSatisfies(pred, propPath, obj) {\n        return propPath.length > 0 && pred(path(propPath, obj));\n    });\n\n    /**\n     * Returns a partial copy of an object containing only the keys specified. If\n     * the key does not exist, the property is ignored.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig [k] -> {k: v} -> {k: v}\n     * @param {Array} names an array of String property names to copy onto a new object\n     * @param {Object} obj The object to copy from\n     * @return {Object} A new object with only properties from `names` on it.\n     * @see R.omit, R.props\n     * @example\n     *\n     *      R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}\n     *      R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}\n     */\n    var pick = _curry2(function pick(names, obj) {\n        var result = {};\n        var idx = 0;\n        while (idx < names.length) {\n            if (names[idx] in obj) {\n                result[names[idx]] = obj[names[idx]];\n            }\n            idx += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Similar to `pick` except that this one includes a `key: undefined` pair for\n     * properties that don't exist.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig [k] -> {k: v} -> {k: v}\n     * @param {Array} names an array of String property names to copy onto a new object\n     * @param {Object} obj The object to copy from\n     * @return {Object} A new object with only properties from `names` on it.\n     * @see R.pick\n     * @example\n     *\n     *      R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}\n     *      R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined}\n     */\n    var pickAll = _curry2(function pickAll(names, obj) {\n        var result = {};\n        var idx = 0;\n        var len = names.length;\n        while (idx < len) {\n            var name = names[idx];\n            result[name] = obj[name];\n            idx += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Returns a partial copy of an object containing only the keys that satisfy\n     * the supplied predicate.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Object\n     * @sig (v, k -> Boolean) -> {k: v} -> {k: v}\n     * @param {Function} pred A predicate to determine whether or not a key\n     *        should be included on the output object.\n     * @param {Object} obj The object to copy from\n     * @return {Object} A new object with only properties that satisfy `pred`\n     *         on it.\n     * @see R.pick, R.filter\n     * @example\n     *\n     *      var isUpperCase = (val, key) => key.toUpperCase() === key;\n     *      R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}\n     */\n    var pickBy = _curry2(function pickBy(test, obj) {\n        var result = {};\n        for (var prop in obj) {\n            if (test(obj[prop], prop, obj)) {\n                result[prop] = obj[prop];\n            }\n        }\n        return result;\n    });\n\n    /**\n     * Returns a new list with the given element at the front, followed by the\n     * contents of the list.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig a -> [a] -> [a]\n     * @param {*} el The item to add to the head of the output list.\n     * @param {Array} list The array to add to the tail of the output list.\n     * @return {Array} A new array.\n     * @see R.append\n     * @example\n     *\n     *      R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum']\n     */\n    var prepend = _curry2(function prepend(el, list) {\n        return _concat([el], list);\n    });\n\n    /**\n     * Returns a function that when supplied an object returns the indicated\n     * property of that object, if it exists.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig s -> {s: a} -> a | Undefined\n     * @param {String} p The property name\n     * @param {Object} obj The object to query\n     * @return {*} The value at `obj.p`.\n     * @example\n     *\n     *      R.prop('x', {x: 100}); //=> 100\n     *      R.prop('x', {}); //=> undefined\n     */\n    var prop = _curry2(function prop(p, obj) {\n        return obj[p];\n    });\n\n    /**\n     * If the given, non-null object has an own property with the specified name,\n     * returns the value of that property. Otherwise returns the provided default\n     * value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.6.0\n     * @category Object\n     * @sig a -> String -> Object -> a\n     * @param {*} val The default value.\n     * @param {String} p The name of the property to return.\n     * @param {Object} obj The object to query.\n     * @return {*} The value of given property of the supplied object or the default value.\n     * @example\n     *\n     *      var alice = {\n     *        name: 'ALICE',\n     *        age: 101\n     *      };\n     *      var favorite = R.prop('favoriteLibrary');\n     *      var favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary');\n     *\n     *      favorite(alice);  //=> undefined\n     *      favoriteWithDefault(alice);  //=> 'Ramda'\n     */\n    var propOr = _curry3(function propOr(val, p, obj) {\n        return obj != null && _has(p, obj) ? obj[p] : val;\n    });\n\n    /**\n     * Returns `true` if the specified object property satisfies the given\n     * predicate; `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category Logic\n     * @sig (a -> Boolean) -> String -> {String: a} -> Boolean\n     * @param {Function} pred\n     * @param {String} name\n     * @param {*} obj\n     * @return {Boolean}\n     * @see R.propEq, R.propIs\n     * @example\n     *\n     *      R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true\n     */\n    var propSatisfies = _curry3(function propSatisfies(pred, name, obj) {\n        return pred(obj[name]);\n    });\n\n    /**\n     * Acts as multiple `prop`: array of keys in, array of values out. Preserves\n     * order.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig [k] -> {k: v} -> [v]\n     * @param {Array} ps The property names to fetch\n     * @param {Object} obj The object to query\n     * @return {Array} The corresponding values or partially applied function.\n     * @example\n     *\n     *      R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2]\n     *      R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2]\n     *\n     *      var fullName = R.compose(R.join(' '), R.props(['first', 'last']));\n     *      fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth'\n     */\n    var props = _curry2(function props(ps, obj) {\n        var len = ps.length;\n        var out = [];\n        var idx = 0;\n        while (idx < len) {\n            out[idx] = obj[ps[idx]];\n            idx += 1;\n        }\n        return out;\n    });\n\n    /**\n     * Returns a list of numbers from `from` (inclusive) to `to` (exclusive).\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig Number -> Number -> [Number]\n     * @param {Number} from The first number in the list.\n     * @param {Number} to One more than the last number in the list.\n     * @return {Array} The list of numbers in tthe set `[a, b)`.\n     * @example\n     *\n     *      R.range(1, 5);    //=> [1, 2, 3, 4]\n     *      R.range(50, 53);  //=> [50, 51, 52]\n     */\n    var range = _curry2(function range(from, to) {\n        if (!(_isNumber(from) && _isNumber(to))) {\n            throw new TypeError('Both arguments to range must be numbers');\n        }\n        var result = [];\n        var n = from;\n        while (n < to) {\n            result.push(n);\n            n += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Returns a single item by iterating through the list, successively calling\n     * the iterator function and passing it an accumulator value and the current\n     * value from the array, and then passing the result to the next call.\n     *\n     * Similar to `reduce`, except moves through the input list from the right to\n     * the left.\n     *\n     * The iterator function receives two values: *(acc, value)*\n     *\n     * Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse\n     * arrays), unlike the native `Array.prototype.reduce` method. For more details\n     * on this behavior, see:\n     * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a,b -> a) -> a -> [b] -> a\n     * @param {Function} fn The iterator function. Receives two values, the accumulator and the\n     *        current element from the array.\n     * @param {*} acc The accumulator value.\n     * @param {Array} list The list to iterate over.\n     * @return {*} The final, accumulated value.\n     * @see R.addIndex\n     * @example\n     *\n     *      var pairs = [ ['a', 1], ['b', 2], ['c', 3] ];\n     *      var flattenPairs = (acc, pair) => acc.concat(pair);\n     *\n     *      R.reduceRight(flattenPairs, [], pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ]\n     */\n    var reduceRight = _curry3(function reduceRight(fn, acc, list) {\n        var idx = list.length - 1;\n        while (idx >= 0) {\n            acc = fn(acc, list[idx]);\n            idx -= 1;\n        }\n        return acc;\n    });\n\n    /**\n     * Returns a value wrapped to indicate that it is the final value of the reduce\n     * and transduce functions. The returned value should be considered a black\n     * box: the internal structure is not guaranteed to be stable.\n     *\n     * Note: this optimization is unavailable to functions not explicitly listed\n     * above. For instance, it is not currently supported by reduceRight.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.15.0\n     * @category List\n     * @sig a -> *\n     * @param {*} x The final value of the reduce.\n     * @return {*} The wrapped value.\n     * @see R.reduce, R.transduce\n     * @example\n     *\n     *      R.reduce(\n     *        R.pipe(R.add, R.when(R.gte(R.__, 10), R.reduced)),\n     *        0,\n     *        [1, 2, 3, 4, 5]) // 10\n     */\n    var reduced = _curry1(_reduced);\n\n    /**\n     * Removes the sub-list of `list` starting at index `start` and containing\n     * `count` elements. _Note that this is not destructive_: it returns a copy of\n     * the list with the changes.\n     * <small>No lists have been harmed in the application of this function.</small>\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.2\n     * @category List\n     * @sig Number -> Number -> [a] -> [a]\n     * @param {Number} start The position to start removing elements\n     * @param {Number} count The number of elements to remove\n     * @param {Array} list The list to remove from\n     * @return {Array} A new Array with `count` elements from `start` removed.\n     * @example\n     *\n     *      R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8]\n     */\n    var remove = _curry3(function remove(start, count, list) {\n        return _concat(_slice(list, 0, Math.min(start, list.length)), _slice(list, Math.min(list.length, start + count)));\n    });\n\n    /**\n     * Replace a substring or regex match in a string with a replacement.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.7.0\n     * @category String\n     * @sig RegExp|String -> String -> String -> String\n     * @param {RegExp|String} pattern A regular expression or a substring to match.\n     * @param {String} replacement The string to replace the matches with.\n     * @param {String} str The String to do the search and replacement in.\n     * @return {String} The result.\n     * @example\n     *\n     *      R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo'\n     *      R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo'\n     *\n     *      // Use the \"g\" (global) flag to replace all occurrences:\n     *      R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar'\n     */\n    var replace = _curry3(function replace(regex, replacement, str) {\n        return str.replace(regex, replacement);\n    });\n\n    /**\n     * Returns a new list or string with the elements or characters in reverse\n     * order.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> [a]\n     * @sig String -> String\n     * @param {Array|String} list\n     * @return {Array|String}\n     * @example\n     *\n     *      R.reverse([1, 2, 3]);  //=> [3, 2, 1]\n     *      R.reverse([1, 2]);     //=> [2, 1]\n     *      R.reverse([1]);        //=> [1]\n     *      R.reverse([]);         //=> []\n     *\n     *      R.reverse('abc');      //=> 'cba'\n     *      R.reverse('ab');       //=> 'ba'\n     *      R.reverse('a');        //=> 'a'\n     *      R.reverse('');         //=> ''\n     */\n    var reverse = _curry1(function reverse(list) {\n        return _isString(list) ? list.split('').reverse().join('') : _slice(list).reverse();\n    });\n\n    /**\n     * Scan is similar to reduce, but returns a list of successively reduced values\n     * from the left\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category List\n     * @sig (a,b -> a) -> a -> [b] -> [a]\n     * @param {Function} fn The iterator function. Receives two values, the accumulator and the\n     *        current element from the array\n     * @param {*} acc The accumulator value.\n     * @param {Array} list The list to iterate over.\n     * @return {Array} A list of all intermediately reduced values.\n     * @example\n     *\n     *      var numbers = [1, 2, 3, 4];\n     *      var factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24]\n     */\n    var scan = _curry3(function scan(fn, acc, list) {\n        var idx = 0;\n        var len = list.length;\n        var result = [acc];\n        while (idx < len) {\n            acc = fn(acc, list[idx]);\n            result[idx + 1] = acc;\n            idx += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Returns the result of \"setting\" the portion of the given data structure\n     * focused by the given lens to the given value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category Object\n     * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s\n     * @sig Lens s a -> a -> s -> s\n     * @param {Lens} lens\n     * @param {*} v\n     * @param {*} x\n     * @return {*}\n     * @see R.prop, R.lensIndex, R.lensProp\n     * @example\n     *\n     *      var xLens = R.lensProp('x');\n     *\n     *      R.set(xLens, 4, {x: 1, y: 2});  //=> {x: 4, y: 2}\n     *      R.set(xLens, 8, {x: 1, y: 2});  //=> {x: 8, y: 2}\n     */\n    var set = _curry3(function set(lens, v, x) {\n        return over(lens, always(v), x);\n    });\n\n    /**\n     * Returns the elements of the given list or string (or object with a `slice`\n     * method) from `fromIndex` (inclusive) to `toIndex` (exclusive).\n     *\n     * Dispatches to the `slice` method of the third argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.4\n     * @category List\n     * @sig Number -> Number -> [a] -> [a]\n     * @sig Number -> Number -> String -> String\n     * @param {Number} fromIndex The start index (inclusive).\n     * @param {Number} toIndex The end index (exclusive).\n     * @param {*} list\n     * @return {*}\n     * @example\n     *\n     *      R.slice(1, 3, ['a', 'b', 'c', 'd']);        //=> ['b', 'c']\n     *      R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd']\n     *      R.slice(0, -1, ['a', 'b', 'c', 'd']);       //=> ['a', 'b', 'c']\n     *      R.slice(-3, -1, ['a', 'b', 'c', 'd']);      //=> ['b', 'c']\n     *      R.slice(0, 3, 'ramda');                     //=> 'ram'\n     */\n    var slice = _curry3(_checkForMethod('slice', function slice(fromIndex, toIndex, list) {\n        return Array.prototype.slice.call(list, fromIndex, toIndex);\n    }));\n\n    /**\n     * Returns a copy of the list, sorted according to the comparator function,\n     * which should accept two values at a time and return a negative number if the\n     * first value is smaller, a positive number if it's larger, and zero if they\n     * are equal. Please note that this is a **copy** of the list. It does not\n     * modify the original.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a,a -> Number) -> [a] -> [a]\n     * @param {Function} comparator A sorting function :: a -> b -> Int\n     * @param {Array} list The list to sort\n     * @return {Array} a new array with its elements sorted by the comparator function.\n     * @example\n     *\n     *      var diff = function(a, b) { return a - b; };\n     *      R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7]\n     */\n    var sort = _curry2(function sort(comparator, list) {\n        return _slice(list).sort(comparator);\n    });\n\n    /**\n     * Sorts the list according to the supplied function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig Ord b => (a -> b) -> [a] -> [a]\n     * @param {Function} fn\n     * @param {Array} list The list to sort.\n     * @return {Array} A new list sorted by the keys generated by `fn`.\n     * @example\n     *\n     *      var sortByFirstItem = R.sortBy(R.prop(0));\n     *      var sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name')));\n     *      var pairs = [[-1, 1], [-2, 2], [-3, 3]];\n     *      sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]]\n     *      var alice = {\n     *        name: 'ALICE',\n     *        age: 101\n     *      };\n     *      var bob = {\n     *        name: 'Bob',\n     *        age: -10\n     *      };\n     *      var clara = {\n     *        name: 'clara',\n     *        age: 314.159\n     *      };\n     *      var people = [clara, bob, alice];\n     *      sortByNameCaseInsensitive(people); //=> [alice, bob, clara]\n     */\n    var sortBy = _curry2(function sortBy(fn, list) {\n        return _slice(list).sort(function (a, b) {\n            var aa = fn(a);\n            var bb = fn(b);\n            return aa < bb ? -1 : aa > bb ? 1 : 0;\n        });\n    });\n\n    /**\n     * Splits a given list or string at a given index.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category List\n     * @sig Number -> [a] -> [[a], [a]]\n     * @sig Number -> String -> [String, String]\n     * @param {Number} index The index where the array/string is split.\n     * @param {Array|String} array The array/string to be split.\n     * @return {Array}\n     * @example\n     *\n     *      R.splitAt(1, [1, 2, 3]);          //=> [[1], [2, 3]]\n     *      R.splitAt(5, 'hello world');      //=> ['hello', ' world']\n     *      R.splitAt(-1, 'foobar');          //=> ['fooba', 'r']\n     */\n    var splitAt = _curry2(function splitAt(index, array) {\n        return [\n            slice(0, index, array),\n            slice(index, length(array), array)\n        ];\n    });\n\n    /**\n     * Splits a collection into slices of the specified length.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category List\n     * @sig Number -> [a] -> [[a]]\n     * @sig Number -> String -> [String]\n     * @param {Number} n\n     * @param {Array} list\n     * @return {Array}\n     * @example\n     *\n     *      R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]]\n     *      R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz']\n     */\n    var splitEvery = _curry2(function splitEvery(n, list) {\n        if (n <= 0) {\n            throw new Error('First argument to splitEvery must be a positive integer');\n        }\n        var result = [];\n        var idx = 0;\n        while (idx < list.length) {\n            result.push(slice(idx, idx += n, list));\n        }\n        return result;\n    });\n\n    /**\n     * Takes a list and a predicate and returns a pair of lists with the following properties:\n     *\n     *  - the result of concatenating the two output lists is equivalent to the input list;\n     *  - none of the elements of the first output list satisfies the predicate; and\n     *  - if the second output list is non-empty, its first element satisfies the predicate.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> [[a], [a]]\n     * @param {Function} pred The predicate that determines where the array is split.\n     * @param {Array} list The array to be split.\n     * @return {Array}\n     * @example\n     *\n     *      R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]);   //=> [[1], [2, 3, 1, 2, 3]]\n     */\n    var splitWhen = _curry2(function splitWhen(pred, list) {\n        var idx = 0;\n        var len = list.length;\n        var prefix = [];\n        while (idx < len && !pred(list[idx])) {\n            prefix.push(list[idx]);\n            idx += 1;\n        }\n        return [\n            prefix,\n            _slice(list, idx)\n        ];\n    });\n\n    /**\n     * Subtracts its second argument from its first argument.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Math\n     * @sig Number -> Number -> Number\n     * @param {Number} a The first value.\n     * @param {Number} b The second value.\n     * @return {Number} The result of `a - b`.\n     * @see R.add\n     * @example\n     *\n     *      R.subtract(10, 8); //=> 2\n     *\n     *      var minus5 = R.subtract(R.__, 5);\n     *      minus5(17); //=> 12\n     *\n     *      var complementaryAngle = R.subtract(90);\n     *      complementaryAngle(30); //=> 60\n     *      complementaryAngle(72); //=> 18\n     */\n    var subtract = _curry2(function subtract(a, b) {\n        return Number(a) - Number(b);\n    });\n\n    /**\n     * Returns all but the first element of the given list or string (or object\n     * with a `tail` method).\n     *\n     * Dispatches to the `slice` method of the first argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> [a]\n     * @sig String -> String\n     * @param {*} list\n     * @return {*}\n     * @see R.head, R.init, R.last\n     * @example\n     *\n     *      R.tail([1, 2, 3]);  //=> [2, 3]\n     *      R.tail([1, 2]);     //=> [2]\n     *      R.tail([1]);        //=> []\n     *      R.tail([]);         //=> []\n     *\n     *      R.tail('abc');  //=> 'bc'\n     *      R.tail('ab');   //=> 'b'\n     *      R.tail('a');    //=> ''\n     *      R.tail('');     //=> ''\n     */\n    var tail = _checkForMethod('tail', slice(1, Infinity));\n\n    /**\n     * Returns the first `n` elements of the given list, string, or\n     * transducer/transformer (or object with a `take` method).\n     *\n     * Dispatches to the `take` method of the second argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig Number -> [a] -> [a]\n     * @sig Number -> String -> String\n     * @param {Number} n\n     * @param {*} list\n     * @return {*}\n     * @see R.drop\n     * @example\n     *\n     *      R.take(1, ['foo', 'bar', 'baz']); //=> ['foo']\n     *      R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']\n     *      R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']\n     *      R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']\n     *      R.take(3, 'ramda');               //=> 'ram'\n     *\n     *      var personnel = [\n     *        'Dave Brubeck',\n     *        'Paul Desmond',\n     *        'Eugene Wright',\n     *        'Joe Morello',\n     *        'Gerry Mulligan',\n     *        'Bob Bates',\n     *        'Joe Dodge',\n     *        'Ron Crotty'\n     *      ];\n     *\n     *      var takeFive = R.take(5);\n     *      takeFive(personnel);\n     *      //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan']\n     */\n    var take = _curry2(_dispatchable('take', _xtake, function take(n, xs) {\n        return slice(0, n < 0 ? Infinity : n, xs);\n    }));\n\n    /**\n     * Returns a new list containing the last `n` elements of a given list, passing\n     * each value to the supplied predicate function, and terminating when the\n     * predicate function returns `false`. Excludes the element that caused the\n     * predicate function to fail. The predicate function is passed one argument:\n     * *(value)*.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> [a]\n     * @param {Function} fn The function called per iteration.\n     * @param {Array} list The collection to iterate over.\n     * @return {Array} A new array.\n     * @see R.dropLastWhile, R.addIndex\n     * @example\n     *\n     *      var isNotOne = x => x !== 1;\n     *\n     *      R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4]\n     */\n    var takeLastWhile = _curry2(function takeLastWhile(fn, list) {\n        var idx = list.length - 1;\n        while (idx >= 0 && fn(list[idx])) {\n            idx -= 1;\n        }\n        return _slice(list, idx + 1, Infinity);\n    });\n\n    /**\n     * Returns a new list containing the first `n` elements of a given list,\n     * passing each value to the supplied predicate function, and terminating when\n     * the predicate function returns `false`. Excludes the element that caused the\n     * predicate function to fail. The predicate function is passed one argument:\n     * *(value)*.\n     *\n     * Dispatches to the `takeWhile` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> [a]\n     * @param {Function} fn The function called per iteration.\n     * @param {Array} list The collection to iterate over.\n     * @return {Array} A new array.\n     * @see R.dropWhile, R.transduce, R.addIndex\n     * @example\n     *\n     *      var isNotFour = x => x !== 4;\n     *\n     *      R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3]\n     */\n    var takeWhile = _curry2(_dispatchable('takeWhile', _xtakeWhile, function takeWhile(fn, list) {\n        var idx = 0;\n        var len = list.length;\n        while (idx < len && fn(list[idx])) {\n            idx += 1;\n        }\n        return _slice(list, 0, idx);\n    }));\n\n    /**\n     * Runs the given function with the supplied object, then returns the object.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (a -> *) -> a -> a\n     * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away.\n     * @param {*} x\n     * @return {*} `x`.\n     * @example\n     *\n     *      var sayX = x => console.log('x is ' + x);\n     *      R.tap(sayX, 100); //=> 100\n     *      //-> 'x is 100'\n     */\n    var tap = _curry2(function tap(fn, x) {\n        fn(x);\n        return x;\n    });\n\n    /**\n     * Calls an input function `n` times, returning an array containing the results\n     * of those function calls.\n     *\n     * `fn` is passed one argument: The current value of `n`, which begins at `0`\n     * and is gradually incremented to `n - 1`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.3\n     * @category List\n     * @sig (Number -> a) -> Number -> [a]\n     * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`.\n     * @param {Number} n A value between `0` and `n - 1`. Increments after each function call.\n     * @return {Array} An array containing the return values of all calls to `fn`.\n     * @example\n     *\n     *      R.times(R.identity, 5); //=> [0, 1, 2, 3, 4]\n     */\n    var times = _curry2(function times(fn, n) {\n        var len = Number(n);\n        var idx = 0;\n        var list;\n        if (len < 0 || isNaN(len)) {\n            throw new RangeError('n must be a non-negative number');\n        }\n        list = new Array(len);\n        while (idx < len) {\n            list[idx] = fn(idx);\n            idx += 1;\n        }\n        return list;\n    });\n\n    /**\n     * Converts an object into an array of key, value arrays. Only the object's\n     * own properties are used.\n     * Note that the order of the output array is not guaranteed to be consistent\n     * across different JS platforms.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.4.0\n     * @category Object\n     * @sig {String: *} -> [[String,*]]\n     * @param {Object} obj The object to extract from\n     * @return {Array} An array of key, value arrays from the object's own properties.\n     * @see R.fromPairs\n     * @example\n     *\n     *      R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]]\n     */\n    var toPairs = _curry1(function toPairs(obj) {\n        var pairs = [];\n        for (var prop in obj) {\n            if (_has(prop, obj)) {\n                pairs[pairs.length] = [\n                    prop,\n                    obj[prop]\n                ];\n            }\n        }\n        return pairs;\n    });\n\n    /**\n     * Converts an object into an array of key, value arrays. The object's own\n     * properties and prototype properties are used. Note that the order of the\n     * output array is not guaranteed to be consistent across different JS\n     * platforms.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.4.0\n     * @category Object\n     * @sig {String: *} -> [[String,*]]\n     * @param {Object} obj The object to extract from\n     * @return {Array} An array of key, value arrays from the object's own\n     *         and prototype properties.\n     * @example\n     *\n     *      var F = function() { this.x = 'X'; };\n     *      F.prototype.y = 'Y';\n     *      var f = new F();\n     *      R.toPairsIn(f); //=> [['x','X'], ['y','Y']]\n     */\n    var toPairsIn = _curry1(function toPairsIn(obj) {\n        var pairs = [];\n        for (var prop in obj) {\n            pairs[pairs.length] = [\n                prop,\n                obj[prop]\n            ];\n        }\n        return pairs;\n    });\n\n    /**\n     * Transposes the rows and columns of a 2D list.\n     * When passed a list of `n` lists of length `x`,\n     * returns a list of `x` lists of length `n`.\n     *\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category List\n     * @sig [[a]] -> [[a]]\n     * @param {Array} list A 2D list\n     * @return {Array} A 2D list\n     * @example\n     *\n     *      R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']]\n     *      R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']]\n     *\n     * If some of the rows are shorter than the following rows, their elements are skipped:\n     *\n     *      R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]]\n     */\n    var transpose = _curry1(function transpose(outerlist) {\n        var i = 0;\n        var result = [];\n        while (i < outerlist.length) {\n            var innerlist = outerlist[i];\n            var j = 0;\n            while (j < innerlist.length) {\n                if (typeof result[j] === 'undefined') {\n                    result[j] = [];\n                }\n                result[j].push(innerlist[j]);\n                j += 1;\n            }\n            i += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Removes (strips) whitespace from both ends of the string.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.6.0\n     * @category String\n     * @sig String -> String\n     * @param {String} str The string to trim.\n     * @return {String} Trimmed version of `str`.\n     * @example\n     *\n     *      R.trim('   xyz  '); //=> 'xyz'\n     *      R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z']\n     */\n    var trim = function () {\n        var ws = '\\t\\n\\x0B\\f\\r \\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003' + '\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028' + '\\u2029\\uFEFF';\n        var zeroWidth = '\\u200B';\n        var hasProtoTrim = typeof String.prototype.trim === 'function';\n        if (!hasProtoTrim || (ws.trim() || !zeroWidth.trim())) {\n            return _curry1(function trim(str) {\n                var beginRx = new RegExp('^[' + ws + '][' + ws + ']*');\n                var endRx = new RegExp('[' + ws + '][' + ws + ']*$');\n                return str.replace(beginRx, '').replace(endRx, '');\n            });\n        } else {\n            return _curry1(function trim(str) {\n                return str.trim();\n            });\n        }\n    }();\n\n    /**\n     * `tryCatch` takes two functions, a `tryer` and a `catcher`. The returned\n     * function evaluates the `tryer`; if it does not throw, it simply returns the\n     * result. If the `tryer` *does* throw, the returned function evaluates the\n     * `catcher` function and returns its result. Note that for effective\n     * composition with this function, both the `tryer` and `catcher` functions\n     * must return the same type of results.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.20.0\n     * @category Function\n     * @sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a)\n     * @param {Function} tryer The function that may throw.\n     * @param {Function} catcher The function that will be evaluated if `tryer` throws.\n     * @return {Function} A new function that will catch exceptions and send then to the catcher.\n     * @example\n     *\n     *      R.tryCatch(R.prop('x'), R.F, {x: true}); //=> true\n     *      R.tryCatch(R.prop('x'), R.F, null);      //=> false\n     */\n    var tryCatch = _curry2(function _tryCatch(tryer, catcher) {\n        return _arity(tryer.length, function () {\n            try {\n                return tryer.apply(this, arguments);\n            } catch (e) {\n                return catcher.apply(this, _concat([e], arguments));\n            }\n        });\n    });\n\n    /**\n     * Gives a single-word string description of the (native) type of a value,\n     * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not\n     * attempt to distinguish user Object types any further, reporting them all as\n     * 'Object'.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Type\n     * @sig (* -> {*}) -> String\n     * @param {*} val The value to test\n     * @return {String}\n     * @example\n     *\n     *      R.type({}); //=> \"Object\"\n     *      R.type(1); //=> \"Number\"\n     *      R.type(false); //=> \"Boolean\"\n     *      R.type('s'); //=> \"String\"\n     *      R.type(null); //=> \"Null\"\n     *      R.type([]); //=> \"Array\"\n     *      R.type(/[A-z]/); //=> \"RegExp\"\n     */\n    var type = _curry1(function type(val) {\n        return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);\n    });\n\n    /**\n     * Takes a function `fn`, which takes a single array argument, and returns a\n     * function which:\n     *\n     *   - takes any number of positional arguments;\n     *   - passes these arguments to `fn` as an array; and\n     *   - returns the result.\n     *\n     * In other words, R.unapply derives a variadic function from a function which\n     * takes an array. R.unapply is the inverse of R.apply.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Function\n     * @sig ([*...] -> a) -> (*... -> a)\n     * @param {Function} fn\n     * @return {Function}\n     * @see R.apply\n     * @example\n     *\n     *      R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]'\n     */\n    var unapply = _curry1(function unapply(fn) {\n        return function () {\n            return fn(_slice(arguments));\n        };\n    });\n\n    /**\n     * Wraps a function of any arity (including nullary) in a function that accepts\n     * exactly 1 parameter. Any extraneous parameters will not be passed to the\n     * supplied function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.0\n     * @category Function\n     * @sig (* -> b) -> (a -> b)\n     * @param {Function} fn The function to wrap.\n     * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of\n     *         arity 1.\n     * @example\n     *\n     *      var takesTwoArgs = function(a, b) {\n     *        return [a, b];\n     *      };\n     *      takesTwoArgs.length; //=> 2\n     *      takesTwoArgs(1, 2); //=> [1, 2]\n     *\n     *      var takesOneArg = R.unary(takesTwoArgs);\n     *      takesOneArg.length; //=> 1\n     *      // Only 1 argument is passed to the wrapped function\n     *      takesOneArg(1, 2); //=> [1, undefined]\n     */\n    var unary = _curry1(function unary(fn) {\n        return nAry(1, fn);\n    });\n\n    /**\n     * Returns a function of arity `n` from a (manually) curried function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category Function\n     * @sig Number -> (a -> b) -> (a -> c)\n     * @param {Number} length The arity for the returned function.\n     * @param {Function} fn The function to uncurry.\n     * @return {Function} A new function.\n     * @see R.curry\n     * @example\n     *\n     *      var addFour = a => b => c => d => a + b + c + d;\n     *\n     *      var uncurriedAddFour = R.uncurryN(4, addFour);\n     *      uncurriedAddFour(1, 2, 3, 4); //=> 10\n     */\n    var uncurryN = _curry2(function uncurryN(depth, fn) {\n        return curryN(depth, function () {\n            var currentDepth = 1;\n            var value = fn;\n            var idx = 0;\n            var endIdx;\n            while (currentDepth <= depth && typeof value === 'function') {\n                endIdx = currentDepth === depth ? arguments.length : idx + value.length;\n                value = value.apply(this, _slice(arguments, idx, endIdx));\n                currentDepth += 1;\n                idx = endIdx;\n            }\n            return value;\n        });\n    });\n\n    /**\n     * Builds a list from a seed value. Accepts an iterator function, which returns\n     * either false to stop iteration or an array of length 2 containing the value\n     * to add to the resulting list and the seed to be used in the next call to the\n     * iterator function.\n     *\n     * The iterator function receives one argument: *(seed)*.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category List\n     * @sig (a -> [b]) -> * -> [b]\n     * @param {Function} fn The iterator function. receives one argument, `seed`, and returns\n     *        either false to quit iteration or an array of length two to proceed. The element\n     *        at index 0 of this array will be added to the resulting array, and the element\n     *        at index 1 will be passed to the next call to `fn`.\n     * @param {*} seed The seed value.\n     * @return {Array} The final list.\n     * @example\n     *\n     *      var f = n => n > 50 ? false : [-n, n + 10];\n     *      R.unfold(f, 10); //=> [-10, -20, -30, -40, -50]\n     */\n    var unfold = _curry2(function unfold(fn, seed) {\n        var pair = fn(seed);\n        var result = [];\n        while (pair && pair.length) {\n            result[result.length] = pair[0];\n            pair = fn(pair[1]);\n        }\n        return result;\n    });\n\n    /**\n     * Returns a new list containing only one copy of each element in the original\n     * list, based upon the value returned by applying the supplied predicate to\n     * two list elements. Prefers the first item if two items compare equal based\n     * on the predicate.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.0\n     * @category List\n     * @sig (a, a -> Boolean) -> [a] -> [a]\n     * @param {Function} pred A predicate used to test whether two items are equal.\n     * @param {Array} list The array to consider.\n     * @return {Array} The list of unique items.\n     * @example\n     *\n     *      var strEq = R.eqBy(String);\n     *      R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2]\n     *      R.uniqWith(strEq)([{}, {}]);       //=> [{}]\n     *      R.uniqWith(strEq)([1, '1', 1]);    //=> [1]\n     *      R.uniqWith(strEq)(['1', 1, 1]);    //=> ['1']\n     */\n    var uniqWith = _curry2(function uniqWith(pred, list) {\n        var idx = 0;\n        var len = list.length;\n        var result = [];\n        var item;\n        while (idx < len) {\n            item = list[idx];\n            if (!_containsWith(pred, item, result)) {\n                result[result.length] = item;\n            }\n            idx += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Tests the final argument by passing it to the given predicate function. If\n     * the predicate is not satisfied, the function will return the result of\n     * calling the `whenFalseFn` function with the same argument. If the predicate\n     * is satisfied, the argument is returned as is.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.18.0\n     * @category Logic\n     * @sig (a -> Boolean) -> (a -> a) -> a -> a\n     * @param {Function} pred        A predicate function\n     * @param {Function} whenFalseFn A function to invoke when the `pred` evaluates\n     *                               to a falsy value.\n     * @param {*}        x           An object to test with the `pred` function and\n     *                               pass to `whenFalseFn` if necessary.\n     * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`.\n     * @see R.ifElse, R.when\n     * @example\n     *\n     *      // coerceArray :: (a|[a]) -> [a]\n     *      var coerceArray = R.unless(R.isArrayLike, R.of);\n     *      coerceArray([1, 2, 3]); //=> [1, 2, 3]\n     *      coerceArray(1);         //=> [1]\n     */\n    var unless = _curry3(function unless(pred, whenFalseFn, x) {\n        return pred(x) ? x : whenFalseFn(x);\n    });\n\n    /**\n     * Takes a predicate, a transformation function, and an initial value,\n     * and returns a value of the same type as the initial value.\n     * It does so by applying the transformation until the predicate is satisfied,\n     * at which point it returns the satisfactory value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.20.0\n     * @category Logic\n     * @sig (a -> Boolean) -> (a -> a) -> a -> a\n     * @param {Function} pred A predicate function\n     * @param {Function} fn The iterator function\n     * @param {*} init Initial value\n     * @return {*} Final value that satisfies predicate\n     * @example\n     *\n     *      R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128\n     */\n    var until = _curry3(function until(pred, fn, init) {\n        var val = init;\n        while (!pred(val)) {\n            val = fn(val);\n        }\n        return val;\n    });\n\n    /**\n     * Returns a new copy of the array with the element at the provided index\n     * replaced with the given value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category List\n     * @sig Number -> a -> [a] -> [a]\n     * @param {Number} idx The index to update.\n     * @param {*} x The value to exist at the given index of the returned array.\n     * @param {Array|Arguments} list The source array-like object to be updated.\n     * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`.\n     * @see R.adjust\n     * @example\n     *\n     *      R.update(1, 11, [0, 1, 2]);     //=> [0, 11, 2]\n     *      R.update(1)(11)([0, 1, 2]);     //=> [0, 11, 2]\n     */\n    var update = _curry3(function update(idx, x, list) {\n        return adjust(always(x), idx, list);\n    });\n\n    /**\n     * Accepts a function `fn` and a list of transformer functions and returns a\n     * new curried function. When the new function is invoked, it calls the\n     * function `fn` with parameters consisting of the result of calling each\n     * supplied handler on successive arguments to the new function.\n     *\n     * If more arguments are passed to the returned function than transformer\n     * functions, those arguments are passed directly to `fn` as additional\n     * parameters. If you expect additional arguments that don't need to be\n     * transformed, although you can ignore them, it's best to pass an identity\n     * function so that the new function reports the correct arity.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (x1 -> x2 -> ... -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z)\n     * @param {Function} fn The function to wrap.\n     * @param {Array} transformers A list of transformer functions\n     * @return {Function} The wrapped function.\n     * @example\n     *\n     *      R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81\n     *      R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81\n     *      R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32\n     *      R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32\n     */\n    var useWith = _curry2(function useWith(fn, transformers) {\n        return curryN(transformers.length, function () {\n            var args = [];\n            var idx = 0;\n            while (idx < transformers.length) {\n                args.push(transformers[idx].call(this, arguments[idx]));\n                idx += 1;\n            }\n            return fn.apply(this, args.concat(_slice(arguments, transformers.length)));\n        });\n    });\n\n    /**\n     * Returns a list of all the enumerable own properties of the supplied object.\n     * Note that the order of the output array is not guaranteed across different\n     * JS platforms.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig {k: v} -> [v]\n     * @param {Object} obj The object to extract values from\n     * @return {Array} An array of the values of the object's own properties.\n     * @example\n     *\n     *      R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3]\n     */\n    var values = _curry1(function values(obj) {\n        var props = keys(obj);\n        var len = props.length;\n        var vals = [];\n        var idx = 0;\n        while (idx < len) {\n            vals[idx] = obj[props[idx]];\n            idx += 1;\n        }\n        return vals;\n    });\n\n    /**\n     * Returns a list of all the properties, including prototype properties, of the\n     * supplied object.\n     * Note that the order of the output array is not guaranteed to be consistent\n     * across different JS platforms.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.0\n     * @category Object\n     * @sig {k: v} -> [v]\n     * @param {Object} obj The object to extract values from\n     * @return {Array} An array of the values of the object's own and prototype properties.\n     * @example\n     *\n     *      var F = function() { this.x = 'X'; };\n     *      F.prototype.y = 'Y';\n     *      var f = new F();\n     *      R.valuesIn(f); //=> ['X', 'Y']\n     */\n    var valuesIn = _curry1(function valuesIn(obj) {\n        var prop;\n        var vs = [];\n        for (prop in obj) {\n            vs[vs.length] = obj[prop];\n        }\n        return vs;\n    });\n\n    /**\n     * Returns a \"view\" of the given data structure, determined by the given lens.\n     * The lens's focus determines which portion of the data structure is visible.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category Object\n     * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s\n     * @sig Lens s a -> s -> a\n     * @param {Lens} lens\n     * @param {*} x\n     * @return {*}\n     * @see R.prop, R.lensIndex, R.lensProp\n     * @example\n     *\n     *      var xLens = R.lensProp('x');\n     *\n     *      R.view(xLens, {x: 1, y: 2});  //=> 1\n     *      R.view(xLens, {x: 4, y: 2});  //=> 4\n     */\n    // `Const` is a functor that effectively ignores the function given to `map`.\n    // Using `Const` effectively ignores the setter function of the `lens`,\n    // leaving the value returned by the getter function unmodified.\n    var view = function () {\n        // `Const` is a functor that effectively ignores the function given to `map`.\n        var Const = function (x) {\n            return {\n                value: x,\n                map: function () {\n                    return this;\n                }\n            };\n        };\n        return _curry2(function view(lens, x) {\n            // Using `Const` effectively ignores the setter function of the `lens`,\n            // leaving the value returned by the getter function unmodified.\n            return lens(Const)(x).value;\n        });\n    }();\n\n    /**\n     * Tests the final argument by passing it to the given predicate function. If\n     * the predicate is satisfied, the function will return the result of calling\n     * the `whenTrueFn` function with the same argument. If the predicate is not\n     * satisfied, the argument is returned as is.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.18.0\n     * @category Logic\n     * @sig (a -> Boolean) -> (a -> a) -> a -> a\n     * @param {Function} pred       A predicate function\n     * @param {Function} whenTrueFn A function to invoke when the `condition`\n     *                              evaluates to a truthy value.\n     * @param {*}        x          An object to test with the `pred` function and\n     *                              pass to `whenTrueFn` if necessary.\n     * @return {*} Either `x` or the result of applying `x` to `whenTrueFn`.\n     * @see R.ifElse, R.unless\n     * @example\n     *\n     *      // truncate :: String -> String\n     *      var truncate = R.when(\n     *        R.propSatisfies(R.gt(R.__, 10), 'length'),\n     *        R.pipe(R.take(10), R.append('…'), R.join(''))\n     *      );\n     *      truncate('12345');         //=> '12345'\n     *      truncate('0123456789ABC'); //=> '0123456789…'\n     */\n    var when = _curry3(function when(pred, whenTrueFn, x) {\n        return pred(x) ? whenTrueFn(x) : x;\n    });\n\n    /**\n     * Takes a spec object and a test object; returns true if the test satisfies\n     * the spec. Each of the spec's own properties must be a predicate function.\n     * Each predicate is applied to the value of the corresponding property of the\n     * test object. `where` returns true if all the predicates return true, false\n     * otherwise.\n     *\n     * `where` is well suited to declaratively expressing constraints for other\n     * functions such as `filter` and `find`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.1\n     * @category Object\n     * @sig {String: (* -> Boolean)} -> {String: *} -> Boolean\n     * @param {Object} spec\n     * @param {Object} testObj\n     * @return {Boolean}\n     * @example\n     *\n     *      // pred :: Object -> Boolean\n     *      var pred = R.where({\n     *        a: R.equals('foo'),\n     *        b: R.complement(R.equals('bar')),\n     *        x: R.gt(_, 10),\n     *        y: R.lt(_, 20)\n     *      });\n     *\n     *      pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true\n     *      pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false\n     *      pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false\n     *      pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false\n     *      pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false\n     */\n    var where = _curry2(function where(spec, testObj) {\n        for (var prop in spec) {\n            if (_has(prop, spec) && !spec[prop](testObj[prop])) {\n                return false;\n            }\n        }\n        return true;\n    });\n\n    /**\n     * Wrap a function inside another to allow you to make adjustments to the\n     * parameters, or do other processing either before the internal function is\n     * called or with its results.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (a... -> b) -> ((a... -> b) -> a... -> c) -> (a... -> c)\n     * @param {Function} fn The function to wrap.\n     * @param {Function} wrapper The wrapper function.\n     * @return {Function} The wrapped function.\n     * @example\n     *\n     *      var greet = name => 'Hello ' + name;\n     *\n     *      var shoutedGreet = R.wrap(greet, (gr, name) => gr(name).toUpperCase());\n     *\n     *      shoutedGreet(\"Kathy\"); //=> \"HELLO KATHY\"\n     *\n     *      var shortenedGreet = R.wrap(greet, function(gr, name) {\n     *        return gr(name.substring(0, 3));\n     *      });\n     *      shortenedGreet(\"Robert\"); //=> \"Hello Rob\"\n     */\n    var wrap = _curry2(function wrap(fn, wrapper) {\n        return curryN(fn.length, function () {\n            return wrapper.apply(this, _concat([fn], arguments));\n        });\n    });\n\n    /**\n     * Creates a new list out of the two supplied by creating each possible pair\n     * from the lists.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> [b] -> [[a,b]]\n     * @param {Array} as The first list.\n     * @param {Array} bs The second list.\n     * @return {Array} The list made by combining each possible pair from\n     *         `as` and `bs` into pairs (`[a, b]`).\n     * @example\n     *\n     *      R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]\n     */\n    // = xprodWith(prepend); (takes about 3 times as long...)\n    var xprod = _curry2(function xprod(a, b) {\n        // = xprodWith(prepend); (takes about 3 times as long...)\n        var idx = 0;\n        var ilen = a.length;\n        var j;\n        var jlen = b.length;\n        var result = [];\n        while (idx < ilen) {\n            j = 0;\n            while (j < jlen) {\n                result[result.length] = [\n                    a[idx],\n                    b[j]\n                ];\n                j += 1;\n            }\n            idx += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Creates a new list out of the two supplied by pairing up equally-positioned\n     * items from both lists. The returned list is truncated to the length of the\n     * shorter of the two input lists.\n     * Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> [b] -> [[a,b]]\n     * @param {Array} list1 The first array to consider.\n     * @param {Array} list2 The second array to consider.\n     * @return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`.\n     * @example\n     *\n     *      R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']]\n     */\n    var zip = _curry2(function zip(a, b) {\n        var rv = [];\n        var idx = 0;\n        var len = Math.min(a.length, b.length);\n        while (idx < len) {\n            rv[idx] = [\n                a[idx],\n                b[idx]\n            ];\n            idx += 1;\n        }\n        return rv;\n    });\n\n    /**\n     * Creates a new object out of a list of keys and a list of values.\n     * Key/value pairing is truncated to the length of the shorter of the two lists.\n     * Note: `zipObj` is equivalent to `pipe(zipWith(pair), fromPairs)`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category List\n     * @sig [String] -> [*] -> {String: *}\n     * @param {Array} keys The array that will be properties on the output object.\n     * @param {Array} values The list of values on the output object.\n     * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`.\n     * @example\n     *\n     *      R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3}\n     */\n    var zipObj = _curry2(function zipObj(keys, values) {\n        var idx = 0;\n        var len = Math.min(keys.length, values.length);\n        var out = {};\n        while (idx < len) {\n            out[keys[idx]] = values[idx];\n            idx += 1;\n        }\n        return out;\n    });\n\n    /**\n     * Creates a new list out of the two supplied by applying the function to each\n     * equally-positioned pair in the lists. The returned list is truncated to the\n     * length of the shorter of the two input lists.\n     *\n     * @function\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a,b -> c) -> [a] -> [b] -> [c]\n     * @param {Function} fn The function used to combine the two elements into one value.\n     * @param {Array} list1 The first array to consider.\n     * @param {Array} list2 The second array to consider.\n     * @return {Array} The list made by combining same-indexed elements of `list1` and `list2`\n     *         using `fn`.\n     * @example\n     *\n     *      var f = (x, y) => {\n     *        // ...\n     *      };\n     *      R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']);\n     *      //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')]\n     */\n    var zipWith = _curry3(function zipWith(fn, a, b) {\n        var rv = [];\n        var idx = 0;\n        var len = Math.min(a.length, b.length);\n        while (idx < len) {\n            rv[idx] = fn(a[idx], b[idx]);\n            idx += 1;\n        }\n        return rv;\n    });\n\n    /**\n     * A function that always returns `false`. Any passed in parameters are ignored.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Function\n     * @sig * -> Boolean\n     * @param {*}\n     * @return {Boolean}\n     * @see R.always, R.T\n     * @example\n     *\n     *      R.F(); //=> false\n     */\n    var F = always(false);\n\n    /**\n     * A function that always returns `true`. Any passed in parameters are ignored.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Function\n     * @sig * -> Boolean\n     * @param {*}\n     * @return {Boolean}\n     * @see R.always, R.F\n     * @example\n     *\n     *      R.T(); //=> true\n     */\n    var T = always(true);\n\n    /**\n     * Copies an object.\n     *\n     * @private\n     * @param {*} value The value to be copied\n     * @param {Array} refFrom Array containing the source references\n     * @param {Array} refTo Array containing the copied source references\n     * @param {Boolean} deep Whether or not to perform deep cloning.\n     * @return {*} The copied value.\n     */\n    var _clone = function _clone(value, refFrom, refTo, deep) {\n        var copy = function copy(copiedValue) {\n            var len = refFrom.length;\n            var idx = 0;\n            while (idx < len) {\n                if (value === refFrom[idx]) {\n                    return refTo[idx];\n                }\n                idx += 1;\n            }\n            refFrom[idx + 1] = value;\n            refTo[idx + 1] = copiedValue;\n            for (var key in value) {\n                copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key];\n            }\n            return copiedValue;\n        };\n        switch (type(value)) {\n        case 'Object':\n            return copy({});\n        case 'Array':\n            return copy([]);\n        case 'Date':\n            return new Date(value.valueOf());\n        case 'RegExp':\n            return _cloneRegExp(value);\n        default:\n            return value;\n        }\n    };\n\n    var _createPartialApplicator = function _createPartialApplicator(concat) {\n        return _curry2(function (fn, args) {\n            return _arity(Math.max(0, fn.length - args.length), function () {\n                return fn.apply(this, concat(args, arguments));\n            });\n        });\n    };\n\n    var _dropLast = function dropLast(n, xs) {\n        return take(n < xs.length ? xs.length - n : 0, xs);\n    };\n\n    // Values of other types are only equal if identical.\n    var _equals = function _equals(a, b, stackA, stackB) {\n        if (identical(a, b)) {\n            return true;\n        }\n        if (type(a) !== type(b)) {\n            return false;\n        }\n        if (a == null || b == null) {\n            return false;\n        }\n        if (typeof a.equals === 'function' || typeof b.equals === 'function') {\n            return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);\n        }\n        switch (type(a)) {\n        case 'Arguments':\n        case 'Array':\n        case 'Object':\n            if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {\n                return a === b;\n            }\n            break;\n        case 'Boolean':\n        case 'Number':\n        case 'String':\n            if (!(typeof a === typeof b && identical(a.valueOf(), b.valueOf()))) {\n                return false;\n            }\n            break;\n        case 'Date':\n            if (!identical(a.valueOf(), b.valueOf())) {\n                return false;\n            }\n            break;\n        case 'Error':\n            return a.name === b.name && a.message === b.message;\n        case 'RegExp':\n            if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {\n                return false;\n            }\n            break;\n        case 'Map':\n        case 'Set':\n            if (!_equals(_arrayFromIterator(a.entries()), _arrayFromIterator(b.entries()), stackA, stackB)) {\n                return false;\n            }\n            break;\n        case 'Int8Array':\n        case 'Uint8Array':\n        case 'Uint8ClampedArray':\n        case 'Int16Array':\n        case 'Uint16Array':\n        case 'Int32Array':\n        case 'Uint32Array':\n        case 'Float32Array':\n        case 'Float64Array':\n            break;\n        case 'ArrayBuffer':\n            break;\n        default:\n            // Values of other types are only equal if identical.\n            return false;\n        }\n        var keysA = keys(a);\n        if (keysA.length !== keys(b).length) {\n            return false;\n        }\n        var idx = stackA.length - 1;\n        while (idx >= 0) {\n            if (stackA[idx] === a) {\n                return stackB[idx] === b;\n            }\n            idx -= 1;\n        }\n        stackA.push(a);\n        stackB.push(b);\n        idx = keysA.length - 1;\n        while (idx >= 0) {\n            var key = keysA[idx];\n            if (!(_has(key, b) && _equals(b[key], a[key], stackA, stackB))) {\n                return false;\n            }\n            idx -= 1;\n        }\n        stackA.pop();\n        stackB.pop();\n        return true;\n    };\n\n    /**\n     * `_makeFlat` is a helper function that returns a one-level or fully recursive\n     * function based on the flag passed in.\n     *\n     * @private\n     */\n    var _makeFlat = function _makeFlat(recursive) {\n        return function flatt(list) {\n            var value, jlen, j;\n            var result = [];\n            var idx = 0;\n            var ilen = list.length;\n            while (idx < ilen) {\n                if (isArrayLike(list[idx])) {\n                    value = recursive ? flatt(list[idx]) : list[idx];\n                    j = 0;\n                    jlen = value.length;\n                    while (j < jlen) {\n                        result[result.length] = value[j];\n                        j += 1;\n                    }\n                } else {\n                    result[result.length] = list[idx];\n                }\n                idx += 1;\n            }\n            return result;\n        };\n    };\n\n    var _reduce = function () {\n        function _arrayReduce(xf, acc, list) {\n            var idx = 0;\n            var len = list.length;\n            while (idx < len) {\n                acc = xf['@@transducer/step'](acc, list[idx]);\n                if (acc && acc['@@transducer/reduced']) {\n                    acc = acc['@@transducer/value'];\n                    break;\n                }\n                idx += 1;\n            }\n            return xf['@@transducer/result'](acc);\n        }\n        function _iterableReduce(xf, acc, iter) {\n            var step = iter.next();\n            while (!step.done) {\n                acc = xf['@@transducer/step'](acc, step.value);\n                if (acc && acc['@@transducer/reduced']) {\n                    acc = acc['@@transducer/value'];\n                    break;\n                }\n                step = iter.next();\n            }\n            return xf['@@transducer/result'](acc);\n        }\n        function _methodReduce(xf, acc, obj) {\n            return xf['@@transducer/result'](obj.reduce(bind(xf['@@transducer/step'], xf), acc));\n        }\n        var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';\n        return function _reduce(fn, acc, list) {\n            if (typeof fn === 'function') {\n                fn = _xwrap(fn);\n            }\n            if (isArrayLike(list)) {\n                return _arrayReduce(fn, acc, list);\n            }\n            if (typeof list.reduce === 'function') {\n                return _methodReduce(fn, acc, list);\n            }\n            if (list[symIterator] != null) {\n                return _iterableReduce(fn, acc, list[symIterator]());\n            }\n            if (typeof list.next === 'function') {\n                return _iterableReduce(fn, acc, list);\n            }\n            throw new TypeError('reduce: list must be array or iterable');\n        };\n    }();\n\n    var _stepCat = function () {\n        var _stepCatArray = {\n            '@@transducer/init': Array,\n            '@@transducer/step': function (xs, x) {\n                xs.push(x);\n                return xs;\n            },\n            '@@transducer/result': _identity\n        };\n        var _stepCatString = {\n            '@@transducer/init': String,\n            '@@transducer/step': function (a, b) {\n                return a + b;\n            },\n            '@@transducer/result': _identity\n        };\n        var _stepCatObject = {\n            '@@transducer/init': Object,\n            '@@transducer/step': function (result, input) {\n                return _assign(result, isArrayLike(input) ? objOf(input[0], input[1]) : input);\n            },\n            '@@transducer/result': _identity\n        };\n        return function _stepCat(obj) {\n            if (_isTransformer(obj)) {\n                return obj;\n            }\n            if (isArrayLike(obj)) {\n                return _stepCatArray;\n            }\n            if (typeof obj === 'string') {\n                return _stepCatString;\n            }\n            if (typeof obj === 'object') {\n                return _stepCatObject;\n            }\n            throw new Error('Cannot create transformer for ' + obj);\n        };\n    }();\n\n    var _xdropLastWhile = function () {\n        function XDropLastWhile(fn, xf) {\n            this.f = fn;\n            this.retained = [];\n            this.xf = xf;\n        }\n        XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init;\n        XDropLastWhile.prototype['@@transducer/result'] = function (result) {\n            this.retained = null;\n            return this.xf['@@transducer/result'](result);\n        };\n        XDropLastWhile.prototype['@@transducer/step'] = function (result, input) {\n            return this.f(input) ? this.retain(result, input) : this.flush(result, input);\n        };\n        XDropLastWhile.prototype.flush = function (result, input) {\n            result = _reduce(this.xf['@@transducer/step'], result, this.retained);\n            this.retained = [];\n            return this.xf['@@transducer/step'](result, input);\n        };\n        XDropLastWhile.prototype.retain = function (result, input) {\n            this.retained.push(input);\n            return result;\n        };\n        return _curry2(function _xdropLastWhile(fn, xf) {\n            return new XDropLastWhile(fn, xf);\n        });\n    }();\n\n    var _xgroupBy = function () {\n        function XGroupBy(f, xf) {\n            this.xf = xf;\n            this.f = f;\n            this.inputs = {};\n        }\n        XGroupBy.prototype['@@transducer/init'] = _xfBase.init;\n        XGroupBy.prototype['@@transducer/result'] = function (result) {\n            var key;\n            for (key in this.inputs) {\n                if (_has(key, this.inputs)) {\n                    result = this.xf['@@transducer/step'](result, this.inputs[key]);\n                    if (result['@@transducer/reduced']) {\n                        result = result['@@transducer/value'];\n                        break;\n                    }\n                }\n            }\n            this.inputs = null;\n            return this.xf['@@transducer/result'](result);\n        };\n        XGroupBy.prototype['@@transducer/step'] = function (result, input) {\n            var key = this.f(input);\n            this.inputs[key] = this.inputs[key] || [\n                key,\n                []\n            ];\n            this.inputs[key][1] = append(input, this.inputs[key][1]);\n            return result;\n        };\n        return _curry2(function _xgroupBy(f, xf) {\n            return new XGroupBy(f, xf);\n        });\n    }();\n\n    /**\n     * Creates a new list iteration function from an existing one by adding two new\n     * parameters to its callback function: the current index, and the entire list.\n     *\n     * This would turn, for instance, Ramda's simple `map` function into one that\n     * more closely resembles `Array.prototype.map`. Note that this will only work\n     * for functions in which the iteration callback function is the first\n     * parameter, and where the list is the last parameter. (This latter might be\n     * unimportant if the list parameter is not used.)\n     *\n     * @func\n     * @memberOf R\n     * @since v0.15.0\n     * @category Function\n     * @category List\n     * @sig ((a ... -> b) ... -> [a] -> *) -> (a ..., Int, [a] -> b) ... -> [a] -> *)\n     * @param {Function} fn A list iteration function that does not pass index or list to its callback\n     * @return {Function} An altered list iteration function that passes (item, index, list) to its callback\n     * @example\n     *\n     *      var mapIndexed = R.addIndex(R.map);\n     *      mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']);\n     *      //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r']\n     */\n    var addIndex = _curry1(function addIndex(fn) {\n        return curryN(fn.length, function () {\n            var idx = 0;\n            var origFn = arguments[0];\n            var list = arguments[arguments.length - 1];\n            var args = _slice(arguments);\n            args[0] = function () {\n                var result = origFn.apply(this, _concat(arguments, [\n                    idx,\n                    list\n                ]));\n                idx += 1;\n                return result;\n            };\n            return fn.apply(this, args);\n        });\n    });\n\n    /**\n     * Wraps a function of any arity (including nullary) in a function that accepts\n     * exactly 2 parameters. Any extraneous parameters will not be passed to the\n     * supplied function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.2.0\n     * @category Function\n     * @sig (* -> c) -> (a, b -> c)\n     * @param {Function} fn The function to wrap.\n     * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of\n     *         arity 2.\n     * @example\n     *\n     *      var takesThreeArgs = function(a, b, c) {\n     *        return [a, b, c];\n     *      };\n     *      takesThreeArgs.length; //=> 3\n     *      takesThreeArgs(1, 2, 3); //=> [1, 2, 3]\n     *\n     *      var takesTwoArgs = R.binary(takesThreeArgs);\n     *      takesTwoArgs.length; //=> 2\n     *      // Only 2 arguments are passed to the wrapped function\n     *      takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]\n     */\n    var binary = _curry1(function binary(fn) {\n        return nAry(2, fn);\n    });\n\n    /**\n     * Creates a deep copy of the value which may contain (nested) `Array`s and\n     * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are not\n     * copied, but assigned by their reference.\n     *\n     * Dispatches to a `clone` method if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig {*} -> {*}\n     * @param {*} value The object or array to clone\n     * @return {*} A new object or array.\n     * @example\n     *\n     *      var objects = [{}, {}, {}];\n     *      var objectsClone = R.clone(objects);\n     *      objects[0] === objectsClone[0]; //=> false\n     */\n    var clone = _curry1(function clone(value) {\n        return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true);\n    });\n\n    /**\n     * Returns a curried equivalent of the provided function. The curried function\n     * has two unusual capabilities. First, its arguments needn't be provided one\n     * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the\n     * following are equivalent:\n     *\n     *   - `g(1)(2)(3)`\n     *   - `g(1)(2, 3)`\n     *   - `g(1, 2)(3)`\n     *   - `g(1, 2, 3)`\n     *\n     * Secondly, the special placeholder value `R.__` may be used to specify\n     * \"gaps\", allowing partial application of any combination of arguments,\n     * regardless of their positions. If `g` is as above and `_` is `R.__`, the\n     * following are equivalent:\n     *\n     *   - `g(1, 2, 3)`\n     *   - `g(_, 2, 3)(1)`\n     *   - `g(_, _, 3)(1)(2)`\n     *   - `g(_, _, 3)(1, 2)`\n     *   - `g(_, 2)(1)(3)`\n     *   - `g(_, 2)(1, 3)`\n     *   - `g(_, 2)(_, 3)(1)`\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (* -> a) -> (* -> a)\n     * @param {Function} fn The function to curry.\n     * @return {Function} A new, curried function.\n     * @see R.curryN\n     * @example\n     *\n     *      var addFourNumbers = (a, b, c, d) => a + b + c + d;\n     *\n     *      var curriedAddFourNumbers = R.curry(addFourNumbers);\n     *      var f = curriedAddFourNumbers(1, 2);\n     *      var g = f(3);\n     *      g(4); //=> 10\n     */\n    var curry = _curry1(function curry(fn) {\n        return curryN(fn.length, fn);\n    });\n\n    /**\n     * Returns all but the first `n` elements of the given list, string, or\n     * transducer/transformer (or object with a `drop` method).\n     *\n     * Dispatches to the `drop` method of the second argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig Number -> [a] -> [a]\n     * @sig Number -> String -> String\n     * @param {Number} n\n     * @param {*} list\n     * @return {*}\n     * @see R.take, R.transduce\n     * @example\n     *\n     *      R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']\n     *      R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz']\n     *      R.drop(3, ['foo', 'bar', 'baz']); //=> []\n     *      R.drop(4, ['foo', 'bar', 'baz']); //=> []\n     *      R.drop(3, 'ramda');               //=> 'da'\n     */\n    var drop = _curry2(_dispatchable('drop', _xdrop, function drop(n, xs) {\n        return slice(Math.max(0, n), Infinity, xs);\n    }));\n\n    /**\n     * Returns a list containing all but the last `n` elements of the given `list`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category List\n     * @sig Number -> [a] -> [a]\n     * @sig Number -> String -> String\n     * @param {Number} n The number of elements of `xs` to skip.\n     * @param {Array} xs The collection to consider.\n     * @return {Array}\n     * @see R.takeLast\n     * @example\n     *\n     *      R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']\n     *      R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']\n     *      R.dropLast(3, ['foo', 'bar', 'baz']); //=> []\n     *      R.dropLast(4, ['foo', 'bar', 'baz']); //=> []\n     *      R.dropLast(3, 'ramda');               //=> 'ra'\n     */\n    var dropLast = _curry2(_dispatchable('dropLast', _xdropLast, _dropLast));\n\n    /**\n     * Returns a new list containing all but last the`n` elements of a given list,\n     * passing each value from the right to the supplied predicate function,\n     * skipping elements while the predicate function returns `true`. The predicate\n     * function is passed one argument: (value)*.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category List\n     * @sig (a -> Boolean) -> [a] -> [a]\n     * @param {Function} fn The function called per iteration.\n     * @param {Array} list The collection to iterate over.\n     * @return {Array} A new array.\n     * @see R.takeLastWhile, R.addIndex\n     * @example\n     *\n     *      var lteThree = x => x <= 3;\n     *\n     *      R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]\n     */\n    var dropLastWhile = _curry2(_dispatchable('dropLastWhile', _xdropLastWhile, _dropLastWhile));\n\n    /**\n     * Returns `true` if its arguments are equivalent, `false` otherwise. Handles\n     * cyclical data structures.\n     *\n     * Dispatches symmetrically to the `equals` methods of both arguments, if\n     * present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.15.0\n     * @category Relation\n     * @sig a -> b -> Boolean\n     * @param {*} a\n     * @param {*} b\n     * @return {Boolean}\n     * @example\n     *\n     *      R.equals(1, 1); //=> true\n     *      R.equals(1, '1'); //=> false\n     *      R.equals([1, 2, 3], [1, 2, 3]); //=> true\n     *\n     *      var a = {}; a.v = a;\n     *      var b = {}; b.v = b;\n     *      R.equals(a, b); //=> true\n     */\n    var equals = _curry2(function equals(a, b) {\n        return _equals(a, b, [], []);\n    });\n\n    /**\n     * Takes a predicate and a \"filterable\", and returns a new filterable of the\n     * same type containing the members of the given filterable which satisfy the\n     * given predicate.\n     *\n     * Dispatches to the `filter` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig Filterable f => (a -> Boolean) -> f a -> f a\n     * @param {Function} pred\n     * @param {Array} filterable\n     * @return {Array}\n     * @see R.reject, R.transduce, R.addIndex\n     * @example\n     *\n     *      var isEven = n => n % 2 === 0;\n     *\n     *      R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]\n     *\n     *      R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}\n     */\n    // else\n    var filter = _curry2(_dispatchable('filter', _xfilter, function (pred, filterable) {\n        return _isObject(filterable) ? _reduce(function (acc, key) {\n            if (pred(filterable[key])) {\n                acc[key] = filterable[key];\n            }\n            return acc;\n        }, {}, keys(filterable)) : // else\n        _filter(pred, filterable);\n    }));\n\n    /**\n     * Returns a new list by pulling every item out of it (and all its sub-arrays)\n     * and putting them in a new array, depth-first.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> [b]\n     * @param {Array} list The array to consider.\n     * @return {Array} The flattened list.\n     * @see R.unnest\n     * @example\n     *\n     *      R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]);\n     *      //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n     */\n    var flatten = _curry1(_makeFlat(true));\n\n    /**\n     * Returns a new function much like the supplied one, except that the first two\n     * arguments' order is reversed.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (a -> b -> c -> ... -> z) -> (b -> a -> c -> ... -> z)\n     * @param {Function} fn The function to invoke with its first two parameters reversed.\n     * @return {*} The result of invoking `fn` with its first two parameters' order reversed.\n     * @example\n     *\n     *      var mergeThree = (a, b, c) => [].concat(a, b, c);\n     *\n     *      mergeThree(1, 2, 3); //=> [1, 2, 3]\n     *\n     *      R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3]\n     */\n    var flip = _curry1(function flip(fn) {\n        return curry(function (a, b) {\n            var args = _slice(arguments);\n            args[0] = b;\n            args[1] = a;\n            return fn.apply(this, args);\n        });\n    });\n\n    /**\n     * Returns the first element of the given list or string. In some libraries\n     * this function is named `first`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> a | Undefined\n     * @sig String -> String\n     * @param {Array|String} list\n     * @return {*}\n     * @see R.tail, R.init, R.last\n     * @example\n     *\n     *      R.head(['fi', 'fo', 'fum']); //=> 'fi'\n     *      R.head([]); //=> undefined\n     *\n     *      R.head('abc'); //=> 'a'\n     *      R.head(''); //=> ''\n     */\n    var head = nth(0);\n\n    /**\n     * Returns all but the last element of the given list or string.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category List\n     * @sig [a] -> [a]\n     * @sig String -> String\n     * @param {*} list\n     * @return {*}\n     * @see R.last, R.head, R.tail\n     * @example\n     *\n     *      R.init([1, 2, 3]);  //=> [1, 2]\n     *      R.init([1, 2]);     //=> [1]\n     *      R.init([1]);        //=> []\n     *      R.init([]);         //=> []\n     *\n     *      R.init('abc');  //=> 'ab'\n     *      R.init('ab');   //=> 'a'\n     *      R.init('a');    //=> ''\n     *      R.init('');     //=> ''\n     */\n    var init = slice(0, -1);\n\n    /**\n     * Combines two lists into a set (i.e. no duplicates) composed of those\n     * elements common to both lists. Duplication is determined according to the\n     * value returned by applying the supplied predicate to two list elements.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig (a -> a -> Boolean) -> [*] -> [*] -> [*]\n     * @param {Function} pred A predicate function that determines whether\n     *        the two supplied elements are equal.\n     * @param {Array} list1 One list of items to compare\n     * @param {Array} list2 A second list of items to compare\n     * @return {Array} A new list containing those elements common to both lists.\n     * @see R.intersection\n     * @example\n     *\n     *      var buffaloSpringfield = [\n     *        {id: 824, name: 'Richie Furay'},\n     *        {id: 956, name: 'Dewey Martin'},\n     *        {id: 313, name: 'Bruce Palmer'},\n     *        {id: 456, name: 'Stephen Stills'},\n     *        {id: 177, name: 'Neil Young'}\n     *      ];\n     *      var csny = [\n     *        {id: 204, name: 'David Crosby'},\n     *        {id: 456, name: 'Stephen Stills'},\n     *        {id: 539, name: 'Graham Nash'},\n     *        {id: 177, name: 'Neil Young'}\n     *      ];\n     *\n     *      R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny);\n     *      //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}]\n     */\n    var intersectionWith = _curry3(function intersectionWith(pred, list1, list2) {\n        var lookupList, filteredList;\n        if (list1.length > list2.length) {\n            lookupList = list1;\n            filteredList = list2;\n        } else {\n            lookupList = list2;\n            filteredList = list1;\n        }\n        var results = [];\n        var idx = 0;\n        while (idx < filteredList.length) {\n            if (_containsWith(pred, filteredList[idx], lookupList)) {\n                results[results.length] = filteredList[idx];\n            }\n            idx += 1;\n        }\n        return uniqWith(pred, results);\n    });\n\n    /**\n     * Transforms the items of the list with the transducer and appends the\n     * transformed items to the accumulator using an appropriate iterator function\n     * based on the accumulator type.\n     *\n     * The accumulator can be an array, string, object or a transformer. Iterated\n     * items will be appended to arrays and concatenated to strings. Objects will\n     * be merged directly or 2-item arrays will be merged as key, value pairs.\n     *\n     * The accumulator can also be a transformer object that provides a 2-arity\n     * reducing iterator function, step, 0-arity initial value function, init, and\n     * 1-arity result extraction function result. The step function is used as the\n     * iterator function in reduce. The result function is used to convert the\n     * final accumulator into the return type and in most cases is R.identity. The\n     * init function is used to provide the initial accumulator.\n     *\n     * The iteration is performed with R.reduce after initializing the transducer.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category List\n     * @sig a -> (b -> b) -> [c] -> a\n     * @param {*} acc The initial accumulator value.\n     * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.\n     * @param {Array} list The list to iterate over.\n     * @return {*} The final, accumulated value.\n     * @example\n     *\n     *      var numbers = [1, 2, 3, 4];\n     *      var transducer = R.compose(R.map(R.add(1)), R.take(2));\n     *\n     *      R.into([], transducer, numbers); //=> [2, 3]\n     *\n     *      var intoArray = R.into([]);\n     *      intoArray(transducer, numbers); //=> [2, 3]\n     */\n    var into = _curry3(function into(acc, xf, list) {\n        return _isTransformer(acc) ? _reduce(xf(acc), acc['@@transducer/init'](), list) : _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list);\n    });\n\n    /**\n     * Same as R.invertObj, however this accounts for objects with duplicate values\n     * by putting the values into an array.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Object\n     * @sig {s: x} -> {x: [ s, ... ]}\n     * @param {Object} obj The object or array to invert\n     * @return {Object} out A new object with keys\n     * in an array.\n     * @example\n     *\n     *      var raceResultsByFirstName = {\n     *        first: 'alice',\n     *        second: 'jake',\n     *        third: 'alice',\n     *      };\n     *      R.invert(raceResultsByFirstName);\n     *      //=> { 'alice': ['first', 'third'], 'jake':['second'] }\n     */\n    var invert = _curry1(function invert(obj) {\n        var props = keys(obj);\n        var len = props.length;\n        var idx = 0;\n        var out = {};\n        while (idx < len) {\n            var key = props[idx];\n            var val = obj[key];\n            var list = _has(val, out) ? out[val] : out[val] = [];\n            list[list.length] = key;\n            idx += 1;\n        }\n        return out;\n    });\n\n    /**\n     * Returns a new object with the keys of the given object as values, and the\n     * values of the given object, which are coerced to strings, as keys. Note\n     * that the last key found is preferred when handling the same value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Object\n     * @sig {s: x} -> {x: s}\n     * @param {Object} obj The object or array to invert\n     * @return {Object} out A new object\n     * @example\n     *\n     *      var raceResults = {\n     *        first: 'alice',\n     *        second: 'jake'\n     *      };\n     *      R.invertObj(raceResults);\n     *      //=> { 'alice': 'first', 'jake':'second' }\n     *\n     *      // Alternatively:\n     *      var raceResults = ['alice', 'jake'];\n     *      R.invertObj(raceResults);\n     *      //=> { 'alice': '0', 'jake':'1' }\n     */\n    var invertObj = _curry1(function invertObj(obj) {\n        var props = keys(obj);\n        var len = props.length;\n        var idx = 0;\n        var out = {};\n        while (idx < len) {\n            var key = props[idx];\n            out[obj[key]] = key;\n            idx += 1;\n        }\n        return out;\n    });\n\n    /**\n     * Returns `true` if the given value is its type's empty value; `false`\n     * otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Logic\n     * @sig a -> Boolean\n     * @param {*} x\n     * @return {Boolean}\n     * @see R.empty\n     * @example\n     *\n     *      R.isEmpty([1, 2, 3]);   //=> false\n     *      R.isEmpty([]);          //=> true\n     *      R.isEmpty('');          //=> true\n     *      R.isEmpty(null);        //=> false\n     *      R.isEmpty({});          //=> true\n     *      R.isEmpty({length: 0}); //=> false\n     */\n    var isEmpty = _curry1(function isEmpty(x) {\n        return x != null && equals(x, empty(x));\n    });\n\n    /**\n     * Returns the last element of the given list or string.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.4\n     * @category List\n     * @sig [a] -> a | Undefined\n     * @sig String -> String\n     * @param {*} list\n     * @return {*}\n     * @see R.init, R.head, R.tail\n     * @example\n     *\n     *      R.last(['fi', 'fo', 'fum']); //=> 'fum'\n     *      R.last([]); //=> undefined\n     *\n     *      R.last('abc'); //=> 'c'\n     *      R.last(''); //=> ''\n     */\n    var last = nth(-1);\n\n    /**\n     * Returns the position of the last occurrence of an item in an array, or -1 if\n     * the item is not included in the array. `R.equals` is used to determine\n     * equality.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig a -> [a] -> Number\n     * @param {*} target The item to find.\n     * @param {Array} xs The array to search in.\n     * @return {Number} the index of the target, or -1 if the target is not found.\n     * @see R.indexOf\n     * @example\n     *\n     *      R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6\n     *      R.lastIndexOf(10, [1,2,3,4]); //=> -1\n     */\n    var lastIndexOf = _curry2(function lastIndexOf(target, xs) {\n        if (typeof xs.lastIndexOf === 'function' && !_isArray(xs)) {\n            return xs.lastIndexOf(target);\n        } else {\n            var idx = xs.length - 1;\n            while (idx >= 0) {\n                if (equals(xs[idx], target)) {\n                    return idx;\n                }\n                idx -= 1;\n            }\n            return -1;\n        }\n    });\n\n    /**\n     * Takes a function and\n     * a [functor](https://github.com/fantasyland/fantasy-land#functor),\n     * applies the function to each of the functor's values, and returns\n     * a functor of the same shape.\n     *\n     * Ramda provides suitable `map` implementations for `Array` and `Object`,\n     * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.\n     *\n     * Dispatches to the `map` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * Also treats functions as functors and will compose them together.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig Functor f => (a -> b) -> f a -> f b\n     * @param {Function} fn The function to be called on every element of the input `list`.\n     * @param {Array} list The list to be iterated over.\n     * @return {Array} The new list.\n     * @see R.transduce, R.addIndex\n     * @example\n     *\n     *      var double = x => x * 2;\n     *\n     *      R.map(double, [1, 2, 3]); //=> [2, 4, 6]\n     *\n     *      R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}\n     */\n    var map = _curry2(_dispatchable('map', _xmap, function map(fn, functor) {\n        switch (Object.prototype.toString.call(functor)) {\n        case '[object Function]':\n            return curryN(functor.length, function () {\n                return fn.call(this, functor.apply(this, arguments));\n            });\n        case '[object Object]':\n            return _reduce(function (acc, key) {\n                acc[key] = fn(functor[key]);\n                return acc;\n            }, {}, keys(functor));\n        default:\n            return _map(fn, functor);\n        }\n    }));\n\n    /**\n     * An Object-specific version of `map`. The function is applied to three\n     * arguments: *(value, key, obj)*. If only the value is significant, use\n     * `map` instead.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Object\n     * @sig ((*, String, Object) -> *) -> Object -> Object\n     * @param {Function} fn\n     * @param {Object} obj\n     * @return {Object}\n     * @see R.map\n     * @example\n     *\n     *      var values = { x: 1, y: 2, z: 3 };\n     *      var prependKeyAndDouble = (num, key, obj) => key + (num * 2);\n     *\n     *      R.mapObjIndexed(prependKeyAndDouble, values); //=> { x: 'x2', y: 'y4', z: 'z6' }\n     */\n    var mapObjIndexed = _curry2(function mapObjIndexed(fn, obj) {\n        return _reduce(function (acc, key) {\n            acc[key] = fn(obj[key], key, obj);\n            return acc;\n        }, {}, keys(obj));\n    });\n\n    /**\n     * Creates a new object with the own properties of the two provided objects. If\n     * a key exists in both objects, the provided function is applied to the values\n     * associated with the key in each object, with the result being used as the\n     * value associated with the key in the returned object. The key will be\n     * excluded from the returned object if the resulting value is `undefined`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category Object\n     * @sig (a -> a -> a) -> {a} -> {a} -> {a}\n     * @param {Function} fn\n     * @param {Object} l\n     * @param {Object} r\n     * @return {Object}\n     * @see R.merge, R.mergeWithKey\n     * @example\n     *\n     *      R.mergeWith(R.concat,\n     *                  { a: true, values: [10, 20] },\n     *                  { b: true, values: [15, 35] });\n     *      //=> { a: true, b: true, values: [10, 20, 15, 35] }\n     */\n    var mergeWith = _curry3(function mergeWith(fn, l, r) {\n        return mergeWithKey(function (_, _l, _r) {\n            return fn(_l, _r);\n        }, l, r);\n    });\n\n    /**\n     * Takes a function `f` and a list of arguments, and returns a function `g`.\n     * When applied, `g` returns the result of applying `f` to the arguments\n     * provided initially followed by the arguments provided to `g`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category Function\n     * @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x)\n     * @param {Function} f\n     * @param {Array} args\n     * @return {Function}\n     * @see R.partialRight\n     * @example\n     *\n     *      var multiply = (a, b) => a * b;\n     *      var double = R.partial(multiply, [2]);\n     *      double(2); //=> 4\n     *\n     *      var greet = (salutation, title, firstName, lastName) =>\n     *        salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';\n     *\n     *      var sayHello = R.partial(greet, ['Hello']);\n     *      var sayHelloToMs = R.partial(sayHello, ['Ms.']);\n     *      sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!'\n     */\n    var partial = _createPartialApplicator(_concat);\n\n    /**\n     * Takes a function `f` and a list of arguments, and returns a function `g`.\n     * When applied, `g` returns the result of applying `f` to the arguments\n     * provided to `g` followed by the arguments provided initially.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category Function\n     * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x)\n     * @param {Function} f\n     * @param {Array} args\n     * @return {Function}\n     * @see R.partial\n     * @example\n     *\n     *      var greet = (salutation, title, firstName, lastName) =>\n     *        salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';\n     *\n     *      var greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']);\n     *\n     *      greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!'\n     */\n    var partialRight = _createPartialApplicator(flip(_concat));\n\n    /**\n     * Determines whether a nested path on an object has a specific value, in\n     * `R.equals` terms. Most likely used to filter a list.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.7.0\n     * @category Relation\n     * @sig [String] -> * -> {String: *} -> Boolean\n     * @param {Array} path The path of the nested property to use\n     * @param {*} val The value to compare the nested property with\n     * @param {Object} obj The object to check the nested property in\n     * @return {Boolean} `true` if the value equals the nested object property,\n     *         `false` otherwise.\n     * @example\n     *\n     *      var user1 = { address: { zipCode: 90210 } };\n     *      var user2 = { address: { zipCode: 55555 } };\n     *      var user3 = { name: 'Bob' };\n     *      var users = [ user1, user2, user3 ];\n     *      var isFamous = R.pathEq(['address', 'zipCode'], 90210);\n     *      R.filter(isFamous, users); //=> [ user1 ]\n     */\n    var pathEq = _curry3(function pathEq(_path, val, obj) {\n        return equals(path(_path, obj), val);\n    });\n\n    /**\n     * Returns a new list by plucking the same named property off all objects in\n     * the list supplied.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig k -> [{k: v}] -> [v]\n     * @param {Number|String} key The key name to pluck off of each object.\n     * @param {Array} list The array to consider.\n     * @return {Array} The list of values for the given key.\n     * @see R.props\n     * @example\n     *\n     *      R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2]\n     *      R.pluck(0)([[1, 2], [3, 4]]);   //=> [1, 3]\n     */\n    var pluck = _curry2(function pluck(p, list) {\n        return map(prop(p), list);\n    });\n\n    /**\n     * Reasonable analog to SQL `select` statement.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @category Relation\n     * @sig [k] -> [{k: v}] -> [{k: v}]\n     * @param {Array} props The property names to project\n     * @param {Array} objs The objects to query\n     * @return {Array} An array of objects with just the `props` properties.\n     * @example\n     *\n     *      var abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};\n     *      var fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};\n     *      var kids = [abby, fred];\n     *      R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]\n     */\n    // passing `identity` gives correct arity\n    var project = useWith(_map, [\n        pickAll,\n        identity\n    ]);\n\n    /**\n     * Returns `true` if the specified object property is equal, in `R.equals`\n     * terms, to the given value; `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig String -> a -> Object -> Boolean\n     * @param {String} name\n     * @param {*} val\n     * @param {*} obj\n     * @return {Boolean}\n     * @see R.equals, R.propSatisfies\n     * @example\n     *\n     *      var abby = {name: 'Abby', age: 7, hair: 'blond'};\n     *      var fred = {name: 'Fred', age: 12, hair: 'brown'};\n     *      var rusty = {name: 'Rusty', age: 10, hair: 'brown'};\n     *      var alois = {name: 'Alois', age: 15, disposition: 'surly'};\n     *      var kids = [abby, fred, rusty, alois];\n     *      var hasBrownHair = R.propEq('hair', 'brown');\n     *      R.filter(hasBrownHair, kids); //=> [fred, rusty]\n     */\n    var propEq = _curry3(function propEq(name, val, obj) {\n        return propSatisfies(equals(val), name, obj);\n    });\n\n    /**\n     * Returns `true` if the specified object property is of the given type;\n     * `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category Type\n     * @sig Type -> String -> Object -> Boolean\n     * @param {Function} type\n     * @param {String} name\n     * @param {*} obj\n     * @return {Boolean}\n     * @see R.is, R.propSatisfies\n     * @example\n     *\n     *      R.propIs(Number, 'x', {x: 1, y: 2});  //=> true\n     *      R.propIs(Number, 'x', {x: 'foo'});    //=> false\n     *      R.propIs(Number, 'x', {});            //=> false\n     */\n    var propIs = _curry3(function propIs(type, name, obj) {\n        return propSatisfies(is(type), name, obj);\n    });\n\n    /**\n     * Returns a single item by iterating through the list, successively calling\n     * the iterator function and passing it an accumulator value and the current\n     * value from the array, and then passing the result to the next call.\n     *\n     * The iterator function receives two values: *(acc, value)*. It may use\n     * `R.reduced` to shortcut the iteration.\n     *\n     * Note: `R.reduce` does not skip deleted or unassigned indices (sparse\n     * arrays), unlike the native `Array.prototype.reduce` method. For more details\n     * on this behavior, see:\n     * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description\n     *\n     * Dispatches to the `reduce` method of the third argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig ((a, b) -> a) -> a -> [b] -> a\n     * @param {Function} fn The iterator function. Receives two values, the accumulator and the\n     *        current element from the array.\n     * @param {*} acc The accumulator value.\n     * @param {Array} list The list to iterate over.\n     * @return {*} The final, accumulated value.\n     * @see R.reduced, R.addIndex\n     * @example\n     *\n     *      var numbers = [1, 2, 3];\n     *      var add = (a, b) => a + b;\n     *\n     *      R.reduce(add, 10, numbers); //=> 16\n     */\n    var reduce = _curry3(_reduce);\n\n    /**\n     * Groups the elements of the list according to the result of calling\n     * the String-returning function `keyFn` on each element and reduces the elements\n     * of each group to a single value via the reducer function `valueFn`.\n     *\n     * This function is basically a more general `groupBy` function.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.20.0\n     * @category List\n     * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a}\n     * @param {Function} valueFn The function that reduces the elements of each group to a single\n     *        value. Receives two values, accumulator for a particular group and the current element.\n     * @param {*} acc The (initial) accumulator value for each group.\n     * @param {Function} keyFn The function that maps the list's element into a key.\n     * @param {Array} list The array to group.\n     * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of\n     *         `valueFn` for elements which produced that key when passed to `keyFn`.\n     * @see R.groupBy, R.reduce\n     * @example\n     *\n     *      var reduceToNamesBy = R.reduceBy((acc, student) => acc.concat(student.name), []);\n     *      var namesByGrade = reduceToNamesBy(function(student) {\n     *        var score = student.score;\n     *        return score < 65 ? 'F' :\n     *               score < 70 ? 'D' :\n     *               score < 80 ? 'C' :\n     *               score < 90 ? 'B' : 'A';\n     *      });\n     *      var students = [{name: 'Lucy', score: 92},\n     *                      {name: 'Drew', score: 85},\n     *                      // ...\n     *                      {name: 'Bart', score: 62}];\n     *      namesByGrade(students);\n     *      // {\n     *      //   'A': ['Lucy'],\n     *      //   'B': ['Drew']\n     *      //   // ...,\n     *      //   'F': ['Bart']\n     *      // }\n     */\n    var reduceBy = _curryN(4, [], function reduceBy(valueFn, valueAcc, keyFn, list) {\n        return _reduce(function (acc, elt) {\n            var key = keyFn(elt);\n            acc[key] = valueFn(_has(key, acc) ? acc[key] : valueAcc, elt);\n            return acc;\n        }, {}, list);\n    });\n\n    /**\n     * The complement of `filter`.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig Filterable f => (a -> Boolean) -> f a -> f a\n     * @param {Function} pred\n     * @param {Array} filterable\n     * @return {Array}\n     * @see R.filter, R.transduce, R.addIndex\n     * @example\n     *\n     *      var isOdd = (n) => n % 2 === 1;\n     *\n     *      R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]\n     *\n     *      R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}\n     */\n    var reject = _curry2(function reject(pred, filterable) {\n        return filter(_complement(pred), filterable);\n    });\n\n    /**\n     * Returns a fixed list of size `n` containing a specified identical value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.1\n     * @category List\n     * @sig a -> n -> [a]\n     * @param {*} value The value to repeat.\n     * @param {Number} n The desired size of the output list.\n     * @return {Array} A new array containing `n` `value`s.\n     * @example\n     *\n     *      R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi']\n     *\n     *      var obj = {};\n     *      var repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}]\n     *      repeatedObjs[0] === repeatedObjs[1]; //=> true\n     */\n    var repeat = _curry2(function repeat(value, n) {\n        return times(always(value), n);\n    });\n\n    /**\n     * Adds together all the elements of a list.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Math\n     * @sig [Number] -> Number\n     * @param {Array} list An array of numbers\n     * @return {Number} The sum of all the numbers in the list.\n     * @see R.reduce\n     * @example\n     *\n     *      R.sum([2,4,6,8,100,1]); //=> 121\n     */\n    var sum = reduce(add, 0);\n\n    /**\n     * Returns a new list containing the last `n` elements of the given list.\n     * If `n > list.length`, returns a list of `list.length` elements.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category List\n     * @sig Number -> [a] -> [a]\n     * @sig Number -> String -> String\n     * @param {Number} n The number of elements to return.\n     * @param {Array} xs The collection to consider.\n     * @return {Array}\n     * @see R.dropLast\n     * @example\n     *\n     *      R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz']\n     *      R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']\n     *      R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']\n     *      R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']\n     *      R.takeLast(3, 'ramda');               //=> 'mda'\n     */\n    var takeLast = _curry2(function takeLast(n, xs) {\n        return drop(n >= 0 ? xs.length - n : 0, xs);\n    });\n\n    /**\n     * Initializes a transducer using supplied iterator function. Returns a single\n     * item by iterating through the list, successively calling the transformed\n     * iterator function and passing it an accumulator value and the current value\n     * from the array, and then passing the result to the next call.\n     *\n     * The iterator function receives two values: *(acc, value)*. It will be\n     * wrapped as a transformer to initialize the transducer. A transformer can be\n     * passed directly in place of an iterator function. In both cases, iteration\n     * may be stopped early with the `R.reduced` function.\n     *\n     * A transducer is a function that accepts a transformer and returns a\n     * transformer and can be composed directly.\n     *\n     * A transformer is an an object that provides a 2-arity reducing iterator\n     * function, step, 0-arity initial value function, init, and 1-arity result\n     * extraction function, result. The step function is used as the iterator\n     * function in reduce. The result function is used to convert the final\n     * accumulator into the return type and in most cases is R.identity. The init\n     * function can be used to provide an initial accumulator, but is ignored by\n     * transduce.\n     *\n     * The iteration is performed with R.reduce after initializing the transducer.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category List\n     * @sig (c -> c) -> (a,b -> a) -> a -> [b] -> a\n     * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.\n     * @param {Function} fn The iterator function. Receives two values, the accumulator and the\n     *        current element from the array. Wrapped as transformer, if necessary, and used to\n     *        initialize the transducer\n     * @param {*} acc The initial accumulator value.\n     * @param {Array} list The list to iterate over.\n     * @return {*} The final, accumulated value.\n     * @see R.reduce, R.reduced, R.into\n     * @example\n     *\n     *      var numbers = [1, 2, 3, 4];\n     *      var transducer = R.compose(R.map(R.add(1)), R.take(2));\n     *\n     *      R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3]\n     */\n    var transduce = curryN(4, function transduce(xf, fn, acc, list) {\n        return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list);\n    });\n\n    /**\n     * Combines two lists into a set (i.e. no duplicates) composed of the elements\n     * of each list. Duplication is determined according to the value returned by\n     * applying the supplied predicate to two list elements.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig (a -> a -> Boolean) -> [*] -> [*] -> [*]\n     * @param {Function} pred A predicate used to test whether two items are equal.\n     * @param {Array} list1 The first list.\n     * @param {Array} list2 The second list.\n     * @return {Array} The first and second lists concatenated, with\n     *         duplicates removed.\n     * @see R.union\n     * @example\n     *\n     *      var l1 = [{a: 1}, {a: 2}];\n     *      var l2 = [{a: 1}, {a: 4}];\n     *      R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}]\n     */\n    var unionWith = _curry3(function unionWith(pred, list1, list2) {\n        return uniqWith(pred, _concat(list1, list2));\n    });\n\n    /**\n     * Takes a spec object and a test object; returns true if the test satisfies\n     * the spec, false otherwise. An object satisfies the spec if, for each of the\n     * spec's own properties, accessing that property of the object gives the same\n     * value (in `R.equals` terms) as accessing that property of the spec.\n     *\n     * `whereEq` is a specialization of [`where`](#where).\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category Object\n     * @sig {String: *} -> {String: *} -> Boolean\n     * @param {Object} spec\n     * @param {Object} testObj\n     * @return {Boolean}\n     * @see R.where\n     * @example\n     *\n     *      // pred :: Object -> Boolean\n     *      var pred = R.whereEq({a: 1, b: 2});\n     *\n     *      pred({a: 1});              //=> false\n     *      pred({a: 1, b: 2});        //=> true\n     *      pred({a: 1, b: 2, c: 3});  //=> true\n     *      pred({a: 1, b: 1});        //=> false\n     */\n    var whereEq = _curry2(function whereEq(spec, testObj) {\n        return where(map(equals, spec), testObj);\n    });\n\n    var _flatCat = function () {\n        var preservingReduced = function (xf) {\n            return {\n                '@@transducer/init': _xfBase.init,\n                '@@transducer/result': function (result) {\n                    return xf['@@transducer/result'](result);\n                },\n                '@@transducer/step': function (result, input) {\n                    var ret = xf['@@transducer/step'](result, input);\n                    return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret;\n                }\n            };\n        };\n        return function _xcat(xf) {\n            var rxf = preservingReduced(xf);\n            return {\n                '@@transducer/init': _xfBase.init,\n                '@@transducer/result': function (result) {\n                    return rxf['@@transducer/result'](result);\n                },\n                '@@transducer/step': function (result, input) {\n                    return !isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input);\n                }\n            };\n        };\n    }();\n\n    // Array.prototype.indexOf doesn't exist below IE9\n    // manually crawl the list to distinguish between +0 and -0\n    // NaN\n    // non-zero numbers can utilise Set\n    // all these types can utilise Set\n    // null can utilise Set\n    // anything else not covered above, defer to R.equals\n    var _indexOf = function _indexOf(list, a, idx) {\n        var inf, item;\n        // Array.prototype.indexOf doesn't exist below IE9\n        if (typeof list.indexOf === 'function') {\n            switch (typeof a) {\n            case 'number':\n                if (a === 0) {\n                    // manually crawl the list to distinguish between +0 and -0\n                    inf = 1 / a;\n                    while (idx < list.length) {\n                        item = list[idx];\n                        if (item === 0 && 1 / item === inf) {\n                            return idx;\n                        }\n                        idx += 1;\n                    }\n                    return -1;\n                } else if (a !== a) {\n                    // NaN\n                    while (idx < list.length) {\n                        item = list[idx];\n                        if (typeof item === 'number' && item !== item) {\n                            return idx;\n                        }\n                        idx += 1;\n                    }\n                    return -1;\n                }\n                // non-zero numbers can utilise Set\n                return list.indexOf(a, idx);\n            // all these types can utilise Set\n            case 'string':\n            case 'boolean':\n            case 'function':\n            case 'undefined':\n                return list.indexOf(a, idx);\n            case 'object':\n                if (a === null) {\n                    // null can utilise Set\n                    return list.indexOf(a, idx);\n                }\n            }\n        }\n        // anything else not covered above, defer to R.equals\n        while (idx < list.length) {\n            if (equals(list[idx], a)) {\n                return idx;\n            }\n            idx += 1;\n        }\n        return -1;\n    };\n\n    var _xchain = _curry2(function _xchain(f, xf) {\n        return map(f, _flatCat(xf));\n    });\n\n    /**\n     * Takes a list of predicates and returns a predicate that returns true for a\n     * given list of arguments if every one of the provided predicates is satisfied\n     * by those arguments.\n     *\n     * The function returned is a curried function whose arity matches that of the\n     * highest-arity predicate.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Logic\n     * @sig [(*... -> Boolean)] -> (*... -> Boolean)\n     * @param {Array} preds\n     * @return {Function}\n     * @see R.anyPass\n     * @example\n     *\n     *      var isQueen = R.propEq('rank', 'Q');\n     *      var isSpade = R.propEq('suit', '♠︎');\n     *      var isQueenOfSpades = R.allPass([isQueen, isSpade]);\n     *\n     *      isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false\n     *      isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true\n     */\n    var allPass = _curry1(function allPass(preds) {\n        return curryN(reduce(max, 0, pluck('length', preds)), function () {\n            var idx = 0;\n            var len = preds.length;\n            while (idx < len) {\n                if (!preds[idx].apply(this, arguments)) {\n                    return false;\n                }\n                idx += 1;\n            }\n            return true;\n        });\n    });\n\n    /**\n     * Returns `true` if all elements are unique, in `R.equals` terms, otherwise\n     * `false`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.18.0\n     * @category List\n     * @sig [a] -> Boolean\n     * @param {Array} list The array to consider.\n     * @return {Boolean} `true` if all elements are unique, else `false`.\n     * @deprecated since v0.20.0\n     * @example\n     *\n     *      R.allUniq(['1', 1]); //=> true\n     *      R.allUniq([1, 1]);   //=> false\n     *      R.allUniq([[42], [42]]); //=> false\n     */\n    var allUniq = _curry1(function allUniq(list) {\n        var len = list.length;\n        var idx = 0;\n        while (idx < len) {\n            if (_indexOf(list, list[idx], idx + 1) >= 0) {\n                return false;\n            }\n            idx += 1;\n        }\n        return true;\n    });\n\n    /**\n     * Takes a list of predicates and returns a predicate that returns true for a\n     * given list of arguments if at least one of the provided predicates is\n     * satisfied by those arguments.\n     *\n     * The function returned is a curried function whose arity matches that of the\n     * highest-arity predicate.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Logic\n     * @sig [(*... -> Boolean)] -> (*... -> Boolean)\n     * @param {Array} preds\n     * @return {Function}\n     * @see R.allPass\n     * @example\n     *\n     *      var gte = R.anyPass([R.gt, R.equals]);\n     *\n     *      gte(3, 2); //=> true\n     *      gte(2, 2); //=> true\n     *      gte(2, 3); //=> false\n     */\n    var anyPass = _curry1(function anyPass(preds) {\n        return curryN(reduce(max, 0, pluck('length', preds)), function () {\n            var idx = 0;\n            var len = preds.length;\n            while (idx < len) {\n                if (preds[idx].apply(this, arguments)) {\n                    return true;\n                }\n                idx += 1;\n            }\n            return false;\n        });\n    });\n\n    /**\n     * ap applies a list of functions to a list of values.\n     *\n     * Dispatches to the `ap` method of the second argument, if present. Also\n     * treats functions as applicatives.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category Function\n     * @sig [f] -> [a] -> [f a]\n     * @param {Array} fns An array of functions\n     * @param {Array} vs An array of values\n     * @return {Array} An array of results of applying each of `fns` to all of `vs` in turn.\n     * @example\n     *\n     *      R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6]\n     */\n    // else\n    var ap = _curry2(function ap(applicative, fn) {\n        return typeof applicative.ap === 'function' ? applicative.ap(fn) : typeof applicative === 'function' ? curryN(Math.max(applicative.length, fn.length), function () {\n            return applicative.apply(this, arguments)(fn.apply(this, arguments));\n        }) : // else\n        _reduce(function (acc, f) {\n            return _concat(acc, map(f, fn));\n        }, [], applicative);\n    });\n\n    /**\n     * Given a spec object recursively mapping properties to functions, creates a\n     * function producing an object of the same structure, by mapping each property\n     * to the result of calling its associated function with the supplied arguments.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.20.0\n     * @category Function\n     * @sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v})\n     * @param {Object} spec an object recursively mapping properties to functions for\n     *        producing the values for these properties.\n     * @return {Function} A function that returns an object of the same structure\n     * as `spec', with each property set to the value returned by calling its\n     * associated function with the supplied arguments.\n     * @see R.juxt\n     * @example\n     *\n     *      var getMetrics = R.applySpec({\n     *                                      sum: R.add,\n     *                                      nested: { mul: R.multiply }\n     *                                   });\n     *      getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } }\n     */\n    var applySpec = _curry1(function applySpec(spec) {\n        spec = map(function (v) {\n            return typeof v == 'function' ? v : applySpec(v);\n        }, spec);\n        return curryN(reduce(max, 0, pluck('length', values(spec))), function () {\n            var args = arguments;\n            return map(function (f) {\n                return apply(f, args);\n            }, spec);\n        });\n    });\n\n    /**\n     * Returns the result of calling its first argument with the remaining\n     * arguments. This is occasionally useful as a converging function for\n     * `R.converge`: the left branch can produce a function while the right branch\n     * produces a value to be passed to that function as an argument.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category Function\n     * @sig (*... -> a),*... -> a\n     * @param {Function} fn The function to apply to the remaining arguments.\n     * @param {...*} args Any number of positional arguments.\n     * @return {*}\n     * @see R.apply\n     * @example\n     *\n     *      var indentN = R.pipe(R.times(R.always(' ')),\n     *                           R.join(''),\n     *                           R.replace(/^(?!$)/gm));\n     *\n     *      var format = R.converge(R.call, [\n     *                                  R.pipe(R.prop('indent'), indentN),\n     *                                  R.prop('value')\n     *                              ]);\n     *\n     *      format({indent: 2, value: 'foo\\nbar\\nbaz\\n'}); //=> '  foo\\n  bar\\n  baz\\n'\n     */\n    var call = curry(function call(fn) {\n        return fn.apply(this, _slice(arguments, 1));\n    });\n\n    /**\n     * `chain` maps a function over a list and concatenates the results. `chain`\n     * is also known as `flatMap` in some libraries\n     *\n     * Dispatches to the `chain` method of the second argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category List\n     * @sig (a -> [b]) -> [a] -> [b]\n     * @param {Function} fn\n     * @param {Array} list\n     * @return {Array}\n     * @example\n     *\n     *      var duplicate = n => [n, n];\n     *      R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3]\n     */\n    var chain = _curry2(_dispatchable('chain', _xchain, function chain(fn, monad) {\n        if (typeof monad === 'function') {\n            return function () {\n                return monad.call(this, fn.apply(this, arguments)).apply(this, arguments);\n            };\n        }\n        return _makeFlat(false)(map(fn, monad));\n    }));\n\n    /**\n     * Returns a function, `fn`, which encapsulates if/else-if/else logic.\n     * `R.cond` takes a list of [predicate, transform] pairs. All of the arguments\n     * to `fn` are applied to each of the predicates in turn until one returns a\n     * \"truthy\" value, at which point `fn` returns the result of applying its\n     * arguments to the corresponding transformer. If none of the predicates\n     * matches, `fn` returns undefined.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.6.0\n     * @category Logic\n     * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *)\n     * @param {Array} pairs\n     * @return {Function}\n     * @example\n     *\n     *      var fn = R.cond([\n     *        [R.equals(0),   R.always('water freezes at 0°C')],\n     *        [R.equals(100), R.always('water boils at 100°C')],\n     *        [R.T,           temp => 'nothing special happens at ' + temp + '°C']\n     *      ]);\n     *      fn(0); //=> 'water freezes at 0°C'\n     *      fn(50); //=> 'nothing special happens at 50°C'\n     *      fn(100); //=> 'water boils at 100°C'\n     */\n    var cond = _curry1(function cond(pairs) {\n        var arity = reduce(max, 0, map(function (pair) {\n            return pair[0].length;\n        }, pairs));\n        return _arity(arity, function () {\n            var idx = 0;\n            while (idx < pairs.length) {\n                if (pairs[idx][0].apply(this, arguments)) {\n                    return pairs[idx][1].apply(this, arguments);\n                }\n                idx += 1;\n            }\n        });\n    });\n\n    /**\n     * Wraps a constructor function inside a curried function that can be called\n     * with the same arguments and returns the same type. The arity of the function\n     * returned is specified to allow using variadic constructor functions.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.4.0\n     * @category Function\n     * @sig Number -> (* -> {*}) -> (* -> {*})\n     * @param {Number} n The arity of the constructor function.\n     * @param {Function} Fn The constructor function to wrap.\n     * @return {Function} A wrapped, curried constructor function.\n     * @example\n     *\n     *      // Variadic constructor function\n     *      var Widget = () => {\n     *        this.children = Array.prototype.slice.call(arguments);\n     *        // ...\n     *      };\n     *      Widget.prototype = {\n     *        // ...\n     *      };\n     *      var allConfigs = [\n     *        // ...\n     *      ];\n     *      R.map(R.constructN(1, Widget), allConfigs); // a list of Widgets\n     */\n    var constructN = _curry2(function constructN(n, Fn) {\n        if (n > 10) {\n            throw new Error('Constructor with greater than ten arguments');\n        }\n        if (n === 0) {\n            return function () {\n                return new Fn();\n            };\n        }\n        return curry(nAry(n, function ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {\n            switch (arguments.length) {\n            case 1:\n                return new Fn($0);\n            case 2:\n                return new Fn($0, $1);\n            case 3:\n                return new Fn($0, $1, $2);\n            case 4:\n                return new Fn($0, $1, $2, $3);\n            case 5:\n                return new Fn($0, $1, $2, $3, $4);\n            case 6:\n                return new Fn($0, $1, $2, $3, $4, $5);\n            case 7:\n                return new Fn($0, $1, $2, $3, $4, $5, $6);\n            case 8:\n                return new Fn($0, $1, $2, $3, $4, $5, $6, $7);\n            case 9:\n                return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8);\n            case 10:\n                return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8, $9);\n            }\n        }));\n    });\n\n    /**\n     * Accepts a converging function and a list of branching functions and returns\n     * a new function. When invoked, this new function is applied to some\n     * arguments, each branching function is applied to those same arguments. The\n     * results of each branching function are passed as arguments to the converging\n     * function to produce the return value.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.4.2\n     * @category Function\n     * @sig (x1 -> x2 -> ... -> z) -> [(a -> b -> ... -> x1), (a -> b -> ... -> x2), ...] -> (a -> b -> ... -> z)\n     * @param {Function} after A function. `after` will be invoked with the return values of\n     *        `fn1` and `fn2` as its arguments.\n     * @param {Array} functions A list of functions.\n     * @return {Function} A new function.\n     * @example\n     *\n     *      var add = (a, b) => a + b;\n     *      var multiply = (a, b) => a * b;\n     *      var subtract = (a, b) => a - b;\n     *\n     *      //≅ multiply( add(1, 2), subtract(1, 2) );\n     *      R.converge(multiply, [add, subtract])(1, 2); //=> -3\n     *\n     *      var add3 = (a, b, c) => a + b + c;\n     *      R.converge(add3, [multiply, add, subtract])(1, 2); //=> 4\n     */\n    var converge = _curry2(function converge(after, fns) {\n        return curryN(reduce(max, 0, pluck('length', fns)), function () {\n            var args = arguments;\n            var context = this;\n            return after.apply(context, _map(function (fn) {\n                return fn.apply(context, args);\n            }, fns));\n        });\n    });\n\n    /**\n     * Counts the elements of a list according to how many match each value of a\n     * key generated by the supplied function. Returns an object mapping the keys\n     * produced by `fn` to the number of occurrences in the list. Note that all\n     * keys are coerced to strings because of how JavaScript objects work.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig (a -> String) -> [a] -> {*}\n     * @param {Function} fn The function used to map values to keys.\n     * @param {Array} list The list to count elements from.\n     * @return {Object} An object mapping keys to number of occurrences in the list.\n     * @example\n     *\n     *      var numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2];\n     *      var letters = R.split('', 'abcABCaaaBBc');\n     *      R.countBy(Math.floor)(numbers);    //=> {'1': 3, '2': 2, '3': 1}\n     *      R.countBy(R.toLower)(letters);   //=> {'a': 5, 'b': 4, 'c': 3}\n     */\n    var countBy = reduceBy(function (acc, elem) {\n        return acc + 1;\n    }, 0);\n\n    /**\n     * Returns a new list without any consecutively repeating elements. Equality is\n     * determined by applying the supplied predicate two consecutive elements. The\n     * first element in a series of equal element is the one being preserved.\n     *\n     * Dispatches to the `dropRepeatsWith` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category List\n     * @sig (a, a -> Boolean) -> [a] -> [a]\n     * @param {Function} pred A predicate used to test whether two items are equal.\n     * @param {Array} list The array to consider.\n     * @return {Array} `list` without repeating elements.\n     * @see R.transduce\n     * @example\n     *\n     *      var l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3];\n     *      R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3]\n     */\n    var dropRepeatsWith = _curry2(_dispatchable('dropRepeatsWith', _xdropRepeatsWith, function dropRepeatsWith(pred, list) {\n        var result = [];\n        var idx = 1;\n        var len = list.length;\n        if (len !== 0) {\n            result[0] = list[0];\n            while (idx < len) {\n                if (!pred(last(result), list[idx])) {\n                    result[result.length] = list[idx];\n                }\n                idx += 1;\n            }\n        }\n        return result;\n    }));\n\n    /**\n     * Takes a function and two values in its domain and returns `true` if the\n     * values map to the same value in the codomain; `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.18.0\n     * @category Relation\n     * @sig (a -> b) -> a -> a -> Boolean\n     * @param {Function} f\n     * @param {*} x\n     * @param {*} y\n     * @return {Boolean}\n     * @example\n     *\n     *      R.eqBy(Math.abs, 5, -5); //=> true\n     */\n    var eqBy = _curry3(function eqBy(f, x, y) {\n        return equals(f(x), f(y));\n    });\n\n    /**\n     * Reports whether two objects have the same value, in `R.equals` terms, for\n     * the specified property. Useful as a curried predicate.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig k -> {k: v} -> {k: v} -> Boolean\n     * @param {String} prop The name of the property to compare\n     * @param {Object} obj1\n     * @param {Object} obj2\n     * @return {Boolean}\n     *\n     * @example\n     *\n     *      var o1 = { a: 1, b: 2, c: 3, d: 4 };\n     *      var o2 = { a: 10, b: 20, c: 3, d: 40 };\n     *      R.eqProps('a', o1, o2); //=> false\n     *      R.eqProps('c', o1, o2); //=> true\n     */\n    var eqProps = _curry3(function eqProps(prop, obj1, obj2) {\n        return equals(obj1[prop], obj2[prop]);\n    });\n\n    /**\n     * Splits a list into sub-lists stored in an object, based on the result of\n     * calling a String-returning function on each element, and grouping the\n     * results according to values returned.\n     *\n     * Dispatches to the `groupBy` method of the second argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig (a -> String) -> [a] -> {String: [a]}\n     * @param {Function} fn Function :: a -> String\n     * @param {Array} list The array to group\n     * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements\n     *         that produced that key when passed to `fn`.\n     * @see R.transduce\n     * @example\n     *\n     *      var byGrade = R.groupBy(function(student) {\n     *        var score = student.score;\n     *        return score < 65 ? 'F' :\n     *               score < 70 ? 'D' :\n     *               score < 80 ? 'C' :\n     *               score < 90 ? 'B' : 'A';\n     *      });\n     *      var students = [{name: 'Abby', score: 84},\n     *                      {name: 'Eddy', score: 58},\n     *                      // ...\n     *                      {name: 'Jack', score: 69}];\n     *      byGrade(students);\n     *      // {\n     *      //   'A': [{name: 'Dianne', score: 99}],\n     *      //   'B': [{name: 'Abby', score: 84}]\n     *      //   // ...,\n     *      //   'F': [{name: 'Eddy', score: 58}]\n     *      // }\n     */\n    var groupBy = _curry2(_dispatchable('groupBy', _xgroupBy, reduceBy(function (acc, item) {\n        if (acc == null) {\n            acc = [];\n        }\n        acc.push(item);\n        return acc;\n    }, null)));\n\n    /**\n     * Given a function that generates a key, turns a list of objects into an\n     * object indexing the objects by the given key. Note that if multiple\n     * objects generate the same value for the indexing key only the last value\n     * will be included in the generated object.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category List\n     * @sig (a -> String) -> [{k: v}] -> {k: {k: v}}\n     * @param {Function} fn Function :: a -> String\n     * @param {Array} array The array of objects to index\n     * @return {Object} An object indexing each array element by the given property.\n     * @example\n     *\n     *      var list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}];\n     *      R.indexBy(R.prop('id'), list);\n     *      //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}}\n     */\n    var indexBy = reduceBy(function (acc, elem) {\n        return elem;\n    }, null);\n\n    /**\n     * Returns the position of the first occurrence of an item in an array, or -1\n     * if the item is not included in the array. `R.equals` is used to determine\n     * equality.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig a -> [a] -> Number\n     * @param {*} target The item to find.\n     * @param {Array} xs The array to search in.\n     * @return {Number} the index of the target, or -1 if the target is not found.\n     * @see R.lastIndexOf\n     * @example\n     *\n     *      R.indexOf(3, [1,2,3,4]); //=> 2\n     *      R.indexOf(10, [1,2,3,4]); //=> -1\n     */\n    var indexOf = _curry2(function indexOf(target, xs) {\n        return typeof xs.indexOf === 'function' && !_isArray(xs) ? xs.indexOf(target) : _indexOf(xs, target, 0);\n    });\n\n    /**\n     * juxt applies a list of functions to a list of values.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category Function\n     * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n])\n     * @param {Array} fns An array of functions\n     * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters.\n     * @see R.applySpec\n     * @example\n     *\n     *      var range = R.juxt([Math.min, Math.max]);\n     *      range(3, 4, 9, -3); //=> [-3, 9]\n     */\n    var juxt = _curry1(function juxt(fns) {\n        return converge(_arrayOf, fns);\n    });\n\n    /**\n     * Returns a lens for the given getter and setter functions. The getter \"gets\"\n     * the value of the focus; the setter \"sets\" the value of the focus. The setter\n     * should not mutate the data structure.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.8.0\n     * @category Object\n     * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s\n     * @sig (s -> a) -> ((a, s) -> s) -> Lens s a\n     * @param {Function} getter\n     * @param {Function} setter\n     * @return {Lens}\n     * @see R.view, R.set, R.over, R.lensIndex, R.lensProp\n     * @example\n     *\n     *      var xLens = R.lens(R.prop('x'), R.assoc('x'));\n     *\n     *      R.view(xLens, {x: 1, y: 2});            //=> 1\n     *      R.set(xLens, 4, {x: 1, y: 2});          //=> {x: 4, y: 2}\n     *      R.over(xLens, R.negate, {x: 1, y: 2});  //=> {x: -1, y: 2}\n     */\n    var lens = _curry2(function lens(getter, setter) {\n        return function (toFunctorFn) {\n            return function (target) {\n                return map(function (focus) {\n                    return setter(focus, target);\n                }, toFunctorFn(getter(target)));\n            };\n        };\n    });\n\n    /**\n     * Returns a lens whose focus is the specified index.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category Object\n     * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s\n     * @sig Number -> Lens s a\n     * @param {Number} n\n     * @return {Lens}\n     * @see R.view, R.set, R.over\n     * @example\n     *\n     *      var headLens = R.lensIndex(0);\n     *\n     *      R.view(headLens, ['a', 'b', 'c']);            //=> 'a'\n     *      R.set(headLens, 'x', ['a', 'b', 'c']);        //=> ['x', 'b', 'c']\n     *      R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c']\n     */\n    var lensIndex = _curry1(function lensIndex(n) {\n        return lens(nth(n), update(n));\n    });\n\n    /**\n     * Returns a lens whose focus is the specified path.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category Object\n     * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s\n     * @sig [String] -> Lens s a\n     * @param {Array} path The path to use.\n     * @return {Lens}\n     * @see R.view, R.set, R.over\n     * @example\n     *\n     *      var xyLens = R.lensPath(['x', 'y']);\n     *\n     *      R.view(xyLens, {x: {y: 2, z: 3}});            //=> 2\n     *      R.set(xyLens, 4, {x: {y: 2, z: 3}});          //=> {x: {y: 4, z: 3}}\n     *      R.over(xyLens, R.negate, {x: {y: 2, z: 3}});  //=> {x: {y: -2, z: 3}}\n     */\n    var lensPath = _curry1(function lensPath(p) {\n        return lens(path(p), assocPath(p));\n    });\n\n    /**\n     * Returns a lens whose focus is the specified property.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category Object\n     * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s\n     * @sig String -> Lens s a\n     * @param {String} k\n     * @return {Lens}\n     * @see R.view, R.set, R.over\n     * @example\n     *\n     *      var xLens = R.lensProp('x');\n     *\n     *      R.view(xLens, {x: 1, y: 2});            //=> 1\n     *      R.set(xLens, 4, {x: 1, y: 2});          //=> {x: 4, y: 2}\n     *      R.over(xLens, R.negate, {x: 1, y: 2});  //=> {x: -1, y: 2}\n     */\n    var lensProp = _curry1(function lensProp(k) {\n        return lens(prop(k), assoc(k));\n    });\n\n    /**\n     * \"lifts\" a function to be the specified arity, so that it may \"map over\" that\n     * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).\n     *\n     * @func\n     * @memberOf R\n     * @since v0.7.0\n     * @category Function\n     * @sig Number -> (*... -> *) -> ([*]... -> [*])\n     * @param {Function} fn The function to lift into higher context\n     * @return {Function} The lifted function.\n     * @see R.lift, R.ap\n     * @example\n     *\n     *      var madd3 = R.liftN(3, R.curryN(3, (...args) => R.sum(args)));\n     *      madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]\n     */\n    var liftN = _curry2(function liftN(arity, fn) {\n        var lifted = curryN(arity, fn);\n        return curryN(arity, function () {\n            return _reduce(ap, map(lifted, arguments[0]), _slice(arguments, 1));\n        });\n    });\n\n    /**\n     * Returns the mean of the given list of numbers.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category Math\n     * @sig [Number] -> Number\n     * @param {Array} list\n     * @return {Number}\n     * @example\n     *\n     *      R.mean([2, 7, 9]); //=> 6\n     *      R.mean([]); //=> NaN\n     */\n    var mean = _curry1(function mean(list) {\n        return sum(list) / list.length;\n    });\n\n    /**\n     * Returns the median of the given list of numbers.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category Math\n     * @sig [Number] -> Number\n     * @param {Array} list\n     * @return {Number}\n     * @example\n     *\n     *      R.median([2, 9, 7]); //=> 7\n     *      R.median([7, 2, 10, 9]); //=> 8\n     *      R.median([]); //=> NaN\n     */\n    var median = _curry1(function median(list) {\n        var len = list.length;\n        if (len === 0) {\n            return NaN;\n        }\n        var width = 2 - len % 2;\n        var idx = (len - width) / 2;\n        return mean(_slice(list).sort(function (a, b) {\n            return a < b ? -1 : a > b ? 1 : 0;\n        }).slice(idx, idx + width));\n    });\n\n    /**\n     * Takes a predicate and a list or other \"filterable\" object and returns the\n     * pair of filterable objects of the same type of elements which do and do not\n     * satisfy, the predicate, respectively.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.4\n     * @category List\n     * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a]\n     * @param {Function} pred A predicate to determine which side the element belongs to.\n     * @param {Array} filterable the list (or other filterable) to partition.\n     * @return {Array} An array, containing first the subset of elements that satisfy the\n     *         predicate, and second the subset of elements that do not satisfy.\n     * @see R.filter, R.reject\n     * @example\n     *\n     *      R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']);\n     *      // => [ [ 'sss', 'bars' ],  [ 'ttt', 'foo' ] ]\n     *\n     *      R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' });\n     *      // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' }  ]\n     */\n    var partition = juxt([\n        filter,\n        reject\n    ]);\n\n    /**\n     * Performs left-to-right function composition. The leftmost function may have\n     * any arity; the remaining functions must be unary.\n     *\n     * In some libraries this function is named `sequence`.\n     *\n     * **Note:** The result of pipe is not automatically curried.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z)\n     * @param {...Function} functions\n     * @return {Function}\n     * @see R.compose\n     * @example\n     *\n     *      var f = R.pipe(Math.pow, R.negate, R.inc);\n     *\n     *      f(3, 4); // -(3^4) + 1\n     */\n    var pipe = function pipe() {\n        if (arguments.length === 0) {\n            throw new Error('pipe requires at least one argument');\n        }\n        return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments)));\n    };\n\n    /**\n     * Performs left-to-right composition of one or more Promise-returning\n     * functions. The leftmost function may have any arity; the remaining functions\n     * must be unary.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category Function\n     * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z)\n     * @param {...Function} functions\n     * @return {Function}\n     * @see R.composeP\n     * @example\n     *\n     *      //  followersForUser :: String -> Promise [User]\n     *      var followersForUser = R.pipeP(db.getUserById, db.getFollowers);\n     */\n    var pipeP = function pipeP() {\n        if (arguments.length === 0) {\n            throw new Error('pipeP requires at least one argument');\n        }\n        return _arity(arguments[0].length, reduce(_pipeP, arguments[0], tail(arguments)));\n    };\n\n    /**\n     * Multiplies together all the elements of a list.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Math\n     * @sig [Number] -> Number\n     * @param {Array} list An array of numbers\n     * @return {Number} The product of all the numbers in the list.\n     * @see R.reduce\n     * @example\n     *\n     *      R.product([2,4,6,8,100,1]); //=> 38400\n     */\n    var product = reduce(multiply, 1);\n\n    /**\n     * Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable)\n     * of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an\n     * Applicative of Traversable.\n     *\n     * Dispatches to the `sequence` method of the second argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category List\n     * @sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a)\n     * @param {Function} of\n     * @param {*} traversable\n     * @return {*}\n     * @see R.traverse\n     * @example\n     *\n     *      R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]);   //=> Just([1, 2, 3])\n     *      R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing()\n     *\n     *      R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)]\n     *      R.sequence(R.of, Nothing());       //=> [Nothing()]\n     */\n    var sequence = _curry2(function sequence(of, traversable) {\n        return typeof traversable.sequence === 'function' ? traversable.sequence(of) : reduceRight(function (acc, x) {\n            return ap(map(prepend, x), acc);\n        }, of([]), traversable);\n    });\n\n    /**\n     * Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning\n     * function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),\n     * then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative\n     * into an Applicative of Traversable.\n     *\n     * Dispatches to the `sequence` method of the third argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category List\n     * @sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b)\n     * @param {Function} of\n     * @param {Function} f\n     * @param {*} traversable\n     * @return {*}\n     * @see R.sequence\n     * @example\n     *\n     *      // Returns `Nothing` if the given divisor is `0`\n     *      safeDiv = n => d => d === 0 ? Nothing() : Just(n / d)\n     *\n     *      R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Just([5, 2.5, 2])\n     *      R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Nothing\n     */\n    var traverse = _curry3(function traverse(of, f, traversable) {\n        return sequence(of, map(f, traversable));\n    });\n\n    /**\n     * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from\n     * any [Chain](https://github.com/fantasyland/fantasy-land#chain).\n     *\n     * @func\n     * @memberOf R\n     * @since v0.3.0\n     * @category List\n     * @sig Chain c => c (c a) -> c a\n     * @param {*} list\n     * @return {*}\n     * @see R.flatten, R.chain\n     * @example\n     *\n     *      R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]]\n     *      R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6]\n     */\n    var unnest = chain(_identity);\n\n    var _contains = function _contains(a, list) {\n        return _indexOf(list, a, 0) >= 0;\n    };\n\n    //  mapPairs :: (Object, [String]) -> [String]\n    var _toString = function _toString(x, seen) {\n        var recur = function recur(y) {\n            var xs = seen.concat([x]);\n            return _contains(y, xs) ? '<Circular>' : _toString(y, xs);\n        };\n        //  mapPairs :: (Object, [String]) -> [String]\n        var mapPairs = function (obj, keys) {\n            return _map(function (k) {\n                return _quote(k) + ': ' + recur(obj[k]);\n            }, keys.slice().sort());\n        };\n        switch (Object.prototype.toString.call(x)) {\n        case '[object Arguments]':\n            return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))';\n        case '[object Array]':\n            return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) {\n                return /^\\d+$/.test(k);\n            }, keys(x)))).join(', ') + ']';\n        case '[object Boolean]':\n            return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString();\n        case '[object Date]':\n            return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')';\n        case '[object Null]':\n            return 'null';\n        case '[object Number]':\n            return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10);\n        case '[object String]':\n            return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x);\n        case '[object Undefined]':\n            return 'undefined';\n        default:\n            if (typeof x.toString === 'function') {\n                var repr = x.toString();\n                if (repr !== '[object Object]') {\n                    return repr;\n                }\n            }\n            return '{' + mapPairs(x, keys(x)).join(', ') + '}';\n        }\n    };\n\n    /**\n     * Performs right-to-left function composition. The rightmost function may have\n     * any arity; the remaining functions must be unary.\n     *\n     * **Note:** The result of compose is not automatically curried.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z)\n     * @param {...Function} functions\n     * @return {Function}\n     * @see R.pipe\n     * @example\n     *\n     *      var f = R.compose(R.inc, R.negate, Math.pow);\n     *\n     *      f(3, 4); // -(3^4) + 1\n     */\n    var compose = function compose() {\n        if (arguments.length === 0) {\n            throw new Error('compose requires at least one argument');\n        }\n        return pipe.apply(this, reverse(arguments));\n    };\n\n    /**\n     * Returns the right-to-left Kleisli composition of the provided functions,\n     * each of which must return a value of a type supported by [`chain`](#chain).\n     *\n     * `R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), R.chain(f))`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category Function\n     * @sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (m a -> m z)\n     * @param {...Function}\n     * @return {Function}\n     * @see R.pipeK\n     * @example\n     *\n     *      //  parseJson :: String -> Maybe *\n     *      //  get :: String -> Object -> Maybe *\n     *\n     *      //  getStateCode :: Maybe String -> Maybe String\n     *      var getStateCode = R.composeK(\n     *        R.compose(Maybe.of, R.toUpper),\n     *        get('state'),\n     *        get('address'),\n     *        get('user'),\n     *        parseJson\n     *      );\n     *\n     *      getStateCode(Maybe.of('{\"user\":{\"address\":{\"state\":\"ny\"}}}'));\n     *      //=> Just('NY')\n     *      getStateCode(Maybe.of('[Invalid JSON]'));\n     *      //=> Nothing()\n     */\n    var composeK = function composeK() {\n        return compose.apply(this, prepend(identity, map(chain, arguments)));\n    };\n\n    /**\n     * Performs right-to-left composition of one or more Promise-returning\n     * functions. The rightmost function may have any arity; the remaining\n     * functions must be unary.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.10.0\n     * @category Function\n     * @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z)\n     * @param {...Function} functions\n     * @return {Function}\n     * @see R.pipeP\n     * @example\n     *\n     *      //  followersForUser :: String -> Promise [User]\n     *      var followersForUser = R.composeP(db.getFollowers, db.getUserById);\n     */\n    var composeP = function composeP() {\n        if (arguments.length === 0) {\n            throw new Error('composeP requires at least one argument');\n        }\n        return pipeP.apply(this, reverse(arguments));\n    };\n\n    /**\n     * Wraps a constructor function inside a curried function that can be called\n     * with the same arguments and returns the same type.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (* -> {*}) -> (* -> {*})\n     * @param {Function} Fn The constructor function to wrap.\n     * @return {Function} A wrapped, curried constructor function.\n     * @example\n     *\n     *      // Constructor function\n     *      var Widget = config => {\n     *        // ...\n     *      };\n     *      Widget.prototype = {\n     *        // ...\n     *      };\n     *      var allConfigs = [\n     *        // ...\n     *      ];\n     *      R.map(R.construct(Widget), allConfigs); // a list of Widgets\n     */\n    var construct = _curry1(function construct(Fn) {\n        return constructN(Fn.length, Fn);\n    });\n\n    /**\n     * Returns `true` if the specified value is equal, in `R.equals` terms, to at\n     * least one element of the given list; `false` otherwise.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig a -> [a] -> Boolean\n     * @param {Object} a The item to compare against.\n     * @param {Array} list The array to consider.\n     * @return {Boolean} `true` if the item is in the list, `false` otherwise.\n     * @see R.any\n     * @example\n     *\n     *      R.contains(3, [1, 2, 3]); //=> true\n     *      R.contains(4, [1, 2, 3]); //=> false\n     *      R.contains([42], [[42]]); //=> true\n     */\n    var contains = _curry2(_contains);\n\n    /**\n     * Finds the set (i.e. no duplicates) of all elements in the first list not\n     * contained in the second list.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig [*] -> [*] -> [*]\n     * @param {Array} list1 The first list.\n     * @param {Array} list2 The second list.\n     * @return {Array} The elements in `list1` that are not in `list2`.\n     * @see R.differenceWith\n     * @example\n     *\n     *      R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2]\n     *      R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5]\n     */\n    var difference = _curry2(function difference(first, second) {\n        var out = [];\n        var idx = 0;\n        var firstLen = first.length;\n        while (idx < firstLen) {\n            if (!_contains(first[idx], second) && !_contains(first[idx], out)) {\n                out[out.length] = first[idx];\n            }\n            idx += 1;\n        }\n        return out;\n    });\n\n    /**\n     * Returns a new list without any consecutively repeating elements. `R.equals`\n     * is used to determine equality.\n     *\n     * Dispatches to the `dropRepeats` method of the first argument, if present.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category List\n     * @sig [a] -> [a]\n     * @param {Array} list The array to consider.\n     * @return {Array} `list` without repeating elements.\n     * @see R.transduce\n     * @example\n     *\n     *     R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2]\n     */\n    var dropRepeats = _curry1(_dispatchable('dropRepeats', _xdropRepeatsWith(equals), dropRepeatsWith(equals)));\n\n    /**\n     * \"lifts\" a function of arity > 1 so that it may \"map over\" a list, Function or other\n     * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).\n     *\n     * @func\n     * @memberOf R\n     * @since v0.7.0\n     * @category Function\n     * @sig (*... -> *) -> ([*]... -> [*])\n     * @param {Function} fn The function to lift into higher context\n     * @return {Function} The lifted function.\n     * @see R.liftN\n     * @example\n     *\n     *      var madd3 = R.lift(R.curry((a, b, c) => a + b + c));\n     *\n     *      madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]\n     *\n     *      var madd5 = R.lift(R.curry((a, b, c, d, e) => a + b + c + d + e));\n     *\n     *      madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24]\n     */\n    var lift = _curry1(function lift(fn) {\n        return liftN(fn.length, fn);\n    });\n\n    /**\n     * Returns a partial copy of an object omitting the keys specified.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Object\n     * @sig [String] -> {String: *} -> {String: *}\n     * @param {Array} names an array of String property names to omit from the new object\n     * @param {Object} obj The object to copy from\n     * @return {Object} A new object with properties from `names` not on it.\n     * @see R.pick\n     * @example\n     *\n     *      R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}\n     */\n    var omit = _curry2(function omit(names, obj) {\n        var result = {};\n        for (var prop in obj) {\n            if (!_contains(prop, names)) {\n                result[prop] = obj[prop];\n            }\n        }\n        return result;\n    });\n\n    /**\n     * Returns the left-to-right Kleisli composition of the provided functions,\n     * each of which must return a value of a type supported by [`chain`](#chain).\n     *\n     * `R.pipeK(f, g, h)` is equivalent to `R.pipe(R.chain(f), R.chain(g), R.chain(h))`.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category Function\n     * @sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (m a -> m z)\n     * @param {...Function}\n     * @return {Function}\n     * @see R.composeK\n     * @example\n     *\n     *      //  parseJson :: String -> Maybe *\n     *      //  get :: String -> Object -> Maybe *\n     *\n     *      //  getStateCode :: Maybe String -> Maybe String\n     *      var getStateCode = R.pipeK(\n     *        parseJson,\n     *        get('user'),\n     *        get('address'),\n     *        get('state'),\n     *        R.compose(Maybe.of, R.toUpper)\n     *      );\n     *\n     *      getStateCode(Maybe.of('{\"user\":{\"address\":{\"state\":\"ny\"}}}'));\n     *      //=> Just('NY')\n     *      getStateCode(Maybe.of('[Invalid JSON]'));\n     *      //=> Nothing()\n     */\n    var pipeK = function pipeK() {\n        return composeK.apply(this, reverse(arguments));\n    };\n\n    /**\n     * Returns the string representation of the given value. `eval`'ing the output\n     * should result in a value equivalent to the input value. Many of the built-in\n     * `toString` methods do not satisfy this requirement.\n     *\n     * If the given value is an `[object Object]` with a `toString` method other\n     * than `Object.prototype.toString`, this method is invoked with no arguments\n     * to produce the return value. This means user-defined constructor functions\n     * can provide a suitable `toString` method. For example:\n     *\n     *     function Point(x, y) {\n     *       this.x = x;\n     *       this.y = y;\n     *     }\n     *\n     *     Point.prototype.toString = function() {\n     *       return 'new Point(' + this.x + ', ' + this.y + ')';\n     *     };\n     *\n     *     R.toString(new Point(1, 2)); //=> 'new Point(1, 2)'\n     *\n     * @func\n     * @memberOf R\n     * @since v0.14.0\n     * @category String\n     * @sig * -> String\n     * @param {*} val\n     * @return {String}\n     * @example\n     *\n     *      R.toString(42); //=> '42'\n     *      R.toString('abc'); //=> '\"abc\"'\n     *      R.toString([1, 2, 3]); //=> '[1, 2, 3]'\n     *      R.toString({foo: 1, bar: 2, baz: 3}); //=> '{\"bar\": 2, \"baz\": 3, \"foo\": 1}'\n     *      R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date(\"2001-02-03T04:05:06.000Z\")'\n     */\n    var toString = _curry1(function toString(val) {\n        return _toString(val, []);\n    });\n\n    /**\n     * Returns a new list without values in the first argument.\n     * `R.equals` is used to determine equality.\n     *\n     * Acts as a transducer if a transformer is given in list position.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category List\n     * @sig [a] -> [a] -> [a]\n     * @param {Array} list1 The values to be removed from `list2`.\n     * @param {Array} list2 The array to remove values from.\n     * @return {Array} The new array without values in `list1`.\n     * @see R.transduce\n     * @example\n     *\n     *      R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4]\n     */\n    var without = _curry2(function (xs, list) {\n        return reject(flip(_contains)(xs), list);\n    });\n\n    // A simple Set type that honours R.equals semantics\n    /* globals Set */\n    /**\n       * Combines the logic for checking whether an item is a member of the set and\n       * for adding a new item to the set.\n       *\n       * @param item       The item to check or add to the Set instance.\n       * @param shouldAdd  If true, the item will be added to the set if it doesn't\n       *                   already exist.\n       * @param set        The set instance to check or add to.\n       * @return {boolean} When shouldAdd is true, this will return true when a new\n       *                   item was added otherwise false. When shouldAdd is false,\n       *                   this will return true if the item already exists, otherwise\n       *                   false.\n       */\n    // distinguish between +0 and -0\n    // these types can all utilise Set\n    // set._items['boolean'] holds a two element array\n    // representing [ falseExists, trueExists ]\n    // compare functions for reference equality\n    /* falls through */\n    // reduce the search size of heterogeneous sets by creating buckets\n    // for each type.\n    // scan through all previously applied items\n    var _Set = function () {\n        function _Set() {\n            /* globals Set */\n            this._nativeSet = typeof Set === 'function' ? new Set() : null;\n            this._items = {};\n        }\n        _Set.prototype.add = function (item) {\n            return hasOrAdd(item, true, this);\n        };\n        _Set.prototype.has = function (item) {\n            return hasOrAdd(item, false, this);\n        };\n        /**\n       * Combines the logic for checking whether an item is a member of the set and\n       * for adding a new item to the set.\n       *\n       * @param item       The item to check or add to the Set instance.\n       * @param shouldAdd  If true, the item will be added to the set if it doesn't\n       *                   already exist.\n       * @param set        The set instance to check or add to.\n       * @return {boolean} When shouldAdd is true, this will return true when a new\n       *                   item was added otherwise false. When shouldAdd is false,\n       *                   this will return true if the item already exists, otherwise\n       *                   false.\n       */\n        function hasOrAdd(item, shouldAdd, set) {\n            var type = typeof item;\n            var prevSize, newSize;\n            switch (type) {\n            case 'string':\n            case 'number':\n                // distinguish between +0 and -0\n                if (item === 0 && !set._items['-0'] && 1 / item === -Infinity) {\n                    if (shouldAdd) {\n                        set._items['-0'] = true;\n                    }\n                    return shouldAdd;\n                }\n                // these types can all utilise Set\n                if (set._nativeSet !== null) {\n                    if (shouldAdd) {\n                        prevSize = set._nativeSet.size;\n                        set._nativeSet.add(item);\n                        newSize = set._nativeSet.size;\n                        return newSize > prevSize;\n                    } else {\n                        return set._nativeSet.has(item);\n                    }\n                } else {\n                    if (!(type in set._items)) {\n                        if (shouldAdd) {\n                            set._items[type] = {};\n                            set._items[type][item] = true;\n                        }\n                        return shouldAdd;\n                    } else if (item in set._items[type]) {\n                        return !shouldAdd;\n                    } else {\n                        if (shouldAdd) {\n                            set._items[type][item] = true;\n                        }\n                        return shouldAdd;\n                    }\n                }\n            case 'boolean':\n                // set._items['boolean'] holds a two element array\n                // representing [ falseExists, trueExists ]\n                if (type in set._items) {\n                    var bIdx = item ? 1 : 0;\n                    if (set._items[type][bIdx]) {\n                        return !shouldAdd;\n                    } else {\n                        if (shouldAdd) {\n                            set._items[type][bIdx] = true;\n                        }\n                        return shouldAdd;\n                    }\n                } else {\n                    if (shouldAdd) {\n                        set._items[type] = item ? [\n                            false,\n                            true\n                        ] : [\n                            true,\n                            false\n                        ];\n                    }\n                    return shouldAdd;\n                }\n            case 'function':\n                // compare functions for reference equality\n                if (set._nativeSet !== null) {\n                    if (shouldAdd) {\n                        prevSize = set._nativeSet.size;\n                        set._nativeSet.add(item);\n                        newSize = set._nativeSet.size;\n                        return newSize > prevSize;\n                    } else {\n                        return set._nativeSet.has(item);\n                    }\n                } else {\n                    if (!(type in set._items)) {\n                        if (shouldAdd) {\n                            set._items[type] = [item];\n                        }\n                        return shouldAdd;\n                    }\n                    if (!_contains(item, set._items[type])) {\n                        if (shouldAdd) {\n                            set._items[type].push(item);\n                        }\n                        return shouldAdd;\n                    }\n                }\n                return !shouldAdd;\n            case 'undefined':\n                if (set._items[type]) {\n                    return !shouldAdd;\n                } else {\n                    if (shouldAdd) {\n                        set._items[type] = true;\n                    }\n                    return shouldAdd;\n                }\n            case 'object':\n                if (item === null) {\n                    if (!set._items['null']) {\n                        if (shouldAdd) {\n                            set._items['null'] = true;\n                        }\n                        return shouldAdd;\n                    }\n                    return !shouldAdd;\n                }\n            /* falls through */\n            default:\n                // reduce the search size of heterogeneous sets by creating buckets\n                // for each type.\n                type = Object.prototype.toString.call(item);\n                if (!(type in set._items)) {\n                    if (shouldAdd) {\n                        set._items[type] = [item];\n                    }\n                    return shouldAdd;\n                }\n                // scan through all previously applied items\n                if (!_contains(item, set._items[type])) {\n                    if (shouldAdd) {\n                        set._items[type].push(item);\n                    }\n                    return shouldAdd;\n                }\n                return !shouldAdd;\n            }\n        }\n        return _Set;\n    }();\n\n    /**\n     * A function wrapping calls to the two functions in an `&&` operation,\n     * returning the result of the first function if it is false-y and the result\n     * of the second function otherwise. Note that this is short-circuited,\n     * meaning that the second function will not be invoked if the first returns a\n     * false-y value.\n     *\n     * In addition to functions, `R.both` also accepts any fantasy-land compatible\n     * applicative functor.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category Logic\n     * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)\n     * @param {Function} f a predicate\n     * @param {Function} g another predicate\n     * @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together.\n     * @see R.and\n     * @example\n     *\n     *      var gt10 = x => x > 10;\n     *      var even = x => x % 2 === 0;\n     *      var f = R.both(gt10, even);\n     *      f(100); //=> true\n     *      f(101); //=> false\n     */\n    var both = _curry2(function both(f, g) {\n        return _isFunction(f) ? function _both() {\n            return f.apply(this, arguments) && g.apply(this, arguments);\n        } : lift(and)(f, g);\n    });\n\n    /**\n     * Takes a function `f` and returns a function `g` such that:\n     *\n     *   - applying `g` to zero or more arguments will give __true__ if applying\n     *     the same arguments to `f` gives a logical __false__ value; and\n     *\n     *   - applying `g` to zero or more arguments will give __false__ if applying\n     *     the same arguments to `f` gives a logical __true__ value.\n     *\n     * `R.complement` will work on all other functors as well.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category Logic\n     * @sig (*... -> *) -> (*... -> Boolean)\n     * @param {Function} f\n     * @return {Function}\n     * @see R.not\n     * @example\n     *\n     *      var isEven = n => n % 2 === 0;\n     *      var isOdd = R.complement(isEven);\n     *      isOdd(21); //=> true\n     *      isOdd(42); //=> false\n     */\n    var complement = lift(not);\n\n    /**\n     * A function wrapping calls to the two functions in an `||` operation,\n     * returning the result of the first function if it is truth-y and the result\n     * of the second function otherwise. Note that this is short-circuited,\n     * meaning that the second function will not be invoked if the first returns a\n     * truth-y value.\n     *\n     * In addition to functions, `R.either` also accepts any fantasy-land compatible\n     * applicative functor.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category Logic\n     * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)\n     * @param {Function} f a predicate\n     * @param {Function} g another predicate\n     * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together.\n     * @see R.or\n     * @example\n     *\n     *      var gt10 = x => x > 10;\n     *      var even = x => x % 2 === 0;\n     *      var f = R.either(gt10, even);\n     *      f(101); //=> true\n     *      f(8); //=> true\n     */\n    var either = _curry2(function either(f, g) {\n        return _isFunction(f) ? function _either() {\n            return f.apply(this, arguments) || g.apply(this, arguments);\n        } : lift(or)(f, g);\n    });\n\n    /**\n     * Turns a named method with a specified arity into a function that can be\n     * called directly supplied with arguments and a target object.\n     *\n     * The returned function is curried and accepts `arity + 1` parameters where\n     * the final parameter is the target object.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *)\n     * @param {Number} arity Number of arguments the returned function should take\n     *        before the target object.\n     * @param {String} method Name of the method to call.\n     * @return {Function} A new curried function.\n     * @example\n     *\n     *      var sliceFrom = R.invoker(1, 'slice');\n     *      sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm'\n     *      var sliceFrom6 = R.invoker(2, 'slice')(6);\n     *      sliceFrom6(8, 'abcdefghijklm'); //=> 'gh'\n     */\n    var invoker = _curry2(function invoker(arity, method) {\n        return curryN(arity + 1, function () {\n            var target = arguments[arity];\n            if (target != null && is(Function, target[method])) {\n                return target[method].apply(target, _slice(arguments, 0, arity));\n            }\n            throw new TypeError(toString(target) + ' does not have a method named \"' + method + '\"');\n        });\n    });\n\n    /**\n     * Returns a string made by inserting the `separator` between each element and\n     * concatenating all the elements into a single string.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig String -> [a] -> String\n     * @param {Number|String} separator The string used to separate the elements.\n     * @param {Array} xs The elements to join into a string.\n     * @return {String} str The string made by concatenating `xs` with `separator`.\n     * @see R.split\n     * @example\n     *\n     *      var spacer = R.join(' ');\n     *      spacer(['a', 2, 3.4]);   //=> 'a 2 3.4'\n     *      R.join('|', [1, 2, 3]);    //=> '1|2|3'\n     */\n    var join = invoker(1, 'join');\n\n    /**\n     * Creates a new function that, when invoked, caches the result of calling `fn`\n     * for a given argument set and returns the result. Subsequent calls to the\n     * memoized `fn` with the same argument set will not result in an additional\n     * call to `fn`; instead, the cached result for that set of arguments will be\n     * returned.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Function\n     * @sig (*... -> a) -> (*... -> a)\n     * @param {Function} fn The function to memoize.\n     * @return {Function} Memoized version of `fn`.\n     * @example\n     *\n     *      var count = 0;\n     *      var factorial = R.memoize(n => {\n     *        count += 1;\n     *        return R.product(R.range(1, n + 1));\n     *      });\n     *      factorial(5); //=> 120\n     *      factorial(5); //=> 120\n     *      factorial(5); //=> 120\n     *      count; //=> 1\n     */\n    var memoize = _curry1(function memoize(fn) {\n        var cache = {};\n        return _arity(fn.length, function () {\n            var key = toString(arguments);\n            if (!_has(key, cache)) {\n                cache[key] = fn.apply(this, arguments);\n            }\n            return cache[key];\n        });\n    });\n\n    /**\n     * Splits a string into an array of strings based on the given\n     * separator.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category String\n     * @sig (String | RegExp) -> String -> [String]\n     * @param {String|RegExp} sep The pattern.\n     * @param {String} str The string to separate into an array.\n     * @return {Array} The array of strings from `str` separated by `str`.\n     * @see R.join\n     * @example\n     *\n     *      var pathComponents = R.split('/');\n     *      R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node']\n     *\n     *      R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd']\n     */\n    var split = invoker(1, 'split');\n\n    /**\n     * Determines whether a given string matches a given regular expression.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.12.0\n     * @category String\n     * @sig RegExp -> String -> Boolean\n     * @param {RegExp} pattern\n     * @param {String} str\n     * @return {Boolean}\n     * @see R.match\n     * @example\n     *\n     *      R.test(/^x/, 'xyz'); //=> true\n     *      R.test(/^y/, 'xyz'); //=> false\n     */\n    var test = _curry2(function test(pattern, str) {\n        if (!_isRegExp(pattern)) {\n            throw new TypeError('\\u2018test\\u2019 requires a value of type RegExp as its first argument; received ' + toString(pattern));\n        }\n        return _cloneRegExp(pattern).test(str);\n    });\n\n    /**\n     * The lower case version of a string.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category String\n     * @sig String -> String\n     * @param {String} str The string to lower case.\n     * @return {String} The lower case version of `str`.\n     * @see R.toUpper\n     * @example\n     *\n     *      R.toLower('XYZ'); //=> 'xyz'\n     */\n    var toLower = invoker(0, 'toLowerCase');\n\n    /**\n     * The upper case version of a string.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.9.0\n     * @category String\n     * @sig String -> String\n     * @param {String} str The string to upper case.\n     * @return {String} The upper case version of `str`.\n     * @see R.toLower\n     * @example\n     *\n     *      R.toUpper('abc'); //=> 'ABC'\n     */\n    var toUpper = invoker(0, 'toUpperCase');\n\n    /**\n     * Returns a new list containing only one copy of each element in the original\n     * list, based upon the value returned by applying the supplied function to\n     * each list element. Prefers the first item if the supplied function produces\n     * the same value on two items. `R.equals` is used for comparison.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.16.0\n     * @category List\n     * @sig (a -> b) -> [a] -> [a]\n     * @param {Function} fn A function used to produce a value to use during comparisons.\n     * @param {Array} list The array to consider.\n     * @return {Array} The list of unique items.\n     * @example\n     *\n     *      R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10]\n     */\n    var uniqBy = _curry2(function uniqBy(fn, list) {\n        var set = new _Set();\n        var result = [];\n        var idx = 0;\n        var appliedItem, item;\n        while (idx < list.length) {\n            item = list[idx];\n            appliedItem = fn(item);\n            if (set.add(appliedItem)) {\n                result.push(item);\n            }\n            idx += 1;\n        }\n        return result;\n    });\n\n    /**\n     * Returns the result of concatenating the given lists or strings.\n     *\n     * Dispatches to the `concat` method of the first argument, if present.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> [a] -> [a]\n     * @sig String -> String -> String\n     * @param {Array|String} a\n     * @param {Array|String} b\n     * @return {Array|String}\n     *\n     * @example\n     *\n     *      R.concat([], []); //=> []\n     *      R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]\n     *      R.concat('ABC', 'DEF'); // 'ABCDEF'\n     */\n    var concat = flip(invoker(1, 'concat'));\n\n    /**\n     * Finds the set (i.e. no duplicates) of all elements contained in the first or\n     * second list, but not both.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category Relation\n     * @sig [*] -> [*] -> [*]\n     * @param {Array} list1 The first list.\n     * @param {Array} list2 The second list.\n     * @return {Array} The elements in `list1` or `list2`, but not both.\n     * @see R.symmetricDifferenceWith\n     * @example\n     *\n     *      R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5]\n     *      R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2]\n     */\n    var symmetricDifference = _curry2(function symmetricDifference(list1, list2) {\n        return concat(difference(list1, list2), difference(list2, list1));\n    });\n\n    /**\n     * Finds the set (i.e. no duplicates) of all elements contained in the first or\n     * second list, but not both. Duplication is determined according to the value\n     * returned by applying the supplied predicate to two list elements.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.19.0\n     * @category Relation\n     * @sig (a -> a -> Boolean) -> [a] -> [a] -> [a]\n     * @param {Function} pred A predicate used to test whether two items are equal.\n     * @param {Array} list1 The first list.\n     * @param {Array} list2 The second list.\n     * @return {Array} The elements in `list1` or `list2`, but not both.\n     * @see R.symmetricDifference\n     * @example\n     *\n     *      var eqA = R.eqBy(R.prop('a'));\n     *      var l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}];\n     *      var l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}];\n     *      R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}]\n     */\n    var symmetricDifferenceWith = _curry3(function symmetricDifferenceWith(pred, list1, list2) {\n        return concat(differenceWith(pred, list1, list2), differenceWith(pred, list2, list1));\n    });\n\n    /**\n     * Returns a new list containing only one copy of each element in the original\n     * list. `R.equals` is used to determine equality.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category List\n     * @sig [a] -> [a]\n     * @param {Array} list The array to consider.\n     * @return {Array} The list of unique items.\n     * @example\n     *\n     *      R.uniq([1, 1, 2, 1]); //=> [1, 2]\n     *      R.uniq([1, '1']);     //=> [1, '1']\n     *      R.uniq([[42], [42]]); //=> [[42]]\n     */\n    var uniq = uniqBy(identity);\n\n    /**\n     * Combines two lists into a set (i.e. no duplicates) composed of those\n     * elements common to both lists.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig [*] -> [*] -> [*]\n     * @param {Array} list1 The first list.\n     * @param {Array} list2 The second list.\n     * @return {Array} The list of elements found in both `list1` and `list2`.\n     * @see R.intersectionWith\n     * @example\n     *\n     *      R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3]\n     */\n    var intersection = _curry2(function intersection(list1, list2) {\n        var lookupList, filteredList;\n        if (list1.length > list2.length) {\n            lookupList = list1;\n            filteredList = list2;\n        } else {\n            lookupList = list2;\n            filteredList = list1;\n        }\n        return uniq(_filter(flip(_contains)(lookupList), filteredList));\n    });\n\n    /**\n     * Combines two lists into a set (i.e. no duplicates) composed of the elements\n     * of each list.\n     *\n     * @func\n     * @memberOf R\n     * @since v0.1.0\n     * @category Relation\n     * @sig [*] -> [*] -> [*]\n     * @param {Array} as The first list.\n     * @param {Array} bs The second list.\n     * @return {Array} The first and second lists concatenated, with\n     *         duplicates removed.\n     * @example\n     *\n     *      R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4]\n     */\n    var union = _curry2(compose(uniq, _concat));\n\n    var R = {\n        F: F,\n        T: T,\n        __: __,\n        add: add,\n        addIndex: addIndex,\n        adjust: adjust,\n        all: all,\n        allPass: allPass,\n        allUniq: allUniq,\n        always: always,\n        and: and,\n        any: any,\n        anyPass: anyPass,\n        ap: ap,\n        aperture: aperture,\n        append: append,\n        apply: apply,\n        applySpec: applySpec,\n        assoc: assoc,\n        assocPath: assocPath,\n        binary: binary,\n        bind: bind,\n        both: both,\n        call: call,\n        chain: chain,\n        clamp: clamp,\n        clone: clone,\n        comparator: comparator,\n        complement: complement,\n        compose: compose,\n        composeK: composeK,\n        composeP: composeP,\n        concat: concat,\n        cond: cond,\n        construct: construct,\n        constructN: constructN,\n        contains: contains,\n        converge: converge,\n        countBy: countBy,\n        curry: curry,\n        curryN: curryN,\n        dec: dec,\n        defaultTo: defaultTo,\n        difference: difference,\n        differenceWith: differenceWith,\n        dissoc: dissoc,\n        dissocPath: dissocPath,\n        divide: divide,\n        drop: drop,\n        dropLast: dropLast,\n        dropLastWhile: dropLastWhile,\n        dropRepeats: dropRepeats,\n        dropRepeatsWith: dropRepeatsWith,\n        dropWhile: dropWhile,\n        either: either,\n        empty: empty,\n        eqBy: eqBy,\n        eqProps: eqProps,\n        equals: equals,\n        evolve: evolve,\n        filter: filter,\n        find: find,\n        findIndex: findIndex,\n        findLast: findLast,\n        findLastIndex: findLastIndex,\n        flatten: flatten,\n        flip: flip,\n        forEach: forEach,\n        fromPairs: fromPairs,\n        groupBy: groupBy,\n        groupWith: groupWith,\n        gt: gt,\n        gte: gte,\n        has: has,\n        hasIn: hasIn,\n        head: head,\n        identical: identical,\n        identity: identity,\n        ifElse: ifElse,\n        inc: inc,\n        indexBy: indexBy,\n        indexOf: indexOf,\n        init: init,\n        insert: insert,\n        insertAll: insertAll,\n        intersection: intersection,\n        intersectionWith: intersectionWith,\n        intersperse: intersperse,\n        into: into,\n        invert: invert,\n        invertObj: invertObj,\n        invoker: invoker,\n        is: is,\n        isArrayLike: isArrayLike,\n        isEmpty: isEmpty,\n        isNil: isNil,\n        join: join,\n        juxt: juxt,\n        keys: keys,\n        keysIn: keysIn,\n        last: last,\n        lastIndexOf: lastIndexOf,\n        length: length,\n        lens: lens,\n        lensIndex: lensIndex,\n        lensPath: lensPath,\n        lensProp: lensProp,\n        lift: lift,\n        liftN: liftN,\n        lt: lt,\n        lte: lte,\n        map: map,\n        mapAccum: mapAccum,\n        mapAccumRight: mapAccumRight,\n        mapObjIndexed: mapObjIndexed,\n        match: match,\n        mathMod: mathMod,\n        max: max,\n        maxBy: maxBy,\n        mean: mean,\n        median: median,\n        memoize: memoize,\n        merge: merge,\n        mergeAll: mergeAll,\n        mergeWith: mergeWith,\n        mergeWithKey: mergeWithKey,\n        min: min,\n        minBy: minBy,\n        modulo: modulo,\n        multiply: multiply,\n        nAry: nAry,\n        negate: negate,\n        none: none,\n        not: not,\n        nth: nth,\n        nthArg: nthArg,\n        objOf: objOf,\n        of: of,\n        omit: omit,\n        once: once,\n        or: or,\n        over: over,\n        pair: pair,\n        partial: partial,\n        partialRight: partialRight,\n        partition: partition,\n        path: path,\n        pathEq: pathEq,\n        pathOr: pathOr,\n        pathSatisfies: pathSatisfies,\n        pick: pick,\n        pickAll: pickAll,\n        pickBy: pickBy,\n        pipe: pipe,\n        pipeK: pipeK,\n        pipeP: pipeP,\n        pluck: pluck,\n        prepend: prepend,\n        product: product,\n        project: project,\n        prop: prop,\n        propEq: propEq,\n        propIs: propIs,\n        propOr: propOr,\n        propSatisfies: propSatisfies,\n        props: props,\n        range: range,\n        reduce: reduce,\n        reduceBy: reduceBy,\n        reduceRight: reduceRight,\n        reduced: reduced,\n        reject: reject,\n        remove: remove,\n        repeat: repeat,\n        replace: replace,\n        reverse: reverse,\n        scan: scan,\n        sequence: sequence,\n        set: set,\n        slice: slice,\n        sort: sort,\n        sortBy: sortBy,\n        split: split,\n        splitAt: splitAt,\n        splitEvery: splitEvery,\n        splitWhen: splitWhen,\n        subtract: subtract,\n        sum: sum,\n        symmetricDifference: symmetricDifference,\n        symmetricDifferenceWith: symmetricDifferenceWith,\n        tail: tail,\n        take: take,\n        takeLast: takeLast,\n        takeLastWhile: takeLastWhile,\n        takeWhile: takeWhile,\n        tap: tap,\n        test: test,\n        times: times,\n        toLower: toLower,\n        toPairs: toPairs,\n        toPairsIn: toPairsIn,\n        toString: toString,\n        toUpper: toUpper,\n        transduce: transduce,\n        transpose: transpose,\n        traverse: traverse,\n        trim: trim,\n        tryCatch: tryCatch,\n        type: type,\n        unapply: unapply,\n        unary: unary,\n        uncurryN: uncurryN,\n        unfold: unfold,\n        union: union,\n        unionWith: unionWith,\n        uniq: uniq,\n        uniqBy: uniqBy,\n        uniqWith: uniqWith,\n        unless: unless,\n        unnest: unnest,\n        until: until,\n        update: update,\n        useWith: useWith,\n        values: values,\n        valuesIn: valuesIn,\n        view: view,\n        when: when,\n        where: where,\n        whereEq: whereEq,\n        without: without,\n        wrap: wrap,\n        xprod: xprod,\n        zip: zip,\n        zipObj: zipObj,\n        zipWith: zipWith\n    };\n  /* eslint-env amd */\n\n  /* TEST_ENTRY_POINT */\n\n  if (true) {\n    module.exports = R;\n  } else if (typeof define === 'function' && define.amd) {\n    define(function() { return R; });\n  } else {\n    this.R = R;\n  }\n\n}.call(this));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/ramda/dist/ramda.js\n ** module id = 4\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/ramda/dist/ramda.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.Observable = undefined;\nexports.createAction = createAction;\nexports.combineLatestObj = combineLatestObj;\nexports.replicateStream = replicateStream;\nexports.mergeActionsByName = mergeActionsByName;\nexports.logNext = logNext;\nexports.logError = logError;\nexports.onDone = onDone;\nexports.preventDefault = preventDefault;\nexports.formatData = formatData;\nexports.isTextNotEmpty = isTextNotEmpty;\nexports.exists = exists;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar Subject = _rx2.default.Subject;\nvar merge = _rx2.default.Observable.merge;\n\n/* create an action that is both an observable AND\na function/callable*/\nfunction createAction(paramsMap) {\n  function action(params) {\n    // use rest parameters or not ? ...params\n    if (paramsMap && typeof paramsMap === 'function') {\n      params = paramsMap(params);\n    }\n    action.onNext(params);\n  }\n  // assign prototype stuff from Subject\n  for (var key in _rx2.default.Subject.prototype) {\n    action[key] = _rx2.default.Subject.prototype[key];\n  }\n\n  _rx2.default.Subject.call(action);\n\n  return action;\n}\n\n/* From https://github.com/staltz/combineLatestObj*/\nfunction combineLatestObj(obj) {\n  var sources = [];\n  var keys = [];\n  for (var key in obj) {\n    if (obj.hasOwnProperty(key)) {\n      keys.push(key.replace(/\\$$/, ''));\n      sources.push(obj[key]);\n    }\n  }\n  return _rx2.default.Observable.combineLatest(sources, function () {\n    var argsLength = arguments.length;\n    var combination = {};\n    for (var i = argsLength - 1; i >= 0; i--) {\n      combination[keys[i]] = arguments[i];\n    }\n    return combination;\n  });\n}\n\n// From https://github.com/futurice/power-ui/blob/85d09645ecadc85bc753ba42fdd841d22d8bdd10/src/utils.js\nfunction replicateStream(origin$, proxy$) {\n  origin$.subscribe(proxy$.asObserver());\n}\n\n/* merges an array of action objects into a single object :ie\n [{doBar$, doFoo$}, {doBaz$, doBar$}] => {doBar$, doFoo$, doBaz$}\n*/\nfunction mergeActionsByName(actionSources) {\n  var validActions = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];\n\n  return actionSources.reduce(function (result, actions) {\n    // console.log(\"acions\",Object.keys(actions),validActions)\n    Object.keys(actions).filter(function (key) {\n      return validActions.length === 0 || validActions.indexOf(key.replace('$', '')) > -1;\n    }).map(function (key) {\n      var action = actions[key];\n      if (key in result) {\n        result[key] = merge(result[key], action);\n      } else {\n        result[key] = action;\n      }\n    });\n\n    return result;\n  }, {});\n}\n\nfunction logNext(next) {\n  log.info(next);\n}\nfunction logError(err) {\n  log.error(err);\n}\nfunction onDone(data) {\n  log.info('DONE', data);\n}\n\nfunction preventDefault(event) {\n  event.preventDefault();\n  return event;\n}\n\nfunction formatData(data, type) {\n  return { data: data, type: type };\n}\n\nfunction isTextNotEmpty(text) {\n  return text !== '';\n}\n\nfunction exists(input) {\n  return input !== null && input !== undefined;\n}\n\nObservable.prototype.onlyWhen = function (observable, selector) {\n  return this.withLatestFrom(observable, function (self, other) {\n    /*console.log(\"here in onlyWhen\",self,other);*/return [self, other];\n  }).filter(function (args) {\n    return selector(args[1]);\n  }).map(function (data) {\n    return data[0];\n  });\n};\n\nexports.Observable = Observable;\n\n// utility to run multiple ones in parallel, see here :\n// https://github.com/Reactive-Extensions/RxJS/blob/master/doc/mapping/async/comparing.md#asyncparallel\n\nfunction wrapArrayParallel(items) {\n  // let __items = Rx.Observable.from()\n  return _rx2.default.Observable.forkJoin.apply(null, items);\n}\n\n/*TODO: implement, we need to find a way to do inverted filtering*/\nfunction opposite(method) {}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/obsUtils.js\n ** module id = 5\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/obsUtils.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.mergeData = mergeData;\nexports.applyDefaults = applyDefaults;\nexports.applyTransform = applyTransform;\nexports.makeModifications = makeModifications;\nexports.smartStateFold = smartStateFold;\nexports.makeModel = makeModel;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar merge = _Rx$Observable.merge;\nvar just = _Rx$Observable.just;\n\n// import Immutable from 'seamless-immutable'\n// hack stand in as we don't really need any immutable lib\n\nfunction Immutable() {}\n\n// faster object.assign\n\n// TODO: this needs to be an external lib, for re-use\n// merge the current data with any number of input data\nfunction mergeData(currentData) {\n  for (var _len = arguments.length, inputs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n    inputs[_key - 1] = arguments[_key];\n  }\n\n  if ('merge' in currentData) {\n    return currentData.merge(inputs);\n  }\n  return _assign2.default.apply(undefined, [{}, currentData].concat(inputs));\n}\n\n// need to make sure source data structure is right\nfunction applyDefaults(data$, defaults) {\n  return data$.map(function (data) {\n    return mergeData(defaults, data);\n  });\n}\n\n// need to make sure the \"type\" (immutable) is right\nfunction applyTransform(data$, transform) {\n  return data$.map(function (data) {\n    return transform(data);\n  });\n}\n\nfunction logHistory(currentData, history) {\n  var past = [currentData].concat(history.past);\n  var future = [];\n\n  console.log('currentData', past);\n  history = mergeData(history, { past: past, future: future });\n  return history;\n}\n\n// history\nfunction makeUndoMod$(actions) {\n  return actions.undo$.map(function (toggleInfo) {\n    return function (_ref) {\n      var state = _ref.state;\n      var history = _ref.history;\n\n      console.log('Undoing');\n\n      var nState = history.past[0];\n      var past = history.past.slice(1);\n      var future = [state].concat(history.future);\n\n      history = mergeData(history, { past: past, future: future });\n\n      return Immutable({ state: nState, history: history });\n    };\n  });\n}\n\nfunction makeRedoMod$(actions) {\n  return actions.redo$.map(function (toggleInfo) {\n    return function (_ref2) {\n      var state = _ref2.state;\n      var history = _ref2.history;\n\n      console.log('Redoing');\n\n      var nState = history.future[0];\n      var past = [state].concat(history.past);\n      var future = history.future.slice(1);\n\n      history = mergeData(history, { past: past, future: future });\n\n      return Immutable({ state: nState, history: history });\n    };\n  });\n}\n\nvar transform = Immutable;\n\nfunction makeModifications(actions, updateFns, options) {\n  var mods$ = Object.keys(actions).map(function (key) {\n    var op = actions[key];\n    var opName = key.replace(/\\$/g, '');\n    var modFn = updateFns[opName];\n\n    // FIXME: how to make this better?\n    if (opName === 'undo') return makeUndoMod$(actions);\n    if (opName === 'redo') return makeRedoMod$(actions);\n\n    // here is where the \"magic happens\"\n    // for each \"operation/action\" we map it to an observable with history & state\n\n    // console.log(\"op\",op,\"opName\",opName,\"modFn\",modFn)\n    if (modFn && op) {\n      var mod$ = op.map(function (input) {\n        return function (state) {\n          if (options.history) {\n            var _history = logHistory(state, state.history);\n          }\n          state = modFn(state, input); // call the adapted function\n\n          if (options.history) {\n            state = { state: state, history: history };\n          }\n\n          if (options.doApplyTransform) {\n            // if we need to coerce data  to immutable etc\n            state = transform(state);\n          }\n\n          return state;\n        };\n      });\n\n      return mod$;\n    }\n  }).filter(function (e) {\n    return e !== undefined;\n  });\n\n  return merge(mods$);\n}\n\n// from futurice/power-ui\n/**\n* smartStateFold is supposed to be given as the argument a\n* `scan` operation over a stream of state|updateFn. State is\n* expected to be an object, and updateFn is a function that\n* takes old state and produces new state.\n* Example:\n* --s0---fn1----fn2----s10------>\n*      scan(smartStateFold)\n* --s0---s1-----s2-----s10------>\n*\n* where s1 = fn1(s0)\n* where s2 = fn2(s1)\n*/\nfunction smartStateFold(prev, curr) {\n  // console.log(\"prev\",prev,\"cur\",curr)\n  if (typeof curr === 'function') {\n    return curr(prev);\n  } else if (typeof curr === 'function') {\n    return prev(curr);\n  } else {\n    return prev;\n  }\n}\n\nfunction makeModel(defaults, updateFns, actions, source) {\n  var options = arguments.length <= 4 || arguments[4] === undefined ? { doApplyTransform: false } : arguments[4];\n\n  var mods$ = makeModifications(actions, updateFns, options);\n\n  // console.log(\"defaults\",defaults)\n  var source$ = source || just(defaults);\n  //  .tap(e=>console.log(\"source\",e))\n\n  source$ = applyDefaults(source$, defaults);\n\n  if (options.doApplyTransform) {\n    source$ = applyTransform(source$, transform);\n  }\n\n  return mods$.merge(source$).scan(smartStateFold, defaults) // combine existing data with new one\n  // .distinctUntilChanged()\n  .shareReplay(1);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/modelUtils.js\n ** module id = 6\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/modelUtils.js?")},function(module,exports){eval('/*\r\n	MIT License http://www.opensource.org/licenses/mit-license.php\r\n	Author Tobias Koppers @sokra\r\n*/\r\n// css base code, injected by the css-loader\r\nmodule.exports = function() {\r\n	var list = [];\r\n\r\n	// return the list of modules as css string\r\n	list.toString = function toString() {\r\n		var result = [];\r\n		for(var i = 0; i < this.length; i++) {\r\n			var item = this[i];\r\n			if(item[2]) {\r\n				result.push("@media " + item[2] + "{" + item[1] + "}");\r\n			} else {\r\n				result.push(item[1]);\r\n			}\r\n		}\r\n		return result.join("");\r\n	};\r\n\r\n	// import a list of modules into the list\r\n	list.i = function(modules, mediaQuery) {\r\n		if(typeof modules === "string")\r\n			modules = [[null, modules, ""]];\r\n		var alreadyImportedModules = {};\r\n		for(var i = 0; i < this.length; i++) {\r\n			var id = this[i][0];\r\n			if(typeof id === "number")\r\n				alreadyImportedModules[id] = true;\r\n		}\r\n		for(i = 0; i < modules.length; i++) {\r\n			var item = modules[i];\r\n			// skip already imported module\r\n			// this implementation is not 100% perfect for weird media query combinations\r\n			//  when a module is imported multiple times with different media queries.\r\n			//  I hope this will never occur (Hey this way we have smaller bundles)\r\n			if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {\r\n				if(mediaQuery && !item[2]) {\r\n					item[2] = mediaQuery;\r\n				} else if(mediaQuery) {\r\n					item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";\r\n				}\r\n				list.push(item);\r\n			}\r\n		}\r\n	};\r\n	return list;\r\n};\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader/lib/css-base.js\n ** module id = 7\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/css-loader/lib/css-base.js?')},function(module,exports){eval("'use strict';\n\n/**\n * Analogue of Object.assign().\n * Copies properties from one or more source objects to\n * a target object. Existing keys on the target object will be overwritten.\n *\n * > Note: This differs from spec in some important ways:\n * > 1. Will throw if passed non-objects, including `undefined` or `null` values.\n * > 2. Does not support the curious Exception handling behavior, exceptions are thrown immediately.\n * > For more details, see:\n * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n *\n *\n *\n * @param  {Object} target      The target object to copy properties to.\n * @param  {Object} source, ... The source(s) to copy properties from.\n * @return {Object}             The updated target object.\n */\nmodule.exports = function fastAssign (target) {\n  var totalArgs = arguments.length,\n      source, i, totalKeys, keys, key, j;\n\n  for (i = 1; i < totalArgs; i++) {\n    source = arguments[i];\n    keys = Object.keys(source);\n    totalKeys = keys.length;\n    for (j = 0; j < totalKeys; j++) {\n      key = keys[j];\n      target[key] = source[key];\n    }\n  }\n  return target;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/fast.js/object/assign.js\n ** module id = 8\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/fast.js/object/assign.js?")},function(module,exports){eval("\"use strict\";\r\n\r\nvar SVGNS = 'http://www.w3.org/2000/svg';    \r\nvar modulesNS = ['hook', 'on', 'style', 'class', 'props', 'attrs'];\r\nvar slice = Array.prototype.slice;\r\n\r\nfunction isPrimitive(val) {\r\n  return  typeof val === 'string'   ||\r\n          typeof val === 'number'   ||\r\n          typeof val === 'boolean'  ||\r\n          typeof val === 'symbol'   ||\r\n          val === null              ||\r\n          val === undefined;\r\n}\r\n\r\nfunction normalizeAttrs(attrs, nsURI, defNS, modules) {\r\n  var map = { ns: nsURI };\r\n  for (var i = 0, len = modules.length; i < len; i++) {\r\n    var mod = modules[i];\r\n    if(attrs[mod])\r\n      map[mod] = attrs[mod];\r\n  }\r\n  for(var key in attrs) {\r\n    if(key !== 'key' && key !== 'classNames' && key !== 'selector') {\r\n      var idx = key.indexOf('-');\r\n      if(idx > 0)\r\n        addAttr(key.slice(0, idx), key.slice(idx+1), attrs[key]);\r\n      else if(!map[key])\r\n        addAttr(defNS, key, attrs[key]);\r\n    }\r\n  }\r\n  return map;\r\n\r\n  function addAttr(namespace, key, val) {\r\n    var ns = map[namespace] || (map[namespace] = {});\r\n    ns[key] = val;\r\n  }\r\n}\r\n\r\nfunction buildFromStringTag(nsURI, defNS, modules, tag, attrs, children) {\r\n\r\n  if(attrs.selector) {\r\n    tag = tag + attrs.selector;\r\n  }\r\n  if(attrs.classNames) {\r\n    var cns = attrs.classNames;\r\n    tag = tag + '.' + (\r\n      Array.isArray(cns) ? cns.join('.') : cns.replace(/\\s+/g, '.')\r\n    );\r\n  }\r\n\r\n  return {\r\n    sel       : tag,\r\n    data      : normalizeAttrs(attrs, nsURI, defNS, modules),\r\n    children  : children.map( function(c) {\r\n      return isPrimitive(c) ? {text: c} : c;\r\n    }),\r\n    key: attrs.key\r\n  };\r\n}\r\n\r\nfunction buildFromComponent(nsURI, defNS, modules, tag, attrs, children) {\r\n  var res;\r\n  if(typeof tag === 'function')\r\n    res = tag(attrs, children);\r\n  else if(tag && typeof tag.view === 'function')\r\n    res = tag.view(attrs, children);\r\n  else if(tag && typeof tag.render === 'function')\r\n    res = tag.render(attrs, children);\r\n  else\r\n    throw \"JSX tag must be either a string, a function or an object with 'view' or 'render' methods\";\r\n  res.key = attrs.key;\r\n  return res;\r\n}\r\n\r\nfunction buildVnode(nsURI, defNS, modules, tag, attrs, children) {\r\n  attrs = attrs || {};\r\n  if(typeof tag === 'string') {\r\n    return buildFromStringTag(nsURI, defNS, modules, tag, attrs, children)\r\n  } else {\r\n    return buildFromComponent(nsURI, defNS, modules, tag, attrs, children)\r\n  }\r\n}\r\n\r\nfunction JSX(nsURI, defNS, modules) {\r\n  return function jsxWithCustomNS(tag, attrs, children) {\r\n    if(arguments.length > 3 || !Array.isArray(children))\r\n      children = slice.call(arguments, 2);\r\n    return buildVnode(nsURI, defNS || 'props', modules || modulesNS, tag, attrs, children);\r\n  };\r\n}\r\n\r\nmodule.exports = {\r\n  html: JSX(undefined),\r\n  svg: JSX(SVGNS, 'attrs'),\r\n  JSX: JSX\r\n};\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-jsx/snabbdom-jsx.js\n ** module id = 9\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-jsx/snabbdom-jsx.js?")},function(module,exports,__webpack_require__){eval('/*\r\n	MIT License http://www.opensource.org/licenses/mit-license.php\r\n	Author Tobias Koppers @sokra\r\n*/\r\nvar stylesInDom = {},\r\n	memoize = function(fn) {\r\n		var memo;\r\n		return function () {\r\n			if (typeof memo === "undefined") memo = fn.apply(this, arguments);\r\n			return memo;\r\n		};\r\n	},\r\n	isOldIE = memoize(function() {\r\n		return /msie [6-9]\\b/.test(window.navigator.userAgent.toLowerCase());\r\n	}),\r\n	getHeadElement = memoize(function () {\r\n		return document.head || document.getElementsByTagName("head")[0];\r\n	}),\r\n	singletonElement = null,\r\n	singletonCounter = 0,\r\n	styleElementsInsertedAtTop = [];\r\n\r\nmodule.exports = function(list, options) {\r\n	if(false) {\r\n		if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");\r\n	}\r\n\r\n	options = options || {};\r\n	// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\r\n	// tags it will allow on a page\r\n	if (typeof options.singleton === "undefined") options.singleton = isOldIE();\r\n\r\n	// By default, add <style> tags to the bottom of <head>.\r\n	if (typeof options.insertAt === "undefined") options.insertAt = "bottom";\r\n\r\n	var styles = listToStyles(list);\r\n	addStylesToDom(styles, options);\r\n\r\n	return function update(newList) {\r\n		var mayRemove = [];\r\n		for(var i = 0; i < styles.length; i++) {\r\n			var item = styles[i];\r\n			var domStyle = stylesInDom[item.id];\r\n			domStyle.refs--;\r\n			mayRemove.push(domStyle);\r\n		}\r\n		if(newList) {\r\n			var newStyles = listToStyles(newList);\r\n			addStylesToDom(newStyles, options);\r\n		}\r\n		for(var i = 0; i < mayRemove.length; i++) {\r\n			var domStyle = mayRemove[i];\r\n			if(domStyle.refs === 0) {\r\n				for(var j = 0; j < domStyle.parts.length; j++)\r\n					domStyle.parts[j]();\r\n				delete stylesInDom[domStyle.id];\r\n			}\r\n		}\r\n	};\r\n}\r\n\r\nfunction addStylesToDom(styles, options) {\r\n	for(var i = 0; i < styles.length; i++) {\r\n		var item = styles[i];\r\n		var domStyle = stylesInDom[item.id];\r\n		if(domStyle) {\r\n			domStyle.refs++;\r\n			for(var j = 0; j < domStyle.parts.length; j++) {\r\n				domStyle.parts[j](item.parts[j]);\r\n			}\r\n			for(; j < item.parts.length; j++) {\r\n				domStyle.parts.push(addStyle(item.parts[j], options));\r\n			}\r\n		} else {\r\n			var parts = [];\r\n			for(var j = 0; j < item.parts.length; j++) {\r\n				parts.push(addStyle(item.parts[j], options));\r\n			}\r\n			stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};\r\n		}\r\n	}\r\n}\r\n\r\nfunction listToStyles(list) {\r\n	var styles = [];\r\n	var newStyles = {};\r\n	for(var i = 0; i < list.length; i++) {\r\n		var item = list[i];\r\n		var id = item[0];\r\n		var css = item[1];\r\n		var media = item[2];\r\n		var sourceMap = item[3];\r\n		var part = {css: css, media: media, sourceMap: sourceMap};\r\n		if(!newStyles[id])\r\n			styles.push(newStyles[id] = {id: id, parts: [part]});\r\n		else\r\n			newStyles[id].parts.push(part);\r\n	}\r\n	return styles;\r\n}\r\n\r\nfunction insertStyleElement(options, styleElement) {\r\n	var head = getHeadElement();\r\n	var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];\r\n	if (options.insertAt === "top") {\r\n		if(!lastStyleElementInsertedAtTop) {\r\n			head.insertBefore(styleElement, head.firstChild);\r\n		} else if(lastStyleElementInsertedAtTop.nextSibling) {\r\n			head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);\r\n		} else {\r\n			head.appendChild(styleElement);\r\n		}\r\n		styleElementsInsertedAtTop.push(styleElement);\r\n	} else if (options.insertAt === "bottom") {\r\n		head.appendChild(styleElement);\r\n	} else {\r\n		throw new Error("Invalid value for parameter \'insertAt\'. Must be \'top\' or \'bottom\'.");\r\n	}\r\n}\r\n\r\nfunction removeStyleElement(styleElement) {\r\n	styleElement.parentNode.removeChild(styleElement);\r\n	var idx = styleElementsInsertedAtTop.indexOf(styleElement);\r\n	if(idx >= 0) {\r\n		styleElementsInsertedAtTop.splice(idx, 1);\r\n	}\r\n}\r\n\r\nfunction createStyleElement(options) {\r\n	var styleElement = document.createElement("style");\r\n	styleElement.type = "text/css";\r\n	insertStyleElement(options, styleElement);\r\n	return styleElement;\r\n}\r\n\r\nfunction createLinkElement(options) {\r\n	var linkElement = document.createElement("link");\r\n	linkElement.rel = "stylesheet";\r\n	insertStyleElement(options, linkElement);\r\n	return linkElement;\r\n}\r\n\r\nfunction addStyle(obj, options) {\r\n	var styleElement, update, remove;\r\n\r\n	if (options.singleton) {\r\n		var styleIndex = singletonCounter++;\r\n		styleElement = singletonElement || (singletonElement = createStyleElement(options));\r\n		update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);\r\n		remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);\r\n	} else if(obj.sourceMap &&\r\n		typeof URL === "function" &&\r\n		typeof URL.createObjectURL === "function" &&\r\n		typeof URL.revokeObjectURL === "function" &&\r\n		typeof Blob === "function" &&\r\n		typeof btoa === "function") {\r\n		styleElement = createLinkElement(options);\r\n		update = updateLink.bind(null, styleElement);\r\n		remove = function() {\r\n			removeStyleElement(styleElement);\r\n			if(styleElement.href)\r\n				URL.revokeObjectURL(styleElement.href);\r\n		};\r\n	} else {\r\n		styleElement = createStyleElement(options);\r\n		update = applyToTag.bind(null, styleElement);\r\n		remove = function() {\r\n			removeStyleElement(styleElement);\r\n		};\r\n	}\r\n\r\n	update(obj);\r\n\r\n	return function updateStyle(newObj) {\r\n		if(newObj) {\r\n			if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)\r\n				return;\r\n			update(obj = newObj);\r\n		} else {\r\n			remove();\r\n		}\r\n	};\r\n}\r\n\r\nvar replaceText = (function () {\r\n	var textStore = [];\r\n\r\n	return function (index, replacement) {\r\n		textStore[index] = replacement;\r\n		return textStore.filter(Boolean).join(\'\\n\');\r\n	};\r\n})();\r\n\r\nfunction applyToSingletonTag(styleElement, index, remove, obj) {\r\n	var css = remove ? "" : obj.css;\r\n\r\n	if (styleElement.styleSheet) {\r\n		styleElement.styleSheet.cssText = replaceText(index, css);\r\n	} else {\r\n		var cssNode = document.createTextNode(css);\r\n		var childNodes = styleElement.childNodes;\r\n		if (childNodes[index]) styleElement.removeChild(childNodes[index]);\r\n		if (childNodes.length) {\r\n			styleElement.insertBefore(cssNode, childNodes[index]);\r\n		} else {\r\n			styleElement.appendChild(cssNode);\r\n		}\r\n	}\r\n}\r\n\r\nfunction applyToTag(styleElement, obj) {\r\n	var css = obj.css;\r\n	var media = obj.media;\r\n\r\n	if(media) {\r\n		styleElement.setAttribute("media", media)\r\n	}\r\n\r\n	if(styleElement.styleSheet) {\r\n		styleElement.styleSheet.cssText = css;\r\n	} else {\r\n		while(styleElement.firstChild) {\r\n			styleElement.removeChild(styleElement.firstChild);\r\n		}\r\n		styleElement.appendChild(document.createTextNode(css));\r\n	}\r\n}\r\n\r\nfunction updateLink(linkElement, obj) {\r\n	var css = obj.css;\r\n	var sourceMap = obj.sourceMap;\r\n\r\n	if(sourceMap) {\r\n		// http://stackoverflow.com/a/26603875\r\n		css += "\\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";\r\n	}\r\n\r\n	var blob = new Blob([css], { type: "text/css" });\r\n\r\n	var oldSrc = linkElement.href;\r\n\r\n	linkElement.href = URL.createObjectURL(blob);\r\n\r\n	if(oldSrc)\r\n		URL.revokeObjectURL(oldSrc);\r\n}\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/style-loader/addStyles.js\n ** module id = 10\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/style-loader/addStyles.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = Menu;\n\nvar _dom = __webpack_require__(16);\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _classnames = __webpack_require__(34);\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _assign2 = __webpack_require__(8);\n\nvar _assign3 = _interopRequireDefault(_assign2);\n\nvar _style = __webpack_require__(344);\n\nvar _style2 = _interopRequireDefault(_style);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//require('./menu.css')\n\nfunction getToolTip(tooltip, toggleCondition) {\n  if (!toggleCondition) {\n    return { 'data-tooltip': tooltip };\n  } else {\n    return undefined;\n  }\n} // faster object.assign\n\nfunction Menu(options) {\n  var defaults = {\n    toggled: false,\n    disabledCondition: false,\n\n    icon: '',\n    klass: '',\n    arrow: true,\n\n    contentPosition: 'right',\n    subItems: false,\n\n    tooltip: '',\n    tooltipPos: 'bottom',\n\n    content: undefined\n  };\n\n  var _assign = (0, _assign3.default)({}, defaults, options);\n\n  var toggled = _assign.toggled;\n  var disabledCondition = _assign.disabledCondition;\n  var icon = _assign.icon;\n  var klass = _assign.klass;\n  var arrow = _assign.arrow;\n  var contentPosition = _assign.contentPosition;\n  var subItems = _assign.subItems;\n  var tooltip = _assign.tooltip;\n  var tooltipPos = _assign.tooltipPos;\n  var content = _assign.content;\n\n\n  var subItemsIndicator = subItems ? (0, _snabbdomJsx.html)('span', { className: 'subItemsIndicator' }) : '';\n  // arrow related\n  var borderNotch = arrow ? (0, _snabbdomJsx.html)('b', { className: 'border-notch notch' }) : '';\n  var notch = arrow ? (0, _snabbdomJsx.html)('b', { className: 'notch' }) : '';\n\n  var button = (0, _dom.h)('button', {\n    props: {\n      disabled: disabledCondition,\n      className: (0, _classnames2.default)(klass, 'tooltip-' + tooltipPos, { active: toggled })\n    },\n    attrs: getToolTip(tooltip, toggled)\n  }, [(0, _dom.h)('span', { props: { innerHTML: icon } }), subItemsIndicator]);\n\n  /*<button\n    disabled={disabledCondition}\n    className={Class(klass, `tooltip-${tooltipPos}`, {active: toggled})}\n    attributes={getToolTip(tooltip, toggled)}>\n    <span innerHTML={icon}/>\n    {subItemsIndicator}\n  </button>*/\n\n  var innerContent = '';\n  if (content !== undefined && toggled) {\n    innerContent = (0, _snabbdomJsx.html)(\n      'div',\n      {\n        className: (0, _classnames2.default)('menu', 'menu-' + contentPosition, { 'active-content': toggled, arrowOffset: arrow }) },\n      content,\n      borderNotch,\n      notch\n    );\n  }\n\n  return (0, _snabbdomJsx.html)(\n    'span',\n    { className: 'toolTipButtonContainer' },\n    button,\n    innerContent\n  );\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/Menu/index.js\n ** module id = 11\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/Menu/index.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n		value: true\n});\nexports.GizmoLineMaterial = exports.GizmoMaterial = undefined;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar GizmoMaterial = function GizmoMaterial(parameters) {\n		_three2.default.MeshBasicMaterial.call(this);\n		this.side = _three2.default.DoubleSide;\n		if ("lineWidth" in parameters) delete parameters.lineWidth;\n		this.setValues(parameters);\n\n		this.highlightColor = parameters.highlightColor !== undefined ? parameters.highlightColor : 0xFFFF00;\n		this.oldColor = this.color.clone();\n		//this.oldOpacity = this.opacity\n\n		this.highlight = function (highlighted) {\n\n				if (highlighted) {\n\n						this.color.set(this.highlightColor);\n				} else {\n\n						this.color.copy(this.oldColor);\n				}\n		};\n};\n\nGizmoMaterial.prototype = Object.create(_three2.default.MeshBasicMaterial.prototype);\n\nvar GizmoLineMaterial = function GizmoLineMaterial(parameters) {\n		_three2.default.LineBasicMaterial.call(this);\n\n		this.highlightColor = parameters.highlightColor !== undefined ? parameters.highlightColor : "#ffd200";\n		this.linewidth = parameters.lineWidth || parameters.linewidth || 1;\n\n		if ("lineWidth" in parameters) delete parameters.lineWidth;\n		if ("highlightColor" in parameters) delete parameters.highlightColor;\n\n		this.setValues(parameters);\n\n		this.oldColor = this.color.clone();\n\n		this.highlight = function (highlighted) {\n\n				if (highlighted) {\n\n						this.color.set(this.highlightColor);\n				} else {\n\n						this.color.copy(this.oldColor);\n				}\n		};\n};\n\nGizmoLineMaterial.prototype = Object.create(_three2.default.LineBasicMaterial.prototype);\n\nexports.GizmoMaterial = GizmoMaterial;\nexports.GizmoLineMaterial = GizmoLineMaterial;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/GizmoMaterial.js\n ** module id = 12\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/GizmoMaterial.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n	value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\nAbstract Base helper class\n*/\n\nvar BaseHelper = (function (_THREE$Object3D) {\n	_inherits(BaseHelper, _THREE$Object3D);\n\n	function BaseHelper(options) {\n		_classCallCheck(this, BaseHelper);\n\n		var DEFAULTS = {\n			name: "",\n			debug: false\n		};\n		options = Object.assign({}, DEFAULTS, options);\n\n		var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(BaseHelper).call(this, options));\n\n		Object.assign(_this, options);\n		return _this;\n	}\n\n	_createClass(BaseHelper, [{\n		key: "setAsSelectionRoot",\n		value: function setAsSelectionRoot(flag) {\n			this.traverse(function (child) {\n				child.selectable = !flag;\n				child.selectTrickleUp = flag;\n			});\n			this.selectable = flag;\n			this.selectTrickleUp = !flag;\n		}\n	}, {\n		key: "hide",\n		value: function hide() {\n			this.traverse(function (child) {\n				child.visible = false;\n			});\n		}\n	}, {\n		key: "show",\n		value: function show() {\n			this.traverse(function (child) {\n				child.visible = true;\n			});\n		}\n	}, {\n		key: "setOpacity",\n		value: function setOpacity(opacityPercent) {\n			this.traverse(function (child) {\n				if (child.material) {\n					child.material.opacity = child.material.opacity * opacityPercent;\n					if (child.material.opacity < 1) {\n						child.material.transparent = true;\n					}\n					//console.log("applying opacity to ",child);\n				} else {\n						//console.log("not applying opacity to",child);\n					}\n			});\n		}\n	}, {\n		key: "highlight",\n		value: function highlight(flag) {\n			this.traverse(function (child) {\n				if (child.material && child.material.highlight) {\n					child.material.highlight(flag);\n				}\n			});\n		}\n	}, {\n		key: "highlight2",\n		value: function highlight2(item) {\n			this.traverse(function (child) {\n				if (child.material && child.material.highlight) {\n					if (child === item) {\n						child.material.highlight(true);\n						return;\n					} else {\n						child.material.highlight(false);\n					}\n				}\n			});\n		}\n	}]);\n\n	return BaseHelper;\n})(_three2.default.Object3D);\n\nexports.default = BaseHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/BaseHelper.js\n ** module id = 13\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/BaseHelper.js?');
},function(module,exports){eval("var isArray = (typeof Array.isArray === 'function') ?\n  // use native function\n  Array.isArray :\n  // use instanceof operator\n  function(a) {\n    return a instanceof Array;\n  };\n\nvar getObjectKeys = typeof Object.keys === 'function' ?\n  function(obj) {\n    return Object.keys(obj);\n  } : function(obj) {\n    var names = [];\n    for (var property in obj) {\n      if (Object.prototype.hasOwnProperty.call(obj, property)) {\n        names.push(property);\n      }\n    }\n    return names;\n  };\n\nvar trimUnderscore = function(str) {\n  if (str.substr(0, 1) === '_') {\n    return str.slice(1);\n  }\n  return str;\n};\n\nvar arrayKeyToSortNumber = function(key) {\n  if (key === '_t') {\n    return -1;\n  } else {\n    if (key.substr(0, 1) === '_') {\n      return parseInt(key.slice(1), 10);\n    } else {\n      return parseInt(key, 10) + 0.1;\n    }\n  }\n};\n\nvar arrayKeyComparer = function(key1, key2) {\n  return arrayKeyToSortNumber(key1) - arrayKeyToSortNumber(key2);\n};\n\nvar BaseFormatter = function BaseFormatter() {};\n\nBaseFormatter.prototype.format = function(delta, left) {\n  var context = {};\n  this.prepareContext(context);\n  this.recurse(context, delta, left);\n  return this.finalize(context);\n};\n\nBaseFormatter.prototype.prepareContext = function(context) {\n  context.buffer = [];\n  context.out = function() {\n    this.buffer.push.apply(this.buffer, arguments);\n  };\n};\n\nBaseFormatter.prototype.typeFormattterNotFound = function(context, deltaType) {\n  throw new Error('cannot format delta type: ' + deltaType);\n};\n\nBaseFormatter.prototype.typeFormattterErrorFormatter = function(context, err) {\n  return err.toString();\n};\n\nBaseFormatter.prototype.finalize = function(context) {\n  if (isArray(context.buffer)) {\n    return context.buffer.join('');\n  }\n};\n\nBaseFormatter.prototype.recurse = function(context, delta, left, key, leftKey, movedFrom, isLast) {\n\n  var useMoveOriginHere = delta && movedFrom;\n  var leftValue = useMoveOriginHere ? movedFrom.value : left;\n\n  if (typeof delta === 'undefined' && typeof key === 'undefined') {\n    return undefined;\n  }\n\n  var type = this.getDeltaType(delta, movedFrom);\n  var nodeType = type === 'node' ? (delta._t === 'a' ? 'array' : 'object') : '';\n\n  if (typeof key !== 'undefined') {\n    this.nodeBegin(context, key, leftKey, type, nodeType, isLast);\n  } else {\n    this.rootBegin(context, type, nodeType);\n  }\n\n  var typeFormattter;\n  try {\n    typeFormattter = this['format_' + type] || this.typeFormattterNotFound(context, type);\n    typeFormattter.call(this, context, delta, leftValue, key, leftKey, movedFrom);\n  } catch (err) {\n    this.typeFormattterErrorFormatter(context, err, delta, leftValue, key, leftKey, movedFrom);\n    if (typeof console !== 'undefined' && console.error) {\n      console.error(err.stack);\n    }\n  }\n\n  if (typeof key !== 'undefined') {\n    this.nodeEnd(context, key, leftKey, type, nodeType, isLast);\n  } else {\n    this.rootEnd(context, type, nodeType);\n  }\n};\n\nBaseFormatter.prototype.formatDeltaChildren = function(context, delta, left) {\n  var self = this;\n  this.forEachDeltaKey(delta, left, function(key, leftKey, movedFrom, isLast) {\n    self.recurse(context, delta[key], left ? left[leftKey] : undefined,\n      key, leftKey, movedFrom, isLast);\n  });\n};\n\nBaseFormatter.prototype.forEachDeltaKey = function(delta, left, fn) {\n  var keys = getObjectKeys(delta);\n  var arrayKeys = delta._t === 'a';\n  var moveDestinations = {};\n  var name;\n  if (typeof left !== 'undefined') {\n    for (name in left) {\n      if (typeof delta[name] === 'undefined' &&\n        ((!arrayKeys) || typeof delta['_' + name] === 'undefined')) {\n        keys.push(name);\n      }\n    }\n  }\n  // look for move destinations\n  for (name in delta) {\n    var value = delta[name];\n    if (isArray(value) && value[2] === 3) {\n      moveDestinations[value[1].toString()] = {\n        key: name,\n        value: left && left[parseInt(name.substr(1))]\n      };\n      if (this.includeMoveDestinations !== false) {\n        if ((typeof left === 'undefined') &&\n          (typeof delta[value[1]] === 'undefined')) {\n          keys.push(value[1].toString());\n        }\n      }\n    }\n  }\n  if (arrayKeys) {\n    keys.sort(arrayKeyComparer);\n  } else {\n    keys.sort();\n  }\n  for (var index = 0, length = keys.length; index < length; index++) {\n    var key = keys[index];\n    if (arrayKeys && key === '_t') {\n      continue;\n    }\n    var leftKey = arrayKeys ?\n      (typeof key === 'number' ? key : parseInt(trimUnderscore(key), 10)) :\n      key;\n    var isLast = (index === length - 1);\n    fn(key, leftKey, moveDestinations[leftKey], isLast);\n  }\n};\n\nBaseFormatter.prototype.getDeltaType = function(delta, movedFrom) {\n  if (typeof delta === 'undefined') {\n    if (typeof movedFrom !== 'undefined') {\n      return 'movedestination';\n    }\n    return 'unchanged';\n  }\n  if (isArray(delta)) {\n    if (delta.length === 1) {\n      return 'added';\n    }\n    if (delta.length === 2) {\n      return 'modified';\n    }\n    if (delta.length === 3 && delta[2] === 0) {\n      return 'deleted';\n    }\n    if (delta.length === 3 && delta[2] === 2) {\n      return 'textdiff';\n    }\n    if (delta.length === 3 && delta[2] === 3) {\n      return 'moved';\n    }\n  } else if (typeof delta === 'object') {\n    return 'node';\n  }\n  return 'unknown';\n};\n\nBaseFormatter.prototype.parseTextDiff = function(value) {\n  var output = [];\n  var lines = value.split('\\n@@ ');\n  for (var i = 0, l = lines.length; i < l; i++) {\n    var line = lines[i];\n    var lineOutput = {\n      pieces: []\n    };\n    var location = /^(?:@@ )?[-+]?(\\d+),(\\d+)/.exec(line).slice(1);\n    lineOutput.location = {\n      line: location[0],\n      chr: location[1]\n    };\n    var pieces = line.split('\\n').slice(1);\n    for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {\n      var piece = pieces[pieceIndex];\n      if (!piece.length) {\n        continue;\n      }\n      var pieceOutput = {\n        type: 'context'\n      };\n      if (piece.substr(0, 1) === '+') {\n        pieceOutput.type = 'added';\n      } else if (piece.substr(0, 1) === '-') {\n        pieceOutput.type = 'deleted';\n      }\n      pieceOutput.text = piece.slice(1);\n      lineOutput.pieces.push(pieceOutput);\n    }\n    output.push(lineOutput);\n  }\n  return output;\n};\n\nexports.BaseFormatter = BaseFormatter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/formatters/base.js\n ** module id = 14\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/formatters/base.js?")},function(module,exports){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.formatNumberTo = formatNumberTo;\nexports.capitalize = capitalize;\nexports.toRadian = toRadian;\nexports.toDegree = toDegree;\nexports.absSizeFromBBox = absSizeFromBBox;\nexports.toRelSize = toRelSize;\nexports.toRelSize2 = toRelSize2;\nexports.threejsColorToHex = threejsColorToHex;\nexports.hexToThreejsColor = hexToThreejsColor;\nexports.toCamelCase = toCamelCase;\nexports.toRevCamelCase = toRevCamelCase;\nexports.hashCodeFromString = hashCodeFromString;\nexports.nameCleanup = nameCleanup;\nexports.normalizeString = normalizeString;\n// format a number to the given precision\nfunction formatNumberTo(input, precision) {\n  return parseFloat(Math.round(input * 100) / 100).toFixed(precision);\n}\n\nfunction capitalize(s) {\n  return s && s[0].toUpperCase() + s.slice(1);\n}\n\n// format an angle value from degrees to radian\nfunction toRadian(input) {\n  if (!input) return 0;\n  return parseFloat(input) * Math.PI / 180;\n}\n\n// format an angle from radian to deg\nfunction toDegree(input) {\n  if (!input) return 0;\n  return input * 180 / Math.PI;\n}\n\n// convert between scale and absolute size\nfunction absSizeFromBBox(input) {\n  // console.log("getting absolute size")\n  if (!input) return undefined;\n  var size = { w: 0, l: 0, h: 0 };\n  // ordering is always x,y,z\n\n  var bbox = input;\n  /* let length = ( (bbox.max.x-bbox.min.x).toFixed(2) )/1 // division by one to coerce to number\n  let width  = ( (bbox.max.y-bbox.min.y).toFixed(2) )/1\n  let height = ( (bbox.max.z-bbox.min.z).toFixed(2) )/1;*/\n\n  var length = (bbox.max[0] - bbox.min[0]).toFixed(2) / 1; // division by one to coerce to number\n  var width = (bbox.max[1] - bbox.min[1]).toFixed(2) / 1;\n  var height = (bbox.max[2] - bbox.min[2]).toFixed(2) / 1;\n\n  size.w = width;\n  size.l = length;\n  size.h = height;\n  return size;\n}\n\n// convert rel size to abs size\nfunction toRelSize(input) {}\n\n// convert rel size to abs size\nfunction toRelSize2(input) {}\n\n// convert between html hex color and three.js color\nfunction threejsColorToHex(input) {\n  if (!input) {\n    return \'#ffffff\';\n  }\n  return \'#\' + input.getHexString();\n}\n\n// convert between three.js color & html hex color\nfunction hexToThreejsColor(input) {\n  return new THREE.Color(input);\n}\n\n// turns a string into a camelcase string (for variable names)\nfunction toCamelCase(input) {\n  if (!input) {\n    return \'\';\n  }\n  return input.toLowerCase().replace(/-(.)/g, function (match, group1) {\n    return group1.toUpperCase();\n  });\n}\n\n// and back\nfunction toRevCamelCase(input) {\n  if (!input) {\n    return \'\';\n  }\n  return input.toLowerCase().replace(/-(.)/g, function (match, group1) {\n    return group1.toUpperCase();\n  });\n}\n\nfunction hashCodeFromString(s) {\n  return s.split(\'\').reduce(function (a, b) {\n    a = (a << 5) - a + b.charCodeAt(0);return a & a;\n  }, 0);\n}\n\n// TODO remove redundandt ones\nfunction camelCase(string) {\n  return string.replace(/-([a-z])/ig, function (all, letter) {\n    return letter.toUpperCase();\n  });\n}\n\nfunction camelCase2(string) {\n  return string.replace(/-([a-z])/ig, function (all, letter) {\n    return letter.toUpperCase();\n  });\n}\n// TODO: do this better\nfunction nameCleanup(name) {\n  var cName = name;\n  if (name.indexOf(\'.\') !== -1) {\n    cName = name.substr(0, name.lastIndexOf(\'.\'));\n  }\n  cName = camelCase(cName);\n  cName = camelCase2(cName);\n  // cName = cName.replace("_","").replace("-","")\n  return cName;\n}\n\n/* generate a url-valid string from the input string :ie remove spaces, */\nfunction normalizeString(string) {\n  return string.toLowerCase().replace(/\\./g, \'-\').replace(/ /g, \'-\');\n}\n\n// OLD polymer code, to be converted\n/*\n\n  //convert between scale and absolute size\n  scaleConvert: {\n     toDOM: function(value, axis) {\n      if(!value) return 0\n      return this.meshSize[axis]\n    },\n    toModel: function(value, axis) {\n      //TODO : do the "safing" of values better( no divisions by zero, nothing under 0 )\n      var minScale = 0.0001\n      if(!value) return minScale\n\n      if(value <= 0) value = minScale\n      //var foo = this.meshSize[axis]\n      var map = {"l":"x","w":"y","h":"z"}\n      var mapped = map[axis]\n      var axisScale = this.selectedObject.scale[ mapped ]\n      if( axisScale <= minScale ) axisScale = minScale\n\n      var scaling = 1/ axisScale\n\n      var meshSize = this.meshSize[axis]\n      if(meshSize <= minScale) meshSize = minScale\n\n      var originalSize = meshSize * scaling\n      var targetScale = value/(originalSize)\n\n      if(targetScale <= minScale) targetScale = minScale\n\n      if(this.meshSize[axis] <= minScale) this.meshSize[axis] = minScale\n\n      this.selectedObject.scale[mapped] = targetScale\n      return targetScale\n    }\n  },\n  }*/\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/formatters.js\n ** module id = 15\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/formatters.js?')},function(module,exports,__webpack_require__){eval("\"use strict\";\nvar thunk = __webpack_require__(298);\nexports.thunk = thunk;\n/**\n * A factory for the DOM driver function.\n *\n * Takes a `container` to define the target on the existing DOM which this\n * driver will operate on, and an `options` object as the second argument. The\n * input to this driver is a stream of virtual DOM objects, or in other words,\n * Snabbdom \"VNode\" objects. The output of this driver is a \"DOMSource\": a\n * collection of Observables queried with the methods `select()` and `events()`.\n *\n * `DOMSource.select(selector)` returns a new DOMSource with scope restricted to\n * the element(s) that matches the CSS `selector` given.\n *\n * `DOMSource.events(eventType, options)` returns a stream of events of\n * `eventType` happening on the elements that match the current DOMSource. The\n * returned stream is an *xstream* Stream if you use `@cycle/xstream-run` to run\n * your app with this driver, or it is an RxJS Observable if you use\n * `@cycle/rxjs-run`, and so forth. The `options` parameter can have the field\n * `useCapture`, which is by default `false`, except it is `true` for event\n * types that do not bubble. Read more here\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\n * about the `useCapture` and its purpose.\n *\n * `DOMSource.elements()` returns a stream of the DOM element(s) matched by the\n * selectors in the DOMSource. Also, `DOMSource.select(':root').elements()`\n * returns a stream of DOM element corresponding to the root (or container) of\n * the app on the DOM.\n *\n * @param {(String|HTMLElement)} container the DOM selector for the element\n * (or the element itself) to contain the rendering of the VTrees.\n * @param {DOMDriverOptions} options an object with two optional fields:\n * `transposition: boolean` enables/disables transposition of inner streams in\n * the virtual DOM tree, `modules: array` contains additional Snabbdom modules.\n * @return {Function} the DOM driver function. The function expects a stream of\n * of VNode as input, and outputs the DOMSource object.\n * @function makeDOMDriver\n */\nvar makeDOMDriver_1 = __webpack_require__(107);\nexports.makeDOMDriver = makeDOMDriver_1.makeDOMDriver;\n/**\n * A factory for the HTML driver function.\n *\n * Takes an `effect` callback function and an `options` object as arguments. The\n * input to this driver is a stream of virtual DOM objects, or in other words,\n * Snabbdom \"VNode\" objects. The output of this driver is a \"DOMSource\": a\n * collection of Observables queried with the methods `select()` and `events()`.\n *\n * The HTML Driver is supplementary to the DOM Driver. Instead of producing\n * elements on the DOM, it generates HTML as strings and does a side effect on\n * those HTML strings. That side effect is described by the `effect` callback\n * function. So, if you want to use the HTML Driver on the server-side to render\n * your application as HTML and send as a response (which is the typical use\n * case for the HTML Driver), you need to pass something like the\n * `html => response.send(html)` function as the `effect` argument. This way,\n * the driver knows what side effect to cause based on the HTML string it just\n * rendered.\n *\n * The HTML driver is useful only for that side effect in the `effect` callback.\n * It can be considered a sink-only driver. However, in order to serve as a\n * transparent replacement to the DOM Driver when rendering from the server, the\n * HTML driver returns a source object that behaves just like the DOMSource.\n * This helps reuse the same application that is written for the DOM Driver.\n * This fake DOMSource returns empty streams when you query it, because there\n * are no user events on the server.\n *\n * `DOMSource.select(selector)` returns a new DOMSource with scope restricted to\n * the element(s) that matches the CSS `selector` given.\n *\n * `DOMSource.events(eventType, options)` returns an empty stream. The returned\n * stream is an *xstream* Stream if you use `@cycle/xstream-run` to run your app\n * with this driver, or it is an RxJS Observable if you use `@cycle/rxjs-run`,\n * and so forth.\n *\n * `DOMSource.elements()` returns the stream of HTML string rendered from your\n * sink virtual DOM stream.\n *\n * @param {Function} effect a callback function that takes a string of rendered\n * HTML as input and should run a side effect, returning nothing.\n * @param {HTMLDriverOptions} options an object with one optional field:\n * `transposition: boolean` enables/disables transposition of inner streams in\n * the virtual DOM tree.\n * @return {Function} the HTML driver function. The function expects a stream of\n * of VNode as input, and outputs the DOMSource object.\n * @function makeHTMLDriver\n */\nvar makeHTMLDriver_1 = __webpack_require__(108);\nexports.makeHTMLDriver = makeHTMLDriver_1.makeHTMLDriver;\n/**\n * A factory function to create mocked DOMSource objects, for testing purposes.\n *\n * Takes a `streamAdapter` and a `mockConfig` object as arguments, and returns\n * a DOMSource that can be given to any Cycle.js app that expects a DOMSource in\n * the sources, for testing.\n *\n * The `streamAdapter` parameter is a package such as `@cycle/xstream-adapter`,\n * `@cycle/rxjs-adapter`, etc. Import it as `import a from '@cycle/rx-adapter`,\n * then provide it to `mockDOMSource. This is important so the DOMSource created\n * knows which stream library should it use to export its streams when you call\n * `DOMSource.events()` for instance.\n *\n * The `mockConfig` parameter is an object specifying selectors, eventTypes and\n * their streams. Example:\n *\n * ```js\n * const domSource = mockDOMSource(RxAdapter, {\n *   '.foo': {\n *     'click': Rx.Observable.of({target: {}}),\n *     'mouseover': Rx.Observable.of({target: {}}),\n *   },\n *   '.bar': {\n *     'scroll': Rx.Observable.of({target: {}}),\n *     elements: Rx.Observable.of({tagName: 'div'}),\n *   }\n * });\n *\n * // Usage\n * const click$ = domSource.select('.foo').events('click');\n * const element$ = domSource.select('.bar').elements();\n * ```\n *\n * @param {Object} mockConfig an object where keys are selector strings\n * and values are objects. Those nested objects have `eventType` strings as keys\n * and values are streams you created.\n * @return {Object} fake DOM source object, with an API containing `select()`\n * and `events()` and `elements()` which can be used just like the DOM Driver's\n * DOMSource.\n *\n * @function mockDOMSource\n */\nvar mockDOMSource_1 = __webpack_require__(109);\nexports.mockDOMSource = mockDOMSource_1.mockDOMSource;\n/**\n * The hyperscript function `h()` is a function to create virtual DOM objects,\n * also known as VNodes. Call\n *\n * ```js\n * h('div.myClass', {style: {color: 'red'}}, [])\n * ```\n *\n * to create a VNode that represents a `DIV` element with className `myClass`,\n * styled with red color, and no children because the `[]` array was passed. The\n * API is `h(tagOrSelector, optionalData, optionalChildrenOrText)`.\n *\n * However, usually you should use \"hyperscript helpers\", which are shortcut\n * functions based on hyperscript. There is one hyperscript helper function for\n * each DOM tagName, such as `h1()`, `h2()`, `div()`, `span()`, `label()`,\n * `input()`. For instance, the previous example could have been written\n * as:\n *\n * ```js\n * div('.myClass', {style: {color: 'red'}}, [])\n * ```\n *\n * There are also SVG helper functions, which apply the appropriate SVG\n * namespace to the resulting elements. `svg()` function creates the top-most\n * SVG element, and `svg.g`, `svg.polygon`, `svg.circle`, `svg.path` are for\n * SVG-specific child elements. Example:\n *\n * ```js\n * svg({width: 150, height: 150}, [\n *   svg.polygon({\n *     attrs: {\n *       class: 'triangle',\n *       points: '20 0 20 150 150 20'\n *     }\n *   })\n * ])\n * ```\n *\n * @function h\n */\nvar hyperscript_1 = __webpack_require__(45);\nexports.h = hyperscript_1.h;\nvar hyperscript_helpers_1 = __webpack_require__(104);\nexports.svg = hyperscript_helpers_1.default.svg;\nexports.a = hyperscript_helpers_1.default.a;\nexports.abbr = hyperscript_helpers_1.default.abbr;\nexports.address = hyperscript_helpers_1.default.address;\nexports.area = hyperscript_helpers_1.default.area;\nexports.article = hyperscript_helpers_1.default.article;\nexports.aside = hyperscript_helpers_1.default.aside;\nexports.audio = hyperscript_helpers_1.default.audio;\nexports.b = hyperscript_helpers_1.default.b;\nexports.base = hyperscript_helpers_1.default.base;\nexports.bdi = hyperscript_helpers_1.default.bdi;\nexports.bdo = hyperscript_helpers_1.default.bdo;\nexports.blockquote = hyperscript_helpers_1.default.blockquote;\nexports.body = hyperscript_helpers_1.default.body;\nexports.br = hyperscript_helpers_1.default.br;\nexports.button = hyperscript_helpers_1.default.button;\nexports.canvas = hyperscript_helpers_1.default.canvas;\nexports.caption = hyperscript_helpers_1.default.caption;\nexports.cite = hyperscript_helpers_1.default.cite;\nexports.code = hyperscript_helpers_1.default.code;\nexports.col = hyperscript_helpers_1.default.col;\nexports.colgroup = hyperscript_helpers_1.default.colgroup;\nexports.dd = hyperscript_helpers_1.default.dd;\nexports.del = hyperscript_helpers_1.default.del;\nexports.dfn = hyperscript_helpers_1.default.dfn;\nexports.dir = hyperscript_helpers_1.default.dir;\nexports.div = hyperscript_helpers_1.default.div;\nexports.dl = hyperscript_helpers_1.default.dl;\nexports.dt = hyperscript_helpers_1.default.dt;\nexports.em = hyperscript_helpers_1.default.em;\nexports.embed = hyperscript_helpers_1.default.embed;\nexports.fieldset = hyperscript_helpers_1.default.fieldset;\nexports.figcaption = hyperscript_helpers_1.default.figcaption;\nexports.figure = hyperscript_helpers_1.default.figure;\nexports.footer = hyperscript_helpers_1.default.footer;\nexports.form = hyperscript_helpers_1.default.form;\nexports.h1 = hyperscript_helpers_1.default.h1;\nexports.h2 = hyperscript_helpers_1.default.h2;\nexports.h3 = hyperscript_helpers_1.default.h3;\nexports.h4 = hyperscript_helpers_1.default.h4;\nexports.h5 = hyperscript_helpers_1.default.h5;\nexports.h6 = hyperscript_helpers_1.default.h6;\nexports.head = hyperscript_helpers_1.default.head;\nexports.header = hyperscript_helpers_1.default.header;\nexports.hgroup = hyperscript_helpers_1.default.hgroup;\nexports.hr = hyperscript_helpers_1.default.hr;\nexports.html = hyperscript_helpers_1.default.html;\nexports.i = hyperscript_helpers_1.default.i;\nexports.iframe = hyperscript_helpers_1.default.iframe;\nexports.img = hyperscript_helpers_1.default.img;\nexports.input = hyperscript_helpers_1.default.input;\nexports.ins = hyperscript_helpers_1.default.ins;\nexports.kbd = hyperscript_helpers_1.default.kbd;\nexports.keygen = hyperscript_helpers_1.default.keygen;\nexports.label = hyperscript_helpers_1.default.label;\nexports.legend = hyperscript_helpers_1.default.legend;\nexports.li = hyperscript_helpers_1.default.li;\nexports.link = hyperscript_helpers_1.default.link;\nexports.main = hyperscript_helpers_1.default.main;\nexports.map = hyperscript_helpers_1.default.map;\nexports.mark = hyperscript_helpers_1.default.mark;\nexports.menu = hyperscript_helpers_1.default.menu;\nexports.meta = hyperscript_helpers_1.default.meta;\nexports.nav = hyperscript_helpers_1.default.nav;\nexports.noscript = hyperscript_helpers_1.default.noscript;\nexports.object = hyperscript_helpers_1.default.object;\nexports.ol = hyperscript_helpers_1.default.ol;\nexports.optgroup = hyperscript_helpers_1.default.optgroup;\nexports.option = hyperscript_helpers_1.default.option;\nexports.p = hyperscript_helpers_1.default.p;\nexports.param = hyperscript_helpers_1.default.param;\nexports.pre = hyperscript_helpers_1.default.pre;\nexports.progress = hyperscript_helpers_1.default.progress;\nexports.q = hyperscript_helpers_1.default.q;\nexports.rp = hyperscript_helpers_1.default.rp;\nexports.rt = hyperscript_helpers_1.default.rt;\nexports.ruby = hyperscript_helpers_1.default.ruby;\nexports.s = hyperscript_helpers_1.default.s;\nexports.samp = hyperscript_helpers_1.default.samp;\nexports.script = hyperscript_helpers_1.default.script;\nexports.section = hyperscript_helpers_1.default.section;\nexports.select = hyperscript_helpers_1.default.select;\nexports.small = hyperscript_helpers_1.default.small;\nexports.source = hyperscript_helpers_1.default.source;\nexports.span = hyperscript_helpers_1.default.span;\nexports.strong = hyperscript_helpers_1.default.strong;\nexports.style = hyperscript_helpers_1.default.style;\nexports.sub = hyperscript_helpers_1.default.sub;\nexports.sup = hyperscript_helpers_1.default.sup;\nexports.table = hyperscript_helpers_1.default.table;\nexports.tbody = hyperscript_helpers_1.default.tbody;\nexports.td = hyperscript_helpers_1.default.td;\nexports.textarea = hyperscript_helpers_1.default.textarea;\nexports.tfoot = hyperscript_helpers_1.default.tfoot;\nexports.th = hyperscript_helpers_1.default.th;\nexports.thead = hyperscript_helpers_1.default.thead;\nexports.title = hyperscript_helpers_1.default.title;\nexports.tr = hyperscript_helpers_1.default.tr;\nexports.u = hyperscript_helpers_1.default.u;\nexports.ul = hyperscript_helpers_1.default.ul;\nexports.video = hyperscript_helpers_1.default.video;\n//# sourceMappingURL=index.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/index.js\n ** module id = 16\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/index.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n id: inner diameter : blank space at center of cross\n*/\n\nvar CrossHelper = (function (_BaseHelper) {\n  _inherits(CrossHelper, _BaseHelper);\n\n  function CrossHelper(options) {\n    _classCallCheck(this, CrossHelper);\n\n    var DEFAULTS = {\n      size: 5,\n      color: "#0F0",\n      highlightColor: "#F00",\n      opacity: 0.8,\n      internalDiameter: 0 //??huh\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CrossHelper).call(this, options));\n\n    Object.assign(_this, options);\n\n    var internalDiameter = _this.internalDiameter;\n    var opacity = _this.opacity;\n    var size = _this.size;\n\n    var offsetPos = size / 2 + internalDiameter / 2;\n    //starting point cross\n    var startCrossGeometry = new _three2.default.Geometry();\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(0, -offsetPos, 0));\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(0, -internalDiameter / 2, 0));\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(0, offsetPos, 0));\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(0, internalDiameter / 2, 0));\n\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(-offsetPos, 0, 0));\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(-internalDiameter / 2, 0, 0));\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(offsetPos, 0, 0));\n    startCrossGeometry.vertices.push(new _three2.default.Vector3(internalDiameter / 2, 0, 0));\n\n    _this.centerCross = new _three2.default.Line(startCrossGeometry, new _GizmoMaterial.GizmoLineMaterial({\n      color: _this.color,\n      highlightColor: _this.highlightColor,\n      lineWidth: _this.lineWidth,\n      opacity: opacity,\n      transparent: true,\n      side: _three2.default.FrontSide }), _three2.default.LinePieces);\n    _this.centerCross.material.depthTest = false;\n    _this.centerCross.material.depthWrite = false;\n    _this.centerCross.material.renderDepth = 1e20;\n\n    _this.add(_this.centerCross);\n    return _this;\n  }\n\n  return CrossHelper;\n})(_BaseHelper3.default);\n\nexports.default = CrossHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/CrossHelper.js\n ** module id = 17\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/CrossHelper.js?')},function(module,exports,__webpack_require__){eval("\nvar environment = __webpack_require__(29);\n\nvar DiffPatcher = __webpack_require__(50).DiffPatcher;\nexports.DiffPatcher = DiffPatcher;\n\nexports.create = function(options){\n  return new DiffPatcher(options);\n};\n\nexports.dateReviver = __webpack_require__(41);\n\nvar defaultInstance;\n\nexports.diff = function() {\n  if (!defaultInstance) {\n    defaultInstance = new DiffPatcher();\n  }\n  return defaultInstance.diff.apply(defaultInstance, arguments);\n};\n\nexports.patch = function() {\n  if (!defaultInstance) {\n    defaultInstance = new DiffPatcher();\n  }\n  return defaultInstance.patch.apply(defaultInstance, arguments);\n};\n\nexports.unpatch = function() {\n  if (!defaultInstance) {\n    defaultInstance = new DiffPatcher();\n  }\n  return defaultInstance.unpatch.apply(defaultInstance, arguments);\n};\n\nexports.reverse = function() {\n  if (!defaultInstance) {\n    defaultInstance = new DiffPatcher();\n  }\n  return defaultInstance.reverse.apply(defaultInstance, arguments);\n};\n\nif (environment.isBrowser) {\n  exports.homepage = '{{package-homepage}}';\n  exports.version = '{{package-version}}';\n} else {\n  var packageInfoModuleName = '../package.json';\n  var packageInfo = __webpack_require__(82)(packageInfoModuleName);\n  exports.homepage = packageInfo.homepage;\n  exports.version = packageInfo.version;\n\n  var formatterModuleName = './formatters';\n  var formatters = __webpack_require__(82)(formatterModuleName);\n  exports.formatters = formatters;\n  // shortcut for console\n  exports.console = formatters.console;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/main.js\n ** module id = 18\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/main.js?")},function(module,exports,__webpack_require__){eval('"use strict";\nvar core_1 = __webpack_require__(364);\nexports.Stream = core_1.Stream;\nexports.MemoryStream = core_1.MemoryStream;\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.default = core_1.Stream;\n//# sourceMappingURL=index.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/xstream/index.js\n ** module id = 19\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/xstream/index.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = checkbox;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\n__webpack_require__(340);\n\nfunction checkbox(_ref) {\n  var id = _ref.id;\n  var value = _ref.value;\n  var checked = _ref.checked;\n  var name = _ref.name;\n  var className = _ref.className;\n  var disabled = _ref.disabled;\n\n  return (0, _snabbdomJsx.html)(\n    'div',\n    { className: 'checkbox', disabled: disabled },\n    (0, _snabbdomJsx.html)('input', { type: 'checkbox', value: value, checked: checked, id: id, name: name, className: className, disabled: disabled }),\n    (0, _snabbdomJsx.html)('label', { htmlFor: id })\n  );\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/Checkbox/index.js\n ** module id = 20\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/Checkbox/index.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.hasModelUrl = hasModelUrl;\nexports.hasDesignUrl = hasDesignUrl;\nexports.validateExtension = validateExtension;\nexports.filterByExtensions = filterByExtensions;\nexports.normalizeData = normalizeData;\nexports.filterExtension = filterExtension;\nexports.extractDataFromRawSources = extractDataFromRawSources;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromArray = _Rx$Observable.fromArray;\nvar merge = _Rx$Observable.merge;\nfunction hasModelUrl(data) {\n  if (data && data.hasOwnProperty('modelUrl')) return true;\n  return false;\n}\n\nfunction hasDesignUrl(data) {\n  if (data && data.hasOwnProperty('designUrl')) return true;\n  return false;\n}\n\nfunction validateExtension(extensions, entry) {\n  return extensions.indexOf((0, _utils.getExtension)(entry)) > -1;\n}\n\nfunction filterByExtensions(input, extensions) {\n  return input.flatMap(fromArray).filter(_utils.exists).filter(function (data) {\n    return validateExtension(extensions, data.name || data);\n  }).map(_utils.toArray).filter(function (data) {\n    data = data.filter(_utils.exists).filter(function (data) {\n      return !(0, _utils.isEmpty)(data);\n    });\n    return data.length > 0;\n  });\n}\n\nfunction normalizeData(input) {\n  return input.map(_utils.toArray).filter(function (data) {\n    data = data.filter(_utils.exists).filter(function (data) {\n      return !(0, _utils.isEmpty)(data);\n    });\n    return data.length > 0;\n  });\n}\n\nfunction filterExtension(input, extensions) {\n  // extensions should be provided by the parsers that are actually in use see below\n  extensions = extensions || {\n    meshes: ['stl', '3mf', 'amf', 'obj', 'ctm', 'ply'] // FIXME: not great, this makes us need an import + fill here to work    sources: ['scad', 'jscad']\n  };\n  // only load meshes for valid extensions\n  var allValidExtensions = extensions.meshes.concat(extensions.sources);\n\n  return input.flatMap(fromArray).filter(_utils.exists).filter(function (file) {\n    return validateExtension(allValidExtensions, file.name || file);\n  }).map(_utils.toArray).filter(function (data) {\n    data = data.filter(_utils.exists).filter(function (data) {\n      return !(0, _utils.isEmpty)(data);\n    });\n    return data.length > 0;\n  });\n}\n\n/* utility function to dynamically load and use the \"data extractors\" (ie functions that\n   extract useful data from raw data)\n  */\nfunction extractDataFromRawSources(sources, basePath) {\n  var data = Object.keys(sources).map(function (sourceName) {\n    try {\n      var _ret = function () {\n        var modulePath = basePath + '/' + sourceName;\n        var extractorImport = __webpack_require__(365)(modulePath);\n\n        var sourceData = sources[sourceName]; // the raw source of data (ususually a driver)\n        var extractorNames = Object.keys(extractorImport); // all the exports from the module\n        console.log(\"extractorNames\", extractorNames);\n\n        // TODO , find a better way to do this\n        var paramsHelper = {\n          get: function get(category, params) {\n            var data = {\n              'extensions': {\n                meshes: ['stl', '3mf', 'amf', 'obj', 'ctm', 'ply'],\n                sources: ['scad', 'jscad'],\n                other: ['gcode']\n              }\n            };\n            return data[category][params];\n          }\n        };\n\n        // deal with all the different data \"field\" functions that are provided by the imports\n        var refinedData = extractorNames.map(function (name) {\n          var fn = extractorImport[name];\n          if (fn) {\n            var _refinedData = fn(sourceData, paramsHelper).flatMap(fromArray).filter(_utils.exists);\n            return _refinedData;\n          }\n        });\n\n        return {\n          v: refinedData\n        };\n      }();\n\n      if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === \"object\") return _ret.v;\n    } catch (error) {}\n  }).filter(function (data) {\n    return data !== undefined;\n  });\n\n  return merge((0, _ramda.flatten)(data));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/utils.js\n ** module id = 21\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/utils.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\nBase helper for all annotations\n*/\n\nvar AnnotationVisual = (function (_BaseHelper) {\n  _inherits(AnnotationVisual, _BaseHelper);\n\n  function AnnotationVisual(options) {\n    _classCallCheck(this, AnnotationVisual);\n\n    var DEFAULTS = {\n      name: "",\n      drawArrows: true,\n      drawLeftArrow: true,\n      drawRightArrow: true,\n      arrowColor: "000",\n      arrowsPlacement: \'dynamic\', //can be either, dynamic, inside, outside\n      arrowHeadSize: 2.0,\n      arrowHeadWidth: 0.8,\n\n      lineWidth: 1,\n      drawSideLines: true,\n      sideLength: 0,\n      sideLengthExtra: 2, //how much sidelines should stick out\n      sideLineColor: "000",\n      sideLineSide: "front",\n\n      drawLabel: true,\n      labelPos: "center",\n      labelType: "flat", //frontFacing or flat\n      fontSize: 10,\n      fontFace: "Jura",\n      textColor: "#000",\n      textBgColor: null,\n      lengthAsLabel: true, //TODO: "length is too specific change that"\n      textPrefix: "", //TODO: perhas a "textformat method would be better ??\n\n      highlightColor: "#F00"\n    };\n\n    //TODO: how to deal with lineWidth would require not using simple lines but strips\n    //see ANGLE issue on windows platforms\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AnnotationVisual).call(this, options));\n\n    Object.assign(_this, options);\n\n    /*this would be practical for "human referencing": ie\n    for example "front mount hole" for a given measurement etc\n    should name uniqueness be enforced ? yes, makes sense!\n    */\n    //this.name = "";\n\n    //can this object be translated/rotated/scaled on its own ? NOPE\n    _this.transformable = false;\n    return _this;\n  }\n\n  return AnnotationVisual;\n})(_BaseHelper3.default);\n\nexports.default = AnnotationVisual;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/AnnotationVisual.js\n ** module id = 22\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/AnnotationVisual.js?')},function(module,exports,__webpack_require__){eval("\"use strict\";\nvar xstream_1 = __webpack_require__(19);\nvar XStreamAdapter = {\n    adapt: function (originStream, originStreamSubscribe) {\n        if (XStreamAdapter.isValidStream(originStream)) {\n            return originStream;\n        }\n        ;\n        var dispose = null;\n        return xstream_1.default.create({\n            start: function (out) {\n                var observer = out;\n                dispose = originStreamSubscribe(originStream, observer);\n            },\n            stop: function () {\n                if (typeof dispose === 'function') {\n                    dispose();\n                }\n            }\n        });\n    },\n    makeSubject: function () {\n        var stream = xstream_1.default.create();\n        var observer = {\n            next: function (x) { stream.shamefullySendNext(x); },\n            error: function (err) { stream.shamefullySendError(err); },\n            complete: function () { stream.shamefullySendComplete(); }\n        };\n        return { observer: observer, stream: stream };\n    },\n    remember: function (stream) {\n        return stream.remember();\n    },\n    isValidStream: function (stream) {\n        return (typeof stream.addListener === 'function' &&\n            typeof stream.shamefullySendNext === 'function');\n    },\n    streamSubscribe: function (stream, observer) {\n        stream.addListener(observer);\n        return function () { return stream.removeListener(observer); };\n    }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = XStreamAdapter;\n//# sourceMappingURL=index.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/xstream-adapter/lib/index.js\n ** module id = 23\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/xstream-adapter/lib/index.js?")},function(module,exports){eval('"use strict";\nfunction isElement(obj) {\n    return typeof HTMLElement === "object" ?\n        obj instanceof HTMLElement || obj instanceof DocumentFragment :\n        obj && typeof obj === "object" && obj !== null &&\n            (obj.nodeType === 1 || obj.nodeType === 11) &&\n            typeof obj.nodeName === "string";\n}\nexports.SCOPE_PREFIX = "$$CYCLEDOM$$-";\nfunction getElement(selectors) {\n    var domElement = (typeof selectors === "string" ?\n        document.querySelector(selectors) :\n        selectors);\n    if (typeof selectors === "string" && domElement === null) {\n        throw new Error("Cannot render into unknown element `" + selectors + "`");\n    }\n    else if (!isElement(domElement)) {\n        throw new Error("Given container is not a DOM element neither a " +\n            "selector string.");\n    }\n    return domElement;\n}\nexports.getElement = getElement;\nfunction getScope(namespace) {\n    return namespace\n        .filter(function (c) { return c.indexOf(exports.SCOPE_PREFIX) > -1; })\n        .slice(-1) // only need the latest, most specific, isolated boundary\n        .join("");\n}\nexports.getScope = getScope;\nfunction getSelectors(namespace) {\n    return namespace.filter(function (c) { return c.indexOf(exports.SCOPE_PREFIX) === -1; }).join(" ");\n}\nexports.getSelectors = getSelectors;\n//# sourceMappingURL=utils.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/utils.js\n ** module id = 24\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/utils.js?')},function(module,exports,__webpack_require__){eval("\nvar Pipe = __webpack_require__(43).Pipe;\n\nvar Context = function Context(){\n};\n\nContext.prototype.setResult = function(result) {\n	this.result = result;\n	this.hasResult = true;\n	return this;\n};\n\nContext.prototype.exit = function() {\n	this.exiting = true;\n	return this;\n};\n\nContext.prototype.switchTo = function(next, pipe) {\n	if (typeof next === 'string' || next instanceof Pipe) {\n		this.nextPipe = next;\n	} else {\n		this.next = next;\n		if (pipe) {\n			this.nextPipe = pipe;\n		}\n	}\n	return this;\n};\n\nContext.prototype.push = function(child, name) {\n	child.parent = this;\n	if (typeof name !== 'undefined') {\n		child.childName = name;\n	}\n	child.root = this.root || this;\n	child.options = child.options || this.options;\n	if (!this.children) {\n		this.children = [child];\n		this.nextAfterChildren = this.next || null;\n		this.next = child;\n	} else {\n		this.children[this.children.length - 1].next = child;\n		this.children.push(child);\n	}\n	child.next = this;\n	return this;\n};\n\nexports.Context = Context;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/contexts/context.js\n ** module id = 25\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/contexts/context.js?")},function(module,exports,__webpack_require__){eval("var Context = __webpack_require__(25).Context;\nvar dateReviver = __webpack_require__(41);\n\nvar DiffContext = function DiffContext(left, right) {\n  this.left = left;\n  this.right = right;\n  this.pipe = 'diff';\n};\n\nDiffContext.prototype = new Context();\n\nDiffContext.prototype.setResult = function(result) {\n  if (this.options.cloneDiffValues) {\n    var clone = typeof this.options.cloneDiffValues === 'function' ?\n      this.options.cloneDiffValues : function(value) {\n        return JSON.parse(JSON.stringify(value), dateReviver);\n      };\n    if (typeof result[0] === 'object') {\n      result[0] = clone(result[0]);\n    }\n    if (typeof result[1] === 'object') {\n      result[1] = clone(result[1]);\n    }\n  }\n  return Context.prototype.setResult.apply(this, arguments);\n};\n\nexports.DiffContext = DiffContext;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/contexts/diff.js\n ** module id = 26\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/contexts/diff.js?")},function(module,exports,__webpack_require__){eval("var Context = __webpack_require__(25).Context;\n\nvar PatchContext = function PatchContext(left, delta) {\n  this.left = left;\n  this.delta = delta;\n  this.pipe = 'patch';\n};\n\nPatchContext.prototype = new Context();\n\nexports.PatchContext = PatchContext;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/contexts/patch.js\n ** module id = 27\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/contexts/patch.js?")},function(module,exports,__webpack_require__){eval("var Context = __webpack_require__(25).Context;\n\nvar ReverseContext = function ReverseContext(delta) {\n  this.delta = delta;\n  this.pipe = 'reverse';\n};\n\nReverseContext.prototype = new Context();\n\nexports.ReverseContext = ReverseContext;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/contexts/reverse.js\n ** module id = 28\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/contexts/reverse.js?")},function(module,exports){eval("\nexports.isBrowser = typeof window !== 'undefined';\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/environment.js\n ** module id = 29\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/environment.js?")},function(module,exports,__webpack_require__){eval("var base = __webpack_require__(14);\nvar BaseFormatter = base.BaseFormatter;\n\nvar AnnotatedFormatter = function AnnotatedFormatter() {\n  this.includeMoveDestinations = false;\n};\n\nAnnotatedFormatter.prototype = new BaseFormatter();\n\nAnnotatedFormatter.prototype.prepareContext = function(context) {\n  BaseFormatter.prototype.prepareContext.call(this, context);\n  context.indent = function(levels) {\n    this.indentLevel = (this.indentLevel || 0) +\n      (typeof levels === 'undefined' ? 1 : levels);\n    this.indentPad = new Array(this.indentLevel + 1).join('&nbsp;&nbsp;');\n  };\n  context.row = function(json, htmlNote) {\n    context.out('<tr><td style=\"white-space: nowrap;\">' +\n      '<pre class=\"jsondiffpatch-annotated-indent\" style=\"display: inline-block\">');\n    context.out(context.indentPad);\n    context.out('</pre><pre style=\"display: inline-block\">');\n    context.out(json);\n    context.out('</pre></td><td class=\"jsondiffpatch-delta-note\"><div>');\n    context.out(htmlNote);\n    context.out('</div></td></tr>');\n  };\n};\n\nAnnotatedFormatter.prototype.typeFormattterErrorFormatter = function(context, err) {\n  context.row('', '<pre class=\"jsondiffpatch-error\">' + err + '</pre>');\n};\n\nAnnotatedFormatter.prototype.formatTextDiffString = function(context, value) {\n  var lines = this.parseTextDiff(value);\n  context.out('<ul class=\"jsondiffpatch-textdiff\">');\n  for (var i = 0, l = lines.length; i < l; i++) {\n    var line = lines[i];\n    context.out('<li>' +\n      '<div class=\"jsondiffpatch-textdiff-location\">' +\n      '<span class=\"jsondiffpatch-textdiff-line-number\">' +\n      line.location.line +\n      '</span>' +\n      '<span class=\"jsondiffpatch-textdiff-char\">' +\n      line.location.chr +\n      '</span>' +\n      '</div>' +\n      '<div class=\"jsondiffpatch-textdiff-line\">');\n    var pieces = line.pieces;\n    for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {\n      var piece = pieces[pieceIndex];\n      context.out('<span class=\"jsondiffpatch-textdiff-' + piece.type + '\">' +\n        piece.text + '</span>');\n    }\n    context.out('</div></li>');\n  }\n  context.out('</ul>');\n};\n\nAnnotatedFormatter.prototype.rootBegin = function(context, type, nodeType) {\n  context.out('<table class=\"jsondiffpatch-annotated-delta\">');\n  if (type === 'node') {\n    context.row('{');\n    context.indent();\n  }\n  if (nodeType === 'array') {\n    context.row('\"_t\": \"a\",', 'Array delta (member names indicate array indices)');\n  }\n};\n\nAnnotatedFormatter.prototype.rootEnd = function(context, type) {\n  if (type === 'node') {\n    context.indent(-1);\n    context.row('}');\n  }\n  context.out('</table>');\n};\n\nAnnotatedFormatter.prototype.nodeBegin = function(context, key, leftKey, type, nodeType) {\n  context.row('&quot;' + key + '&quot;: {');\n  if (type === 'node') {\n    context.indent();\n  }\n  if (nodeType === 'array') {\n    context.row('\"_t\": \"a\",', 'Array delta (member names indicate array indices)');\n  }\n};\n\nAnnotatedFormatter.prototype.nodeEnd = function(context, key, leftKey, type, nodeType, isLast) {\n  if (type === 'node') {\n    context.indent(-1);\n  }\n  context.row('}' + (isLast ? '' : ','));\n};\n\n/* jshint camelcase: false */\n\nAnnotatedFormatter.prototype.format_unchanged = function() {\n  return;\n};\n\nAnnotatedFormatter.prototype.format_movedestination = function() {\n  return;\n};\n\n\nAnnotatedFormatter.prototype.format_node = function(context, delta, left) {\n  // recurse\n  this.formatDeltaChildren(context, delta, left);\n};\n\nvar wrapPropertyName = function(name) {\n  return '<pre style=\"display:inline-block\">&quot;' + name + '&quot;</pre>';\n};\n\nvar deltaAnnotations = {\n  added: function(delta, left, key, leftKey) {\n    var formatLegend = ' <pre>([newValue])</pre>';\n    if (typeof leftKey === 'undefined') {\n      return 'new value' + formatLegend;\n    }\n    if (typeof leftKey === 'number') {\n      return 'insert at index ' + leftKey + formatLegend;\n    }\n    return 'add property ' + wrapPropertyName(leftKey) + formatLegend;\n  },\n  modified: function(delta, left, key, leftKey) {\n    var formatLegend = ' <pre>([previousValue, newValue])</pre>';\n    if (typeof leftKey === 'undefined') {\n      return 'modify value' + formatLegend;\n    }\n    if (typeof leftKey === 'number') {\n      return 'modify at index ' + leftKey + formatLegend;\n    }\n    return 'modify property ' + wrapPropertyName(leftKey) + formatLegend;\n  },\n  deleted: function(delta, left, key, leftKey) {\n    var formatLegend = ' <pre>([previousValue, 0, 0])</pre>';\n    if (typeof leftKey === 'undefined') {\n      return 'delete value' + formatLegend;\n    }\n    if (typeof leftKey === 'number') {\n      return 'remove index ' + leftKey + formatLegend;\n    }\n    return 'delete property ' + wrapPropertyName(leftKey) + formatLegend;\n  },\n  moved: function(delta, left, key, leftKey) {\n    return 'move from <span title=\"(position to remove at original state)\">index ' +\n      leftKey + '</span> to ' +\n      '<span title=\"(position to insert at final state)\">index ' +\n      delta[1] + '</span>';\n  },\n  textdiff: function(delta, left, key, leftKey) {\n    var location = (typeof leftKey === 'undefined') ?\n      '' : (\n        (typeof leftKey === 'number') ?\n        ' at index ' + leftKey :\n        ' at property ' + wrapPropertyName(leftKey)\n      );\n    return 'text diff' + location + ', format is ' +\n      '<a href=\"https://code.google.com/p/google-diff-match-patch/wiki/Unidiff\">' +\n      'a variation of Unidiff</a>';\n  }\n};\n\nvar formatAnyChange = function(context, delta) {\n  var deltaType = this.getDeltaType(delta);\n  var annotator = deltaAnnotations[deltaType];\n  var htmlNote = annotator && annotator.apply(annotator,\n    Array.prototype.slice.call(arguments, 1));\n  var json = JSON.stringify(delta, null, 2);\n  if (deltaType === 'textdiff') {\n    // split text diffs lines\n    json = json.split('\\\\n').join('\\\\n\"+\\n   \"');\n  }\n  context.indent();\n  context.row(json, htmlNote);\n  context.indent(-1);\n};\n\nAnnotatedFormatter.prototype.format_added = formatAnyChange;\nAnnotatedFormatter.prototype.format_modified = formatAnyChange;\nAnnotatedFormatter.prototype.format_deleted = formatAnyChange;\nAnnotatedFormatter.prototype.format_moved = formatAnyChange;\nAnnotatedFormatter.prototype.format_textdiff = formatAnyChange;\n\n/* jshint camelcase: true */\n\nexports.AnnotatedFormatter = AnnotatedFormatter;\n\nvar defaultInstance;\n\nexports.format = function(delta, left) {\n  if (!defaultInstance) {\n    defaultInstance = new AnnotatedFormatter();\n  }\n  return defaultInstance.format(delta, left);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/formatters/annotated.js\n ** module id = 30\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/formatters/annotated.js?")},function(module,exports,__webpack_require__){eval("var base = __webpack_require__(14);\nvar BaseFormatter = base.BaseFormatter;\n\nvar HtmlFormatter = function HtmlFormatter() {};\n\nHtmlFormatter.prototype = new BaseFormatter();\n\nfunction htmlEscape(text) {\n  var html = text;\n  var replacements = [\n    [/&/g, '&amp;'],\n    [/</g, '&lt;'],\n    [/>/g, '&gt;'],\n    [/'/g, '&apos;'],\n    [/\"/g, '&quot;']\n  ];\n  for (var i = 0; i < replacements.length; i++) {\n    html = html.replace(replacements[i][0], replacements[i][1]);\n  }\n  return html;\n}\n\nHtmlFormatter.prototype.typeFormattterErrorFormatter = function(context, err) {\n  context.out('<pre class=\"jsondiffpatch-error\">' + err + '</pre>');\n};\n\nHtmlFormatter.prototype.formatValue = function(context, value) {\n  context.out('<pre>' + htmlEscape(JSON.stringify(value, null, 2)) + '</pre>');\n};\n\nHtmlFormatter.prototype.formatTextDiffString = function(context, value) {\n  var lines = this.parseTextDiff(value);\n  context.out('<ul class=\"jsondiffpatch-textdiff\">');\n  for (var i = 0, l = lines.length; i < l; i++) {\n    var line = lines[i];\n    context.out('<li>' +\n      '<div class=\"jsondiffpatch-textdiff-location\">' +\n      '<span class=\"jsondiffpatch-textdiff-line-number\">' +\n      line.location.line +\n      '</span>' +\n      '<span class=\"jsondiffpatch-textdiff-char\">' +\n      line.location.chr +\n      '</span>' +\n      '</div>' +\n      '<div class=\"jsondiffpatch-textdiff-line\">');\n    var pieces = line.pieces;\n    for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {\n      /* global unescape */\n      var piece = pieces[pieceIndex];\n      context.out('<span class=\"jsondiffpatch-textdiff-' + piece.type + '\">' +\n        htmlEscape(unescape(piece.text)) + '</span>');\n    }\n    context.out('</div></li>');\n  }\n  context.out('</ul>');\n};\n\nvar adjustArrows = function jsondiffpatchHtmlFormatterAdjustArrows(node) {\n  node = node || document;\n  var getElementText = function(el) {\n    return el.textContent || el.innerText;\n  };\n  var eachByQuery = function(el, query, fn) {\n    var elems = el.querySelectorAll(query);\n    for (var i = 0, l = elems.length; i < l; i++) {\n      fn(elems[i]);\n    }\n  };\n  var eachChildren = function(el, fn) {\n    for (var i = 0, l = el.children.length; i < l; i++) {\n      fn(el.children[i], i);\n    }\n  };\n  eachByQuery(node, '.jsondiffpatch-arrow', function(arrow) {\n    var arrowParent = arrow.parentNode;\n    var svg = arrow.children[0],\n      path = svg.children[1];\n    svg.style.display = 'none';\n    var destination = getElementText(arrowParent.querySelector('.jsondiffpatch-moved-destination'));\n    var container = arrowParent.parentNode;\n    var destinationElem;\n    eachChildren(container, function(child) {\n      if (child.getAttribute('data-key') === destination) {\n        destinationElem = child;\n      }\n    });\n    if (!destinationElem) {\n      return;\n    }\n    try {\n      var distance = destinationElem.offsetTop - arrowParent.offsetTop;\n      svg.setAttribute('height', Math.abs(distance) + 6);\n      arrow.style.top = (-8 + (distance > 0 ? 0 : distance)) + 'px';\n      var curve = distance > 0 ?\n        'M30,0 Q-10,' + Math.round(distance / 2) + ' 26,' + (distance - 4) :\n        'M30,' + (-distance) + ' Q-10,' + Math.round(-distance / 2) + ' 26,4';\n      path.setAttribute('d', curve);\n      svg.style.display = '';\n    } catch (err) {\n      return;\n    }\n  });\n};\n\nHtmlFormatter.prototype.rootBegin = function(context, type, nodeType) {\n  var nodeClass = 'jsondiffpatch-' + type +\n    (nodeType ? ' jsondiffpatch-child-node-type-' + nodeType : '');\n  context.out('<div class=\"jsondiffpatch-delta ' + nodeClass + '\">');\n};\n\nHtmlFormatter.prototype.rootEnd = function(context) {\n  context.out('</div>' + (context.hasArrows ?\n    ('<script type=\"text/javascript\">setTimeout(' +\n      adjustArrows.toString() +\n      ',10);</script>') : ''));\n};\n\nHtmlFormatter.prototype.nodeBegin = function(context, key, leftKey, type, nodeType) {\n  var nodeClass = 'jsondiffpatch-' + type +\n    (nodeType ? ' jsondiffpatch-child-node-type-' + nodeType : '');\n  context.out('<li class=\"' + nodeClass + '\" data-key=\"' + leftKey + '\">' +\n    '<div class=\"jsondiffpatch-property-name\">' + leftKey + '</div>');\n};\n\n\nHtmlFormatter.prototype.nodeEnd = function(context) {\n  context.out('</li>');\n};\n\n/* jshint camelcase: false */\n\nHtmlFormatter.prototype.format_unchanged = function(context, delta, left) {\n  if (typeof left === 'undefined') {\n    return;\n  }\n  context.out('<div class=\"jsondiffpatch-value\">');\n  this.formatValue(context, left);\n  context.out('</div>');\n};\n\nHtmlFormatter.prototype.format_movedestination = function(context, delta, left) {\n  if (typeof left === 'undefined') {\n    return;\n  }\n  context.out('<div class=\"jsondiffpatch-value\">');\n  this.formatValue(context, left);\n  context.out('</div>');\n};\n\nHtmlFormatter.prototype.format_node = function(context, delta, left) {\n  // recurse\n  var nodeType = (delta._t === 'a') ? 'array' : 'object';\n  context.out('<ul class=\"jsondiffpatch-node jsondiffpatch-node-type-' + nodeType + '\">');\n  this.formatDeltaChildren(context, delta, left);\n  context.out('</ul>');\n};\n\nHtmlFormatter.prototype.format_added = function(context, delta) {\n  context.out('<div class=\"jsondiffpatch-value\">');\n  this.formatValue(context, delta[0]);\n  context.out('</div>');\n};\n\nHtmlFormatter.prototype.format_modified = function(context, delta) {\n  context.out('<div class=\"jsondiffpatch-value jsondiffpatch-left-value\">');\n  this.formatValue(context, delta[0]);\n  context.out('</div>' +\n    '<div class=\"jsondiffpatch-value jsondiffpatch-right-value\">');\n  this.formatValue(context, delta[1]);\n  context.out('</div>');\n};\n\nHtmlFormatter.prototype.format_deleted = function(context, delta) {\n  context.out('<div class=\"jsondiffpatch-value\">');\n  this.formatValue(context, delta[0]);\n  context.out('</div>');\n};\n\nHtmlFormatter.prototype.format_moved = function(context, delta) {\n  context.out('<div class=\"jsondiffpatch-value\">');\n  this.formatValue(context, delta[0]);\n  context.out('</div><div class=\"jsondiffpatch-moved-destination\">' + delta[1] + '</div>');\n\n  // draw an SVG arrow from here to move destination\n  context.out(\n    /*jshint multistr: true */\n    '<div class=\"jsondiffpatch-arrow\" style=\"position: relative; left: -34px;\">\\\n        <svg width=\"30\" height=\"60\" style=\"position: absolute; display: none;\">\\\n        <defs>\\\n            <marker id=\"markerArrow\" markerWidth=\"8\" markerHeight=\"8\" refx=\"2\" refy=\"4\"\\\n                   orient=\"auto\" markerUnits=\"userSpaceOnUse\">\\\n                <path d=\"M1,1 L1,7 L7,4 L1,1\" style=\"fill: #339;\" />\\\n            </marker>\\\n        </defs>\\\n        <path d=\"M30,0 Q-10,25 26,50\" style=\"stroke: #88f; stroke-width: 2px; fill: none;\\\n        stroke-opacity: 0.5; marker-end: url(#markerArrow);\"></path>\\\n        </svg>\\\n        </div>');\n  context.hasArrows = true;\n};\n\nHtmlFormatter.prototype.format_textdiff = function(context, delta) {\n  context.out('<div class=\"jsondiffpatch-value\">');\n  this.formatTextDiffString(context, delta[0]);\n  context.out('</div>');\n};\n\n/* jshint camelcase: true */\n\nvar showUnchanged = function(show, node, delay) {\n  var el = node || document.body;\n  var prefix = 'jsondiffpatch-unchanged-';\n  var classes = {\n    showing: prefix + 'showing',\n    hiding: prefix + 'hiding',\n    visible: prefix + 'visible',\n    hidden: prefix + 'hidden',\n  };\n  var list = el.classList;\n  if (!list) {\n    return;\n  }\n  if (!delay) {\n    list.remove(classes.showing);\n    list.remove(classes.hiding);\n    list.remove(classes.visible);\n    list.remove(classes.hidden);\n    if (show === false) {\n      list.add(classes.hidden);\n    }\n    return;\n  }\n  if (show === false) {\n    list.remove(classes.showing);\n    list.add(classes.visible);\n    setTimeout(function() {\n      list.add(classes.hiding);\n    }, 10);\n  } else {\n    list.remove(classes.hiding);\n    list.add(classes.showing);\n    list.remove(classes.hidden);\n  }\n  var intervalId = setInterval(function() {\n    adjustArrows(el);\n  }, 100);\n  setTimeout(function() {\n    list.remove(classes.showing);\n    list.remove(classes.hiding);\n    if (show === false) {\n      list.add(classes.hidden);\n      list.remove(classes.visible);\n    } else {\n      list.add(classes.visible);\n      list.remove(classes.hidden);\n    }\n    setTimeout(function() {\n      list.remove(classes.visible);\n      clearInterval(intervalId);\n    }, delay + 400);\n  }, delay);\n};\n\nvar hideUnchanged = function(node, delay) {\n  return showUnchanged(false, node, delay);\n};\n\nexports.HtmlFormatter = HtmlFormatter;\n\nexports.showUnchanged = showUnchanged;\n\nexports.hideUnchanged = hideUnchanged;\n\nvar defaultInstance;\n\nexports.format = function(delta, left) {\n  if (!defaultInstance) {\n    defaultInstance = new HtmlFormatter();\n  }\n  return defaultInstance.format(delta, left);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/formatters/html.js\n ** module id = 31\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/formatters/html.js?");
},function(module,exports,__webpack_require__){eval("(function () {\n  var base = __webpack_require__(14);\n  var BaseFormatter = base.BaseFormatter;\n\n  var named = {\n    added: 'add',\n    deleted: 'remove',\n    modified: 'replace',\n    moved: 'moved',\n    movedestination: 'movedestination',\n    unchanged: 'unchanged',\n    error: 'error',\n    textDiffLine: 'textDiffLine'\n  };\n\n  function JSONFormatter() {\n    this.includeMoveDestinations = false;\n  }\n\n  JSONFormatter.prototype = new BaseFormatter();\n\n  JSONFormatter.prototype.prepareContext = function (context) {\n    BaseFormatter.prototype.prepareContext.call(this, context);\n    context.result = [];\n    context.path = [];\n    context.pushCurrentOp = function (op, value) {\n      var val = {\n        op: op,\n        path: this.currentPath()\n      };\n      if (typeof value !== 'undefined') {\n        val.value = value;\n      }\n      this.result.push(val);\n    };\n\n    context.currentPath = function () {\n      return '/' + this.path.join('/');\n    };\n  };\n\n  JSONFormatter.prototype.typeFormattterErrorFormatter = function (context, err) {\n    context.out('[ERROR]' + err);\n  };\n\n  JSONFormatter.prototype.rootBegin = function () {\n  };\n\n  JSONFormatter.prototype.rootEnd = function () {\n  };\n\n  JSONFormatter.prototype.nodeBegin = function (context, key, leftKey) {\n    context.path.push(leftKey);\n  };\n\n  JSONFormatter.prototype.nodeEnd = function (context) {\n    context.path.pop();\n  };\n\n  /* jshint camelcase: false */\n\n  JSONFormatter.prototype.format_unchanged = function (context, delta, left) {\n    if (typeof left === 'undefined') {\n      return;\n    }\n    context.pushCurrentOp(named.unchanged, left);\n  };\n\n  JSONFormatter.prototype.format_movedestination = function (context, delta, left) {\n    if (typeof left === 'undefined') {\n      return;\n    }\n    context.pushCurrentOp(named.movedestination, left);\n  };\n\n  JSONFormatter.prototype.format_node = function (context, delta, left) {\n    this.formatDeltaChildren(context, delta, left);\n  };\n\n  JSONFormatter.prototype.format_added = function (context, delta) {\n    context.pushCurrentOp(named.added, delta[0]);\n  };\n\n  JSONFormatter.prototype.format_modified = function (context, delta) {\n    context.pushCurrentOp(named.modified, delta[1]);\n  };\n\n  JSONFormatter.prototype.format_deleted = function (context) {\n    context.pushCurrentOp(named.deleted);\n  };\n\n  JSONFormatter.prototype.format_moved = function (context, delta) {\n    context.pushCurrentOp(named.moved, delta[1]);\n  };\n\n  JSONFormatter.prototype.format_textdiff = function () {\n    throw 'not implimented';\n  };\n\n  JSONFormatter.prototype.format = function (delta, left) {\n    var context = {};\n    this.prepareContext(context);\n    this.recurse(context, delta, left);\n    return context.result;\n  };\n  /* jshint camelcase: true */\n\n  exports.JSONFormatter = JSONFormatter;\n\n  var defaultInstance;\n\n  function last(arr) {\n    return arr[arr.length - 1];\n  }\n\n  function sortBy(arr, pred) {\n    arr.sort(pred);\n    return arr;\n  }\n\n  var compareByIndexDesc = function (indexA, indexB) {\n    var lastA = parseInt(indexA, 10);\n    var lastB = parseInt(indexB, 10);\n    if (!(isNaN(lastA) || isNaN(lastB))) {\n      return lastB - lastA;\n    } else {\n      return 0;\n    }\n  };\n\n  function opsByDescendingOrder(removeOps) {\n    return sortBy(removeOps, function (a, b) {\n      var splitA = a.path.split('/');\n      var splitB = b.path.split('/');\n      if (splitA.length !== splitB.length) {\n        return splitA.length - splitB.length;\n      } else {\n        return compareByIndexDesc(last(splitA), last(splitB));\n      }\n    });\n  }\n\n  function partition(arr, pred) {\n    var left = [];\n    var right = [];\n\n    arr.forEach(function (el) {\n      var coll = pred(el) ? left : right;\n      coll.push(el);\n    });\n    return [left, right];\n  }\n\n  function reorderOps(jsonFormattedDiff) {\n    var removeOpsOtherOps = partition(jsonFormattedDiff, function (operation) {\n      return operation.op === 'remove';\n    });\n    var removeOps = removeOpsOtherOps[0];\n    var otherOps = removeOpsOtherOps[1];\n\n    var removeOpsReverse = opsByDescendingOrder(removeOps);\n    return removeOpsReverse.concat(otherOps);\n  }\n\n\n  var format = function (delta, left) {\n    if (!defaultInstance) {\n      defaultInstance = new JSONFormatter();\n    }\n    return reorderOps(defaultInstance.format(delta, left));\n  };\n\n  exports.log = function (delta, left) {\n    console.log(format(delta, left));\n  };\n\n  exports.format = format;\n})();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/formatters/jsonpatch.js\n ** module id = 32\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/formatters/jsonpatch.js?")},function(module,exports){eval("// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    if (!draining || !currentQueue) {\n        return;\n    }\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = setTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/node-libs-browser/~/process/browser.js\n ** module id = 33\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/node-libs-browser/~/process/browser.js?")},function(module,exports,__webpack_require__){eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n  Copyright (c) 2016 Jed Watson.\n  Licensed under the MIT License (MIT), see\n  http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n	'use strict';\n\n	var hasOwn = {}.hasOwnProperty;\n\n	function classNames () {\n		var classes = [];\n\n		for (var i = 0; i < arguments.length; i++) {\n			var arg = arguments[i];\n			if (!arg) continue;\n\n			var argType = typeof arg;\n\n			if (argType === 'string' || argType === 'number') {\n				classes.push(arg);\n			} else if (Array.isArray(arg)) {\n				classes.push(classNames.apply(null, arg));\n			} else if (argType === 'object') {\n				for (var key in arg) {\n					if (hasOwn.call(arg, key) && arg[key]) {\n						classes.push(key);\n					}\n				}\n			}\n		}\n\n		return classes.join(' ');\n	}\n\n	if (typeof module !== 'undefined' && module.exports) {\n		module.exports = classNames;\n	} else if (true) {\n		// register as 'classnames', consistent with npm package name\n		!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n			return classNames;\n		}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n	} else {\n		window.classNames = classNames;\n	}\n}());\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/classnames/index.js\n ** module id = 34\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/classnames/index.js?")},function(module,exports,__webpack_require__){eval("var environment = __webpack_require__(29);\n\nexports.base = __webpack_require__(14);\nexports.html = __webpack_require__(31);\nexports.annotated = __webpack_require__(30);\nexports.jsonpatch = __webpack_require__(32);\n\nif (!environment.isBrowser) {\n  var consoleModuleName = './console';\n  exports.console = __webpack_require__(275)(consoleModuleName);\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/formatters/index.js\n ** module id = 35\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/formatters/index.js?")},function(module,exports,__webpack_require__){eval('/* WEBPACK VAR INJECTION */(function(setImmediate, clearImmediate) {var nextTick = __webpack_require__(277).nextTick;\nvar apply = Function.prototype.apply;\nvar slice = Array.prototype.slice;\nvar immediateIds = {};\nvar nextImmediateId = 0;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n  return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n  return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) { timeout.close(); };\n\nfunction Timeout(id, clearFn) {\n  this._id = id;\n  this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n  this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n  clearTimeout(item._idleTimeoutId);\n  item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n  clearTimeout(item._idleTimeoutId);\n  item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n  clearTimeout(item._idleTimeoutId);\n\n  var msecs = item._idleTimeout;\n  if (msecs >= 0) {\n    item._idleTimeoutId = setTimeout(function onTimeout() {\n      if (item._onTimeout)\n        item._onTimeout();\n    }, msecs);\n  }\n};\n\n// That\'s not how node.js implements it but the exposed api is the same.\nexports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {\n  var id = nextImmediateId++;\n  var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n\n  immediateIds[id] = true;\n\n  nextTick(function onNextTick() {\n    if (immediateIds[id]) {\n      // fn.call() is faster so we optimize for the common use-case\n      // @see http://jsperf.com/call-apply-segu\n      if (args) {\n        fn.apply(null, args);\n      } else {\n        fn.call(null);\n      }\n      // Prevent ids from leaking\n      exports.clearImmediate(id);\n    }\n  });\n\n  return id;\n};\n\nexports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {\n  delete immediateIds[id];\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(36).setImmediate, __webpack_require__(36).clearImmediate))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/timers-browserify/main.js\n ** module id = 36\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/timers-browserify/main.js?')},function(module,exports){eval("module.exports = function(module) {\r\n	if(!module.webpackPolyfill) {\r\n		module.deprecate = function() {};\r\n		module.paths = [];\r\n		// module.parent = undefined by default\r\n		module.children = [];\r\n		module.webpackPolyfill = 1;\r\n	}\r\n	return module;\r\n}\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** (webpack)/buildin/module.js\n ** module id = 37\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///(webpack)/buildin/module.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.createComponents = createComponents;\nexports.removeComponents = removeComponents;\nexports.duplicateComponents = duplicateComponents;\nexports.makeActionsFromApiFns = makeActionsFromApiFns;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// ///////\n// used for all\nfunction createComponents(defaults, state, inputs) {\n  // console.log("createComponents",inputs)\n\n  return inputs.reduce(function (state, input) {\n    // console.log("createComponents")\n    var inputValue = {};\n    if (input && input.value) inputValue = input.value;\n    var newAttrs = (0, _modelUtils.mergeData)(defaults, inputValue);\n\n    // auto increment ?\n    // auto generate ?\n    var id = (0, _utils.generateUUID)();\n    if (input && input.id !== undefined) {\n      id = input.id;\n    }\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    state[id] = newAttrs;\n    // FIXME big hack, use mutability\n\n    // console.log("done createComponents",state)\n    return state;\n  }, state);\n}\n\nfunction removeComponents(state, inputs) {\n  // FIXME: update data structures\n  // console.log("removeComponents",inputs)\n\n  return inputs.reduce(function (state, input) {\n    state = (0, _modelUtils.mergeData)({}, state);\n    if (input.hasOwnProperty(\'id\')) {\n      // FIXME big hack, use mutability\n      delete state[input.id];\n    } else if (input.hasOwnProperty(\'typeUid\')) {\n      state = Object.keys(state).reduce(function (outState, id) {\n        if (state[id].typeUid !== input.typeUid) {\n          outState[id] = state[id];\n        }\n        return outState;\n      }, {});\n    }\n\n    return state;\n  }, state);\n}\n\nfunction duplicateComponents(state, inputs) {\n  // console.log("duplicatING Components",inputs)\n\n  return inputs.reduce(function (state, input) {\n    var id = input.id;\n    var newId = input.newId;\n\n\n    var source = state[id];\n    var clone = void 0;\n    if (\'clone\' in source) {\n      clone = source.clone();\n      // FIXME specific to mesh components, move it elsewhere\n      clone.material = source.material.clone();\n      clone.userData.entity = {\n        id: newId\n      };\n      clone.pickable = source.pickable;\n    } else {\n      clone = (0, _modelUtils.mergeData)({}, source);\n      clone.id = newId;\n    }\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    // FIXME big hack, use mutability\n    state[newId] = clone;\n\n    // console.log("done duplicateComponents",state)\n    return state;\n  }, state);\n}\n\n// other helpers\nfunction makeActionsFromApiFns(apiFns) {\n  var actions = Object.keys(apiFns).reduce(function (prev, cur) {\n    var key = cur + \'$\';\n    prev[key] = new _rx2.default.Subject();\n    return prev;\n  }, {});\n\n  return actions;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/common.js\n ** module id = 38\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/common.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar LabelHelper = (function (_BaseHelper) {\n  _inherits(LabelHelper, _BaseHelper);\n\n  function LabelHelper(options) {\n    _classCallCheck(this, LabelHelper);\n\n    var DEFAULTS = {\n      text: "",\n      color: "rgba(0, 0, 0, 1)",\n      bgColor: "rgba(255, 255, 255, 1)",\n      background: true,\n      fontSize: 10,\n      fontFace: "Jura", //Open Sans\n      fontWeight: "bold",\n      fontStyle: "",\n\n      borderSize: 0,\n      alphaTest: 0.1,\n      upscale: 10, //texture upscaling ratio\n      baseRatio: 4 };\n\n    //convertion of canvas to webglUnits\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LabelHelper).call(this, options));\n\n    Object.assign(_this, options);\n\n    _this.width = 0;\n    _this.height = 0;\n\n    _this.canvas = document.createElement(\'canvas\');\n    _this.canvas.style.position = "absolute";\n    _this.canvas.width = 256;\n    _this.canvas.height = 256;\n\n    _this.context = _this.canvas.getContext(\'2d\');\n    var texture = new _three2.default.Texture(_this.canvas);\n    _this.texture = texture;\n\n    _this.measureText();\n    _this.drawText();\n    return _this;\n  }\n\n  _createClass(LabelHelper, [{\n    key: "clear",\n    value: function clear() {\n      this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n      this._texture.needsUpdate = true;\n    }\n  }, {\n    key: "setText",\n    value: function setText(text) {\n      this.text = text;\n\n      this.measureText();\n      this.drawText();\n      this.generate();\n    }\n  }, {\n    key: "applyFontStyleToContext",\n    value: function applyFontStyleToContext(measureMode) {\n      measureMode = measureMode !== undefined ? measureMode : true;\n\n      var fontSize = this.charHeight;\n      if (!measureMode) fontSize = this.scaledFontSize;\n\n      var font = this.fontWeight + " " + this.fontStyle + " " + fontSize + "px " + this.fontFace;\n\n      this.context.font = font;\n      this.context.textBaseline = "middle";\n      this.context.textAlign = "center";\n    }\n  }, {\n    key: "measureText",\n    value: function measureText(text) {\n      var pixelRatio = window.devicePixelRatio || 1;\n      var charWidth = 0;\n      var charHeight = pixelRatio * this.fontSize;\n\n      var canvas = this.canvas;\n      var context = this.context;\n      var fontFace = this.fontFace;\n      var fontWeight = this.fontWeight;\n      var fontStyle = this.fontStyle;\n      var borderSize = this.borderSize;\n\n      this.applyFontStyleToContext();\n\n      function getPowerOfTwo(value, pow) {\n        pow = pow || 1;\n        while (pow < value) {\n          pow *= 2;\n        }\n        return pow;\n      }\n\n      //FIXME: hackery based on measurement of specific characters\n      charWidth = context.measureText(Array(100 + 1).join(\'M\')).width / 100;\n      this.charWidth = charWidth;\n      this.charHeight = charHeight;\n\n      charWidth = context.measureText(Array(100 + 1).join(\'M\')).width / 100;\n      charHeight = this.fontSize;\n\n      var rWidth = charWidth * this.text.length;\n      var rHeight = charHeight;\n      var textWidth = context.measureText(text).width;\n\n      textWidth = rWidth;\n      var sqrWidth = getPowerOfTwo(textWidth);\n      var sqrHeight = getPowerOfTwo(2 * this.fontSize);\n\n      var upscale = this.upscale;\n      var baseRatio = this.baseRatio;\n\n      sqrWidth *= upscale;\n      sqrHeight *= upscale;\n\n      this.canvasWidth = sqrWidth;\n      this.canvasHeight = sqrHeight;\n\n      this.width = sqrWidth / (upscale * baseRatio);\n      this.height = sqrHeight / (upscale * baseRatio);\n\n      this.scaledFontSize = this.fontSize * upscale;\n\n      this.textWidth = textWidth * upscale / (upscale * baseRatio);\n      this.textHeight = rHeight * upscale / (upscale * baseRatio);\n\n      //console.log("canvas",sqrWidth, sqrHeight,"Width/height",this.width,this.height,"text (glSizes)",this.textWidth,this.textHeight)\n    }\n  }, {\n    key: "drawText",\n    value: function drawText() {\n      var canvas = this.canvas;\n      var context = this.context;\n      var text = this.text;\n\n      var color = this.color;\n\n      var fontWeight = this.fontWeight;\n      var fontStyle = this.fontStyle;\n      var fontFace = this.fontFace;\n      var charHeight = this.charHeight;\n\n      canvas.width = this.canvasWidth;\n      canvas.height = this.canvasHeight;\n\n      this.applyFontStyleToContext(false);\n\n      context.clearRect(0, 0, canvas.width, canvas.height);\n\n      //context.fillStyle = "#000000"\n      //context.fillRect(0, 0, canvas.width, canvas.height)\n\n      context.fillStyle = "#ffffff";\n      context.fillText(text, canvas.width / 2, canvas.height / 2);\n\n      //textWidth\n      //ctx.strokeStyle="red"\n      //ctx.rect((canvas.width-rWidth)/2,(canvas.height-rHeight)/2,rWidth,rHeight)\n      //ctx.stroke()\n\n      var texture = new _three2.default.Texture(canvas);\n      texture.needsUpdate = true;\n      texture.generateMipmaps = true;\n      texture.magFilter = _three2.default.LinearFilter;\n      texture.minFilter = _three2.default.LinearFilter;\n      this._texture = texture;\n    }\n  }]);\n\n  return LabelHelper;\n})(_BaseHelper3.default);\n\n/*Perspective 3d helpers*/\n\nvar LabelHelper3d = (function (_LabelHelper) {\n  _inherits(LabelHelper3d, _LabelHelper);\n\n  function LabelHelper3d(options) {\n    _classCallCheck(this, LabelHelper3d);\n\n    var DEFAULTS = {};\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this2 = _possibleConstructorReturn(this, Object.getPrototypeOf(LabelHelper3d).call(this, options));\n\n    Object.assign(_this2, options);\n\n    _this2.generate();\n    return _this2;\n  }\n\n  _createClass(LabelHelper3d, [{\n    key: "generate",\n    value: function generate() {\n      var spriteMaterial = new _three2.default.SpriteMaterial({\n        map: this._texture,\n        transparent: true,\n        alphaTest: this.alphaTest,\n        useScreenCoordinates: false,\n        scaleByViewport: false,\n        color: this.color,\n        side: _three2.default.DoubleSide\n      });\n\n      //depthTest:false,\n      //depthWrite:false,\n      //renderDepth : 1e20\n      var width = this.width;\n      var height = this.height;\n\n      var textSprite = new _three2.default.Sprite(spriteMaterial);\n      textSprite.scale.set(width, height, 1.0);\n\n      this.textSprite = textSprite;\n      this.add(textSprite);\n    }\n  }]);\n\n  return LabelHelper3d;\n})(LabelHelper);\n\n/*Flat (perspective not front facing) helper*/\n\nvar LabelHelperPlane = (function (_LabelHelper2) {\n  _inherits(LabelHelperPlane, _LabelHelper2);\n\n  function LabelHelperPlane(options) {\n    _classCallCheck(this, LabelHelperPlane);\n\n    var DEFAULTS = {\n      highlightColor: "#F00"\n    };\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this3 = _possibleConstructorReturn(this, Object.getPrototypeOf(LabelHelperPlane).call(this, options));\n\n    Object.assign(_this3, options);\n    _this3.generate();\n    return _this3;\n  }\n\n  _createClass(LabelHelperPlane, [{\n    key: "generate",\n    value: function generate() {\n      var width = this.width;\n      var height = this.height;\n      //console.log("width", width,"height", height)\n\n      var material = new _GizmoMaterial.GizmoMaterial({\n        map: this._texture,\n        transparent: true,\n        color: this.color,\n        highlightColor: this.highlightColor,\n        alphaTest: this.alphaTest,\n        side: _three2.default.FrontSide,\n        shading: _three2.default.FlatShading\n      });\n\n      /*depthTest:false,\n       depthWrite:false,\n       renderDepth : 1e20,*/\n\n      var textPlane = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(width, height), material);\n\n      if (this.textMesh) this.remove(this.textMesh);\n\n      this.textMesh = textPlane;\n      this.add(textPlane);\n\n      if (this.textPlaneBack) this.remove(this.textPlaneBack);\n\n      this.textPlaneBack = textPlane.clone();\n      this.textPlaneBack.rotation.y = -Math.PI;\n      this.add(this.textPlaneBack);\n    }\n  }]);\n\n  return LabelHelperPlane;\n})(LabelHelper);\n\n//export {}\n\nmodule.exports = { LabelHelperPlane: LabelHelperPlane, LabelHelper3d: LabelHelper3d };\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/LabelHelper.js\n ** module id = 39\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/LabelHelper.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _LineHelper = __webpack_require__(256);\n\nvar _LineHelper2 = _interopRequireDefault(_LineHelper);\n\nvar _CrossHelper = __webpack_require__(17);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _LabelHelper = __webpack_require__(39);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n  Made of two main arrows, and two lines perpendicular to the main arrow, at both its ends\n  If the VISUAL distance between start & end of the helper is too short to fit text + arrow:\n   * arrows should be on the outside\n   * if text does not fit either, offset it to the side\n*/\n\n//TODO: how to put items on the left instead of right, front instead of back etc\n\nvar SizeHelper = (function (_BaseHelper) {\n  _inherits(SizeHelper, _BaseHelper);\n\n  function SizeHelper(options) {\n    _classCallCheck(this, SizeHelper);\n\n    var DEFAULTS = {\n      _position: new _three2.default.Vector3(),\n      centerColor: "#F00",\n      crossColor: "#F00",\n      highlightColor: "F00",\n\n      drawArrows: true,\n      drawLeftArrow: true,\n      drawRightArrow: true,\n      arrowColor: "000",\n      arrowsPlacement: \'dynamic\', //can be either, dynamic, inside, outside\n      arrowHeadSize: 2.0,\n      arrowHeadWidth: 0.8,\n      arrowFlatten: 0.3, //by how much to flatten arrows along their "up axis"\n\n      lineWidth: 1, //TODO: how to ? would require not using simple lines but strips\n      //see ANGLE issue on windows platforms\n      drawSideLines: true,\n      sideLength: 0, //length of the small lines perpendicular to the main arrows\n      sideLengthExtra: 2, //how much sidelines should stick out\n      sideLineColor: "000",\n      sideLineSide: "front",\n\n      drawLabel: true,\n      labelPos: "center",\n      labelType: "flat", //frontFacing or flat\n      labelSpacingExtra: 0.1,\n      fontSize: 10,\n      fontFace: "Jura",\n      fontWeight: "bold",\n      fontStyle: "",\n      textColor: "#000",\n      textBgColor: "rgba(255, 255, 255, 0)",\n      lengthAsLabel: true, //TODO: "length is too specific change that"\n      text: "",\n      textPrefix: "", //TODO: perhas a "textformat method would be better ??\n\n      start: undefined,\n      end: undefined,\n      up: new _three2.default.Vector3(0, 0, 1),\n      direction: undefined, //new THREE.Vector3(1,0,0),\n      facingSide: new _three2.default.Vector3(0, 1, 0), //all placement computations are done relative to this one\n      facingMode: "static", //can be static or dynamic\n      length: 0\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SizeHelper).call(this, options));\n\n    _this.DEFAULTS = DEFAULTS; //keep defaults\n\n    Object.assign(_this, options);\n\n    console.log("options", options);\n\n    //FIXME: do this better\n    _this.axisAligned = false;\n    _this.findGoodSide = true;\n\n    _this.leftArrowPos = new _three2.default.Vector3();\n    _this.rightArrowPos = new _three2.default.Vector3();\n    _this.leftArrowDir = new _three2.default.Vector3();\n    _this.rightArrowDir = new _three2.default.Vector3();\n    _this.flatNormal = new _three2.default.Vector3(0, 0, 1);\n    _this.labelPosition = new _three2.default.Vector3();\n    _this.offsetLeftArrowPos = new _three2.default.Vector3();\n    _this.offsetRightArrowPos = new _three2.default.Vector3();\n\n    _this._setupVisuals();\n    _this._computeBasics();\n\n    return _this;\n  }\n\n  /* method compute all the minimal parameters, to have a minimal viable\n  display of size\n   parameter\'s priortity is in descending order as follows:\n    - start & end\n    - lengh & direction\n   you can provide either:\n    - start & end\n    - start & length & direction\n    - end & length & direction\n  */\n\n  _createClass(SizeHelper, [{\n    key: "_computeBasics",\n    value: function _computeBasics() {\n      //either use provided length parameter , or compute things based on start/end parameters\n      var start = this.start;\n      var end = this.end;\n\n      if (end && start) {\n        var tmpV = end.clone().sub(start);\n        this.length = tmpV.length();\n        this.direction = tmpV.normalize();\n      } else if (start && !end && this.direction && this.length) {\n        end = this.direction.clone().multiplyScalar(this.length).add(start);\n      } else if (end && !start && this.direction && this.length) {\n        start = this.direction.clone().negate().multiplyScalar(this.length).add(end);\n      } else if (this.direction && this.length) {\n        start = this.direction.clone().multiplyScalar(-this.length / 2).add(this.position);\n        end = this.direction.clone().multiplyScalar(this.length / 2).add(this.position);\n      } else {\n        //throw new Error("No sufficient parameters provided to generate a SizeHelper")\n        return;\n      }\n\n      this.start = start;\n      this.end = end;\n      //MID is literally the middle point between start & end, nothing more\n      this.mid = this.direction.clone().multiplyScalar(this.length / 2).add(this.start);\n\n      //the size of arrows (if they are drawn) is max half the total length between start & end\n      this.arrowSize = this.length / 2;\n      this.leftArrowDir = this.direction.clone();\n      this.rightArrowDir = this.direction.clone().negate();\n\n      if (this.lengthAsLabel) this.text = this.length.toFixed(2);\n\n      //HACK, for testing\n      if (Math.abs(this.direction.z) - 1 <= 0.0001 && this.direction.x == 0 && this.direction.y == 0) {\n        this.up = new _three2.default.Vector3(1, 0, 0);\n      }\n\n      var cross = this.direction.clone().cross(this.up);\n      cross.normalize().multiplyScalar(this.sideLength);\n      console.log("mid", this.mid, "cross", cross);\n\n      /*let bla = [0,0,0]\n      let axes = ["x","y","z"]\n      axes.forEach( (axis, index) => {\n        if(this.facingSide[axis] != 0)\n        {\n          bla[index] = cross[axis] * this.facingSide[axis]\n        }\n        else{\n          bla[index] = cross[axis]\n        }\n      })\n      cross = new THREE.Vector3().fromArray( bla )\n      console.log("cross", cross)*/\n\n      this.leftArrowPos = this.mid.clone().add(cross);\n      this.rightArrowPos = this.mid.clone().add(cross);\n      this.flatNormal = cross.clone();\n\n      this.offsetMid = this.mid.clone().add(cross.clone().setLength(this.sideLength));\n      this.offsetStart = this.start.clone().add(cross.clone().setLength(this.sideLength));\n      this.offsetEnd = this.end.clone().add(cross.clone().setLength(this.sideLength));\n\n      //compute all the arrow & label positioning details\n      this._computeLabelAndArrowsOffsets();\n      //all the basic are computed, configure visuals\n      this._updateVisuals();\n    }\n\n    /* compute the placement for label & arrows\n      determine positioning for the label/text:\n      Different cases:\n       - arrows pointing inwards:\n        * if label + arrows fits between ends, put label between arrows\n        * if label does not fit between ends\n    */\n\n  }, {\n    key: "_computeLabelAndArrowsOffsets",\n    value: function _computeLabelAndArrowsOffsets() {\n      var sideLength = this.sideLength;\n      var length = this.length;\n      var labelPos = this.labelPos;\n      var labelOrient = new _three2.default.Vector3(-1, 0, 1);\n      var labelHeight = 0;\n      var labelLength = 0;\n      var innerLength = 0;\n      var innerLengthHalf = 0;\n      var labelSpacingExtra = this.labelSpacingExtra;\n      var arrowHeadSize = this.arrowHeadSize;\n      var arrowHeadsLength = this.arrowHeadSize * 2;\n      var arrowSize = this.arrowSize;\n\n      var offsetMid = this.offsetMid;\n      var offsetStart = this.offsetStart;\n      var offsetEnd = this.offsetEnd;\n\n      //generate invisible label/ text\n      //this first one is used to get some labeling metrics, and is\n      //not always displayed\n      var label = new _LabelHelper.LabelHelperPlane({\n        text: this.text,\n        fontSize: this.fontSize,\n        fontWeight: this.fontWeight,\n        fontFace: this.fontFace,\n        color: this.textColor,\n        bgColor: this.textBgColor });\n      label.position.copy(this.leftArrowPos);\n\n      //calculate offset so that there is a hole between the two arrows to draw the label\n      if (this.drawLabel) {\n        labelLength = label.textWidth + labelSpacingExtra * 2;\n        labelHeight = label.textHeight;\n      }\n\n      innerLength = labelLength + arrowHeadsLength;\n      innerLengthHalf = innerLength / 2;\n\n      /*cases\n        - no label : just arrows: \n          - arrows get placed OUTSIDE if size too small (dynamic & inside too)\n        - label: \n          - label + labelBorder  + arrowHeads X2 need to fit between start & end\n          - dynamic :\n            * (labelLength + labelBorder  + arrowHeads X2) < length : do nothing  IE : length - (labelLength + labelBorder) > (arrowHeads X2)\n            * (labelLength + labelBorder) < length but not arrows IE  0 < ( length - (labelLength + labelBorder)) < (arrowHeads X2)\n            \n      */\n      var remLength = length - labelLength; //remaining length (total - label )\n      var roomForBoth = remLength > arrowHeadsLength; //fiting arrow + label is OK\n      var roomForLabel = remLength > 0 && remLength < arrowHeadsLength; //fitting only label is OK\n      var noRoom = remLength < 0; // no room (in hell) to fit either label or arrows\n\n      var actualPos = undefined; //we collapse all possibilities to something simple\n\n      if (this.arrowsPlacement == "dynamic" || this.arrowsPlacement == "inner") {\n        if (roomForBoth) //if the label + arrows would fit\n          {\n            this.arrowSize -= labelLength;\n            this.leftArrowPos.add(this.leftArrowDir.clone().normalize().setLength(labelLength / 2));\n            this.rightArrowPos.add(this.rightArrowDir.clone().normalize().setLength(labelLength / 2));\n          }\n        if (noRoom || roomForLabel) {\n\n          this.arrowSize = Math.max(length / 2, 6); //we want arrows to be more than just arrowhead when we put it "outside"\n          var arrowDist = length / 2 + this.arrowSize;\n\n          //invert the direction of arrows , since we want them "OUTSIDE" of the start & end pointing "IN"\n          this.leftArrowDir = this.direction.clone().negate();\n          this.rightArrowDir = this.leftArrowDir.clone().negate();\n\n          this.leftArrowPos.sub(this.leftArrowDir.clone().normalize().multiplyScalar(arrowDist));\n          this.rightArrowPos.sub(this.rightArrowDir.clone().normalize().multiplyScalar(arrowDist));\n        }\n      } else if (this.arrowsPlacement == "outside") {\n        //put the arrows outside of measure, pointing "inwards" towards center\n        this.arrowSize = Math.max(length / 2, 6); //we want arrows to be more than just arrowhead in all the cases\n        var arrowDist = this.length / 2 + this.arrowSize;\n\n        this.leftArrowDir = this.direction.clone().negate();\n        this.rightArrowDir = this.leftArrowDir.clone().negate();\n\n        this.leftArrowPos.sub(this.leftArrowDir.clone().normalize().multiplyScalar(arrowDist));\n        this.rightArrowPos.sub(this.rightArrowDir.clone().normalize().multiplyScalar(arrowDist));\n\n        if (!roomForLabel) {\n          //this.offsetMid   = this.mid.clone().add( cross.clone().multiplyScalar( this.sideLength ) )\n          //this.offsetStart = this.start.clone().add( cross.clone().multiplyScalar( this.sideLength ) )\n          //this.offsetEnd   = this.end.clone().add( cross.clone().multiplyScalar( this.sideLength ) )\n          //console.log("UH OH , this", this, "will not fit!!")\n          //we want it "to the side" , aligned with the arrow, beyond the arrow head\n          //let lengthOffset = this.length/2 + labelSpacingExtra + arrowHeadSize + labelLength\n          var lengthOffset = label.textWidth / 4 + arrowHeadSize;\n          this.labelPosition = offsetStart.clone().add(this.leftArrowDir.clone().setLength(lengthOffset));\n          labelPos = "top";\n        }\n      } else {\n        var labelHoleHalfSize = labelLength / 2;\n        this.arrowSize -= labelHoleHalfSize;\n        this.leftArrowPos.add(this.leftArrowDir.clone().normalize().setLength(labelHoleHalfSize));\n        this.rightArrowPos.add(this.rightArrowDir.clone().normalize().setLength(labelHoleHalfSize));\n      }\n\n      //offset the label based on centered/top/bottom setting\n      switch (labelPos) {\n        case "center":\n          this.textHeightOffset = new _three2.default.Vector3();\n          break;\n        case "top":\n          this.textHeightOffset = new _three2.default.Vector3().crossVectors(this.up, this.direction).setLength(labelHeight / 2);\n          break;\n        case "bottom":\n          this.textHeightOffset = new _three2.default.Vector3().crossVectors(this.up, this.direction).setLength(labelHeight).negate();\n          break;\n      }\n    }\n  }, {\n    key: "_setupVisuals",\n    value: function _setupVisuals() {\n      //materials\n      this.arrowLineMaterial = new _GizmoMaterial.GizmoLineMaterial({\n        highlightColor: this.highlightColor,\n        color: this.arrowColor,\n        linewidth: this.lineWidth,\n        linecap: "miter" });\n      this.arrowConeMaterial = new _GizmoMaterial.GizmoMaterial({\n        color: this.arrowColor,\n        highlightColor: this.highlightColor\n      });\n\n      //arrows\n      var sideLength = this.sideLength;\n      var leftArrowDir = undefined,\n          rightArrowDir = undefined,\n          leftArrowPos = undefined,\n          rightArrowPos = undefined,\n          arrowHeadSize = undefined,\n          arrowSize = undefined,\n          leftArrowHeadSize = undefined,\n          leftArrowHeadWidth = undefined,\n          rightArrowHeadSize = undefined,\n          rightArrowHeadWidth = undefined;\n\n      leftArrowDir = this.leftArrowDir;\n      rightArrowDir = this.rightArrowDir;\n      leftArrowPos = this.leftArrowPos;\n      rightArrowPos = this.rightArrowPos;\n\n      arrowHeadSize = this.arrowHeadSize;\n      arrowSize = this.arrowSize;\n\n      leftArrowHeadSize = rightArrowHeadSize = this.arrowHeadSize;\n      leftArrowHeadWidth = rightArrowHeadWidth = this.arrowHeadWidth;\n\n      //direction, origin, length, color, headLength, headRadius, headColor\n      this.mainArrowLeft = new _three2.default.ArrowHelper(leftArrowDir, leftArrowPos, arrowSize, this.arrowColor, leftArrowHeadSize, leftArrowHeadWidth);\n      this.mainArrowRight = new _three2.default.ArrowHelper(rightArrowDir, rightArrowPos, arrowSize, this.arrowColor, rightArrowHeadSize, rightArrowHeadWidth);\n\n      if (!this.drawLeftArrow) this.mainArrowLeft.cone.visible = false;\n      if (!this.drawRightArrow) this.mainArrowRight.cone.visible = false;\n\n      this.mainArrowLeft.line.material = this.arrowLineMaterial;\n      this.mainArrowRight.line.material = this.arrowLineMaterial;\n\n      this.mainArrowLeft.cone.material = this.arrowConeMaterial;\n      this.mainArrowRight.cone.material = this.arrowConeMaterial;\n\n      //Flaten in the UP direction(s) , not just z\n      var arrowFlatten = this.arrowFlatten;\n      var arrowFlatScale = new _three2.default.Vector3(arrowFlatten, arrowFlatten, arrowFlatten);\n      arrowFlatScale = new _three2.default.Vector3().multiplyVectors(this.up, arrowFlatScale);\n      var axes = ["x", "y", "z"];\n      axes.forEach(function (axis, index) {\n        if (arrowFlatScale[axis] === 0) arrowFlatScale[axis] = 1;\n      });\n      this.mainArrowLeft.scale.copy(arrowFlatScale);\n      this.mainArrowRight.scale.copy(arrowFlatScale);\n\n      this.add(this.mainArrowLeft);\n      this.add(this.mainArrowRight);\n      //this.add( this.dirDebugArrow )\n\n      this.mainArrowRight.renderDepth = this.mainArrowLeft.renderDepth = 1e20;\n      this.mainArrowRight.depthTest = this.mainArrowLeft.depthTest = false;\n      this.mainArrowRight.depthWrite = this.mainArrowLeft.depthWrite = false;\n      //this.dirDebugArrow.depthWrite  = this.dirDebugArrow.depthTest = false\n\n      ////////sidelines\n      this.leftSideLine = new _LineHelper2.default({\n        lineWidth: this.lineWidth / 1.5,\n        color: this.arrowColor,\n        highlightColor: this.highlightColor\n      });\n      this.rightSideLine = new _LineHelper2.default({\n        lineWidth: this.lineWidth / 1.5,\n        color: this.arrowColor,\n        highlightColor: this.highlightColor\n      });\n\n      this.add(this.rightSideLine);\n      this.add(this.leftSideLine);\n\n      ////////labels\n      switch (this.labelType) {\n        case "flat":\n          this.label = new _LabelHelper.LabelHelperPlane({\n            text: this.text,\n            fontSize: this.fontSize,\n            fontFace: this.fontFace,\n            fontWeight: this.fontWeight,\n            fontStyle: this.fontStyle,\n            color: this.textColor,\n            background: this.textBgColor != null,\n            bgColor: this.textBgColor,\n            highlightColor: this.highlightColor\n          });\n          break;\n        case "frontFacing":\n          this.label = new _LabelHelper.LabelHelper3d({\n            text: this.text,\n            fontSize: this.fontSize,\n            fontFace: this.fontFace,\n            fontWeight: this.fontWeight,\n            fontStyle: this.fontStyle,\n            color: this.textColor,\n            bgColor: this.textBgColor,\n            highlightColor: this.highlightColor\n          });\n          break;\n      }\n      this.label.position.copy(this.labelPosition);\n      this.add(this.label);\n\n      if (!this.drawLabel) {\n        this.label.hide();\n      } else {\n        this.label.show();\n      }\n\n      //debug helpers\n      this.debugHelpers = new _BaseHelper3.default();\n\n      this.directionDebugHelper = new _three2.default.ArrowHelper(new _three2.default.Vector3(1, 0, 0), new _three2.default.Vector3(), 15, 0XFF0000);\n      this.upVectorDebugHelper = new _three2.default.ArrowHelper(new _three2.default.Vector3(1, 0, 0), new _three2.default.Vector3(), 15, 0X0000FF);\n      this.startDebugHelper = new _CrossHelper2.default({ color: 0xFF0000 });\n      this.midDebugHelper = new _CrossHelper2.default({ color: 0x0000FF });\n      this.endDebugHelper = new _CrossHelper2.default({ color: 0x00FF00 });\n\n      this.offsetStartDebugHelper = new _CrossHelper2.default({ color: 0xFF0000 });\n      this.offsetMidDebugHelper = new _CrossHelper2.default({ color: 0x0000FF });\n      this.offsetEndDebugHelper = new _CrossHelper2.default({ color: 0x00FF00 });\n\n      this.debugHelpers.add(this.directionDebugHelper);\n      this.debugHelpers.add(this.upVectorDebugHelper);\n      this.debugHelpers.add(this.startDebugHelper);\n      this.debugHelpers.add(this.midDebugHelper);\n      this.debugHelpers.add(this.endDebugHelper);\n      this.debugHelpers.add(this.offsetStartDebugHelper);\n      this.debugHelpers.add(this.offsetMidDebugHelper);\n      this.debugHelpers.add(this.offsetEndDebugHelper);\n\n      //this.add( this.debugHelpers )\n      if (!this.debug) {\n        this.debugHelpers.hide();\n      } else {\n        this.debugHelpers.show();\n      }\n    }\n  }, {\n    key: "_updateVisuals",\n    value: function _updateVisuals() {\n      var leftArrowDir = undefined,\n          rightArrowDir = undefined,\n          leftArrowPos = undefined,\n          rightArrowPos = undefined,\n          arrowHeadSize = undefined,\n          arrowSize = undefined,\n          leftArrowHeadSize = undefined,\n          leftArrowHeadWidth = undefined,\n          rightArrowHeadSize = undefined,\n          rightArrowHeadWidth = undefined;\n\n      leftArrowDir = this.leftArrowDir;\n      rightArrowDir = this.rightArrowDir;\n      leftArrowPos = this.leftArrowPos;\n      rightArrowPos = this.rightArrowPos;\n\n      arrowHeadSize = this.arrowHeadSize;\n      arrowSize = this.arrowSize;\n\n      this.mainArrowLeft.setLength(arrowSize, this.arrowHeadSize, this.arrowHeadWidth);\n      this.mainArrowLeft.setDirection(leftArrowDir);\n      this.mainArrowLeft.position.copy(leftArrowPos);\n\n      this.mainArrowRight.setLength(arrowSize, this.arrowHeadSize, this.arrowHeadWidth);\n      this.mainArrowRight.setDirection(rightArrowDir);\n      this.mainArrowRight.position.copy(rightArrowPos);\n\n      //Flaten arrows the UP direction(s)\n      var arrowFlatten = this.arrowFlatten;\n      var arrowFlatScale = new _three2.default.Vector3(arrowFlatten, arrowFlatten, arrowFlatten);\n      arrowFlatScale = new _three2.default.Vector3().multiplyVectors(this.up, arrowFlatScale);\n      var axes = ["x", "y", "z"];\n      axes.forEach(function (axis, index) {\n        if (arrowFlatScale[axis] === 0) arrowFlatScale[axis] = 1;\n      });\n      this.mainArrowLeft.scale.copy(arrowFlatScale);\n      this.mainArrowRight.scale.copy(arrowFlatScale);\n\n      ///sidelines\n      var sideLength = this.sideLength;\n      var sideLengthExtra = this.sideLengthExtra;\n\n      var sideLineV = this.flatNormal.clone().setLength(sideLength + sideLengthExtra);\n\n      var lSideLineStart = this.start.clone();\n      var lSideLineEnd = lSideLineStart.clone().add(sideLineV);\n\n      var rSideLineStart = this.end.clone();\n      var rSideLineEnd = rSideLineStart.clone().add(sideLineV);\n      //this.end.clone().sub( this.start )\n\n      this.leftSideLine.setStart(lSideLineStart);\n      this.leftSideLine.setEnd(lSideLineEnd);\n\n      this.rightSideLine.setStart(rSideLineStart);\n      this.rightSideLine.setEnd(rSideLineEnd);\n\n      ///label\n      if (!this.drawLabel) {\n        this.label.hide();\n      } else {\n        this.label.show();\n      }\n      this.label.setText(this.text);\n      this.label.position.copy(this.labelPosition.clone().add(this.textHeightOffset));\n\n      //make the label face the correct way\n      //flatNormal is a custom "up" vector (the way the label / arrows should face)\n\n      //let labelDefaultOrientation = new THREE.Vector3(-1,0,1)\n      //let quaternion = new THREE.Quaternion()\n      //quaternion.setFromUnitVectors ( labelDefaultOrientation, this.direction.clone() )\n\n      //from http://stackoverflow.com/questions/15139649/three-js-two-points-one-cylinder-align-issue\n      var oldPos = this.label.position.clone();\n      sideLength = this.sideLength;\n      sideLineV = this.flatNormal.clone().setLength(sideLength);\n      lSideLineStart = this.start.clone();\n      lSideLineEnd = lSideLineStart.clone().add(sideLineV);\n      rSideLineStart = this.end.clone();\n      rSideLineEnd = rSideLineStart.clone().add(sideLineV);\n\n      var orientation = new _three2.default.Matrix4(); //a new orientation matrix to offset pivot\n      var offsetRotation = new _three2.default.Matrix4(); //a matrix to fix pivot rotation\n      var offsetPosition = new _three2.default.Matrix4(); //a matrix to fix pivot position\n      var up = this.up; //new THREE.Vector3(0,1,0)//this.up\n      var HALF_PI = +Math.PI * .5;\n      orientation.lookAt(lSideLineStart, lSideLineEnd, up); //look at destination\n      offsetRotation.makeRotationX(HALF_PI); //rotate 90 degs on X\n      orientation.multiply(offsetRotation); //combine orientation with rotation transformations\n\n      var newOrient = new _three2.default.Euler().setFromRotationMatrix(orientation);\n\n      function isEulerAlmostEqual(euler, otherEuler) {\n        var precision = arguments.length <= 2 || arguments[2] === undefined ? 0.00001 : arguments[2];\n\n        /*return (\n        ( Math.abs( euler._x - otherEuler._x) < precision ) && \n        ( Math.abs( euler._y - otherEuler._y) < precision ) && \n        ( Math.abs( euler._z - otherEuler._z) < precision ) && \n        ( euler._order === otherEuler._order ) )\n        ||\n        (\n         )*/\n        return euler._x === otherEuler._x && euler._y === -otherEuler._y && euler._order === otherEuler._order;\n      }\n      //if( prev.equals( this.label.rotation ) )//issues with precision\n      if (isEulerAlmostEqual(newOrient, this.label.rotation)) {\n        console.log("already there bud");\n      } else {\n        this.label.applyMatrix(orientation);\n        this.label.position.copy(oldPos);\n        //this.label.position.copy( this.mid )\n      }\n\n      //FIXME: HACK\n      if (this.facingSide.x == -1) {\n        console.log("ughh");\n        //offsetRotation.makeRotationZ( Math.PI )\n        //this.label.rotateOnAxis( new THREE.Vector3(0,0,1), Math.PI )\n      }\n\n      //debug helpers\n      this.directionDebugHelper.setDirection(this.direction);\n      this.upVectorDebugHelper.setDirection(this.up);\n      this.startDebugHelper.position.copy(this.start);\n      this.midDebugHelper.position.copy(this.mid);\n      this.endDebugHelper.position.copy(this.end);\n\n      this.offsetStartDebugHelper.position.copy(this.offsetStart);\n      this.offsetMidDebugHelper.position.copy(this.offsetMid);\n      this.offsetEndDebugHelper.position.copy(this.offsetEnd);\n\n      if (!this.debug) {\n        this.debugHelpers.hide(); //not working ??\n      } else {\n          this.debugHelpers.show();\n        }\n\n      //FIXME: something weird is going on, we have to remove the debug helpers, cannot\n      //hide them ??\n      //this.remove( this.debugHelpers )\n    }\n\n    //setters\n    /* set all parameters from options */\n\n  }, {\n    key: "setFromParams",\n    value: function setFromParams(options) {\n      var defaults = {\n        start: undefined,\n        end: undefined,\n        up: new _three2.default.Vector3(0, 0, 1)\n      };\n\n      this.start = undefined;\n      this.end = undefined;\n      this.up = new _three2.default.Vector3(0, 0, 1);\n      this.direction = undefined; //new THREE.Vector3(1,0,0),\n      this.facingSide = new _three2.default.Vector3(0, 1, 0); //all placement computations are done relative to this one\n\n      this.labelOriented = false;\n\n      this.label.position.set(0, 0, 0);\n      this.label.scale.set(1, 1, 1);\n      this.label.rotation.set(0, 0, 0);\n      this.label.updateMatrix();\n\n      Object.assign(this, options);\n\n      this._computeBasics();\n    }\n  }, {\n    key: "setUp",\n    value: function setUp(up) {\n      this.up = up !== undefined ? up : new _three2.default.Vector3(0, 0, 1);\n      this._computeBasics();\n    }\n  }, {\n    key: "setDirection",\n    value: function setDirection(direction) {\n      this.direction = direction || new _three2.default.Vector3(1, 0, 0);\n      this._computeBasics();\n    }\n  }, {\n    key: "setLength",\n    value: function setLength(length) {\n      /*this.length = length !== undefined ? length : 10\n      \n      this.start = this.direction.clone().multiplyScalar( -this.length/2).add( this._position )\n      this.end   = this.direction.clone().multiplyScalar( this.length/2).add( this._position )\n          this._recomputeMidDir()  */\n    }\n  }, {\n    key: "setSideLength",\n    value: function setSideLength(sideLength) {\n      this.sideLength = sideLength !== undefined ? sideLength : 0;\n      this._computeBasics();\n    }\n  }, {\n    key: "setText",\n    value: function setText(text) {\n      this.text = text !== undefined ? text : "";\n      this._computeBasics();\n    }\n  }, {\n    key: "setStart",\n    value: function setStart(start) {\n      this.start = start || new _three2.default.Vector3();\n      this._computeBasics();\n    }\n  }, {\n    key: "setEnd",\n    value: function setEnd(end) {\n      this.end = end || new _three2.default.Vector3();\n      this._computeBasics();\n    }\n  }, {\n    key: "setFacingSide",\n    value: function setFacingSide(facingSide) {\n      this.facingSide = facingSide || new _three2.default.Vector3();\n      this._computeBasics();\n    }\n  }]);\n\n  return SizeHelper;\n})(_BaseHelper3.default);\n\nexports.default = SizeHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/dimensions/SizeHelper.js\n ** module id = 40\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/dimensions/SizeHelper.js?');
},function(module,exports){eval("// use as 2nd parameter for JSON.parse to revive Date instances\nmodule.exports = function dateReviver(key, value) {\n  var parts;\n  if (typeof value === 'string') {\n    parts = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d*))?(Z|([+\\-])(\\d{2}):(\\d{2}))$/.exec(value);\n    if (parts) {\n      return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4], +parts[5], +parts[6], +(parts[7] || 0)));\n    }\n  }\n  return value;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/date-reviver.js\n ** module id = 41\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/date-reviver.js?")},function(module,exports,__webpack_require__){eval("var chalk = __webpack_require__(304);\nvar base = __webpack_require__(14);\nvar BaseFormatter = base.BaseFormatter;\n\nvar colors = {\n  added: chalk.green,\n  deleted: chalk.red,\n  movedestination: chalk.gray,\n  moved: chalk.yellow,\n  unchanged: chalk.gray,\n  error: chalk.white.bgRed,\n  textDiffLine: chalk.gray\n};\n\nvar ConsoleFormatter = function ConsoleFormatter() {\n  this.includeMoveDestinations = false;\n};\n\nConsoleFormatter.prototype = new BaseFormatter();\n\nConsoleFormatter.prototype.prepareContext = function(context) {\n  BaseFormatter.prototype.prepareContext.call(this, context);\n  context.indent = function(levels) {\n    this.indentLevel = (this.indentLevel || 0) +\n      (typeof levels === 'undefined' ? 1 : levels);\n    this.indentPad = new Array(this.indentLevel + 1).join('  ');\n    this.outLine();\n  };\n  context.outLine = function() {\n    this.buffer.push('\\n' + (this.indentPad || ''));\n  };\n  context.out = function() {\n    for (var i = 0, l = arguments.length; i < l; i++) {\n      var lines = arguments[i].split('\\n');\n      var text = lines.join('\\n' + (this.indentPad || ''));\n      if (this.color && this.color[0]) {\n        text = this.color[0](text);\n      }\n      this.buffer.push(text);\n    }\n  };\n  context.pushColor = function(color) {\n    this.color = this.color || [];\n    this.color.unshift(color);\n  };\n  context.popColor = function() {\n    this.color = this.color || [];\n    this.color.shift();\n  };\n};\n\nConsoleFormatter.prototype.typeFormattterErrorFormatter = function(context, err) {\n  context.pushColor(colors.error);\n  context.out('[ERROR]' + err);\n  context.popColor();\n};\n\nConsoleFormatter.prototype.formatValue = function(context, value) {\n  context.out(JSON.stringify(value, null, 2));\n};\n\nConsoleFormatter.prototype.formatTextDiffString = function(context, value) {\n  var lines = this.parseTextDiff(value);\n  context.indent();\n  for (var i = 0, l = lines.length; i < l; i++) {\n    var line = lines[i];\n    context.pushColor(colors.textDiffLine);\n    context.out(line.location.line + ',' + line.location.chr + ' ');\n    context.popColor();\n    var pieces = line.pieces;\n    for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {\n      var piece = pieces[pieceIndex];\n      context.pushColor(colors[piece.type]);\n      context.out(piece.text);\n      context.popColor();\n    }\n    if (i < l - 1) {\n      context.outLine();\n    }\n  }\n  context.indent(-1);\n};\n\nConsoleFormatter.prototype.rootBegin = function(context, type, nodeType) {\n  context.pushColor(colors[type]);\n  if (type === 'node') {\n    context.out(nodeType === 'array' ? '[' : '{');\n    context.indent();\n  }\n};\n\nConsoleFormatter.prototype.rootEnd = function(context, type, nodeType) {\n  if (type === 'node') {\n    context.indent(-1);\n    context.out(nodeType === 'array' ? ']' : '}');\n  }\n  context.popColor();\n};\n\nConsoleFormatter.prototype.nodeBegin = function(context, key, leftKey, type, nodeType) {\n  context.pushColor(colors[type]);\n  context.out(leftKey + ': ');\n  if (type === 'node') {\n    context.out(nodeType === 'array' ? '[' : '{');\n    context.indent();\n  }\n};\n\nConsoleFormatter.prototype.nodeEnd = function(context, key, leftKey, type, nodeType, isLast) {\n  if (type === 'node') {\n    context.indent(-1);\n    context.out(nodeType === 'array' ? ']' : '}' +\n      (isLast ? '' : ','));\n  }\n  if (!isLast) {\n    context.outLine();\n  }\n  context.popColor();\n};\n\n/* jshint camelcase: false */\n\nConsoleFormatter.prototype.format_unchanged = function(context, delta, left) {\n  if (typeof left === 'undefined') {\n    return;\n  }\n  this.formatValue(context, left);\n};\n\nConsoleFormatter.prototype.format_movedestination = function(context, delta, left) {\n  if (typeof left === 'undefined') {\n    return;\n  }\n  this.formatValue(context, left);\n};\n\nConsoleFormatter.prototype.format_node = function(context, delta, left) {\n  // recurse\n  this.formatDeltaChildren(context, delta, left);\n};\n\nConsoleFormatter.prototype.format_added = function(context, delta) {\n  this.formatValue(context, delta[0]);\n};\n\nConsoleFormatter.prototype.format_modified = function(context, delta) {\n  context.pushColor(colors.deleted);\n  this.formatValue(context, delta[0]);\n  context.popColor();\n  context.out(' => ');\n  context.pushColor(colors.added);\n  this.formatValue(context, delta[1]);\n  context.popColor();\n};\n\nConsoleFormatter.prototype.format_deleted = function(context, delta) {\n  this.formatValue(context, delta[0]);\n};\n\nConsoleFormatter.prototype.format_moved = function(context, delta) {\n  context.out('==> ' + delta[1]);\n};\n\nConsoleFormatter.prototype.format_textdiff = function(context, delta) {\n  this.formatTextDiffString(context, delta[0]);\n};\n\n/* jshint camelcase: true */\n\nexports.ConsoleFormatter = ConsoleFormatter;\n\nvar defaultInstance;\n\nvar format = function(delta, left) {\n  if (!defaultInstance) {\n    defaultInstance = new ConsoleFormatter();\n  }\n  return defaultInstance.format(delta, left);\n};\n\nexports.log = function(delta, left) {\n  console.log(format(delta, left));\n};\n\nexports.format = format;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/formatters/console.js\n ** module id = 42\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/formatters/console.js?")},function(module,exports){eval("var Pipe = function Pipe(name) {\n  this.name = name;\n  this.filters = [];\n};\n\nPipe.prototype.process = function(input) {\n  if (!this.processor) {\n    throw new Error('add this pipe to a processor before using it');\n  }\n  var debug = this.debug;\n  var length = this.filters.length;\n  var context = input;\n  for (var index = 0; index < length; index++) {\n    var filter = this.filters[index];\n    if (debug) {\n      this.log('filter: ' + filter.filterName);\n    }\n    filter(context);\n    if (typeof context === 'object' && context.exiting) {\n      context.exiting = false;\n      break;\n    }\n  }\n  if (!context.next && this.resultCheck) {\n    this.resultCheck(context);\n  }\n};\n\nPipe.prototype.log = function(msg) {\n  console.log('[jsondiffpatch] ' + this.name + ' pipe, ' + msg);\n};\n\nPipe.prototype.append = function() {\n  this.filters.push.apply(this.filters, arguments);\n  return this;\n};\n\nPipe.prototype.prepend = function() {\n  this.filters.unshift.apply(this.filters, arguments);\n  return this;\n};\n\nPipe.prototype.indexOf = function(filterName) {\n  if (!filterName) {\n    throw new Error('a filter name is required');\n  }\n  for (var index = 0; index < this.filters.length; index++) {\n    var filter = this.filters[index];\n    if (filter.filterName === filterName) {\n      return index;\n    }\n  }\n  throw new Error('filter not found: ' + filterName);\n};\n\nPipe.prototype.list = function() {\n  var names = [];\n  for (var index = 0; index < this.filters.length; index++) {\n    var filter = this.filters[index];\n    names.push(filter.filterName);\n  }\n  return names;\n};\n\nPipe.prototype.after = function(filterName) {\n  var index = this.indexOf(filterName);\n  var params = Array.prototype.slice.call(arguments, 1);\n  if (!params.length) {\n    throw new Error('a filter is required');\n  }\n  params.unshift(index + 1, 0);\n  Array.prototype.splice.apply(this.filters, params);\n  return this;\n};\n\nPipe.prototype.before = function(filterName) {\n  var index = this.indexOf(filterName);\n  var params = Array.prototype.slice.call(arguments, 1);\n  if (!params.length) {\n    throw new Error('a filter is required');\n  }\n  params.unshift(index, 0);\n  Array.prototype.splice.apply(this.filters, params);\n  return this;\n};\n\nPipe.prototype.clear = function() {\n  this.filters.length = 0;\n  return this;\n};\n\nPipe.prototype.shouldHaveResult = function(should) {\n  if (should === false) {\n    this.resultCheck = null;\n    return;\n  }\n  if (this.resultCheck) {\n    return;\n  }\n  var pipe = this;\n  this.resultCheck = function(context) {\n    if (!context.hasResult) {\n      console.log(context);\n      var error = new Error(pipe.name + ' failed');\n      error.noResult = true;\n      throw error;\n    }\n  };\n  return this;\n};\n\nexports.Pipe = Pipe;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/pipe.js\n ** module id = 43\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/pipe.js?")},function(module,exports){eval("module.exports = {\n  array: Array.isArray,\n  primitive: function(s) { return typeof s === 'string' || typeof s === 'number'; },\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/is.js\n ** module id = 44\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/is.js?")},function(module,exports,__webpack_require__){eval('"use strict";\nvar is = __webpack_require__(44);\nvar vnode = __webpack_require__(58);\nfunction isGenericStream(x) {\n    return !Array.isArray(x) && typeof x.map === "function";\n}\nfunction mutateStreamWithNS(vNode) {\n    addNS(vNode.data, vNode.children, vNode.sel);\n    return vNode;\n}\nfunction addNS(data, children, selector) {\n    data.ns = "http://www.w3.org/2000/svg";\n    if (selector !== "foreignObject" && typeof children !== "undefined" && is.array(children)) {\n        for (var i = 0; i < children.length; ++i) {\n            if (isGenericStream(children[i])) {\n                children[i] = children[i].map(mutateStreamWithNS);\n            }\n            else {\n                addNS(children[i].data, children[i].children, children[i].sel);\n            }\n        }\n    }\n}\nfunction h(sel, b, c) {\n    var data = {};\n    var children;\n    var text;\n    var i;\n    if (arguments.length === 3) {\n        data = b;\n        if (is.array(c)) {\n            children = c;\n        }\n        else if (is.primitive(c)) {\n            text = c;\n        }\n    }\n    else if (arguments.length === 2) {\n        if (is.array(b)) {\n            children = b;\n        }\n        else if (is.primitive(b)) {\n            text = b;\n        }\n        else {\n            data = b;\n        }\n    }\n    if (is.array(children)) {\n        children = children.filter(function (x) { return x; });\n        for (i = 0; i < children.length; ++i) {\n            if (is.primitive(children[i])) {\n                children[i] = vnode(undefined, undefined, undefined, children[i]);\n            }\n        }\n    }\n    if (sel[0] === \'s\' && sel[1] === \'v\' && sel[2] === \'g\') {\n        addNS(data, children, sel);\n    }\n    return vnode(sel, data, children, text, undefined);\n}\nexports.h = h;\n;\n//# sourceMappingURL=hyperscript.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/hyperscript.js\n ** module id = 45\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/hyperscript.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.transformInputs = transformInputs;\n\nvar _dom = __webpack_require__(16);\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _formatters = __webpack_require__(15);\n\nfunction transformInputs(options) {\n  var defaults = {\n    fieldName: 'pos',\n    unit: 'mm',\n    values: [0, 0, 0],\n    step: 0.1,\n    precision: 2,\n    min: Number.NEGATIVE_INFINITY,\n    disabled: false,\n\n    valuePercents: [0, 0, 0],\n    stepPercents: 1,\n    showPercents: false,\n    disabledPercents: false,\n\n    axes: ['x', 'y', 'z']\n  };\n\n  var _Object$assign = Object.assign({}, defaults, options);\n\n  var fieldName = _Object$assign.fieldName;\n  var unit = _Object$assign.unit;\n  var values = _Object$assign.values;\n  var step = _Object$assign.step;\n  var precision = _Object$assign.precision;\n  var min = _Object$assign.min;\n  var disabled = _Object$assign.disabled;\n  var valuePercents = _Object$assign.valuePercents;\n  var stepPercents = _Object$assign.stepPercents;\n  var showPercents = _Object$assign.showPercents;\n  var disabledPercents = _Object$assign.disabledPercents;\n  var axes = _Object$assign.axes;\n\n\n  return axes.map(function (axisName, index) {\n    var value = (0, _formatters.formatNumberTo)(values[index], precision);\n    var valuePercent = valuePercents[index];\n    var percentGroup = showPercents ? (0, _dom.h)('span.percentGroup', [(0, _dom.h)('input#' + axisName + '-scale-pcent', { key: fieldName + '-' + axisName + '-' + index + '-percent', // VERY important, without this, unexpected controls\n      props: { type: 'number', lang: 'en', className: 'transformsInputPercent percent', value: valuePercent, step: stepPercents, disabled: disabledPercents },\n      attrs: { 'data-transform': fieldName + '_' + index + '_percent' }\n    }), (0, _dom.h)('span.unit', ['%'])]) : '';\n\n    /*<span className='percentGroup'>\n      <input id={`${axisName}-scale-pcent`} type='number' lang='en' value={valuePercent} step={stepPercents}\n        className='transformsInputPercent percent' attributes={{ 'data-transform': `${fieldName}_${index}` }} />\n      <span className='unit'>%</span>\n    </span> : ''*/\n    return (0, _dom.h)('span', { props: { className: 'axisData ' + axisName + '-axis' } }, [(0, _dom.h)('span.valueGroup', [(0, _dom.h)('span.axisName', [axisName.toUpperCase()]), (0, _dom.h)('input#' + axisName + '-' + fieldName, { key: fieldName + '-' + axisName + '-' + index, // VERY important, without this, unexpected controls\n      props: { type: 'number', lang: 'en', className: 'transformsInput value', value: value, step: step, disabled: disabled },\n      attrs: { 'data-transform': fieldName + '_' + index }\n    }), (0, _dom.h)('span.unit', [unit])]), percentGroup]);\n\n    /*<span className={`axisData ${axisName}-axis`}>\n      <span className='valueGroup'>\n        <span className='axisName'>{axisName.toUpperCase()}</span>\n        <input id={`${axisName}-scale`} key={'foo'+index+Math.random()} type='number' lang='en' value={value} step={step}\n          className='transformsInput value' attributes={{ 'data-transform': `${fieldName}_${index}` }} />\n        <span className='unit'>{unit}</span>\n      </span>\n      {percentGroup}\n    </span>*/\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/helpers.js\n ** module id = 46\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/helpers.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.first = first;\nexports.forceTextEllipsis = forceTextEllipsis;\nexports.easyElipsedTextSelection = easyElipsedTextSelection;\nexports.flipValue__ = flipValue__;\nexports.getPropertyByPath = getPropertyByPath;\nexports.setPropertyByPath = setPropertyByPath;\n// ///////////////////////////////\n// generic utils\nfunction first(input) {\n  return input[0];\n}\n\n// forces to show the ellipsis again when a text input element for example goes out of focus or is edited\nfunction forceTextEllipsis(element) {\n  element.setSelectionRange(0, 0);\n  element.blur();\n}\n\n// when the element has an overflow, you automatically select the last position when you click it for editing\nfunction easyElipsedTextSelection(element) {\n  if (element.offsetWidth < element.scrollWidth) {\n    element.setSelectionRange(element.value.length, element.value.length);\n  }\n}\n\nfunction flipValue__(newValue, oldValue) {\n  var val = newValue;\n  var outValue = oldValue === newValue ? undefined : newValue;\n\n  return outValue;\n}\n\n// ///\n\n/* returns an object's (deep) property, given a path as string\ntaken from : http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key\n*/\nfunction getPropertyByPath(obj, path) {\n  /* if(path && path.indexOf('.') === -1) {\n    path = \".\"+path\n  }*/\n\n  var parts = path.split('.'),\n      last = parts.pop(),\n      l = parts.length,\n      i = 1,\n      current = parts[0];\n\n  while (l > 0 && (obj = obj[current]) && i < l) {\n    current = parts[i];\n    i++;\n  }\n\n  if (obj) {\n    return obj[last];\n  }\n}\n\nfunction setPropertyByPath(obj, path, value) {\n  var parts = path.split('.'),\n      last = parts.pop(),\n      l = parts.length,\n      i = 1,\n      current = parts[0];\n\n  while (l > 0 && (obj = obj[current]) && i < l) {\n    current = parts[i];\n    i++;\n  }\n\n  if (obj) {\n    obj[last] = value;\n  }\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/otherUtils.js\n ** module id = 47\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/otherUtils.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.computeBoundingBox = computeBoundingBox;\nexports.computeBoundingSphere = computeBoundingSphere;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction computeBoundingBox(object, force) {\n  var force = force === undefined ? false : force;\n\n  if (object.geometry === undefined) {\n    var bbox = new _three2.default.Box3();\n  } else {\n\n    if (!object.geometry.boundingBox || force) {\n      object.geometry.computeBoundingBox();\n    }\n    var bbox = object.geometry.boundingBox.clone();\n  }\n\n  object.traverse(function (child) {\n\n    if (child instanceof _three2.default.Mesh) {\n      if (child.geometry !== undefined) {\n\n        if (!child.geometry.boundingBox || force) {\n          child.geometry.computeBoundingBox();\n        }\n        var childBox = child.geometry.boundingBox.clone();\n        childBox.translate(child.localToWorld(new _three2.default.Vector3()));\n        bbox.union(childBox);\n      }\n    }\n  });\n  object.boundingBox = bbox;\n  return bbox;\n}\n\nfunction computeBoundingSphere(object, force) {\n  var bbox = new _three2.default.Box3().setFromObject(object);\n\n  if (object.boundingBox) object.boundingBox.copy(bbox);\n  if (!object.boundingBox) object.boundingBox = bbox;\n  object.boundingSphere = bbox.getBoundingSphere();\n  return object.boundingSphere;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/meshTools/computeBounds.js\n ** module id = 48\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/meshTools/computeBounds.js?")},function(module,exports){eval("/**\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @fileoverview Computes the difference between two texts to create a patch.\n * Applies the patch onto another text, allowing for errors.\n * @author fraser@google.com (Neil Fraser)\n */\n\n/**\n * Class containing the diff, match and patch methods.\n * @constructor\n */\nfunction diff_match_patch() {\n\n  // Defaults.\n  // Redefine these in your program to override the defaults.\n\n  // Number of seconds to map a diff before giving up (0 for infinity).\n  this.Diff_Timeout = 1.0;\n  // Cost of an empty edit operation in terms of edit characters.\n  this.Diff_EditCost = 4;\n  // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n  this.Match_Threshold = 0.5;\n  // How far to search for a match (0 = exact location, 1000+ = broad match).\n  // A match this many characters away from the expected location will add\n  // 1.0 to the score (0.0 is a perfect match).\n  this.Match_Distance = 1000;\n  // When deleting a large block of text (over ~64 characters), how close does\n  // the contents have to match the expected contents. (0.0 = perfection,\n  // 1.0 = very loose).  Note that Match_Threshold controls how closely the\n  // end points of a delete need to match.\n  this.Patch_DeleteThreshold = 0.5;\n  // Chunk size for context length.\n  this.Patch_Margin = 4;\n\n  // The number of bits in an int.\n  this.Match_MaxBits = 32;\n}\n\n\n//  DIFF FUNCTIONS\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n/** @typedef {!Array.<number|string>} */\ndiff_match_patch.Diff;\n\n\n/**\n * Find the differences between two texts.  Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {boolean=} opt_checklines Optional speedup flag. If present and false,\n *     then don't run a line-level diff first to identify the changed areas.\n *     Defaults to true, which does a faster, slightly less optimal diff.\n * @param {number} opt_deadline Optional time when the diff should be complete\n *     by.  Used internally for recursive calls.  Users should set DiffTimeout\n *     instead.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,\n    opt_deadline) {\n  // Set a deadline by which time the diff must be complete.\n  if (typeof opt_deadline == 'undefined') {\n    if (this.Diff_Timeout <= 0) {\n      opt_deadline = Number.MAX_VALUE;\n    } else {\n      opt_deadline = (new Date).getTime() + this.Diff_Timeout * 1000;\n    }\n  }\n  var deadline = opt_deadline;\n\n  // Check for null inputs.\n  if (text1 == null || text2 == null) {\n    throw new Error('Null input. (diff_main)');\n  }\n\n  // Check for equality (speedup).\n  if (text1 == text2) {\n    if (text1) {\n      return [[DIFF_EQUAL, text1]];\n    }\n    return [];\n  }\n\n  if (typeof opt_checklines == 'undefined') {\n    opt_checklines = true;\n  }\n  var checklines = opt_checklines;\n\n  // Trim off common prefix (speedup).\n  var commonlength = this.diff_commonPrefix(text1, text2);\n  var commonprefix = text1.substring(0, commonlength);\n  text1 = text1.substring(commonlength);\n  text2 = text2.substring(commonlength);\n\n  // Trim off common suffix (speedup).\n  commonlength = this.diff_commonSuffix(text1, text2);\n  var commonsuffix = text1.substring(text1.length - commonlength);\n  text1 = text1.substring(0, text1.length - commonlength);\n  text2 = text2.substring(0, text2.length - commonlength);\n\n  // Compute the diff on the middle block.\n  var diffs = this.diff_compute_(text1, text2, checklines, deadline);\n\n  // Restore the prefix and suffix.\n  if (commonprefix) {\n    diffs.unshift([DIFF_EQUAL, commonprefix]);\n  }\n  if (commonsuffix) {\n    diffs.push([DIFF_EQUAL, commonsuffix]);\n  }\n  this.diff_cleanupMerge(diffs);\n  return diffs;\n};\n\n\n/**\n * Find the differences between two texts.  Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {boolean} checklines Speedup flag.  If false, then don't run a\n *     line-level diff first to identify the changed areas.\n *     If true, then run a faster, slightly less optimal diff.\n * @param {number} deadline Time when the diff should be complete by.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,\n    deadline) {\n  var diffs;\n\n  if (!text1) {\n    // Just add some text (speedup).\n    return [[DIFF_INSERT, text2]];\n  }\n\n  if (!text2) {\n    // Just delete some text (speedup).\n    return [[DIFF_DELETE, text1]];\n  }\n\n  var longtext = text1.length > text2.length ? text1 : text2;\n  var shorttext = text1.length > text2.length ? text2 : text1;\n  var i = longtext.indexOf(shorttext);\n  if (i != -1) {\n    // Shorter text is inside the longer text (speedup).\n    diffs = [[DIFF_INSERT, longtext.substring(0, i)],\n             [DIFF_EQUAL, shorttext],\n             [DIFF_INSERT, longtext.substring(i + shorttext.length)]];\n    // Swap insertions for deletions if diff is reversed.\n    if (text1.length > text2.length) {\n      diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n    }\n    return diffs;\n  }\n\n  if (shorttext.length == 1) {\n    // Single character string.\n    // After the previous speedup, the character can't be an equality.\n    return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n  }\n  longtext = shorttext = null;  // Garbage collect.\n\n  // Check to see if the problem can be split in two.\n  var hm = this.diff_halfMatch_(text1, text2);\n  if (hm) {\n    // A half-match was found, sort out the return data.\n    var text1_a = hm[0];\n    var text1_b = hm[1];\n    var text2_a = hm[2];\n    var text2_b = hm[3];\n    var mid_common = hm[4];\n    // Send both pairs off for separate processing.\n    var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);\n    var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);\n    // Merge the results.\n    return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n  }\n\n  if (checklines && text1.length > 100 && text2.length > 100) {\n    return this.diff_lineMode_(text1, text2, deadline);\n  }\n\n  return this.diff_bisect_(text1, text2, deadline);\n};\n\n\n/**\n * Do a quick line-level diff on both strings, then rediff the parts for\n * greater accuracy.\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} deadline Time when the diff should be complete by.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {\n  // Scan the text on a line-by-line basis first.\n  var a = this.diff_linesToChars_(text1, text2);\n  text1 = /** @type {string} */(a[0]);\n  text2 = /** @type {string} */(a[1]);\n  var linearray = /** @type {!Array.<string>} */(a[2]);\n\n  var diffs = this.diff_bisect_(text1, text2, deadline);\n\n  // Convert the diff back to original text.\n  this.diff_charsToLines_(diffs, linearray);\n  // Eliminate freak matches (e.g. blank lines)\n  this.diff_cleanupSemantic(diffs);\n\n  // Rediff any replacement blocks, this time character-by-character.\n  // Add a dummy entry at the end.\n  diffs.push([DIFF_EQUAL, '']);\n  var pointer = 0;\n  var count_delete = 0;\n  var count_insert = 0;\n  var text_delete = '';\n  var text_insert = '';\n  while (pointer < diffs.length) {\n    switch (diffs[pointer][0]) {\n      case DIFF_INSERT:\n        count_insert++;\n        text_insert += diffs[pointer][1];\n        break;\n      case DIFF_DELETE:\n        count_delete++;\n        text_delete += diffs[pointer][1];\n        break;\n      case DIFF_EQUAL:\n        // Upon reaching an equality, check for prior redundancies.\n        if (count_delete >= 1 && count_insert >= 1) {\n          // Delete the offending records and add the merged ones.\n          var a = this.diff_main(text_delete, text_insert, false, deadline);\n          diffs.splice(pointer - count_delete - count_insert,\n                       count_delete + count_insert);\n          pointer = pointer - count_delete - count_insert;\n          for (var j = a.length - 1; j >= 0; j--) {\n            diffs.splice(pointer, 0, a[j]);\n          }\n          pointer = pointer + a.length;\n        }\n        count_insert = 0;\n        count_delete = 0;\n        text_delete = '';\n        text_insert = '';\n        break;\n    }\n    pointer++;\n  }\n  diffs.pop();  // Remove the dummy entry at the end.\n\n  return diffs;\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} deadline Time at which to bail if not yet complete.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {\n  // Cache the text lengths to prevent multiple calls.\n  var text1_length = text1.length;\n  var text2_length = text2.length;\n  var max_d = Math.ceil((text1_length + text2_length) / 2);\n  var v_offset = max_d;\n  var v_length = 2 * max_d;\n  var v1 = new Array(v_length);\n  var v2 = new Array(v_length);\n  // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n  // integers and undefined.\n  for (var x = 0; x < v_length; x++) {\n    v1[x] = -1;\n    v2[x] = -1;\n  }\n  v1[v_offset + 1] = 0;\n  v2[v_offset + 1] = 0;\n  var delta = text1_length - text2_length;\n  // If the total number of characters is odd, then the front path will collide\n  // with the reverse path.\n  var front = (delta % 2 != 0);\n  // Offsets for start and end of k loop.\n  // Prevents mapping of space beyond the grid.\n  var k1start = 0;\n  var k1end = 0;\n  var k2start = 0;\n  var k2end = 0;\n  for (var d = 0; d < max_d; d++) {\n    // Bail out if deadline is reached.\n    if ((new Date()).getTime() > deadline) {\n      break;\n    }\n\n    // Walk the front path one step.\n    for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n      var k1_offset = v_offset + k1;\n      var x1;\n      if (k1 == -d || k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1]) {\n        x1 = v1[k1_offset + 1];\n      } else {\n        x1 = v1[k1_offset - 1] + 1;\n      }\n      var y1 = x1 - k1;\n      while (x1 < text1_length && y1 < text2_length &&\n             text1.charAt(x1) == text2.charAt(y1)) {\n        x1++;\n        y1++;\n      }\n      v1[k1_offset] = x1;\n      if (x1 > text1_length) {\n        // Ran off the right of the graph.\n        k1end += 2;\n      } else if (y1 > text2_length) {\n        // Ran off the bottom of the graph.\n        k1start += 2;\n      } else if (front) {\n        var k2_offset = v_offset + delta - k1;\n        if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {\n          // Mirror x2 onto top-left coordinate system.\n          var x2 = text1_length - v2[k2_offset];\n          if (x1 >= x2) {\n            // Overlap detected.\n            return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);\n          }\n        }\n      }\n    }\n\n    // Walk the reverse path one step.\n    for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n      var k2_offset = v_offset + k2;\n      var x2;\n      if (k2 == -d || k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1]) {\n        x2 = v2[k2_offset + 1];\n      } else {\n        x2 = v2[k2_offset - 1] + 1;\n      }\n      var y2 = x2 - k2;\n      while (x2 < text1_length && y2 < text2_length &&\n             text1.charAt(text1_length - x2 - 1) ==\n             text2.charAt(text2_length - y2 - 1)) {\n        x2++;\n        y2++;\n      }\n      v2[k2_offset] = x2;\n      if (x2 > text1_length) {\n        // Ran off the left of the graph.\n        k2end += 2;\n      } else if (y2 > text2_length) {\n        // Ran off the top of the graph.\n        k2start += 2;\n      } else if (!front) {\n        var k1_offset = v_offset + delta - k2;\n        if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {\n          var x1 = v1[k1_offset];\n          var y1 = v_offset + x1 - k1_offset;\n          // Mirror x2 onto top-left coordinate system.\n          x2 = text1_length - x2;\n          if (x1 >= x2) {\n            // Overlap detected.\n            return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);\n          }\n        }\n      }\n    }\n  }\n  // Diff took too long and hit the deadline or\n  // number of diffs equals number of characters, no commonality at all.\n  return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @param {number} deadline Time at which to bail if not yet complete.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x, y,\n    deadline) {\n  var text1a = text1.substring(0, x);\n  var text2a = text2.substring(0, y);\n  var text1b = text1.substring(x);\n  var text2b = text2.substring(y);\n\n  // Compute both diffs serially.\n  var diffs = this.diff_main(text1a, text2a, false, deadline);\n  var diffsb = this.diff_main(text1b, text2b, false, deadline);\n\n  return diffs.concat(diffsb);\n};\n\n\n/**\n * Split two texts into an array of strings.  Reduce the texts to a string of\n * hashes where each Unicode character represents one line.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {!Array.<string|!Array.<string>>} Three element Array, containing the\n *     encoded text1, the encoded text2 and the array of unique strings.  The\n *     zeroth element of the array of unique strings is intentionally blank.\n * @private\n */\ndiff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {\n  var lineArray = [];  // e.g. lineArray[4] == 'Hello\\n'\n  var lineHash = {};   // e.g. lineHash['Hello\\n'] == 4\n\n  // '\\x00' is a valid character, but various debuggers don't like it.\n  // So we'll insert a junk entry to avoid generating a null character.\n  lineArray[0] = '';\n\n  /**\n   * Split a text into an array of strings.  Reduce the texts to a string of\n   * hashes where each Unicode character represents one line.\n   * Modifies linearray and linehash through being a closure.\n   * @param {string} text String to encode.\n   * @return {string} Encoded string.\n   * @private\n   */\n  function diff_linesToCharsMunge_(text) {\n    var chars = '';\n    // Walk the text, pulling out a substring for each line.\n    // text.split('\\n') would would temporarily double our memory footprint.\n    // Modifying text would create many large strings to garbage collect.\n    var lineStart = 0;\n    var lineEnd = -1;\n    // Keeping our own length variable is faster than looking it up.\n    var lineArrayLength = lineArray.length;\n    while (lineEnd < text.length - 1) {\n      lineEnd = text.indexOf('\\n', lineStart);\n      if (lineEnd == -1) {\n        lineEnd = text.length - 1;\n      }\n      var line = text.substring(lineStart, lineEnd + 1);\n      lineStart = lineEnd + 1;\n\n      if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :\n          (lineHash[line] !== undefined)) {\n        chars += String.fromCharCode(lineHash[line]);\n      } else {\n        chars += String.fromCharCode(lineArrayLength);\n        lineHash[line] = lineArrayLength;\n        lineArray[lineArrayLength++] = line;\n      }\n    }\n    return chars;\n  }\n\n  var chars1 = diff_linesToCharsMunge_(text1);\n  var chars2 = diff_linesToCharsMunge_(text2);\n  return [chars1, chars2, lineArray];\n};\n\n\n/**\n * Rehydrate the text in a diff from a string of line hashes to real lines of\n * text.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @param {!Array.<string>} lineArray Array of unique strings.\n * @private\n */\ndiff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {\n  for (var x = 0; x < diffs.length; x++) {\n    var chars = diffs[x][1];\n    var text = [];\n    for (var y = 0; y < chars.length; y++) {\n      text[y] = lineArray[chars.charCodeAt(y)];\n    }\n    diffs[x][1] = text.join('');\n  }\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n *     string.\n */\ndiff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {\n  // Quick check for common null cases.\n  if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {\n    return 0;\n  }\n  // Binary search.\n  // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n  var pointermin = 0;\n  var pointermax = Math.min(text1.length, text2.length);\n  var pointermid = pointermax;\n  var pointerstart = 0;\n  while (pointermin < pointermid) {\n    if (text1.substring(pointerstart, pointermid) ==\n        text2.substring(pointerstart, pointermid)) {\n      pointermin = pointermid;\n      pointerstart = pointermin;\n    } else {\n      pointermax = pointermid;\n    }\n    pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n  }\n  return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\ndiff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {\n  // Quick check for common null cases.\n  if (!text1 || !text2 ||\n      text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {\n    return 0;\n  }\n  // Binary search.\n  // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n  var pointermin = 0;\n  var pointermax = Math.min(text1.length, text2.length);\n  var pointermid = pointermax;\n  var pointerend = 0;\n  while (pointermin < pointermid) {\n    if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n        text2.substring(text2.length - pointermid, text2.length - pointerend)) {\n      pointermin = pointermid;\n      pointerend = pointermin;\n    } else {\n      pointermax = pointermid;\n    }\n    pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n  }\n  return pointermid;\n};\n\n\n/**\n * Determine if the suffix of one string is the prefix of another.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of the first\n *     string and the start of the second string.\n * @private\n */\ndiff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {\n  // Cache the text lengths to prevent multiple calls.\n  var text1_length = text1.length;\n  var text2_length = text2.length;\n  // Eliminate the null case.\n  if (text1_length == 0 || text2_length == 0) {\n    return 0;\n  }\n  // Truncate the longer string.\n  if (text1_length > text2_length) {\n    text1 = text1.substring(text1_length - text2_length);\n  } else if (text1_length < text2_length) {\n    text2 = text2.substring(0, text1_length);\n  }\n  var text_length = Math.min(text1_length, text2_length);\n  // Quick check for the worst case.\n  if (text1 == text2) {\n    return text_length;\n  }\n\n  // Start by looking for a single character match\n  // and increase length until no match is found.\n  // Performance analysis: http://neil.fraser.name/news/2010/11/04/\n  var best = 0;\n  var length = 1;\n  while (true) {\n    var pattern = text1.substring(text_length - length);\n    var found = text2.indexOf(pattern);\n    if (found == -1) {\n      return best;\n    }\n    length += found;\n    if (found == 0 || text1.substring(text_length - length) ==\n        text2.substring(0, length)) {\n      best = length;\n      length++;\n    }\n  }\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.<string>} Five element Array, containing the prefix of\n *     text1, the suffix of text1, the prefix of text2, the suffix of\n *     text2 and the common middle.  Or null if there was no match.\n * @private\n */\ndiff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {\n  if (this.Diff_Timeout <= 0) {\n    // Don't risk returning a non-optimal diff if we have unlimited time.\n    return null;\n  }\n  var longtext = text1.length > text2.length ? text1 : text2;\n  var shorttext = text1.length > text2.length ? text2 : text1;\n  if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n    return null;  // Pointless.\n  }\n  var dmp = this;  // 'this' becomes 'window' in a closure.\n\n  /**\n   * Does a substring of shorttext exist within longtext such that the substring\n   * is at least half the length of longtext?\n   * Closure, but does not reference any external variables.\n   * @param {string} longtext Longer string.\n   * @param {string} shorttext Shorter string.\n   * @param {number} i Start index of quarter length substring within longtext.\n   * @return {Array.<string>} Five element Array, containing the prefix of\n   *     longtext, the suffix of longtext, the prefix of shorttext, the suffix\n   *     of shorttext and the common middle.  Or null if there was no match.\n   * @private\n   */\n  function diff_halfMatchI_(longtext, shorttext, i) {\n    // Start with a 1/4 length substring at position i as a seed.\n    var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n    var j = -1;\n    var best_common = '';\n    var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n    while ((j = shorttext.indexOf(seed, j + 1)) != -1) {\n      var prefixLength = dmp.diff_commonPrefix(longtext.substring(i),\n                                               shorttext.substring(j));\n      var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i),\n                                               shorttext.substring(0, j));\n      if (best_common.length < suffixLength + prefixLength) {\n        best_common = shorttext.substring(j - suffixLength, j) +\n            shorttext.substring(j, j + prefixLength);\n        best_longtext_a = longtext.substring(0, i - suffixLength);\n        best_longtext_b = longtext.substring(i + prefixLength);\n        best_shorttext_a = shorttext.substring(0, j - suffixLength);\n        best_shorttext_b = shorttext.substring(j + prefixLength);\n      }\n    }\n    if (best_common.length * 2 >= longtext.length) {\n      return [best_longtext_a, best_longtext_b,\n              best_shorttext_a, best_shorttext_b, best_common];\n    } else {\n      return null;\n    }\n  }\n\n  // First check if the second quarter is the seed for a half-match.\n  var hm1 = diff_halfMatchI_(longtext, shorttext,\n                             Math.ceil(longtext.length / 4));\n  // Check again based on the third quarter.\n  var hm2 = diff_halfMatchI_(longtext, shorttext,\n                             Math.ceil(longtext.length / 2));\n  var hm;\n  if (!hm1 && !hm2) {\n    return null;\n  } else if (!hm2) {\n    hm = hm1;\n  } else if (!hm1) {\n    hm = hm2;\n  } else {\n    // Both matched.  Select the longest.\n    hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n  }\n\n  // A half-match was found, sort out the return data.\n  var text1_a, text1_b, text2_a, text2_b;\n  if (text1.length > text2.length) {\n    text1_a = hm[0];\n    text1_b = hm[1];\n    text2_a = hm[2];\n    text2_b = hm[3];\n  } else {\n    text2_a = hm[0];\n    text2_b = hm[1];\n    text1_a = hm[2];\n    text1_b = hm[3];\n  }\n  var mid_common = hm[4];\n  return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reduce the number of edits by eliminating semantically trivial equalities.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {\n  var changes = false;\n  var equalities = [];  // Stack of indices where equalities are found.\n  var equalitiesLength = 0;  // Keeping our own length var is faster in JS.\n  /** @type {?string} */\n  var lastequality = null;  // Always equal to equalities[equalitiesLength-1][1]\n  var pointer = 0;  // Index of current position.\n  // Number of characters that changed prior to the equality.\n  var length_insertions1 = 0;\n  var length_deletions1 = 0;\n  // Number of characters that changed after the equality.\n  var length_insertions2 = 0;\n  var length_deletions2 = 0;\n  while (pointer < diffs.length) {\n    if (diffs[pointer][0] == DIFF_EQUAL) {  // Equality found.\n      equalities[equalitiesLength++] = pointer;\n      length_insertions1 = length_insertions2;\n      length_deletions1 = length_deletions2;\n      length_insertions2 = 0;\n      length_deletions2 = 0;\n      lastequality = /** @type {string} */(diffs[pointer][1]);\n    } else {  // An insertion or deletion.\n      if (diffs[pointer][0] == DIFF_INSERT) {\n        length_insertions2 += diffs[pointer][1].length;\n      } else {\n        length_deletions2 += diffs[pointer][1].length;\n      }\n      // Eliminate an equality that is smaller or equal to the edits on both\n      // sides of it.\n      if (lastequality !== null && (lastequality.length <=\n          Math.max(length_insertions1, length_deletions1)) &&\n          (lastequality.length <= Math.max(length_insertions2,\n                                           length_deletions2))) {\n        // Duplicate record.\n        diffs.splice(equalities[equalitiesLength - 1], 0,\n                     [DIFF_DELETE, lastequality]);\n        // Change second copy to insert.\n        diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;\n        // Throw away the equality we just deleted.\n        equalitiesLength--;\n        // Throw away the previous equality (it needs to be reevaluated).\n        equalitiesLength--;\n        pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;\n        length_insertions1 = 0;  // Reset the counters.\n        length_deletions1 = 0;\n        length_insertions2 = 0;\n        length_deletions2 = 0;\n        lastequality = null;\n        changes = true;\n      }\n    }\n    pointer++;\n  }\n\n  // Normalize the diff.\n  if (changes) {\n    this.diff_cleanupMerge(diffs);\n  }\n  this.diff_cleanupSemanticLossless(diffs);\n\n  // Find any overlaps between deletions and insertions.\n  // e.g: <del>abcxxx</del><ins>xxxdef</ins>\n  //   -> <del>abc</del>xxx<ins>def</ins>\n  // Only extract an overlap if it is as big as the edit ahead or behind it.\n  pointer = 1;\n  while (pointer < diffs.length) {\n    if (diffs[pointer - 1][0] == DIFF_DELETE &&\n        diffs[pointer][0] == DIFF_INSERT) {\n      var deletion = /** @type {string} */(diffs[pointer - 1][1]);\n      var insertion = /** @type {string} */(diffs[pointer][1]);\n      var overlap_length = this.diff_commonOverlap_(deletion, insertion);\n      if (overlap_length >= deletion.length / 2 ||\n          overlap_length >= insertion.length / 2) {\n        // Overlap found.  Insert an equality and trim the surrounding edits.\n        diffs.splice(pointer, 0,\n            [DIFF_EQUAL, insertion.substring(0, overlap_length)]);\n        diffs[pointer - 1][1] =\n            deletion.substring(0, deletion.length - overlap_length);\n        diffs[pointer + 1][1] = insertion.substring(overlap_length);\n        pointer++;\n      }\n      pointer++;\n    }\n    pointer++;\n  }\n};\n\n\n/**\n * Look for single edits surrounded on both sides by equalities\n * which can be shifted sideways to align the edit to a word boundary.\n * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {\n  // Define some regex patterns for matching boundaries.\n  var punctuation = /[^a-zA-Z0-9]/;\n  var whitespace = /\\s/;\n  var linebreak = /[\\r\\n]/;\n  var blanklineEnd = /\\n\\r?\\n$/;\n  var blanklineStart = /^\\r?\\n\\r?\\n/;\n\n  /**\n   * Given two strings, compute a score representing whether the internal\n   * boundary falls on logical boundaries.\n   * Scores range from 5 (best) to 0 (worst).\n   * Closure, makes reference to regex patterns defined above.\n   * @param {string} one First string.\n   * @param {string} two Second string.\n   * @return {number} The score.\n   * @private\n   */\n  function diff_cleanupSemanticScore_(one, two) {\n    if (!one || !two) {\n      // Edges are the best.\n      return 5;\n    }\n\n    // Each port of this function behaves slightly differently due to\n    // subtle differences in each language's definition of things like\n    // 'whitespace'.  Since this function's purpose is largely cosmetic,\n    // the choice has been made to use each language's native features\n    // rather than force total conformity.\n    var score = 0;\n    // One point for non-alphanumeric.\n    if (one.charAt(one.length - 1).match(punctuation) ||\n        two.charAt(0).match(punctuation)) {\n      score++;\n      // Two points for whitespace.\n      if (one.charAt(one.length - 1).match(whitespace) ||\n          two.charAt(0).match(whitespace)) {\n        score++;\n        // Three points for line breaks.\n        if (one.charAt(one.length - 1).match(linebreak) ||\n            two.charAt(0).match(linebreak)) {\n          score++;\n          // Four points for blank lines.\n          if (one.match(blanklineEnd) || two.match(blanklineStart)) {\n            score++;\n          }\n        }\n      }\n    }\n    return score;\n  }\n\n  var pointer = 1;\n  // Intentionally ignore the first and last element (don't need checking).\n  while (pointer < diffs.length - 1) {\n    if (diffs[pointer - 1][0] == DIFF_EQUAL &&\n        diffs[pointer + 1][0] == DIFF_EQUAL) {\n      // This is a single edit surrounded by equalities.\n      var equality1 = /** @type {string} */(diffs[pointer - 1][1]);\n      var edit = /** @type {string} */(diffs[pointer][1]);\n      var equality2 = /** @type {string} */(diffs[pointer + 1][1]);\n\n      // First, shift the edit as far left as possible.\n      var commonOffset = this.diff_commonSuffix(equality1, edit);\n      if (commonOffset) {\n        var commonString = edit.substring(edit.length - commonOffset);\n        equality1 = equality1.substring(0, equality1.length - commonOffset);\n        edit = commonString + edit.substring(0, edit.length - commonOffset);\n        equality2 = commonString + equality2;\n      }\n\n      // Second, step character by character right, looking for the best fit.\n      var bestEquality1 = equality1;\n      var bestEdit = edit;\n      var bestEquality2 = equality2;\n      var bestScore = diff_cleanupSemanticScore_(equality1, edit) +\n          diff_cleanupSemanticScore_(edit, equality2);\n      while (edit.charAt(0) === equality2.charAt(0)) {\n        equality1 += edit.charAt(0);\n        edit = edit.substring(1) + equality2.charAt(0);\n        equality2 = equality2.substring(1);\n        var score = diff_cleanupSemanticScore_(equality1, edit) +\n            diff_cleanupSemanticScore_(edit, equality2);\n        // The >= encourages trailing rather than leading whitespace on edits.\n        if (score >= bestScore) {\n          bestScore = score;\n          bestEquality1 = equality1;\n          bestEdit = edit;\n          bestEquality2 = equality2;\n        }\n      }\n\n      if (diffs[pointer - 1][1] != bestEquality1) {\n        // We have an improvement, save it back to the diff.\n        if (bestEquality1) {\n          diffs[pointer - 1][1] = bestEquality1;\n        } else {\n          diffs.splice(pointer - 1, 1);\n          pointer--;\n        }\n        diffs[pointer][1] = bestEdit;\n        if (bestEquality2) {\n          diffs[pointer + 1][1] = bestEquality2;\n        } else {\n          diffs.splice(pointer + 1, 1);\n          pointer--;\n        }\n      }\n    }\n    pointer++;\n  }\n};\n\n\n/**\n * Reduce the number of edits by eliminating operationally trivial equalities.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {\n  var changes = false;\n  var equalities = [];  // Stack of indices where equalities are found.\n  var equalitiesLength = 0;  // Keeping our own length var is faster in JS.\n  var lastequality = '';  // Always equal to equalities[equalitiesLength-1][1]\n  var pointer = 0;  // Index of current position.\n  // Is there an insertion operation before the last equality.\n  var pre_ins = false;\n  // Is there a deletion operation before the last equality.\n  var pre_del = false;\n  // Is there an insertion operation after the last equality.\n  var post_ins = false;\n  // Is there a deletion operation after the last equality.\n  var post_del = false;\n  while (pointer < diffs.length) {\n    if (diffs[pointer][0] == DIFF_EQUAL) {  // Equality found.\n      if (diffs[pointer][1].length < this.Diff_EditCost &&\n          (post_ins || post_del)) {\n        // Candidate found.\n        equalities[equalitiesLength++] = pointer;\n        pre_ins = post_ins;\n        pre_del = post_del;\n        lastequality = diffs[pointer][1];\n      } else {\n        // Not a candidate, and can never become one.\n        equalitiesLength = 0;\n        lastequality = '';\n      }\n      post_ins = post_del = false;\n    } else {  // An insertion or deletion.\n      if (diffs[pointer][0] == DIFF_DELETE) {\n        post_del = true;\n      } else {\n        post_ins = true;\n      }\n      /*\n       * Five types to be split:\n       * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>\n       * <ins>A</ins>X<ins>C</ins><del>D</del>\n       * <ins>A</ins><del>B</del>X<ins>C</ins>\n       * <ins>A</del>X<ins>C</ins><del>D</del>\n       * <ins>A</ins><del>B</del>X<del>C</del>\n       */\n      if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||\n                           ((lastequality.length < this.Diff_EditCost / 2) &&\n                            (pre_ins + pre_del + post_ins + post_del) == 3))) {\n        // Duplicate record.\n        diffs.splice(equalities[equalitiesLength - 1], 0,\n                     [DIFF_DELETE, lastequality]);\n        // Change second copy to insert.\n        diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;\n        equalitiesLength--;  // Throw away the equality we just deleted;\n        lastequality = '';\n        if (pre_ins && pre_del) {\n          // No changes made which could affect previous entry, keep going.\n          post_ins = post_del = true;\n          equalitiesLength = 0;\n        } else {\n          equalitiesLength--;  // Throw away the previous equality.\n          pointer = equalitiesLength > 0 ?\n              equalities[equalitiesLength - 1] : -1;\n          post_ins = post_del = false;\n        }\n        changes = true;\n      }\n    }\n    pointer++;\n  }\n\n  if (changes) {\n    this.diff_cleanupMerge(diffs);\n  }\n};\n\n\n/**\n * Reorder and merge like edit sections.  Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupMerge = function(diffs) {\n  diffs.push([DIFF_EQUAL, '']);  // Add a dummy entry at the end.\n  var pointer = 0;\n  var count_delete = 0;\n  var count_insert = 0;\n  var text_delete = '';\n  var text_insert = '';\n  var commonlength;\n  while (pointer < diffs.length) {\n    switch (diffs[pointer][0]) {\n      case DIFF_INSERT:\n        count_insert++;\n        text_insert += diffs[pointer][1];\n        pointer++;\n        break;\n      case DIFF_DELETE:\n        count_delete++;\n        text_delete += diffs[pointer][1];\n        pointer++;\n        break;\n      case DIFF_EQUAL:\n        // Upon reaching an equality, check for prior redundancies.\n        if (count_delete + count_insert > 1) {\n          if (count_delete !== 0 && count_insert !== 0) {\n            // Factor out any common prefixies.\n            commonlength = this.diff_commonPrefix(text_insert, text_delete);\n            if (commonlength !== 0) {\n              if ((pointer - count_delete - count_insert) > 0 &&\n                  diffs[pointer - count_delete - count_insert - 1][0] ==\n                  DIFF_EQUAL) {\n                diffs[pointer - count_delete - count_insert - 1][1] +=\n                    text_insert.substring(0, commonlength);\n              } else {\n                diffs.splice(0, 0, [DIFF_EQUAL,\n                                    text_insert.substring(0, commonlength)]);\n                pointer++;\n              }\n              text_insert = text_insert.substring(commonlength);\n              text_delete = text_delete.substring(commonlength);\n            }\n            // Factor out any common suffixies.\n            commonlength = this.diff_commonSuffix(text_insert, text_delete);\n            if (commonlength !== 0) {\n              diffs[pointer][1] = text_insert.substring(text_insert.length -\n                  commonlength) + diffs[pointer][1];\n              text_insert = text_insert.substring(0, text_insert.length -\n                  commonlength);\n              text_delete = text_delete.substring(0, text_delete.length -\n                  commonlength);\n            }\n          }\n          // Delete the offending records and add the merged ones.\n          if (count_delete === 0) {\n            diffs.splice(pointer - count_delete - count_insert,\n                count_delete + count_insert, [DIFF_INSERT, text_insert]);\n          } else if (count_insert === 0) {\n            diffs.splice(pointer - count_delete - count_insert,\n                count_delete + count_insert, [DIFF_DELETE, text_delete]);\n          } else {\n            diffs.splice(pointer - count_delete - count_insert,\n                count_delete + count_insert, [DIFF_DELETE, text_delete],\n                [DIFF_INSERT, text_insert]);\n          }\n          pointer = pointer - count_delete - count_insert +\n                    (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;\n        } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {\n          // Merge this equality with the previous one.\n          diffs[pointer - 1][1] += diffs[pointer][1];\n          diffs.splice(pointer, 1);\n        } else {\n          pointer++;\n        }\n        count_insert = 0;\n        count_delete = 0;\n        text_delete = '';\n        text_insert = '';\n        break;\n    }\n  }\n  if (diffs[diffs.length - 1][1] === '') {\n    diffs.pop();  // Remove the dummy entry at the end.\n  }\n\n  // Second pass: look for single edits surrounded on both sides by equalities\n  // which can be shifted sideways to eliminate an equality.\n  // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC\n  var changes = false;\n  pointer = 1;\n  // Intentionally ignore the first and last element (don't need checking).\n  while (pointer < diffs.length - 1) {\n    if (diffs[pointer - 1][0] == DIFF_EQUAL &&\n        diffs[pointer + 1][0] == DIFF_EQUAL) {\n      // This is a single edit surrounded by equalities.\n      if (diffs[pointer][1].substring(diffs[pointer][1].length -\n          diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {\n        // Shift the edit over the previous equality.\n        diffs[pointer][1] = diffs[pointer - 1][1] +\n            diffs[pointer][1].substring(0, diffs[pointer][1].length -\n                                        diffs[pointer - 1][1].length);\n        diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n        diffs.splice(pointer - 1, 1);\n        changes = true;\n      } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n          diffs[pointer + 1][1]) {\n        // Shift the edit over the next equality.\n        diffs[pointer - 1][1] += diffs[pointer + 1][1];\n        diffs[pointer][1] =\n            diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n            diffs[pointer + 1][1];\n        diffs.splice(pointer + 1, 1);\n        changes = true;\n      }\n    }\n    pointer++;\n  }\n  // If shifts were made, the diff needs reordering and another shift sweep.\n  if (changes) {\n    this.diff_cleanupMerge(diffs);\n  }\n};\n\n\n/**\n * loc is a location in text1, compute and return the equivalent location in\n * text2.\n * e.g. 'The cat' vs 'The big cat', 1->1, 5->8\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @param {number} loc Location within text1.\n * @return {number} Location within text2.\n */\ndiff_match_patch.prototype.diff_xIndex = function(diffs, loc) {\n  var chars1 = 0;\n  var chars2 = 0;\n  var last_chars1 = 0;\n  var last_chars2 = 0;\n  var x;\n  for (x = 0; x < diffs.length; x++) {\n    if (diffs[x][0] !== DIFF_INSERT) {  // Equality or deletion.\n      chars1 += diffs[x][1].length;\n    }\n    if (diffs[x][0] !== DIFF_DELETE) {  // Equality or insertion.\n      chars2 += diffs[x][1].length;\n    }\n    if (chars1 > loc) {  // Overshot the location.\n      break;\n    }\n    last_chars1 = chars1;\n    last_chars2 = chars2;\n  }\n  // Was the location was deleted?\n  if (diffs.length != x && diffs[x][0] === DIFF_DELETE) {\n    return last_chars2;\n  }\n  // Add the remaining character length.\n  return last_chars2 + (loc - last_chars1);\n};\n\n\n/**\n * Convert a diff array into a pretty HTML report.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} HTML representation.\n */\ndiff_match_patch.prototype.diff_prettyHtml = function(diffs) {\n  var html = [];\n  var i = 0;\n  var pattern_amp = /&/g;\n  var pattern_lt = /</g;\n  var pattern_gt = />/g;\n  var pattern_para = /\\n/g;\n  for (var x = 0; x < diffs.length; x++) {\n    var op = diffs[x][0];    // Operation (insert, delete, equal)\n    var data = diffs[x][1];  // Text of change.\n    var text = data.replace(pattern_amp, '&amp;').replace(pattern_lt, '&lt;')\n        .replace(pattern_gt, '&gt;').replace(pattern_para, '&para;<br>');\n    switch (op) {\n      case DIFF_INSERT:\n        html[x] = '<ins style=\"background:#e6ffe6;\">' + text + '</ins>';\n        break;\n      case DIFF_DELETE:\n        html[x] = '<del style=\"background:#ffe6e6;\">' + text + '</del>';\n        break;\n      case DIFF_EQUAL:\n        html[x] = '<span>' + text + '</span>';\n        break;\n    }\n    if (op !== DIFF_DELETE) {\n      i += data.length;\n    }\n  }\n  return html.join('');\n};\n\n\n/**\n * Compute and return the source text (all equalities and deletions).\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} Source text.\n */\ndiff_match_patch.prototype.diff_text1 = function(diffs) {\n  var text = [];\n  for (var x = 0; x < diffs.length; x++) {\n    if (diffs[x][0] !== DIFF_INSERT) {\n      text[x] = diffs[x][1];\n    }\n  }\n  return text.join('');\n};\n\n\n/**\n * Compute and return the destination text (all equalities and insertions).\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} Destination text.\n */\ndiff_match_patch.prototype.diff_text2 = function(diffs) {\n  var text = [];\n  for (var x = 0; x < diffs.length; x++) {\n    if (diffs[x][0] !== DIFF_DELETE) {\n      text[x] = diffs[x][1];\n    }\n  }\n  return text.join('');\n};\n\n\n/**\n * Compute the Levenshtein distance; the number of inserted, deleted or\n * substituted characters.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {number} Number of changes.\n */\ndiff_match_patch.prototype.diff_levenshtein = function(diffs) {\n  var levenshtein = 0;\n  var insertions = 0;\n  var deletions = 0;\n  for (var x = 0; x < diffs.length; x++) {\n    var op = diffs[x][0];\n    var data = diffs[x][1];\n    switch (op) {\n      case DIFF_INSERT:\n        insertions += data.length;\n        break;\n      case DIFF_DELETE:\n        deletions += data.length;\n        break;\n      case DIFF_EQUAL:\n        // A deletion and an insertion is one substitution.\n        levenshtein += Math.max(insertions, deletions);\n        insertions = 0;\n        deletions = 0;\n        break;\n    }\n  }\n  levenshtein += Math.max(insertions, deletions);\n  return levenshtein;\n};\n\n\n/**\n * Crush the diff into an encoded string which describes the operations\n * required to transform text1 into text2.\n * E.g. =3\\t-2\\t+ing  -> Keep 3 chars, delete 2 chars, insert 'ing'.\n * Operations are tab-separated.  Inserted text is escaped using %xx notation.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} Delta text.\n */\ndiff_match_patch.prototype.diff_toDelta = function(diffs) {\n  var text = [];\n  for (var x = 0; x < diffs.length; x++) {\n    switch (diffs[x][0]) {\n      case DIFF_INSERT:\n        text[x] = '+' + encodeURI(diffs[x][1]);\n        break;\n      case DIFF_DELETE:\n        text[x] = '-' + diffs[x][1].length;\n        break;\n      case DIFF_EQUAL:\n        text[x] = '=' + diffs[x][1].length;\n        break;\n    }\n  }\n  return text.join('\\t').replace(/%20/g, ' ');\n};\n\n\n/**\n * Given the original text1, and an encoded string which describes the\n * operations required to transform text1 into text2, compute the full diff.\n * @param {string} text1 Source string for the diff.\n * @param {string} delta Delta text.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @throws {!Error} If invalid input.\n */\ndiff_match_patch.prototype.diff_fromDelta = function(text1, delta) {\n  var diffs = [];\n  var diffsLength = 0;  // Keeping our own length var is faster in JS.\n  var pointer = 0;  // Cursor in text1\n  var tokens = delta.split(/\\t/g);\n  for (var x = 0; x < tokens.length; x++) {\n    // Each token begins with a one character parameter which specifies the\n    // operation of this token (delete, insert, equality).\n    var param = tokens[x].substring(1);\n    switch (tokens[x].charAt(0)) {\n      case '+':\n        try {\n          diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)];\n        } catch (ex) {\n          // Malformed URI sequence.\n          throw new Error('Illegal escape in diff_fromDelta: ' + param);\n        }\n        break;\n      case '-':\n        // Fall through.\n      case '=':\n        var n = parseInt(param, 10);\n        if (isNaN(n) || n < 0) {\n          throw new Error('Invalid number in diff_fromDelta: ' + param);\n        }\n        var text = text1.substring(pointer, pointer += n);\n        if (tokens[x].charAt(0) == '=') {\n          diffs[diffsLength++] = [DIFF_EQUAL, text];\n        } else {\n          diffs[diffsLength++] = [DIFF_DELETE, text];\n        }\n        break;\n      default:\n        // Blank tokens are ok (from a trailing \\t).\n        // Anything else is an error.\n        if (tokens[x]) {\n          throw new Error('Invalid diff operation in diff_fromDelta: ' +\n                          tokens[x]);\n        }\n    }\n  }\n  if (pointer != text1.length) {\n    throw new Error('Delta length (' + pointer +\n        ') does not equal source text length (' + text1.length + ').');\n  }\n  return diffs;\n};\n\n\n//  MATCH FUNCTIONS\n\n\n/**\n * Locate the best instance of 'pattern' in 'text' near 'loc'.\n * @param {string} text The text to search.\n * @param {string} pattern The pattern to search for.\n * @param {number} loc The location to search around.\n * @return {number} Best match index or -1.\n */\ndiff_match_patch.prototype.match_main = function(text, pattern, loc) {\n  // Check for null inputs.\n  if (text == null || pattern == null || loc == null) {\n    throw new Error('Null input. (match_main)');\n  }\n\n  loc = Math.max(0, Math.min(loc, text.length));\n  if (text == pattern) {\n    // Shortcut (potentially not guaranteed by the algorithm)\n    return 0;\n  } else if (!text.length) {\n    // Nothing to match.\n    return -1;\n  } else if (text.substring(loc, loc + pattern.length) == pattern) {\n    // Perfect match at the perfect spot!  (Includes case of null pattern)\n    return loc;\n  } else {\n    // Do a fuzzy compare.\n    return this.match_bitap_(text, pattern, loc);\n  }\n};\n\n\n/**\n * Locate the best instance of 'pattern' in 'text' near 'loc' using the\n * Bitap algorithm.\n * @param {string} text The text to search.\n * @param {string} pattern The pattern to search for.\n * @param {number} loc The location to search around.\n * @return {number} Best match index or -1.\n * @private\n */\ndiff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {\n  if (pattern.length > this.Match_MaxBits) {\n    throw new Error('Pattern too long for this browser.');\n  }\n\n  // Initialise the alphabet.\n  var s = this.match_alphabet_(pattern);\n\n  var dmp = this;  // 'this' becomes 'window' in a closure.\n\n  /**\n   * Compute and return the score for a match with e errors and x location.\n   * Accesses loc and pattern through being a closure.\n   * @param {number} e Number of errors in match.\n   * @param {number} x Location of match.\n   * @return {number} Overall score for match (0.0 = good, 1.0 = bad).\n   * @private\n   */\n  function match_bitapScore_(e, x) {\n    var accuracy = e / pattern.length;\n    var proximity = Math.abs(loc - x);\n    if (!dmp.Match_Distance) {\n      // Dodge divide by zero error.\n      return proximity ? 1.0 : accuracy;\n    }\n    return accuracy + (proximity / dmp.Match_Distance);\n  }\n\n  // Highest score beyond which we give up.\n  var score_threshold = this.Match_Threshold;\n  // Is there a nearby exact match? (speedup)\n  var best_loc = text.indexOf(pattern, loc);\n  if (best_loc != -1) {\n    score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);\n    // What about in the other direction? (speedup)\n    best_loc = text.lastIndexOf(pattern, loc + pattern.length);\n    if (best_loc != -1) {\n      score_threshold =\n          Math.min(match_bitapScore_(0, best_loc), score_threshold);\n    }\n  }\n\n  // Initialise the bit arrays.\n  var matchmask = 1 << (pattern.length - 1);\n  best_loc = -1;\n\n  var bin_min, bin_mid;\n  var bin_max = pattern.length + text.length;\n  var last_rd;\n  for (var d = 0; d < pattern.length; d++) {\n    // Scan for the best match; each iteration allows for one more error.\n    // Run a binary search to determine how far from 'loc' we can stray at this\n    // error level.\n    bin_min = 0;\n    bin_mid = bin_max;\n    while (bin_min < bin_mid) {\n      if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {\n        bin_min = bin_mid;\n      } else {\n        bin_max = bin_mid;\n      }\n      bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);\n    }\n    // Use the result from this iteration as the maximum for the next.\n    bin_max = bin_mid;\n    var start = Math.max(1, loc - bin_mid + 1);\n    var finish = Math.min(loc + bin_mid, text.length) + pattern.length;\n\n    var rd = Array(finish + 2);\n    rd[finish + 1] = (1 << d) - 1;\n    for (var j = finish; j >= start; j--) {\n      // The alphabet (s) is a sparse hash, so the following line generates\n      // warnings.\n      var charMatch = s[text.charAt(j - 1)];\n      if (d === 0) {  // First pass: exact match.\n        rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;\n      } else {  // Subsequent passes: fuzzy match.\n        rd[j] = ((rd[j + 1] << 1) | 1) & charMatch |\n                (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |\n                last_rd[j + 1];\n      }\n      if (rd[j] & matchmask) {\n        var score = match_bitapScore_(d, j - 1);\n        // This match will almost certainly be better than any existing match.\n        // But check anyway.\n        if (score <= score_threshold) {\n          // Told you so.\n          score_threshold = score;\n          best_loc = j - 1;\n          if (best_loc > loc) {\n            // When passing loc, don't exceed our current distance from loc.\n            start = Math.max(1, 2 * loc - best_loc);\n          } else {\n            // Already passed loc, downhill from here on in.\n            break;\n          }\n        }\n      }\n    }\n    // No hope for a (better) match at greater error levels.\n    if (match_bitapScore_(d + 1, loc) > score_threshold) {\n      break;\n    }\n    last_rd = rd;\n  }\n  return best_loc;\n};\n\n\n/**\n * Initialise the alphabet for the Bitap algorithm.\n * @param {string} pattern The text to encode.\n * @return {!Object} Hash of character locations.\n * @private\n */\ndiff_match_patch.prototype.match_alphabet_ = function(pattern) {\n  var s = {};\n  for (var i = 0; i < pattern.length; i++) {\n    s[pattern.charAt(i)] = 0;\n  }\n  for (var i = 0; i < pattern.length; i++) {\n    s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);\n  }\n  return s;\n};\n\n\n//  PATCH FUNCTIONS\n\n\n/**\n * Increase the context until it is unique,\n * but don't let the pattern expand beyond Match_MaxBits.\n * @param {!diff_match_patch.patch_obj} patch The patch to grow.\n * @param {string} text Source text.\n * @private\n */\ndiff_match_patch.prototype.patch_addContext_ = function(patch, text) {\n  if (text.length == 0) {\n    return;\n  }\n  var pattern = text.substring(patch.start2, patch.start2 + patch.length1);\n  var padding = 0;\n\n  // Look for the first and last matches of pattern in text.  If two different\n  // matches are found, increase the pattern length.\n  while (text.indexOf(pattern) != text.lastIndexOf(pattern) &&\n         pattern.length < this.Match_MaxBits - this.Patch_Margin -\n         this.Patch_Margin) {\n    padding += this.Patch_Margin;\n    pattern = text.substring(patch.start2 - padding,\n                             patch.start2 + patch.length1 + padding);\n  }\n  // Add one chunk for good luck.\n  padding += this.Patch_Margin;\n\n  // Add the prefix.\n  var prefix = text.substring(patch.start2 - padding, patch.start2);\n  if (prefix) {\n    patch.diffs.unshift([DIFF_EQUAL, prefix]);\n  }\n  // Add the suffix.\n  var suffix = text.substring(patch.start2 + patch.length1,\n                              patch.start2 + patch.length1 + padding);\n  if (suffix) {\n    patch.diffs.push([DIFF_EQUAL, suffix]);\n  }\n\n  // Roll back the start points.\n  patch.start1 -= prefix.length;\n  patch.start2 -= prefix.length;\n  // Extend the lengths.\n  patch.length1 += prefix.length + suffix.length;\n  patch.length2 += prefix.length + suffix.length;\n};\n\n\n/**\n * Compute a list of patches to turn text1 into text2.\n * Use diffs if provided, otherwise compute it ourselves.\n * There are four ways to call this function, depending on what data is\n * available to the caller:\n * Method 1:\n * a = text1, b = text2\n * Method 2:\n * a = diffs\n * Method 3 (optimal):\n * a = text1, b = diffs\n * Method 4 (deprecated, use method 3):\n * a = text1, b = text2, c = diffs\n *\n * @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or\n * Array of diff tuples for text1 to text2 (method 2).\n * @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or\n * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).\n * @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples\n * for text1 to text2 (method 4) or undefined (methods 1,2,3).\n * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.\n */\ndiff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {\n  var text1, diffs;\n  if (typeof a == 'string' && typeof opt_b == 'string' &&\n      typeof opt_c == 'undefined') {\n    // Method 1: text1, text2\n    // Compute diffs from text1 and text2.\n    text1 = /** @type {string} */(a);\n    diffs = this.diff_main(text1, /** @type {string} */(opt_b), true);\n    if (diffs.length > 2) {\n      this.diff_cleanupSemantic(diffs);\n      this.diff_cleanupEfficiency(diffs);\n    }\n  } else if (a && typeof a == 'object' && typeof opt_b == 'undefined' &&\n      typeof opt_c == 'undefined') {\n    // Method 2: diffs\n    // Compute text1 from diffs.\n    diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(a);\n    text1 = this.diff_text1(diffs);\n  } else if (typeof a == 'string' && opt_b && typeof opt_b == 'object' &&\n      typeof opt_c == 'undefined') {\n    // Method 3: text1, diffs\n    text1 = /** @type {string} */(a);\n    diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_b);\n  } else if (typeof a == 'string' && typeof opt_b == 'string' &&\n      opt_c && typeof opt_c == 'object') {\n    // Method 4: text1, text2, diffs\n    // text2 is not used.\n    text1 = /** @type {string} */(a);\n    diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_c);\n  } else {\n    throw new Error('Unknown call format to patch_make.');\n  }\n\n  if (diffs.length === 0) {\n    return [];  // Get rid of the null case.\n  }\n  var patches = [];\n  var patch = new diff_match_patch.patch_obj();\n  var patchDiffLength = 0;  // Keeping our own length var is faster in JS.\n  var char_count1 = 0;  // Number of characters into the text1 string.\n  var char_count2 = 0;  // Number of characters into the text2 string.\n  // Start with text1 (prepatch_text) and apply the diffs until we arrive at\n  // text2 (postpatch_text).  We recreate the patches one by one to determine\n  // context info.\n  var prepatch_text = text1;\n  var postpatch_text = text1;\n  for (var x = 0; x < diffs.length; x++) {\n    var diff_type = diffs[x][0];\n    var diff_text = diffs[x][1];\n\n    if (!patchDiffLength && diff_type !== DIFF_EQUAL) {\n      // A new patch starts here.\n      patch.start1 = char_count1;\n      patch.start2 = char_count2;\n    }\n\n    switch (diff_type) {\n      case DIFF_INSERT:\n        patch.diffs[patchDiffLength++] = diffs[x];\n        patch.length2 += diff_text.length;\n        postpatch_text = postpatch_text.substring(0, char_count2) + diff_text +\n                         postpatch_text.substring(char_count2);\n        break;\n      case DIFF_DELETE:\n        patch.length1 += diff_text.length;\n        patch.diffs[patchDiffLength++] = diffs[x];\n        postpatch_text = postpatch_text.substring(0, char_count2) +\n                         postpatch_text.substring(char_count2 +\n                             diff_text.length);\n        break;\n      case DIFF_EQUAL:\n        if (diff_text.length <= 2 * this.Patch_Margin &&\n            patchDiffLength && diffs.length != x + 1) {\n          // Small equality inside a patch.\n          patch.diffs[patchDiffLength++] = diffs[x];\n          patch.length1 += diff_text.length;\n          patch.length2 += diff_text.length;\n        } else if (diff_text.length >= 2 * this.Patch_Margin) {\n          // Time for a new patch.\n          if (patchDiffLength) {\n            this.patch_addContext_(patch, prepatch_text);\n            patches.push(patch);\n            patch = new diff_match_patch.patch_obj();\n            patchDiffLength = 0;\n            // Unlike Unidiff, our patch lists have a rolling context.\n            // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff\n            // Update prepatch text & pos to reflect the application of the\n            // just completed patch.\n            prepatch_text = postpatch_text;\n            char_count1 = char_count2;\n          }\n        }\n        break;\n    }\n\n    // Update the current character count.\n    if (diff_type !== DIFF_INSERT) {\n      char_count1 += diff_text.length;\n    }\n    if (diff_type !== DIFF_DELETE) {\n      char_count2 += diff_text.length;\n    }\n  }\n  // Pick up the leftover patch if not empty.\n  if (patchDiffLength) {\n    this.patch_addContext_(patch, prepatch_text);\n    patches.push(patch);\n  }\n\n  return patches;\n};\n\n\n/**\n * Given an array of patches, return another array that is identical.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.\n */\ndiff_match_patch.prototype.patch_deepCopy = function(patches) {\n  // Making deep copies is hard in JavaScript.\n  var patchesCopy = [];\n  for (var x = 0; x < patches.length; x++) {\n    var patch = patches[x];\n    var patchCopy = new diff_match_patch.patch_obj();\n    patchCopy.diffs = [];\n    for (var y = 0; y < patch.diffs.length; y++) {\n      patchCopy.diffs[y] = patch.diffs[y].slice();\n    }\n    patchCopy.start1 = patch.start1;\n    patchCopy.start2 = patch.start2;\n    patchCopy.length1 = patch.length1;\n    patchCopy.length2 = patch.length2;\n    patchesCopy[x] = patchCopy;\n  }\n  return patchesCopy;\n};\n\n\n/**\n * Merge a set of patches onto the text.  Return a patched text, as well\n * as a list of true/false values indicating which patches were applied.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @param {string} text Old text.\n * @return {!Array.<string|!Array.<boolean>>} Two element Array, containing the\n *      new text and an array of boolean values.\n */\ndiff_match_patch.prototype.patch_apply = function(patches, text) {\n  if (patches.length == 0) {\n    return [text, []];\n  }\n\n  // Deep copy the patches so that no changes are made to originals.\n  patches = this.patch_deepCopy(patches);\n\n  var nullPadding = this.patch_addPadding(patches);\n  text = nullPadding + text + nullPadding;\n\n  this.patch_splitMax(patches);\n  // delta keeps track of the offset between the expected and actual location\n  // of the previous patch.  If there are patches expected at positions 10 and\n  // 20, but the first patch was found at 12, delta is 2 and the second patch\n  // has an effective expected position of 22.\n  var delta = 0;\n  var results = [];\n  for (var x = 0; x < patches.length; x++) {\n    var expected_loc = patches[x].start2 + delta;\n    var text1 = this.diff_text1(patches[x].diffs);\n    var start_loc;\n    var end_loc = -1;\n    if (text1.length > this.Match_MaxBits) {\n      // patch_splitMax will only provide an oversized pattern in the case of\n      // a monster delete.\n      start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits),\n                                  expected_loc);\n      if (start_loc != -1) {\n        end_loc = this.match_main(text,\n            text1.substring(text1.length - this.Match_MaxBits),\n            expected_loc + text1.length - this.Match_MaxBits);\n        if (end_loc == -1 || start_loc >= end_loc) {\n          // Can't find valid trailing context.  Drop this patch.\n          start_loc = -1;\n        }\n      }\n    } else {\n      start_loc = this.match_main(text, text1, expected_loc);\n    }\n    if (start_loc == -1) {\n      // No match found.  :(\n      results[x] = false;\n      // Subtract the delta for this failed patch from subsequent patches.\n      delta -= patches[x].length2 - patches[x].length1;\n    } else {\n      // Found a match.  :)\n      results[x] = true;\n      delta = start_loc - expected_loc;\n      var text2;\n      if (end_loc == -1) {\n        text2 = text.substring(start_loc, start_loc + text1.length);\n      } else {\n        text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);\n      }\n      if (text1 == text2) {\n        // Perfect match, just shove the replacement text in.\n        text = text.substring(0, start_loc) +\n               this.diff_text2(patches[x].diffs) +\n               text.substring(start_loc + text1.length);\n      } else {\n        // Imperfect match.  Run a diff to get a framework of equivalent\n        // indices.\n        var diffs = this.diff_main(text1, text2, false);\n        if (text1.length > this.Match_MaxBits &&\n            this.diff_levenshtein(diffs) / text1.length >\n            this.Patch_DeleteThreshold) {\n          // The end points match, but the content is unacceptably bad.\n          results[x] = false;\n        } else {\n          this.diff_cleanupSemanticLossless(diffs);\n          var index1 = 0;\n          var index2;\n          for (var y = 0; y < patches[x].diffs.length; y++) {\n            var mod = patches[x].diffs[y];\n            if (mod[0] !== DIFF_EQUAL) {\n              index2 = this.diff_xIndex(diffs, index1);\n            }\n            if (mod[0] === DIFF_INSERT) {  // Insertion\n              text = text.substring(0, start_loc + index2) + mod[1] +\n                     text.substring(start_loc + index2);\n            } else if (mod[0] === DIFF_DELETE) {  // Deletion\n              text = text.substring(0, start_loc + index2) +\n                     text.substring(start_loc + this.diff_xIndex(diffs,\n                         index1 + mod[1].length));\n            }\n            if (mod[0] !== DIFF_DELETE) {\n              index1 += mod[1].length;\n            }\n          }\n        }\n      }\n    }\n  }\n  // Strip the padding off.\n  text = text.substring(nullPadding.length, text.length - nullPadding.length);\n  return [text, results];\n};\n\n\n/**\n * Add some padding on text start and end so that edges can match something.\n * Intended to be called only from within patch_apply.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @return {string} The padding string added to each side.\n */\ndiff_match_patch.prototype.patch_addPadding = function(patches) {\n  var paddingLength = this.Patch_Margin;\n  var nullPadding = '';\n  for (var x = 1; x <= paddingLength; x++) {\n    nullPadding += String.fromCharCode(x);\n  }\n\n  // Bump all the patches forward.\n  for (var x = 0; x < patches.length; x++) {\n    patches[x].start1 += paddingLength;\n    patches[x].start2 += paddingLength;\n  }\n\n  // Add some padding on start of first diff.\n  var patch = patches[0];\n  var diffs = patch.diffs;\n  if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {\n    // Add nullPadding equality.\n    diffs.unshift([DIFF_EQUAL, nullPadding]);\n    patch.start1 -= paddingLength;  // Should be 0.\n    patch.start2 -= paddingLength;  // Should be 0.\n    patch.length1 += paddingLength;\n    patch.length2 += paddingLength;\n  } else if (paddingLength > diffs[0][1].length) {\n    // Grow first equality.\n    var extraLength = paddingLength - diffs[0][1].length;\n    diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];\n    patch.start1 -= extraLength;\n    patch.start2 -= extraLength;\n    patch.length1 += extraLength;\n    patch.length2 += extraLength;\n  }\n\n  // Add some padding on end of last diff.\n  patch = patches[patches.length - 1];\n  diffs = patch.diffs;\n  if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {\n    // Add nullPadding equality.\n    diffs.push([DIFF_EQUAL, nullPadding]);\n    patch.length1 += paddingLength;\n    patch.length2 += paddingLength;\n  } else if (paddingLength > diffs[diffs.length - 1][1].length) {\n    // Grow last equality.\n    var extraLength = paddingLength - diffs[diffs.length - 1][1].length;\n    diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);\n    patch.length1 += extraLength;\n    patch.length2 += extraLength;\n  }\n\n  return nullPadding;\n};\n\n\n/**\n * Look through the patches and break up any which are longer than the maximum\n * limit of the match algorithm.\n * Intended to be called only from within patch_apply.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n */\ndiff_match_patch.prototype.patch_splitMax = function(patches) {\n  var patch_size = this.Match_MaxBits;\n  for (var x = 0; x < patches.length; x++) {\n    if (patches[x].length1 > patch_size) {\n      var bigpatch = patches[x];\n      // Remove the big old patch.\n      patches.splice(x--, 1);\n      var start1 = bigpatch.start1;\n      var start2 = bigpatch.start2;\n      var precontext = '';\n      while (bigpatch.diffs.length !== 0) {\n        // Create one of several smaller patches.\n        var patch = new diff_match_patch.patch_obj();\n        var empty = true;\n        patch.start1 = start1 - precontext.length;\n        patch.start2 = start2 - precontext.length;\n        if (precontext !== '') {\n          patch.length1 = patch.length2 = precontext.length;\n          patch.diffs.push([DIFF_EQUAL, precontext]);\n        }\n        while (bigpatch.diffs.length !== 0 &&\n               patch.length1 < patch_size - this.Patch_Margin) {\n          var diff_type = bigpatch.diffs[0][0];\n          var diff_text = bigpatch.diffs[0][1];\n          if (diff_type === DIFF_INSERT) {\n            // Insertions are harmless.\n            patch.length2 += diff_text.length;\n            start2 += diff_text.length;\n            patch.diffs.push(bigpatch.diffs.shift());\n            empty = false;\n          } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 &&\n                     patch.diffs[0][0] == DIFF_EQUAL &&\n                     diff_text.length > 2 * patch_size) {\n            // This is a large deletion.  Let it pass in one chunk.\n            patch.length1 += diff_text.length;\n            start1 += diff_text.length;\n            empty = false;\n            patch.diffs.push([diff_type, diff_text]);\n            bigpatch.diffs.shift();\n          } else {\n            // Deletion or equality.  Only take as much as we can stomach.\n            diff_text = diff_text.substring(0,\n                patch_size - patch.length1 - this.Patch_Margin);\n            patch.length1 += diff_text.length;\n            start1 += diff_text.length;\n            if (diff_type === DIFF_EQUAL) {\n              patch.length2 += diff_text.length;\n              start2 += diff_text.length;\n            } else {\n              empty = false;\n            }\n            patch.diffs.push([diff_type, diff_text]);\n            if (diff_text == bigpatch.diffs[0][1]) {\n              bigpatch.diffs.shift();\n            } else {\n              bigpatch.diffs[0][1] =\n                  bigpatch.diffs[0][1].substring(diff_text.length);\n            }\n          }\n        }\n        // Compute the head context for the next patch.\n        precontext = this.diff_text2(patch.diffs);\n        precontext =\n            precontext.substring(precontext.length - this.Patch_Margin);\n        // Append the end context for this patch.\n        var postcontext = this.diff_text1(bigpatch.diffs)\n                              .substring(0, this.Patch_Margin);\n        if (postcontext !== '') {\n          patch.length1 += postcontext.length;\n          patch.length2 += postcontext.length;\n          if (patch.diffs.length !== 0 &&\n              patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) {\n            patch.diffs[patch.diffs.length - 1][1] += postcontext;\n          } else {\n            patch.diffs.push([DIFF_EQUAL, postcontext]);\n          }\n        }\n        if (!empty) {\n          patches.splice(++x, 0, patch);\n        }\n      }\n    }\n  }\n};\n\n\n/**\n * Take a list of patches and return a textual representation.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @return {string} Text representation of patches.\n */\ndiff_match_patch.prototype.patch_toText = function(patches) {\n  var text = [];\n  for (var x = 0; x < patches.length; x++) {\n    text[x] = patches[x];\n  }\n  return text.join('');\n};\n\n\n/**\n * Parse a textual representation of patches and return a list of patch objects.\n * @param {string} textline Text representation of patches.\n * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.\n * @throws {!Error} If invalid input.\n */\ndiff_match_patch.prototype.patch_fromText = function(textline) {\n  var patches = [];\n  if (!textline) {\n    return patches;\n  }\n  var text = textline.split('\\n');\n  var textPointer = 0;\n  var patchHeader = /^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$/;\n  while (textPointer < text.length) {\n    var m = text[textPointer].match(patchHeader);\n    if (!m) {\n      throw new Error('Invalid patch string: ' + text[textPointer]);\n    }\n    var patch = new diff_match_patch.patch_obj();\n    patches.push(patch);\n    patch.start1 = parseInt(m[1], 10);\n    if (m[2] === '') {\n      patch.start1--;\n      patch.length1 = 1;\n    } else if (m[2] == '0') {\n      patch.length1 = 0;\n    } else {\n      patch.start1--;\n      patch.length1 = parseInt(m[2], 10);\n    }\n\n    patch.start2 = parseInt(m[3], 10);\n    if (m[4] === '') {\n      patch.start2--;\n      patch.length2 = 1;\n    } else if (m[4] == '0') {\n      patch.length2 = 0;\n    } else {\n      patch.start2--;\n      patch.length2 = parseInt(m[4], 10);\n    }\n    textPointer++;\n\n    while (textPointer < text.length) {\n      var sign = text[textPointer].charAt(0);\n      try {\n        var line = decodeURI(text[textPointer].substring(1));\n      } catch (ex) {\n        // Malformed URI sequence.\n        throw new Error('Illegal escape in patch_fromText: ' + line);\n      }\n      if (sign == '-') {\n        // Deletion.\n        patch.diffs.push([DIFF_DELETE, line]);\n      } else if (sign == '+') {\n        // Insertion.\n        patch.diffs.push([DIFF_INSERT, line]);\n      } else if (sign == ' ') {\n        // Minor equality.\n        patch.diffs.push([DIFF_EQUAL, line]);\n      } else if (sign == '@') {\n        // Start of next patch.\n        break;\n      } else if (sign === '') {\n        // Blank line?  Whatever.\n      } else {\n        // WTF?\n        throw new Error('Invalid patch mode \"' + sign + '\" in: ' + line);\n      }\n      textPointer++;\n    }\n  }\n  return patches;\n};\n\n\n/**\n * Class representing one patch operation.\n * @constructor\n */\ndiff_match_patch.patch_obj = function() {\n  /** @type {!Array.<!diff_match_patch.Diff>} */\n  this.diffs = [];\n  /** @type {?number} */\n  this.start1 = null;\n  /** @type {?number} */\n  this.start2 = null;\n  /** @type {number} */\n  this.length1 = 0;\n  /** @type {number} */\n  this.length2 = 0;\n};\n\n\n/**\n * Emmulate GNU diff's format.\n * Header: @@ -382,8 +481,9 @@\n * Indicies are printed as 1-based, not 0-based.\n * @return {string} The GNU diff string.\n */\ndiff_match_patch.patch_obj.prototype.toString = function() {\n  var coords1, coords2;\n  if (this.length1 === 0) {\n    coords1 = this.start1 + ',0';\n  } else if (this.length1 == 1) {\n    coords1 = this.start1 + 1;\n  } else {\n    coords1 = (this.start1 + 1) + ',' + this.length1;\n  }\n  if (this.length2 === 0) {\n    coords2 = this.start2 + ',0';\n  } else if (this.length2 == 1) {\n    coords2 = this.start2 + 1;\n  } else {\n    coords2 = (this.start2 + 1) + ',' + this.length2;\n  }\n  var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\\n'];\n  var op;\n  // Escape the body of the patch with %xx notation.\n  for (var x = 0; x < this.diffs.length; x++) {\n    switch (this.diffs[x][0]) {\n      case DIFF_INSERT:\n        op = '+';\n        break;\n      case DIFF_DELETE:\n        op = '-';\n        break;\n      case DIFF_EQUAL:\n        op = ' ';\n        break;\n    }\n    text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\\n';\n  }\n  return text.join('').replace(/%20/g, ' ');\n};\n\n\n// Export these global variables so that they survive Google's JS compiler.\n// In a browser, 'this' will be 'window'.\n// In node.js 'this' will be a global object.\nthis['diff_match_patch'] = diff_match_patch;\nthis['DIFF_DELETE'] = DIFF_DELETE;\nthis['DIFF_INSERT'] = DIFF_INSERT;\nthis['DIFF_EQUAL'] = DIFF_EQUAL;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/public/external/diff_match_patch_uncompressed.js\n ** module id = 49\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/public/external/diff_match_patch_uncompressed.js?");
},function(module,exports,__webpack_require__){eval("var Processor = __webpack_require__(57).Processor;\nvar Pipe = __webpack_require__(43).Pipe;\nvar DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar trivial = __webpack_require__(56);\nvar nested = __webpack_require__(54);\nvar arrays = __webpack_require__(51);\nvar dates = __webpack_require__(52);\nvar texts = __webpack_require__(55);\n\nvar DiffPatcher = function DiffPatcher(options) {\n  this.processor = new Processor(options);\n  this.processor.pipe(new Pipe('diff').append(\n    nested.collectChildrenDiffFilter,\n    trivial.diffFilter,\n    dates.diffFilter,\n    texts.diffFilter,\n    nested.objectsDiffFilter,\n    arrays.diffFilter\n  ).shouldHaveResult());\n  this.processor.pipe(new Pipe('patch').append(\n    nested.collectChildrenPatchFilter,\n    arrays.collectChildrenPatchFilter,\n    trivial.patchFilter,\n    texts.patchFilter,\n    nested.patchFilter,\n    arrays.patchFilter\n  ).shouldHaveResult());\n  this.processor.pipe(new Pipe('reverse').append(\n    nested.collectChildrenReverseFilter,\n    arrays.collectChildrenReverseFilter,\n    trivial.reverseFilter,\n    texts.reverseFilter,\n    nested.reverseFilter,\n    arrays.reverseFilter\n  ).shouldHaveResult());\n};\n\nDiffPatcher.prototype.options = function() {\n  return this.processor.options.apply(this.processor, arguments);\n};\n\nDiffPatcher.prototype.diff = function(left, right) {\n  return this.processor.process(new DiffContext(left, right));\n};\n\nDiffPatcher.prototype.patch = function(left, delta) {\n  return this.processor.process(new PatchContext(left, delta));\n};\n\nDiffPatcher.prototype.reverse = function(delta) {\n  return this.processor.process(new ReverseContext(delta));\n};\n\nDiffPatcher.prototype.unpatch = function(right, delta) {\n  return this.patch(right, this.reverse(delta));\n};\n\nexports.DiffPatcher = DiffPatcher;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/diffpatcher.js\n ** module id = 50\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/diffpatcher.js?")},function(module,exports,__webpack_require__){eval("var DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar lcs = __webpack_require__(53);\n\nvar ARRAY_MOVE = 3;\n\nvar isArray = (typeof Array.isArray === 'function') ?\n  // use native function\n  Array.isArray :\n  // use instanceof operator\n  function(a) {\n    return a instanceof Array;\n  };\n\nvar arrayIndexOf = typeof Array.prototype.indexOf === 'function' ?\n  function(array, item) {\n    return array.indexOf(item);\n  } : function(array, item) {\n    var length = array.length;\n    for (var i = 0; i < length; i++) {\n      if (array[i] === item) {\n        return i;\n      }\n    }\n    return -1;\n  };\n\nfunction arraysHaveMatchByRef(array1, array2, len1, len2) {\n  for (var index1 = 0; index1 < len1; index1++) {\n    var val1 = array1[index1];\n    for (var index2 = 0; index2 < len2; index2++) {\n      var val2 = array2[index2];\n      if (val1 === val2) {\n        return true;\n      }\n    }\n  }\n}\n\nfunction matchItems(array1, array2, index1, index2, context) {\n  var value1 = array1[index1];\n  var value2 = array2[index2];\n  if (value1 === value2) {\n    return true;\n  }\n  if (typeof value1 !== 'object' || typeof value2 !== 'object') {\n    return false;\n  }\n  var objectHash = context.objectHash;\n  if (!objectHash) {\n    // no way to match objects was provided, try match by position\n    return context.matchByPosition && index1 === index2;\n  }\n  var hash1;\n  var hash2;\n  if (typeof index1 === 'number') {\n    context.hashCache1 = context.hashCache1 || [];\n    hash1 = context.hashCache1[index1];\n    if (typeof hash1 === 'undefined') {\n      context.hashCache1[index1] = hash1 = objectHash(value1, index1);\n    }\n  } else {\n    hash1 = objectHash(value1);\n  }\n  if (typeof hash1 === 'undefined') {\n    return false;\n  }\n  if (typeof index2 === 'number') {\n    context.hashCache2 = context.hashCache2 || [];\n    hash2 = context.hashCache2[index2];\n    if (typeof hash2 === 'undefined') {\n      context.hashCache2[index2] = hash2 = objectHash(value2, index2);\n    }\n  } else {\n    hash2 = objectHash(value2);\n  }\n  if (typeof hash2 === 'undefined') {\n    return false;\n  }\n  return hash1 === hash2;\n}\n\nvar diffFilter = function arraysDiffFilter(context) {\n  if (!context.leftIsArray) {\n    return;\n  }\n\n  var matchContext = {\n    objectHash: context.options && context.options.objectHash,\n    matchByPosition: context.options && context.options.matchByPosition\n  };\n  var commonHead = 0;\n  var commonTail = 0;\n  var index;\n  var index1;\n  var index2;\n  var array1 = context.left;\n  var array2 = context.right;\n  var len1 = array1.length;\n  var len2 = array2.length;\n\n  var child;\n\n  if (len1 > 0 && len2 > 0 && !matchContext.objectHash &&\n    typeof matchContext.matchByPosition !== 'boolean') {\n    matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);\n  }\n\n  // separate common head\n  while (commonHead < len1 && commonHead < len2 &&\n    matchItems(array1, array2, commonHead, commonHead, matchContext)) {\n    index = commonHead;\n    child = new DiffContext(context.left[index], context.right[index]);\n    context.push(child, index);\n    commonHead++;\n  }\n  // separate common tail\n  while (commonTail + commonHead < len1 && commonTail + commonHead < len2 &&\n    matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {\n    index1 = len1 - 1 - commonTail;\n    index2 = len2 - 1 - commonTail;\n    child = new DiffContext(context.left[index1], context.right[index2]);\n    context.push(child, index2);\n    commonTail++;\n  }\n  var result;\n  if (commonHead + commonTail === len1) {\n    if (len1 === len2) {\n      // arrays are identical\n      context.setResult(undefined).exit();\n      return;\n    }\n    // trivial case, a block (1 or more consecutive items) was added\n    result = result || {\n      _t: 'a'\n    };\n    for (index = commonHead; index < len2 - commonTail; index++) {\n      result[index] = [array2[index]];\n    }\n    context.setResult(result).exit();\n    return;\n  }\n  if (commonHead + commonTail === len2) {\n    // trivial case, a block (1 or more consecutive items) was removed\n    result = result || {\n      _t: 'a'\n    };\n    for (index = commonHead; index < len1 - commonTail; index++) {\n      result['_' + index] = [array1[index], 0, 0];\n    }\n    context.setResult(result).exit();\n    return;\n  }\n  // reset hash cache\n  delete matchContext.hashCache1;\n  delete matchContext.hashCache2;\n\n  // diff is not trivial, find the LCS (Longest Common Subsequence)\n  var trimmed1 = array1.slice(commonHead, len1 - commonTail);\n  var trimmed2 = array2.slice(commonHead, len2 - commonTail);\n  var seq = lcs.get(\n    trimmed1, trimmed2,\n    matchItems,\n    matchContext\n  );\n  var removedItems = [];\n  result = result || {\n    _t: 'a'\n  };\n  for (index = commonHead; index < len1 - commonTail; index++) {\n    if (arrayIndexOf(seq.indices1, index - commonHead) < 0) {\n      // removed\n      result['_' + index] = [array1[index], 0, 0];\n      removedItems.push(index);\n    }\n  }\n\n  var detectMove = true;\n  if (context.options && context.options.arrays && context.options.arrays.detectMove === false) {\n    detectMove = false;\n  }\n  var includeValueOnMove = false;\n  if (context.options && context.options.arrays && context.options.arrays.includeValueOnMove) {\n    includeValueOnMove = true;\n  }\n\n  var removedItemsLength = removedItems.length;\n  for (index = commonHead; index < len2 - commonTail; index++) {\n    var indexOnArray2 = arrayIndexOf(seq.indices2, index - commonHead);\n    if (indexOnArray2 < 0) {\n      // added, try to match with a removed item and register as position move\n      var isMove = false;\n      if (detectMove && removedItemsLength > 0) {\n        for (var removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {\n          index1 = removedItems[removeItemIndex1];\n          if (matchItems(trimmed1, trimmed2, index1 - commonHead,\n            index - commonHead, matchContext)) {\n            // store position move as: [originalValue, newPosition, ARRAY_MOVE]\n            result['_' + index1].splice(1, 2, index, ARRAY_MOVE);\n            if (!includeValueOnMove) {\n              // don't include moved value on diff, to save bytes\n              result['_' + index1][0] = '';\n            }\n\n            index2 = index;\n            child = new DiffContext(context.left[index1], context.right[index2]);\n            context.push(child, index2);\n            removedItems.splice(removeItemIndex1, 1);\n            isMove = true;\n            break;\n          }\n        }\n      }\n      if (!isMove) {\n        // added\n        result[index] = [array2[index]];\n      }\n    } else {\n      // match, do inner diff\n      index1 = seq.indices1[indexOnArray2] + commonHead;\n      index2 = seq.indices2[indexOnArray2] + commonHead;\n      child = new DiffContext(context.left[index1], context.right[index2]);\n      context.push(child, index2);\n    }\n  }\n\n  context.setResult(result).exit();\n\n};\ndiffFilter.filterName = 'arrays';\n\nvar compare = {\n  numerically: function(a, b) {\n    return a - b;\n  },\n  numericallyBy: function(name) {\n    return function(a, b) {\n      return a[name] - b[name];\n    };\n  }\n};\n\nvar patchFilter = function nestedPatchFilter(context) {\n  if (!context.nested) {\n    return;\n  }\n  if (context.delta._t !== 'a') {\n    return;\n  }\n  var index, index1;\n\n  var delta = context.delta;\n  var array = context.left;\n\n  // first, separate removals, insertions and modifications\n  var toRemove = [];\n  var toInsert = [];\n  var toModify = [];\n  for (index in delta) {\n    if (index !== '_t') {\n      if (index[0] === '_') {\n        // removed item from original array\n        if (delta[index][2] === 0 || delta[index][2] === ARRAY_MOVE) {\n          toRemove.push(parseInt(index.slice(1), 10));\n        } else {\n          throw new Error('only removal or move can be applied at original array indices' +\n            ', invalid diff type: ' + delta[index][2]);\n        }\n      } else {\n        if (delta[index].length === 1) {\n          // added item at new array\n          toInsert.push({\n            index: parseInt(index, 10),\n            value: delta[index][0]\n          });\n        } else {\n          // modified item at new array\n          toModify.push({\n            index: parseInt(index, 10),\n            delta: delta[index]\n          });\n        }\n      }\n    }\n  }\n\n  // remove items, in reverse order to avoid sawing our own floor\n  toRemove = toRemove.sort(compare.numerically);\n  for (index = toRemove.length - 1; index >= 0; index--) {\n    index1 = toRemove[index];\n    var indexDiff = delta['_' + index1];\n    var removedValue = array.splice(index1, 1)[0];\n    if (indexDiff[2] === ARRAY_MOVE) {\n      // reinsert later\n      toInsert.push({\n        index: indexDiff[1],\n        value: removedValue\n      });\n    }\n  }\n\n  // insert items, in reverse order to avoid moving our own floor\n  toInsert = toInsert.sort(compare.numericallyBy('index'));\n  var toInsertLength = toInsert.length;\n  for (index = 0; index < toInsertLength; index++) {\n    var insertion = toInsert[index];\n    array.splice(insertion.index, 0, insertion.value);\n  }\n\n  // apply modifications\n  var toModifyLength = toModify.length;\n  var child;\n  if (toModifyLength > 0) {\n    for (index = 0; index < toModifyLength; index++) {\n      var modification = toModify[index];\n      child = new PatchContext(context.left[modification.index], modification.delta);\n      context.push(child, modification.index);\n    }\n  }\n\n  if (!context.children) {\n    context.setResult(context.left).exit();\n    return;\n  }\n  context.exit();\n};\npatchFilter.filterName = 'arrays';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n  if (!context || !context.children) {\n    return;\n  }\n  if (context.delta._t !== 'a') {\n    return;\n  }\n  var length = context.children.length;\n  var child;\n  for (var index = 0; index < length; index++) {\n    child = context.children[index];\n    context.left[child.childName] = child.result;\n  }\n  context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'arraysCollectChildren';\n\nvar reverseFilter = function arraysReverseFilter(context) {\n  if (!context.nested) {\n    if (context.delta[2] === ARRAY_MOVE) {\n      context.newName = '_' + context.delta[1];\n      context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();\n    }\n    return;\n  }\n  if (context.delta._t !== 'a') {\n    return;\n  }\n  var name, child;\n  for (name in context.delta) {\n    if (name === '_t') {\n      continue;\n    }\n    child = new ReverseContext(context.delta[name]);\n    context.push(child, name);\n  }\n  context.exit();\n};\nreverseFilter.filterName = 'arrays';\n\nvar reverseArrayDeltaIndex = function(delta, index, itemDelta) {\n  if (typeof index === 'string' && index[0] === '_') {\n    return parseInt(index.substr(1), 10);\n  } else if (isArray(itemDelta) && itemDelta[2] === 0) {\n    return '_' + index;\n  }\n\n  var reverseIndex = +index;\n  for (var deltaIndex in delta) {\n    var deltaItem = delta[deltaIndex];\n    if (isArray(deltaItem)) {\n      if (deltaItem[2] === ARRAY_MOVE) {\n        var moveFromIndex = parseInt(deltaIndex.substr(1), 10);\n        var moveToIndex = deltaItem[1];\n        if (moveToIndex === +index) {\n          return moveFromIndex;\n        }\n        if (moveFromIndex <= reverseIndex && moveToIndex > reverseIndex) {\n          reverseIndex++;\n        } else if (moveFromIndex >= reverseIndex && moveToIndex < reverseIndex) {\n          reverseIndex--;\n        }\n      } else if (deltaItem[2] === 0) {\n        var deleteIndex = parseInt(deltaIndex.substr(1), 10);\n        if (deleteIndex <= reverseIndex) {\n          reverseIndex++;\n        }\n      } else if (deltaItem.length === 1 && deltaIndex <= reverseIndex) {\n        reverseIndex--;\n      }\n    }\n  }\n\n  return reverseIndex;\n};\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n  if (!context || !context.children) {\n    return;\n  }\n  if (context.delta._t !== 'a') {\n    return;\n  }\n  var length = context.children.length;\n  var child;\n  var delta = {\n    _t: 'a'\n  };\n\n  for (var index = 0; index < length; index++) {\n    child = context.children[index];\n    var name = child.newName;\n    if (typeof name === 'undefined') {\n      name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);\n    }\n    if (delta[name] !== child.result) {\n      delta[name] = child.result;\n    }\n  }\n  context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'arraysCollectChildren';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/arrays.js\n ** module id = 51\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/arrays.js?")},function(module,exports){eval("var diffFilter = function datesDiffFilter(context) {\n  if (context.left instanceof Date) {\n    if (context.right instanceof Date) {\n      if (context.left.getTime() !== context.right.getTime()) {\n        context.setResult([context.left, context.right]);\n      } else {\n        context.setResult(undefined);\n      }\n    } else {\n      context.setResult([context.left, context.right]);\n    }\n    context.exit();\n  } else if (context.right instanceof Date) {\n    context.setResult([context.left, context.right]).exit();\n  }\n};\ndiffFilter.filterName = 'dates';\n\nexports.diffFilter = diffFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/dates.js\n ** module id = 52\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/dates.js?")},function(module,exports){eval("/*\n\nLCS implementation that supports arrays or strings\n\nreference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem\n\n*/\n\nvar defaultMatch = function(array1, array2, index1, index2) {\n  return array1[index1] === array2[index2];\n};\n\nvar lengthMatrix = function(array1, array2, match, context) {\n  var len1 = array1.length;\n  var len2 = array2.length;\n  var x, y;\n\n  // initialize empty matrix of len1+1 x len2+1\n  var matrix = [len1 + 1];\n  for (x = 0; x < len1 + 1; x++) {\n    matrix[x] = [len2 + 1];\n    for (y = 0; y < len2 + 1; y++) {\n      matrix[x][y] = 0;\n    }\n  }\n  matrix.match = match;\n  // save sequence lengths for each coordinate\n  for (x = 1; x < len1 + 1; x++) {\n    for (y = 1; y < len2 + 1; y++) {\n      if (match(array1, array2, x - 1, y - 1, context)) {\n        matrix[x][y] = matrix[x - 1][y - 1] + 1;\n      } else {\n        matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);\n      }\n    }\n  }\n  return matrix;\n};\n\nvar backtrack = function(matrix, array1, array2, index1, index2, context) {\n  if (index1 === 0 || index2 === 0) {\n    return {\n      sequence: [],\n      indices1: [],\n      indices2: []\n    };\n  }\n\n  if (matrix.match(array1, array2, index1 - 1, index2 - 1, context)) {\n    var subsequence = backtrack(matrix, array1, array2, index1 - 1, index2 - 1, context);\n    subsequence.sequence.push(array1[index1 - 1]);\n    subsequence.indices1.push(index1 - 1);\n    subsequence.indices2.push(index2 - 1);\n    return subsequence;\n  }\n\n  if (matrix[index1][index2 - 1] > matrix[index1 - 1][index2]) {\n    return backtrack(matrix, array1, array2, index1, index2 - 1, context);\n  } else {\n    return backtrack(matrix, array1, array2, index1 - 1, index2, context);\n  }\n};\n\nvar get = function(array1, array2, match, context) {\n  context = context || {};\n  var matrix = lengthMatrix(array1, array2, match || defaultMatch, context);\n  var result = backtrack(matrix, array1, array2, array1.length, array2.length, context);\n  if (typeof array1 === 'string' && typeof array2 === 'string') {\n    result.sequence = result.sequence.join('');\n  }\n  return result;\n};\n\nexports.get = get;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/lcs.js\n ** module id = 53\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/lcs.js?")},function(module,exports,__webpack_require__){eval("var DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar collectChildrenDiffFilter = function collectChildrenDiffFilter(context) {\n  if (!context || !context.children) {\n    return;\n  }\n  var length = context.children.length;\n  var child;\n  var result = context.result;\n  for (var index = 0; index < length; index++) {\n    child = context.children[index];\n    if (typeof child.result === 'undefined') {\n      continue;\n    }\n    result = result || {};\n    result[child.childName] = child.result;\n  }\n  if (result && context.leftIsArray) {\n    result._t = 'a';\n  }\n  context.setResult(result).exit();\n};\ncollectChildrenDiffFilter.filterName = 'collectChildren';\n\nvar objectsDiffFilter = function objectsDiffFilter(context) {\n  if (context.leftIsArray || context.leftType !== 'object') {\n    return;\n  }\n\n  var name, child, propertyFilter = context.options.propertyFilter;\n  for (name in context.left) {\n    if (!Object.prototype.hasOwnProperty.call(context.left, name)) {\n      continue;\n    }\n    if (propertyFilter && !propertyFilter(name, context)) {\n      continue;\n    }\n    child = new DiffContext(context.left[name], context.right[name]);\n    context.push(child, name);\n  }\n  for (name in context.right) {\n    if (!Object.prototype.hasOwnProperty.call(context.right, name)) {\n      continue;\n    }\n    if (propertyFilter && !propertyFilter(name, context)) {\n      continue;\n    }\n    if (typeof context.left[name] === 'undefined') {\n      child = new DiffContext(undefined, context.right[name]);\n      context.push(child, name);\n    }\n  }\n\n  if (!context.children || context.children.length === 0) {\n    context.setResult(undefined).exit();\n    return;\n  }\n  context.exit();\n};\nobjectsDiffFilter.filterName = 'objects';\n\nvar patchFilter = function nestedPatchFilter(context) {\n  if (!context.nested) {\n    return;\n  }\n  if (context.delta._t) {\n    return;\n  }\n  var name, child;\n  for (name in context.delta) {\n    child = new PatchContext(context.left[name], context.delta[name]);\n    context.push(child, name);\n  }\n  context.exit();\n};\npatchFilter.filterName = 'objects';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n  if (!context || !context.children) {\n    return;\n  }\n  if (context.delta._t) {\n    return;\n  }\n  var length = context.children.length;\n  var child;\n  for (var index = 0; index < length; index++) {\n    child = context.children[index];\n    if (Object.prototype.hasOwnProperty.call(context.left, child.childName) && child.result === undefined) {\n      delete context.left[child.childName];\n    } else if (context.left[child.childName] !== child.result) {\n      context.left[child.childName] = child.result;\n    }\n  }\n  context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'collectChildren';\n\nvar reverseFilter = function nestedReverseFilter(context) {\n  if (!context.nested) {\n    return;\n  }\n  if (context.delta._t) {\n    return;\n  }\n  var name, child;\n  for (name in context.delta) {\n    child = new ReverseContext(context.delta[name]);\n    context.push(child, name);\n  }\n  context.exit();\n};\nreverseFilter.filterName = 'objects';\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n  if (!context || !context.children) {\n    return;\n  }\n  if (context.delta._t) {\n    return;\n  }\n  var length = context.children.length;\n  var child;\n  var delta = {};\n  for (var index = 0; index < length; index++) {\n    child = context.children[index];\n    if (delta[child.childName] !== child.result) {\n      delta[child.childName] = child.result;\n    }\n  }\n  context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'collectChildren';\n\nexports.collectChildrenDiffFilter = collectChildrenDiffFilter;\nexports.objectsDiffFilter = objectsDiffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/nested.js\n ** module id = 54\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/nested.js?")},function(module,exports,__webpack_require__){eval("/* global diff_match_patch */\nvar TEXT_DIFF = 2;\nvar DEFAULT_MIN_LENGTH = 60;\nvar cachedDiffPatch = null;\n\nvar getDiffMatchPatch = function(required) {\n  /*jshint camelcase: false */\n\n  if (!cachedDiffPatch) {\n    var instance;\n    if (typeof diff_match_patch !== 'undefined') {\n      // already loaded, probably a browser\n      instance = typeof diff_match_patch === 'function' ?\n        new diff_match_patch() : new diff_match_patch.diff_match_patch();\n    } else if (true) {\n      try {\n        var dmpModuleName = 'diff_match_patch_uncompressed';\n        var dmp = __webpack_require__(274)(\"./\" + dmpModuleName);\n        instance = new dmp.diff_match_patch();\n      } catch (err) {\n        instance = null;\n      }\n    }\n    if (!instance) {\n      if (!required) {\n        return null;\n      }\n      var error = new Error('text diff_match_patch library not found');\n      error.diff_match_patch_not_found = true;\n      throw error;\n    }\n    cachedDiffPatch = {\n      diff: function(txt1, txt2) {\n        return instance.patch_toText(instance.patch_make(txt1, txt2));\n      },\n      patch: function(txt1, patch) {\n        var results = instance.patch_apply(instance.patch_fromText(patch), txt1);\n        for (var i = 0; i < results[1].length; i++) {\n          if (!results[1][i]) {\n            var error = new Error('text patch failed');\n            error.textPatchFailed = true;\n          }\n        }\n        return results[0];\n      }\n    };\n  }\n  return cachedDiffPatch;\n};\n\nvar diffFilter = function textsDiffFilter(context) {\n  if (context.leftType !== 'string') {\n    return;\n  }\n  var minLength = (context.options && context.options.textDiff &&\n    context.options.textDiff.minLength) || DEFAULT_MIN_LENGTH;\n  if (context.left.length < minLength ||\n    context.right.length < minLength) {\n    context.setResult([context.left, context.right]).exit();\n    return;\n  }\n  // large text, try to use a text-diff algorithm\n  var diffMatchPatch = getDiffMatchPatch();\n  if (!diffMatchPatch) {\n    // diff-match-patch library not available, fallback to regular string replace\n    context.setResult([context.left, context.right]).exit();\n    return;\n  }\n  var diff = diffMatchPatch.diff;\n  context.setResult([diff(context.left, context.right), 0, TEXT_DIFF]).exit();\n};\ndiffFilter.filterName = 'texts';\n\nvar patchFilter = function textsPatchFilter(context) {\n  if (context.nested) {\n    return;\n  }\n  if (context.delta[2] !== TEXT_DIFF) {\n    return;\n  }\n\n  // text-diff, use a text-patch algorithm\n  var patch = getDiffMatchPatch(true).patch;\n  context.setResult(patch(context.left, context.delta[0])).exit();\n};\npatchFilter.filterName = 'texts';\n\nvar textDeltaReverse = function(delta) {\n  var i, l, lines, line, lineTmp, header = null,\n    headerRegex = /^@@ +\\-(\\d+),(\\d+) +\\+(\\d+),(\\d+) +@@$/,\n    lineHeader, lineAdd, lineRemove;\n  lines = delta.split('\\n');\n  for (i = 0, l = lines.length; i < l; i++) {\n    line = lines[i];\n    var lineStart = line.slice(0, 1);\n    if (lineStart === '@') {\n      header = headerRegex.exec(line);\n      lineHeader = i;\n      lineAdd = null;\n      lineRemove = null;\n\n      // fix header\n      lines[lineHeader] = '@@ -' + header[3] + ',' + header[4] + ' +' + header[1] + ',' + header[2] + ' @@';\n    } else if (lineStart === '+') {\n      lineAdd = i;\n      lines[i] = '-' + lines[i].slice(1);\n      if (lines[i - 1].slice(0, 1) === '+') {\n        // swap lines to keep default order (-+)\n        lineTmp = lines[i];\n        lines[i] = lines[i - 1];\n        lines[i - 1] = lineTmp;\n      }\n    } else if (lineStart === '-') {\n      lineRemove = i;\n      lines[i] = '+' + lines[i].slice(1);\n    }\n  }\n  return lines.join('\\n');\n};\n\nvar reverseFilter = function textsReverseFilter(context) {\n  if (context.nested) {\n    return;\n  }\n  if (context.delta[2] !== TEXT_DIFF) {\n    return;\n  }\n\n  // text-diff, use a text-diff algorithm\n  context.setResult([textDeltaReverse(context.delta[0]), 0, TEXT_DIFF]).exit();\n};\nreverseFilter.filterName = 'texts';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/texts.js\n ** module id = 55\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/texts.js?")},function(module,exports){eval("var isArray = (typeof Array.isArray === 'function') ?\n  // use native function\n  Array.isArray :\n  // use instanceof operator\n  function(a) {\n    return a instanceof Array;\n  };\n\nvar diffFilter = function trivialMatchesDiffFilter(context) {\n  if (context.left === context.right) {\n    context.setResult(undefined).exit();\n    return;\n  }\n  if (typeof context.left === 'undefined') {\n    if (typeof context.right === 'function') {\n      throw new Error('functions are not supported');\n    }\n    context.setResult([context.right]).exit();\n    return;\n  }\n  if (typeof context.right === 'undefined') {\n    context.setResult([context.left, 0, 0]).exit();\n    return;\n  }\n  if (typeof context.left === 'function' || typeof context.right === 'function') {\n    throw new Error('functions are not supported');\n  }\n  context.leftType = context.left === null ? 'null' : typeof context.left;\n  context.rightType = context.right === null ? 'null' : typeof context.right;\n  if (context.leftType !== context.rightType) {\n    context.setResult([context.left, context.right]).exit();\n    return;\n  }\n  if (context.leftType === 'boolean' || context.leftType === 'number') {\n    context.setResult([context.left, context.right]).exit();\n    return;\n  }\n  if (context.leftType === 'object') {\n    context.leftIsArray = isArray(context.left);\n  }\n  if (context.rightType === 'object') {\n    context.rightIsArray = isArray(context.right);\n  }\n  if (context.leftIsArray !== context.rightIsArray) {\n    context.setResult([context.left, context.right]).exit();\n    return;\n  }\n};\ndiffFilter.filterName = 'trivial';\n\nvar patchFilter = function trivialMatchesPatchFilter(context) {\n  if (typeof context.delta === 'undefined') {\n    context.setResult(context.left).exit();\n    return;\n  }\n  context.nested = !isArray(context.delta);\n  if (context.nested) {\n    return;\n  }\n  if (context.delta.length === 1) {\n    context.setResult(context.delta[0]).exit();\n    return;\n  }\n  if (context.delta.length === 2) {\n    context.setResult(context.delta[1]).exit();\n    return;\n  }\n  if (context.delta.length === 3 && context.delta[2] === 0) {\n    context.setResult(undefined).exit();\n    return;\n  }\n};\npatchFilter.filterName = 'trivial';\n\nvar reverseFilter = function trivialReferseFilter(context) {\n  if (typeof context.delta === 'undefined') {\n    context.setResult(context.delta).exit();\n    return;\n  }\n  context.nested = !isArray(context.delta);\n  if (context.nested) {\n    return;\n  }\n  if (context.delta.length === 1) {\n    context.setResult([context.delta[0], 0, 0]).exit();\n    return;\n  }\n  if (context.delta.length === 2) {\n    context.setResult([context.delta[1], context.delta[0]]).exit();\n    return;\n  }\n  if (context.delta.length === 3 && context.delta[2] === 0) {\n    context.setResult([context.delta[0]]).exit();\n    return;\n  }\n};\nreverseFilter.filterName = 'trivial';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/trivial.js\n ** module id = 56\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/trivial.js?")},function(module,exports){eval("\nvar Processor = function Processor(options){\n  this.selfOptions = options || {};\n  this.pipes = {};\n};\n\nProcessor.prototype.options = function(options) {\n  if (options) {\n    this.selfOptions = options;\n  }\n  return this.selfOptions;\n};\n\nProcessor.prototype.pipe = function(name, pipe) {\n  if (typeof name === 'string') {\n    if (typeof pipe === 'undefined') {\n      return this.pipes[name];\n    } else {\n      this.pipes[name] = pipe;\n    }\n  }\n  if (name && name.name) {\n    pipe = name;\n    if (pipe.processor === this) { return pipe; }\n    this.pipes[pipe.name] = pipe;\n  }\n  pipe.processor = this;\n  return pipe;\n};\n\nProcessor.prototype.process = function(input, pipe) {\n  var context = input;\n  context.options = this.options();\n  var nextPipe = pipe || input.pipe || 'default';\n  var lastPipe, lastContext;\n  while (nextPipe) {\n    if (typeof context.nextAfterChildren !== 'undefined') {\n      // children processed and coming back to parent\n      context.next = context.nextAfterChildren;\n      context.nextAfterChildren = null;\n    }\n\n    if (typeof nextPipe === 'string') {\n      nextPipe = this.pipe(nextPipe);\n    }\n    nextPipe.process(context);\n    lastContext = context;\n    lastPipe = nextPipe;\n    nextPipe = null;\n    if (context) {\n      if (context.next) {\n        context = context.next;\n        nextPipe = lastContext.nextPipe || context.pipe || lastPipe;\n      }\n    }\n  }\n  return context.hasResult ? context.result : undefined;\n};\n\nexports.Processor = Processor;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/processor.js\n ** module id = 57\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/processor.js?");
},function(module,exports){eval("module.exports = function(sel, data, children, text, elm) {\n  var key = data === undefined ? undefined : data.key;\n  return {sel: sel, data: data, children: children,\n          text: text, elm: elm, key: key};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/vnode.js\n ** module id = 58\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/vnode.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license  MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = __webpack_require__(227)\nvar ieee754 = __webpack_require__(308)\nvar isArray = __webpack_require__(309)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n *   === true    Use Uint8Array implementation (fastest)\n *   === false   Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n *   - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property\n *     on objects.\n *\n *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n *     incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n  ? global.TYPED_ARRAY_SUPPORT\n  : typedArraySupport()\n\nfunction typedArraySupport () {\n  function Bar () {}\n  try {\n    var arr = new Uint8Array(1)\n    arr.foo = function () { return 42 }\n    arr.constructor = Bar\n    return arr.foo() === 42 && // typed array instances can be augmented\n        arr.constructor === Bar && // constructor can be set\n        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n  } catch (e) {\n    return false\n  }\n}\n\nfunction kMaxLength () {\n  return Buffer.TYPED_ARRAY_SUPPORT\n    ? 0x7fffffff\n    : 0x3fffffff\n}\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (arg) {\n  if (!(this instanceof Buffer)) {\n    // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n    if (arguments.length > 1) return new Buffer(arg, arguments[1])\n    return new Buffer(arg)\n  }\n\n  if (!Buffer.TYPED_ARRAY_SUPPORT) {\n    this.length = 0\n    this.parent = undefined\n  }\n\n  // Common case.\n  if (typeof arg === 'number') {\n    return fromNumber(this, arg)\n  }\n\n  // Slightly less common case.\n  if (typeof arg === 'string') {\n    return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n  }\n\n  // Unusual.\n  return fromObject(this, arg)\n}\n\nfunction fromNumber (that, length) {\n  that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) {\n    for (var i = 0; i < length; i++) {\n      that[i] = 0\n    }\n  }\n  return that\n}\n\nfunction fromString (that, string, encoding) {\n  if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n  // Assumption: byteLength() return value is always < kMaxLength.\n  var length = byteLength(string, encoding) | 0\n  that = allocate(that, length)\n\n  that.write(string, encoding)\n  return that\n}\n\nfunction fromObject (that, object) {\n  if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n  if (isArray(object)) return fromArray(that, object)\n\n  if (object == null) {\n    throw new TypeError('must start with number, buffer, array or string')\n  }\n\n  if (typeof ArrayBuffer !== 'undefined') {\n    if (object.buffer instanceof ArrayBuffer) {\n      return fromTypedArray(that, object)\n    }\n    if (object instanceof ArrayBuffer) {\n      return fromArrayBuffer(that, object)\n    }\n  }\n\n  if (object.length) return fromArrayLike(that, object)\n\n  return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n  var length = checked(buffer.length) | 0\n  that = allocate(that, length)\n  buffer.copy(that, 0, 0, length)\n  return that\n}\n\nfunction fromArray (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  // Truncating the elements is probably not what people expect from typed\n  // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n  // of the old Buffer constructor.\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nfunction fromArrayBuffer (that, array) {\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    array.byteLength\n    that = Buffer._augment(new Uint8Array(array))\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    that = fromTypedArray(that, new Uint8Array(array))\n  }\n  return that\n}\n\nfunction fromArrayLike (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n  var array\n  var length = 0\n\n  if (object.type === 'Buffer' && isArray(object.data)) {\n    array = object.data\n    length = checked(array.length) | 0\n  }\n  that = allocate(that, length)\n\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n  Buffer.prototype.__proto__ = Uint8Array.prototype\n  Buffer.__proto__ = Uint8Array\n} else {\n  // pre-set for values that may exist in the future\n  Buffer.prototype.length = undefined\n  Buffer.prototype.parent = undefined\n}\n\nfunction allocate (that, length) {\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    that = Buffer._augment(new Uint8Array(length))\n    that.__proto__ = Buffer.prototype\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    that.length = length\n    that._isBuffer = true\n  }\n\n  var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n  if (fromPool) that.parent = rootParent\n\n  return that\n}\n\nfunction checked (length) {\n  // Note: cannot use `length < kMaxLength` here because that fails when\n  // length is NaN (which is otherwise coerced to zero.)\n  if (length >= kMaxLength()) {\n    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n                         'size: 0x' + kMaxLength().toString(16) + ' bytes')\n  }\n  return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n  if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n  var buf = new Buffer(subject, encoding)\n  delete buf.parent\n  return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n  return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n    throw new TypeError('Arguments must be Buffers')\n  }\n\n  if (a === b) return 0\n\n  var x = a.length\n  var y = b.length\n\n  var i = 0\n  var len = Math.min(x, y)\n  while (i < len) {\n    if (a[i] !== b[i]) break\n\n    ++i\n  }\n\n  if (i !== len) {\n    x = a[i]\n    y = b[i]\n  }\n\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'binary':\n    case 'base64':\n    case 'raw':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.concat = function concat (list, length) {\n  if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n  if (list.length === 0) {\n    return new Buffer(0)\n  }\n\n  var i\n  if (length === undefined) {\n    length = 0\n    for (i = 0; i < list.length; i++) {\n      length += list[i].length\n    }\n  }\n\n  var buf = new Buffer(length)\n  var pos = 0\n  for (i = 0; i < list.length; i++) {\n    var item = list[i]\n    item.copy(buf, pos)\n    pos += item.length\n  }\n  return buf\n}\n\nfunction byteLength (string, encoding) {\n  if (typeof string !== 'string') string = '' + string\n\n  var len = string.length\n  if (len === 0) return 0\n\n  // Use a for loop to avoid recursion\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'ascii':\n      case 'binary':\n      // Deprecated\n      case 'raw':\n      case 'raws':\n        return len\n      case 'utf8':\n      case 'utf-8':\n        return utf8ToBytes(string).length\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return len * 2\n      case 'hex':\n        return len >>> 1\n      case 'base64':\n        return base64ToBytes(string).length\n      default:\n        if (loweredCase) return utf8ToBytes(string).length // assume utf8\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n  var loweredCase = false\n\n  start = start | 0\n  end = end === undefined || end === Infinity ? this.length : end | 0\n\n  if (!encoding) encoding = 'utf8'\n  if (start < 0) start = 0\n  if (end > this.length) end = this.length\n  if (end <= start) return ''\n\n  while (true) {\n    switch (encoding) {\n      case 'hex':\n        return hexSlice(this, start, end)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Slice(this, start, end)\n\n      case 'ascii':\n        return asciiSlice(this, start, end)\n\n      case 'binary':\n        return binarySlice(this, start, end)\n\n      case 'base64':\n        return base64Slice(this, start, end)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return utf16leSlice(this, start, end)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = (encoding + '').toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toString = function toString () {\n  var length = this.length | 0\n  if (length === 0) return ''\n  if (arguments.length === 0) return utf8Slice(this, 0, length)\n  return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return true\n  return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n  var str = ''\n  var max = exports.INSPECT_MAX_BYTES\n  if (this.length > 0) {\n    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n    if (this.length > max) str += ' ... '\n  }\n  return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return 0\n  return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n  if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n  else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n  byteOffset >>= 0\n\n  if (this.length === 0) return -1\n  if (byteOffset >= this.length) return -1\n\n  // Negative offsets start from the end of the buffer\n  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n  if (typeof val === 'string') {\n    if (val.length === 0) return -1 // special case: looking for empty string always fails\n    return String.prototype.indexOf.call(this, val, byteOffset)\n  }\n  if (Buffer.isBuffer(val)) {\n    return arrayIndexOf(this, val, byteOffset)\n  }\n  if (typeof val === 'number') {\n    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n    }\n    return arrayIndexOf(this, [ val ], byteOffset)\n  }\n\n  function arrayIndexOf (arr, val, byteOffset) {\n    var foundIndex = -1\n    for (var i = 0; byteOffset + i < arr.length; i++) {\n      if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n        if (foundIndex === -1) foundIndex = i\n        if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n      } else {\n        foundIndex = -1\n      }\n    }\n    return -1\n  }\n\n  throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` is deprecated\nBuffer.prototype.get = function get (offset) {\n  console.log('.get() is deprecated. Access using array indexes instead.')\n  return this.readUInt8(offset)\n}\n\n// `set` is deprecated\nBuffer.prototype.set = function set (v, offset) {\n  console.log('.set() is deprecated. Access using array indexes instead.')\n  return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  // must be an even number of digits\n  var strLen = string.length\n  if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; i++) {\n    var parsed = parseInt(string.substr(i * 2, 2), 16)\n    if (isNaN(parsed)) throw new Error('Invalid hex string')\n    buf[offset + i] = parsed\n  }\n  return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n  return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n  return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n  return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n  // Buffer#write(string)\n  if (offset === undefined) {\n    encoding = 'utf8'\n    length = this.length\n    offset = 0\n  // Buffer#write(string, encoding)\n  } else if (length === undefined && typeof offset === 'string') {\n    encoding = offset\n    length = this.length\n    offset = 0\n  // Buffer#write(string, offset[, length][, encoding])\n  } else if (isFinite(offset)) {\n    offset = offset | 0\n    if (isFinite(length)) {\n      length = length | 0\n      if (encoding === undefined) encoding = 'utf8'\n    } else {\n      encoding = length\n      length = undefined\n    }\n  // legacy write(string, encoding, offset, length) - remove in v0.13\n  } else {\n    var swap = encoding\n    encoding = offset\n    offset = length | 0\n    length = swap\n  }\n\n  var remaining = this.length - offset\n  if (length === undefined || length > remaining) length = remaining\n\n  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n    throw new RangeError('attempt to write outside buffer bounds')\n  }\n\n  if (!encoding) encoding = 'utf8'\n\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'hex':\n        return hexWrite(this, string, offset, length)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Write(this, string, offset, length)\n\n      case 'ascii':\n        return asciiWrite(this, string, offset, length)\n\n      case 'binary':\n        return binaryWrite(this, string, offset, length)\n\n      case 'base64':\n        // Warning: maxLength not taken into account in base64Write\n        return base64Write(this, string, offset, length)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return ucs2Write(this, string, offset, length)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nfunction base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction utf8Slice (buf, start, end) {\n  end = Math.min(buf.length, end)\n  var res = []\n\n  var i = start\n  while (i < end) {\n    var firstByte = buf[i]\n    var codePoint = null\n    var bytesPerSequence = (firstByte > 0xEF) ? 4\n      : (firstByte > 0xDF) ? 3\n      : (firstByte > 0xBF) ? 2\n      : 1\n\n    if (i + bytesPerSequence <= end) {\n      var secondByte, thirdByte, fourthByte, tempCodePoint\n\n      switch (bytesPerSequence) {\n        case 1:\n          if (firstByte < 0x80) {\n            codePoint = firstByte\n          }\n          break\n        case 2:\n          secondByte = buf[i + 1]\n          if ((secondByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n            if (tempCodePoint > 0x7F) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 3:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 4:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          fourthByte = buf[i + 3]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n              codePoint = tempCodePoint\n            }\n          }\n      }\n    }\n\n    if (codePoint === null) {\n      // we did not generate a valid codePoint so insert a\n      // replacement char (U+FFFD) and advance only 1 byte\n      codePoint = 0xFFFD\n      bytesPerSequence = 1\n    } else if (codePoint > 0xFFFF) {\n      // encode to utf16 (surrogate pair dance)\n      codePoint -= 0x10000\n      res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n      codePoint = 0xDC00 | codePoint & 0x3FF\n    }\n\n    res.push(codePoint)\n    i += bytesPerSequence\n  }\n\n  return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n  var len = codePoints.length\n  if (len <= MAX_ARGUMENTS_LENGTH) {\n    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n  }\n\n  // Decode in chunks to avoid \"call stack size exceeded\".\n  var res = ''\n  var i = 0\n  while (i < len) {\n    res += String.fromCharCode.apply(\n      String,\n      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n    )\n  }\n  return res\n}\n\nfunction asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i] & 0x7F)\n  }\n  return ret\n}\n\nfunction binarySlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i])\n  }\n  return ret\n}\n\nfunction hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; i++) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n  var len = this.length\n  start = ~~start\n  end = end === undefined ? len : ~~end\n\n  if (start < 0) {\n    start += len\n    if (start < 0) start = 0\n  } else if (start > len) {\n    start = len\n  }\n\n  if (end < 0) {\n    end += len\n    if (end < 0) end = 0\n  } else if (end > len) {\n    end = len\n  }\n\n  if (end < start) end = start\n\n  var newBuf\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    newBuf = Buffer._augment(this.subarray(start, end))\n  } else {\n    var sliceLen = end - start\n    newBuf = new Buffer(sliceLen, undefined)\n    for (var i = 0; i < sliceLen; i++) {\n      newBuf[i] = this[i + start]\n    }\n  }\n\n  if (newBuf.length) newBuf.parent = this.parent || this\n\n  return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    checkOffset(offset, byteLength, this.length)\n  }\n\n  var val = this[offset + --byteLength]\n  var mul = 1\n  while (byteLength > 0 && (mul *= 0x100)) {\n    val += this[offset + --byteLength] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return ((this[offset]) |\n      (this[offset + 1] << 8) |\n      (this[offset + 2] << 16)) +\n      (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] * 0x1000000) +\n    ((this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var i = byteLength\n  var mul = 1\n  var val = this[offset + --i]\n  while (i > 0 && (mul *= 0x100)) {\n    val += this[offset + --i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  if (!(this[offset] & 0x80)) return (this[offset])\n  return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset] | (this[offset + 1] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset + 1] | (this[offset] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset]) |\n    (this[offset + 1] << 8) |\n    (this[offset + 2] << 16) |\n    (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] << 24) |\n    (this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n  if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var mul = 1\n  var i = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var i = byteLength - 1\n  var mul = 1\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n      (littleEndian ? i : 1 - i) * 8\n  }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffffffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset + 3] = (value >>> 24)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 1] = (value >>> 8)\n    this[offset] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = 0\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  if (value < 0) value = 0xff + value + 1\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 3] = (value >>> 24)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (value < 0) value = 0xffffffff + value + 1\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n  if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n  return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n  return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (targetStart >= target.length) targetStart = target.length\n  if (!targetStart) targetStart = 0\n  if (end > 0 && end < start) end = start\n\n  // Copy 0 bytes; we're done\n  if (end === start) return 0\n  if (target.length === 0 || this.length === 0) return 0\n\n  // Fatal error conditions\n  if (targetStart < 0) {\n    throw new RangeError('targetStart out of bounds')\n  }\n  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n  if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n  // Are we oob?\n  if (end > this.length) end = this.length\n  if (target.length - targetStart < end - start) {\n    end = target.length - targetStart + start\n  }\n\n  var len = end - start\n  var i\n\n  if (this === target && start < targetStart && targetStart < end) {\n    // descending copy from end\n    for (i = len - 1; i >= 0; i--) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n    // ascending copy from start\n    for (i = 0; i < len; i++) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else {\n    target._set(this.subarray(start, start + len), targetStart)\n  }\n\n  return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n  if (!value) value = 0\n  if (!start) start = 0\n  if (!end) end = this.length\n\n  if (end < start) throw new RangeError('end < start')\n\n  // Fill 0 bytes; we're done\n  if (end === start) return\n  if (this.length === 0) return\n\n  if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n  if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n  var i\n  if (typeof value === 'number') {\n    for (i = start; i < end; i++) {\n      this[i] = value\n    }\n  } else {\n    var bytes = utf8ToBytes(value.toString())\n    var len = bytes.length\n    for (i = start; i < end; i++) {\n      this[i] = bytes[i % len]\n    }\n  }\n\n  return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n  if (typeof Uint8Array !== 'undefined') {\n    if (Buffer.TYPED_ARRAY_SUPPORT) {\n      return (new Buffer(this)).buffer\n    } else {\n      var buf = new Uint8Array(this.length)\n      for (var i = 0, len = buf.length; i < len; i += 1) {\n        buf[i] = this[i]\n      }\n      return buf.buffer\n    }\n  } else {\n    throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n  }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n  arr.constructor = Buffer\n  arr._isBuffer = true\n\n  // save reference to original Uint8Array set method before overwriting\n  arr._set = arr.set\n\n  // deprecated\n  arr.get = BP.get\n  arr.set = BP.set\n\n  arr.write = BP.write\n  arr.toString = BP.toString\n  arr.toLocaleString = BP.toString\n  arr.toJSON = BP.toJSON\n  arr.equals = BP.equals\n  arr.compare = BP.compare\n  arr.indexOf = BP.indexOf\n  arr.copy = BP.copy\n  arr.slice = BP.slice\n  arr.readUIntLE = BP.readUIntLE\n  arr.readUIntBE = BP.readUIntBE\n  arr.readUInt8 = BP.readUInt8\n  arr.readUInt16LE = BP.readUInt16LE\n  arr.readUInt16BE = BP.readUInt16BE\n  arr.readUInt32LE = BP.readUInt32LE\n  arr.readUInt32BE = BP.readUInt32BE\n  arr.readIntLE = BP.readIntLE\n  arr.readIntBE = BP.readIntBE\n  arr.readInt8 = BP.readInt8\n  arr.readInt16LE = BP.readInt16LE\n  arr.readInt16BE = BP.readInt16BE\n  arr.readInt32LE = BP.readInt32LE\n  arr.readInt32BE = BP.readInt32BE\n  arr.readFloatLE = BP.readFloatLE\n  arr.readFloatBE = BP.readFloatBE\n  arr.readDoubleLE = BP.readDoubleLE\n  arr.readDoubleBE = BP.readDoubleBE\n  arr.writeUInt8 = BP.writeUInt8\n  arr.writeUIntLE = BP.writeUIntLE\n  arr.writeUIntBE = BP.writeUIntBE\n  arr.writeUInt16LE = BP.writeUInt16LE\n  arr.writeUInt16BE = BP.writeUInt16BE\n  arr.writeUInt32LE = BP.writeUInt32LE\n  arr.writeUInt32BE = BP.writeUInt32BE\n  arr.writeIntLE = BP.writeIntLE\n  arr.writeIntBE = BP.writeIntBE\n  arr.writeInt8 = BP.writeInt8\n  arr.writeInt16LE = BP.writeInt16LE\n  arr.writeInt16BE = BP.writeInt16BE\n  arr.writeInt32LE = BP.writeInt32LE\n  arr.writeInt32BE = BP.writeInt32BE\n  arr.writeFloatLE = BP.writeFloatLE\n  arr.writeFloatBE = BP.writeFloatBE\n  arr.writeDoubleLE = BP.writeDoubleLE\n  arr.writeDoubleBE = BP.writeDoubleBE\n  arr.fill = BP.fill\n  arr.inspect = BP.inspect\n  arr.toArrayBuffer = BP.toArrayBuffer\n\n  return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n  // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n  str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n  // Node converts strings with length < 2 to ''\n  if (str.length < 2) return ''\n  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n  while (str.length % 4 !== 0) {\n    str = str + '='\n  }\n  return str\n}\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n  units = units || Infinity\n  var codePoint\n  var length = string.length\n  var leadSurrogate = null\n  var bytes = []\n\n  for (var i = 0; i < length; i++) {\n    codePoint = string.charCodeAt(i)\n\n    // is surrogate component\n    if (codePoint > 0xD7FF && codePoint < 0xE000) {\n      // last char was a lead\n      if (!leadSurrogate) {\n        // no lead yet\n        if (codePoint > 0xDBFF) {\n          // unexpected trail\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        } else if (i + 1 === length) {\n          // unpaired lead\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        }\n\n        // valid lead\n        leadSurrogate = codePoint\n\n        continue\n      }\n\n      // 2 leads in a row\n      if (codePoint < 0xDC00) {\n        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n        leadSurrogate = codePoint\n        continue\n      }\n\n      // valid surrogate pair\n      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n    } else if (leadSurrogate) {\n      // valid bmp char, but last char was a lead\n      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n    }\n\n    leadSurrogate = null\n\n    // encode utf8\n    if (codePoint < 0x80) {\n      if ((units -= 1) < 0) break\n      bytes.push(codePoint)\n    } else if (codePoint < 0x800) {\n      if ((units -= 2) < 0) break\n      bytes.push(\n        codePoint >> 0x6 | 0xC0,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x10000) {\n      if ((units -= 3) < 0) break\n      bytes.push(\n        codePoint >> 0xC | 0xE0,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x110000) {\n      if ((units -= 4) < 0) break\n      bytes.push(\n        codePoint >> 0x12 | 0xF0,\n        codePoint >> 0xC & 0x3F | 0x80,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else {\n      throw new Error('Invalid code point')\n    }\n  }\n\n  return bytes\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    // Node's code seems to be doing this and not & 0x7F..\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    if ((units -= 2) < 0) break\n\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  for (var i = 0; i < length; i++) {\n    if ((i + offset >= dst.length) || (i >= src.length)) break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(59).Buffer, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/buffer/index.js\n ** module id = 59\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/buffer/index.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.annotations = exports.cameraEffects = exports.CamViewControls = exports.meshTools = exports.planes = exports.grids = undefined;\n\nvar _Grids = __webpack_require__(254);\n\nvar grids = _interopRequireWildcard(_Grids);\n\nvar _Planes = __webpack_require__(257);\n\nvar planes = _interopRequireWildcard(_Planes);\n\nvar _CamViewControls = __webpack_require__(265);\n\nvar _CamViewControls2 = _interopRequireDefault(_CamViewControls);\n\nvar _AnnotationVisual = __webpack_require__(22);\n\nvar _AnnotationVisual2 = _interopRequireDefault(_AnnotationVisual);\n\nvar _DistanceVisual = __webpack_require__(260);\n\nvar _DistanceVisual2 = _interopRequireDefault(_DistanceVisual);\n\nvar _NoteVisual = __webpack_require__(261);\n\nvar _NoteVisual2 = _interopRequireDefault(_NoteVisual);\n\nvar _DiameterVisual = __webpack_require__(259);\n\nvar _DiameterVisual2 = _interopRequireDefault(_DiameterVisual);\n\nvar _AngleVisual = __webpack_require__(258);\n\nvar _AngleVisual2 = _interopRequireDefault(_AngleVisual);\n\nvar _ThicknessVisual = __webpack_require__(262);\n\nvar _ThicknessVisual2 = _interopRequireDefault(_ThicknessVisual);\n\nvar _zoomInOn = __webpack_require__(263);\n\nvar _zoomInOn2 = _interopRequireDefault(_zoomInOn);\n\nvar _zoomToFit = __webpack_require__(264);\n\nvar _zoomToFit2 = _interopRequireDefault(_zoomToFit);\n\nvar _centerMesh = __webpack_require__(267);\n\nvar _centerMesh2 = _interopRequireDefault(_centerMesh);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n//import * as objectEffects from './objectEffects'\n\nvar annotations = { AnnotationVisual: _AnnotationVisual2.default, DistanceVisual: _DistanceVisual2.default, NoteVisual: _NoteVisual2.default, DiameterVisual: _DiameterVisual2.default, AngleVisual: _AngleVisual2.default, ThicknessVisual: _ThicknessVisual2.default };\n\n//import ZoomInOnObject from './objectEffects/zoomInOnObject'\n\nvar cameraEffects = { zoomInOn: _zoomInOn2.default, zoomToFit: _zoomToFit2.default };\n\nvar meshTools = { centerMesh: _centerMesh2.default };\n\nexports.grids = grids;\nexports.planes = planes;\nexports.meshTools = meshTools;\nexports.CamViewControls = _CamViewControls2.default;\nexports.cameraEffects = cameraEffects;\nexports.annotations = annotations;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/index.js\n ** module id = 60\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(module, global) {/**\n * lodash 3.0.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/** Used to determine if values are of the language type `Object`. */\nvar objectTypes = {\n  'function': true,\n  'object': true\n};\n\n/** Detect free variable `exports`. */\nvar freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)\n  ? exports\n  : undefined;\n\n/** Detect free variable `module`. */\nvar freeModule = (objectTypes[typeof module] && module && !module.nodeType)\n  ? module\n  : undefined;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);\n\n/** Detect free variable `self`. */\nvar freeSelf = checkGlobal(objectTypes[typeof self] && self);\n\n/** Detect free variable `window`. */\nvar freeWindow = checkGlobal(objectTypes[typeof window] && window);\n\n/** Detect `this` as the global object. */\nvar thisGlobal = checkGlobal(objectTypes[typeof this] && this);\n\n/**\n * Used as a reference to the global object.\n *\n * The `this` value is used if it's the global object to avoid Greasemonkey's\n * restricted `window` object, otherwise the `window` object is used.\n */\nvar root = freeGlobal ||\n  ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||\n    freeSelf || thisGlobal || Function('return this')();\n\n/**\n * Checks if `value` is a global object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {null|Object} Returns `value` if it's a global object, else `null`.\n */\nfunction checkGlobal(value) {\n  return (value && value.Object === Object) ? value : null;\n}\n\nmodule.exports = root;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module), (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._root/index.js\n ** module id = 61\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._root/index.js?")},function(module,exports){eval("'use strict';\n\nvar proto = Element.prototype;\nvar vendor = proto.matches\n  || proto.matchesSelector\n  || proto.webkitMatchesSelector\n  || proto.mozMatchesSelector\n  || proto.msMatchesSelector\n  || proto.oMatchesSelector;\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n  if (vendor) return vendor.call(el, selector);\n  var nodes = el.parentNode.querySelectorAll(selector);\n  for (var i = 0; i < nodes.length; i++) {\n    if (nodes[i] == el) return true;\n  }\n  return false;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/matches-selector/index.js\n ** module id = 62\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/matches-selector/index.js?")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(96)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/utils.js\n ** module id = 63\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/utils.js?")},function(module,exports){eval('"use strict";\nvar ScopeChecker = (function () {\n    function ScopeChecker(scope, isolateModule) {\n        this.scope = scope;\n        this.isolateModule = isolateModule;\n    }\n    ScopeChecker.prototype.isStrictlyInRootScope = function (leaf) {\n        for (var el = leaf; el; el = el.parentElement) {\n            var scope = this.isolateModule.isIsolatedElement(el);\n            if (scope && scope !== this.scope) {\n                return false;\n            }\n            if (scope) {\n                return true;\n            }\n        }\n        return true;\n    };\n    return ScopeChecker;\n}());\nexports.ScopeChecker = ScopeChecker;\n//# sourceMappingURL=ScopeChecker.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/ScopeChecker.js\n ** module id = 64\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/ScopeChecker.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_adapter_1 = __webpack_require__(23);\nvar xstream_1 = __webpack_require__(19);\nfunction createVTree(vnode, children) {\n    return {\n        sel: vnode.sel,\n        data: vnode.data,\n        text: vnode.text,\n        elm: vnode.elm,\n        key: vnode.key,\n        children: children,\n    };\n}\nfunction makeTransposeVNode(runStreamAdapter) {\n    return function transposeVNode(vnode) {\n        if (!vnode) {\n            return null;\n        }\n        else if (vnode && typeof vnode.data === "object" && vnode.data.static) {\n            return xstream_1.default.of(vnode);\n        }\n        else if (runStreamAdapter.isValidStream(vnode)) {\n            var xsStream = xstream_adapter_1.default.adapt(vnode, runStreamAdapter.streamSubscribe);\n            return xsStream.map(transposeVNode).flatten();\n        }\n        else if (typeof vnode === "object") {\n            if (!vnode.children || vnode.children.length === 0) {\n                return xstream_1.default.of(vnode);\n            }\n            var vnodeChildren = vnode.children\n                .map(transposeVNode)\n                .filter(function (x) { return x !== null; });\n            if (vnodeChildren.length === 0) {\n                return xstream_1.default.of(createVTree(vnode, []));\n            }\n            else {\n                return xstream_1.default.combine.apply(xstream_1.default, vnodeChildren)\n                    .map(function (children) { return createVTree(vnode, children.slice()); });\n            }\n        }\n        else {\n            throw new Error("Unhandled vTree Value");\n        }\n    };\n}\nexports.makeTransposeVNode = makeTransposeVNode;\n//# sourceMappingURL=transposition.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/transposition.js\n ** module id = 65\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/transposition.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = renderProgressBar;\n\nvar _dom = __webpack_require__(16);\n\n__webpack_require__(345);\n\nfunction renderProgressBar(state) {\n  var defaults = {\n    progress: 0,\n    hideOnDone: true\n  };\n\n  var _Object$assign = Object.assign({}, defaults, state);\n\n  var progress = _Object$assign.progress;\n  var hideOnDone = _Object$assign.hideOnDone;\n\n\n  var element = hideOnDone && progress === 100 ? (0, _dom.h)('div') : (0, _dom.h)('div.progressBar', [(0, _dom.h)('span.fill', { style: { width: progress + '%' } })]);\n  return element;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/ProgressBar/index.js\n ** module id = 66\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/ProgressBar/index.js?")},function(module,exports){eval("'use strict';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mr.doob / http://mrdoob.com/\n */\n\n/*var window = window || {CanvasRenderingContext2D:false,WebGLRenderingContext:false,Worker:undefined,File:undefined,\nFileReader:undefined,FileList:undefined, Blob:undefined }*/\n\nvar Detector = {\n\n  canvas: !!window.CanvasRenderingContext2D,\n  webgl: function () {\n    try {\n      return !!window.WebGLRenderingContext && !!document.createElement('canvas').getContext('experimental-webgl');\n    } catch (e) {\n      return false;\n    }\n  }(),\n  workers: !!window.Worker,\n  fileapi: window.File && window.FileReader && window.FileList && window.Blob\n\n};\n\nmodule.exports = Detector;\n\nfunction getWebGLErrorMessage() {\n\n  var domElement = document.createElement('div');\n\n  domElement.style.fontFamily = 'monospace';\n  domElement.style.fontSize = '13px';\n  domElement.style.textAlign = 'center';\n  domElement.style.background = '#eee';\n  domElement.style.color = '#000';\n  domElement.style.padding = '1em';\n  domElement.style.width = '475px';\n  domElement.style.margin = '5em auto 0';\n\n  if (!this.webgl) {\n\n    domElement.innerHTML = window.WebGLRenderingContext ? ['Sorry, your graphics card doesn\\'t support <a href=\"http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation\">WebGL</a>'].join('\\n') : ['Sorry, your browser doesn\\'t support <a href=\"http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation\">WebGL</a><br/>', 'Please try with', '<a href=\"http://www.google.com/chrome\">Chrome</a>, ', '<a href=\"http://www.mozilla.com/en-US/firefox/new/\">Firefox 4</a> or', '<a href=\"http://nightly.webkit.org/\">Webkit Nightly (Mac)</a>'].join('\\n');\n  }\n\n  return domElement;\n}\n\nfunction addGetWebGLMessage(parameters) {\n\n  var parent, id, domElement;\n\n  parameters = parameters || {};\n\n  parent = parameters.parent !== undefined ? parameters.parent : document.body;\n  id = parameters.id !== undefined ? parameters.id : 'oldie';\n\n  domElement = Detector.getWebGLErrorMessage();\n  domElement.id = id;\n\n  parent.appendChild(domElement);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Detector.js\n ** module id = 67\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Detector.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nexports.findSelectionRoot = findSelectionRoot;\nexports.getCoordsFromPosSizeRect = getCoordsFromPosSizeRect;\nexports.pick = pick;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _Projector = __webpack_require__(148);\n\nvar _Projector2 = _interopRequireDefault(_Projector);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction isRootNode(node) {\n  return node.selectTrickleUp === false && node.selectable === true;\n}\n\nfunction walkUp(node, checker) {\n  if (node) {\n    if (checker(node)) {\n      return node;\n    }\n    if (node.parent) {\n      return walkUp(node.parent, checker);\n    }\n  }\n  return undefined;\n}\n\nfunction findSelectionRoot(node) {\n  return walkUp(node, isRootNode);\n}\n\nfunction getCoordsFromPosSizeRect(inputs) {\n  var pos = inputs.pos;\n  var rect = inputs.rect;\n  var width = inputs.width;\n  var height = inputs.height;\n\n  var x = (pos.x - rect.left) / width * 2 - 1;\n  var y = -((pos.y - rect.top) / height) * 2 + 1;\n  //v = new THREE.Vector3((x / this.viewWidth) * 2 - 1, -(y / this.viewHeight) * 2 + 1, 1)\n  return { x: x, y: y };\n}\n\nfunction pick(mouseCoords, camera, hiearchyRoot) {\n  var ortho = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];\n  var precision = arguments.length <= 4 || arguments[4] === undefined ? 10 : arguments[4];\n  var x = mouseCoords.x;\n  var y = mouseCoords.y;\n\n  var mousecoords = new _three2.default.Vector3(x, y, 0.5);\n  var v = mousecoords;\n  var intersects = [];\n\n  if (!ortho) {\n    v.unproject(camera);\n    var fooV = v.clone();\n    var raycaster = new _three2.default.Raycaster(camera.position, v.sub(camera.position).normalize());\n    //raycaster.precision = 10\n    intersects = raycaster.intersectObjects(hiearchyRoot, true);\n  } else {\n    // use picking ray since it's an orthographic camera\n    //var ray = this.projector.pickingRay( v, this.camera )\n    //intersects = ray.intersectObjects( this.hiearchyRoot, true )\n    //see here:\n    _three2.default.Vector3.prototype.pickingRay = function (camera) {\n      var tan = Math.tan(0.5 * _three2.default.Math.degToRad(camera.fov)) / camera.zoom;\n\n      this.x *= tan * camera.aspect;\n      this.y *= tan;\n      this.z = -1;\n      return this.transformDirection(camera.matrixWorld);\n    };\n\n    var _raycaster = new _three2.default.Raycaster();\n    v.pickingRay(camera);\n    _raycaster.set(camera.position, v);\n    intersects = _raycaster.intersectObjects(hiearchyRoot, true);\n  }\n\n  //remove invisibles, dedupe ??\n  //TODO: use transducers.js ?\n  intersects = intersects.filter(function (intersect) {\n    return intersect.object && intersect.object.visible === true;\n  }) //&& intersect.object.pickable)\n  .sort(function (a, b) {\n    return a.distance - b.distance;\n  });\n  //.reverse()\n\n  return intersects;\n}\n\nvar Selector = function () {\n  function Selector() {\n    _classCallCheck(this, Selector);\n\n    this.projector = new _three2.default.Projector();\n    this.camera = undefined;\n    //for camera\n    this.isOrtho = false;\n  }\n\n  /*pick(event, rect, width, height, scene){\n    event.preventDefault()\n    //console.log(\"rect, width, height\",rect, width, height)\n    var x =   ( (event.clientX - rect.left) / width) * 2 - 1\n    var y = - ( (event.clientY - rect.top) / height) * 2 + 1\n     this.hiearchyRoot = scene.children\n     return this._pickInner( x, y, null, this.camera)\n  }*/\n\n  _createClass(Selector, [{\n    key: 'pickAlt',\n    value: function pickAlt(pos, rect, width, height, scene) {\n      //console.log(\"rect, width, height\",rect, width, height)\n      var x = (pos.x - rect.left) / width * 2 - 1;\n      var y = -((pos.y - rect.top) / height) * 2 + 1;\n\n      this.hiearchyRoot = scene.children;\n\n      return this._pickInner(x, y, null, this.camera);\n    }\n  }, {\n    key: '_pickInner',\n    value: function _pickInner(x, y, isOrtho, camera) {\n      isOrtho = isOrtho || this.isOrtho;\n      camera = camera || this.camera;\n      var mousecoords = new _three2.default.Vector3(x, y, 0.5);\n\n      var intersects = [];\n      //v = new THREE.Vector3((x / this.viewWidth) * 2 - 1, -(y / this.viewHeight) * 2 + 1, 1)\n      var v = mousecoords;\n      if (!isOrtho) {\n        v.unproject(camera);\n        var v1 = v.clone();\n        var fooV = v.clone();\n        var raycaster = new _three2.default.Raycaster(camera.position, v.sub(camera.position).normalize());\n        //raycaster.precision = 10\n        intersects = raycaster.intersectObjects(this.hiearchyRoot, true);\n      } else {\n        // use picking ray since it's an orthographic camera\n        //var ray = this.projector.pickingRay( v, this.camera )\n        //intersects = ray.intersectObjects( this.hiearchyRoot, true )\n        //see here:\n        _three2.default.Vector3.prototype.pickingRay = function (camera) {\n          var tan = Math.tan(0.5 * _three2.default.Math.degToRad(camera.fov)) / camera.zoom;\n\n          this.x *= tan * camera.aspect;\n          this.y *= tan;\n          this.z = -1;\n\n          return this.transformDirection(camera.matrixWorld);\n        };\n\n        var _raycaster2 = new _three2.default.Raycaster();\n        v.pickingRay(this.camera);\n        _raycaster2.set(this.camera.position, v);\n        intersects = _raycaster2.intersectObjects(this.hiearchyRoot, true);\n      }\n\n      //remove invisibles, dedupe\n      //TODO: use transducers.js\n      intersects = intersects.sort().filter(function (intersect, pos) {\n        return intersect.object && intersect.object.visible === true && !pos || intersect != intersects[pos - 1];\n      });\n\n      return intersects;\n\n      /*\n      mousecoords.unproject(camera)\n      raycaster.ray.set( camera.position, mousecoords.sub( camera.position ).normalize() )\n       var intersections = raycaster.intersectObjects( this._THREEObject3D.children, true )\n      var firstintersection = ( intersections.length ) > 0 ? intersections[ 0 ] : null\n      if (firstintersection !== null) {\n        var pickobject = firstintersection.object\n        if (typeof pickobject.userData !== 'undefined' &&\n            typeof pickobject.userData.props.onPick === 'function') {\n          pickobject.userData.props.onPick(event, firstintersection)\n        }\n      }*/\n    }\n  }]);\n\n  return Selector;\n}();\n\nexports.default = Selector;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Selector.js\n ** module id = 68\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Selector.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.positionFromCoords = positionFromCoords;\nexports.targetObject = targetObject;\nexports.isTransformTool = isTransformTool;\nexports.selectionAt = selectionAt;\nexports.meshFrom = meshFrom;\nexports.makeCamera = makeCamera;\nexports.makeControls = makeControls;\nexports.makeLight = makeLight;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _OrbitControls = __webpack_require__(147);\n\nvar _OrbitControls2 = _interopRequireDefault(_OrbitControls);\n\nvar _CombinedCamera = __webpack_require__(146);\n\nvar _CombinedCamera2 = _interopRequireDefault(_CombinedCamera);\n\nvar _ramda = __webpack_require__(4);\n\nvar _Selector = __webpack_require__(68);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// faster object.assign\n\nfunction positionFromCoords(coords) {\n  return { position: { x: coords.x, y: coords.y }, event: coords };\n}\nfunction targetObject(event) {\n  return event.target.object;\n}\nfunction isTransformTool(input) {\n  return ['translate', 'rotate', 'scale', null, undefined].indexOf(input) > -1;\n}\n\nfunction selectionAt(event, mouseCoords, camera, hiearchyRoot) {\n  // log.debug(\"selection at\",event)\n  // , container, selector, width, height, rootObject\n\n  // let intersects = selector.pickAlt({x:event.clientX,y:event.clientY}, rect, width, height, rootObject)\n  var intersects = (0, _Selector.pick)(mouseCoords, camera, hiearchyRoot); // , ortho = false, precision=10)\n\n  var outEvent = {};\n  outEvent.clientX = event.clientX;\n  outEvent.clientY = event.clientY;\n  outEvent.offsetX = event.offsetX;\n  outEvent.offsetY = event.offsetY;\n  outEvent.x = event.x || event.clientX;\n  outEvent.y = event.y || event.clientY;\n\n  outEvent.detail = {};\n  outEvent.detail.pickingInfos = intersects;\n  return outEvent;\n}\n\nfunction meshFrom(event) {\n  var mesh = void 0;\n  if (event && event.detail && event.detail.pickingInfos) {\n    var _take = (0, _ramda.take)(1, event.detail.pickingInfos);\n\n    var _take2 = _slicedToArray(_take, 1);\n\n    var intersect = _take2[0]; // we actually only get the best match => DO NOT MODIFY original object\n\n    if (intersect && intersect.object) {\n      mesh = (0, _Selector.findSelectionRoot)(intersect.object); // now we make sure that what we have is actually selectable\n    }\n  }\n  return mesh;\n}\n\n// //////////Various \"making\" functions , data/config in, (3d object) instances out\n// yup, like factories ! yikes !\n\n/* create a camera instance from the provided data*/\nfunction makeCamera(cameraData, params) {\n  // let cameraData = cameraData//TODO: merge with defaults using object.assign\n  var DEFAULTS = {\n    width: 320,\n    height: 240,\n    lens: {\n      fov: 45,\n      near: 0.1,\n      far: 20000\n    },\n    aspect: 320 / 240,\n    up: [0, 0, 1],\n    pos: [0, 0, 0]\n  };\n  cameraData = (0, _assign2.default)({}, DEFAULTS, cameraData);\n\n  var camera = new _CombinedCamera2.default(cameraData.width, cameraData.height, cameraData.lens.fov, cameraData.lens.near, cameraData.lens.far, cameraData.lens.near, cameraData.lens.far);\n\n  camera.up.fromArray(cameraData.up);\n  camera.position.fromArray(cameraData.pos);\n  return camera;\n}\n\n/* setup a controls instance from the provided data*/\nfunction makeControls(controlsData) {\n  var up = new _three2.default.Vector3().fromArray(controlsData.up);\n\n  // controlsData = controlsData//TODO: merge with defaults using object.assign\n  var controls = new _OrbitControls2.default(undefined, undefined, up);\n  controls.upVector = up;\n\n  controls.userPanSpeed = controlsData.panSpeed;\n  controls.userZoomSpeed = controlsData.zoomSpeed;\n  controls.userRotateSpeed = controlsData.rotateSpeed;\n\n  controls.autoRotate = controlsData.autoRotate.enabled;\n  controls.autoRotateSpeed = controlsData.autoRotate.speed;\n\n  return controls;\n}\n\n/* create a light instance from the provided data*/\nfunction makeLight(lightData) {\n  var light = void 0;\n  var DEFAULTS = {\n    color: '#FFF',\n    intensity: 1,\n    pos: [0, 0, 0]\n  };\n  lightData = (0, _assign2.default)({}, DEFAULTS, lightData);\n\n  switch (lightData.type) {\n    case 'light':\n      light = new _three2.default.Light(lightData.color);\n      light.intensity = lightData.intensity;\n      break;\n    case 'hemisphereLight':\n      light = new _three2.default.HemisphereLight(lightData.color, lightData.gndColor, lightData.intensity);\n      break;\n    case 'ambientLight':\n      // ambient light does not have intensity, only color\n      var newColor = new _three2.default.Color(lightData.color);\n      newColor.r *= lightData.intensity;\n      newColor.g *= lightData.intensity;\n      newColor.b *= lightData.intensity;\n      light = new _three2.default.AmbientLight(newColor);\n      break;\n    case 'directionalLight':\n      var dirLightDefaults = {\n        castShadow: false,\n        onlyShadow: false,\n\n        shadowMapWidth: 2048,\n        shadowMapHeight: 2048,\n        shadowCameraLeft: -500,\n        shadowCameraRight: 500,\n        shadowCameraTop: 500,\n        shadowCameraBottom: -500,\n        shadowCameraNear: 1200,\n        shadowCameraFar: 5000,\n        shadowCameraFov: 50,\n        shadowBias: 0.0001,\n        shadowDarkness: 0.3,\n        shadowCameraVisible: false\n      };\n      lightData = (0, _assign2.default)({}, dirLightDefaults, lightData);\n      light = new _three2.default.DirectionalLight(lightData.color, lightData.intensity);\n      for (var key in lightData) {\n        if (light.hasOwnProperty(key)) {\n          light[key] = lightData[key];\n        }\n      }\n\n      break;\n    default:\n      throw new Error('could not create light');\n  }\n\n  light.position.fromArray(lightData.pos);\n\n  return light;\n}\n\nfunction cameraWobble3dHint(camera) {\n  var time = arguments.length <= 1 || arguments[1] === undefined ? 1500 : arguments[1];\n\n  var camPos = camera.position.clone();\n  var target = camera.position.clone().add(new _three2.default.Vector3(-5, -10, -5));\n\n  var tween = new TWEEN.Tween(camPos).to(target, time).repeat(Infinity).delay(500).yoyo(true).easing(TWEEN.Easing.Cubic.InOut).onUpdate(function () {\n    camera.position.copy(camPos);\n  }).start();\n\n  // let camRot = camera.rotation.clone()\n  // let rtarget = camera.rotation.clone().add(new THREE.Vector3(50,50,50))\n\n  /* let tween2 = new TWEEN.Tween( camRot )\n    .to( rtarget , time )\n    .repeat( Infinity )\n    .delay( 500 )\n    .yoyo(true)\n    .easing( TWEEN.Easing.Quadratic.InOut )\n    .onUpdate( function () {\n      camera.position.copy(camRot)\n    } )\n    .start()*/\n  return tween;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/utils2.js\n ** module id = 69\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/utils2.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\nexports.other = other;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(21);\n\nvar _dragAndDrop = __webpack_require__(217);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction partMesh(DOM, params) {\n  var dragOvers$ = DOM.select(':root').events('dragover');\n  var drops$ = DOM.select(':root').events('drop');\n  var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n  // drag & drop sources\n  var dndMeshFiles$ = dnd$.filter(function (e) {\n    return e.type === 'file';\n  }).pluck('data');\n  var dndMeshUris$ = dnd$.filter(function (e) {\n    return e.type === 'url';\n  }).pluck('data');\n\n  return (0, _utils.filterByExtensions)(merge(dndMeshFiles$, dndMeshUris$), params.get('extensions', 'meshes'));\n  // .map(data =>( {src:'desktop', uri:data.name} ) )\n}\n\nfunction partSource(DOM, params) {\n  var dragOvers$ = DOM.select(':root').events('dragover');\n  var drops$ = DOM.select(':root').events('drop');\n  var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n  // drag & drop sources\n  var dndSourceFiles$ = dnd$.filter(function (e) {\n    return e.type === 'file';\n  }).pluck('data');\n  var dndSourceUris$ = dnd$.filter(function (e) {\n    return e.type === 'url';\n  }).pluck('data');\n\n  return (0, _utils.filterByExtensions)(merge(dndSourceFiles$, dndSourceUris$), params.get('extensions', 'sources'));\n  // .map(data => ( {src:'desktop', uri:data.name} ) )\n}\n\nfunction other(DOM, params) {\n  var dragOvers$ = DOM.select(':root').events('dragover');\n  var drops$ = DOM.select(':root').events('drop');\n  var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n  // drag & drop sources\n  var dndOtherFiles$ = dnd$.filter(function (e) {\n    return e.type === 'file';\n  }).pluck('data');\n  var dndOtherUris$ = dnd$.filter(function (e) {\n    return e.type === 'url';\n  }).pluck('data');\n\n  return (0, _utils.filterByExtensions)(merge(dndOtherFiles$, dndOtherUris$), params.get('extensions', 'other'));\n  // .map(data => ( {src:'desktop', uri:data.name} ) )\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/DOM.js\n ** module id = 70\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/DOM.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\nexports.other = other;\n\nvar _utils = __webpack_require__(21);\n\nfunction partMesh(addressbar, params) {\n  return (0, _utils.filterByExtensions)(addressbar.get('modelUrl'), params.get('extensions', 'meshes'));\n  // .map(data =>  ({src:'http', uri:data})  )\n}\n\nfunction partSource(addressbar, params) {\n  return (0, _utils.filterByExtensions)(addressbar.get('sourceUrl'), params.get('extensions', 'sources'));\n  // .map(data =>  ({src:'http', uri:data})  )\n}\n\n// for other formats like gcode etc\nfunction other(addressbar, params) {\n  return (0, _utils.filterByExtensions)(addressbar.get('sourceUrl'), params.get('extensions', 'other'));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/addressbar.js\n ** module id = 71\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/addressbar.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\n\nvar _utils = __webpack_require__(21);\n\nfunction partMesh(postMessage$, params) {\n  return (0, _utils.filterByExtensions)(postMessage$.pluck('data').filter(_utils.hasModelUrl).pluck('modelUrl').map(function (data) {\n    return [data];\n  }) // always return array\n  , params.get('extensions', 'meshes')); // we only let actual mesh \"data\" through\n  // .map(data => ( {src:'http', uri:data} )  )\n}\n\nfunction partSource(postMessage$, params) {\n  return (0, _utils.filterByExtensions)(postMessage$.pluck('data').filter(_utils.hasModelUrl).pluck('sourceUrl').map(function (data) {\n    return [data];\n  }) // always return array\n\n  , params.get('extensions', 'sources')); // we only let actual sources \"data\" through\n  // .map(data => ( {src:'http', uri:data} ) )\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/postMessage.js\n ** module id = 72\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/postMessage.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.keycodes = undefined;\nexports.isValidElementEvent = isValidElementEvent;\nexports.preventBackNavigation = preventBackNavigation;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar keycodes = exports.keycodes = {\n  8: 'backspace', 46: 'delete',\n  48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9',\n  65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g',\n  72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n',\n  79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u',\n  86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z'\n};\n\n/*\nfunction setKeyBidings( element ){\n  //based on http://qiita.com/jdeseno/items/72e12a5fa815b52f95e2\n */\n\nfunction isValidElementEvent(event) {\n  var element = event.target || event.srcElement;\n  return !(element.tagName === 'INPUT' || element.tagName === 'SELECT' || element.tagName === 'TEXTAREA' || element.isContentEditable);\n}\n\nfunction preventBackNavigation() {\n  // disable backspace navigation for MacOs\n  _rx2.default.Observable.fromEvent(document, 'keydown').map(function (e) {\n    return { event: e, key: keycodes[e.keyCode] };\n  }).filter(function (e) {\n    return e.key === 'backspace';\n  }).tap(function (_ref) {\n    var event = _ref.event;\n\n    var d = event.srcElement || event.target;\n    var tagName = d.tagName.toUpperCase();\n    var type = d.type ? d.type.toUpperCase() : undefined;\n    var validElements = ['TEXT', 'PASSWORD', 'FILE', 'SEARCH', 'EMAIL', 'NUMBER', 'DATE'];\n\n    if (!(tagName === 'INPUT' && validElements.indexOf(type) > -1 || tagName === 'TEXTAREA')) {\n      event.preventDefault();\n      return false;\n    }\n  }).forEach(function (e) {\n    return e;\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/keyboard.js\n ** module id = 73\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/keyboard.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.clicks = clicks;\nexports.interactionsFromEvents = interactionsFromEvents;\nexports.interactionsFromCEvents = interactionsFromCEvents;\nexports.pointerInteractions = pointerInteractions;\nexports.preventScroll = preventScroll;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(218);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\nvar empty = _Rx$Observable.empty;\nvar just = _Rx$Observable.just;\n// faster object.assign\n\n// various helpers\nfunction hasTwoTouchPoints(event) {\n  return event.touches && event.touches.length === 2;\n}\n\nfunction getOffset(event) {\n  return {\n    x: event.offsetX === undefined ? event.layerX : event.offsetX,\n    y: event.offsetY === undefined ? event.layerY : event.offsetY\n  };\n}\n\nfunction isMoving(moveDelta, deltaSqr) {\n  return true;\n  /* let distSqr = (moveDelta.x * moveDelta.x + moveDelta.y * moveDelta.y)\n  let isMoving = (distSqr > deltaSqr)\n  // console.log(\"moving\",isMoving)\n  return isMoving*/\n}\n\nfunction isStatic(moveDelta, deltaSqr) {\n  return !isMoving(moveDelta);\n}\n\n// TODO ,: regroup / refactor all \"delta\" operation ?\nfunction isShort(elapsed, maxTime) {\n  return elapsed < maxTime;\n}\n\nfunction isLong(elapsed, maxTime) {\n  return elapsed > maxTime;\n}\n\nfunction clicks(mouseDowns, mouseUps, mouseMoves) {\n  var timing = arguments.length <= 3 || arguments[3] === undefined ? 200 : arguments[3];\n  var deltaSqr = arguments[4];\n\n  /*\n  \"pseudo click\" that does not trigger when there was\n  a mouse movement\n  */\n  var fakeClicksOld = mouseDowns.flatMap(function (md) {\n    var start = { x: md.clientX, y: md.clientY };\n\n    // get only valid moves\n    var mMoves = mouseMoves.map(false).bufferWithTimeOrCount(timing, 1).filter(function (x) {\n      return x.length === 1;\n    }).map(function (x) {\n      return x[0];\n    });\n\n    var __moves = mMoves.merge(just(true)); // default to true\n\n    return __moves.combineLatest(mouseUps, function (m, mu) {\n      // log.info(m, mu)\n      var end = { x: mu.clientX, y: mu.clientY };\n      return isStatic({ start: start, end: end }, deltaSqr); // allow for small movement (shaky hands!)\n    }).takeUntil(mouseUps).filter(function (x) {\n      return x === true;\n    });\n  });\n\n  var fakeClicks = mouseDowns.flatMap(function (downEvent) {\n    var target = downEvent.currentTarget;\n    return _rx2.default.Observable.amb([\n    // Skip if we get a movement before a mouse up\n    mouseMoves.take(1).flatMap(function (x) {\n      return empty();\n    }), mouseUps.take(1)]); // .map(function(event){console.log(event) return event})\n  });\n\n  return fakeClicks;\n}\n\nfunction altMouseMoves(mouseMoves) {\n  return mouseMoves.skip(1).zip(mouseMoves, function (a, b) {\n    var data = {\n      client: {\n        x: a.clientX,\n        y: a.clientY\n      },\n      delta: { x: a.clientX - b.clientX, y: a.clientY - b.clientY }\n    };\n\n    return (0, _assign2.default)(data, b);\n  });\n}\n\n/* alternative \"clicks\" (ie mouseDown -> mouseUp ) implementation, with more fine\ngrained control*/\nfunction taps(mouseDowns, mouseUps, mouseMoves) {\n  var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n  var deltaSqr = arguments[4];\n\n  // only doing any \"clicks if the time between mDOWN and mUP is below longpressDelay\"\n  // any small mouseMove is ignored (shaky hands)\n  return mouseDowns.flatMap(function (downEvent) {\n    var target = downEvent.currentTarget;\n    // const startTime = Date.now()//TODO: use time difference to determine if it was a short or a long tap ?\n\n    return _rx2.default.Observable.amb([\n    // Skip if we get a movement before a mouse up\n    mouseMoves.filter(function (data) {\n      return isMoving(data.delta, deltaSqr);\n    }) // allow for small movement (shaky hands!)\n    .take(1).flatMap(function (x) {\n      return empty();\n    }).timeInterval(), mouseUps.take(1).timeInterval()]); // .timeout(longPressDelay, empty())\n  });\n}\n\n/* this emits events whenever pointers are held */\nfunction holds(mouseDowns, mouseUps, mouseMoves) {\n  var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n  var deltaSqr = arguments[4];\n\n  return mouseDowns.flatMap(function (downEvent) {\n    var target = downEvent.currentTarget;\n    return _rx2.default.Observable.amb([\n    // Skip if we get a movement before timeout\n    mouseMoves.filter(function (data) {\n      return isMoving(data.delta, deltaSqr);\n    }) // allow for small movement (shaky hands!)\n    .take(1).flatMap(function (x) {\n      return empty();\n    }),\n\n    // Skip if we get a mouseup before main timeout\n    mouseUps.take(1).flatMap(function (x) {\n      return empty();\n    }), just(2).delay(longPressDelay).timeout(longPressDelay, just(downEvent))]);\n    // .timeout(longPressDelay, empty())\n  });\n}\n\n/* function drags(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n  return mouseDowns\n      .flatMap( function(downEvent){\n        let target = downEvent.currentTarget\n        //let origin = target.position()\n        log.info(\"kldf\")\n        return Observable.amb(\n          [\n            // Skip if we get a mouse up before we move\n            mouseUps.take(1).flatMap( x => empty() ),\n\n            mouseMoves.take(1).map(function(x){\n              return{\n                target: target,\n                //origin: target.position(),\n                drags: mouseMoves.takeUntil(mouseUps).map(function(x){\n                  return {\n                    delta: x.delta,\n                    offset: {\n                      x: x.client.x - downEvent.clientX,\n                      y: x.client.y - downEvent.clientY\n                    }\n                  }\n                })\n              }\n            })\n\n          ])\n\n      })\n}\n\n//this one just works by dispatching at the end of the movement\nfunction drags2(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n  return mouseDowns.flatMap(function (md) {\n      var start = { x: md.clientX, y: md.clientY }\n      return mouseMoves.combineLatest(mouseUps, function (mm, mu) {\n        //log.info(\"mm\",mm,\"mu\",mu)\n        var stop = {x: mu.clientX, y: mu.clientY }\n        return {\n          start: start,\n          end: stop\n        }\n      })\n        //.delay(400)\n        .takeUntil(mouseUps)\n    })\n}\n*/\n\n// based on http://jsfiddle.net/mattpodwysocki/pfCqq/\nfunction drags3(mouseDowns$, mouseUps, mouseMoves) {\n  var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n  var deltaSqr = arguments[4];\n\n  return mouseDowns$.flatMap(function (md) {\n    // console.log(\"drags3 mousedown\",md)\n    // calculate offsets when mouse down\n    var startX = md.offsetX;\n    var startY = md.offsetY;\n    // Calculate delta with mousemove until mouseup\n    return mouseMoves.map(function (e) {\n      // console.log(\"drags3 mousemove\",mm)\n      // (mm.preventDefault) ? mm.preventDefault() : mm.returnValue = false\n      var delta = {\n        left: e.clientX - startX,\n        top: e.clientY - startY\n      };\n      // console.log(\"delta\",delta)\n      return (0, _assign2.default)({}, e, delta);\n    }).takeUntil(mouseUps);\n  });\n}\n\nfunction touchDrags(touchStart$, touchEnd$, touchMove$) {\n  return touchStart$.flatMap(function (ts) {\n    var startX = ts.touches[0].pageX;\n    var startY = ts.touches[0].pageY;\n\n    return touchMove$.map(function (e) {\n      var x = (e.touches[0].pageX - startX) / 5.0;\n      var y = (e.touches[0].pageY - startY) / 5.0;\n\n      var delta = {\n        left: x,\n        top: y,\n        x: x,\n        y: y };\n\n      var output = (0, _assign2.default)({}, e, { delta: delta });\n      return output;\n    }).takeUntil(touchEnd$);\n  });\n}\n\n// pinch, taken from https://github.com/hugobessaa/rx-react-pinch\nfunction pinches(touchstarts, touchmoves, touchEnds) {\n  return touchStarts.do(_obsUtils.preventDefault).takeWhile(hasTwoTouchPoints).flatMap(function () {\n    return touchMoves.pluck('scale').takeUntil(touchEnds);\n  });\n}\n\nfunction interactionsFromEvents(targetEl) {\n  var mouseDowns$ = fromEvent(targetEl, 'mousedown');\n  var mouseUps$ = fromEvent(targetEl, 'mouseup');\n  var mouseLeaves$ = fromEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n  var mouseMoves$ = altMouseMoves(fromEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n  var rightClicks$ = fromEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n  var zooms$ = fromEvent(targetEl, 'wheel');\n\n  var touchStart$ = fromEvent('touchstart'); // dom.touchstart(window)\n  var touchMove$ = fromEvent('touchmove'); // dom.touchmove(window)\n  var touchEnd$ = fromEvent('touchend'); // dom.touchend(window)\n\n  return {\n    mouseDowns$: mouseDowns$,\n    mouseUps$: mouseUps$,\n    mouseMoves$: mouseMoves$,\n    rightClicks$: rightClicks$,\n    zooms$: zooms$,\n    touchStart$: touchStart$,\n    touchMoves$: touchMoves$,\n    touchEnd$: touchEnd$ };\n}\n\n/* generate a hash of basic pointer/ mouse event observables*/\nfunction interactionsFromCEvents(targetEl) {\n  var rTarget = arguments.length <= 1 || arguments[1] === undefined ? 'canvas' : arguments[1];\n\n  /* function fromCEvent(targetEl, eventName){\n    return targetEl.get(rTarget, eventName)\n  }*/\n  function fromCEvent(targetEl, eventName) {\n    return targetEl.select(rTarget).events(eventName);\n  }\n\n  var mouseDowns$ = fromCEvent(targetEl, 'mousedown');\n  var mouseUps$ = fromCEvent(targetEl, 'mouseup');\n  var mouseLeaves$ = fromCEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n  var mouseMoves$ = altMouseMoves(fromCEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n  var rightClicks$ = fromCEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n  var zooms$ = fromCEvent(targetEl, 'wheel');\n\n  var touchStart$ = fromCEvent(targetEl, 'touchstart'); // dom.touchstart(window)\n  var touchMoves$ = fromCEvent(targetEl, 'touchmove'); // dom.touchmove(window)\n  var touchEnd$ = fromCEvent(targetEl, 'touchend'); // dom.touchend(window)\n\n  return {\n    mouseDowns$: mouseDowns$,\n    mouseUps$: mouseUps$,\n    mouseMoves$: mouseMoves$,\n    rightClicks$: rightClicks$,\n    zooms$: zooms$,\n    touchStart$: touchStart$,\n    touchMoves$: touchMoves$,\n    touchEnd$: touchEnd$ };\n}\n\nfunction pointerInteractions(baseInteractions) {\n  var multiClickDelay = 250;\n  var longPressDelay = 250;\n\n  var minDelta = 25; // max 50 pixels delta\n  var deltaSqr = minDelta * minDelta;\n\n  var mouseDowns$ = baseInteractions.mouseDowns$;\n  var mouseUps$ = baseInteractions.mouseUps$;\n  var rightclicks$ = baseInteractions.rightclicks$;\n  var mouseMoves$ = baseInteractions.mouseMoves$;\n  var touchStart$ = baseInteractions.touchStart$;\n  var touchMoves$ = baseInteractions.touchMoves$;\n  var touchEnd$ = baseInteractions.touchEnd$;\n  var zooms$ = baseInteractions.zooms$;\n\n  // mouseMoves$.forEach(e=>console.log(\"mousemove\",e))\n\n  // /// now setup the more complex interactions\n\n  var taps$ = taps(merge(mouseDowns$, touchStart$), // mouse & touch interactions starts\n  merge(mouseUps$, touchEnd$), // mouse & touch interactions ends\n  mouseMoves$, longPressDelay, deltaSqr).share();\n\n  var shortTaps$ = taps$.filter(function (e) {\n    return e.interval <= longPressDelay;\n  }).map(function (e) {\n    return e.value;\n  }).filter(function (event) {\n    return 'button' in event && event.button === 0;\n  }) // FIXME : bad filter !\n  .buffer(function () {\n    return taps$.debounce(multiClickDelay);\n  }).map(function (list) {\n    return { list: list, nb: list.length };\n  }).share();\n\n  // normalize zooms (should this be elsewhere ?)\n  zooms$ = zooms$.map(_utils.normalizeWheel);\n\n  // we get our custom right clicks\n  var rightClicks2 = taps$.filter(function (event) {\n    return 'button' in event && event.button === 2;\n  });\n  var holds$ = holds(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr);\n\n  var shortSingleTaps$ = shortTaps$.filter(function (x) {\n    return x.nb === 1;\n  }).flatMap(function (e) {\n    return e.list;\n  });\n  var shortDoubleTaps$ = shortTaps$.filter(function (x) {\n    return x.nb === 2;\n  }).flatMap(function (e) {\n    return e.list;\n  }).take(1).repeat();\n\n  // static , long held taps, for context menus etc\n  // longTaps: either HELD leftmouse/pointer or HELD right click //FIXME : needs to be \"UNTIL\" mouseUp\n  // and not fire before mouseUp\n  var longTaps$ = taps$.filter(function (e) {\n    return e.interval > longPressDelay;\n  }).map(function (e) {\n    return e.value;\n  }); // holds$.take(1).repeat()//.timeout(longPressDelay, empty())\n  // .tap(e=>console.log(\"taps with LONG timeInterval\",e))\n\n  // drag move interactions (continuously firing)\n  var dragMoves$ = merge(drags3(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr), touchDrags(touchStart$, touchEnd$, touchMoves$)).takeUntil(longTaps$).repeat(); // no drag moves if there is a context action already taking place\n\n  return {\n    taps: taps$.map(function (e) {\n      return e.value;\n    }),\n    shortSingleTaps$: shortSingleTaps$,\n    shortDoubleTaps$: shortDoubleTaps$,\n    longTaps$: longTaps$,\n    dragMoves$: dragMoves$,\n    zooms$: zooms$ };\n}\n\n// /////\nfunction preventScroll(targetEl) {\n  fromEvent(targetEl, 'mousewheel').forEach(_obsUtils.preventDefault);\n  fromEvent(targetEl, 'DOMMouseScroll').forEach(_obsUtils.preventDefault);\n  fromEvent(targetEl, 'wheel').forEach(_obsUtils.preventDefault);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/pointers.js\n ** module id = 74\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/pointers.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.windowResizes = windowResizes;\nexports.elementResizes = elementResizes;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar fromEvent = Observable.fromEvent;\n__webpack_require__(281);\n\n// window resize event stream, throttled by throttle amount (250ms default)\nfunction windowResizes() {\n  var throttle = arguments.length <= 0 || arguments[0] === undefined ? 250 : arguments[0];\n\n  // only get the fields we need\n  function extractSize(x) {\n    x = x.target;\n    var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n    if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n    var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n    return res;\n  }\n\n  var throttledWinResize = fromEvent(window, 'resize').throttle(throttle /* ms */).map(extractSize).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n  return throttledWinResize;\n}\n\nfunction elementResizes(element) {\n  var throttle = arguments.length <= 1 || arguments[1] === undefined ? 250 : arguments[1];\n\n  function extractSize(x) {\n    x = x.target;\n    var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n    if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n    var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n    return res;\n  }\n\n  return _rx2.default.DOM.resize(element).throttle(throttle /* ms */).map(extractSize);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/sizing.js\n ** module id = 75\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/sizing.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.extractChanges = extractChanges;\nexports.extractChangesBetweenArrays = extractChangesBetweenArrays;\nexports.changesFromObservableArrays = changesFromObservableArrays;\nexports.changesFromObservableArrays2 = changesFromObservableArrays2;\nexports.transformEquals = transformEquals;\nexports.colorsEqual = colorsEqual;\nexports.entityVisualComparer = entityVisualComparer;\n\nvar _utils = __webpack_require__(3);\n\nfunction compareHash(obj) {\n  if (obj.uuid) return obj.uuid;\n  // return JSON.stringify(obj)\n  // return typeof(obj)+obj.name\n}\n\nvar jsondiffpatch = __webpack_require__(18).create({ objectHash: compareHash });\n\nfunction extractChanges(prev, cur) {\n  var delta = jsondiffpatch.diff(prev, cur);\n  // console.log("delta",delta)\n  var result = { added: [], removed: [], changed: [] };\n\n  if (delta && \'_t\' in delta) {\n    (function () {\n      var removed = []; // delta["_0"][0]//delta[0][0]\n      var added = []; // delta[0][0]//delta[0][1]\n\n      Object.keys(delta).map(function (key) {\n        // console.log("AAA",key)\n        // "_t": "a",	Array delta (member names indicate array indices)\n\n        if (key[0] === \'_\') {\n          if (key !== \'_a\' && key !== \'_t\') {\n            removed.push(delta[key][0]);\n          }\n        } else {\n          added.push(delta[key][0]);\n        }\n      });\n\n      result.added = (0, _utils.toArray)(added).filter(function (i) {\n        return i !== undefined;\n      });\n      result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n        return i !== undefined;\n      });\n\n      // console.log("added",result.added)\n      // console.log("removed",result.removed)\n    })();\n  } else if (prev === undefined) {\n    // not handled right in the above case for some reason ??\n    result.added = cur;\n  }\n\n  return result;\n}\n\nvar instance = __webpack_require__(18).create({\n  objectHash: function objectHash(obj, index) {\n    if (typeof obj._id !== \'undefined\') {\n      return obj._id;\n    }\n    if (typeof obj.id !== \'undefined\') {\n      return obj.id;\n    }\n    if (typeof obj.name !== \'undefined\') {\n      return obj.name;\n    }\n    return \'$$index:\' + index;\n  }\n});\n// to ignore functions\ninstance.processor.pipes.diff.before(\'trivial\', function ignoreFunctionDiffFilter(context) {\n  if (typeof context.left === \'function\' || typeof context.right === \'function\') {\n    context.setResult(undefined);\n    context.exit();\n  }\n});\n\nfunction extractChangesBetweenArrays(prev, cur) {\n  var delta = instance.diff(prev, cur);\n  // console.log("delta",delta)\n  // console.log("diff",delta)//JSON.stringify(delta, null, 2))\n\n  var result = { added: [], removed: [], changed: [], upserted: [] };\n\n  if (delta && \'_t\' in delta) {\n    (function () {\n      var removed = []; // delta["_0"][0]//delta[0][0]\n      var added = []; // delta[0][0]//delta[0][1]\n      var upserted = [];\n\n      if (delta[\'_t\'] === \'a\') {\n        // array diff\n        // "_t": "a",	Array delta (member names indicate array indices)\n        Object.keys(delta).map(function (key) {\n          if (key !== \'_t\') {\n            if (key.length > 0 && key.indexOf(\'_\') > -1) {\n              var realKey = parseInt(key.replace(\'_\', \'\'), 10);\n              // console.log("removed",delta, realKey)//,key,delta)\n              removed.push(prev[realKey]);\n            } else {\n              // added or changed\n              // console.log("added or changed",delta, key)\n              var _realKey = parseInt(key, 10);\n              upserted.push(cur[_realKey]);\n            }\n          }\n        });\n      }\n      result.added = (0, _utils.toArray)(added).filter(function (i) {\n        return i !== undefined;\n      });\n      result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n        return i !== undefined;\n      });\n      result.upserted = (0, _utils.toArray)(upserted).filter(function (i) {\n        return i !== undefined;\n      });\n      // console.log("added",result.added)\n      // console.log("removed",result.removed)\n    })();\n  } else if (prev === undefined) {\n    // not handled right in the above case for some reason ??\n    result.upserted = cur;\n  }\n\n  return result;\n}\n\nfunction changesFromObservableArrays(data$) {\n  return data$.scan(function (acc, cur) {\n    return { cur: cur, prev: acc.cur };\n  }, { prev: undefined, cur: undefined }).map(function (typeData) {\n    var cur = typeData.cur;\n    var prev = typeData.prev;\n\n    var changes = extractChangesBetweenArrays(prev, cur);\n    return changes;\n  }).share();\n}\n\nfunction changesFromObservableArrays2(data$) {\n  return data$.scan(function (acc, x) {\n    var cur = x;\n    var prev = acc.cur;\n\n    cur = Object.keys(cur).map(function (key) {\n      return cur[key];\n    });\n    return { cur: cur, prev: prev };\n  }, { prev: undefined, cur: undefined }).map(function (typeData) {\n    var cur = typeData.cur;\n    var prev = typeData.prev;\n    // console.log("diffing",cur,prev)\n\n    var changes = extractChanges(prev, cur);\n    return changes;\n  }).share();\n}\n\nfunction transformEquals(a, b) {\n  if (!a || !b) return true;\n  for (var j = 0; j < a.length; j++) {\n    if (a[j] !== b[j]) {\n      return false;\n    }\n  }\n  return true;\n}\n\nfunction colorsEqual(a, b) {\n  if (!a || !b) return true;\n  return a === b;\n}\n\nfunction entityVisualComparer(prev, cur) {\n  // console.log("prev",prev,"cur",cur)\n\n  if (!cur) {\n    return false;\n  }\n\n  // compare lengths - can save a lot of time\n  if (cur.length !== prev.length) {\n    return false;\n  }\n\n  var sortedCur = cur.sort();\n  var sortedPrev = prev.sort();\n  for (var i = 0; i < cur.length; i++) {\n    if (sortedCur[i].typeUid !== sortedPrev[i].typeUid) {\n      return false;\n    }\n\n    if (sortedCur[i].id !== sortedPrev[i].id) {\n      return false;\n    }\n\n    var curVal = sortedCur[i];\n    var preVal = sortedPrev[i];\n\n    /*\n      sortedCur[i].color === sortedPrev[i].color\n      )*/\n\n    var posEq = transformEquals(curVal.pos, preVal.pos);\n    var rotEq = transformEquals(curVal.rot, preVal.rot);\n    var scaEq = transformEquals(curVal.sca, preVal.sca);\n    var colEq = colorsEqual(curVal.color, preVal.color);\n    var allEqual = posEq && rotEq && scaEq && colEq;\n    if (!allEqual) return false;\n  }\n\n  return true;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/diffPatchUtils.js\n ** module id = 76\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/diffPatchUtils.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _loglevel = __webpack_require__(276);\n\nvar _loglevel2 = _interopRequireDefault(_loglevel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// polygill for array.includes\nif (![].includes) {\n  Array.prototype.includes = function (searchElement /*, fromIndex*/) {\n    'use strict';\n\n    var O = Object(this);\n    var len = parseInt(O.length) || 0;\n    if (len === 0) {\n      return false;\n    }\n    var n = parseInt(arguments[1]) || 0;\n    var k;\n    if (n >= 0) {\n      k = n;\n    } else {\n      k = len + n;\n      if (k < 0) {\n        k = 0;\n      }\n    }\n    var currentElement;\n    while (k < len) {\n      currentElement = O[k];\n      if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {\n        return true;\n      }\n      k++;\n    }\n    return false;\n  };\n}\n\n// ////////////\nvar logMaker = function logMaker() {\n  var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n  var strLevel = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n  var timeStamp = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n  var log = {};\n  var loglevel = 'warn';\n  log.setLevel = function (level) {\n    loglevel = level;\n  };\n\n  log.trace = function () {\n    var context = prefix;\n    if (strLevel) context += 'TRACE:';\n    if (timeStamp) {\n      var tStamp = new Date().toTimeString().slice(0, 8);\n      context += tStamp;\n    }\n    if (!['trace'].includes(loglevel)) return new Function();\n    return Function.prototype.bind.call(console.trace, console, context);\n  }();\n  log.debug = function () {\n    var context = prefix;\n    if (strLevel) context += 'DEBUG:';\n    if (timeStamp) {\n      var tStamp = new Date().toTimeString().slice(0, 8);\n      context += tStamp;\n    }\n    if (!['trace', 'debug'].includes(loglevel)) return new Function();\n    return Function.prototype.bind.call(console.debug, console, context);\n  }();\n\n  log.info = function () {\n    var context = prefix;\n    if (strLevel) context += 'INFO:';\n    if (timeStamp) {\n      var tStamp = new Date().toTimeString().slice(0, 8);\n      context += tStamp;\n    }\n    if (!['trace', 'debug', 'info'].includes(loglevel)) new Function();\n    return Function.prototype.bind.call(console.info, console, context);\n  }();\n\n  log.warn = function () {\n    var context = prefix;\n    if (strLevel) context += 'WARN:';\n    if (timeStamp) {\n      var tStamp = new Date().toTimeString().slice(0, 8);\n      context += tStamp;\n    }\n    if (!['trace', 'debug', 'info', 'warn'].includes(loglevel)) new Function();\n    return Function.prototype.bind.call(console.warn, console, context);\n  }();\n  log.error = function () {\n    var context = prefix;\n    if (strLevel) context += 'ERROR:';\n    if (timeStamp) {\n      var tStamp = new Date().toTimeString().slice(0, 8);\n      context += tStamp;\n    }\n    if (!['trace', 'debug', 'info', 'warn', 'error'].includes(loglevel)) new Function();\n    return Function.prototype.bind.call(console.error, console, context);\n  }();\n\n  return log;\n};\n\n// import log from 'loglevel'\n\n/*function makeLog(prefix=\"\"){\n  var originalFactory = _log.methodFactory\n  _log.methodFactory = function (methodName, logLevel) {\n      var rawMethod = originalFactory(methodName, logLevel)\n      let tStamp    = new Date().toTimeString().slice(0, 8)\n      //tStamp = tStamp.getHours() +\":\"+tStamp.getMinutes()+\":\"+tStamp.getSeconds()+\" \"+tStamp.getMilliseconds()\n      return function (message) {\n          rawMethod(prefix+ tStamp +\" \"+ message)\n      }\n  }\n  return _log\n}*/\n\n/*var originalFactory = log.methodFactory\nlog.methodFactory = function (methodName, logLevel) {\n    var rawMethod = originalFactory(methodName, logLevel)\n\n    return function (message) {\n        rawMethod(\"Newsflash: \" + message)\n    }\n}\nlog.setLevel(\"warn\") // Be sure to call setLevel method in order to apply plugin */\n\n/* log.setLevel(\"info\")\n  let foo = {sdf:\"dsf\",aa:45}\n  log.error(\"too easy\")\n  log.error(\"..or is it\",\"blal\",foo)\n  log.info(\"..or is it\",\"blal\",foo)\n\n  let msg =\" sdfqsdq\"\n  log.trace(msg)\n  log.debug(msg)\n  log.info(msg)\n  log.warn(msg)\n  log.error(msg)\n\n  log.info(\"assetManager\",AssetManager)\n\n  log.info(\"This is a test...\");*/\n\n// for now return loglevel\n\nvar logMaker2 = function logMaker2() {\n  var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n  return _loglevel2.default;\n};\n// import logger from './utils/log'\n// let log = logger(\"Jam-Root\")\n// log.setLevel(\"warn\")\nexports.default = logMaker2;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/log.js\n ** module id = 77\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/log.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n//TODO: make this into a mesh / geometry subclass\n*/\n\nvar CircleHelper = (function (_BaseHelper) {\n  _inherits(CircleHelper, _BaseHelper);\n\n  function CircleHelper(options) {\n    _classCallCheck(this, CircleHelper);\n\n    var defaultMaterial = new _GizmoMaterial.GizmoLineMaterial({\n      color: "#000",\n      depthTest: false,\n      depthWrite: false,\n      renderDepth: 1e20,\n      highlightColor: "#F00"\n    });\n\n    var DEFAULTS = {\n      radius: 0,\n      direction: new _three2.default.Vector3(),\n\n      color: "#000",\n      highlightColor: "#F00",\n\n      material: defaultMaterial\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CircleHelper).call(this, options));\n\n    Object.assign(_this, options);\n\n    _this.setRadius(_this.radius);\n    return _this;\n  }\n\n  _createClass(CircleHelper, [{\n    key: "setRadius",\n    value: function setRadius(radius) {\n      var circleRadius = this.radius = radius;\n      var circleShape = new _three2.default.Shape();\n      circleShape.moveTo(0, 0);\n      circleShape.absarc(0, 0, circleRadius, 0, Math.PI * 2, false);\n      circleShape.moveTo(0, 0);\n      var points = circleShape.createSpacedPointsGeometry(100);\n\n      if (this.rCircle) this.remove(this.rCircle);\n\n      this.rCircle = new _three2.default.Line(points, this.material);\n      this.add(this.rCircle);\n    }\n  }]);\n\n  return CircleHelper;\n})(_BaseHelper3.default);\n\nexports.default = CircleHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/CircleHelper.js\n ** module id = 78\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/CircleHelper.js?');
},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.getTargetBoundsData = getTargetBoundsData;\nexports.computeCenterDiaNormalFromThreePoints = computeCenterDiaNormalFromThreePoints;\nexports.getEntryExitThickness = getEntryExitThickness;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getTargetBoundsData(targetObject, point) {\n  console.log("computing bounds");\n  /* -1 /+1 directions on all 3 axis to determine for example WHERE an annotation\n  should be placed (left/right, front/back, top/bottom)\n  */\n  var putSide = [0, 0, 0];\n  if (!targetObject) return putSide;\n  var bbox = targetObject.boundingBox;\n\n  var objectCenter = new _three2.default.Vector3().addVectors(targetObject.boundingBox.min, targetObject.boundingBox.max).divideScalar(2);\n\n  //let realCenter = point.clone().sub( objectCenter )\n  //console.log("objectCenter",objectCenter,"point", point,foo.normalize())\n\n  var axes = ["x", "y", "z"];\n  axes.forEach(function (axis, index) {\n    var axisOffset = point[axis] - objectCenter[axis];\n    axisOffset = Math.round(axisOffset * 100) / 100;\n    if (axisOffset > 0) {\n      putSide[index] = 1;\n    } else if (axisOffset < 0) {\n      putSide[index] = -1;\n    }\n  });\n\n  console.log("putSide", putSide);\n  putSide = new _three2.default.Vector3().fromArray(putSide);\n  return putSide;\n}\n\n//compute center , dia/radius from three 3d points\nfunction computeCenterDiaNormalFromThreePoints(pointA, pointB, pointC) {\n\n  var plane = new _three2.default.Plane().setFromCoplanarPoints(pointA, pointB, pointC);\n  var center = new _three2.default.Vector3();\n\n  //see http://en.wikipedia.org/wiki/Circumscribed_circle\n  // triangle "edges"\n  var t = pointA.clone().sub(pointB);\n  var u = pointB.clone().sub(pointC);\n  var v = pointC.clone().sub(pointA);\n  var m = pointA.clone().sub(pointC);\n  var x = pointB.clone().sub(pointA);\n  var z = pointC.clone().sub(pointB);\n\n  var foo = t.clone().cross(u).length();\n  var bar = 2 * foo;\n  var baz = foo * foo;\n  var buu = 2 * baz;\n\n  var radius = t.length() * u.length() * v.length() / bar;\n\n  var alpha = u.lengthSq() * t.clone().dot(m) / buu;\n  var beta = m.lengthSq() * x.clone().dot(u) / buu;\n  var gamma = t.lengthSq() * v.clone().dot(z) / buu;\n\n  center = pointA.clone().multiplyScalar(alpha).add(pointB.clone().multiplyScalar(beta)).add(pointC.clone().multiplyScalar(gamma));\n\n  var diameter = radius * 2;\n  var normal = plane.normal;\n\n  return { center: center, diameter: diameter, normal: normal };\n}\n\nfunction getEntryExitThickness(entryInteresect) {\n  var normalType = arguments.length <= 1 || arguments[1] === undefined ? "face" : arguments[1];\n\n  var normal = entryInteresect.face.normal.clone();\n  switch (normalType) {\n    case "face":\n      break;\n    case "x":\n      normal = new _three2.default.Vector3(1, 0, 0);\n      break;\n    case "y":\n      normal = new _three2.default.Vector3(0, 1, 0);\n      break;\n    case "z":\n      normal = new _three2.default.Vector3(0, 0, 1);\n      break;\n  }\n\n  var object = entryInteresect.object;\n  if (!object) return undefined;\n\n  var entryPoint = entryInteresect.point.clone();\n  var flippedNormal = normal.clone().negate();\n  var offsetPoint = entryPoint.clone().add(flippedNormal.clone().multiplyScalar(10000));\n\n  //get escape entryPoint\n  var raycaster = new _three2.default.Raycaster(offsetPoint, normal.clone().normalize());\n  var intersects = raycaster.intersectObjects([object], true);\n\n  var exitPoint = null;\n  var minDist = Infinity;\n\n  intersects.map(function (entry) {\n    var curPt = entry.point;\n    var curLn = curPt.clone().sub(entryPoint).length();\n\n    if (curLn < minDist) {\n      exitPoint = curPt;\n      minDist = curLn;\n    }\n  });\n\n  //FIXME: todo or not ??\n  object.worldToLocal(entryPoint);\n  object.worldToLocal(exitPoint);\n\n  //compute actual thickness\n  var endToStart = exitPoint.clone().sub(entryPoint);\n  var thickness = endToStart.length();\n\n  return { object: object, entryPoint: entryPoint, exitPoint: exitPoint, thickness: thickness };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/utils.js\n ** module id = 79\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/utils.js?')},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _CrossHelper = __webpack_require__(17);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _ArrowHelper = __webpack_require__(253);\n\nvar _ArrowHelper2 = _interopRequireDefault(_ArrowHelper);\n\nvar _LabelHelper = __webpack_require__(39);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n  Visual helper representing leader lines\n*/\n\nvar LeaderLineHelper = (function (_BaseHelper) {\n  _inherits(LeaderLineHelper, _BaseHelper);\n\n  function LeaderLineHelper(options) {\n    _classCallCheck(this, LeaderLineHelper);\n\n    var DEFAULTS = {\n      distance: 30,\n      color: "#000",\n      text: "",\n      fontFace: "Jura"\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LeaderLineHelper).call(this, options));\n\n    Object.assign(_this, options);\n\n    _this.arrowColor = options.arrowColor !== undefined ? options.arrowColor : 0x000000;\n    _this.arrowHeadSize = options.arrowHeadSize !== undefined ? options.arrowHeadSize : 2.0;\n    _this.arrowHeadWidth = options.arrowHeadWidth !== undefined ? options.arrowHeadWidth : 0.8;\n    _this.arrowHeadType = options.arrowHeadType !== undefined ? options.arrowHeadType : undefined;\n\n    _this.linesColor = options.linesColor !== undefined ? options.linesColor : 0x000000;\n    _this.lineWidth = options.lineWidth !== undefined ? options.lineWidth : 1;\n\n    _this.fontSize = options.fontSize !== undefined ? options.fontSize : 8;\n    _this.textColor = options.textColor !== undefined ? options.textColor : "#000";\n    _this.textBgColor = options.textBgColor !== undefined ? options.textBgColor : "#fff";\n    _this.labelType = options.labelType !== undefined ? options.labelType : "frontFacing";\n\n    _this.angle = options.angle !== undefined ? options.angle : 45;\n    _this.angleLength = options.angleLength !== undefined ? options.angleLength : 5;\n    _this.horizLength = options.horizLength !== undefined ? options.horizLength : 5;\n    _this.radius = options.radius !== undefined ? options.radius : 0;\n\n    _this.highlightColor = options.highlightColor !== undefined ? options.highlightColor : "#F00";\n\n    var angle = _this.angle;\n    var radius = _this.radius;\n    var angleLength = _this.angleLength;\n    var horizLength = _this.horizLength;\n\n    var textBorder = options.textBorder || null;\n    var material = new _GizmoMaterial.GizmoLineMaterial({\n      color: _this.linesColor,\n      lineWidth: _this.lineWidth,\n      linecap: "miter",\n      highlightColor: _this.highlightColor\n    });\n    //depthTest:false,depthWrite:false})\n\n    var rAngle = angle;\n    rAngle = rAngle * Math.PI / 180;\n    var y = Math.cos(rAngle) * angleLength;\n    var x = Math.sin(rAngle) * angleLength;\n    var angleEndPoint = new _three2.default.Vector3(x, y, 0);\n    angleEndPoint = angleEndPoint.add(angleEndPoint.clone().normalize().multiplyScalar(radius));\n    var angleArrowDir = angleEndPoint.clone().normalize();\n    angleEndPoint.x = -angleEndPoint.x;\n    angleEndPoint.y = -angleEndPoint.y;\n\n    _this.angleArrow = new _ArrowHelper2.default(angleArrowDir, angleEndPoint, angleLength, _this.color, _this.arrowHeadSize, _this.arrowHeadWidth, _this.arrowHeadType);\n    _this.angleArrow.scale.z = 0.6;\n\n    var horizEndPoint = angleEndPoint.clone();\n    horizEndPoint.x -= horizLength;\n\n    var horizGeom = new _three2.default.Geometry();\n    horizGeom.vertices.push(angleEndPoint);\n    horizGeom.vertices.push(horizEndPoint);\n\n    _this.horizLine = new _three2.default.Line(horizGeom, material);\n\n    //draw dimention / text\n    switch (_this.labelType) {\n      case "flat":\n        _this.label = new _LabelHelper.LabelHelperPlane({\n          text: _this.text,\n          fontSize: _this.fontSize,\n          fontFace: _this.fontFace,\n          background: _this.textBgColor != null,\n          color: _this.textColor,\n          bgColor: _this.textBgColor,\n          highlightColor: _this.highlightColor\n        });\n        break;\n      case "frontFacing":\n        _this.label = new _LabelHelper.LabelHelper3d({\n          text: _this.text,\n          fontSize: _this.fontSize,\n          fontFace: _this.fontFace,\n          color: _this.textColor,\n          bgColor: _this.textBgColor });\n        break;\n    }\n    _this.label.rotation.z = Math.PI;\n    var labelSize = _this.label.textWidth / 2 + 1; //label size, plus some extra\n    var labelPosition = horizEndPoint.clone().sub(new _three2.default.Vector3(labelSize, 0, 0));\n    _this.label.position.add(labelPosition);\n\n    /*\n    let precisionLabelPos = new THREE.Vector3().copy( labelPosition )\n    precisionLabelPos.x += this.label.width\n    \n    //TODO: this is both needed in the data structures & in the visuals (here)\n    this.precision = 0.12\n    this.precisionText = "+"+this.precision+"\\n"+"-"+this.precision\n    this.precisionLabel = new LabelHelperPlane({text:this.precisionText,fontSize:this.fontSize/1.5,background:(this.textBgColor!=null),color:this.textColor,bgColor:this.textBgColor})\n    this.add( this.precisionLabel )\n    \n    this.precisionLabel.rotation.z = Math.PI\n    this.precisionLabel.position.copy( precisionLabelPos )*/\n\n    /*let crossHelper = new CrossHelper({\n        size:3\n    })\n    this.add( crossHelper )*/\n\n    if (textBorder) {\n      if (textBorder === "circle") {\n        var textBorderGeom = new _three2.default.CircleGeometry(labelSize, 32);\n        textBorderGeom.vertices.shift();\n        var textBorderOutline = new _three2.default.Line(textBorderGeom, material);\n        textBorderOutline.position.add(labelPosition);\n        _this.add(textBorderOutline);\n      }\n      if (textBorder === "rectangle") {\n        var rectWidth = _this.label.textHeight;\n        var rectLength = _this.label.textWidth;\n\n        //console.log("textWidth",this.label.textWidth, this.label.width,"textHeight",this.label.textHeight, this.label.height)\n\n        var rectShape = new _three2.default.Shape();\n        rectShape.moveTo(0, 0);\n        rectShape.lineTo(0, rectWidth);\n        rectShape.lineTo(rectLength, rectWidth);\n        rectShape.lineTo(rectLength, 0);\n        rectShape.lineTo(0, 0);\n        rectShape.lineTo(0, 0);\n\n        var textBorderGeom = new _three2.default.ShapeGeometry(rectShape);\n        var textBorderOutline = new _three2.default.Line(textBorderGeom, material);\n        textBorderOutline.position.add(labelPosition);\n        textBorderOutline.position.add(new _three2.default.Vector3(-rectLength / 2, -rectWidth / 2, 0));\n        _this.add(textBorderOutline);\n      }\n    }\n\n    _this.add(_this.angleArrow);\n    _this.add(_this.horizLine);\n    _this.add(_this.label);\n\n    //material settings\n    _this.arrowLineMaterial = new _GizmoMaterial.GizmoLineMaterial({\n      color: _this.arrowColor,\n      lineWidth: _this.lineWidth,\n      linecap: "miter",\n      highlightColor: _this.highlightColor });\n    _this.arrowConeMaterial = new _GizmoMaterial.GizmoMaterial({\n      color: _this.arrowColor,\n      highlightColor: _this.highlightColor\n    });\n\n    _this.angleArrow.line.material = _this.arrowLineMaterial;\n    _this.angleArrow.head.material = _this.arrowConeMaterial;\n    _this.angleArrow.line.material.depthTest = _this.angleArrow.line.material.depthTest = true;\n    _this.angleArrow.line.material.depthWrite = _this.angleArrow.line.material.depthWrite = true;\n\n    //this.angleArrow.renderDepth = 1e20\n    _this.horizLine.renderDepth = 1e20;\n    return _this;\n  }\n\n  return LeaderLineHelper;\n})(_BaseHelper3.default);\n\nmodule.exports = LeaderLineHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/dimensions/LeaderLineHelper.js\n ** module id = 80\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/dimensions/LeaderLineHelper.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*TODO:\n - refactor\n - use label helper\n*/\n\nvar LabeledGrid = (function (_THREE$Object3D) {\n  _inherits(LabeledGrid, _THREE$Object3D);\n\n  function LabeledGrid() {\n    var width = arguments.length <= 0 || arguments[0] === undefined ? 200 : arguments[0];\n    var length = arguments.length <= 1 || arguments[1] === undefined ? 200 : arguments[1];\n    var step = arguments.length <= 2 || arguments[2] === undefined ? 100 : arguments[2];\n    var upVector = arguments.length <= 3 || arguments[3] === undefined ? [0, 1, 0] : arguments[3];\n    var color = arguments.length <= 4 || arguments[4] === undefined ? 0x00baff : arguments[4];\n    var opacity = arguments.length <= 5 || arguments[5] === undefined ? 0.2 : arguments[5];\n    var text = arguments.length <= 6 || arguments[6] === undefined ? true : arguments[6];\n    var textColor = arguments.length <= 7 || arguments[7] === undefined ? "#000000" : arguments[7];\n    var textLocation = arguments.length <= 8 || arguments[8] === undefined ? "center" : arguments[8];\n\n    _classCallCheck(this, LabeledGrid);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LabeledGrid).call(this));\n\n    _this.width = width;\n    _this.length = length;\n    _this.step = step;\n    _this.color = color;\n    _this.opacity = opacity;\n    _this.text = text;\n    _this.textColor = textColor;\n    _this.textLocation = textLocation;\n    _this.upVector = new _three2.default.Vector3().fromArray(upVector);\n\n    _this.name = "grid";\n\n    //TODO: clean this up\n    _this.marginSize = 10;\n    _this.stepSubDivisions = 10;\n\n    _this._drawGrid();\n\n    //default grid orientation is z up, rotate if not the case\n    var upVector = _this.upVector;\n    _this.up = upVector;\n    _this.lookAt(upVector);\n    return _this;\n  }\n\n  _createClass(LabeledGrid, [{\n    key: "_drawGrid",\n    value: function _drawGrid() {\n      var gridGeometry, gridMaterial, mainGridZ, planeFragmentShader, planeGeometry, planeMaterial, subGridGeometry, subGridMaterial, subGridZ;\n\n      //offset to avoid z fighting\n      mainGridZ = -0.05;\n      gridGeometry = new _three2.default.Geometry();\n      gridMaterial = new _three2.default.LineBasicMaterial({\n        color: new _three2.default.Color().setHex(this.color),\n        opacity: this.opacity,\n        linewidth: 2,\n        transparent: true\n      });\n\n      subGridZ = -0.05;\n      subGridGeometry = new _three2.default.Geometry();\n      subGridMaterial = new _three2.default.LineBasicMaterial({\n        color: new _three2.default.Color().setHex(this.color),\n        opacity: this.opacity / 2,\n        transparent: true\n      });\n\n      var step = this.step;\n      var stepSubDivisions = this.stepSubDivisions;\n      var width = this.width;\n      var length = this.length;\n\n      var centerBased = true;\n\n      if (centerBased) {\n        for (var i = 0; i <= width / 2; i += step / stepSubDivisions) {\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, subGridZ));\n\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -i, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, -i, subGridZ));\n\n          if (i % step == 0) {\n            gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, mainGridZ));\n\n            gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -i, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, -i, mainGridZ));\n          }\n        }\n        for (var i = 0; i <= length / 2; i += step / stepSubDivisions) {\n          subGridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, subGridZ));\n\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-i, -width / 2, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-i, width / 2, subGridZ));\n\n          if (i % step == 0) {\n            gridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, mainGridZ));\n\n            gridGeometry.vertices.push(new _three2.default.Vector3(-i, -width / 2, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(-i, width / 2, mainGridZ));\n          }\n        }\n      } else {\n        for (var i = -width / 2; i <= width / 2; i += step / stepSubDivisions) {\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, subGridZ));\n\n          if (i % step == 0) {\n            gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, mainGridZ));\n          }\n        }\n        for (var i = -length / 2; i <= length / 2; i += step / stepSubDivisions) {\n          subGridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, subGridZ));\n\n          if (i % step == 0) {\n            gridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, mainGridZ));\n          }\n        }\n      }\n\n      this.mainGrid = new _three2.default.Line(gridGeometry, gridMaterial, _three2.default.LinePieces);\n      //create sub grid geometry object\n      this.subGrid = new _three2.default.Line(subGridGeometry, subGridMaterial, _three2.default.LinePieces);\n\n      //create margin\n      var offsetWidth = width + this.marginSize;\n      var offsetLength = length + this.marginSize;\n\n      var marginGeometry = new _three2.default.Geometry();\n      marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -width / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, -width / 2, subGridZ));\n\n      marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, -width / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, width / 2, subGridZ));\n\n      marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, width / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, width / 2, subGridZ));\n\n      marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, width / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -width / 2, subGridZ));\n\n      marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, -offsetWidth / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, -offsetWidth / 2, subGridZ));\n\n      marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, -offsetWidth / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, offsetWidth / 2, subGridZ));\n\n      marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, offsetWidth / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, offsetWidth / 2, subGridZ));\n\n      marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, offsetWidth / 2, subGridZ));\n      marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, -offsetWidth / 2, subGridZ));\n\n      var strongGridMaterial = new _three2.default.LineBasicMaterial({\n        color: new _three2.default.Color().setHex(this.color),\n        opacity: this.opacity * 2,\n        linewidth: 2,\n        transparent: true\n      });\n      this.margin = new _three2.default.Line(marginGeometry, strongGridMaterial, _three2.default.LinePieces);\n\n      //add all grids, subgrids, margins etc\n      this.add(this.mainGrid);\n      this.add(this.subGrid);\n      this.add(this.margin);\n\n      this._drawNumbering();\n    }\n  }, {\n    key: "toggle",\n    value: function toggle(_toggle) {\n      //apply visibility settings to all children\n      this.traverse(function (child) {\n        child.visible = _toggle;\n      });\n    }\n  }, {\n    key: "setOpacity",\n    value: function setOpacity(opacity) {\n      this.opacity = opacity;\n      this.mainGrid.material.opacity = opacity;\n      this.subGrid.material.opacity = opacity / 2;\n      this.margin.material.opacity = opacity * 2;\n    }\n  }, {\n    key: "setColor",\n    value: function setColor(color) {\n      this.color = color;\n      this.mainGrid.material.color = new _three2.default.Color().setHex(this.color);\n      this.subGrid.material.color = new _three2.default.Color().setHex(this.color);\n      this.margin.material.color = new _three2.default.Color().setHex(this.color);\n    }\n  }, {\n    key: "toggleText",\n    value: function toggleText(toggle) {\n      this.text = toggle;\n      var labels = this.labels.children;\n      for (var i = 0; i < this.labels.children.length; i++) {\n        var label = labels[i];\n        label.visible = toggle;\n      }\n    }\n  }, {\n    key: "setTextColor",\n    value: function setTextColor(color) {\n      this.textColor = color;\n      this._drawNumbering();\n    }\n  }, {\n    key: "setTextLocation",\n    value: function setTextLocation(location) {\n      this.textLocation = location;\n      return this._drawNumbering();\n    }\n  }, {\n    key: "setUp",\n    value: function setUp(upVector) {\n      this.upVector = upVector;\n      this.up = upVector;\n      this.lookAt(upVector);\n    }\n  }, {\n    key: "resize",\n    value: function resize(width, length) {\n      if (width && length) {\n        var width = Math.max(width, 10);\n        this.width = width;\n\n        var length = Math.max(length, 10);\n        this.length = length;\n\n        this.step = Math.max(this.step, 5);\n\n        this.remove(this.mainGrid);\n        this.remove(this.subGrid);\n        this.remove(this.margin);\n        //this.remove(this.plane);\n        return this._drawGrid();\n      }\n    }\n  }, {\n    key: "_drawNumbering",\n    value: function _drawNumbering() {\n      var label, sizeLabel, sizeLabel2, xLabelsLeft, xLabelsRight, yLabelsBack, yLabelsFront;\n      var step = this.step;\n\n      this._labelStore = {};\n\n      if (this.labels != null) {\n        this.mainGrid.remove(this.labels);\n      }\n      this.labels = new _three2.default.Object3D();\n\n      var width = this.width;\n      var length = this.length;\n      var numbering = this.numbering = "centerBased";\n\n      var labelsFront = new _three2.default.Object3D();\n      var labelsSideRight = new _three2.default.Object3D();\n\n      if (numbering == "centerBased") {\n        for (var i = 0; i <= width / 2; i += step) {\n          var sizeLabel = this.drawTextOnPlane("" + i, 32);\n          var sizeLabel2 = sizeLabel.clone();\n\n          sizeLabel.position.set(length / 2, -i, 0.1);\n          sizeLabel.rotation.z = -Math.PI / 2;\n          labelsFront.add(sizeLabel);\n\n          sizeLabel2.position.set(length / 2, i, 0.1);\n          sizeLabel2.rotation.z = -Math.PI / 2;\n          labelsFront.add(sizeLabel2);\n        }\n\n        for (var i = 0; i <= length / 2; i += step) {\n          var sizeLabel = this.drawTextOnPlane("" + i, 32);\n          var sizeLabel2 = sizeLabel.clone();\n\n          sizeLabel.position.set(-i, width / 2, 0.1);\n          //sizeLabel.rotation.z = -Math.PI / 2;\n          labelsSideRight.add(sizeLabel);\n\n          sizeLabel2.position.set(i, width / 2, 0.1);\n          //sizeLabel2.rotation.z = -Math.PI / 2;\n          labelsSideRight.add(sizeLabel2);\n        }\n\n        var labelsSideLeft = labelsSideRight.clone();\n        labelsSideLeft.rotation.z = -Math.PI;\n        //labelsSideLeft = labelsSideRight.clone().translateY(- width );\n\n        var labelsBack = labelsFront.clone();\n        labelsBack.rotation.z = -Math.PI;\n      }\n\n      /*if (this.textLocation === "center") {\n        yLabelsRight.translateY(- length/ 2);\n        xLabelsFront.translateX(- width / 2);\n      } else {\n        yLabelsLeft = yLabelsRight.clone().translateY( -width );\n        xLabelsBack = xLabelsFront.clone().translateX( -length );\n        \n        this.labels.add( yLabelsLeft );\n        this.labels.add( xLabelsBack) ;\n      }*/\n      //this.labels.add( yLabelsRight );\n      this.labels.add(labelsFront);\n      this.labels.add(labelsBack);\n\n      this.labels.add(labelsSideRight);\n      this.labels.add(labelsSideLeft);\n\n      //apply visibility settings to all labels\n      var textVisible = this.text;\n      this.labels.traverse(function (child) {\n        child.visible = textVisible;\n      });\n\n      this.mainGrid.add(this.labels);\n    }\n  }, {\n    key: "drawTextOnPlane",\n    value: function drawTextOnPlane(text, size) {\n      var canvas, context, material, plane, texture;\n\n      if (size == null) {\n        size = 256;\n      }\n\n      if (document) {\n        canvas = document.createElement(\'canvas\');\n      } else {\n        canvas = {};\n      }\n\n      var size = 128;\n      canvas.width = size;\n      canvas.height = size;\n      context = canvas.getContext(\'2d\');\n      context.font = "18px sans-serif";\n      context.textAlign = \'center\';\n      context.fillStyle = this.textColor;\n      context.fillText(text, canvas.width / 2, canvas.height / 2);\n      context.strokeStyle = this.textColor;\n      context.strokeText(text, canvas.width / 2, canvas.height / 2);\n\n      texture = new _three2.default.Texture(canvas);\n      texture.needsUpdate = true;\n      texture.generateMipmaps = true;\n      texture.magFilter = _three2.default.LinearFilter;\n      texture.minFilter = _three2.default.LinearFilter;\n\n      material = new _three2.default.MeshBasicMaterial({\n        map: texture,\n        transparent: true,\n        color: 0xffffff,\n        alphaTest: 0.3\n      });\n      plane = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(size / 8, size / 8), material);\n      plane.doubleSided = true;\n      plane.overdraw = true;\n\n      return plane;\n    }\n  }]);\n\n  return LabeledGrid;\n})(_three2.default.Object3D);\n\n//autoresize, disabled for now\n/*\nupdateGridSize() {\n      var max, maxX, maxY, min, minX, minY, size, subchild, _getBounds, _i, _len, _ref,\n        _this = this;\n      minX = 99999;\n      maxX = -99999;\n      minY = 99999;\n      maxY = -99999;\n      _getBounds = function(mesh) {\n        var bBox, subchild, _i, _len, _ref, _results;\n        if (mesh instanceof THREE.Mesh) {\n          mesh.geometry.computeBoundingBox();\n          bBox = mesh.geometry.boundingBox;\n          minX = Math.min(minX, bBox.min.x);\n          maxX = Math.max(maxX, bBox.max.x);\n          minY = Math.min(minY, bBox.min.y);\n          maxY = Math.max(maxY, bBox.max.y);\n          _ref = mesh.children;\n          _results = [];\n          for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n            subchild = _ref[_i];\n            _results.push(_getBounds(subchild));\n          }\n          return _results;\n        }\n      };\n      if (this.rootAssembly != null) {\n        _ref = this.rootAssembly.children;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          subchild = _ref[_i];\n          if (subchild.name !== "renderSubs" && subchild.name !== "connectors") {\n            _getBounds(subchild);\n          }\n        }\n      }\n      max = Math.max(Math.max(maxX, maxY), 100);\n      min = Math.min(Math.min(minX, minY), -100);\n      size = (Math.max(max, Math.abs(min))) * 2;\n      size = Math.ceil(size / 10) * 10;\n      if (size >= 200) {\n        return this.resize(size);\n      }\n};\n*/\n\nexports.default = LabeledGrid;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/grids/LabeledGrid.js\n ** module id = 81\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/grids/LabeledGrid.js?')},function(module,exports,__webpack_require__){
eval('var map = {\n	"./contexts/context": 25,\n	"./contexts/context.js": 25,\n	"./contexts/diff": 26,\n	"./contexts/diff.js": 26,\n	"./contexts/patch": 27,\n	"./contexts/patch.js": 27,\n	"./contexts/reverse": 28,\n	"./contexts/reverse.js": 28,\n	"./date-reviver": 41,\n	"./date-reviver.js": 41,\n	"./diffpatcher": 50,\n	"./diffpatcher.js": 50,\n	"./environment": 29,\n	"./environment.js": 29,\n	"./filters/arrays": 51,\n	"./filters/arrays.js": 51,\n	"./filters/dates": 52,\n	"./filters/dates.js": 52,\n	"./filters/lcs": 53,\n	"./filters/lcs.js": 53,\n	"./filters/nested": 54,\n	"./filters/nested.js": 54,\n	"./filters/texts": 55,\n	"./filters/texts.js": 55,\n	"./filters/trivial": 56,\n	"./filters/trivial.js": 56,\n	"./formatters/annotated": 30,\n	"./formatters/annotated.js": 30,\n	"./formatters/base": 14,\n	"./formatters/base.js": 14,\n	"./formatters/console": 42,\n	"./formatters/console.js": 42,\n	"./formatters/html": 31,\n	"./formatters/html.js": 31,\n	"./formatters/index": 35,\n	"./formatters/index.js": 35,\n	"./formatters/jsonpatch": 32,\n	"./formatters/jsonpatch.js": 32,\n	"./main": 18,\n	"./main-formatters": 83,\n	"./main-formatters.js": 83,\n	"./main-full": 84,\n	"./main-full.js": 84,\n	"./main.js": 18,\n	"./pipe": 43,\n	"./pipe.js": 43,\n	"./processor": 57,\n	"./processor.js": 57\n};\nfunction webpackContext(req) {\n	return __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n	return map[req] || (function() { throw new Error("Cannot find module \'" + req + "\'.") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n	return Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 82;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src ^\\.\\/.*$\n ** module id = 82\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src_^\\.\\/.*$?')},function(module,exports,__webpack_require__){eval("\nmodule.exports = __webpack_require__(35);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/main-formatters.js\n ** module id = 83\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/main-formatters.js?")},function(module,exports,__webpack_require__){eval("var environment = __webpack_require__(29);\n\nif (environment.isBrowser) {\n  /* global window */\n  /* jshint camelcase: false */\n  window.diff_match_patch = __webpack_require__(49);\n  /* jshint camelcase: true */\n}\n\nmodule.exports = __webpack_require__(18);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/main-full.js\n ** module id = 84\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/main-full.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = selectorParser;\n\nvar _browserSplit = __webpack_require__(88);\n\nvar _browserSplit2 = _interopRequireDefault(_browserSplit);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nfunction selectorParser() {\n  var selector = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n  var tagName = undefined;\n  var id = '';\n  var classes = [];\n\n  var tagParts = (0, _browserSplit2.default)(selector, classIdSplit);\n\n  if (notClassId.test(tagParts[1]) || selector === '') {\n    tagName = 'div';\n  }\n\n  var part = undefined;\n  var type = undefined;\n  var i = undefined;\n\n  for (i = 0; i < tagParts.length; i++) {\n    part = tagParts[i];\n\n    if (!part) {\n      continue;\n    }\n\n    type = part.charAt(0);\n\n    if (!tagName) {\n      tagName = part;\n    } else if (type === '.') {\n      classes.push(part.substring(1, part.length));\n    } else if (type === '#') {\n      id = part.substring(1, part.length);\n    }\n  }\n\n  return {\n    tagName: tagName,\n    id: id,\n    className: classes.join(' ')\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-selector/lib/selectorParser.js\n ** module id = 85\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-selector/lib/selectorParser.js?")},function(module,exports,__webpack_require__){eval("\n// https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/parse-tag.js\n\nvar split = __webpack_require__(88);\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nmodule.exports = function parseSelector(selector, upper) {\n  selector = selector || '';\n  var tagName;\n  var id = '';\n  var classes = [];\n\n  var tagParts = split(selector, classIdSplit);\n\n  if (notClassId.test(tagParts[1]) || selector === '') {\n    tagName = 'div';\n  }\n\n  var part, type, i;\n\n  for (i = 0; i < tagParts.length; i++) {\n    part = tagParts[i];\n\n    if (!part) {\n      continue;\n    }\n\n    type = part.charAt(0);\n\n    if (!tagName) {\n      tagName = part;\n    } else if (type === '.') {\n      classes.push(part.substring(1, part.length));\n    } else if (type === '#') {\n      id = part.substring(1, part.length);\n    }\n  }\n\n  return {\n    tagName: upper === true ? tagName.toUpperCase() : tagName,\n    id: id,\n    className: classes.join(' ')\n  };\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/parse-selector.js\n ** module id = 86\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/parse-selector.js?")},function(module,exports){eval("'use strict';\nmodule.exports = function () {\n	return /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/ansi-regex/index.js\n ** module id = 87\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/ansi-regex/index.js?")},function(module,exports){eval("/*!\n * Cross-Browser Split 1.1.1\n * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>\n * Available under the MIT License\n * ECMAScript compliant, uniform cross-browser split method\n */\n\n/**\n * Splits a string into an array of strings using a regex or string separator. Matches of the\n * separator are not included in the result array. However, if `separator` is a regex that contains\n * capturing groups, backreferences are spliced into the result each time `separator` is matched.\n * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably\n * cross-browser.\n * @param {String} str String to split.\n * @param {RegExp|String} separator Regex or string to use for separating the string.\n * @param {Number} [limit] Maximum number of items to include in the result array.\n * @returns {Array} Array of substrings.\n * @example\n *\n * // Basic use\n * split('a b c d', ' ');\n * // -> ['a', 'b', 'c', 'd']\n *\n * // With limit\n * split('a b c d', ' ', 2);\n * // -> ['a', 'b']\n *\n * // Backreferences in result array\n * split('..word1 word2..', /([a-z]+)(\\d+)/i);\n * // -> ['..', 'word', '1', ' ', 'word', '2', '..']\n */\nmodule.exports = (function split(undef) {\n\n  var nativeSplit = String.prototype.split,\n    compliantExecNpcg = /()??/.exec(\"\")[1] === undef,\n    // NPCG: nonparticipating capturing group\n    self;\n\n  self = function(str, separator, limit) {\n    // If `separator` is not a regex, use `nativeSplit`\n    if (Object.prototype.toString.call(separator) !== \"[object RegExp]\") {\n      return nativeSplit.call(str, separator, limit);\n    }\n    var output = [],\n      flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n      (separator.sticky ? \"y\" : \"\"),\n      // Firefox 3+\n      lastLastIndex = 0,\n      // Make `global` and avoid `lastIndex` issues by working with a copy\n      separator = new RegExp(separator.source, flags + \"g\"),\n      separator2, match, lastIndex, lastLength;\n    str += \"\"; // Type-convert\n    if (!compliantExecNpcg) {\n      // Doesn't need flags gy, but they don't hurt\n      separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n    }\n    /* Values for `limit`, per the spec:\n     * If undefined: 4294967295 // Math.pow(2, 32) - 1\n     * If 0, Infinity, or NaN: 0\n     * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n     * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n     * If other: Type-convert, then use the above rules\n     */\n    limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1\n    limit >>> 0; // ToUint32(limit)\n    while (match = separator.exec(str)) {\n      // `separator.lastIndex` is not reliable cross-browser\n      lastIndex = match.index + match[0].length;\n      if (lastIndex > lastLastIndex) {\n        output.push(str.slice(lastLastIndex, match.index));\n        // Fix browsers whose `exec` methods don't consistently return `undefined` for\n        // nonparticipating capturing groups\n        if (!compliantExecNpcg && match.length > 1) {\n          match[0].replace(separator2, function() {\n            for (var i = 1; i < arguments.length - 2; i++) {\n              if (arguments[i] === undef) {\n                match[i] = undef;\n              }\n            }\n          });\n        }\n        if (match.length > 1 && match.index < str.length) {\n          Array.prototype.push.apply(output, match.slice(1));\n        }\n        lastLength = match[0].length;\n        lastLastIndex = lastIndex;\n        if (output.length >= limit) {\n          break;\n        }\n      }\n      if (separator.lastIndex === match.index) {\n        separator.lastIndex++; // Avoid an infinite loop\n      }\n    }\n    if (lastLastIndex === str.length) {\n      if (lastLength || !separator.test(\"\")) {\n        output.push(\"\");\n      }\n    } else {\n      output.push(str.slice(lastLastIndex));\n    }\n    return output.length > limit ? output.slice(0, limit) : output;\n  };\n\n  return self;\n})();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/browser-split/index.js\n ** module id = 88\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/browser-split/index.js?")},function(module,exports){eval("/**\n * lodash 3.9.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n  fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n  .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n  var value = object == null ? undefined : object[key];\n  return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n  // The use of `Object#toString` avoids issues with the `typeof` operator\n  // in older versions of Chrome and Safari which return 'function' for regexes\n  // and Safari 8 equivalents which return 'object' for typed array constructors.\n  return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n  // Avoid a V8 JIT bug in Chrome 19-20.\n  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n  var type = typeof value;\n  return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n  if (value == null) {\n    return false;\n  }\n  if (isFunction(value)) {\n    return reIsNative.test(fnToString.call(value));\n  }\n  return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = getNative;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._getnative/index.js\n ** module id = 89\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._getnative/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.2.0 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar root = __webpack_require__(61);\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match HTML entities and HTML characters. */\nvar reUnescapedHtml = /[&<>\"'`]/g,\n    reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n/** Used to map characters to HTML entities. */\nvar htmlEscapes = {\n  '&': '&amp;',\n  '<': '&lt;',\n  '>': '&gt;',\n  '\"': '&quot;',\n  \"'\": '&#39;',\n  '`': '&#96;'\n};\n\n/**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nfunction escapeHtmlChar(chr) {\n  return htmlEscapes[chr];\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n    symbolToString = Symbol ? symbolProto.toString : undefined;\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n  return typeof value == 'symbol' ||\n    (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n  // Exit early for strings to avoid a performance hit in some environments.\n  if (typeof value == 'string') {\n    return value;\n  }\n  if (value == null) {\n    return '';\n  }\n  if (isSymbol(value)) {\n    return Symbol ? symbolToString.call(value) : '';\n  }\n  var result = (value + '');\n  return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Converts the characters \"&\", \"<\", \">\", '\"', \"'\", and \"\\`\" in `string` to\n * their corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value.\n * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * Backticks are escaped because in IE < 9, they can break out of\n * attribute values or HTML comments. See [#59](https://html5sec.org/#59),\n * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and\n * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)\n * for more details.\n *\n * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)\n * to reduce XSS vectors.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, &amp; pebbles'\n */\nfunction escape(string) {\n  string = toString(string);\n  return (string && reHasUnescapedHtml.test(string))\n    ? string.replace(reUnescapedHtml, escapeHtmlChar)\n    : string;\n}\n\nmodule.exports = escape;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.escape/index.js\n ** module id = 90\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.escape/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.0.2 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar baseFor = __webpack_require__(311),\n    bindCallback = __webpack_require__(314),\n    keys = __webpack_require__(319);\n\n/**\n * The base implementation of `_.forOwn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n  return baseFor(object, iteratee, keys);\n}\n\n/**\n * Creates a function for `_.forOwn` or `_.forOwnRight`.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new each function.\n */\nfunction createForOwn(objectFunc) {\n  return function(object, iteratee, thisArg) {\n    if (typeof iteratee != 'function' || thisArg !== undefined) {\n      iteratee = bindCallback(iteratee, thisArg, 3);\n    }\n    return objectFunc(object, iteratee);\n  };\n}\n\n/**\n * Iterates over own enumerable properties of an object invoking `iteratee`\n * for each property. The `iteratee` is bound to `thisArg` and invoked with\n * three arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n *   this.a = 1;\n *   this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n *   console.log(key);\n * });\n * // => logs 'a' and 'b' (iteration order is not guaranteed)\n */\nvar forOwn = createForOwn(baseForOwn);\n\nmodule.exports = forOwn;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.forown/index.js\n ** module id = 91\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.forown/index.js?")},function(module,exports){eval("/**\n * lodash 3.0.8 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n    funcTag = '[object Function]',\n    genTag = '[object GeneratorFunction]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n  return function(object) {\n    return object == null ? undefined : object[key];\n  };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n  // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n  return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n    (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n  return value != null && isLength(getLength(value)) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n  return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n  // The use of `Object#toString` avoids issues with the `typeof` operator\n  // in Safari 8 which returns 'object' for typed array and weak map constructors,\n  // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n  var tag = isObject(value) ? objectToString.call(value) : '';\n  return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n  return typeof value == 'number' &&\n    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n  var type = typeof value;\n  return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\nmodule.exports = isArguments;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.isarguments/index.js\n ** module id = 92\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.isarguments/index.js?")},function(module,exports){eval("/**\n * lodash 3.0.4 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]',\n    funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n  fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n  .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n  var value = object == null ? undefined : object[key];\n  return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n  return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n  return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n  // The use of `Object#toString` avoids issues with the `typeof` operator\n  // in older versions of Chrome and Safari which return 'function' for regexes\n  // and Safari 8 equivalents which return 'object' for typed array constructors.\n  return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n  // Avoid a V8 JIT bug in Chrome 19-20.\n  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n  var type = typeof value;\n  return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n  if (value == null) {\n    return false;\n  }\n  if (isFunction(value)) {\n    return reIsNative.test(fnToString.call(value));\n  }\n  return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isArray;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.isarray/index.js\n ** module id = 93\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.isarray/index.js?");
},function(module,exports){eval("/**\n * Tween.js - Licensed under the MIT license\n * https://github.com/sole/tween.js\n * ----------------------------------------------\n *\n * See https://github.com/sole/tween.js/graphs/contributors for the full list of contributors.\n * Thank you all, you're awesome!\n */\n\n// Date.now shim for (ahem) Internet Explo(d|r)er\nif ( Date.now === undefined ) {\n\n	Date.now = function () {\n\n		return new Date().valueOf();\n\n	};\n\n}\n\nvar TWEEN = TWEEN || ( function () {\n\n	var _tweens = [];\n\n	return {\n\n		REVISION: '14',\n\n		getAll: function () {\n\n			return _tweens;\n\n		},\n\n		removeAll: function () {\n\n			_tweens = [];\n\n		},\n\n		add: function ( tween ) {\n\n			_tweens.push( tween );\n\n		},\n\n		remove: function ( tween ) {\n\n			var i = _tweens.indexOf( tween );\n\n			if ( i !== -1 ) {\n\n				_tweens.splice( i, 1 );\n\n			}\n\n		},\n\n		update: function ( time ) {\n\n			if ( _tweens.length === 0 ) return false;\n\n			var i = 0;\n\n			time = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );\n\n			while ( i < _tweens.length ) {\n\n				if ( _tweens[ i ].update( time ) ) {\n\n					i++;\n\n				} else {\n\n					_tweens.splice( i, 1 );\n\n				}\n\n			}\n\n			return true;\n\n		}\n	};\n\n} )();\n\nTWEEN.Tween = function ( object ) {\n\n	var _object = object;\n	var _valuesStart = {};\n	var _valuesEnd = {};\n	var _valuesStartRepeat = {};\n	var _duration = 1000;\n	var _repeat = 0;\n	var _yoyo = false;\n	var _isPlaying = false;\n	var _reversed = false;\n	var _delayTime = 0;\n	var _startTime = null;\n	var _easingFunction = TWEEN.Easing.Linear.None;\n	var _interpolationFunction = TWEEN.Interpolation.Linear;\n	var _chainedTweens = [];\n	var _onStartCallback = null;\n	var _onStartCallbackFired = false;\n	var _onUpdateCallback = null;\n	var _onCompleteCallback = null;\n	var _onStopCallback = null;\n\n	// Set all starting values present on the target object\n	for ( var field in object ) {\n\n		_valuesStart[ field ] = parseFloat(object[field], 10);\n\n	}\n\n	this.to = function ( properties, duration ) {\n\n		if ( duration !== undefined ) {\n\n			_duration = duration;\n\n		}\n\n		_valuesEnd = properties;\n\n		return this;\n\n	};\n\n	this.start = function ( time ) {\n\n		TWEEN.add( this );\n\n		_isPlaying = true;\n\n		_onStartCallbackFired = false;\n\n		_startTime = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );\n		_startTime += _delayTime;\n\n		for ( var property in _valuesEnd ) {\n\n			// check if an Array was provided as property value\n			if ( _valuesEnd[ property ] instanceof Array ) {\n\n				if ( _valuesEnd[ property ].length === 0 ) {\n\n					continue;\n\n				}\n\n				// create a local copy of the Array with the start value at the front\n				_valuesEnd[ property ] = [ _object[ property ] ].concat( _valuesEnd[ property ] );\n\n			}\n\n			_valuesStart[ property ] = _object[ property ];\n\n			if( ( _valuesStart[ property ] instanceof Array ) === false ) {\n				_valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings\n			}\n\n			_valuesStartRepeat[ property ] = _valuesStart[ property ] || 0;\n\n		}\n\n		return this;\n\n	};\n\n	this.stop = function () {\n\n		if ( !_isPlaying ) {\n			return this;\n		}\n\n		TWEEN.remove( this );\n		_isPlaying = false;\n\n		if ( _onStopCallback !== null ) {\n\n			_onStopCallback.call( _object );\n\n		}\n\n		this.stopChainedTweens();\n		return this;\n\n	};\n\n	this.stopChainedTweens = function () {\n\n		for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++ ) {\n\n			_chainedTweens[ i ].stop();\n\n		}\n\n	};\n\n	this.delay = function ( amount ) {\n\n		_delayTime = amount;\n		return this;\n\n	};\n\n	this.repeat = function ( times ) {\n\n		_repeat = times;\n		return this;\n\n	};\n\n	this.yoyo = function( yoyo ) {\n\n		_yoyo = yoyo;\n		return this;\n\n	};\n\n\n	this.easing = function ( easing ) {\n\n		_easingFunction = easing;\n		return this;\n\n	};\n\n	this.interpolation = function ( interpolation ) {\n\n		_interpolationFunction = interpolation;\n		return this;\n\n	};\n\n	this.chain = function () {\n\n		_chainedTweens = arguments;\n		return this;\n\n	};\n\n	this.onStart = function ( callback ) {\n\n		_onStartCallback = callback;\n		return this;\n\n	};\n\n	this.onUpdate = function ( callback ) {\n\n		_onUpdateCallback = callback;\n		return this;\n\n	};\n\n	this.onComplete = function ( callback ) {\n\n		_onCompleteCallback = callback;\n		return this;\n\n	};\n\n	this.onStop = function ( callback ) {\n\n		_onStopCallback = callback;\n		return this;\n\n	};\n\n	this.update = function ( time ) {\n\n		var property;\n\n		if ( time < _startTime ) {\n\n			return true;\n\n		}\n\n		if ( _onStartCallbackFired === false ) {\n\n			if ( _onStartCallback !== null ) {\n\n				_onStartCallback.call( _object );\n\n			}\n\n			_onStartCallbackFired = true;\n\n		}\n\n		var elapsed = ( time - _startTime ) / _duration;\n		elapsed = elapsed > 1 ? 1 : elapsed;\n\n		var value = _easingFunction( elapsed );\n\n		for ( property in _valuesEnd ) {\n\n			var start = _valuesStart[ property ] || 0;\n			var end = _valuesEnd[ property ];\n\n			if ( end instanceof Array ) {\n\n				_object[ property ] = _interpolationFunction( end, value );\n\n			} else {\n\n				// Parses relative end values with start as base (e.g.: +10, -3)\n				if ( typeof(end) === \"string\" ) {\n					end = start + parseFloat(end, 10);\n				}\n\n				// protect against non numeric properties.\n				if ( typeof(end) === \"number\" ) {\n					_object[ property ] = start + ( end - start ) * value;\n				}\n\n			}\n\n		}\n\n		if ( _onUpdateCallback !== null ) {\n\n			_onUpdateCallback.call( _object, value );\n\n		}\n\n		if ( elapsed == 1 ) {\n\n			if ( _repeat > 0 ) {\n\n				if( isFinite( _repeat ) ) {\n					_repeat--;\n				}\n\n				// reassign starting values, restart by making startTime = now\n				for( property in _valuesStartRepeat ) {\n\n					if ( typeof( _valuesEnd[ property ] ) === \"string\" ) {\n						_valuesStartRepeat[ property ] = _valuesStartRepeat[ property ] + parseFloat(_valuesEnd[ property ], 10);\n					}\n\n					if (_yoyo) {\n						var tmp = _valuesStartRepeat[ property ];\n						_valuesStartRepeat[ property ] = _valuesEnd[ property ];\n						_valuesEnd[ property ] = tmp;\n					}\n\n					_valuesStart[ property ] = _valuesStartRepeat[ property ];\n\n				}\n\n				if (_yoyo) {\n					_reversed = !_reversed;\n				}\n\n				_startTime = time + _delayTime;\n\n				return true;\n\n			} else {\n\n				if ( _onCompleteCallback !== null ) {\n\n					_onCompleteCallback.call( _object );\n\n				}\n\n				for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++ ) {\n\n					_chainedTweens[ i ].start( time );\n\n				}\n\n				return false;\n\n			}\n\n		}\n\n		return true;\n\n	};\n\n};\n\n\nTWEEN.Easing = {\n\n	Linear: {\n\n		None: function ( k ) {\n\n			return k;\n\n		}\n\n	},\n\n	Quadratic: {\n\n		In: function ( k ) {\n\n			return k * k;\n\n		},\n\n		Out: function ( k ) {\n\n			return k * ( 2 - k );\n\n		},\n\n		InOut: function ( k ) {\n\n			if ( ( k *= 2 ) < 1 ) return 0.5 * k * k;\n			return - 0.5 * ( --k * ( k - 2 ) - 1 );\n\n		}\n\n	},\n\n	Cubic: {\n\n		In: function ( k ) {\n\n			return k * k * k;\n\n		},\n\n		Out: function ( k ) {\n\n			return --k * k * k + 1;\n\n		},\n\n		InOut: function ( k ) {\n\n			if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k;\n			return 0.5 * ( ( k -= 2 ) * k * k + 2 );\n\n		}\n\n	},\n\n	Quartic: {\n\n		In: function ( k ) {\n\n			return k * k * k * k;\n\n		},\n\n		Out: function ( k ) {\n\n			return 1 - ( --k * k * k * k );\n\n		},\n\n		InOut: function ( k ) {\n\n			if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k;\n			return - 0.5 * ( ( k -= 2 ) * k * k * k - 2 );\n\n		}\n\n	},\n\n	Quintic: {\n\n		In: function ( k ) {\n\n			return k * k * k * k * k;\n\n		},\n\n		Out: function ( k ) {\n\n			return --k * k * k * k * k + 1;\n\n		},\n\n		InOut: function ( k ) {\n\n			if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k;\n			return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 );\n\n		}\n\n	},\n\n	Sinusoidal: {\n\n		In: function ( k ) {\n\n			return 1 - Math.cos( k * Math.PI / 2 );\n\n		},\n\n		Out: function ( k ) {\n\n			return Math.sin( k * Math.PI / 2 );\n\n		},\n\n		InOut: function ( k ) {\n\n			return 0.5 * ( 1 - Math.cos( Math.PI * k ) );\n\n		}\n\n	},\n\n	Exponential: {\n\n		In: function ( k ) {\n\n			return k === 0 ? 0 : Math.pow( 1024, k - 1 );\n\n		},\n\n		Out: function ( k ) {\n\n			return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k );\n\n		},\n\n		InOut: function ( k ) {\n\n			if ( k === 0 ) return 0;\n			if ( k === 1 ) return 1;\n			if ( ( k *= 2 ) < 1 ) return 0.5 * Math.pow( 1024, k - 1 );\n			return 0.5 * ( - Math.pow( 2, - 10 * ( k - 1 ) ) + 2 );\n\n		}\n\n	},\n\n	Circular: {\n\n		In: function ( k ) {\n\n			return 1 - Math.sqrt( 1 - k * k );\n\n		},\n\n		Out: function ( k ) {\n\n			return Math.sqrt( 1 - ( --k * k ) );\n\n		},\n\n		InOut: function ( k ) {\n\n			if ( ( k *= 2 ) < 1) return - 0.5 * ( Math.sqrt( 1 - k * k) - 1);\n			return 0.5 * ( Math.sqrt( 1 - ( k -= 2) * k) + 1);\n\n		}\n\n	},\n\n	Elastic: {\n\n		In: function ( k ) {\n\n			var s, a = 0.1, p = 0.4;\n			if ( k === 0 ) return 0;\n			if ( k === 1 ) return 1;\n			if ( !a || a < 1 ) { a = 1; s = p / 4; }\n			else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n			return - ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );\n\n		},\n\n		Out: function ( k ) {\n\n			var s, a = 0.1, p = 0.4;\n			if ( k === 0 ) return 0;\n			if ( k === 1 ) return 1;\n			if ( !a || a < 1 ) { a = 1; s = p / 4; }\n			else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n			return ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 );\n\n		},\n\n		InOut: function ( k ) {\n\n			var s, a = 0.1, p = 0.4;\n			if ( k === 0 ) return 0;\n			if ( k === 1 ) return 1;\n			if ( !a || a < 1 ) { a = 1; s = p / 4; }\n			else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n			if ( ( k *= 2 ) < 1 ) return - 0.5 * ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );\n			return a * Math.pow( 2, -10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) * 0.5 + 1;\n\n		}\n\n	},\n\n	Back: {\n\n		In: function ( k ) {\n\n			var s = 1.70158;\n			return k * k * ( ( s + 1 ) * k - s );\n\n		},\n\n		Out: function ( k ) {\n\n			var s = 1.70158;\n			return --k * k * ( ( s + 1 ) * k + s ) + 1;\n\n		},\n\n		InOut: function ( k ) {\n\n			var s = 1.70158 * 1.525;\n			if ( ( k *= 2 ) < 1 ) return 0.5 * ( k * k * ( ( s + 1 ) * k - s ) );\n			return 0.5 * ( ( k -= 2 ) * k * ( ( s + 1 ) * k + s ) + 2 );\n\n		}\n\n	},\n\n	Bounce: {\n\n		In: function ( k ) {\n\n			return 1 - TWEEN.Easing.Bounce.Out( 1 - k );\n\n		},\n\n		Out: function ( k ) {\n\n			if ( k < ( 1 / 2.75 ) ) {\n\n				return 7.5625 * k * k;\n\n			} else if ( k < ( 2 / 2.75 ) ) {\n\n				return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;\n\n			} else if ( k < ( 2.5 / 2.75 ) ) {\n\n				return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;\n\n			} else {\n\n				return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;\n\n			}\n\n		},\n\n		InOut: function ( k ) {\n\n			if ( k < 0.5 ) return TWEEN.Easing.Bounce.In( k * 2 ) * 0.5;\n			return TWEEN.Easing.Bounce.Out( k * 2 - 1 ) * 0.5 + 0.5;\n\n		}\n\n	}\n\n};\n\nTWEEN.Interpolation = {\n\n	Linear: function ( v, k ) {\n\n		var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.Linear;\n\n		if ( k < 0 ) return fn( v[ 0 ], v[ 1 ], f );\n		if ( k > 1 ) return fn( v[ m ], v[ m - 1 ], m - f );\n\n		return fn( v[ i ], v[ i + 1 > m ? m : i + 1 ], f - i );\n\n	},\n\n	Bezier: function ( v, k ) {\n\n		var b = 0, n = v.length - 1, pw = Math.pow, bn = TWEEN.Interpolation.Utils.Bernstein, i;\n\n		for ( i = 0; i <= n; i++ ) {\n			b += pw( 1 - k, n - i ) * pw( k, i ) * v[ i ] * bn( n, i );\n		}\n\n		return b;\n\n	},\n\n	CatmullRom: function ( v, k ) {\n\n		var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.CatmullRom;\n\n		if ( v[ 0 ] === v[ m ] ) {\n\n			if ( k < 0 ) i = Math.floor( f = m * ( 1 + k ) );\n\n			return fn( v[ ( i - 1 + m ) % m ], v[ i ], v[ ( i + 1 ) % m ], v[ ( i + 2 ) % m ], f - i );\n\n		} else {\n\n			if ( k < 0 ) return v[ 0 ] - ( fn( v[ 0 ], v[ 0 ], v[ 1 ], v[ 1 ], -f ) - v[ 0 ] );\n			if ( k > 1 ) return v[ m ] - ( fn( v[ m ], v[ m ], v[ m - 1 ], v[ m - 1 ], f - m ) - v[ m ] );\n\n			return fn( v[ i ? i - 1 : 0 ], v[ i ], v[ m < i + 1 ? m : i + 1 ], v[ m < i + 2 ? m : i + 2 ], f - i );\n\n		}\n\n	},\n\n	Utils: {\n\n		Linear: function ( p0, p1, t ) {\n\n			return ( p1 - p0 ) * t + p0;\n\n		},\n\n		Bernstein: function ( n , i ) {\n\n			var fc = TWEEN.Interpolation.Utils.Factorial;\n			return fc( n ) / fc( i ) / fc( n - i );\n\n		},\n\n		Factorial: ( function () {\n\n			var a = [ 1 ];\n\n			return function ( n ) {\n\n				var s = 1, i;\n				if ( a[ n ] ) return a[ n ];\n				for ( i = n; i > 1; i-- ) s *= i;\n				return a[ n ] = s;\n\n			};\n\n		} )(),\n\n		CatmullRom: function ( p0, p1, p2, p3, t ) {\n\n			var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2;\n			return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n		}\n\n	}\n\n};\n\nmodule.exports=TWEEN;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/tween.js/index.js\n ** module id = 94\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/tween.js/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nvar required = __webpack_require__(325)\n  , lolcation = __webpack_require__(347)\n  , qs = __webpack_require__(324)\n  , relativere = /^\\/(?!\\/)/\n  , protocolre = /^([a-z0-9.+-]+:)?(\\/\\/)?(.*)$/i; // actual protocol is first match\n\n/**\n * These are the parse instructions for the URL parsers, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n *    indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n *    the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar instructions = [\n  ['#', 'hash'],                        // Extract from the back.\n  ['?', 'query'],                       // Extract from the back.\n  ['/', 'pathname'],                    // Extract from the back.\n  ['@', 'auth', 1],                     // Extract from the front.\n  [NaN, 'host', undefined, 1, 1],       // Set left over value.\n  [/\\:(\\d+)$/, 'port'],                 // RegExp the back.\n  [NaN, 'hostname', undefined, 1, 1]    // Set left over.\n];\n\n /**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase\n * @property {Boolean} slashes Indicates whether the protocol is followed by double slash (\"//\")\n * @property {String} rest     Rest of the URL that is not part of the protocol\n */\n\n /**\n  * Extract protocol information from a URL with/without double slash (\"//\")\n  *\n  * @param  {String} address   URL we want to extract from.\n  * @return {ProtocolExtract}  Extracted information\n  * @private\n  */\nfunction extractProtocol(address) {\n  var match = protocolre.exec(address);\n  return {\n    protocol: match[1] ? match[1].toLowerCase() : '',\n    slashes: !!match[2],\n    rest: match[3] ? match[3] : ''\n  };\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my CDO.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} location Location defaults for relative paths.\n * @param {Boolean|Function} parser Parser for the query string.\n * @api public\n */\nfunction URL(address, location, parser) {\n  if (!(this instanceof URL)) {\n    return new URL(address, location, parser);\n  }\n\n  var relative = relativere.test(address)\n    , parse, instruction, index, key\n    , type = typeof location\n    , url = this\n    , i = 0;\n\n  //\n  // The following if statements allows this module two have compatibility with\n  // 2 different API:\n  //\n  // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n  //    where the boolean indicates that the query string should also be parsed.\n  //\n  // 2. The `URL` interface of the browser which accepts a URL, object as\n  //    arguments. The supplied object will be used as default values / fall-back\n  //    for relative paths.\n  //\n  if ('object' !== type && 'string' !== type) {\n    parser = location;\n    location = null;\n  }\n\n  if (parser && 'function' !== typeof parser) {\n    parser = qs.parse;\n  }\n\n  location = lolcation(location);\n\n  // extract protocol information before running the instructions\n  var extracted = extractProtocol(address);\n  url.protocol = extracted.protocol || location.protocol || '';\n  url.slashes = extracted.slashes || location.slashes;\n  address = extracted.rest;\n\n  for (; i < instructions.length; i++) {\n    instruction = instructions[i];\n    parse = instruction[0];\n    key = instruction[1];\n\n    if (parse !== parse) {\n      url[key] = address;\n    } else if ('string' === typeof parse) {\n      if (~(index = address.indexOf(parse))) {\n        if ('number' === typeof instruction[2]) {\n          url[key] = address.slice(0, index);\n          address = address.slice(index + instruction[2]);\n        } else {\n          url[key] = address.slice(index);\n          address = address.slice(0, index);\n        }\n      }\n    } else if (index = parse.exec(address)) {\n      url[key] = index[1];\n      address = address.slice(0, address.length - index[0].length);\n    }\n\n    url[key] = url[key] || (instruction[3] || ('port' === key && relative) ? location[key] || '' : '');\n\n    //\n    // Hostname, host and protocol should be lowercased so they can be used to\n    // create a proper `origin`.\n    //\n    if (instruction[4]) {\n      url[key] = url[key].toLowerCase();\n    }\n  }\n\n  //\n  // Also parse the supplied query string in to an object. If we're supplied\n  // with a custom parser as function use that instead of the default build-in\n  // parser.\n  //\n  if (parser) url.query = parser(url.query);\n\n  //\n  // We should not add port numbers if they are already the default port number\n  // for a given protocol. As the host also contains the port number we're going\n  // override it with the hostname which contains no port number.\n  //\n  if (!required(url.port, url.protocol)) {\n    url.host = url.hostname;\n    url.port = '';\n  }\n\n  //\n  // Parse down the `auth` for the username and password.\n  //\n  url.username = url.password = '';\n  if (url.auth) {\n    instruction = url.auth.split(':');\n    url.username = instruction[0] || '';\n    url.password = instruction[1] || '';\n  }\n\n  //\n  // The href is just the compiled result.\n  //\n  url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} prop          Property we need to adjust.\n * @param {Mixed} value          The newly assigned value.\n * @param {Boolean|Function} fn  When setting the query, it will be the function used to parse\n *                               the query.\n *                               When setting the protocol, double slash will be removed from\n *                               the final url if it is true.\n * @returns {URL}\n * @api public\n */\nURL.prototype.set = function set(part, value, fn) {\n  var url = this;\n\n  if ('query' === part) {\n    if ('string' === typeof value && value.length) {\n      value = (fn || qs.parse)(value);\n    }\n\n    url[part] = value;\n  } else if ('port' === part) {\n    url[part] = value;\n\n    if (!required(value, url.protocol)) {\n      url.host = url.hostname;\n      url[part] = '';\n    } else if (value) {\n      url.host = url.hostname +':'+ value;\n    }\n  } else if ('hostname' === part) {\n    url[part] = value;\n\n    if (url.port) value += ':'+ url.port;\n    url.host = value;\n  } else if ('host' === part) {\n    url[part] = value;\n\n    if (/\\:\\d+/.test(value)) {\n      value = value.split(':');\n      url.hostname = value[0];\n      url.port = value[1];\n    }\n  } else if ('protocol' === part) {\n    url.protocol = value;\n    url.slashes = !fn;\n  } else {\n    url[part] = value;\n  }\n\n  url.href = url.toString();\n  return url;\n};\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String}\n * @api public\n */\nURL.prototype.toString = function toString(stringify) {\n  if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n  var query\n    , url = this\n    , protocol = url.protocol;\n\n  if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n  var result = protocol + (url.slashes ? '//' : '');\n\n  if (url.username) {\n    result += url.username;\n    if (url.password) result += ':'+ url.password;\n    result += '@';\n  }\n\n  result += url.hostname;\n  if (url.port) result += ':'+ url.port;\n\n  result += url.pathname;\n\n  query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n  if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n  if (url.hash) result += url.hash;\n\n  return result;\n};\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others.\n//\nURL.qs = qs;\nURL.location = lolcation;\nmodule.exports = URL;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/url-parse/index.js\n ** module id = 95\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/url-parse/index.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.trim = trim;\nexports.exists = exists;\nexports.isEmpty = isEmpty;\nexports.itemsEqual = itemsEqual;\nexports.toArray = toArray;\nexports.safeJSONParse = safeJSONParse;\nexports.getExtension = getExtension;\nexports.getNameAndExtension = getNameAndExtension;\nexports.isValidFile = isValidFile;\nexports.isValidUrl = isValidUrl;\nexports.generateUUID = generateUUID;\nexports.stringToBoolean = stringToBoolean;\nexports.remapJson = remapJson;\nexports.coerceTypes = coerceTypes;\nfunction trim(string) {\n  return String(string).replace(/^\\s+|\\s+$/g, '');\n}\n\nfunction exists(input) {\n  return input !== null && input !== undefined;\n}\n\n// utiity to determine if a string is empty, null, or full of whitespaces\nfunction isEmpty(str) {\n  if (!(typeof str === 'string')) return false; // UUUGH bad way of checking not a string\n  return !str || /^\\s*$/.test(str) || str.length === 0 || !str.trim();\n}\n\nfunction itemsEqual(a, b) {\n  // perhaps an immutable library would not require such horrors?\n  if (JSON.stringify(a) === JSON.stringify(b)) {\n    return true;\n  }\n  return false;\n}\n\n/* converts input data to array if it is not already an array*/\nfunction toArray(data) {\n  if (!data) return [];\n  if (data.constructor !== Array) return [data];\n  return data;\n}\n\n/* JSON parse that always returns an object*/\nfunction safeJSONParse(str) {\n  try {\n    return JSON.parse(str) || {}; // from cycle.js\n  } catch (error) {\n    throw new Error('Error parsing data', JSON.stringify(str));\n  }\n}\n\n// file utils ??\nfunction getExtension(fname) {\n  return fname.substr((~ -fname.lastIndexOf('.') >>> 0) + 2).toLowerCase();\n}\n\nfunction getNameAndExtension(uri) {\n  var _uriElems = uri.split('?');\n  var name = _uriElems.shift().split('/').pop();\n  var ext = getExtension(uri);\n  return { name: name, ext: ext };\n}\n\nfunction isValidFile(file) {\n  return typeof file !== 'undefined' && file !== null && file instanceof File;\n}\n\n// from http://stackoverflow.com/questions/1701898/how-to-detect-whether-a-string-is-in-url-format-using-javascript\nfunction isValidUrl(url) {\n  /* var strRegex = \"^((https|http|ftp|rtsp|mms)?://)\"\n      + \"?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?\" //ftp的user@\n      + \"(([0-9]{1,3}\\.){3}[0-9]{1,3}\" // IP形式的URL- 199.194.52.184\n      + \"|\" // 允许IP和DOMAIN（域名）\n      + \"([0-9a-z_!~*'()-]+\\.)*\" // 域名- www.\n      + \"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\.\" // 二级域名\n      + \"[a-z]{2,6})\" // first level domain- .com or .museum\n      + \"(:[0-9]{1,4})?\" // 端口- :80\n      + \"((/?)|\" // a slash isn't required if there is no file name\n      + \"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$\"\n   var re=new RegExp(strRegex)\n   return re.test(url)*/\n  var regexp = /(ftp|http|https|localhost):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\n  return regexp.test(url);\n}\n\n// TODO: taken from three.js ,do correct attribution\nfunction generateUUID() {\n  // http://www.broofa.com/Tools/Math.uuid.htm\n\n  var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');\n  var uuid = new Array(36);\n  var rnd = 0;\n  var r = void 0;\n\n  return function () {\n    for (var i = 0; i < 36; i++) {\n      if (i === 8 || i === 13 || i === 18 || i === 23) {\n        uuid[i] = '-';\n      } else if (i === 14) {\n        uuid[i] = '4';\n      } else {\n        if (rnd <= 0x02) rnd = 0x2000000 + Math.random() * 0x1000000 | 0;\n        r = rnd & 0xf;\n        rnd = rnd >> 4;\n        uuid[i] = chars[i === 19 ? r & 0x3 | 0x8 : r];\n      }\n    }\n    return uuid.join('');\n  }();\n}\n\n// convert a string to a boolean\nfunction stringToBoolean(string) {\n  switch (string.toLowerCase().trim()) {\n    case 'true':case 'yes':case '1':\n      return true;\n    case 'false':case 'no':case '0':case null:\n      return false;\n    default:\n      return Boolean(string);\n  }\n}\n\n/*\nRemap the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:42}\nremapJson({foo:baz},input) => {baz:42}\n*/\nfunction remapJson(mapping, input) {\n  var result = Object.keys(input).reduce(function (obj, key) {\n    if (key in mapping) {\n      obj[mapping[key]] = input[key];\n    } else {\n      obj[key] = input[key];\n    }\n    return obj;\n  }, {});\n  return result;\n}\n\n/*\nconvert the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:\"42\"}\nremapJson({foo:parseFloat},input) => {baz:42}\n*/\nfunction coerceTypes(mapping, input) {\n  var result = Object.keys(input).reduce(function (obj, key) {\n    if (key in mapping && input[key] !== null && input[key] !== undefined) {\n      obj[key] = mapping[key](input[key]);\n    } else {\n      obj[key] = input[key];\n    }\n    return obj;\n  }, {});\n  return result;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/lib/utils.js\n ** module id = 96\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/lib/utils.js?")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(357)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/obsUtils.js\n ** module id = 97\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/obsUtils.js?")},function(module,exports,__webpack_require__){eval('"use strict";\nvar ScopeChecker_1 = __webpack_require__(64);\nvar utils_1 = __webpack_require__(24);\nvar matchesSelector;\ntry {\n    matchesSelector = __webpack_require__(62);\n}\ncatch (e) {\n    matchesSelector = Function.prototype;\n}\nfunction toElArray(input) {\n    return Array.prototype.slice.call(input);\n}\nvar ElementFinder = (function () {\n    function ElementFinder(namespace, isolateModule) {\n        this.namespace = namespace;\n        this.isolateModule = isolateModule;\n    }\n    ElementFinder.prototype.call = function (rootElement) {\n        var namespace = this.namespace;\n        if (namespace.join("") === "") {\n            return rootElement;\n        }\n        var scope = utils_1.getScope(namespace);\n        var scopeChecker = new ScopeChecker_1.ScopeChecker(scope, this.isolateModule);\n        var selector = utils_1.getSelectors(namespace);\n        var topNode = rootElement;\n        var topNodeMatches = [];\n        if (scope.length > 0) {\n            topNode = this.isolateModule.getIsolatedElement(scope) || rootElement;\n            if (selector && matchesSelector(topNode, selector)) {\n                topNodeMatches.push(topNode);\n            }\n        }\n        return toElArray(topNode.querySelectorAll(selector))\n            .filter(scopeChecker.isStrictlyInRootScope, scopeChecker)\n            .concat(topNodeMatches);\n    };\n    return ElementFinder;\n}());\nexports.ElementFinder = ElementFinder;\n//# sourceMappingURL=ElementFinder.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/ElementFinder.js\n ** module id = 98\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/ElementFinder.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar ScopeChecker_1 = __webpack_require__(64);\nvar utils_1 = __webpack_require__(24);\nvar matchesSelector;\ntry {\n    matchesSelector = __webpack_require__(62);\n}\ncatch (e) {\n    matchesSelector = Function.prototype;\n}\n/**\n * Attaches an actual event listener to the DOM root element,\n * handles "destinations" (interested DOMSource output subjects), and bubbling.\n */\nvar EventDelegator = (function () {\n    function EventDelegator(topElement, eventType, useCapture, isolateModule) {\n        var _this = this;\n        this.topElement = topElement;\n        this.eventType = eventType;\n        this.useCapture = useCapture;\n        this.isolateModule = isolateModule;\n        this.destinations = [];\n        this.roof = topElement.parentElement;\n        if (useCapture) {\n            this.domListener = function (ev) { return _this.capture(ev); };\n        }\n        else {\n            this.domListener = function (ev) { return _this.bubble(ev); };\n        }\n        topElement.addEventListener(eventType, this.domListener, useCapture);\n    }\n    EventDelegator.prototype.bubble = function (rawEvent) {\n        if (!document.body.contains(rawEvent.currentTarget)) {\n            return;\n        }\n        var ev = this.patchEvent(rawEvent);\n        for (var el = ev.target; el && el !== this.roof; el = el.parentElement) {\n            if (ev.propagationHasBeenStopped) {\n                return;\n            }\n            this.matchEventAgainstDestinations(el, ev);\n        }\n    };\n    EventDelegator.prototype.matchEventAgainstDestinations = function (el, ev) {\n        for (var i = 0, n = this.destinations.length; i < n; i++) {\n            var dest = this.destinations[i];\n            if (!dest.scopeChecker.isStrictlyInRootScope(el)) {\n                continue;\n            }\n            if (matchesSelector(el, dest.selector)) {\n                this.mutateEventCurrentTarget(ev, el);\n                dest.subject._n(ev);\n            }\n        }\n    };\n    EventDelegator.prototype.capture = function (ev) {\n        for (var i = 0, n = this.destinations.length; i < n; i++) {\n            var dest = this.destinations[i];\n            if (matchesSelector(ev.target, dest.selector)) {\n                dest.subject._n(ev);\n            }\n        }\n    };\n    EventDelegator.prototype.addDestination = function (subject, namespace) {\n        var scope = utils_1.getScope(namespace);\n        var selector = utils_1.getSelectors(namespace);\n        var scopeChecker = new ScopeChecker_1.ScopeChecker(scope, this.isolateModule);\n        this.destinations.push({ subject: subject, scopeChecker: scopeChecker, selector: selector });\n    };\n    EventDelegator.prototype.patchEvent = function (event) {\n        var pEvent = event;\n        pEvent.propagationHasBeenStopped = false;\n        var oldStopPropagation = pEvent.stopPropagation;\n        pEvent.stopPropagation = function stopPropagation() {\n            oldStopPropagation.call(this);\n            this.propagationHasBeenStopped = true;\n        };\n        return pEvent;\n    };\n    EventDelegator.prototype.mutateEventCurrentTarget = function (event, currentTargetElement) {\n        try {\n            Object.defineProperty(event, "currentTarget", {\n                value: currentTargetElement,\n                configurable: true,\n            });\n        }\n        catch (err) {\n            console.log("please use event.ownerTarget");\n        }\n        event.ownerTarget = currentTargetElement;\n    };\n    EventDelegator.prototype.updateTopElement = function (newTopElement) {\n        this.topElement.removeEventListener(this.eventType, this.domListener, this.useCapture);\n        newTopElement.addEventListener(this.eventType, this.domListener, this.useCapture);\n        this.topElement = newTopElement;\n    };\n    return EventDelegator;\n}());\nexports.EventDelegator = EventDelegator;\n//# sourceMappingURL=EventDelegator.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/EventDelegator.js\n ** module id = 99\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/EventDelegator.js?');
},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_1 = __webpack_require__(19);\nvar xstream_adapter_1 = __webpack_require__(23);\nvar HTMLSource = (function () {\n    function HTMLSource(html$, runSA) {\n        this.runSA = runSA;\n        this._html$ = html$;\n        this._empty$ = runSA.adapt(xstream_1.default.empty(), xstream_adapter_1.default.streamSubscribe);\n    }\n    HTMLSource.prototype.elements = function () {\n        return this.runSA.adapt(this._html$, xstream_adapter_1.default.streamSubscribe);\n    };\n    HTMLSource.prototype.select = function (selector) {\n        return new HTMLSource(xstream_1.default.empty(), this.runSA);\n    };\n    HTMLSource.prototype.events = function (eventType, options) {\n        return this._empty$;\n    };\n    return HTMLSource;\n}());\nexports.HTMLSource = HTMLSource;\n//# sourceMappingURL=HTMLSource.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/HTMLSource.js\n ** module id = 100\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/HTMLSource.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_adapter_1 = __webpack_require__(23);\nvar xstream_1 = __webpack_require__(19);\nvar ElementFinder_1 = __webpack_require__(98);\nvar fromEvent_1 = __webpack_require__(103);\nvar isolate_1 = __webpack_require__(105);\nvar EventDelegator_1 = __webpack_require__(99);\nvar utils_1 = __webpack_require__(24);\nvar matchesSelector;\ntry {\n    matchesSelector = __webpack_require__(62);\n}\ncatch (e) {\n    matchesSelector = Function.prototype;\n}\nvar eventTypesThatDontBubble = [\n    "blur",\n    "canplay",\n    "canplaythrough",\n    "change",\n    "durationchange",\n    "emptied",\n    "ended",\n    "focus",\n    "load",\n    "loadeddata",\n    "loadedmetadata",\n    "mouseenter",\n    "mouseleave",\n    "pause",\n    "play",\n    "playing",\n    "ratechange",\n    "reset",\n    "scroll",\n    "seeked",\n    "seeking",\n    "stalled",\n    "submit",\n    "suspend",\n    "timeupdate",\n    "unload",\n    "volumechange",\n    "waiting",\n];\nfunction determineUseCapture(eventType, options) {\n    var result = false;\n    if (typeof options.useCapture === "boolean") {\n        result = options.useCapture;\n    }\n    if (eventTypesThatDontBubble.indexOf(eventType) !== -1) {\n        result = true;\n    }\n    return result;\n}\nvar MainDOMSource = (function () {\n    function MainDOMSource(_rootElement$, _runStreamAdapter, _namespace, _isolateModule, _delegators) {\n        if (_namespace === void 0) { _namespace = []; }\n        this._rootElement$ = _rootElement$;\n        this._runStreamAdapter = _runStreamAdapter;\n        this._namespace = _namespace;\n        this._isolateModule = _isolateModule;\n        this._delegators = _delegators;\n        this.isolateSource = isolate_1.isolateSource;\n        this.isolateSink = isolate_1.isolateSink;\n    }\n    MainDOMSource.prototype.elements = function () {\n        var output$;\n        if (this._namespace.length === 0) {\n            output$ = this._rootElement$;\n        }\n        else {\n            var elementFinder_1 = new ElementFinder_1.ElementFinder(this._namespace, this._isolateModule);\n            output$ = this._rootElement$.map(function (el) { return elementFinder_1.call(el); });\n        }\n        var runSA = this._runStreamAdapter;\n        return runSA.remember(runSA.adapt(output$, xstream_adapter_1.default.streamSubscribe));\n    };\n    Object.defineProperty(MainDOMSource.prototype, "namespace", {\n        get: function () {\n            return this._namespace;\n        },\n        enumerable: true,\n        configurable: true\n    });\n    MainDOMSource.prototype.select = function (selector) {\n        if (typeof selector !== \'string\') {\n            throw new Error("DOM driver\'s select() expects the argument to be a " +\n                "string as a CSS selector");\n        }\n        var trimmedSelector = selector.trim();\n        var childNamespace = trimmedSelector === ":root" ?\n            this._namespace :\n            this._namespace.concat(trimmedSelector);\n        return new MainDOMSource(this._rootElement$, this._runStreamAdapter, childNamespace, this._isolateModule, this._delegators);\n    };\n    MainDOMSource.prototype.events = function (eventType, options) {\n        if (options === void 0) { options = {}; }\n        if (typeof eventType !== "string") {\n            throw new Error("DOM driver\'s events() expects argument to be a " +\n                "string representing the event type to listen for.");\n        }\n        var useCapture = determineUseCapture(eventType, options);\n        var namespace = this._namespace;\n        var scope = utils_1.getScope(namespace);\n        var keyParts = [eventType, useCapture];\n        if (scope) {\n            keyParts.push(scope);\n        }\n        var key = keyParts.join(\'~\');\n        var domSource = this;\n        var rootElement$;\n        if (scope) {\n            var hadIsolated_mutable_1 = false;\n            rootElement$ = this._rootElement$\n                .filter(function (rootElement) {\n                var hasIsolated = !!domSource._isolateModule.getIsolatedElement(scope);\n                var shouldPass = hasIsolated && !hadIsolated_mutable_1;\n                hadIsolated_mutable_1 = hasIsolated;\n                return shouldPass;\n            });\n        }\n        else {\n            rootElement$ = this._rootElement$.take(2);\n        }\n        var event$ = rootElement$\n            .map(function setupEventDelegatorOnTopElement(rootElement) {\n            // Event listener just for the root element\n            if (!namespace || namespace.length === 0) {\n                return fromEvent_1.fromEvent(rootElement, eventType, useCapture);\n            }\n            // Event listener on the top element as an EventDelegator\n            var delegators = domSource._delegators;\n            var top = scope\n                ? domSource._isolateModule.getIsolatedElement(scope)\n                : rootElement;\n            var delegator;\n            if (delegators.has(key)) {\n                delegator = delegators.get(key);\n                delegator.updateTopElement(top);\n            }\n            else {\n                delegator = new EventDelegator_1.EventDelegator(top, eventType, useCapture, domSource._isolateModule);\n                delegators.set(key, delegator);\n            }\n            var subject = xstream_1.default.create();\n            if (scope) {\n                domSource._isolateModule.addEventDelegator(scope, delegator);\n            }\n            delegator.addDestination(subject, namespace);\n            return subject;\n        })\n            .flatten();\n        return this._runStreamAdapter.adapt(event$, xstream_adapter_1.default.streamSubscribe);\n    };\n    MainDOMSource.prototype.dispose = function () {\n        this._isolateModule.reset();\n    };\n    return MainDOMSource;\n}());\nexports.MainDOMSource = MainDOMSource;\n//# sourceMappingURL=MainDOMSource.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/MainDOMSource.js\n ** module id = 101\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/MainDOMSource.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar hyperscript_1 = __webpack_require__(45);\nvar classNameFromVNode_1 = __webpack_require__(283);\nvar selectorParser_1 = __webpack_require__(85);\nvar VNodeWrapper = (function () {\n    function VNodeWrapper(rootElement) {\n        this.rootElement = rootElement;\n    }\n    VNodeWrapper.prototype.call = function (vnode) {\n        var _a = selectorParser_1.default(vnode.sel), selectorTagName = _a.tagName, selectorId = _a.id;\n        var vNodeClassName = classNameFromVNode_1.default(vnode);\n        var vNodeData = vnode.data || {};\n        var vNodeDataProps = vNodeData.props || {};\n        var _b = vNodeDataProps.id, vNodeId = _b === void 0 ? selectorId : _b;\n        var isVNodeAndRootElementIdentical = vNodeId.toUpperCase() === this.rootElement.id.toUpperCase() &&\n            selectorTagName.toUpperCase() === this.rootElement.tagName.toUpperCase() &&\n            vNodeClassName.toUpperCase() === this.rootElement.className.toUpperCase();\n        if (isVNodeAndRootElementIdentical) {\n            return vnode;\n        }\n        var _c = this.rootElement, tagName = _c.tagName, id = _c.id, className = _c.className;\n        var elementId = id ? "#" + id : "";\n        var elementClassName = className ?\n            "." + className.split(" ").join(".") : "";\n        return hyperscript_1.h("" + tagName + elementId + elementClassName, {}, [vnode]);\n    };\n    return VNodeWrapper;\n}());\nexports.VNodeWrapper = VNodeWrapper;\n//# sourceMappingURL=VNodeWrapper.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/VNodeWrapper.js\n ** module id = 102\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/VNodeWrapper.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_1 = __webpack_require__(19);\nfunction fromEvent(element, eventName, useCapture) {\n    if (useCapture === void 0) { useCapture = false; }\n    return xstream_1.Stream.create({\n        element: element,\n        next: null,\n        start: function start(listener) {\n            this.next = function next(event) { listener.next(event); };\n            this.element.addEventListener(eventName, this.next, useCapture);\n        },\n        stop: function stop() {\n            this.element.removeEventListener(eventName, this.next, useCapture);\n        }\n    });\n}\nexports.fromEvent = fromEvent;\n//# sourceMappingURL=fromEvent.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/fromEvent.js\n ** module id = 103\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/fromEvent.js?')},function(module,exports,__webpack_require__){eval("\"use strict\";\nvar hyperscript_1 = __webpack_require__(45);\nfunction isValidString(param) {\n    return typeof param === 'string' && param.length > 0;\n}\nfunction isSelector(param) {\n    return isValidString(param) && (param[0] === '.' || param[0] === '#');\n}\nfunction createTagFunction(tagName) {\n    return function hyperscript(first, b, c) {\n        if (isSelector(first)) {\n            if (!!b && !!c) {\n                return hyperscript_1.h(tagName + first, b, c);\n            }\n            else if (!!b) {\n                return hyperscript_1.h(tagName + first, b);\n            }\n            else {\n                return hyperscript_1.h(tagName + first, {});\n            }\n        }\n        else if (!!b) {\n            return hyperscript_1.h(tagName, first, b);\n        }\n        else if (!!first) {\n            return hyperscript_1.h(tagName, first);\n        }\n        else {\n            return hyperscript_1.h(tagName, {});\n        }\n    };\n}\nvar SVG_TAG_NAMES = [\n    'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor',\n    'animateMotion', 'animateTransform', 'circle', 'clipPath', 'colorProfile',\n    'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix',\n    'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',\n    'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB',\n    'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode',\n    'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting',\n    'feSpotlight', 'feTile', 'feTurbulence', 'filter', 'font', 'fontFace',\n    'fontFaceFormat', 'fontFaceName', 'fontFaceSrc', 'fontFaceUri',\n    'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line',\n    'linearGradient', 'marker', 'mask', 'metadata', 'missingGlyph', 'mpath',\n    'path', 'pattern', 'polygon', 'polyling', 'radialGradient', 'rect', 'script',\n    'set', 'stop', 'style', 'switch', 'symbol', 'text', 'textPath', 'title',\n    'tref', 'tspan', 'use', 'view', 'vkern'\n];\nvar svg = createTagFunction('svg');\nSVG_TAG_NAMES.forEach(function (tag) {\n    svg[tag] = createTagFunction(tag);\n});\nvar TAG_NAMES = [\n    'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base',\n    'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption',\n    'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'dir', 'div', 'dl',\n    'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form',\n    'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html',\n    'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend',\n    'li', 'link', 'main', 'map', 'mark', 'menu', 'meta', 'nav', 'noscript',\n    'object', 'ol', 'optgroup', 'option', 'p', 'param', 'pre', 'progress', 'q',\n    'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small',\n    'source', 'span', 'strong', 'style', 'sub', 'sup', 'table', 'tbody', 'td',\n    'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'u', 'ul', 'video'\n];\nvar exported = { SVG_TAG_NAMES: SVG_TAG_NAMES, TAG_NAMES: TAG_NAMES, svg: svg, isSelector: isSelector, createTagFunction: createTagFunction };\nTAG_NAMES.forEach(function (n) {\n    exported[n] = createTagFunction(n);\n});\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = exported;\n//# sourceMappingURL=hyperscript-helpers.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/hyperscript-helpers.js\n ** module id = 104\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/hyperscript-helpers.js?")},function(module,exports,__webpack_require__){eval("\"use strict\";\nvar utils_1 = __webpack_require__(24);\nfunction isolateSource(source, scope) {\n    return source.select(utils_1.SCOPE_PREFIX + scope);\n}\nexports.isolateSource = isolateSource;\nfunction isolateSink(sink, scope) {\n    return sink.map(function (vTree) {\n        if (vTree.data.isolate) {\n            var existingScope = parseInt(vTree.data.isolate.split(utils_1.SCOPE_PREFIX + 'cycle')[1]);\n            var _scope = parseInt(scope.split('cycle')[1]);\n            if (Number.isNaN(existingScope) ||\n                Number.isNaN(_scope) ||\n                existingScope > _scope) {\n                return vTree;\n            }\n        }\n        vTree.data.isolate = utils_1.SCOPE_PREFIX + scope;\n        return vTree;\n    });\n}\nexports.isolateSink = isolateSink;\n//# sourceMappingURL=isolate.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/isolate.js\n ** module id = 105\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/isolate.js?")},function(module,exports){eval('"use strict";\nvar IsolateModule = (function () {\n    function IsolateModule(isolatedElements) {\n        this.isolatedElements = isolatedElements;\n        this.eventDelegators = new Map();\n    }\n    IsolateModule.prototype.setScope = function (elm, scope) {\n        this.isolatedElements.set(scope, elm);\n    };\n    IsolateModule.prototype.removeScope = function (scope) {\n        this.isolatedElements.delete(scope);\n    };\n    IsolateModule.prototype.getIsolatedElement = function (scope) {\n        return this.isolatedElements.get(scope);\n    };\n    IsolateModule.prototype.isIsolatedElement = function (elm) {\n        var elements = Array.from(this.isolatedElements.entries());\n        for (var i = 0; i < elements.length; ++i) {\n            if (elm === elements[i][1]) {\n                return elements[i][0];\n            }\n        }\n        return false;\n    };\n    IsolateModule.prototype.addEventDelegator = function (scope, eventDelegator) {\n        var delegators = this.eventDelegators.get(scope);\n        if (!delegators) {\n            delegators = [];\n            this.eventDelegators.set(scope, delegators);\n        }\n        delegators[delegators.length] = eventDelegator;\n    };\n    IsolateModule.prototype.reset = function () {\n        this.isolatedElements.clear();\n    };\n    IsolateModule.prototype.createModule = function () {\n        var self = this;\n        return {\n            create: function (oldVNode, vNode) {\n                var _a = oldVNode.data, oldData = _a === void 0 ? {} : _a;\n                var elm = vNode.elm, _b = vNode.data, data = _b === void 0 ? {} : _b;\n                var oldScope = oldData.isolate || "";\n                var scope = data.isolate || "";\n                if (scope) {\n                    if (oldScope) {\n                        self.removeScope(oldScope);\n                    }\n                    self.setScope(elm, scope);\n                    var delegators = self.eventDelegators.get(scope);\n                    if (delegators) {\n                        for (var i = 0, len = delegators.length; i < len; ++i) {\n                            delegators[i].updateTopElement(elm);\n                        }\n                    }\n                    else if (delegators === void 0) {\n                        self.eventDelegators.set(scope, []);\n                    }\n                }\n                if (oldScope && !scope) {\n                    self.removeScope(scope);\n                }\n            },\n            update: function (oldVNode, vNode) {\n                var _a = oldVNode.data, oldData = _a === void 0 ? {} : _a;\n                var elm = vNode.elm, _b = vNode.data, data = _b === void 0 ? {} : _b;\n                var oldScope = oldData.isolate || "";\n                var scope = data.isolate || "";\n                if (scope && scope !== oldScope) {\n                    if (oldScope) {\n                        self.removeScope(oldScope);\n                    }\n                    self.setScope(elm, scope);\n                }\n                if (oldScope && !scope) {\n                    self.removeScope(scope);\n                }\n            },\n            remove: function (_a, cb) {\n                var data = _a.data;\n                data = data || {};\n                var scope = data.isolate;\n                if (scope) {\n                    self.removeScope(scope);\n                    if (self.eventDelegators.get(scope)) {\n                        self.eventDelegators.set(scope, []);\n                    }\n                }\n                cb();\n            },\n            destroy: function (_a) {\n                var data = _a.data;\n                data = data || {};\n                var scope = data.isolate;\n                if (scope) {\n                    self.removeScope(scope);\n                    if (self.eventDelegators.get(scope)) {\n                        self.eventDelegators.set(scope, []);\n                    }\n                }\n            }\n        };\n    };\n    return IsolateModule;\n}());\nexports.IsolateModule = IsolateModule;\n//# sourceMappingURL=isolateModule.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/isolateModule.js\n ** module id = 106\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/isolateModule.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar snabbdom_1 = __webpack_require__(297);\nvar xstream_1 = __webpack_require__(19);\nvar MainDOMSource_1 = __webpack_require__(101);\nvar VNodeWrapper_1 = __webpack_require__(102);\nvar utils_1 = __webpack_require__(24);\nvar modules_1 = __webpack_require__(110);\nvar isolateModule_1 = __webpack_require__(106);\nvar transposition_1 = __webpack_require__(65);\nvar xstream_adapter_1 = __webpack_require__(23);\nfunction makeDOMDriverInputGuard(modules) {\n    if (!Array.isArray(modules)) {\n        throw new Error("Optional modules option must be " +\n            "an array for snabbdom modules");\n    }\n}\nfunction domDriverInputGuard(view$) {\n    if (!view$\n        || typeof view$.addListener !== "function"\n        || typeof view$.fold !== "function") {\n        throw new Error("The DOM driver function expects as input a Stream of " +\n            "virtual DOM elements");\n    }\n}\nfunction makeDOMDriver(container, options) {\n    if (!options) {\n        options = {};\n    }\n    var transposition = options.transposition || false;\n    var modules = options.modules || modules_1.default;\n    var isolateModule = new isolateModule_1.IsolateModule((new Map()));\n    var patch = snabbdom_1.init([isolateModule.createModule()].concat(modules));\n    var rootElement = utils_1.getElement(container);\n    var vnodeWrapper = new VNodeWrapper_1.VNodeWrapper(rootElement);\n    var delegators = new Map();\n    makeDOMDriverInputGuard(modules);\n    function DOMDriver(vnode$, runStreamAdapter) {\n        domDriverInputGuard(vnode$);\n        var transposeVNode = transposition_1.makeTransposeVNode(runStreamAdapter);\n        var preprocessedVNode$ = (transposition ? vnode$.map(transposeVNode).flatten() : vnode$);\n        var rootElement$ = preprocessedVNode$\n            .map(function (vnode) { return vnodeWrapper.call(vnode); })\n            .fold(patch, rootElement)\n            .drop(1)\n            .map(function unwrapElementFromVNode(vnode) { return vnode.elm; })\n            .compose(function (stream) { return xstream_1.default.merge(stream, xstream_1.default.never()); }) // don\'t complete this stream\n            .startWith(rootElement);\n        /* tslint:disable:no-empty */\n        rootElement$.addListener({ next: function () { }, error: function () { }, complete: function () { } });\n        /* tslint:enable:no-empty */\n        return new MainDOMSource_1.MainDOMSource(rootElement$, runStreamAdapter, [], isolateModule, delegators);\n    }\n    ;\n    DOMDriver.streamAdapter = xstream_adapter_1.default;\n    return DOMDriver;\n}\nexports.makeDOMDriver = makeDOMDriver;\n//# sourceMappingURL=makeDOMDriver.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/makeDOMDriver.js\n ** module id = 107\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/makeDOMDriver.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_adapter_1 = __webpack_require__(23);\nvar transposition_1 = __webpack_require__(65);\nvar HTMLSource_1 = __webpack_require__(100);\nvar toHTML = __webpack_require__(326);\n/* tslint:disable:no-empty */\nvar noop = function () { };\n/* tslint:enable:no-empty */\nfunction makeHTMLDriver(effect, options) {\n    if (!options) {\n        options = {};\n    }\n    var transposition = options.transposition || false;\n    function htmlDriver(vnode$, runStreamAdapter) {\n        var transposeVNode = transposition_1.makeTransposeVNode(runStreamAdapter);\n        var preprocessedVNode$ = (transposition ? vnode$.map(transposeVNode).flatten() : vnode$);\n        var html$ = preprocessedVNode$.last().map(toHTML);\n        html$.addListener({\n            next: effect || noop,\n            error: noop,\n            complete: noop,\n        });\n        return new HTMLSource_1.HTMLSource(html$, runStreamAdapter);\n    }\n    ;\n    htmlDriver.streamAdapter = xstream_adapter_1.default;\n    return htmlDriver;\n}\nexports.makeHTMLDriver = makeHTMLDriver;\n//# sourceMappingURL=makeHTMLDriver.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/makeHTMLDriver.js\n ** module id = 108\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/makeHTMLDriver.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_adapter_1 = __webpack_require__(23);\nvar xstream_1 = __webpack_require__(19);\nvar MockedDOMSource = (function () {\n    function MockedDOMSource(_streamAdapter, _mockConfig) {\n        this._streamAdapter = _streamAdapter;\n        this._mockConfig = _mockConfig;\n        if (_mockConfig.elements) {\n            this._elements = _mockConfig.elements;\n        }\n        else {\n            this._elements = _streamAdapter.adapt(xstream_1.default.empty(), xstream_adapter_1.default.streamSubscribe);\n        }\n    }\n    MockedDOMSource.prototype.elements = function () {\n        return this._elements;\n    };\n    MockedDOMSource.prototype.events = function (eventType, options) {\n        var mockConfig = this._mockConfig;\n        var keys = Object.keys(mockConfig);\n        var keysLen = keys.length;\n        for (var i = 0; i < keysLen; i++) {\n            var key = keys[i];\n            if (key === eventType) {\n                return mockConfig[key];\n            }\n        }\n        return this._streamAdapter.adapt(xstream_1.default.empty(), xstream_adapter_1.default.streamSubscribe);\n    };\n    MockedDOMSource.prototype.select = function (selector) {\n        var mockConfig = this._mockConfig;\n        var keys = Object.keys(mockConfig);\n        var keysLen = keys.length;\n        for (var i = 0; i < keysLen; i++) {\n            var key = keys[i];\n            if (key === selector) {\n                return new MockedDOMSource(this._streamAdapter, mockConfig[key]);\n            }\n        }\n        return new MockedDOMSource(this._streamAdapter, {});\n    };\n    return MockedDOMSource;\n}());\nexports.MockedDOMSource = MockedDOMSource;\nfunction mockDOMSource(streamAdapter, mockConfig) {\n    return new MockedDOMSource(streamAdapter, mockConfig);\n}\nexports.mockDOMSource = mockDOMSource;\n//# sourceMappingURL=mockDOMSource.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/mockDOMSource.js\n ** module id = 109\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/mockDOMSource.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar ClassModule = __webpack_require__(292);\nexports.ClassModule = ClassModule;\nvar PropsModule = __webpack_require__(295);\nexports.PropsModule = PropsModule;\nvar AttrsModule = __webpack_require__(291);\nexports.AttrsModule = AttrsModule;\nvar EventsModule = __webpack_require__(293);\nexports.EventsModule = EventsModule;\nvar StyleModule = __webpack_require__(296);\nexports.StyleModule = StyleModule;\nvar HeroModule = __webpack_require__(294);\nexports.HeroModule = HeroModule;\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.default = [StyleModule, ClassModule, PropsModule, AttrsModule];\n//# sourceMappingURL=modules.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/modules.js\n ** module id = 110\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/modules.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = Bom;\n\nvar _intent = __webpack_require__(119);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _model = __webpack_require__(120);\n\nvar _model2 = _interopRequireDefault(_model);\n\nvar _view = __webpack_require__(121);\n\nvar _view2 = _interopRequireDefault(_view);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction Bom(_ref) {\n  var DOM = _ref.DOM;\n  var props$ = _ref.props$;\n\n  var actions = (0, _intent2.default)(DOM);\n  var state$ = (0, _model2.default)(props$, actions);\n  var vtree$ = (0, _view2.default)(state$);\n\n  return {\n    DOM: vtree$,\n    events: {\n      entryTapped$: actions.entryTapped$,\n      entryDoubleTapped$: actions.entryDoubleTapped$,\n      entryLongTapped$: actions.entryLongTapped$,\n      editEntry$: actions.editEntry$,\n      addEntry$: actions.addEntry$,\n      removeEntry$: actions.removeEntry$\n    },\n    //FIXME: not sure\n    fileStorage: {\n      exportBOMAsJson$: actions.exportAsJson$,\n      exportBOMAsText$: actions.exportAsText$\n    }\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Bom/index.js\n ** module id = 111\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Bom/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _intent = __webpack_require__(122);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _model = __webpack_require__(123);\n\nvar _model2 = _interopRequireDefault(_model);\n\nvar _view = __webpack_require__(124);\n\nvar _view2 = _interopRequireDefault(_view);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction addExtraData(actions, props$) {\n  var entity$ = props$.pluck('entity');\n\n  // helper function, tor return uids (type/instance)\n  function getIds(entity) {\n    if (entity) {\n      return { typeUid: entity.typeUid, id: entity.id };\n    }\n    return { typeUid: undefined, id: undefined };\n  }\n\n  var addComment$ = actions.addComment$.withLatestFrom(entity$.map(getIds), function (commentText, entityData) {\n    return { text: commentText, target: entityData };\n  }).shareReplay(1);\n\n  return {\n    addComment$: addComment$ };\n}\n\nfunction Comments(_ref) {\n  var DOM = _ref.DOM;\n  var props$ = _ref.props$;\n\n  var actions = (0, _intent2.default)(DOM);\n  var state$ = (0, _model2.default)(props$, actions);\n  var vtree$ = (0, _view2.default)(state$);\n\n  return {\n    DOM: vtree$,\n    events: {\n      addComment$: addExtraData(actions, state$).addComment$\n    }\n  };\n}\n\nexports.default = Comments;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/index.js\n ** module id = 112\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _view = __webpack_require__(131);\n\nvar _view2 = _interopRequireDefault(_view);\n\nvar _intent = __webpack_require__(125);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//\n\n\n// import Comments from '../Comments'\nfunction model(props$, actions) {\n  return props$.map(function (props) {\n    var comments = props.comments;\n    var meta = props.meta;\n    var transforms = props.transforms;\n    var settings = props.settings;\n\n    return { comments: comments, meta: meta, transforms: transforms, settings: settings };\n  }).startWith({ comments: undefined, meta: undefined, transforms: undefined, settings: undefined }).distinctUntilChanged().shareReplay(1);\n}\n\n// err bad naming ..also should this be part of the model\n// faster object.assign\n\nfunction refineActions(props$, actions) {\n  var selections$ = props$.pluck('selections');\n  var transforms$ = props$.pluck('transforms').filter(_obsUtils.exists);\n  var activeTool$ = props$.pluck('settings', 'activeTool').distinctUntilChanged();\n\n  var changeTransformsBase$ = actions.changeTransforms$.withLatestFrom(transforms$, selections$, function (changed, transforms, selections) {\n    var _transforms = JSON.parse(JSON.stringify(transforms)); // FIXME : this is needed because of mutation bug\n    var avg = (0, _ramda.pluck)(changed.trans)(_transforms).reduce(function (acc, cur) {\n      if (!acc) return cur;\n      return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n        return x * 0.5;\n      });\n    }, undefined);\n\n    if (avg) {\n      avg[changed.idx] = changed.val;\n    }\n    //return {value: avg, trans: changed.trans, id: changed.idx, ids: selections}\n    return { value: avg, trans: changed.trans, ids: selections };\n  }).filter(function (x) {\n    return x.value !== undefined;\n  }).map(function (data) {\n    var value = data.value;\n    var trans = data.trans;\n    var ids = data.ids;\n\n    return ids.map(function (id) {\n      return { value: value, trans: trans, id: id };\n    });\n  }).share().tap(function (e) {\n    return console.log('transforms', e);\n  });\n\n  /*const selectionTransforms$ =\n    selections$.distinctUntilChanged()\n    .withLatestFrom(transforms$, (selections, transforms) => ({selections, transforms}))\n    .combineLatest(activeTool$, function ({selections, transforms}, activeTool) {\n      const trans = {'translate': 'pos', 'rotate': 'rot', 'scale': 'sca'}[activeTool]\n      let _transforms = JSON.parse(JSON.stringify(transforms)) // FIXME : this is needed because of mutation bug\n      let avg = pluck(trans)(_transforms)\n        .reduce(function (acc, cur) {\n          if(!acc) return cur\n          return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(x => x * 0.5)\n        }, undefined)\n      return {value: avg, trans: trans, ids: selections, cmd: 'reset'}\n    })\n    .filter(x=> x.value !== undefined && x.trans !== undefined)\n   const changeTransformsF$ = changeTransformsBase$.merge(selectionTransforms$)\n    function combiner (stream) {\n    return stream.scan(function (acc, changed) {\n      if(!acc) {\n        let diff = [0, 0, 0]\n        if(changed.id) {\n          diff[changed.id] = changed.value[changed.id]\n        }\n        //console.log('diff', diff, 'new', changed.value)\n        return [{diff, value: changed.value, trans: changed.trans, ids: changed.ids}]\n      }else{\n        if(changed.cmd === 'reset')// selection changed, reset\n        {\n          //console.log('selection changed, reseting')\n          let diff = [0, 0, 0]\n          //console.log('diff', diff, 'new', changed.value)\n          return [{diff, value: changed.value, trans: changed.trans, ids: changed.ids}]\n        }\n         if(acc.length < 2) { // adding a new one\n          acc.push(changed)\n        }\n        if(acc.length === 2) {\n          const [first, second] = acc\n          const diff = [second.value[0] - first.value[0], second.value[1] - first.value[1], second.value[2] - first.value[2]]\n          //console.log('diff', diff, 'old', first.value, 'new', second.value)\n          return [{diff, value: second.value, trans: second.trans, ids: second.ids}]\n        }\n      }\n    }, undefined)\n    .filter(x => x.length === 1)\n    .map(head)\n    .map(function(data){\n      const {diff, trans, ids} = data\n      return ids.map(function(id){\n        return {value: diff, trans, id}\n      })\n    })\n    .tap(e=>console.log('input FIRST',e))\n  }\n   const changeTransforms$ = combiner(changeTransformsF$)*/\n  var changeTransforms$ = changeTransformsBase$;\n  var resetScaling$ = actions.resetScaling$.withLatestFrom(selections$, function (_, selections) {\n    return { ids: selections };\n  }).filter(_obsUtils.exists).map(function (data) {\n    var ids = data.ids;\n\n    return ids.map(function (id) {\n      return { id: id };\n    });\n  });\n\n  return {\n    changeMeta$: actions.changeMeta$,\n    changeTransforms$: changeTransforms$,\n    resetScaling$: resetScaling$\n  };\n}\n\nfunction EntityInfos(_ref) {\n  var DOM = _ref.DOM;\n  var props$ = _ref.props$;\n  var name = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];\n\n  var _refineActions = refineActions(props$, (0, _intent2.default)(DOM));\n\n  var changeMeta$ = _refineActions.changeMeta$;\n  var changeTransforms$ = _refineActions.changeTransforms$;\n  var resetScaling$ = _refineActions.resetScaling$;\n\n  var state$ = model(props$);\n  var vtree$ = (0, _view2.default)(state$);\n\n  return {\n    DOM: vtree$,\n    events: {\n      changeMeta$: changeMeta$,\n      changeTransforms$: changeTransforms$,\n      resetScaling$: resetScaling$\n    }\n  };\n}\n\nexports.default = EntityInfos;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/index.js\n ** module id = 113\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/index.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _intent = __webpack_require__(132);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _model = __webpack_require__(133);\n\nvar _model2 = _interopRequireDefault(_model);\n\nvar _view = __webpack_require__(134);\n\nvar _view2 = _interopRequireDefault(_view);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// fyi for now, we hardcode some of the ui\nfunction Settings(_ref) {\n  var DOM = _ref.DOM;\n  var props$ = _ref.props$;\n  var name = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];\n\n  var actions = (0, _intent2.default)(DOM);\n  var state$ = (0, _model2.default)(props$, actions);\n  var vtree$ = (0, _view2.default)(state$);\n\n  return {\n    DOM: vtree$\n  };\n}\n\nexports.default = Settings;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/index.js\n ** module id = 114\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = main;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _Settings = __webpack_require__(114);\n\nvar _Settings2 = _interopRequireDefault(_Settings);\n\nvar _index = __webpack_require__(116);\n\nvar _index2 = _interopRequireDefault(_index);\n\nvar _Help = __webpack_require__(117);\n\nvar _Help2 = _interopRequireDefault(_Help);\n\nvar _wrappers = __webpack_require__(142);\n\nvar _intent = __webpack_require__(138);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _model = __webpack_require__(140);\n\nvar _model2 = _interopRequireDefault(_model);\n\nvar _view = __webpack_require__(141);\n\nvar _view2 = _interopRequireDefault(_view);\n\nvar _api = __webpack_require__(167);\n\nvar _api2 = _interopRequireDefault(_api);\n\nvar _formatDataForYMStorage = __webpack_require__(137);\n\nvar _formatDataForYMStorage2 = _interopRequireDefault(_formatDataForYMStorage);\n\nvar _formatDataForLocalStorage = __webpack_require__(136);\n\nvar _formatDataForLocalStorage2 = _interopRequireDefault(_formatDataForLocalStorage);\n\nvar _formatDataForFileStorage = __webpack_require__(135);\n\nvar _formatDataForFileStorage2 = _interopRequireDefault(_formatDataForFileStorage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar just = _rx2.default.Observable.just;\n\n// views & wrappers\n\nfunction main(sources) {\n  var DOM = sources.DOM;\n\n\n  var actions = (0, _intent2.default)(sources);\n  var state$ = (0, _model2.default)(undefined, actions, sources);\n\n  // create visual elements\n  var entityInfos = (0, _wrappers.EntityInfosWrapper)(state$, DOM);\n  var comments = (0, _wrappers.CommentsWrapper)(state$, DOM);\n  var gl = (0, _wrappers.GLWrapper)(state$, sources);\n  var bom = (0, _wrappers.BOMWrapper)(state$, DOM);\n  var settingsC = (0, _Settings2.default)({ DOM: DOM, props$: state$ });\n  var fsToggler = (0, _index2.default)({ DOM: DOM });\n  var help = (0, _Help2.default)({ DOM: DOM, props$: state$ });\n\n  // outputs\n  var vtree$ = (0, _view2.default)(state$, settingsC.DOM, fsToggler.DOM, bom.DOM, gl.DOM, entityInfos.DOM, comments.DOM, help.DOM);\n  var events$ = just({\n    gl: gl.events,\n    entityInfos: entityInfos.events,\n    bom: bom.events,\n    comments: comments.events });\n\n  var postMsg$ = (0, _api2.default)(actions, state$).postMsg$;\n\n  // localStorage\n  var localStorage$ = (0, _formatDataForLocalStorage2.default)({ sources: sources, state$: state$ });\n  // ymStorage\n  var ymStorage$ = (0, _formatDataForYMStorage2.default)({ sources: sources, state$: state$ });\n  // save file to user hdd\n  var fileStorage$ = (0, _formatDataForFileStorage2.default)({ sources: sources, state$: state$ }, bom);\n\n  // return anything you want to output to sources\n  return {\n    DOM: vtree$,\n    events: events$,\n    postMessage: postMsg$,\n\n    http: actions.requests.http$,\n    desktop: actions.requests.desktop$,\n    localStorage: localStorage$,\n    ym: ymStorage$,\n    clipBoard: fileStorage$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/index.js\n ** module id = 115\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/index.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _screenfull = __webpack_require__(282);\n\nvar _screenfull2 = _interopRequireDefault(_screenfull);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(342);\n\nfunction intent(_ref) {\n  var DOM = _ref.DOM;\n\n  var toggle$ = DOM.select(\'.fullScreenToggler\').events(\'click\').map(true).startWith(false).scan(function (acc, val) {\n    return !acc;\n  });\n\n  return toggle$;\n}\n\nfunction view(state$) {\n  return state$.map(function (toggle) {\n    if (_screenfull2.default.enabled) {\n      _screenfull2.default.toggle();\n    }\n    var tooltip = toggle ? \'exit fullscreen\' : \'fullscreen\';\n    var icon = void 0;\n    if (!_screenfull2.default.isFullscreen) {\n      icon = \'\\n        <svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 25 25" class=\\\'icon\\\'\\n              version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n        <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n        <title>fullscreen</title>\\n        <desc>Created with Sketch.</desc>\\n        <defs></defs>\\n        <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n            <path d="M23,8 L23,17 L29,12.5 L23,8 Z M15,12 L23,12 L23,13 L15,13 L15,12 Z M2,8 L2,17 L-4,12.5 L2,8 Z M10,12 L2,12 L2,13 L10,13 L10,12 Z" id="fullscreen" fill="#000000" transform="translate(12.500000, 12.500000) rotate(-45.000000) translate(-12.500000, -12.500000) "></path>\\n        </g>\\n      </svg>\';\n    } else {\n      icon = \'<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 25 25" class=\\\'icon\\\'\\n        version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n          <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n          <title>normal-screen</title>\\n          <desc>Created with Sketch.</desc>\\n          <defs></defs>\\n          <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n              <path d="M20.495689,7.99568901 L20.495689,16.995689 L14.495689,12.495689 L20.495689,7.99568901 Z M20.495689,11.995689 L28.495689,11.995689 L28.495689,12.995689 L20.495689,12.995689 L20.495689,11.995689 Z M4.49568901,7.99568901 L4.49568901,16.995689 L10.495689,12.495689 L4.49568901,7.99568901 Z M4.49568901,11.995689 L-3.50431099,11.995689 L-3.50431099,12.995689 L4.49568901,12.995689 L4.49568901,11.995689 Z" id="normal-screen" fill="#000000" transform="translate(12.495689, 12.495689) rotate(-45.000000) translate(-12.495689, -12.495689) "></path>\\n          </g>\\n      </svg>\';\n    }\n    return (0, _Menu2.default)({ toggle: toggle, icon: icon, klass: \'fullScreenToggler containerToggler\', tooltip: tooltip, tooltipPos: \'top\' });\n  });\n}\n\nfunction FullScreenToggler(_ref2) {\n  var DOM = _ref2.DOM;\n  var props = _ref2.props;\n\n  var state$ = intent({ DOM: DOM }); // cheating a bit\n  var vtree$ = view(state$);\n\n  return {\n    DOM: vtree$\n  };\n}\n\nexports.default = FullScreenToggler;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/FullScreenToggler/index.js\n ** module id = 116\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/FullScreenToggler/index.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = Help;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _classnames = __webpack_require__(34);\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromEvent = _rx2.default.Observable.fromEvent;\n\n\n__webpack_require__(343);\n\nfunction intent(DOM) {\n  // any outside taps close the settings\n  var outsideTaps$ = fromEvent(window, 'click').map(function (e) {\n    return e.target;\n  }).map(function (target) {\n    return document.querySelector('.help').contains(target);\n  }).filter(function (x) {\n    return x === false;\n  }); // we only care if it was clicked outside, not in\n\n  var toggle$ = DOM.select('.helpToggler').events('click').map(true).scan(function (acc, val) {\n    return !acc;\n  }).merge(outsideTaps$).takeUntil(outsideTaps$).repeat();\n\n  return { toggle$: toggle$ };\n}\n\nfunction model(props$, actions) {\n  var toggled$ = actions.toggle$.startWith(false);\n  var appVersion$ = props$.map(function (e) {\n    return e.appData.version;\n  });\n\n  return (0, _obsUtils.combineLatestObj)({ toggled$: toggled$, appVersion$: appVersion$ });\n}\n\nfunction view(state$) {\n  var helpIconSvg = '<svg preserveAspectRatio=\"xMidYMid meet\" width=\"50%\" viewBox=\"0 0 12 19\" class=\\'icon\\'\\n  version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>help</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n        <path d=\"M6,1.42108547e-14 C2.69142857,1.42108547e-14 0,2.77582739 0,6.18742 C0,6.66684952 0.384,7.05595173 0.857142857,7.05595173 C1.33028571,7.05595173 1.71428571,6.66684952 1.71428571,6.18742 C1.71428571,3.77463887 3.67714286,1.73706345 6,1.73706345 C8.36228571,1.73706345 10.2857143,3.66172975 10.2857143,6.02761017 C10.2857143,8.39175352 8.36228571,10.3164198 6,10.3164198 C5.52685714,10.3164198 5.14285714,10.705522 5.14285714,11.1849515 L5.14285714,13.3545438 C5.14285714,13.8339733 5.52685714,14.2230755 6,14.2230755 C6.47314286,14.2230755 6.85714286,13.8339733 6.85714286,13.3545438 L6.85714286,11.992686 C9.76114286,11.5740538 12,9.05878588 12,6.02761017 C12,2.70287073 9.30857143,1.42108547e-14 6,1.42108547e-14 Z M6,19 C6.94677386,19 7.71428571,18.2222902 7.71428571,17.2629366 C7.71428571,16.3035829 6.94677386,15.5258731 6,15.5258731 C5.05322614,15.5258731 4.28571429,16.3035829 4.28571429,17.2629366 C4.28571429,18.2222902 5.05322614,19 6,19 Z\" id=\"help\" fill=\"#000000\"></path>\\n    </g>\\n</svg>';\n\n  return state$.map(function (_ref) {\n    var toggled = _ref.toggled;\n    var appVersion = _ref.appVersion;\n\n    var content = (0, _snabbdomJsx.html)(\n      'section',\n      { className: (0, _classnames2.default)('content', { toggled: toggled }) },\n      (0, _snabbdomJsx.html)(\n        'span',\n        { className: 'helpItems' },\n        (0, _snabbdomJsx.html)(\n          'ul',\n          null,\n          (0, _snabbdomJsx.html)(\n            'li',\n            null,\n            'Click/tap and drag to rotate.'\n          ),\n          (0, _snabbdomJsx.html)(\n            'li',\n            null,\n            'Mouse wheel to zoom.'\n          ),\n          (0, _snabbdomJsx.html)(\n            'li',\n            null,\n            'Single click/tap to select items.'\n          ),\n          (0, _snabbdomJsx.html)(\n            'li',\n            null,\n            'Double click/tap to zoom on points/objects.'\n          ),\n          (0, _snabbdomJsx.html)(\n            'li',\n            null,\n            'Long press/click on objects to start multi selection: (ie longpress on an object, then select any additional objects/ unselect them via single click/tap)'\n          ),\n          (0, _snabbdomJsx.html)(\n            'li',\n            null,\n            'Click/tap outside of any object in the 3d view to clear all selections'\n          )\n        )\n      ),\n      (0, _snabbdomJsx.html)(\n        'span',\n        { className: 'appVersion' },\n        'Jam version ',\n        appVersion\n      )\n    );\n\n    return (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'help' },\n      (0, _Menu2.default)({ toggled: toggled, icon: helpIconSvg, klass: 'containerToggler helpToggler',\n        tooltip: 'help', tooltipPos: 'top', content: content, contentPosition: 'top', arrow: false })\n    );\n  });\n}\n\nfunction Help(_ref2) {\n  var DOM = _ref2.DOM;\n  var props$ = _ref2.props$;\n  var name = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];\n\n  var actions = intent(DOM);\n  var state$ = model(props$, actions);\n  var vtree$ = view(state$);\n\n  return {\n    DOM: vtree$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/Help/index.js\n ** module id = 117\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/Help/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = bom;\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction upsertBomEntry(state, input) {\n  var index = (0, _ramda.findIndex)((0, _ramda.propEq)('id', input.id))(state);\n\n  if (index === -1) {\n    // if we have a bom entry that is new\n    var bomEntryDefaults = {\n      name: undefined,\n      qty: 0,\n      _qtyOffset: 0, // this is for \"dynamic\" entities only , and should be disregarded when saving the bom\n      phys_qty: 0,\n      version: '0.0.1',\n      unit: 'EA',\n      printable: true,\n      dynamic: false\n    };\n    var entry = (0, _modelUtils.mergeData)(bomEntryDefaults, input.data);\n    state = state.concat((0, _utils.toArray)(entry));\n    return state;\n  } else {\n    // we already have this same bom entry\n    state = [].concat(_toConsumableArray(state.slice(0, index)), [(0, _modelUtils.mergeData)(state[index], input.data)], _toConsumableArray(state.slice(index + 1)));\n    return state;\n  }\n}\n\nfunction upsertBomEntries(state, input) {\n  console.log('upsert BOM entries', state, input);\n  var newData = (0, _utils.toArray)(input) || [];\n  return newData.filter(_utils.exists).reduce(function (state, entry) {\n    return upsertBomEntry(state, entry);\n  }, state);\n  // let entries = flatten( newData.filter(exists).map(upsertBomEntry.bind(null,state)) )\n}\n\n// remove an entry\nfunction removeBomEntries(state, inputs) {\n  console.log('removeBomEntries', inputs);\n  return inputs.reduce(function (state, input) {\n    var index = (0, _ramda.findIndex)((0, _ramda.propEq)('id', input.id))(state);\n    state = [].concat(_toConsumableArray(state.slice(0, index)), _toConsumableArray(state.slice(index + 1)));\n    return state;\n  }, state);\n}\n\nfunction clearBomEntries(state, input) {\n  return [];\n}\n\nfunction updateBomEntries(state, inputs) {\n  var typeMapping = {\n    'qty': function qty(value) {\n      return Math.max(Math.round(value), 0);\n    }, // quantities of parts are always positive, always integers\n    'phys_qty': function phys_qty(value) {\n      return Math.max(value, 0);\n    } // physical quantities in our cases are always positive (no negative lengths, weifhts, volumes)\n  };\n\n  inputs = inputs.map(function (_ref) {\n    var attrName = _ref.attrName;\n    var id = _ref.id;\n    var value = _ref.value;\n\n    var data = {};\n    data[attrName] = value;\n    data = (0, _utils.coerceTypes)(typeMapping, data);\n    return (0, _modelUtils.mergeData)({ id: id }, { data: data });\n  });\n  return upsertBomEntries(state, inputs);\n}\n\n// these are only for dynamic entries ie : if a part gets duplicated , deleted etc\n// as such they are dealt with seperatly\nfunction updateBomEntriesCount(state, inputs) {\n  console.log('updateBomEntriesCount', inputs);\n  return inputs.reduce(function (state, _ref2) {\n    var id = _ref2.id;\n    var offset = _ref2.offset;\n\n    // TODO: refactor\n    var idx = (0, _ramda.findIndex)((0, _ramda.propEq)('id', id))(state);\n    if (idx === -1) {\n      return state;\n    }\n    var entries = (0, _ramda.adjust)(function (item) {\n      var _qtyOffset = Math.max(item._qtyOffset + offset, 0);\n      var qty = Math.max(item.qty + offset, _qtyOffset);\n      return (0, _modelUtils.mergeData)({}, item, { _qtyOffset: _qtyOffset, qty: qty, dynamic: true });\n    }, (0, _ramda.findIndex)((0, _ramda.propEq)('id', id))(state) // get index of the one we want to change\n    , state);\n\n    return entries;\n  }, state);\n}\n\nfunction bom(actions) {\n  var defaults = [];\n  var updateFns = { upsertBomEntries: upsertBomEntries, updateBomEntries: updateBomEntries, updateBomEntriesCount: updateBomEntriesCount, removeBomEntries: removeBomEntries, clearBomEntries: clearBomEntries };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/bom/index.js\n ** module id = 118\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/bom/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _utils = __webpack_require__(3);\n\nvar _otherUtils = __webpack_require__(47);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction intent(DOM) {\n\n  var entryTaps$ = DOM.select('.bom .normal').events('click', true) // capture == true\n  .tap(function (e) {\n    return e.stopPropagation();\n  }).map(function (e) {\n    return { id: e.target.dataset.id, selected: (0, _utils.stringToBoolean)(e.target.dataset.selected) };\n  });\n\n  var entryMultiTaps$ = entryTaps$.buffer(entryTaps$.debounce(250)).map(function (list) {\n    return { item: list[0], nb: list.length };\n  }).shareReplay(10);\n\n  var entryTapped$ = entryMultiTaps$.filter(function (data) {\n    return data.nb === 1;\n  }).pluck('item');\n  //.shareReplay(1)\n\n  var entryDoubleTapped$ = entryMultiTaps$.filter(function (data) {\n    return data.nb === 2;\n  }).pluck('item').tap(function (e) {\n    return console.log('entryDoubleTapped', e);\n  });\n  //.shareReplay(1)\n\n  var entryLongTapped$ = DOM.select('.bom .normal').events('mousedown', true).flatMap(function (downEvent) {\n    return _rx2.default.Observable.amb([\n    // Skip if we get a movement before a mouse up\n    DOM.select('.bom').events('mousemove', true).take(1).flatMap(function (x) {\n      return _rx2.default.Observable.empty();\n    }).timeInterval(),\n    // also if there was some other event: FIXME : convoluted\n    /*merge(\n    editEntry$,\n    exportAsText$,\n    exportAsJson$\n    ).timeInterval(),*/\n    DOM.select('.bom .normal').events('mouseup', true).take(1).timeInterval()]);\n  }).filter(function (e) {\n    return e.interval > 250;\n  });\n\n  var headerTapped$ = DOM.select('.headerCell').events('click', true).tap(function (e) {\n    return e.stopPropagation();\n  });\n\n  var removeEntryRequest$ = DOM.select('.bom .removeBomEntry').events('click').tap(function (e) {\n    return e.stopPropagation();\n  }).map(function (e) {\n    var actualTarget = e.currentTarget.dataset;\n    return {\n      id: actualTarget.id\n    };\n  });\n\n  var removeEntryRequestCancel$ = DOM.select('.bom .removal .cancel').events('click').tap(function (e) {\n    return e.stopPropagation();\n  }).map(function (e) {\n    var actualTarget = e.target.dataset;\n    return {\n      id: actualTarget.id\n    };\n  });\n\n  var removeEntry$ = DOM.select('.bom .removal .confirm').events('click') // DOM.select('.bom .removeBomEntry').events('click')\n  .tap(function (e) {\n    return e.stopPropagation();\n  }).map(function (e) {\n    var actualTarget = e.target.dataset;\n    return {\n      id: actualTarget.id\n    };\n  }).share();\n\n  var addEntryTapped$ = DOM.select('.addBomEntry').events('click').tap(function (e) {\n    e.preventDefault();\n    return false;\n  }).share().tap(function (e) {\n    return console.log('addEntryTapped');\n  });\n  // .map(e=>getFormResults(e.target))\n\n  var newEntryValues$ = (0, _obsUtils.combineLatestObj)({\n    name$: DOM.select('.bom .adder input[name=\"name\"]').events('change').map(function (e) {\n      return e.target.value;\n    }).startWith(''),\n    qty$: DOM.select('.bom .adder input[name=\"qty\"]').events('change').map(function (e) {\n      return e.target.value;\n    }).startWith(0),\n    phys_qty$: DOM.select('.bom .adder input[name=\"phys_qty\"]').events('change').map(function (e) {\n      return e.target.value;\n    }).startWith(0),\n    unit$: DOM.select('.bom .adder select[name=\"unit\"]').events('change').map(function (e) {\n      return e.target.value;\n    }).startWith('EA'),\n    printable$: DOM.select('.bom .adder [name=\"printable\"]').events('change').map(function (e) {\n      return e.target.checked;\n    }).startWith(false)\n  }).share();\n\n  var addEntry$ = addEntryTapped$.withLatestFrom(newEntryValues$, function (_, data) {\n    return data;\n  }).filter(function (data) {\n    return data.name !== '';\n  }).map(function (data) {\n    // inject extra data\n    document.querySelector('.adderTextInput').value = ''; // clears the inputfield value so it uses the default placeholder again\n    return (0, _modelUtils.mergeData)({}, data, { id: (0, _utils.generateUUID)() });\n  }).tap(function (e) {\n    return console.log(\"raw addEntry data\", e);\n  }).share(); // VERY important, you don't want duplicate uuid generation etc\n\n  //  const addEntry$ = getFieldValues({name:'', qty:0, phys_qty:0, unit:'EA', printable:false}, DOM, '.bom .adder', addEntryTapped$)\n\n  DOM.select('.bomTextInput').events('blur').forEach(function (e) {\n    return (0, _otherUtils.forceTextEllipsis)(e.target);\n  });\n\n  DOM.select('.bomTextInput').events('click').forEach(function (e) {\n    return (0, _otherUtils.easyElipsedTextSelection)(e.target);\n  });\n\n  var changeEntryValue$ = DOM.select('.bom .normal input[type=text]').events('change').tap(function (e) {\n    return (0, _otherUtils.forceTextEllipsis)(e.target);\n  }).merge(DOM.select('.bom .normal input[type=number]').events('change')).tap(function (e) {\n    return e.stopPropagation();\n  }).tap(function (e) {\n    e.preventDefault();\n    return false;\n  }).map(function (e) {\n    //forceTextEllipsis(e.target)\n    var actualTarget = e.target.parentElement.dataset;\n    return {\n      id: actualTarget.id,\n      attrName: actualTarget.name,\n      value: e.target.value\n    };\n  });\n\n  var checkEntry$ = DOM.select('.bom .normal input[type=checkbox]').events('change').tap(function (e) {\n    return e.stopPropagation();\n  }).map(function (e) {\n    var actualTarget = e.target.parentElement.parentElement.dataset;\n    return {\n      id: actualTarget.id,\n      attrName: actualTarget.name,\n      value: e.target.checked\n    };\n  }).tap(function (e) {\n    return console.log('checkboxing entry', e);\n  });\n\n  var entryOptionChange$ = DOM.select('.bom .normal select').events('change').do(function (e) {\n    return e.stopPropagation();\n  }).map(function (e) {\n    var actualTarget = e.target.parentElement.dataset;\n    return {\n      id: actualTarget.id,\n      attrName: actualTarget.name,\n      value: e.target.value\n    };\n  });\n\n  var editEntry$ = merge(changeEntryValue$, checkEntry$, entryOptionChange$).tap(function (e) {\n    return console.log('editEntry', e);\n  });\n\n  var toggle$ = DOM.select('.bomToggler').events('click') // toggle should be scoped?\n  .map(true).scan(function (acc, val) {\n    return !acc;\n  }, false); // intitial value of scan needs to match the one of \"startWith\" in \"toggled\" model\n\n  var exportAsJson$ = DOM.select('.bom-as-json').events('click').tap(function (e) {\n    return console.log('exportAsJson');\n  });\n\n  var exportAsText$ = DOM.select('.bom-as-text').events('click').tap(function (e) {\n    return console.log('exportAsText');\n  });\n\n  return {\n    entryTapped$: entryTapped$,\n    entryDoubleTapped$: entryDoubleTapped$,\n    entryLongTapped$: entryLongTapped$,\n    headerTapped$: headerTapped$,\n\n    addEntry$: addEntry$,\n    editEntry$: editEntry$,\n    removeEntryRequest$: removeEntryRequest$,\n    removeEntryRequestCancel$: removeEntryRequestCancel$,\n    removeEntry$: removeEntry$,\n\n    exportAsJson$: exportAsJson$,\n    exportAsText$: exportAsText$,\n\n    toggle$: toggle$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Bom/intent.js\n ** module id = 119\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Bom/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = model;\n\nvar _utils = __webpack_require__(3);\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction sortBy(fieldName) {\n  return function (a, b) {\n    var A = a[fieldName];\n    var B = b[fieldName];\n    // convert numbers presented as strings into actual numbers\n    A = isNaN(Number(A)) ? A : Number(A);\n    B = isNaN(Number(B)) ? B : Number(B);\n    if (typeof A === 'string') {\n      // change strings to lowercase because else all capital letters go first.\n      A = A.toLowerCase();\n      B = B.toLowerCase();\n    }\n    if (A > B) {\n      return 1;\n    }\n    if (A < B) {\n      return -1;\n    }\n    // a must be equal to b\n    return 0;\n  };\n}\n\nfunction model(props$, actions) {\n  var fieldNames$ = props$.pluck('fieldNames').startWith([]).filter(_obsUtils.exists);\n  // const sortableFields$ = props$.pluck('sortableFields').startWith([]).filter(exists)\n  var editableFields$ = props$.pluck('editableFields').startWith([]).filter(_obsUtils.exists);\n  var entries$ = props$.pluck('entries').startWith([]).filter(_obsUtils.exists);\n  var fieldDescriptions$ = props$.pluck('fieldDescriptions').startWith({});\n  var fieldTypes$ = props$.pluck('fieldTypes').startWith({});\n  var units$ = props$.pluck('units').startWith([]);\n  var selectedEntries$ = props$.pluck('selectedEntries').startWith([]).filter(_obsUtils.exists).distinctUntilChanged().shareReplay(1);\n  var readOnly$ = props$.pluck('readOnly').startWith(false);\n\n  // observable of current sorting field (what field do we sort by)\n  var sortFieldName$ = actions.headerTapped$.map(function (e) {\n    return e.currentTarget.dataset.name;\n  }).startWith(undefined);\n  // .filter( name => sortableFields.indexOf(name)>1 )\n\n  // ascending, descending, neutral\n  var sortablesDirection$ = actions.headerTapped$.map(function (e) {\n    return undefined;\n  }).scan(function (acc, x) {\n    if (!acc) return true;\n    return !acc;\n  }, false).startWith(undefined);\n\n  // actual entries (filtered, sorted etc)\n  var sortedEntries$ = entries$.combineLatest(sortFieldName$, sortablesDirection$, function (entries, sortFieldName, direction) {\n    if (!sortFieldName) return entries;\n\n    var output = entries.sort(sortBy(sortFieldName));\n    if (direction !== undefined && direction === false) {\n      output = output.reverse();\n    }\n    return output;\n  });\n\n  // //////\n  var toggled$ = actions.toggle$.startWith(false);\n\n  var removeEntryRequested$ = actions.removeEntryRequest$.startWith(undefined).merge(actions.removeEntryRequestCancel$.map(undefined)).merge(actions.removeEntry$.map(undefined)).tap(function (e) {\n    return console.log('removeEntryRequested', e);\n  });\n\n  function makeNewEntryDefaults() {\n    var newEntryDefaults = {\n      name: '',\n      qty: 0,\n      _qtyOffset: 0, // this is for \"dynamic\" entities only , and should be disregarded when saving the bom\n      phys_qty: 0,\n      version: '0.0.1',\n      unit: 'EA',\n      printable: false,\n      _adder: true, // special flag for adder\n      id: (0, _utils.generateUUID)() // this is a what allows forcing the dom to refresh\n    };\n    return newEntryDefaults;\n  }\n\n  var newEntryValues$ = actions.addEntry$.map(function (e) {\n    return makeNewEntryDefaults();\n  }).startWith(makeNewEntryDefaults()).tap(function (e) {\n    return console.log('reseting add entry field to', e);\n  });\n\n  return (0, _obsUtils.combineLatestObj)({ entries$: sortedEntries$, selectedEntries$: selectedEntries$, fieldNames$: fieldNames$, sortFieldName$: sortFieldName$, sortablesDirection$: sortablesDirection$, editableFields$: editableFields$, fieldDescriptions$: fieldDescriptions$, fieldTypes$: fieldTypes$, units$: units$,\n    newEntryValues$: newEntryValues$, toggled$: toggled$, removeEntryRequested$: removeEntryRequested$, readOnly$: readOnly$ });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Bom/model.js\n ** module id = 120\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Bom/model.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = view;\n\nvar _dom = __webpack_require__(16);\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _classnames = __webpack_require__(34);\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _ramda = __webpack_require__(4);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(330);\n\nfunction view(state$) {\n  return state$.distinctUntilChanged().map(function (_ref) {\n    var entries = _ref.entries;\n    var selectedEntries = _ref.selectedEntries;\n    var fieldNames = _ref.fieldNames;\n    var sortFieldName = _ref.sortFieldName;\n    var sortablesDirection = _ref.sortablesDirection;\n    var editableFields = _ref.editableFields;\n    var fieldDescriptions = _ref.fieldDescriptions;\n    var fieldTypes = _ref.fieldTypes;\n    var units = _ref.units;\n    var newEntryValues = _ref.newEntryValues;\n    var toggled = _ref.toggled;\n    var removeEntryRequested = _ref.removeEntryRequested;\n    var readOnly = _ref.readOnly;\n\n    var direction = sortablesDirection;\n    // const readOnly = true // for testing\n\n    /*const exportIconSvg = `<svg version=\"1.1\" id=\"Flag\" xmlns=\"http://www.w3.org/2000/svg\"\n      width=\"16\" height=\"16\" x=\"0px\" y=\"0px\" viewBox=\"0 0 20 20\" enable-background=\"new 0 0 20 20\" class=\"icon\">\n    <path d=\"M18.926,5.584c-9.339,13.568-6.142-0.26-14.037,6.357L6.684,19H4.665L1,4.59l1.85-0.664\n      c8.849-6.471,4.228,5.82,15.637,1.254C18.851,5.033,19.142,5.27,18.926,5.584z\"/>\n    </svg>`\n     const exportSubItems = <span>\n      <button className='bom-as-json' value='bom-as-json'>Export as json</button>\n      <button className='bom-as-text' value='bom-as-text'>Export as plain text</button>\n    </span>\n     const exportButton = Menu(true\n      , exportIconSvg, 'exportBOMData', 'export', 'bottom', false, exportSubItems)*/\n    var exportButtons = (0, _dom.h)('span', [(0, _dom.h)('button.bom-as-json', { props: { value: 'bom-as-json' } }, [(0, _dom.h)('span.tooltip-bottom', { attrs: { 'data-tooltip': 'copy to clipboard as Json' } }, ['json'])]), (0, _dom.h)('button.bom-as-text', { props: { value: 'bom-as-text' } }, [(0, _dom.h)('span.tooltip-bottom', { attrs: { 'data-tooltip': 'copy to clipboard as text' } }, ['text'])])]);\n    /*<span>\n      <button className='bom-as-json' value='bom-as-json' >\n        <span className='tooltip-bottom' attributes={{'data-tooltip': 'copy to clipboard as Json'}}> json </span> </button>\n      <button className='bom-as-text' value='bom-as-text'>\n        <span className='tooltip-bottom' attributes={{'data-tooltip': 'copy to clipboard as text'}}> text </span> </button>\n      </span>*/\n    //\n\n    // PRIMARY DOM-FUNCTIONS\n    function getHeaderRow() {\n      var cells = fieldNames.map(function (name) {\n        var editable = editableFields.indexOf(name) > -1;\n        var toolTip = editable ? '(editable) ' + fieldDescriptions[name] : fieldDescriptions[name];\n        var columnName = 'column' + fieldNames.indexOf(name);\n\n        var sortArrow = getSortArrow(name, direction);\n        var lastInRow = fieldNames.indexOf(name) === fieldNames.length - 1;\n        var thContent = (0, _dom.h)('span', { attrs: { 'data-tooltip': toolTip } }, [name, sortArrow]); // <span className='tooltip-bottom' attributes={{'data-tooltip': toolTip}}>{name} {sortArrow}</span>\n        return (0, _dom.h)('th', { props: { className: 'headerCell ' + columnName },\n          attrs: { 'data-name': name, 'colspan': lastInRow ? '1' : '1' } }, [thContent]);\n        /*(\n          <th className={`headerCell ${columnName}`} attributes={{'data-name': name, 'colspan': lastInRow ? '1' : '1'}}>\n            {thContent}\n          </th>\n        )*/\n      }).concat([(0, _snabbdomJsx.html)(\n        'th',\n        { className: 'export' },\n        exportButtons\n      )]); // for 'hidden field to add/remove entries'\n      return (0, _snabbdomJsx.html)(\n        'tr',\n        { className: 'headerRow' },\n        cells\n      );\n    }\n\n    function getAdderRow(adderFieldsArray) {\n      return adderFieldsArray.map(function (row, index) {\n        var placeholder = row.hasOwnProperty('_adder') ? 'f.e:velcro, nuts, bolts' : 'not specified';\n        var cells = getCells(row, placeholder);\n        var adder = (0, _dom.h)('tr.adderRow', cells);\n        /*  <tr className='adderRow'>\n            {cells}\n          </tr> */\n\n        return adder;\n      }).concat([]);\n    }\n\n    function getTableBody(bodyFieldsArray) {\n      return bodyFieldsArray.map(function (row, index) {\n        var cells = getCells(row);\n        return getRow(row, cells, index);\n      });\n    }\n\n    // HELPER FUNCTIONS\n    function getRow(row, cells) {\n      var index = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];\n\n      var selected = selectedEntries.indexOf(row.id) > -1;\n      if (removeEntryRequested !== undefined && removeEntryRequested.id === row.id) {\n        // deletion row\n        //<button className='confirm' attributes={{'data-name': row.name, 'data-id': row.id}}> Yes </button>\n        var confirmButton = (0, _dom.h)('button.confirm', { attrs: { 'data-name': row.name, 'data-id': row.id } }, ['yes']);\n        var cancelButton = (0, _dom.h)('button.cancel', ['no']);\n        return (0, _dom.h)('tr.test.removal', { attrs: { 'data-name': row.name, 'data-id': row.id } }, [(0, _dom.h)('td.cell', { attrs: { 'colspan': '100%' } }, [(0, _dom.h)('span', ['This will delete this part (and its copies), are you sure ?']), (0, _dom.h)('span', [confirmButton, cancelButton])])]);\n        /*(<tr className='test removal' attributes={{'data-name': row.name, 'data-id': row.id}} key={index}>\n               <td className='cell' attributes={{colspan: '100%'}}>\n                 <span>This will delete this part (and its copies), are you sure ?</span>\n                 <span>\n                  {confirmButton}\n                  <button className='cancel'> No </button></span>\n               </td>\n             </tr>)*/\n      } else {\n        // normal row\n        //key: index,\n        return (0, _dom.h)('tr', { class: { test: true, normal: true, selected: selected }, attrs: { 'data-name': row.name, 'data-id': row.id } }, cells);\n        /*(\n        <tr className={Class('test', 'normal', {selected})} attributes={{'data-name': row.name, 'data-id': row.id}} key={index}>\n         {cells}\n        </tr>\n        )*/\n      }\n    }\n\n    function getCells(row, placeholder) {\n      var baseClassName = row.hasOwnProperty('_adder') ? 'adder cell' : 'bomEntry cell';\n      var selected = selectedEntries.indexOf(row.id) > -1;\n\n      var cells = fieldNames.map(function (name) {\n        var columnName = 'column' + fieldNames.indexOf(name);\n\n        var cellToolTip = void 0;\n        cellToolTip = readOnly ? undefined : cellToolTip; // if the field is disabled do not add any extra toolTip\n\n        var value = getInputField(row, name, placeholder);\n        return (0, _dom.h)('td', { props: { className: baseClassName + ' ' + columnName + ' ' + name },\n          attrs: { 'data-name': name, 'data-id': row.id, 'data-selected': selected } }, [value]);\n\n        /*(<td className={`${baseClassName} ${columnName} ${name}`} attributes={{'data-name': name, 'data-id': row.id}}>\n                  {value}\n                </td>)*/\n      });\n      if (!readOnly) {\n        cells.push((0, _dom.h)('td', { props: { className: baseClassName + ' ' + ('column' + fieldNames.length) } }, [getModifierButton(row)]));\n        /*<td className={`${baseClassName} ${'column' + fieldNames.length}`}>\n                    {getModifierButton(row)}\n                  </td>*/\n      }\n      return cells;\n    }\n\n    function getModifierButton(row) {\n      var isAdder = row.hasOwnProperty('_adder');\n      if (isAdder) {\n        return (0, _snabbdomJsx.html)(\n          'button',\n          { type: 'button', className: 'addBomEntry' },\n          'Add'\n        );\n      } else {\n        return (0, _dom.h)('button.removeBomEntry', { attrs: { 'data-name': '', 'data-id': row.id } }, [(0, _dom.h)('span.tooltip-bottom', { props: { innerHTML: getIcon('delete') }, attrs: { 'data-tooltip': 'remove this part type' } })]);\n\n        /*(<button type='button' className='removeBomEntry' attributes={{'data-name': '', 'data-id': row.id}}>\n                  <span innerHTML={getIcon('delete')}/>\n                </button>)*/\n      }\n    }\n\n    function getSortArrow(name, direction) {\n      if (direction !== undefined && sortFieldName === name) {\n        if (direction) {\n          return (0, _snabbdomJsx.html)(\n            'span',\n            { className: 'directionArrow' },\n            (0, _snabbdomJsx.html)('span', { className: 'asc' })\n          );\n        } else {\n          return (0, _snabbdomJsx.html)(\n            'span',\n            { className: 'directionArrow' },\n            (0, _snabbdomJsx.html)('span', { className: 'desc' })\n          );\n        }\n      } else if (direction === undefined || sortFieldName !== name) {\n        return (0, _snabbdomJsx.html)(\n          'span',\n          { className: 'directionArrow' },\n          (0, _snabbdomJsx.html)('span', { className: 'neut' })\n        );\n      }\n    }\n\n    function getInputField(row, name, placeholder) {\n      //FIXME: data attributes should be added to these directly?\n      var isDynamic = row.dynamic; // row['_qtyOffset'] !== 0 ? true: false //are we dealing with a 'dynamic' entry ie from a 3d file\n      var disabled = isDynamic && (name === 'phys_qty' || name === 'unit') || readOnly; // if readony or if we have a dynamic entry called phys_qty, disable\n      var dataValue = isDynamic && name === 'phys_qty' ? null : row[name];\n      var className = row._adder !== undefined ? 'adderTextInput' : 'bomTextInput';\n\n      switch (fieldTypes[name]) {\n        case 'text':\n          return (0, _snabbdomJsx.html)('input', {\n            type: 'text',\n            value: dataValue,\n            name: name,\n            placeholder: placeholder,\n            className: className,\n            disabled: disabled });\n        case 'number':\n          var steps = name === 'qty' ? 1 : 0.01;\n          var min = isDynamic ? row['_qtyOffset'] : 0;\n          return (0, _snabbdomJsx.html)('input', {\n            type: 'number',\n            value: dataValue,\n            min: min,\n            steps: steps,\n            name: name,\n            disabled: disabled });\n        case 'boolean':\n          return (0, _Checkbox2.default)({ checked: dataValue, value: dataValue, name: name, disabled: disabled, id: (0, _utils.generateUUID)() });\n\n          return (0, _snabbdomJsx.html)('input', {\n            type: 'checkbox',\n            checked: dataValue,\n            value: dataValue,\n            name: name,\n            disabled: disabled,\n            key: (0, _utils.generateUUID)() }); // VDOM BUG: need to force a new uuid or it will not rerender correctly\n        case 'list':\n          /*const options = units.map(unit => <option value={unit} selected={dataValue === unit}>\n                                              {unit}\n                                            </option>)\n           function classes(list){\n            return list.join('.') //list.reduce(funcio(acc, cur)=> acc = ,'')\n          }*/\n          var options = units.map(function (unit) {\n            return (0, _dom.h)('option', { props: { value: unit, selected: dataValue === unit } }, [unit]);\n          });\n          //VDOM BUG: need to force a new uuid or it will not rerender correctly\n          return (0, _snabbdomJsx.html)(\n            'select',\n            {\n              name: name,\n              value: dataValue,\n              disabled: disabled,\n              key: (0, _utils.generateUUID)() },\n            options\n          );\n        default:\n          return name;\n      }\n    }\n\n    function getIcon(icon) {\n      switch (icon) {\n        case 'bomToggler':\n          return '<svg width=\"24px\" height=\"21px\" viewBox=\"0 0 24 21\" version=\"1.1\" id=\\'List\\' class=\\'icon\\'\\n              xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n                <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n                <title>bom</title>\\n                <desc>Created with Sketch.</desc>\\n                <defs></defs>\\n                <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n                    <g id=\"bom\" fill=\"#000000\">\\n                        <path d=\"M2.5,5 C3.88071187,5 5,3.88071187 5,2.5 C5,1.11928813 3.88071187,0 2.5,0 C1.11928813,0 0,1.11928813 0,2.5 C0,3.88071187 1.11928813,5 2.5,5 L2.5,5 Z M2.5,4 C1.67157288,4 1,3.32842712 1,2.5 C1,1.67157288 1.67157288,1 2.5,1 C3.32842712,1 4,1.67157288 4,2.5 C4,3.32842712 3.32842712,4 2.5,4 L2.5,4 Z\" id=\"Oval\"></path>\\n                        <polygon id=\"Shape\" points=\"8.5 3 23.5 3 23.5 2 8.5 2\"></polygon>\\n                        <path d=\"M2.5,13 C3.88071187,13 5,11.8807119 5,10.5 C5,9.11928813 3.88071187,8 2.5,8 C1.11928813,8 0,9.11928813 0,10.5 C0,11.8807119 1.11928813,13 2.5,13 L2.5,13 Z M2.5,12 C1.67157288,12 1,11.3284271 1,10.5 C1,9.67157288 1.67157288,9 2.5,9 C3.32842712,9 4,9.67157288 4,10.5 C4,11.3284271 3.32842712,12 2.5,12 L2.5,12 Z\" id=\"Oval\"></path>\\n                        <polygon id=\"Shape\" points=\"8.5 11 23.5 11 23.5 10 8.5 10\"></polygon>\\n                        <path d=\"M2.5,21 C3.88071187,21 5,19.8807119 5,18.5 C5,17.1192881 3.88071187,16 2.5,16 C1.11928813,16 0,17.1192881 0,18.5 C0,19.8807119 1.11928813,21 2.5,21 L2.5,21 Z M2.5,20 C1.67157288,20 1,19.3284271 1,18.5 C1,17.6715729 1.67157288,17 2.5,17 C3.32842712,17 4,17.6715729 4,18.5 C4,19.3284271 3.32842712,20 2.5,20 L2.5,20 Z\" id=\"Oval\"></path>\\n                        <polygon id=\"Shape\" points=\"8.5 19 23.5 19 23.5 18 8.5 18\"></polygon>\\n                    </g>\\n                </g>\\n            </svg>';\n        case 'delete':\n          return '<svg width=\"27px\" height=\"27px\" viewBox=\"0 0 27 27\" class=\\'icon\\'\\n            version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n                <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n                <title>remove</title>\\n                <desc>Created with Sketch.</desc>\\n                <defs></defs>\\n                <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n                    <g id=\"remove\" fill=\"#000000\">\\n                        <path d=\"M20.5,15 L20.5,15 C17.4682847,15 15,17.4682847 15,20.5 C15,23.5317153 17.4682847,26 20.5,26 C23.5317153,26 26,23.5317153 26,20.5 C26,17.4682847 23.5317153,15 20.5,15 L20.5,15 Z M20.5,14 L20.5,14 C24.084,14 27,16.916 27,20.5 C27,24.084 24.084,27 20.5,27 C16.916,27 14,24.084 14,20.5 C14,16.916 16.916,14 20.5,14 L20.5,14 Z\" id=\"Shape\"></path>\\n                        <path d=\"M23.554,17.446 C23.359,17.251 23.042,17.251 22.847,17.446 L20.5,19.793 L18.153,17.446 C17.958,17.251 17.641,17.251 17.446,17.446 C17.251,17.641 17.251,17.958 17.446,18.153 L19.793,20.5 L17.446,22.847 C17.251,23.042 17.251,23.359 17.446,23.554 C17.544,23.652 17.672,23.7 17.8,23.7 C17.928,23.7 18.056,23.651 18.154,23.554 L20.501,21.207 L22.848,23.554 C22.946,23.652 23.074,23.7 23.202,23.7 C23.33,23.7 23.458,23.651 23.556,23.554 C23.751,23.359 23.751,23.042 23.556,22.847 L21.207,20.5 L23.554,18.153 C23.749,17.958 23.749,17.642 23.554,17.446 L23.554,17.446 Z\" id=\"Shape\"></path>\\n                        <polygon id=\"Path-93\" points=\"12 22.5 1 22.5 1.46423835 23.1856953 7.46423835 8.18569534 7.54115587 7.99340152 7.45957252 7.80304035 4.45957252 0.803040351 4 1.5 19 1.5 18.5404275 0.803040351 15.5404275 7.80304035 15.4490778 8.0161896 15.5527864 8.2236068 17.5527864 12.2236068 18.4472136 11.7763932 16.4472136 7.7763932 16.4595725 8.19695965 19.4595725 1.19695965 19.7582695 0.5 19 0.5 4 0.5 3.24173049 0.5 3.54042748 1.19695965 6.54042748 8.19695965 6.53576165 7.81430466 0.535761655 22.8143047 0.261483519 23.5 1 23.5 12 23.5\"></polygon>\\n                    </g>\\n                </g>\\n            </svg>';\n        default:\n          return '<p>icon</p>';\n      }\n    }\n\n    function getFieldsArray(entries, property) {\n      var include = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];\n\n      // this function can also exclude by property by calling fillFieldsArray('property', false)\n      // add editable row for new entries before all the rest\n      var uiEntries = readOnly ? entries : (0, _ramda.prepend)(newEntryValues, entries);\n      var fieldsArray = uiEntries.map(function (row, index) {\n        var valid = include && row.hasOwnProperty(property);\n        //if( valid || !valid )\n        if (include && row.hasOwnProperty(property)) {\n          return row;\n        }\n        if (!include && !row.hasOwnProperty(property)) {\n          return row;\n        }\n      }).filter(function (x) {\n        return x !== undefined;\n      });\n      return fieldsArray;\n    }\n\n    // THIS PART ACTUALLY RETURNS THE BOM\n    var content = void 0;\n    var header = getHeaderRow();\n    var adder = !readOnly ? getAdderRow([newEntryValues]) : '';\n    if (adder) adder = adder[0]; // FIXME hack, snabdom\n\n    var body = getTableBody(getFieldsArray(entries, '_adder', false));\n    content = (0, _snabbdomJsx.html)(\n      'div',\n      { className: (0, _classnames2.default)('tableContainer', { toggled: toggled }) },\n      (0, _snabbdomJsx.html)(\n        'table',\n        { id: 'tableheader' },\n        header,\n        adder\n      ),\n      (0, _snabbdomJsx.html)(\n        'table',\n        { id: 'tablebody' },\n        body\n      )\n    );\n\n    return (0, _snabbdomJsx.html)(\n      'div',\n      { className: (0, _classnames2.default)('bom', { readOnly: readOnly }) },\n      (0, _Menu2.default)({ toggled: toggled, icon: getIcon('bomToggler'), klass: 'containerToggler bomToggler',\n        tooltip: 'bom/list of parts', tooltipPos: 'bottom', content: content, contentPosition: 'bottom', arrow: false })\n    );\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Bom/view.js\n ** module id = 121\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Bom/view.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\n\nfunction intent(DOM) {\n  var toggle$ = DOM.select('.commentsToggler').events('click').map(true).scan(function (acc, val) {\n    return !acc;\n  });\n\n  var newCommentContent$ = merge( // stream containing new comment, if any\n  DOM.select('.newCommentContent').events('input')\n  // ,DOM.select(\".newCommentContent\").events(\"keyup\")\n  ).map(function (e) {\n    return e.target.value;\n  }).startWith('').distinctUntilChanged().shareReplay(1);\n\n  var addComment$ = DOM.select('.add').events('click').withLatestFrom(newCommentContent$, function (nC, newCommentContent) {\n    return newCommentContent;\n  });\n\n  return {\n    addComment$: addComment$,\n    newCommentContent$: newCommentContent$,\n    toggle$: toggle$ };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/intent.js\n ** module id = 122\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = model;\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction model(props$, actions) {\n  var comments$ = props$.pluck('comments');\n  var entity$ = props$.pluck('entity');\n  var toggled$ = actions.toggle$.startWith(false);\n\n  var newCommentContent$ = actions.addComment$.map(function () {\n    return '';\n  }) // if new comment has been submited, reset to empty field\n  .startWith(undefined);\n\n  var state$ = (0, _obsUtils.combineLatestObj)({\n    comments$: comments$,\n    newCommentContent$: newCommentContent$,\n    entity$: entity$,\n    toggled$: toggled$ }).distinctUntilChanged();\n\n  return state$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/model.js\n ** module id = 123\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/model.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _ramda = __webpack_require__(4);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(331);\n\nfunction renderCommentsList(comments) {\n  var iconSvg = '<svg class=\\'icon\\' version=\\'1.1\\' id=\\'Pencil\\' xmlns=\\'http://www.w3.org/2000/svg\\' x=\\'0px\\' y=\\'0px\\'\\n     viewBox=\\'0 0 20 20\\' enable-background=\\'new 0 0 20 20\\' >\\n    <path fill=\\'#FFFFFF\\' d=\\'M14.69,2.661c-1.894-1.379-3.242-1.349-3.754-1.266c-0.144,0.023-0.265,0.106-0.35,0.223l-4.62,6.374\\n      l-2.263,3.123c-0.277,0.382-0.437,0.836-0.462,1.307l-0.296,5.624c-0.021,0.405,0.382,0.698,0.76,0.553l5.256-2.01\\n      c0.443-0.17,0.828-0.465,1.106-0.849l1.844-2.545l5.036-6.949c0.089-0.123,0.125-0.273,0.1-0.423\\n      C16.963,5.297,16.56,4.021,14.69,2.661z M8.977,15.465l-2.043,0.789c-0.08,0.031-0.169,0.006-0.221-0.062\\n      c-0.263-0.335-0.576-0.667-1.075-1.03c-0.499-0.362-0.911-0.558-1.31-0.706c-0.08-0.03-0.131-0.106-0.126-0.192l0.122-2.186\\n      l0.549-0.755c0,0,1.229-0.169,2.833,0.998c1.602,1.166,1.821,2.388,1.821,2.388L8.977,15.465z\\'/>\\n    </svg>';\n\n  var listElements = comments.map(function (comment) {\n    return (0, _snabbdomJsx.html)(\n      'li',\n      { className: 'item' },\n      (0, _snabbdomJsx.html)(\n        'header',\n        null,\n        (0, _snabbdomJsx.html)('span', { innerHTML: iconSvg }),\n        (0, _snabbdomJsx.html)(\n          'span',\n          { className: 'author' },\n          comment.author\n        ),\n        ' ',\n        (0, _snabbdomJsx.html)(\n          'span',\n          null,\n          'commented 0.5h ago'\n        )\n      ),\n      (0, _snabbdomJsx.html)(\n        'div',\n        { className: 'content' },\n        comment.text\n      )\n    );\n  });\n  return (0, _snabbdomJsx.html)(\n    'ul',\n    { className: 'commentsList' },\n    listElements\n  );\n}\n\n/* <EditableItem id='newComment'\n          data={newComment.text}\n          placeholder='what are your thoughts...'\n          multiline='true'\n          changeHandler={changeHandler}\n        />*/\n\nfunction renderCommentCreator(newCommentContent) {\n  var iconSvg = '\\n    <svg class=\\'icon\\' version=\\'1.1\\' id=\\'Message\\' xmlns=\\'http://www.w3.org/2000/svg\\' x=\\'0px\\' y=\\'0px\\'\\n       viewBox=\\'0 0 20 20\\' enable-background=\\'new 0 0 20 20\\' >\\n      <path fill=\\'#FFFFFF\\' d=\\'M18,6v7c0,1.1-0.9,2-2,2h-4v3l-4-3H4c-1.101,0-2-0.9-2-2V6c0-1.1,0.899-2,2-2h12C17.1,4,18,4.9,18,6z\\'/>\\n    </svg>';\n\n  return (0, _snabbdomJsx.html)(\n    'div',\n    { className: 'item new' },\n    (0, _snabbdomJsx.html)(\n      'header',\n      { innerHTML: iconSvg },\n      'Leave a comment'\n    ),\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'content' },\n      (0, _snabbdomJsx.html)('textarea', {\n        name: 'textarea',\n        className: 'newCommentContent',\n        placeholder: 'What are your thoughts...',\n        value: newCommentContent })\n    ),\n    (0, _snabbdomJsx.html)(\n      'button',\n      { className: 'add' },\n      'Add comment'\n    )\n  );\n}\n\n/* <a className='tooltips' href='#' >\n         <span innerHTML={iconSvg}> </span>\n         <span>\n           See/add comments\n         </span>\n       </a>*/\n\nfunction renderComments(toggled, comments, entity, newCommentContent) {\n  var commentDetails = null;\n  var commentsList = [];\n\n  function bykey(key) {\n    // key = Immutable(key)\n    return comments.data.filter(function (e) {\n      // e.key === key\n      var equal = (0, _ramda.equals)(e.key, key);\n      return equal;\n    });\n  }\n\n  var iconSvg = '\\n    <svg class=\\'icon\\' version=\\'1.1\\' id=\\'Message\\' xmlns=\\'http://www.w3.org/2000/svg\\' x=\\'0px\\' y=\\'0px\\'\\n       viewBox=\\'0 0 20 20\\' enable-background=\\'new 0 0 20 20\\' >\\n      <path fill=\\'#FFFFFF\\' d=\\'M18,6v7c0,1.1-0.9,2-2,2h-4v3l-4-3H4c-1.101,0-2-0.9-2-2V6c0-1.1,0.899-2,2-2h12C17.1,4,18,4.9,18,6z\\'/>\\n    </svg>';\n\n  if (toggled) {\n    var key = [undefined, undefined]; // at design level ie :no entity selected\n    if (entity) {\n      key = [entity.id, entity.typeUid];\n    }\n\n    commentsList = bykey(key);\n    commentsList = commentsList.asMutable();\n    // console.log('entity', entity, 'key',key,'commentsList',commentsList)\n    if (!commentsList) {\n      commentsList = [];\n    }\n\n    commentDetails = (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'commentDetails fadesIn visible' },\n      (0, _snabbdomJsx.html)(\n        'span',\n        null,\n        renderCommentsList(commentsList),\n        ' ',\n        renderCommentCreator(newCommentContent)\n      )\n    );\n  }\n\n  return (0, _snabbdomJsx.html)(\n    'div',\n    { className: 'comments' },\n    (0, _Menu2.default)(toggled, iconSvg, 'commentsToggler', 'comments', 'top'),\n    commentDetails\n  );\n}\n\nfunction view(state$) {\n  return state$.map(function (_ref) {\n    var comments = _ref.comments;\n    var entity = _ref.entity;\n    var toggled = _ref.toggled;\n    var newCommentContent = _ref.newCommentContent;\n\n    /* let fakeComments = {\n       bykey:{}\n     }\n     fakeComments.bykey[[undefined,undefined]] = [\n     {\n       text: 'foo bar baz'\n       ,author:'DR WhoBrown'}\n       ,\n       {\n       text: 'indeed'\n       ,author:'Roborbarbar'}\n     ]*/\n\n    return renderComments(toggled, comments, entity, newCommentContent);\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/view.js\n ** module id = 124\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/view.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _formatters = __webpack_require__(15);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\n\n\nfunction isNumber(obj) {\n  return !isNaN(parseFloat(obj));\n}\n\nfunction intent(DOM) {\n  // const addComment$ = DOM.select('.comments').events('addComment$').pluck('detail')\n\n  var changeName$ = merge(DOM.select('.nameInput').events('change'), DOM.select('.nameInput').events('input')).map(function (e) {\n    return e.target.value;\n  }).distinctUntilChanged().debounce(20).shareReplay(1);\n\n  var changeColor$ = merge(DOM.select('.colorInput').events('change'), DOM.select('.colorInput').events('input')).map(function (e) {\n    return e.target.value;\n  }).distinctUntilChanged().debounce(20).shareReplay(1).merge(DOM.select('.fallbackPickerSquare').events('click').map(function (e) {\n    return e.target.dataset.color;\n  }));\n\n  /*const baseStream$ = merge(\n      DOM.select('.transformsInput').events('change'),\n      DOM.select('.transformsInput').events('blur'),\n      DOM.select('.transformsInput').events('input'),\n       //special one for scaling\n      DOM.select('.transformsInputPercent').events('change'),\n      DOM.select('.transformsInputPercent').events('blur'),\n      DOM.select('.transformsInputPercent').events('input')\n  )\n  .map(function (e) {\n    let val = parseFloat(e.target.value)\n    const attributes = e.target.dataset\n    let dtrans = attributes.transform\n    let [trans, idx, extra] = dtrans.split('_')\n    if (trans === 'rot') { // convert rotated values back from degrees to radians\n      val = toRadian(val)\n    }\n     if(trans === 'sca') {\n      if(extra === 'percent'){\n        val = val / 100\n        console.log('scale',val, extra)\n      }\n      else{\n        return undefined\n      }\n    }\n    if(trans === 'pos') {\n      //we are dealing with offsets, NOT absolute positions\n    }\n    console.log('there', val, idx)\n    return {val, trans, idx: parseInt(idx, 10)}\n  })\n  .filter(exists)\n  .filter(data => isNumber(data.val))\n   const changeTransforms$ = baseStream$\n    .bufferWithCount(2,1)\n    .map(function(buffer){\n      const [first, second] = buffer\n      return {val: second.val - first.val, trans: second.trans, idx: second.idx}\n    })\n    .merge(baseStream$.take(1))\n    .tap(function(acc){\n      console.log('changeTransformsDiff',acc)\n    })*/\n\n  var changeTransforms$ = merge(DOM.select('.transformsInput').events('change'), DOM.select('.transformsInput').events('blur'), DOM.select('.transformsInput').events('input'),\n\n  //special one for scaling\n  DOM.select('.transformsInputPercent').events('change'), DOM.select('.transformsInputPercent').events('blur'), DOM.select('.transformsInputPercent').events('input')).map(function (e) {\n    var val = parseFloat(e.target.value);\n    var attributes = e.target.dataset;\n    //console.log('attributes', attributes)\n    var dtrans = attributes.transform;\n\n    var _dtrans$split = dtrans.split('_');\n\n    var _dtrans$split2 = _slicedToArray(_dtrans$split, 3);\n\n    var trans = _dtrans$split2[0];\n    var idx = _dtrans$split2[1];\n    var extra = _dtrans$split2[2];\n\n    if (trans === 'rot') {\n      // convert rotated values back from degrees to radians\n      val = (0, _formatters.toRadian)(val);\n    }\n\n    if (trans === 'sca') {\n      if (extra === 'percent') {\n        val = val / 100;\n        //console.log('scale',val, extra)\n      } else {\n        return undefined;\n      }\n    }\n    if (trans === 'pos') {}\n    //we are dealing with offsets, NOT absolute positions\n\n    //console.log('there', val, idx)\n\n    return { val: val, trans: trans, idx: parseInt(idx, 10) };\n    //return {}\n  }).filter(_utils.exists).filter(function (data) {\n    return isNumber(data.val);\n  }).distinctUntilChanged()\n  // .debounce(20)\n  .shareReplay(1);\n\n  //output[changed.trans][changed.idx] = changed.val\n\n  var changeMeta$ = merge(changeName$.map(function (value) {\n    return { name: value };\n  }), changeColor$.map(function (value) {\n    return { color: value };\n  }));\n\n  var resetScaling$ = DOM.select('.resetScaling').events('click');\n\n  return {\n    changeMeta$: changeMeta$,\n    changeTransforms$: changeTransforms$,\n    resetScaling$: resetScaling$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/intent.js\n ** module id = 125\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/intent.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n    value: true\n});\nexports.renderMirroringUi = renderMirroringUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar mainIcon = \'<svg viewBox="0 0 22 26" version="1.1" preserveAspectRatio="xMidYMid meet" class="icon"\\nxmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>mirror</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <path d="M21.47,23.5 L16.103,9.499 L18.787,2.5 L11.234,2.5 L11.234,0 L10.234,0 L10.234,2.5 L2.684,2.5 L5.367,9.499 L0,23.5 L10.234,23.5 L10.234,26 L11.234,26 L11.234,23.5 L21.47,23.5 L21.47,23.5 Z M1.454,22.5 L6.3,9.856 L6.437,9.499 L6.3,9.141 L4.138,3.5 L10.234,3.5 L10.234,22.5 L1.454,22.5 L1.454,22.5 Z" id="mirror" fill="#000000"></path>\\n    </g>\\n</svg>\';\n\nvar mirrorXIcon = \'<svg viewBox="0 0 24 28" preserveAspectRatio="xMidYMid meet" class=\\\'icon\\\'\\nversion="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>mirror-x</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <g id="mirror-x" fill="#000000">\\n            <polygon id="Shape" points="5.181 3.492 18.799 3.492 18.799 5.984 23.98 2.992 18.799 0 18.799 2.492 5.181 2.492 5.181 0 0 2.992 5.181 5.984"></polygon>\\n            <path d="M20.041,6.876 L12.016,6.876 L3.938,6.876 L6.622,13.875 L1.255,27.876 L12.016,27.876 L22.725,27.876 L17.359,13.875 L20.041,6.876 L20.041,6.876 Z M12.016,26.876 L2.709,26.876 L7.555,14.232 L7.692,13.875 L7.555,13.517 L5.393,7.876 L12.016,7.876 L12.016,26.876 L12.016,26.876 Z" id="Shape"></path>\\n        </g>\\n    </g>\\n</svg>\';\n\nvar mirrorYIcon = \'<svg viewBox="0 0 24 28" preserveAspectRatio="xMidYMid meet" class=\\\'icon\\\'\\nversion="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>mirror-y</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <g id="mirror-y" fill="#000000">\\n            <polygon id="Shape" points="18.8 3.492 5.182 3.492 5.182 5.984 0 2.992 5.182 0 5.182 2.492 18.8 2.492 18.8 0 23.98 2.992 18.8 5.984"></polygon>\\n            <path d="M6.366,13.999 L1,28 L11.709,28 L22.47,28 L17.103,13.999 L19.787,7 L11.71,7 L3.683,7 L6.366,13.999 Z M11.709,8 L18.332,8 L16.169,13.641 L16.031,13.999 L16.169,14.356 L21.016,27 L11.709,27 L11.709,8 L11.709,8 Z" id="Shape"></path>\\n        </g>\\n    </g>\\n</svg>\';\n\nvar mirrorZIcon = \'<svg viewBox="0 0 29 24" preserveAspectRatio="xMidYMid meet" class=\\\'icon\\\'\\n version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>mirror-z</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <g id="mirror-z" fill="#000000">\\n            <polygon id="Shape" points="25.641 5.181 28.133 5.181 25.141 0 22.148 5.181 24.641 5.181 24.641 18.8 22.148 18.8 25.141 23.98 28.133 18.8 25.641 18.8"></polygon>\\n            <path d="M16.604,8.439 L19.286,1.44 L3.184,1.44 L5.868,8.439 L4.358,12.376 L0.5,22.44 L21.969,22.44 L18.112,12.376 L16.604,8.439 L16.604,8.439 Z M5.43,12.376 L6.801,8.797 L6.938,8.44 L6.801,8.082 L4.639,2.44 L17.832,2.44 L15.67,8.082 L15.533,8.439 L15.67,8.796 L17.041,12.375 L5.43,12.375 L5.43,12.376 Z" id="Shape"></path>\\n        </g>\\n    </g>\\n</svg>\';\n\nfunction renderMirroringUi(state) {\n    var activeTool = state.settings.activeTool;\n    var mirrorModeToggled = activeTool === \'mirror\';\n\n    var subTools = (0, _snabbdomJsx.html)(\n        \'span\',\n        null,\n        (0, _Menu2.default)({ icon: mirrorXIcon, klass: \'mirror-x\', tooltip: \'mirror along x axis\', tooltipPos: \'bottom\' }),\n        (0, _Menu2.default)({ icon: mirrorYIcon, klass: \'mirror-y\', tooltip: \'mirror along y axis\', tooltipPos: \'bottom\' }),\n        (0, _Menu2.default)({ icon: mirrorZIcon, klass: \'mirror-z\', tooltip: \'mirror along z axis\', tooltipPos: \'bottom\' })\n    );\n\n    return (0, _Menu2.default)({ toggled: mirrorModeToggled, icon: mainIcon, klass: \'toMirrorMode\',\n        tooltip: \'mirror\', tooltipPos: \'bottom\', content: subTools, subItems: true });\n}\n\nfunction view(state$) {\n    return state$.map(renderMirroringUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/mirroring.js\n ** module id = 126\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/mirroring.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.renderNameAndColorUi = renderNameAndColorUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _fallbackPicker = __webpack_require__(165);\n\nvar _fallbackPicker2 = _interopRequireDefault(_fallbackPicker);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '<svg viewBox=\"0 0 23 24\" preserveAspectRatio=\"xMidYMid meet\" class=\\'icon\\'\\nversion=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>color</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n        <g id=\"color\" fill=\"#000000\">\\n            <path d=\"M19.3535534,12.1464466 L10.3535534,3.14644661 L10,2.79289322 L9.64644661,3.14644661 L1.14644661,11.6464466 C0.170222152,12.6226711 0.170222152,14.2050791 1.14622048,15.1823271 L5.81848445,19.8535912 C6.79470876,20.8298155 8.37729124,20.8298155 9.35355339,19.8535534 L16.3535534,12.8535534 L16,13 L19,13 L20.2071068,13 L19.3535534,12.1464466 L19.3535534,12.1464466 Z M18.6464466,12.8535534 L19,12 L16,12 L15.7928932,12 L15.6464466,12.1464466 L8.64644661,19.1464466 C8.06070876,19.7321845 7.11129124,19.7321845 6.52555339,19.1464466 L1.85351555,14.4754088 C1.26777785,13.8889209 1.26777785,12.9393289 1.85355339,12.3535534 L10.3535534,3.85355339 L9.64644661,3.85355339 L18.6464466,12.8535534 L18.6464466,12.8535534 Z\" id=\"Shape\"></path>\\n            <path d=\"M10,10.5 L10,2.5 C10,1.12316384 8.87644873,0 7.5,0 C6.12355127,0 5,1.12316384 5,2.5 L5,8.016 L6,8.016 L6,2.5 C6,1.67552581 6.67575883,1 7.5,1 C8.32424117,1 9,1.67552581 9,2.5 L9,10.5 L10,10.5 L10,10.5 Z\" id=\"Shape\"></path>\\n            <path d=\"M22,21 C22,22.1048576 21.1048576,23 20,23 C18.8951424,23 18,22.1048576 18,21 C18,20.6075108 18.3032737,19.7720461 18.8274131,18.6906886 C18.9409908,18.4563652 19.0635031,18.2130979 19.1936439,17.9627331 C19.4635254,17.4435351 19.7531787,16.918301 20.0428613,16.4143497 C20.2165301,16.112224 20.3512565,15.8849328 20.4274316,15.7594268 L19.5725684,15.7594268 C19.6487435,15.8849328 19.7834699,16.112224 19.9571387,16.4143497 C20.2468213,16.918301 20.5364746,17.4435351 20.8063561,17.9627331 C20.9364969,18.2130979 21.0590092,18.4563652 21.1725869,18.6906886 C21.6967263,19.7720461 22,20.6075108 22,21 L22,21 Z M23,21 C23,20.3997163 22.6652327,19.4774924 22.0724517,18.2545196 C21.9546136,18.0114066 21.8279288,17.7598542 21.6936439,17.5015169 C21.4166504,16.9686367 21.1203662,16.4313787 20.8241113,15.9159941 C20.6462176,15.6065182 20.5075065,15.3725047 20.4274316,15.2405732 L20,14.536337 L19.5725684,15.2405732 C19.4924935,15.3725047 19.3537824,15.6065182 19.1758887,15.9159941 C18.8796338,16.4313787 18.5833496,16.9686367 18.3063561,17.5015169 C18.1720712,17.7598542 18.0453864,18.0114066 17.9275483,18.2545196 C17.3347673,19.4774924 17,20.3997163 17,21 C17,22.6571424 18.3428576,24 20,24 C21.6571424,24 23,22.6571424 23,21 L23,21 Z\" id=\"Shape\"></path>\\n        </g>\\n    </g>\\n</svg>';\n\nfunction renderNameAndColorUi(state) {\n  var settings = state.settings;\n  var activeTool = settings.activeTool;\n  var toggled = activeTool === 'nameAndColor';\n\n  var data = state.selections.instIds.reduce(function (acc, id) {\n    acc['transforms'].push(state.transforms[id]);\n    acc['meta'].push(state.meta[id]);\n    return acc;\n  }, { transforms: [], meta: [], settings: settings });\n\n  var meta = data.meta.length > 0 ? data.meta[0] : data.meta;\n  meta = meta || { name: undefined, color: '#FFFFFF' };\n\n  function getFallbackPicker() {\n    // first check whether the browser supports html5 color input, if not load the fallback picker\n    if (document.getElementById('colorInput')) {\n      var element = document.getElementById('colorInput');\n      if (element.type === 'text') {\n        // non supporting browsers set the input type to text instead of color\n        return (0, _fallbackPicker2.default)();\n      }\n    }\n    return '';\n  }\n\n  var subTools = (0, _snabbdomJsx.html)(\n    'span',\n    { className: 'nameAndColorSubTools' },\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'formGroup' },\n      (0, _snabbdomJsx.html)(\n        'span',\n        null,\n        (0, _snabbdomJsx.html)(\n          'label',\n          { htmlfor: 'entityName' },\n          ' Name: '\n        ),\n        (0, _snabbdomJsx.html)(\n          'span',\n          { className: 'inputWrapper' },\n          (0, _snabbdomJsx.html)('input', { type: 'text', name: 'entityName', value: meta.name, className: 'nameInput', placeholder: 'Type name here...' })\n        )\n      ),\n      (0, _snabbdomJsx.html)(\n        'span',\n        null,\n        (0, _snabbdomJsx.html)(\n          'label',\n          { htmlfor: 'entityColor' },\n          ' Color: '\n        ),\n        (0, _snabbdomJsx.html)(\n          'span',\n          { className: 'inputWrapper', style: { 'backgroundColor': meta.color } },\n          (0, _snabbdomJsx.html)('input', { type: 'color', name: 'entityColor', value: meta.color, className: 'colorInput', id: 'colorInput' })\n        )\n      ),\n      getFallbackPicker()\n    )\n  );\n\n  return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toNameAndColorMode',\n    tooltip: 'set name & color of part', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n  return state$.map(renderNameAndColorUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/nameAndColor.js\n ** module id = 127\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/nameAndColor.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.renderPositionUi = renderPositionUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _helpers = __webpack_require__(46);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '<svg viewBox=\"0 0 29 29\" preserveAspectRatio=\"xMidYMid meet\" class=\\'icon\\'\\nversion=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>move</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n        <path d=\"M15,14 L23,14 L23,15 L14,15 L14,14.5 L14,6 L15,6 L15,14 Z M23,10 L23,19 L29,14.5 L23,10 Z M6,10 L6,19 L0,14.5 L6,10 Z M14,14 L6,14 L6,15 L14,15 L14,14 Z M19,23 L10,23 L14.5,29 L19,23 Z M15,15 L15,23 L14,23 L14,15 L15,15 Z M19,6 L10,6 L14.5,0 L19,6 Z\" id=\"move\" fill=\"#000000\"></path>\\n    </g>\\n</svg>';\n\nfunction renderPositionUi(state) {\n  var settings = state.settings;\n  var activeTool = settings.activeTool;\n  var toggled = activeTool === 'translate';\n\n  var transformStep = 0.1;\n  var precision = 2;\n\n  var data = state.selections.instIds.reduce(function (acc, id) {\n    acc['transforms'].push(state.transforms[id]);\n    acc['meta'].push(state.meta[id]);\n    acc['ids'].push(id);\n    return acc;\n  }, { transforms: [], meta: [], settings: settings, ids: [] });\n\n  var transforms = data.transforms;\n  var ids = data.ids;\n\n  if (transforms.length > 0) transforms = transforms[0];\n\n  // compute the average position\n  var avg = (0, _ramda.pluck)('pos')(data.transforms).reduce(function (acc, cur) {\n    if (!acc) return cur;\n    return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n      return x * 0.5;\n    });\n  }, undefined);\n\n  var values = avg || [0, 0, 0];\n\n  var subTools = (0, _snabbdomJsx.html)(\n    'span',\n    { className: 'movingSubTools' },\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'transformsGroup' },\n      (0, _helpers.transformInputs)({ fieldName: 'pos', unit: '', step: transformStep, values: values, precision: precision })\n    ),\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'optionsGroup' },\n      (0, _snabbdomJsx.html)(\n        'label',\n        { className: 'menuContent' },\n        (0, _Checkbox2.default)({ id: 'snapTranslation', className: 'snapTranslation', checked: state.settings.snapRotation }),\n        'snap translation'\n      )\n    )\n  );\n\n  return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toTranslateMode',\n    tooltip: 'move', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n  return state$.map(renderPositionUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/position.js\n ** module id = 128\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/position.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.renderRotationUi = renderRotationUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _helpers = __webpack_require__(46);\n\nvar _formatters = __webpack_require__(15);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '<svg viewBox=\"0 0 25 24\" preserveAspectRatio=\"xMidYMid meet\" class=\\'icon\\'\\nversion=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>rotate</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n        <path d=\"M20.56,13.492 C23.381,12.471 25,10.963 25,9.296 C25,7.415 22.922,5.787 19.696,4.809 L19.697,4.809 L21.5,0 L3.5,0 L5.304,4.809 C2.079,5.787 0,7.415 0,9.296 C0,11.004 1.669,12.509 4.435,13.508 L0.5,24.001 L24.5,24.001 L20.562,13.502 L20.56,13.492 L20.56,13.492 Z M24,9.296 C24,10.504 22.586,11.702 20.209,12.559 L18.5,8 L19.349,5.738 C22.265,6.607 24,7.979 24,9.296 L24,9.296 Z M3.643,12.078 C3.548,12.033 3.455,11.987 3.366,11.941 C3.27,11.89 3.176,11.84 3.085,11.789 C2.901,11.685 2.728,11.58 2.565,11.473 C2.559,11.469 2.552,11.465 2.546,11.461 C1.568,10.803 1,10.059 1,9.296 C1,7.979 2.735,6.607 5.652,5.738 L5.653,5.742 L6.5,8 L4.791,12.559 C4.379,12.41 3.998,12.248 3.643,12.078 L3.643,12.078 Z M1.943,23.001 L5.386,13.818 C6.375,14.109 7.473,14.341 8.668,14.504 C8.708,14.51 8.749,14.514 8.789,14.519 C8.833,14.525 8.879,14.531 8.924,14.536 L8.924,17.163 L14.104,14.171 L8.924,11.179 L8.924,13.522 C7.778,13.37 6.703,13.15 5.744,12.868 L7.437,8.353 L7.569,8.002 L7.437,7.651 L6.622,5.478 L6.363,4.789 L6.272,4.544 L6.272,4.544 L4.943,1 L20.057,1 L18.729,4.544 L18.508,5.132 L18.378,5.477 L18.378,5.477 L17.564,7.648 L17.432,7.999 L17.564,8.35 L19.264,12.884 L19.614,13.815 L23.057,23.001 L1.943,23.001 L1.943,23.001 Z\" id=\"rotate\" fill=\"#000000\"></path>\\n    </g>\\n</svg>';\n\nfunction renderRotationUi(state) {\n  var settings = state.settings;\n  var activeTool = state.settings.activeTool;\n  var toggled = activeTool === 'rotate';\n\n  var snapDefaults = 10; // snap rotation snaps to tens of degrees\n  var transformStep = settings.snapRotation ? snapDefaults : 0.5;\n  var precision = 2;\n\n  var data = state.selections.instIds.reduce(function (acc, id) {\n    acc['transforms'].push(state.transforms[id]);\n    acc['meta'].push(state.meta[id]);\n    return acc;\n  }, { transforms: [], meta: [], settings: settings });\n\n  var transforms = data.transforms;\n\n  if (transforms.length > 0) transforms = transforms[0];\n\n  // compute the average rotation\n  var avg = (0, _ramda.pluck)('rot')(data.transforms).reduce(function (acc, cur) {\n    if (!acc) return cur;\n    return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n      return x * 0.5;\n    });\n  }, undefined);\n\n  var values = (avg || [0, 0, 0]).map(_formatters.toDegree); // convert to degrees\n\n  var subTools = (0, _snabbdomJsx.html)(\n    'span',\n    { className: 'rotationSubTools' },\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'transformsGroup' },\n      (0, _helpers.transformInputs)({ fieldName: 'rot', unit: 'deg', step: transformStep, values: values, precision: precision })\n    ),\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'optionsGroup' },\n      (0, _snabbdomJsx.html)(\n        'label',\n        { className: 'menuContent' },\n        (0, _Checkbox2.default)({ id: 'snapRotation', className: 'snapRotation', checked: state.settings.snapRotation }),\n        'snap rotation'\n      )\n    )\n  );\n\n  return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toRotateMode',\n    tooltip: 'rotate', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n  return state$.map(renderRotationUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/rotation.js\n ** module id = 129\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/rotation.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.renderScaleUi = renderScaleUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _helpers = __webpack_require__(46);\n\nvar _formatters = __webpack_require__(15);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '<svg viewBox=\"0 0 24 21\" preserveAspectRatio=\"xMidYMid meet\" class=\\'icon\\'\\nversion=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>scale</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n        <path d=\"M21.251,0 L5.149,0 L7.833,6.999 L1.701,7 L3.401,11.667 L0,21 L2.465,21 L13.606,21 L23.935,21 L18.569,6.999 L21.251,0 Z M13.241,20 L10.204,11.667 L11.904,7 L8.903,7 L8.903,6.999 L8.765,6.641 L6.603,1 L19.797,1 L17.635,6.641 L17.497,6.999 L17.635,7.356 L22.481,20 L13.241,20 L13.241,20 Z\" id=\"scale\" fill=\"#000000\"></path>\\n    </g>\\n</svg>';\n\nfunction renderScaleUi(state) {\n  var settings = state.settings;\n  var activeTool = settings.activeTool;\n  var toggled = activeTool === 'scale';\n\n  var snapDefaults = 0.1; // snap scaling snaps to tens of percentages\n  var transformStep = settings.snapScaling ? snapDefaults : 0.1;\n  var precision = 2;\n  var min = 0.01;\n\n  var data = state.selections.instIds.reduce(function (acc, id) {\n    acc['transforms'].push(state.transforms[id]);\n    acc['meta'].push(state.meta[id]);\n    acc['bounds'].push(state.meshes[id]);\n    return acc;\n  }, { transforms: [], meta: [], bounds: [], settings: settings }); // FIXME: should be based on bounds component, not meshes\n\n  var transforms = data.transforms;\n  var bounds = data.bounds;\n\n  if (transforms.length > 0) transforms = transforms[0];\n  if (bounds.length >= 0) {\n    if (bounds.length > 0) {\n      bounds = bounds[0];\n    }\n    try {\n      var bbox = bounds.geometry.boundingBox;\n      var bsph = bounds.geometry.boundingSphere;\n      bounds = {\n        dia: bounds.geometry.boundingSphere.radius * 2,\n        center: bounds.geometry.boundingSphere.center.toArray(),\n        min: bounds.geometry.boundingBox.min.toArray(),\n        max: bounds.geometry.boundingBox.max.toArray()\n      };\n      bounds.size = [bounds.max[0] - bounds.min[0], bounds.max[1] - bounds.min[1], bounds.max[2] - bounds.min[2]];\n      //bound.size = bound.size.map((x, index) => x * transforms.sca[index])\n    } catch (error) {}\n  }\n\n  var valuePercents = (transforms.sca || [0, 0, 0]).map(function (x) {\n    return x * 100;\n  });\n  var values = (bounds.size || [0, 0, 0]).map(function (x, index) {\n    return x * valuePercents[index] / 100;\n  });\n\n  var subTools = (0, _snabbdomJsx.html)(\n    'span',\n    { className: 'scalingSubTools twoColumns' },\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'transformsGroup' },\n      (0, _helpers.transformInputs)({ fieldName: 'sca', showPercents: true, step: transformStep, values: values, valuePercents: valuePercents, precision: precision, min: min,\n        disabled: true })\n    ),\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'optionsGroup' },\n      (0, _snabbdomJsx.html)(\n        'label',\n        { className: 'menuContent' },\n        (0, _Checkbox2.default)({ id: 'snapScaling', className: 'snapScaling', checked: state.settings.snapScaling }),\n        'snap scaling'\n      ),\n      (0, _snabbdomJsx.html)(\n        'label',\n        { className: 'menuContent' },\n        (0, _Checkbox2.default)({ id: 'uniformScaling', className: 'uniformScaling', checked: state.settings.uniformScaling }),\n        'uniform scaling'\n      )\n    ),\n    (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'defaultsGroup' },\n      (0, _snabbdomJsx.html)(\n        'label',\n        { className: 'resetScaling' },\n        (0, _snabbdomJsx.html)(\n          'a',\n          { className: 'textLink' },\n          'Reset Scaling'\n        )\n      )\n    )\n  );\n\n  return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toScaleMode',\n    tooltip: 'scale', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n  return state$.map(renderScaleUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/scale.js\n ** module id = 130\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/scale.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = view;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _formatters = __webpack_require__(15);\n\nvar _utils = __webpack_require__(3);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(332);\nvar just = _rx2.default.Observable.just;\n// //////\n\n// faster object.assign\n\nfunction absSizeInput(entity, controlsStep, numberPrecision, changeHandler) {\n  /* display / control object transforms: posistion,rotation,scale etc\n  in doubt about change handler\n  onChange={self.handleChange.bind(self,'pos',index)}\n  onChange={self.handleSizeChange.bind(self,index)}\n  */\n\n  // TODO : do the 'safing' of values better( no divisions by zero, nothing under 0 )\n  /* var minScale = 0.0001\n  if(!value) return minScale\n   if(value <= 0) value = minScale\n  //var foo = this.meshSize[axis]\n  var map = {'l':'x','w':'y','h':'z'}\n  var mapped = map[axis]\n  var axisScale = this.selectedObject.scale[ mapped ]\n  if( axisScale <= minScale ) axisScale = minScale\n   var scaling = 1/ axisScale\n   var meshSize = this.meshSize[axis]\n  if(meshSize <= minScale) meshSize = minScale\n   var originalSize = meshSize * scaling\n  var targetScale = value/(originalSize)\n   if(targetScale <= minScale) targetScale = minScale\n  if(this.meshSize[axis] <= minScale) this.meshSize[axis] = minScale\n   this.selectedObject.scale[mapped] = targetScale\n  return targetScale\n   absSize = originalSize * scale\n  scale   =\n  */\n\n  if (entity && entity['sca']) {\n    var _ret = function () {\n      // this one is for absolute sizing\n\n      var innerChangeHandler = function innerChangeHandler(fieldName, index, absSize, event) {\n        var value = event.target.value;\n        var originalValue = absSize[index];\n        var scaleChange = value / originalValue;\n        // console.log('changeHandler for absSize fieldName',fieldName,'index',index,'value',value,'originalValue',originalValue ,'absSize', absSize )\n        console.log('value', value, 'originalValue', originalValue, scaleChange);\n\n        changeHandler('sca', index, { target: { value: value } });\n      };\n\n      var absSizeInputs = [];\n      if (entity.bbox) {\n        var absSize = (0, _formatters.absSizeFromBBox)(entity.bbox);\n        absSize = absSize || { w: 0, l: 0, h: 0 };\n        // convert to array to keep logic the same for all fields\n        absSize = [absSize.l, absSize.w, absSize.h];\n        // onChange={innerChangeHandler.bind(null,'absSize',index ,absSize)}\n\n        absSize.forEach(function (entry, index) {\n          entry = (0, _formatters.formatNumberTo)(entry, numberPrecision);\n          absSizeInputs.push((0, _snabbdomJsx.html)('input', {\n            type: 'number',\n            value: entry,\n            step: controlsStep,\n            onChange: changeHandler.bind(null, 'absSize', index) }));\n        });\n      }\n\n      return {\n        v: (0, _snabbdomJsx.html)(\n          'span',\n          null,\n          (0, _snabbdomJsx.html)(\n            'span',\n            null,\n            'D:'\n          ),\n          absSizeInputs\n        )\n      };\n    }();\n\n    if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === \"object\") return _ret.v;\n  }\n}\n\nfunction nameInput(meta) {\n  if (meta && 'name' in meta) {\n    var name = meta.name;\n    if ((0, _utils.isEmpty)(name)) {\n      name = undefined;\n    }\n    return (0, _snabbdomJsx.html)(\n      'span',\n      { className: 'inputWrapper' },\n      (0, _snabbdomJsx.html)('input', {\n        type: 'text',\n        value: name,\n        placeholder: 'Type name here...',\n        className: 'nameInput' })\n    );\n  }\n}\n\nfunction colorInput(meta) {\n  if (meta && 'color' in meta) {\n    return (0, _snabbdomJsx.html)(\n      'span',\n      null,\n      (0, _snabbdomJsx.html)('input', { type: 'color', value: meta.color, className: 'colorInput' })\n    );\n  }\n}\n\n// TODO : this is a duplicate, refactor\nvar translateIconSvg = '<svg xmlns=\\'http://www.w3.org/2000/svg\\' version=\\'1.1\\'\\n  preserveAspectRatio=\"xMidYMid meet\" data-icon=\\'move\\' viewBox=\\'0 0 16 16\\' class=\\'icon\\'>\\n  <path d=\\'M8 0l-3 3h2v4h-4v-2l-3 3 3 3v-2h4v4h-2l2 2 1 1 1-1 2-2h-2v-4h4v2l3-3-3-3v2h-4v-4h2l-3-3z\\' />\\n</svg>';\n\nvar rotateIconSvg = '<svg version=\\'1.1\\' id=\\'CCW\\' xmlns=\\'http://www.w3.org/2000/svg\\' x=\\'0px\\' y=\\'0px\\'\\n  preserveAspectRatio=\"xMidYMid meet\" data-icon=\\'rotate\\' viewBox=\\'0 0 20 20\\' class=\\'icon\\'>\\n  <path d=\\'M0.685,10h2.372V9.795c0.108-4.434,3.724-7.996,8.169-7.996c4.515,0,8.174,3.672,8.174,8.201s-3.659,8.199-8.174,8.199\\n  c-1.898,0-3.645-0.65-5.033-1.738l1.406-1.504c1.016,0.748,2.27,1.193,3.627,1.193c3.386,0,6.131-2.754,6.131-6.15\\n  c0-3.396-2.745-6.15-6.131-6.15c-3.317,0-6.018,2.643-6.125,5.945V10h2.672l-3.494,3.894L0.685,10z\\'/>\\n</svg>';\n\nvar scaleIconSvg = '<svg preserveAspectRatio=\"xMidYMid meet\" viewBox=\\'0 0 16 16\\' version=\\'1.1\\' xmlns=\\'http://www.w3.org/2000/svg\\' class=\\'icon\\'>\\n    <!-- Generator: Sketch 3.4 (15575) - http://www.bohemiancoding.com/sketch -->\\n    <title>Untitled</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id=\\'Page-1\\' stroke=\\'none\\' stroke-width=\\'1\\' fill=\\'none\\' fill-rule=\\'evenodd\\' sketch:type=\\'MSPage\\'>\\n        <path d=\\'M16,8 L13,5 L13,7 L9,7 L9,9 L13,9 L13,11 L16,8 L16,8 Z M3,11 L3,9 L7,9 L7,7 L3,7 L3,5 L0,8 L3,11 L3,11 Z M8,16 C8.553,16 9,15.951 9,15.4 L9,0.6 C9,0.047 8.553,0 8,0 C7.448,0 7,0.047 7,0.6 L7,15.4 C7,15.951 7.448,16 8,16 L8,16 Z\\' fill=\\'#555555\\' sketch:type=\\'MSShapeGroup\\'></path>\\n    </g>\\n</svg>';\n\nfunction transformInputs(transforms, fieldName, displayName, controlsStep, numberPrecision) {\n  var inputs = [];\n  var iconsPerTransform = {\n    'pos': translateIconSvg,\n    'rot': rotateIconSvg,\n    'sca': scaleIconSvg\n  };\n  if (transforms && transforms[fieldName]) {\n    transforms[fieldName].slice(0, 3) // we only want x,y,z values, nothing else\n    .forEach(function (value, index) {\n      if (fieldName === 'rot') // convert rotation information to degree\n        {\n          value = (0, _formatters.toDegree)(value);\n        }\n      value = (0, _formatters.formatNumberTo)(value, numberPrecision);\n      inputs.push((0, _snabbdomJsx.html)('input', {\n        type: 'number',\n        lang: 'en',\n        value: value,\n        step: controlsStep,\n        className: 'transformsInput',\n        attributes: { 'data-transform': fieldName + '_' + index } }));\n    });\n\n    var iconSvg = iconsPerTransform[fieldName];\n    return (0, _snabbdomJsx.html)(\n      'span',\n      { className: 'transformInput' },\n      (0, _snabbdomJsx.html)(\n        'span',\n        { innerHTML: iconSvg },\n        displayName\n      ),\n      inputs\n    );\n  }\n}\n\nfunction getControlStep(transformType, settings) {\n  // , snapping) {\n  var snapScaling = settings.snapScaling;\n  var snapRotation = settings.snapRotation; // please replace this with actual settings\n\n  var snapDefaults = {\n    rot: 10, // snap rotation snaps to tens of degrees\n    sca: 0.1 // snap scaling snaps to tens of percentages\n  };\n\n  var rotateStep = settings.snapRotation ? snapDefaults.rot : 0.5;\n  var scaleStep = settings.snapScaling ? snapDefaults.sca : 0.01;\n\n  switch (transformType) {\n    case 'pos':\n      return 0.1;\n    case 'rot':\n      return rotateStep;\n      break;\n    case 'sca':\n      return scaleStep;\n      break;\n    default:\n      return 0.4;\n  }\n}\n\nfunction view(state$, colorPicker) {\n  var numberPrecision = 2;\n\n  // {colorPicker}\n  return state$.map(function (state) {\n    var meta = state.meta;\n    var transforms = state.transforms;\n    var settings = state.settings;\n\n\n    if (!meta || !transforms || !settings) {\n      return undefined;\n    }\n    if (transforms.length > 0) transforms = transforms[0];\n    if (meta.length > 0) meta = meta[0];\n\n    // console.log('meta,transforms',meta,transforms)\n\n    return '';\n\n    var res = (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'toolBarBottom entityInfos' },\n      colorInput(meta),\n      nameInput(meta),\n      transformInputs(transforms, 'pos', undefined, getControlStep('pos', settings), numberPrecision),\n      transformInputs(transforms, 'rot', undefined, getControlStep('rot', settings), numberPrecision),\n      transformInputs(transforms, 'sca', undefined, getControlStep('sca', settings), numberPrecision)\n    );\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/view.js\n ** module id = 131\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/view.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromEvent = _rx2.default.Observable.fromEvent;\n\nfunction intent(DOM) {\n  // any outside taps close the settings\n  var outsideTaps$ = fromEvent(window, 'click').map(function (e) {\n    return e.target;\n  }).map(function (target) {\n    return document.querySelector('.settings').contains(target);\n  }).filter(function (x) {\n    return x === false;\n  }); // we only care if it was clicked outside, not in\n\n  var toggle$ = DOM.select('.settingsToggler').events('click').map(true).scan(function (acc, val) {\n    return !acc;\n  }).merge(outsideTaps$).takeUntil(outsideTaps$).repeat();\n\n  return {\n    toggle$: toggle$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/intent.js\n ** module id = 132\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = model;\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction model(props$, actions) {\n  var settings$ = props$.pluck('settings');\n  var schema$ = props$.pluck('schema').startWith({});\n\n  var toggled$ = actions.toggle$.startWith(false);\n\n  return (0, _obsUtils.combineLatestObj)({ settings$: settings$, toggled$: toggled$ });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/model.js\n ** module id = 133\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/model.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _classnames = __webpack_require__(34);\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(333);\n\nfunction view(state$) {\n  return state$.map(function (_ref) {\n    var settings = _ref.settings;\n    var toggled = _ref.toggled;\n\n    var fields = void 0;\n    var showGrid = settings.grid.show;\n    // let showAnnot = settings.annotations.show\n    var autoRotate = settings.camera.autoRotate;\n\n    fields = (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'settingsView' },\n      (0, _snabbdomJsx.html)(\n        'section',\n        { className: 'settingEntry' },\n        (0, _Checkbox2.default)({ id: 'showGrid', className: 'showGrid', checked: showGrid }),\n        (0, _snabbdomJsx.html)(\n          'label',\n          { htmlFor: 'showGrid' },\n          'Show grid'\n        )\n      ),\n      (0, _snabbdomJsx.html)(\n        'section',\n        { className: 'settingEntry' },\n        (0, _Checkbox2.default)({ id: 'autoRotate', className: 'autoRotate', checked: autoRotate }),\n        (0, _snabbdomJsx.html)(\n          'label',\n          { htmlFor: 'autoRotate' },\n          'Auto rotate camera'\n        )\n      )\n    );\n\n    var content = (0, _snabbdomJsx.html)(\n      'section',\n      { className: (0, _classnames2.default)('content', { toggled: toggled }) },\n      fields\n    );\n\n    var icon = '<svg preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 23 22\" class=\\'icon\\'\\n    version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>settings</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id=\"icons\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\n        <g id=\"settings\" fill=\"#000000\">\\n            <path d=\"M11.2666667,15.1666667 C13.5678531,15.1666667 15.4333333,13.3011865 15.4333333,11 C15.4333333,8.69881354 13.5678531,6.83333333 11.2666667,6.83333333 C8.96548021,6.83333333 7.1,8.69881354 7.1,11 C7.1,13.3011865 8.96548021,15.1666667 11.2666667,15.1666667 L11.2666667,15.1666667 Z M11.2666667,14.1666667 C9.51776496,14.1666667 8.1,12.7489017 8.1,11 C8.1,9.25109829 9.51776496,7.83333333 11.2666667,7.83333333 C13.0155684,7.83333333 14.4333333,9.25109829 14.4333333,11 C14.4333333,12.7489017 13.0155684,14.1666667 11.2666667,14.1666667 L11.2666667,14.1666667 Z\" id=\"Oval\"></path>\\n            <path d=\"M19.4162442,9.83574866 L21.6910442,8.52161532 L22.1238875,8.2715653 L21.8739429,7.83866117 L19.3072762,3.3931945 L19.0572609,2.96016804 L18.6242442,3.21020025 L16.3509109,4.52286692 L16.9316766,4.58088816 C16.0703338,3.82115564 15.0711508,3.24195348 13.9912057,2.8788685 L14.3318667,3.3528 L14.3318667,0.733333333 L14.3318667,0.233333333 L13.8318667,0.233333333 L8.69853333,0.233333333 L8.19853333,0.233333333 L8.19853333,0.733333333 L8.19853333,3.36453333 L8.54002157,2.8903245 C7.44698042,3.2556907 6.45489372,3.83069927 5.60303272,4.58243482 L6.18397756,4.52438468 L3.90917756,3.21025134 L3.4761235,2.96007956 L3.22605714,3.3931945 L0.659390474,7.83866117 L0.409464619,8.27153275 L0.842256545,8.52159651 L3.11412321,9.83426318 L2.87432839,9.30153109 C2.64809965,10.4121085 2.64691756,11.5607073 2.8771922,12.6951936 L3.11708911,12.1627847 L0.842289105,13.476918 L0.409445822,13.726968 L0.659390474,14.1598722 L3.22605714,18.6053388 L3.47607242,19.0383653 L3.9090891,18.7883331 L6.18242244,17.4756664 L5.60203999,17.4179829 C6.4622902,18.1751904 7.45940361,18.7530899 8.53837636,19.1179224 L8.19853333,18.6442667 L8.19853333,21.2666667 L8.19853333,21.7666667 L8.69853333,21.7666667 L13.8318667,21.7666667 L14.3318667,21.7666667 L14.3318667,21.2666667 L14.3318667,18.6369333 L13.9909746,19.1109425 C15.0878591,18.7427575 16.0822959,18.1674667 16.9291812,17.4187251 L16.3478891,17.477082 L18.6226891,18.7912153 L19.0557432,19.0413871 L19.3058095,18.6082722 L21.8724762,14.1628055 L22.122402,13.7299339 L21.6896101,13.4798702 L19.4177435,12.1672035 L19.6574295,12.7004682 C19.8850581,11.589198 19.8866349,10.4389056 19.6561411,9.30333969 L19.4162442,9.83574866 L19.4162442,9.83574866 Z M18.9160224,8.96985134 L18.6045781,9.14977016 L18.6761255,9.50226031 C18.8798214,10.5058021 18.8784309,11.5201856 18.6777705,12.4997984 L18.6054637,12.8527962 L18.9174565,13.0330632 L21.1893232,14.3457298 L21.0064571,13.6627945 L18.4397905,18.1082612 L19.1229109,17.925318 L16.8481109,16.6111847 L16.5364613,16.4311473 L16.2668188,16.6695415 C15.5200472,17.3297714 14.6425981,17.8373837 13.6727587,18.1629242 L13.3318667,18.2773495 L13.3318667,18.6369333 L13.3318667,21.2666667 L13.8318667,20.7666667 L8.69853333,20.7666667 L9.19853333,21.2666667 L9.19853333,18.6442667 L9.19853333,18.2855219 L8.8586903,18.1706109 C7.90551828,17.8483154 7.02401408,17.3374198 6.26276001,16.6673504 L5.99327759,16.4301472 L5.68237756,16.6096669 L3.40904423,17.9223336 L4.09207619,18.1053278 L1.52540953,13.6598612 L1.34251089,14.3428153 L3.61731089,13.028682 L3.92875519,12.8487632 L3.8572078,12.496273 C3.65367194,11.4935197 3.65471455,10.4804521 3.85420494,9.50113557 L3.92604546,9.14846393 L3.61441012,8.96840349 L1.34254346,7.65573682 L1.52540953,8.33867217 L4.09207619,3.8932055 L3.40895577,4.07614866 L5.68375577,5.39028199 L5.99510091,5.57014353 L6.26470062,5.33223185 C7.01676101,4.66856662 7.89183177,4.16137991 8.8570451,3.83874217 L9.19853333,3.72459435 L9.19853333,3.36453333 L9.19853333,0.733333333 L8.69853333,1.23333333 L13.8318667,1.23333333 L13.3318667,0.733333333 L13.3318667,3.3528 L13.3318667,3.71219894 L13.6725276,3.8267315 C14.6255812,4.14715468 15.5083401,4.65886862 16.27019,5.33084517 L16.5397204,5.56857974 L16.8509558,5.38886641 L19.1242891,4.07619975 L18.4412571,3.8932055 L21.0079238,8.33867217 L21.1908224,7.65571801 L18.9160224,8.96985134 L18.9160224,8.96985134 Z\" id=\"Shape\"></path>\\n        </g>\\n    </g>\\n</svg>';\n\n    return (0, _snabbdomJsx.html)(\n      'div',\n      { className: 'settings' },\n      (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'containerToggler settingsToggler', tooltip: 'settings', tooltipPos: 'top',\n        content: content, contentPosition: 'top', arrow: false\n      })\n    );\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/view.js\n ** module id = 134\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/view.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = formatDataForFileStorage;\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nfunction formatDataForFileStorage(_ref, bom) {\n  var sources = _ref.sources;\n  var state$ = _ref.state$;\n\n  var fieldNames = ['part_uuid', 'name', 'qty', 'phys_qty', 'unit', 'printable']; // , 'version' ]\n  var mapping = {\n    'id': 'part_uuid'\n  };\n\n  function formatBomAsPlainText(data) {\n    var result = // 'Bill Of Materials:\\n' +\n    data.map(function (entry) {\n      var phys_qty = entry.phys_qty > 0 ? entry.phys_qty + ' ' : '';\n      var unit = entry.unit === 'EA' ? '' : entry.unit + ' ';\n      return '- ' + entry.qty + ' X ' + phys_qty + unit + entry.name + ' (Part Id : ' + entry.part_uuid + ')';\n    }).join('\\r');\n\n    return result;\n  }\n\n  var bomJsonOutput$ = bom.fileStorage.exportBOMAsJson$.withLatestFrom(state$.pluck('bom'), function (_, bom) {\n    return bom;\n  }).map(function (bom) {\n    return bom.map(function (entry) {\n      return (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n    });\n  }).map(JSON.stringify).map(function (bom) {\n    return { data: bom, type: 'json', name: 'bom.json' };\n  });\n\n  var bomTextOutput$ = bom.fileStorage.exportBOMAsText$.withLatestFrom(state$.pluck('bom'), function (_, bom) {\n    return bom;\n  }).map(function (bom) {\n    return bom.map(function (entry) {\n      return (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n    });\n  }).map(formatBomAsPlainText).map(function (bom) {\n    return { data: bom, type: 'text', name: 'bom.md' };\n  });\n\n  return bomJsonOutput$.merge(bomTextOutput$);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/dataFormating/formatDataForFileStorage.js\n ** module id = 135\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/dataFormating/formatDataForFileStorage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = formatDataForLocalStorage;\n\nvar _ramda = __webpack_require__(4);\n\nfunction formatDataForLocalStorage(_ref) {\n  var sources = _ref.sources;\n  var state$ = _ref.state$;\n\n  return state$ // output to localStorage\n  .pluck('settings') // in this case, settings\n  .map(function (settings) {\n    return (0, _ramda.omit)(['autoSave', 'autoLoad', 'toolSets'], settings); // here put any settings that should NOT be saved\n  }).map(function (s) {\n    return { 'jam!-settings': JSON.stringify(s) };\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/dataFormating/formatDataForLocalStorage.js\n ** module id = 136\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/dataFormating/formatDataForLocalStorage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = formatDataForYMStorage;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar merge = _Rx$Observable.merge;\nvar just = _Rx$Observable.just;\nfunction formatDataForYMStorage(_ref) {\n  var sources = _ref.sources;\n  var state$ = _ref.state$;\n\n  var apiEndpoint$ = sources.addressbar.get('apiEndpoint').map(_ramda.head).filter(_utils.exists).shareReplay(1);\n\n  // this are responses from ym\n  var waitForLoadNeeded$ = state$.pluck('settings', 'autoLoad') // do we need to wait for data to be loaded?\n  .map(function (data) {\n    return !data;\n  });\n\n  var loadAllDone$ = sources.ym.data.filter(function (res$) {\n    return res$.request.type === 'ymLoad';\n  }) // handle errors etc\n  .flatMap(function (data) {\n    var responseWrapper$ = data.catch(function (e) {\n      console.log('caught error in loading data', e);\n      return _rx2.default.Observable.empty();\n    });\n    var request$ = just(data.request);\n    var response$ = responseWrapper$.pluck('response');\n    return (0, _obsUtils.combineLatestObj)({ response$: response$, request$: request$ }); // .materialize()//FIXME: still do not get this one\n  }).scan(function (acc, data) {\n    acc.push(data.request.typeDetail);\n    return acc;\n  }, []).map(function (data) {\n    // TODO: we need a way to check what the design actually has\n    // we recieved all 3 types of data, we are gold !\n    return (0, _ramda.contains)('parts', data) && (0, _ramda.contains)('bom', data) && (0, _ramda.contains)('assemblyEntries', data);\n  }).merge(waitForLoadNeeded$) // here we combine with autoLoad/autoSave settings : if autoLoad is false but autoSave is true, just save\n  .filter(function (d) {\n    return d === true;\n  }).tap(function (e) {\n    return console.log('loading done, we got it all');\n  });\n\n  var designExists$ = sources.ym.data.tap(function (e) {\n    return console.log('responses from ym', e);\n  }).filter(function (res) {\n    return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'designExists';\n  }).flatMap(function (data) {\n    return data.catch(function (_) {\n      return just({ error: true });\n    });\n  }) // flag errors\n  .filter(function (e) {\n    return !e.progress;\n  }) // filter out progress data\n  .map(function (data) {\n    return data.error ? false : true;\n  }); // if we have an error return false, true otherwise\n  // .forEach(e=>console.log(\"designExists: \",e))\n\n  // OUTPUT to ym\n  var bomToYm = state$.pluck('bom');\n  var entityMetaToYm = state$.pluck('meta').distinctUntilChanged().shareReplay(1);\n  var entityTransformsToYm = state$.pluck('transforms').distinctUntilChanged(null, _ramda.equals).shareReplay(1); //\n  var entitymeshesToYm = state$.pluck('meshes');\n  var parts = state$.pluck('types');\n  var design = state$.pluck('design');\n  var authData = state$.pluck('authData');\n  var assembly = state$.pluck('assembly');\n\n  // send simple query to determine if design already exists\n  var queryDesignExists$ = (0, _obsUtils.combineLatestObj)({ design: design, authData: authData, apiEndpoint$: apiEndpoint$ }).filter(function (data) {\n    return data.design.synched;\n  }) // data.authData.token !== undefined &&  only try to save anything when the design is in \"synch mode\" aka has a ur\n  .map(function (data) {\n    return { data: data, query: 'designExists' };\n  }).take(1);\n\n  // saving should NOT take place before load is complete IFAND ONLY IF , we are reloading a design\n  var saveDesigntoYm$ = state$.filter(function (state) {\n    return state.settings.autoSave === true;\n  }) // do not save anything if not in save mode\n  .filter(function (state) {\n    return state.design.synched;\n  }) // && state.authData.token !== undefined only try to save anything when the design is in \"synch mode\" aka has a ur\n  .skipUntil(loadAllDone$)\n  //.tap(e => console.log('we are all done loading so SAVE', e))\n  .flatMap(function (_) {\n    return (0, _obsUtils.combineLatestObj)({\n      bom: bomToYm,\n      parts: parts,\n      eMetas: entityMetaToYm,\n      eTrans: entityTransformsToYm,\n      eMeshs: entitymeshesToYm,\n      design: design,\n      authData: authData,\n      assembly: assembly,\n\n      apiEndpoint$: apiEndpoint$ });\n  }).map(function (data) {\n    return { method: 'save', data: data, type: 'design' };\n  }).distinctUntilChanged(null, _ramda.equals);\n\n  // if the design exists, load data, otherwise...whataver\n  var loadDesignFromYm$ = designExists$ // actions.loadDesign\n  .withLatestFrom(state$.pluck('settings', 'autoLoad'), function (designExists, autoLoad) {\n    return designExists && autoLoad;\n  }).filter(function (e) {\n    return e === true;\n  }) // filter out non existing designs (we cannot load those , duh')\n  .flatMap(function (_) {\n    return (0, _obsUtils.combineLatestObj)({ design: design, authData: authData, apiEndpoint$: apiEndpoint$ });\n  }) // we inject design & authData\n  .map(function (data) {\n    return { method: 'load', data: data, type: 'design' };\n  }) // create our query/request\n  .throttle(5).distinctUntilChanged(null, _ramda.equals).take(1).tap(function (e) {\n    return console.log('loadDesignFromYm', e);\n  });\n\n  var ymStorage$ = merge(queryDesignExists$, saveDesigntoYm$, loadDesignFromYm$).distinctUntilChanged(null, _ramda.equals);\n\n  return ymStorage$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/dataFormating/formatDataForYMStorage.js\n ** module id = 137\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/dataFormating/formatDataForYMStorage.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _keyboard = __webpack_require__(73);\n\nvar _intents = __webpack_require__(168);\n\nvar _intents2 = _interopRequireDefault(_intents);\n\nvar _intents3 = __webpack_require__(182);\n\nvar _intents4 = _interopRequireDefault(_intents3);\n\nvar _intents5 = __webpack_require__(171);\n\nvar _intents6 = _interopRequireDefault(_intents5);\n\nvar _intents7 = __webpack_require__(195);\n\nvar _intents8 = _interopRequireDefault(_intents7);\n\nvar _intents9 = __webpack_require__(206);\n\nvar _intents10 = _interopRequireDefault(_intents9);\n\nvar _intents11 = __webpack_require__(177);\n\nvar _intents12 = _interopRequireDefault(_intents11);\n\nvar _assetManager = __webpack_require__(219);\n\nvar _assetRequests = __webpack_require__(220);\n\nvar _assetRequests2 = _interopRequireDefault(_assetRequests);\n\nvar _utils = __webpack_require__(21);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intent(sources) {\n  // disable backspace navigation for MacOs\n  (0, _keyboard.preventBackNavigation)();\n\n  // FIXME: damned  relative paths ! actual path (relative to THIS module) is '../../core/sources/' , relative to the loader it is '.'\n  var refinedSourceData$ = (0, _utils.normalizeData)((0, _utils.extractDataFromRawSources)(sources, '.')); // q.tap(e=>console.log(\"foo\",e))\n  // .tap(e=>console.log(\"refinedSourceData$\",e))\n\n  // const actions            = actionsFromSources(sources, path.resolve(__dirname,'./actions')+'/' )\n  var _resources = (0, _assetManager.resources)(sources);\n  // special case for gcode etc\n  var visualResources$ = _resources.parsed$.filter(function (e) {\n    return e.progress === 1;\n  }).pluck('data').filter(function (data) {\n    return !(0, _ramda.has)('meshOnly', data);\n  });\n\n  // we also require resources as a source\n  sources = (0, _modelUtils.mergeData)(sources, { resources: _resources });\n\n  // design\n  var designActions = (0, _intents4.default)(sources);\n  // entities\n  var entityActions = (0, _intents8.default)(sources);\n  // settings\n  var settingActions = (0, _intents10.default)(sources);\n  // auth\n  var authActions = (0, _intents6.default)(sources);\n  // comments\n  var commentActions = (0, _intents12.default)(sources);\n\n  // API\n  var apiActions = (0, _intents2.default)(sources);\n\n  // OUTbound requests to various sources\n  var requests = (0, _assetRequests2.default)(refinedSourceData$);\n  requests.desktop$ = requests.desktop$.merge(entityActions.desktopRequests$);\n  requests.http$ = requests.http$.merge(entityActions.requests$);\n\n  return {\n    settingActions: settingActions,\n    // ,selectionActions\n    designActions: designActions,\n    authActions: authActions,\n    entityActions: entityActions,\n    commentActions: commentActions,\n    annotationsActions: { creationStep$: _rx2.default.Observable.never() },\n    apiActions: apiActions,\n    progress: _resources,\n    requests: requests,\n\n    visualResources: visualResources$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/intent.js\n ** module id = 138\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/intent.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n    value: true\n});\nexports.renderMeasurementsUi = renderMeasurementsUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar mainIcon = \'<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 23 23" class=\\\'icon\\\'\\nversion="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>measurement</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <g id="measurement" fill="#000000">\\n            <path d="M11.1133613,8 L11.888882,10.0680673 L11.9495491,10.2314239 L12.1263937,10.7018724 L12.6817388,12.1825666 L12.7717347,12.4218739 L12.9041108,12.7738739 L12.7717347,13.1258739 L12.6817388,13.3651812 L12.682047,13.3643607 L9.06802444,23 L8.69295617,23 L8.24335199,22.3511795 L8.37506827,22 L22.0204453,22 L22.151991,22.350967 L21.7021307,23 L21.3273212,23 L19.1118218,17.0889975 L18.8728898,16.4534372 L17.7141977,13.3631359 L17.6242018,13.1238286 L17.4918257,12.7718286 L17.6242018,12.4198286 L17.7138508,12.1814451 L18.2694018,10.699752 L18.3577376,10.4653235 L18.5080638,10.065362 L19.2819918,8 L19.6567096,8 L20.1066608,8.64910822 L19.9751754,9 L10.4203616,9 L10.2886903,8.64887656 L10.738362,8 L11.1133613,8 L11.1133613,8 Z M11.7457388,13.0131812 L11.8357347,12.7738739 L11.7457388,12.5345666 L11.1900823,11.053043 L11.0134994,10.5832917 L10.9514568,10.4162538 L10.0453616,8 L20.3498932,8 L19.4444798,10.4162538 L19.2938048,10.8171447 L19.2051725,11.0523613 L18.6501977,12.5325212 L18.5602018,12.7718286 L18.6501977,13.0111359 L19.8092359,16.102359 L20.0478615,16.7371029 L22.3952548,23 L8,23 L11.7457388,13.0131812 L11.7457388,13.0131812 Z" id="Path"></path>\\n            <path d="M0.5,5 L4.5,5 L4,4.5 L4,22.5 L4.5,22 L0.5,22 L1,22.5 L1,4.5 L0.5,5 L0.5,5 Z M0.5,4 L0,4 L0,4.5 L0,22.5 L0,23 L0.5,23 L4.5,23 L5,23 L5,22.5 L5,4.5 L5,4 L4.5,4 L0.5,4 L0.5,4 Z" id="Rectangle-path"></path>\\n            <path d="M4.5,1 L22.5,1 L22,0.5 L22,4.5 L22.5,4 L4.5,4 L5,4.5 L5,0.5 L4.5,1 L4.5,1 Z M4.5,0 L4,0 L4,0.5 L4,4.5 L4,5 L4.5,5 L22.5,5 L23,5 L23,4.5 L23,0.5 L23,0 L22.5,0 L4.5,0 L4.5,0 Z" id="Rectangle-path"></path>\\n            <path d="M0.5,1 L4.5,1 L4,0.5 L4,4.5 L4.5,4 L0.5,4 L1,4.5 L1,0.5 L0.5,1 L0.5,1 Z M0.5,0 L0,0 L0,0.5 L0,4.5 L0,5 L0.5,5 L4.5,5 L5,5 L5,4.5 L5,0.5 L5,0 L4.5,0 L0.5,0 L0.5,0 Z" id="Rectangle-path"></path>\\n            <polygon id="Shape" points="8 4.5 8 2.5 7 2.5 7 4.5"></polygon>\\n            <polygon id="Shape" points="12 4.5 12 2.5 11 2.5 11 4.5"></polygon>\\n            <polygon id="Shape" points="16 4.5 16 2.5 15 2.5 15 4.5"></polygon>\\n            <polygon id="Shape" points="20 4.5 20 2.5 19 2.5 19 4.5"></polygon>\\n            <polygon id="Shape" points="4.5 19 2.5 19 2.5 20 4.5 20"></polygon>\\n            <polygon id="Shape" points="4.5 15 2.5 15 2.5 16 4.5 16"></polygon>\\n            <polygon id="Shape" points="4.5 11 2.5 11 2.5 12 4.5 12"></polygon>\\n            <polygon id="Shape" points="4.5 7 2.5 7 2.5 8 4.5 8"></polygon>\\n        </g>\\n    </g>\\n</svg>\';\n\nvar addNoteIcon = \'<svg version="1.1" id="Flag" xmlns="http://www.w3.org/2000/svg"\\n  preserveAspectRatio="xMidYMid meet" x="0px" y="0px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" class="icon">\\n<path d="M18.926,5.584c-9.339,13.568-6.142-0.26-14.037,6.357L6.684,19H4.665L1,4.59l1.85-0.664\\n  c8.849-6.471,4.228,5.82,15.637,1.254C18.851,5.033,19.142,5.27,18.926,5.584z"/>\\n</svg>\';\n\nvar measureDistanceIcon = \'<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" class=\\\'icon\\\'\\nversion="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>ruler</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <path d="M23.85325,5.641 L18.35325,0.141 C18.16525,-0.047 17.83325,-0.047 17.64625,0.141 L0.14625,17.641 C-0.04875,17.836 -0.04875,18.153 0.14625,18.348 L5.64625,23.848 C5.73925,23.942 5.86625,23.995 5.99925,23.995 C6.13225,23.995 6.25925,23.942 6.35325,23.849 L23.85325,6.349 C24.04825,6.153 24.04825,5.836 23.85325,5.641 L23.85325,5.641 Z M5.99925,22.788 L1.20625,17.994 L4.01425,15.186 L6.16025,17.333 C6.25825,17.431 6.38625,17.479 6.51425,17.479 C6.64225,17.479 6.77025,17.43 6.86825,17.333 C7.06325,17.138 7.06325,16.821 6.86825,16.626 L4.72225,14.479 L6.01725,13.184 L7.67925,14.821 C7.77625,14.917 7.90325,14.965 8.03025,14.965 C8.15925,14.965 8.28825,14.915 8.38625,14.816 C8.57925,14.62 8.57725,14.303 8.38025,14.109 L6.72425,12.478 L8.25725,10.945 L10.40325,13.091 C10.50125,13.189 10.62925,13.237 10.75725,13.237 C10.88525,13.237 11.01325,13.188 11.11125,13.091 C11.30625,12.896 11.30625,12.579 11.11125,12.384 L8.96525,10.238 L10.26525,8.938 L11.66225,10.335 C11.76025,10.433 11.88825,10.481 12.01625,10.481 C12.14425,10.481 12.27225,10.432 12.37025,10.335 C12.56525,10.14 12.56525,9.823 12.37025,9.628 L10.97325,8.231 L12.49925,6.702 L14.64525,8.848 C14.74325,8.946 14.87125,8.994 14.99925,8.994 C15.12725,8.994 15.25525,8.945 15.35325,8.848 C15.54825,8.653 15.54825,8.336 15.35325,8.141 L13.20625,5.994 L14.50125,4.698 L16.16225,6.336 C16.26025,6.432 16.38625,6.48 16.51325,6.48 C16.64225,6.48 16.77125,6.43 16.86925,6.331 C17.06325,6.134 17.06125,5.818 16.86425,5.624 L15.20825,3.991 L17.99925,1.201 L22.79225,5.994 L5.99925,22.788 L5.99925,22.788 Z" id="ruler" fill="#000000"></path>\\n    </g>\\n</svg>\';\n\nvar measureThicknessIcon = \'<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 25 25" class=\\\'icon\\\'\\nversion="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>thickness</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <path d="M21,8.3492424 L21,17.3492424 L15,12.8492424 L21,8.3492424 Z M29,12.3492424 L21,12.3492424 L21,13.3492424 L29,13.3492424 L29,12.3492424 Z M4,8.3492424 L4,17.3492424 L10,12.8492424 L4,8.3492424 Z M-4,12.3492424 L4,12.3492424 L4,13.3492424 L-4,13.3492424 L-4,12.3492424 Z M11.6507576,0 L12.6507576,0 L12.6507576,26 L11.6507576,26 L11.6507576,0 Z" id="thickness" fill="#000000" transform="translate(12.500000, 13.000000) rotate(-45.000000) translate(-12.500000, -13.000000) "></path>\\n    </g>\\n</svg>\';\n\nvar measureDiameterIcon = \'<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 22 23" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>diameter</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <g id="diameter" fill="#000000">\\n            <path d="M11,22.5 C16.7989899,22.5 21.5,17.7989899 21.5,12 C21.5,6.20101013 16.7989899,1.5 11,1.5 C5.20101013,1.5 0.5,6.20101013 0.5,12 C0.5,17.7989899 5.20101013,22.5 11,22.5 M11,21.5 C5.75329488,21.5 1.5,17.2467051 1.5,12 C1.5,6.75329488 5.75329488,2.5 11,2.5 C16.2467051,2.5 20.5,6.75329488 20.5,12 C20.5,17.2467051 16.2467051,21.5 11,21.5" id="Oval-58"></path>\\n            <rect id="Rectangle-402" transform="translate(11.000000, 11.500000) rotate(-45.000000) translate(-11.000000, -11.500000) " x="-4" y="11" width="30" height="1"></rect>\\n        </g>\\n    </g>\\n</svg>\';\n\nvar measureAngleIcon = \'<svg version="1.1" xmlns="http://www.w3.org/2000/svg"\\n    preserveAspectRatio="xMidYMid meet"viewBox="0 0 18 18" class="icon">\\n    <title>Untitled</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\\n        <polygon id="Triangle-1" stroke="#000000" stroke-width="3" sketch:type="MSShapeGroup" points="0 0 18 18 0 18 "></polygon>\\n    </g>\\n</svg>\';\n\n/*<section>\n    {Menu({toggled: activeTool === \'addNote\', icon: addNoteIconSvg, klass: \'addNote\',\n      tooltip: \'add note\', tooltipPos: \'bottom\'})}\n\n    {Menu({toggled: activeTool === \'measureDistance\', icon: measureDistanceIconSvg, klass: \'measureDistance\',\n      tooltip: \'measure distance\', tooltipPos: \'bottom\'})}\n\n    {Menu({toggled: activeTool === \'measureThickness\', icon: measureThicknessIconSvg, klass: \'measureThickness\',\n      tooltip: \'measure thickness\', tooltipPos: \'bottom\'})}\n\n    {Menu({toggled: activeTool === \'measureDiameter\', icon: measureDiameterIconSvg, klass: \'measureDiameter\',\n      tooltip: \'measure diameter\', tooltipPos: \'bottom\'})}\n\n    {Menu({toggled: activeTool === \'measureAngle\', icon: measureAngleIconSvg, klass: \'measureAngle\',\n      tooltip: \'measure angle\', tooltipPos: \'bottom\'})}*/\n\nfunction renderMeasurementsUi(state) {\n    var activeTool = state.settings.activeTool;\n    var toggled = activeTool === \'measure\';\n\n    /*{Menu({toggled: activeTool === \'addNote\', icon: addNoteIconSvg, klass: \'addNote\',\n    tooltip: \'add note\', tooltipPos: \'bottom\'})}*/\n    var subTools = (0, _snabbdomJsx.html)(\n        \'span\',\n        null,\n        (0, _Menu2.default)({ toggled: activeTool === \'measureDistance\', icon: measureDistanceIcon, klass: \'measureDistance\',\n            tooltip: \'measure distance\', tooltipPos: \'bottom\' }),\n        (0, _Menu2.default)({ toggled: activeTool === \'measureThickness\', icon: measureThicknessIcon, klass: \'measureThickness\',\n            tooltip: \'measure thickness\', tooltipPos: \'bottom\' }),\n        (0, _Menu2.default)({ toggled: activeTool === \'measureDiameter\', icon: measureDiameterIcon, klass: \'measureDiameter\',\n            tooltip: \'measure diameter\', tooltipPos: \'bottom\' }),\n        (0, _Menu2.default)({ toggled: activeTool === \'measureAngle\', icon: measureAngleIcon, klass: \'measureAngle\',\n            tooltip: \'measure angle\', tooltipPos: \'bottom\' })\n    );\n\n    return (0, _Menu2.default)({ toggled: toggled, icon: mainIcon, klass: \'toMeasureMode\',\n        tooltip: \'measure & annotate\', tooltipPos: \'bottom\', content: subTools, subItems: true });\n}\n\nfunction view(state$) {\n    return state$.map(renderMeasurementsUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/measurements.js\n ** module id = 139\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/measurements.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = model;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(3);\n\nvar _meta = __webpack_require__(192);\n\nvar _transforms = __webpack_require__(193);\n\nvar _mesh = __webpack_require__(191);\n\nvar _bounds = __webpack_require__(190);\n\nvar _annotations = __webpack_require__(188);\n\nvar _utils2 = __webpack_require__(198);\n\nvar _intents = __webpack_require__(200);\n\nvar _intents2 = _interopRequireDefault(_intents);\n\nvar _design = __webpack_require__(181);\n\nvar _design2 = _interopRequireDefault(_design);\n\nvar _auth = __webpack_require__(170);\n\nvar _auth2 = _interopRequireDefault(_auth);\n\nvar _settings = __webpack_require__(207);\n\nvar _settings2 = _interopRequireDefault(_settings);\n\nvar _comments = __webpack_require__(176);\n\nvar _comments2 = _interopRequireDefault(_comments);\n\nvar _selections = __webpack_require__(201);\n\nvar _selections2 = _interopRequireDefault(_selections);\n\nvar _types = __webpack_require__(197);\n\nvar _types2 = _interopRequireDefault(_types);\n\nvar _assemblies = __webpack_require__(189);\n\nvar _assemblies2 = _interopRequireDefault(_assemblies);\n\nvar _typeInstanceMapping = __webpack_require__(196);\n\nvar _typeInstanceMapping2 = _interopRequireDefault(_typeInstanceMapping);\n\nvar _entitiesExtra2 = __webpack_require__(194);\n\nvar _entitiesExtra3 = _interopRequireDefault(_entitiesExtra2);\n\nvar _index = __webpack_require__(118);\n\nvar _index2 = _interopRequireDefault(_index);\n\nvar _intents3 = __webpack_require__(174);\n\nvar _intents4 = _interopRequireDefault(_intents3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// entity components\nfunction model(props$, actions, sources) {\n  var entityActions = actions.entityActions;\n\n  var design$ = (0, _design2.default)(actions.designActions);\n  var authData$ = (0, _auth2.default)(actions.authActions); // authentification data, if any\n  var settings$ = (0, _settings2.default)(actions.settingActions);\n\n  var types$ = (0, _types2.default)(actions.entityActions);\n  var assembly$ = (0, _assemblies2.default)(actions.entityActions).pluck('currentAssembly');\n  var comments$ = (0, _comments2.default)(actions.commentActions);\n\n  var _entitiesExtra = (0, _entitiesExtra3.default)(actions, types$, assembly$);\n\n  var createMeshComponents$ = _entitiesExtra.createMeshComponents$;\n  var componentBase$ = _entitiesExtra.componentBase$;\n\n  entityActions.createMeshComponents$ = createMeshComponents$;\n\n  // annotations\n  var addAnnotations$ = (0, _annotations.addAnnotation)(actions.annotationsActions, settings$).map(_utils.toArray);\n\n  var proxySelections$ = new _rx2.default.ReplaySubject(1);\n\n  entityActions = (0, _utils2.remapEntityActions)(entityActions, proxySelections$);\n  console.log('entityActions', entityActions);\n\n  var metaActions = (0, _utils2.remapMetaActions)(entityActions, componentBase$, proxySelections$, addAnnotations$);\n  var meshActions = (0, _utils2.remapMeshActions)(entityActions, componentBase$);\n  var transformActions = (0, _utils2.remapTransformActions)(entityActions, componentBase$, settings$);\n  var boundActions = (0, _utils2.remapBoundsActions)(entityActions, componentBase$);\n\n  var _makeMetaSystem = (0, _meta.makeMetaSystem)(metaActions);\n\n  var meta$ = _makeMetaSystem.meta$;\n\n  var _makeMeshSystem = (0, _mesh.makeMeshSystem)(meshActions);\n\n  var meshes$ = _makeMeshSystem.meshes$;\n\n  var _makeTransformsSystem = (0, _transforms.makeTransformsSystem)(transformActions);\n\n  var transforms$ = _makeTransformsSystem.transforms$;\n\n  var _makeBoundingSystem = (0, _bounds.makeBoundingSystem)(boundActions);\n\n  var bounds$ = _makeBoundingSystem.bounds$;\n\n  // selections => only for real time view\n\n  var typesInstancesRegistry$ = (0, _typeInstanceMapping2.default)(meta$, types$);\n  var selections$ = (0, _selections2.default)((0, _intents2.default)(sources, { idsMapper$: typesInstancesRegistry$, removeInstances$: entityActions.deleteInstances$, removeTypes$: entityActions.removeTypes$ }));\n  //.merge(entityActions.deleteInstances$.map(a => ({instIds: [], bomIds: []}))) // after an instance is removed, unselect\n\n  var currentSelections$ = selections$.withLatestFrom(typesInstancesRegistry$, function (selections, registry) {\n    return selections.instIds.map(function (id) {\n      var typeUid = registry.typeUidFromInstUid[id];\n      return { id: id, typeUid: typeUid };\n    });\n  }).distinctUntilChanged().shareReplay(1);\n\n  // close some cycles\n  (0, _obsUtils.replicateStream)(currentSelections$, proxySelections$);\n\n  //FIXME : must find a way to get it out of here\n  var bomActions = (0, _intents4.default)(sources, types$, metaActions, entityActions);\n  var bom$ = (0, _index2.default)(bomActions);\n\n  //saveNotifications\n  var saveNotifications$ = sources.ym.progress.pluck('saveInProgress').filter(function (d) {\n    return d === true;\n  }).flatMap(function (data) {\n    return _rx2.default.Observable.just(data).merge(_rx2.default.Observable.timer(300).map(false));\n  });\n\n  // not entirely sure, we need a way to observe any fetch/updload etc operation\n  var operationsInProgress$ = actions.progress.combinedProgress$.merge(saveNotifications$.map(function (data) {\n    return data ? 0.99999 : 1;\n  })).startWith(undefined);\n  var notifications$ = saveNotifications$.map(function (data) {\n    return data ? 'All changes have been saved' : undefined;\n  })\n  //.map(data => undefined)\n  .startWith(undefined).distinctUntilChanged();\n\n  // ////other data\n  var appData$ = sources.appMeta;\n\n  //\n  var visualResources$ = actions.visualResources.startWith([]);\n  //.forEach(e=>console.log('visualResources',e))\n\n  // combine all the above to get our dynamic state\n  var state$ = (0, _obsUtils.combineLatestObj)({\n    selections$: selections$,\n    bom$: bom$,\n    comments$: comments$,\n    // entity components\n    meta$: meta$,\n    transforms$: transforms$,\n    meshes$: meshes$,\n    types$: types$,\n    // app level data, meta data , settings etc\n    operationsInProgress$: operationsInProgress$,\n    notifications$: notifications$,\n    appData$: appData$,\n    settings$: settings$,\n    // infos about current design etc\n    design$: design$,\n    assembly$: assembly$,\n    authData$: authData$,\n\n    // FIXME  temporary\n    visualResources$: visualResources$\n  }).shareReplay(1);\n\n  return state$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/model.js\n ** module id = 140\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/model.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.default = view;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _dom = __webpack_require__(16);\n\nvar _classnames = __webpack_require__(34);\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(3);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _nameAndColor = __webpack_require__(127);\n\nvar _position = __webpack_require__(128);\n\nvar _rotation = __webpack_require__(129);\n\nvar _scale = __webpack_require__(130);\n\nvar _mirroring = __webpack_require__(126);\n\nvar _ProgressBar = __webpack_require__(66);\n\nvar _ProgressBar2 = _interopRequireDefault(_ProgressBar);\n\nvar _measurements = __webpack_require__(139);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar combineLatest = _rx2.default.Observable.combineLatest;\n\n__webpack_require__(334);\n__webpack_require__(336);\n__webpack_require__(339);\n__webpack_require__(335);\n\n__webpack_require__(338);\n__webpack_require__(337);\n__webpack_require__(346);\n\n/*\nfunction renderWebglError(){\n  return (\n    <div className="mainError">\n      <span>\n        <div className="container-heading">\n          <h1>Whoops, it seems you do not have a WebGL capable browser, sorry!</h1>\n        </div>\n        <div className="container-text">\n          <span> <a href="https://get.webgl.org/"> Find out more here  </a> </span>\n        </div>\n      </span>\n    </div>\n  )\n}*/\n\nvar duplicateIcon = \'<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 27 27" data-icon="duplicate" class="icon"\\nversion="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>duplicate</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <g id="duplicate" fill="#000000">\\n            <path d="M10.046237,7.35628664e-16 L11.2381671,3.19560225 L11.3273074,3.43690937 L11.5851694,4.12657524 L12.3954591,6.29864701 L12.5267464,6.64963106 L12.6584327,7.00168174 L12.5267464,7.35373243 L12.3954591,7.70471647 L12.3957657,7.70389584 L7.06245915,22 L6.6893453,22 L6.24208392,21.3510861 L6.37311385,20.999856 L26.6271436,20.999856 L26.7580039,21.3508736 L26.3104877,22 L25.9376312,22 L22.6444276,13.1663628 L22.2960124,12.2345886 L20.6055355,7.70171661 L20.4742482,7.35073256 L20.3425619,6.99868188 L20.4742482,6.64663119 L20.6051904,6.2965711 L21.4153686,4.1241365 L21.5443717,3.77994034 L21.7638315,3.19289661 L22.953861,1.94317006e-15 L23.3266263,4.58032942e-16 L23.7742328,0.649201687 L23.6434325,1.00014399 L9.35684816,1.00014399 L9.22586298,0.648969993 L9.67319158,0 L10.046237,4.58032942e-16 L10.046237,7.35628664e-16 Z M11.4643365,7.35266579 L11.5956238,7.00168174 L11.4643365,6.6506977 L10.6537369,4.47779646 L10.3961353,3.78882778 L10.3056266,3.54383892 L8.98380222,0 L24.0161978,0 L22.695368,3.54383892 L22.4755612,4.13181219 L22.3462631,4.47679651 L21.5366581,6.64769783 L21.4053708,6.99868188 L21.5366581,7.34966592 L23.2274794,11.8834598 L23.5755897,12.8144175 L27,22 L6,22 L11.4643365,7.35266579 L11.4643365,7.35266579 Z" id="Path"></path>\\n            <polygon id="Path" points="5.46433646 12.3526658 5.59562376 12.0016817 5.46433646 11.6506977 4.65373686 9.47779646 4.39613527 8.78882778 4.3056266 8.54383892 2.98380222 5 18.0161978 5 16.695368 8.54383892 16.4755612 9.13181219 16.3462631 9.47679651 15.5366581 11.6476978 15.4053708 11.9986819 15.5366581 12.3496659 17.2274794 16.8834598 17.5755897 17.8144175 21 27 0 27"></polygon>\\n        </g>\\n    </g>\\n</svg>\';\n\nvar deleteIcon = \'<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 27 27" class=\\\'icon\\\'\\nversion="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\\n    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->\\n    <title>remove</title>\\n    <desc>Created with Sketch.</desc>\\n    <defs></defs>\\n    <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\\n        <g id="remove" fill="#000000">\\n            <path d="M20.5,15 L20.5,15 C17.4682847,15 15,17.4682847 15,20.5 C15,23.5317153 17.4682847,26 20.5,26 C23.5317153,26 26,23.5317153 26,20.5 C26,17.4682847 23.5317153,15 20.5,15 L20.5,15 Z M20.5,14 L20.5,14 C24.084,14 27,16.916 27,20.5 C27,24.084 24.084,27 20.5,27 C16.916,27 14,24.084 14,20.5 C14,16.916 16.916,14 20.5,14 L20.5,14 Z" id="Shape"></path>\\n            <path d="M23.554,17.446 C23.359,17.251 23.042,17.251 22.847,17.446 L20.5,19.793 L18.153,17.446 C17.958,17.251 17.641,17.251 17.446,17.446 C17.251,17.641 17.251,17.958 17.446,18.153 L19.793,20.5 L17.446,22.847 C17.251,23.042 17.251,23.359 17.446,23.554 C17.544,23.652 17.672,23.7 17.8,23.7 C17.928,23.7 18.056,23.651 18.154,23.554 L20.501,21.207 L22.848,23.554 C22.946,23.652 23.074,23.7 23.202,23.7 C23.33,23.7 23.458,23.651 23.556,23.554 C23.751,23.359 23.751,23.042 23.556,22.847 L21.207,20.5 L23.554,18.153 C23.749,17.958 23.749,17.642 23.554,17.446 L23.554,17.446 Z" id="Shape"></path>\\n            <polygon id="Path-93" points="12 22.5 1 22.5 1.46423835 23.1856953 7.46423835 8.18569534 7.54115587 7.99340152 7.45957252 7.80304035 4.45957252 0.803040351 4 1.5 19 1.5 18.5404275 0.803040351 15.5404275 7.80304035 15.4490778 8.0161896 15.5527864 8.2236068 17.5527864 12.2236068 18.4472136 11.7763932 16.4472136 7.7763932 16.4595725 8.19695965 19.4595725 1.19695965 19.7582695 0.5 19 0.5 4 0.5 3.24173049 0.5 3.54042748 1.19695965 6.54042748 8.19695965 6.53576165 7.81430466 0.535761655 22.8143047 0.261483519 23.5 1 23.5 12 23.5"></polygon>\\n        </g>\\n    </g>\\n</svg>\';\n\nfunction renderLeftToolbar(state) {\n  var selections = state.selections;\n  var activeTool = state.settings.activeTool;\n  var toggleControls = selections && selections.instIds.length > 0;\n\n  var viewIcons = [];\n\n  var editIcons = [(0, _snabbdomJsx.html)(\n    \'section\',\n    null,\n    (0, _nameAndColor.renderNameAndColorUi)(state),\n    (0, _position.renderPositionUi)(state),\n    (0, _rotation.renderRotationUi)(state),\n    (0, _scale.renderScaleUi)(state),\n    (0, _mirroring.renderMirroringUi)(state)\n  ), (0, _snabbdomJsx.html)(\n    \'section\',\n    null,\n    (0, _Menu2.default)({ icon: duplicateIcon, klass: \'duplicate\',\n      tooltip: \'duplicate\', tooltipPos: \'bottom\', disabledCondition: !toggleControls }),\n    (0, _Menu2.default)({ icon: deleteIcon, klass: \'delete\',\n      tooltip: \'delete\', tooltipPos: \'bottom\', disabledCondition: !toggleControls })\n  )];\n  var annotIcons = [(0, _snabbdomJsx.html)(\n    \'section\',\n    null,\n    (0, _measurements.renderMeasurementsUi)(state)\n  )];\n\n  var iconSets = {\n    \'view\': viewIcons,\n    \'edit\': editIcons,\n    \'annotate\': annotIcons,\n    \'bom\': undefined\n  };\n\n  var icons = state.settings.toolSets.map(function (toolSet) {\n    return iconSets[toolSet];\n  }).filter(_utils.exists);\n\n  return (0, _dom.h)(\'section#leftToolbar\', (0, _ramda.flatten)([icons]));\n}\n\nfunction renderRightToolbar(state, _ref) {\n  var bom = _ref.bom;\n\n  var widgetSets = {\n    \'bom\': bom\n  };\n\n  var widgetsNames = (0, _ramda.uniq)((0, _ramda.flatten)(state.settings.toolSets.map(function (toolSet) {\n    return widgetNamesByToolSet(toolSet);\n  }).filter(_utils.exists)));\n  var widgets = widgetsNames.map(function (wName) {\n    return widgetSets[wName];\n  });\n\n  return (0, _dom.h)(\'section#rightToolbar\', widgets);\n}\n\nfunction renderTopToolbar(state) {\n  var progressBar = (0, _ProgressBar2.default)({ progress: state.operationsInProgress * 100 });\n  return (0, _dom.h)(\'section#topToolBar\', [(0, _dom.h)(\'section.notifications\', [state.notifications]), progressBar]);\n}\n\nfunction renderUiElements(uiElements) {\n  var state = uiElements.state;\n  var settings = uiElements.settings;\n  var fsToggler = uiElements.fsToggler;\n  var bom = uiElements.bom;\n  var gl = uiElements.gl;\n  var entityInfos = uiElements.entityInfos;\n  var help = uiElements.help;\n\n\n  var widgetsMapping = {\n    //\'comments\': comments,\n    \'entityInfos\': entityInfos,\n    \'bom\': bom\n  };\n\n  var widgetsNames = (0, _ramda.uniq)((0, _ramda.flatten)(state.settings.toolSets.map(function (toolSet) {\n    return widgetNamesByToolSet(toolSet);\n  }).filter(_utils.exists)));\n  var widgets = widgetsNames.map(function (wName) {\n    return widgetsMapping[wName];\n  });\n\n  var leftToolbar = renderLeftToolbar(state);\n  var rightToolbar = renderRightToolbar(state, uiElements);\n  var bottomToolBar = (0, _dom.h)(\'section#bottomToolBar\', [settings, help, fsToggler]);\n  var topToolbar = renderTopToolbar(state);\n\n  return (0, _dom.h)(\'div.jam\', (0, _ramda.flatten)([gl, leftToolbar, rightToolbar, topToolbar, bottomToolBar]));\n}\n\nfunction widgetNamesByToolSet(toolset) {\n  var mappings = {\n    \'view\': [],\n    \'bom\': [\'bom\'],\n    \'edit\': [\'entityInfos\', \'bom\'],\n    \'annot\': [\'comments\']\n  };\n  return mappings[toolset];\n}\n\nfunction view(state$, settings$, fsToggler$, bom$, gl$, entityInfos$, comment$, help$) {\n\n  return (0, _obsUtils.combineLatestObj)({ state$: state$, settings$: settings$, fsToggler$: fsToggler$, bom$: bom$, gl$: gl$, entityInfos$: entityInfos$, comment$: comment$, help$: help$ }).map(renderUiElements);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/view.js\n ** module id = 141\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/view.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.EntityInfosWrapper = EntityInfosWrapper;\nexports.BOMWrapper = BOMWrapper;\nexports.GLWrapper = GLWrapper;\nexports.CommentsWrapper = CommentsWrapper;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _ramda = __webpack_require__(4);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _Bom = __webpack_require__(111);\n\nvar _Bom2 = _interopRequireDefault(_Bom);\n\nvar _GlView = __webpack_require__(143);\n\nvar _GlView2 = _interopRequireDefault(_GlView);\n\nvar _Comments = __webpack_require__(112);\n\nvar _Comments2 = _interopRequireDefault(_Comments);\n\nvar _EntityInfos = __webpack_require__(113);\n\nvar _EntityInfos2 = _interopRequireDefault(_EntityInfos);\n\nvar _ProgressBar = __webpack_require__(66);\n\nvar _ProgressBar2 = _interopRequireDefault(_ProgressBar);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar just = _rx2.default.Observable.just;\n\n// nested dialogues etc\n\n\n// for settings\n/* just({\n   ,schema : {\n     showGrid:{type:\"checkbox\",path:\"grid.show\"}\n     ,autoRotate:{type:\"checkbox\",path:\"camera.autoRotate\"}\n     //,annotations:{type:\"checkbox\",path:\"grid.show\"}\n   }\n })*/\nfunction EntityInfosWrapper(state$, DOM) {\n\n  function makeEntityInfosProps(state$) {\n    var selectedInstIds$ = state$.pluck('selections').map(function (s) {\n      return s.instIds;\n    }).filter(function (s) {\n      return s !== undefined;\n    }).distinctUntilChanged(null, _ramda.equals);\n\n    return selectedInstIds$.combineLatest(state$, function (ids, state) {\n      var transforms = ids.map(function (id) {\n        return state.transforms[id];\n      });\n\n      var meta = ids.map(function (id) {\n        return state.meta[id];\n      });\n\n      var selections = ids;\n\n      return { transforms: transforms, meta: meta, settings: state.settings, selections: selections };\n    }).shareReplay(1);\n  }\n  var props$ = makeEntityInfosProps(state$);\n\n  /*const props$ = state$.map(function(state){\n     const data = state.selections.instIds.reduce(function (acc, id) {\n      acc['transforms'].push(state.transforms[id])\n      acc['meta'].push(state.meta[id])\n      return acc\n    }, {transforms: [], meta: [], settings})\n    return assign({}, state, {__data: data})\n  })*/\n\n  // entity infos\n  return (0, _EntityInfos2.default)({ DOM: DOM, props$: props$ });\n}\n\nfunction BOMWrapper(state$, DOM) {\n  function makeBomProps(state$) {\n    var fieldNames = ['name', 'qty', 'phys_qty', 'unit', 'printable'];\n    var sortableFields = ['id', 'name', 'qty', 'unit', 'printable'];\n    var editableFields = ['name', 'qty', 'phys_qty'];\n    var fieldDescriptions = {\n      'name': 'name of the parts',\n      'qty': 'quantities of this parts',\n      'phys_qty': 'physical quantity: ie 10 cm',\n      'unit': 'use EA for \"each\", or SI/ imperial units',\n      'printable': 'is this a printable part?'\n    };\n    var fieldTypes = {\n      'name': 'text',\n      'qty': 'number',\n      'phys_qty': 'number',\n      'unit': 'list',\n      'printable': 'boolean'\n    };\n\n    var fieldNames$ = just(fieldNames);\n    var editableFields$ = just(editableFields);\n    var sortableFields$ = just(sortableFields);\n    var selectedEntries$ = state$.pluck('selections').pluck('bomIds');\n    var fieldDescriptions$ = just(fieldDescriptions);\n    var fieldTypes$ = just(fieldTypes);\n    var units$ = just(['EA', 'm', 'in', 'kg', 'lb', 'l']);\n    // let show$            = state$.pluck(\"settings\").pluck(\"appMode\").map(mode=> mode !=='viewer')\n    var entries$ = state$.map(function (s) {\n      return s.bom;\n    }).distinctUntilChanged();\n    var readOnly$ = state$.pluck('settings').map(function (s) {\n      return !(s.toolSets.indexOf('edit') !== -1);\n    });\n\n    var bomProps$ = (0, _obsUtils.combineLatestObj)({\n      fieldNames$: fieldNames$,\n      sortableFields$: sortableFields$,\n      editableFields$: editableFields$,\n      entries$: entries$,\n      selectedEntries$: selectedEntries$,\n      fieldDescriptions$: fieldDescriptions$,\n      fieldTypes$: fieldTypes$,\n      units$: units$,\n      readOnly$: readOnly$ });\n\n    return bomProps$;\n  }\n  return (0, _Bom2.default)({ DOM: DOM, props$: makeBomProps(state$) });\n}\n\nfunction GLWrapper(state$, drivers) {\n  var selectedInstIds$ = state$.pluck('selections').map(function (s) {\n    return s.instIds;\n  }).filter(function (s) {\n    return s !== undefined;\n  }).distinctUntilChanged(null, _ramda.equals);\n\n  var selections$ = selectedInstIds$.withLatestFrom(state$, function (ids, state) {\n    return ids.map(function (id) {\n      return state.meta[id];\n    });\n  }).shareReplay(1);\n\n  var focusedEntities$ = state$.pluck('selections').map(function (s) {\n    return s.focusInstIds;\n  }).filter(function (s) {\n    return s !== undefined;\n  });\n\n  var glProps$ = (0, _obsUtils.combineLatestObj)({\n    settings: state$.pluck('settings'),\n    selections$: selections$,\n    focusedEntities$: focusedEntities$,\n    meta: state$.pluck('meta'),\n    meshes: state$.pluck('meshes'),\n    transforms: state$.pluck('transforms'),\n    rawVisuals: state$.pluck('visualResources')\n  });\n\n  var glUi = (0, _GlView2.default)({ drivers: drivers, props$: glProps$ });\n  return glUi;\n}\n\nfunction CommentsWrapper(state$, DOM) {\n  var selectedInstIds$ = state$.pluck('selections').map(function (s) {\n    return s.instIds;\n  }).filter(function (s) {\n    return s !== undefined;\n  }).distinctUntilChanged(null, _ramda.equals);\n\n  var selections$ = selectedInstIds$.combineLatest(state$, function (ids, state) {\n    // console.log(\"gnagna gna\")\n    var meta = ids.map(function (id) {\n      return state.meta[id];\n    });\n    return meta;\n  }).map(getFirstsData).shareReplay(1);\n\n  function getFirstsData(list) {\n    if (list.length === 0) return undefined;\n    if (!list[0]) return undefined;\n\n    return { id: list[0].id, typeUid: list[0].typeUid };\n  }\n\n  var props$ = (0, _obsUtils.combineLatestObj)({\n    entity: selections$, comments: state$.pluck('comments')\n  });\n\n  return (0, _Comments2.default)({ DOM: DOM, props$: props$ });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/wrappers.js\n ** module id = 142\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/wrappers.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _tween = __webpack_require__(94);\n\nvar _tween2 = _interopRequireDefault(_tween);\n\nvar _Detector = __webpack_require__(67);\n\nvar _Detector2 = _interopRequireDefault(_Detector);\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _dom = __webpack_require__(16);\n\nvar _pointers = __webpack_require__(74);\n\nvar _sizing = __webpack_require__(75);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _diffPatchUtils = __webpack_require__(76);\n\nvar _TransformControls = __webpack_require__(162);\n\nvar _TransformControls2 = _interopRequireDefault(_TransformControls);\n\nvar _glViewHelpers = __webpack_require__(60);\n\nvar _LabeledGrid = __webpack_require__(81);\n\nvar _LabeledGrid2 = _interopRequireDefault(_LabeledGrid);\n\nvar _cameraUtils = __webpack_require__(144);\n\nvar _cameraUtils2 = _interopRequireDefault(_cameraUtils);\n\nvar _computeBounds = __webpack_require__(145);\n\nvar _utils = __webpack_require__(69);\n\nvar _presets = __webpack_require__(161);\n\nvar _EffectComposer = __webpack_require__(152);\n\nvar _EffectComposer2 = _interopRequireDefault(_EffectComposer);\n\nvar _ShaderPass = __webpack_require__(157);\n\nvar _ShaderPass2 = _interopRequireDefault(_ShaderPass);\n\nvar _RenderPass = __webpack_require__(156);\n\nvar _RenderPass2 = _interopRequireDefault(_RenderPass);\n\nvar _MaskPass = __webpack_require__(154);\n\nvar _CopyShader = __webpack_require__(150);\n\nvar _CopyShader2 = _interopRequireDefault(_CopyShader);\n\nvar _FXAAShader = __webpack_require__(153);\n\nvar _FXAAShader2 = _interopRequireDefault(_FXAAShader);\n\nvar _vignetteShader = __webpack_require__(158);\n\nvar _vignetteShader2 = _interopRequireDefault(_vignetteShader);\n\nvar _EdgeShader = __webpack_require__(151);\n\nvar _EdgeShader2 = _interopRequireDefault(_EdgeShader);\n\nvar _AdditiveBlendShader = __webpack_require__(149);\n\nvar _AdditiveBlendShader2 = _interopRequireDefault(_AdditiveBlendShader);\n\nvar _intent = __webpack_require__(159);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _model = __webpack_require__(160);\n\nvar _model2 = _interopRequireDefault(_model);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromEvent = _rx2.default.Observable.fromEvent;\nvar merge = _rx2.default.Observable.merge;\n\n// console.log('helpers.planes',planes,objectEffects)\n// let LabeledGrid = helpers.grids.LabeledGrid\nvar ShadowPlane = _glViewHelpers.planes.ShadowPlane.default; // ugh FIXME: bloody babel6\n// let annotations    = annotations\nvar zoomInOn = _glViewHelpers.cameraEffects.zoomInOn;\nvar zoomToFit = _glViewHelpers.cameraEffects.zoomToFit; // default configuration for lighting, cameras etc\n\nfunction setupPostProcess(camera, renderer, scene) {\n  // console.log('setupPostProcess')\n  // //////post processing\n  var renderTargetParameters = {\n    minFilter: _three2.default.LinearFilter,\n    magFilter: _three2.default.LinearFilter,\n    format: _three2.default.RGBAFormat,\n    stencilBuffer: true\n  };\n\n  var outScene = new _three2.default.Scene();\n  var maskScene = new _three2.default.Scene();\n\n  var renderTarget = new _three2.default.WebGLRenderTarget(window.innerWidth, window.innerHeight, renderTargetParameters);\n\n  var uniforms = {\n    offset: {\n      type: 'f',\n      value: 0.9\n    },\n    color: {\n      type: 'c',\n      value: new _three2.default.Color('#000000') // #ff2500')//[1.0,0.0,0.0]\n    }\n  };\n\n  var shader = __webpack_require__(155).default;\n  var outShader = shader['outline'];\n\n  var outlineMaterial = new _three2.default.ShaderMaterial({\n    uniforms: uniforms,\n    vertexShader: outShader.vertex_shader,\n    fragmentShader: outShader.fragment_shader\n  });\n  outlineMaterial.depthTest = false;\n  // new THREE.MeshBasicMaterial({color:0xFF0000,transparent:true,opacity:0.5})\n\n  var maskMaterial = new _three2.default.MeshBasicMaterial({ color: 0xffffff });\n\n  // setup composer\n  var composer = new _EffectComposer2.default(renderer);\n  composer.renderTarget1.stencilBuffer = true;\n  composer.renderTarget2.stencilBuffer = true;\n\n  var normal = new _RenderPass2.default(scene, camera);\n  var outline = new _RenderPass2.default(outScene, camera, outlineMaterial);\n  var maskPass = new _three2.default.MaskPass(maskScene, camera, maskMaterial);\n  maskPass.inverse = true;\n  var clearMask = new _three2.default.ClearMaskPass();\n  var copyPass = new _three2.default.ShaderPass(_three2.default.CopyShader);\n  var fxaaPass = new _three2.default.ShaderPass(_three2.default.FXAAShader);\n  var vignettePass = new _three2.default.ShaderPass(_three2.default.VignetteShader);\n\n  fxaaPass.uniforms['resolution'].value.set(1 / window.innerWidth * window.devicePixelRatio, 1 / window.innerHeight * window.devicePixelRatio);\n  vignettePass.uniforms['offset'].value = 0.95;\n  vignettePass.uniforms['darkness'].value = 0.9;\n\n  // /////////////////////////////////\n\n  renderer.autoClear = false;\n  // renderer.autoClearStencil = false\n\n  outline.clear = false;\n  // normal.clear = false\n\n  composer.addPass(normal);\n  composer.addPass(maskPass);\n  composer.addPass(outline);\n\n  composer.addPass(clearMask);\n  // composer.addPass(vignettePass)\n  // composer.addPass(fxaaPass)\n  composer.addPass(copyPass);\n\n  var lastPass = composer.passes[composer.passes.length - 1];\n  lastPass.renderToScreen = true;\n\n  return { composers: [composer], fxaaPass: fxaaPass, outScene: outScene, maskScene: maskScene };\n\n  // return {composer:finalComposer, fxaaPass, outScene, maskScene, composers:[normalComposer,depthComposer,finalComposer]}\n}\n\n// //////////\nfunction GLView(_ref) {\n  var drivers = _ref.drivers;\n  var props$ = _ref.props$;\n  var DOM = drivers.DOM;\n  var postMessage = drivers.postMessage;\n\n\n  var config = _presets.presets;\n\n  var initialized$ = new _rx2.default.BehaviorSubject(false);\n  var update$ = _rx2.default.Observable.interval(16, 66666666667);\n\n  var settings$ = props$.pluck('settings');\n  // every time either activeTool or selection changes, reset/update transform controls\n  var activeTool$ = settings$.pluck('activeTool').startWith(undefined);\n\n  var renderer = null;\n\n  var composer = null;\n  var composers = [];\n  var fxaaPass = null;\n  var outScene = null;\n  var maskScene = null;\n\n  var scene = new _three2.default.Scene();\n  var dynamicInjector = new _three2.default.Object3D(); // all dynamic mapped objects reside here\n  scene.dynamicInjector = dynamicInjector;\n  scene.add(dynamicInjector);\n\n  var selectionsContainer = new _three2.default.Scene(); // unfortunate way to handle things in three.js\n\n  var camera = (0, _utils.makeCamera)(config.cameras[0]);\n  var controls = (0, _utils.makeControls)(config.controls[0]); // create 'orbit' controls\n  var transformControls = new _TransformControls2.default(camera);\n\n  var grid = new _LabeledGrid2.default(200, 200, 10, config.cameras[0].up);\n  var shadowPlane = new ShadowPlane(2000, 2000, null, config.cameras[0].up);\n\n  var actions = (0, _intent2.default)({ DOM: DOM, events: drivers.events }, { camera: camera, scene: scene, transformControls: transformControls, props$: props$, settings$: settings$ });\n  var state$ = (0, _model2.default)(props$, actions);\n\n  // FIXME: proxies for now, not sure how to deal with them\n  var meshAddedToScene$ = new _rx2.default.ReplaySubject(1);\n  var meshRemovedFromScene$ = new _rx2.default.ReplaySubject(1);\n\n  var outlineSelections$ = settings$.filter(function (s) {\n    return !(s.toolSets.indexOf('view') !== -1 && s.toolSets.length === 1);\n  }) // in all but view only mode\n  .combineLatest(state$, function (settings, state) {\n    return state;\n  });\n\n  var focusedMeshesFromFocusedEntities$ = state$.pluck('focusedMeshesFromFocusedEntities').startWith([]);\n\n  var zoomToFit$ = settings$.filter(function (s) {\n    return s.toolSets.indexOf('edit') === -1 && s.toolSets.length === 1;\n  }) // only in view only mode\n  .combineLatest(state$.pluck('items'), function (settings, items) {\n    return items;\n  }).merge(focusedMeshesFromFocusedEntities$).filter(_obsUtils.exists).filter(function (i) {\n    return i.length > 0;\n  }).distinctUntilChanged();\n\n  /*\n    const zoomToFit$ = meshAddedToScene$ //alternative implementation\n    .combineLatest(settings$.filter(s=> s.appMode === 'viewer'), function(mesh, settings){\n      return [dynamicInjector]\n    })\n    .distinctUntilChanged()*/\n\n  // react to actions\n  actions.zoomInOnPoint$.forEach(function (oAndP) {\n    return zoomInOn(oAndP.object, camera, { position: oAndP.point });\n  });\n\n  zoomToFit$.map(function (meshesToFocus) {\n    var wrapperObject = new _three2.default.Object3D();\n    wrapperObject.boundingBox = (0, _computeBounds.computeBoundingBox)(wrapperObject, meshesToFocus);\n    wrapperObject.boundingSphere = wrapperObject.boundingBox.getBoundingSphere();\n    var center = new _three2.default.Vector3().subVectors(wrapperObject.boundingBox.max, wrapperObject.boundingBox.min).multiplyScalar(0.5);\n    return { focusMesh: wrapperObject, center: center };\n  }).forEach(function (_ref2) {\n    var focusMesh = _ref2.focusMesh;\n    var center = _ref2.center;\n    return (0, _cameraUtils2.default)(focusMesh, camera, center);\n  });\n\n  var windowResizes$ = (0, _sizing.windowResizes)(1); // get from intents/interactions ?\n\n  function clearScene() {\n    if (scene) {\n      if (scene.dynamicInjector) {\n        scene.remove(scene.dynamicInjector);\n      }\n      var _dynamicInjector = new _three2.default.Object3D();\n      scene.dynamicInjector = _dynamicInjector;\n\n      scene.add(_dynamicInjector);\n    }\n  }\n\n  function addToScene(object) {\n    scene.dynamicInjector.add(object);\n  }\n  function removeFromScene(object) {\n    scene.dynamicInjector.remove(object);\n  }\n\n  function setupScene() {\n    config.scenes['main']\n    // TODO , update to be more generic\n    .map(function (light) {\n      return (0, _utils.makeLight)(light);\n    }).forEach(function (light) {\n      return scene.add(light);\n    });\n  }\n\n  function render(scene, camera) {\n    composers.forEach(function (c) {\n      return c.render();\n    });\n    // composer.passes[composer.passes.length-1].uniforms[ 'tDiffuse2' ].value = composers[0].renderTarget2\n    // composer.passes[composer.passes.length-1].uniforms[ 'tDiffuse3' ].value = composers[1].renderTarget2\n  }\n\n  function update() {\n    controls.update();\n    transformControls.update();\n    _tween2.default.update();\n    // if(camViewControls) camViewControls.update()\n  }\n\n  function configure(container) {\n    // log.debug('initializing into container', container)\n\n    if (!_Detector2.default.webgl) {\n      // TODO: handle lacking webgl\n    } else {\n      renderer = new _three2.default.WebGLRenderer({\n        antialias: false,\n        preserveDrawingBuffer: true\n      });\n    }\n\n    renderer.setClearColor('#fff');\n    Object.keys(config.renderer).map(function (key) {\n      // TODO add hasOwnProp check\n      renderer[key] = config.renderer[key];\n    });\n\n    var pixelRatio = window.devicePixelRatio || 1;\n    renderer.setPixelRatio(pixelRatio);\n\n    container.appendChild(renderer.domElement);\n    // prevents zooming the 3d view from scrolling the window\n    (0, _pointers.preventScroll)(container);\n\n    transformControls.setDomElement(container);\n\n    // more init\n    controls.setObservables(actions.filteredInteractions$);\n    controls.addObject(camera);\n\n    scene.add(camera);\n    scene.add(shadowPlane);\n    scene.add(transformControls);\n\n    var ppData = setupPostProcess(camera, renderer, scene);\n    // composer = ppData.composer\n    composers = ppData.composers;\n    fxaaPass = ppData.fxaaPass;\n    outScene = ppData.outScene;\n    maskScene = ppData.maskScene;\n\n    initialized$.onNext(true);\n  }\n\n  // side effect ?\n  function handleResize(sizeInfos) {\n    // log.debug('setting glView size',sizeInfos)\n    var width = sizeInfos.width;\n    var height = sizeInfos.height;\n    var aspect = sizeInfos.aspect;\n\n\n    if (width > 0 && height > 0 && camera && renderer) {\n      (function () {\n        renderer.setSize(width, height);\n        camera.aspect = aspect;\n        camera.setSize(width, height);\n        camera.updateProjectionMatrix();\n\n        var pixelRatio = window.devicePixelRatio || 1;\n        fxaaPass.uniforms['resolution'].value.set(1 / (width * pixelRatio), 1 / (height * pixelRatio));\n\n        composers.forEach(function (c) {\n          c.reset();\n          c.setSize(width * pixelRatio, height * pixelRatio);\n        });\n      })();\n    }\n  }\n\n  // combine All needed components to apply any 'transforms' to their visuals\n  var items$ = state$.pluck('items'); // .distinctUntilChanged()\n  // TODO : we DO  want distinctUntilChanged() to prevent spamming here at any state change\n  // TODO we want to zoomToFit only when mode is viewer && we just recieved the FIRST model ??\n  /* settings$\n    .filter(s=> s.mode === 'viewer')\n    .forEach(e=>console.log('settings',e))*/\n\n  // do diffing to find what was added/changed\n  var itemChanges$ = items$.scan(function (acc, x) {\n    var cur = x;\n    var prev = acc.cur;\n    return { cur: cur, prev: prev };\n  }, { prev: undefined, cur: undefined }).map(function (typeData) {\n    var cur = typeData.cur;\n    var prev = typeData.prev;\n\n    var changes = (0, _diffPatchUtils.extractChanges)(prev, cur);\n    // console.log('changes', changes)\n    return changes;\n  });\n\n  // experimenting with selections effects\n  //FIXME : use data, not mesh level things\n  outlineSelections$.pluck('selectedMeshesFromSelections').distinctUntilChanged().filter(_obsUtils.exists).forEach(function (selectedMeshes) {\n    if (outScene) {\n      var sceneItems = selectedMeshes.filter(_obsUtils.exists);\n      outScene.children = sceneItems;\n      maskScene.children = sceneItems;\n    }\n  });\n\n  // transformControls handling\n  // we modify the transformControls mode based on the active tool\n  // every time either activeTool or selection changes, reset/update transform controls\n  var selectedMeshesChanges$ = state$.pluck('selectedMeshes').distinctUntilChanged().scan(function (acc, x) {\n    var cur = x;\n    var prev = acc.cur;\n    return { cur: cur, prev: prev };\n  }, { prev: [], cur: [] }).map(function (typeData) {\n    var cur = typeData.cur;\n    var prev = typeData.prev;\n\n    var changes = (0, _diffPatchUtils.extractChanges)(prev, cur);\n    return changes;\n  }).distinctUntilChanged().shareReplay(1);\n\n  (0, _obsUtils.combineLatestObj)({\n    selections: selectedMeshesChanges$,\n    tool: activeTool$.distinctUntilChanged()\n  }).forEach(function (_ref3) {\n    var selections = _ref3.selections;\n    var tool = _ref3.tool;\n\n    // console.log('updating transformControls',selections,tool)\n    // remove transformControls from removed meshes\n    selections.removed.map(function (mesh) {\n      return transformControls.detach(mesh);\n    });\n\n    selections.added.map(function (mesh) {\n      if (tool && mesh && ['translate', 'rotate', 'scale'].indexOf(tool) > -1) {\n        transformControls.attach(mesh);\n        transformControls.setMode(tool);\n      } else if (!tool && mesh || ['translate', 'rotate', 'scale'].indexOf(tool) === -1) {\n        // tool is undefined, but we still had selections\n        transformControls.detach(mesh);\n      }\n    });\n  });\n\n  // hande all the cases where events require re-rendering\n  var reRender$ = merge(initialized$.filter(function (i) {\n    return i === true;\n  }).do(function (i) {\n    return handleResize({\n      width: window.innerWidth,\n      height: window.innerHeight,\n      aspect: window.innerWidth / window.innerHeight\n    });\n  }), fromEvent(controls, 'change'), fromEvent(transformControls, 'change'), state$.pluck('selectedMeshes'), windowResizes$.do(handleResize) // we need the resize to take place before we render\n  ).shareReplay(1);\n\n  // /////////\n  setupScene();\n\n  update$.forEach(update);\n  reRender$.forEach(render);\n\n  // settings handling\n  settings$ = settings$.filter(_obsUtils.exists).distinctUntilChanged();\n\n  settings$.map(function (s) {\n    return s.camera.autoRotate;\n  }).forEach(function (autoRotate) {\n    return controls.autoRotate = autoRotate;\n  });\n\n  settings$.map(function (s) {\n    return s.grid.show;\n  }).forEach(function (showGrid) {\n    scene.remove(grid);\n    if (showGrid) {\n      scene.add(grid);\n    }\n  });\n\n  // react based on diffs\n  itemChanges$.do(function (changes) {\n    // console.log('reacting to changes', changes)\n    changes.added.map(function (mesh) {\n      addToScene(mesh);\n      meshAddedToScene$.onNext(mesh);\n    });\n    changes.removed.map(function (mesh) {\n      removeFromScene(mesh);\n      meshRemovedFromScene$.onNext(mesh);\n    });\n  }).do(function (e) {\n    return render();\n  }).forEach(function (e) {\n    return e;\n  });\n\n  // we do not want to change our container (DOM) but the contents (gl)\n  var vtree$ = _rx2.default.Observable.just((0, _dom.h)('div.glView', [(0, _dom.h)('div.container', {\n    //key: someUniqueKey,\n    hook: {\n      insert: function insert(vnode) {\n        console.log('vnode', vnode);configure(vnode.elm);\n      } //movie.elmHeight = vnode.elm.offsetHeight;\n    }\n  })]));\n\n  // screencapture test\n  /* postMessage\n    .filter(e=>e.hasOwnProperty('captureScreen'))\n    .flatMap(e=>{\n      let img = domElementToImage(renderer.domElement)\n       let resolutions = e.captureScreen\n       let images$ = resolutions.map(function(resolution){\n          let [width,height] = resolution\n          console.log('resolution',resolution)\n           let obs = new Rx.Subject()\n          aspectResize(img, width, height, e=>{\n            obs.onNext(e)\n            obs.onCompleted()})\n          return obs\n        })\n       let results$ = Rx.Observable.forkJoin(images$)\n       return results$\n    })\n    .forEach(e=>{\n      e.map(img=>console.log(img))\n    })*/\n\n  return {\n    DOM: vtree$,\n    events: {\n      // initialized:initialized$,\n      shortSingleTaps$: actions.shortSingleTapsWPicking$,\n      shortDoubleTaps$: actions.shortDoubleTapsWPicking$,\n      longTaps$: actions.longTapsWPicking$,\n      selectionsTransforms$: actions.selectionsTransforms$,\n      selectedMeshes$: actions.selectMeshes$\n    }\n  };\n}\n\nexports.default = GLView;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/GlView.js\n ** module id = 143\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/GlView.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = zoomToFitBounds;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction zoomToFitBounds(object, camera, target) {\n  var bbox = object.boundingBox;\n  if (bbox.empty()) {\n    return;\n  }\n\n  target = bbox.center();\n\n  var radius = object.boundingSphere.radius;\n  var center = object.boundingSphere.center;\n  var targetOffset = new _three2.default.Vector3().subVectors(center, camera.target);\n\n  // move camera to base position\n  camera.position.add(targetOffset);\n  camera.target.copy(center);\n\n  // and move it away from the boundingSphere of the object\n  var vec = new _three2.default.Vector3();\n  vec.subVectors(camera.position, camera.target);\n  vec.normalize();\n  vec.setLength(center.distanceTo(camera.position) - radius * 4);\n  camera.position.sub(vec);\n\n  camera.updateProjectionMatrix();\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/cameraUtils2.js\n ** module id = 144\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/cameraUtils2.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.computeBoundingBox = computeBoundingBox;\nexports.computeBoundingSphere = computeBoundingSphere;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// FIXME : very temporary , until moving to regl/gl-matrix\n\nfunction computeBoundingBox(object, children, force) {\n  var force = force === undefined ? false : force;\n\n  if (object.geometry === undefined) {\n    var bbox = new _three2.default.Box3();\n  } else {\n    if (!object.geometry.boundingBox || force) {\n      object.geometry.computeBoundingBox();\n    }\n    var bbox = object.geometry.boundingBox.clone();\n  }\n\n  children.forEach(function (rootChild) {\n    rootChild.traverse(function (child) {\n      if (child instanceof _three2.default.Mesh) {\n        if (child.geometry !== undefined) {\n          if (!child.geometry.boundingBox || force) {\n            child.geometry.computeBoundingBox();\n          }\n          var childBox = child.geometry.boundingBox.clone();\n          childBox.translate(child.localToWorld(new _three2.default.Vector3()));\n          bbox.union(childBox);\n        }\n      }\n    });\n  });\n\n  object.boundingBox = bbox;\n  return bbox;\n}\n\nfunction computeBoundingSphere(object, children, force) {\n  var bbox = new _three2.default.Box3().setFromObject(object);\n\n  if (object.boundingBox) object.boundingBox.copy(bbox);\n  if (!object.boundingBox) object.boundingBox = bbox;\n  var boundingSphere = bbox.getBoundingSphere();\n  return boundingSphere;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/computeBounds2.js\n ** module id = 145\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/computeBounds2.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\n *  @author zz85 / http://twitter.com/blurspline / http://www.lab4games.net/zz85/blog\n *\n *  A general perpose camera, for setting FOV, Lens Focal Length,\n *      and switching between perspective and orthographic views easily.\n *      Use this only if you do not wish to manage\n *      both a Orthographic and Perspective Camera\n *\n * some additional changes by kaosat-dev\n */\n\nvar CombinedCamera = function CombinedCamera(width, height, fov, near, far, orthoNear, orthoFar) {\n\n    _three2.default.Camera.call(this);\n\n    this.fov = fov;\n\n    this.left = -width / 2;\n    this.right = width / 2;\n    this.top = height / 2;\n    this.bottom = -height / 2;\n\n    // We could also handle the projectionMatrix internally, but just wanted to test nested camera objects\n\n    this.cameraO = new _three2.default.OrthographicCamera(width / -2, width / 2, height / 2, height / -2, orthoNear, orthoFar);\n    this.cameraP = new _three2.default.PerspectiveCamera(fov, width / height, near, far);\n\n    this.zoom = 1;\n\n    this.toPerspective();\n\n    var aspect = width / height;\n\n    this.target = new _three2.default.Vector3();\n    this.defaultPosition = new _three2.default.Vector3();\n\n    /**\n      Orientations:\n        front: +x \n        back:  -x\n        top/above : +z\n        bottom/under : -z\n        left: +y\n        right: -y \n    */\n    this.orientationMap = {\n        "F": new _three2.default.Vector3(1, 0, 0),\n        "B": new _three2.default.Vector3(-1, 0, 0),\n\n        "A": new _three2.default.Vector3(0, 0, 1),\n        "U": new _three2.default.Vector3(0, 0, -1),\n\n        "L": new _three2.default.Vector3(0, 1, 0),\n        "R": new _three2.default.Vector3(0, -1, 0)\n    };\n\n    //we generate methods for each an every possible case\n    var orientationNameMap = {\n        "F": "Front",\n        "B": "Back",\n        "L": "Left",\n        "R": "Right",\n        "A": "Top",\n        "U": "Bottom",\n\n        "FL": "FrontLeft",\n        "FR": "FrontRight",\n        "FA": "FrontTop",\n        "FU": "FrontBottom",\n\n        "BL": "BackLeft",\n        "BR": "BackRight",\n        "BA": "BackTop",\n        "BU": "BackBottom",\n\n        "LA": "LeftTop",\n        "LU": "LeftBottom",\n        "RA": "RightTop",\n        "RU": "RightBottom",\n\n        "FAL": "FrontTopLeft",\n        "FAR": "FrontTopRight",\n        "FUL": "FrontBottomLeft",\n        "FUR": "FrontBottomRight",\n\n        "BAL": "BackTopLeft",\n        "BAR": "BackTopRight",\n        "BUL": "BackBottomLeft",\n        "BUR": "BackBottomRight"\n    };\n\n    var self = this;\n    function createOrientationFunct(methodName, orCode) {\n        self[methodName] = function () {\n            self.orientationGenerator(orCode);\n        };\n    }\n\n    for (var shortOrientationName in orientationNameMap) {\n        var orientation = orientationNameMap[shortOrientationName];\n        var methodName = "to" + orientation.charAt(0).toUpperCase() + orientation.slice(1) + "View";\n        createOrientationFunct(methodName, shortOrientationName);\n    }\n};\n\nCombinedCamera.prototype = Object.create(_three2.default.Camera.prototype);\n\nCombinedCamera.prototype.lookAt = function () {\n\n    // This routine does not support cameras with rotated and/or translated parent(s)\n\n    var m1 = new _three2.default.Matrix4();\n\n    return function (vector) {\n        this.target = vector;\n        if (this.inOrthographicMode === true) {\n            this.toOrthographic();\n        }\n\n        m1.lookAt(this.position, vector, this.up);\n\n        this.quaternion.setFromRotationMatrix(m1);\n    };\n}();\n\nCombinedCamera.prototype.toPerspective = function () {\n\n    // Switches to the Perspective Camera\n\n    this.near = this.cameraP.near;\n    this.far = this.cameraP.far;\n\n    this.cameraP.fov = this.fov / this.zoom;\n\n    this.cameraP.updateProjectionMatrix();\n\n    this.projectionMatrix = this.cameraP.projectionMatrix;\n\n    this.inPerspectiveMode = true;\n    this.inOrthographicMode = false;\n};\n\nCombinedCamera.prototype.toOrthographic = function () {\n\n    // Switches to the Orthographic camera estimating viewport from Perspective\n\n    var fov = this.fov;\n    var aspect = this.cameraP.aspect;\n    var near = this.cameraP.near;\n    var far = this.cameraP.far;\n\n    //set the orthographic view rectangle to 0,0,width,height\n    //see here : http://stackoverflow.com/questions/13483775/set-zoomvalue-of-a-perspective-equal-to-perspective\n    if (this.target === null) {\n        this.target = new _three2.default.Vector3();\n    }\n    var distance = new _three2.default.Vector3().subVectors(this.position, this.target).length() * 0.3;\n    var width = Math.tan(fov) * distance * aspect;\n    var height = Math.tan(fov) * distance;\n\n    var halfWidth = width;\n    var halfHeight = height;\n\n    this.cameraO.left = halfWidth;\n    this.cameraO.right = -halfWidth;\n    this.cameraO.top = -halfHeight;\n    this.cameraO.bottom = halfHeight;\n\n    this.cameraO.updateProjectionMatrix();\n\n    this.near = this.cameraO.near;\n    this.far = this.cameraO.far;\n    this.projectionMatrix = this.cameraO.projectionMatrix;\n\n    this.inPerspectiveMode = false;\n    this.inOrthographicMode = true;\n};\n\nCombinedCamera.prototype.setSize = function (width, height) {\n\n    this.cameraP.aspect = width / height;\n    this.left = -width / 2;\n    this.right = width / 2;\n    this.top = height / 2;\n    this.bottom = -height / 2;\n};\n\nCombinedCamera.prototype.setFov = function (fov) {\n\n    this.fov = fov;\n\n    if (this.inPerspectiveMode) {\n\n        this.toPerspective();\n    } else {\n\n        this.toOrthographic();\n    }\n};\n\n// For mantaining similar API with PerspectiveCamera\n\nCombinedCamera.prototype.updateProjectionMatrix = function () {\n\n    if (this.inPerspectiveMode) {\n\n        this.toPerspective();\n    } else {\n\n        this.toPerspective();\n        this.toOrthographic();\n    }\n};\n\n/*\n* Uses Focal Length (in mm) to estimate and set FOV\n* 35mm (fullframe) camera is used if frame size is not specified;\n* Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html\n*/\nCombinedCamera.prototype.setLens = function (focalLength, frameHeight) {\n\n    if (frameHeight === undefined) frameHeight = 24;\n\n    var fov = 2 * _three2.default.Math.radToDeg(Math.atan(frameHeight / (focalLength * 2)));\n\n    this.setFov(fov);\n\n    return fov;\n};\n\nCombinedCamera.prototype.setZoom = function (zoom) {\n\n    this.zoom = zoom;\n\n    if (this.inPerspectiveMode) {\n        this.toPerspective();\n    } else {\n        this.toOrthographic();\n    }\n};\n\nCombinedCamera.prototype.toDiagonalView = function () {\n    this.position.copy(this.defaultPosition);\n    this.target = new _three2.default.Vector3();\n    this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.orientationGenerator = function (name) {\n\n    //name is a string of letters of length 1 to 3 representing\n    // the desired orientation : ex : a: above, r: right, ar: above right\n    //, flb: front left bottom\n\n    var offset = this.position.clone().sub(this.target);\n    var components = name;\n    //console.log("offset distance",offset.length());\n\n    var combinedTransform = new _three2.default.Vector3();\n    for (var i = 0; i < components.length; i++) {\n        //console.log("handling", components[i] );\n        var component = components[i];\n        var nPost = this.orientationMap[component].clone(); //.multiplyScalar( offset.length() );\n\n        combinedTransform.add(nPost);\n    }\n    combinedTransform.setLength(offset.length());\n    //console.log("offset disance 2",combinedTransform.length() );\n    this.position.copy(combinedTransform);\n\n    //console.log("offset disance 3",this.position.clone().sub(this.target).length() );\n    this.lookAt(this.target);\n    //console.log("offset disance 4",this.position.clone().sub(this.target).length() );\n};\n\n/*CombinedCamera.prototype.toFrontView = function() {\n    \n    var offset = this.position.clone().sub( this.target );\n    var nPost = new  THREE.Vector3();\n    nPost.y = -offset.length();\n    this.position.copy( nPost );\n    this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontLeftView = function() {\n    //TODO: check posisitoning\n    var offset = this.position.clone().sub( this.target );\n    var nPost = new  THREE.Vector3();\n    nPost.y = -offset.length();\n    nPost.x = -offset.length();\n    this.position.copy( nPost );\n    this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontRightView = function() {\n    //TODO: check posisitoning\n    var offset = this.position.clone().sub( this.target );\n    var nPost = new  THREE.Vector3();\n    nPost.y = -offset.length();\n    nPost.x = offset.length();\n    this.position.copy( nPost );\n    this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontTopView = function() {\n    //TODO: check posisitoning\n    var offset = this.position.clone().sub( this.target );\n    var nPost = new  THREE.Vector3();\n    nPost.y = -offset.length();\n    nPost.z = offset.length();\n    this.position.copy( nPost );\n    this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontBottomView = function() {\n    //TODO: check posisitoning\n    var offset = this.position.clone().sub( this.target );\n    var nPost = new  THREE.Vector3();\n    nPost.y = -offset.length();\n    nPost.z = -offset.length();\n    this.position.copy( nPost );\n    this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toBackView = function() {\n\n    var offset = this.position.clone().sub(this.target);\n    var nPost = new  THREE.Vector3();\n    nPost.y = offset.length();\n    this.position.copy(nPost);\n    this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.toLeftView = function() {\n    \n    var offset = this.position.clone().sub(this.target);\n    var nPost = new  THREE.Vector3();\n    nPost.x = offset.length();\n    this.position.copy(nPost);\n    this.lookAt(this.target);\n    \n};\n\nCombinedCamera.prototype.toRightView = function() {\n    var offset = this.position.clone().sub(this.target);\n    var nPost = new  THREE.Vector3();\n    nPost.x = -offset.length();\n    this.position.copy( nPost );\n    this.lookAt(this.target );\n};\n\nCombinedCamera.prototype.toTopView = function() {\n    this.orientationGenerator( "a" );\n};\n\nCombinedCamera.prototype.toBottomView = function() {\n    var offset = this.position.clone().sub(this.target);\n    var nPost = new  THREE.Vector3();\n    nPost.z = -offset.length();\n    this.position.copy( nPost );\n    this.lookAt( this.target );\n};*/\n\nCombinedCamera.prototype.centerView = function () {\n    //var offset = new THREE.Vector3().sub(this.target.clone());\n    //this.position= new THREE.Vector3(100,100,200);\n    //this.target = new THREE.Vector3();\n\n    this.position.copy(this.defaultPosition);\n    this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.resetView = function () {\n    this.position.copy(this.defaultPosition);\n    this.target.copy(new _three2.default.Vector3());\n};\n\n//export default CombinedCamera;\nmodule.exports = CombinedCamera;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/CombinedCamera.js\n ** module id = 146\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/CombinedCamera.js?');
},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//faster object.assign\n/**\n * @author kaosat-dev\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n */\nvar OrbitControls = function OrbitControls(object, domElement, upVector) {\n\n  //this.object = object\n  this.objects = [];\n  this.objectOptions = [];\n  this.camStates = [];\n\n  this.domElement = domElement !== undefined ? domElement : document;\n  this.upVector = upVector || new _three2.default.Vector3(0, 1, 0);\n\n  // API\n  this.enabled = true;\n\n  //this.center = new THREE.Vector3()\n  this.centers = [];\n\n  this.userZoom = true;\n  this.userZoomSpeed = 1.0;\n\n  this.userRotate = true;\n  this.userRotateSpeed = 1.0;\n\n  this.userPan = true;\n  this.userPanSpeed = 2.0;\n\n  this.autoRotate = false;\n  this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n  this.minPolarAngle = 0; // radians\n  this.maxPolarAngle = Math.PI; // radians\n\n  this.minDistance = 0.2;\n  this.maxDistance = 1400;\n\n  this.active = false;\n  this.mainPointerPressed = false;\n\n  // internals\n\n  var scope = this;\n\n  var EPS = 0.000001;\n  var PIXELS_PER_ROUND = 1800;\n\n  var phiDelta = 0;\n  var thetaDelta = 0;\n  var scale = 1;\n\n  var origPhiDelta = phiDelta;\n  var origThetaDelta = thetaDelta;\n  var origScale = scale;\n\n  //to add control of multiple cameras\n  this.addObject = function (object) {\n    var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n    if (this.objects.indexOf(object) != -1) return;\n    var DEFAULTS = { userZoom: true, userPan: true, userRotate: true };\n    options = (0, _assign2.default)({}, DEFAULTS, options);\n\n    this.objects.push(object);\n    this.objectOptions.push(options);\n    this.centers.push(new _three2.default.Vector3());\n    this.camStates.push({ phiDelta: 0, thetaDelta: 0, scale: 1, lastPosition: new _three2.default.Vector3() });\n  };\n\n  // events\n  var changeEvent = { type: \'change\' };\n\n  this.update = function (dt) {\n    //this is a modified version, with inverted Y and Z (since we use camera.z => up)\n    //we also allow multiple objects/cameras\n    for (var i = 0; i < this.objects.length; i++) {\n      var object = this.objects[i];\n      var center = this.centers[i];\n      var camState = this.camStates[i];\n\n      var curThetaDelta = camState.thetaDelta;\n      var curPhiDelta = camState.phiDelta;\n      var curScale = camState.scale;\n\n      var lastPosition = camState.lastPosition;\n\n      var position = object.position;\n      var offset = position.clone().sub(center);\n\n      if (this.upVector.z == 1) {\n        // angle from z-axis around y-axis, upVector : z\n        var theta = Math.atan2(offset.x, offset.y);\n        // angle from y-axis\n        var phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.y * offset.y), offset.z);\n      } else {\n        //in case of y up\n        var theta = Math.atan2(offset.x, offset.z);\n        var phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n        curThetaDelta = -curThetaDelta;\n      }\n\n      if (this.autoRotate) {\n        //this.rotateLeft( getAutoRotationAngle() )\n        //PER camera\n        this.objects.map(function (object, index) {\n          if (scope.objectOptions[index].userRotate) {\n            scope.camStates[index].thetaDelta += getAutoRotationAngle();\n          }\n        });\n      }\n\n      theta += curThetaDelta;\n      phi += curPhiDelta;\n\n      // restrict phi to be between desired limits\n      phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, phi));\n      // restrict phi to be betwee EPS and PI-EPS\n      phi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n      //multiply by scaling effect\n      var radius = offset.length() * curScale;\n      // restrict radius to be between desired limits\n      radius = Math.max(this.minDistance, Math.min(this.maxDistance, radius));\n\n      if (this.upVector.z == 1) {\n        offset.x = radius * Math.sin(phi) * Math.sin(theta);\n        offset.z = radius * Math.cos(phi);\n        offset.y = radius * Math.sin(phi) * Math.cos(theta);\n      } else {\n        offset.x = radius * Math.sin(phi) * Math.sin(theta);\n        offset.y = radius * Math.cos(phi);\n        offset.z = radius * Math.sin(phi) * Math.cos(theta);\n      }\n\n      //\n      position.copy(center).add(offset);\n      object.lookAt(center);\n\n      if (lastPosition.distanceTo(object.position) > 0) {\n        //this.active = true\n        this.dispatchEvent(changeEvent);\n\n        lastPosition.copy(object.position);\n      } else {\n        //fireDeActivated()\n      }\n\n      camState.thetaDelta /= 1.5;\n      camState.phiDelta /= 1.5;\n      camState.scale = 1;\n    }\n  };\n\n  function getAutoRotationAngle() {\n    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n  }\n\n  function getZoomScale() {\n    return Math.pow(0.95, scope.userZoomSpeed);\n  }\n\n  this.enable = function () {\n    scope.enabled = true;\n    this.enabled = true;\n  };\n\n  this.disable = function () {\n    scope.enabled = false;\n    this.enabled = false;\n  };\n\n  this.reset = function () {\n    for (var i = 0; i < this.objects.length; i++) {\n      var center = this.centers[i];\n      center = new _three2.default.Vector3();\n    }\n    this.objects.map(function (object, index) {\n      var center = this.centers[index];\n      center = new _three2.default.Vector3();\n      this.camStates[index].phiDelta = origPhiDelta;\n      this.camStates[index].thetaDelta = origThetaDelta;\n      this.camStates[index].scale = origScale = scale;\n    });\n\n    this.update();\n  };\n\n  this.setObservables = function (observables) {\n    var dragMoves$ = observables.dragMoves$;\n    var zooms$ = observables.zooms$;\n\n\n    var self = this;\n\n    /* are these useful ?\n    scope.userZoomSpeed = 0.6\n    onPinch\n    */\n    function zoom(zoomDir, zoomScale, cameras) {\n\n      if (scope.enabled === false) return;\n      if (scope.userZoom === false) return;\n\n      //PER camera\n      cameras.map(function (object, index) {\n        if (scope.objectOptions[index].userZoom) {\n\n          if (zoomDir < 0) scope.camStates[index].scale /= zoomScale;\n          if (zoomDir > 0) scope.camStates[index].scale *= zoomScale;\n        }\n      });\n    }\n\n    function rotate(cameras, angle) {\n\n      if (scope.enabled === false) return;\n      if (scope.userRotate === false) return;\n\n      //PER camera\n      cameras.map(function (object, index) {\n        if (scope.objectOptions[index].userRotate) {\n          scope.camStates[index].thetaDelta += angle.x;\n          scope.camStates[index].phiDelta += angle.y;\n        }\n      });\n    }\n\n    //TODO: implement\n    function pan(cameras, offset) {\n      //console.log(event)\n      var _origDist = distance.clone();\n\n      //do this PER camera\n      cameras.map(function (object, index) {\n        if (scope.objectOptions[index].userPan) {\n          var _distance = _origDist.clone();\n          _distance.transformDirection(object.matrix);\n          _distance.multiplyScalar(scope.userPanSpeed);\n\n          object.position.add(_distance);\n          scope.centers[index].add(_distance);\n        }\n      });\n    }\n\n    dragMoves$.subscribe(function (e) {\n      var delta = e.delta;\n\n      /*if ( angle === undefined ) {\n      angle = 2 * Math.PI /180  * scope.userRotateSpeed\n      }*/\n      var angle = { x: 0, y: 0 };\n      angle.x = 2 * Math.PI * delta.x / PIXELS_PER_ROUND * scope.userRotateSpeed;\n      angle.y = -2 * Math.PI * delta.y / PIXELS_PER_ROUND * scope.userRotateSpeed;\n\n      //console.log("rotate by angle",angle)\n      /*if ( angle === undefined ) {\n        angle = 2 * Math.PI /180  * scope.userRotateSpeed\n      } */\n      rotate(self.objects, angle);\n    });\n    //.subscribe(e=>e)//console.log("dragMoves",e.delta))\n\n    zooms$.subscribe(function (delta) {\n      var zoomScale = undefined;\n      if (!zoomScale) {\n        zoomScale = getZoomScale();\n      }\n      zoom(delta, zoomScale, self.objects);\n    });\n    //.subscribe(e=>e)//console.log("zoom",e))\n  };\n};\n\nOrbitControls.prototype = Object.create(_three2.default.EventDispatcher.prototype);\n\nexports.default = OrbitControls;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/OrbitControls.js\n ** module id = 147\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/OrbitControls.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n	value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//var THREE = require(\"three\"); //until it is done via the import syntax everywhere we have to use this\n\n_three2.default.RenderableObject = function () {\n\n	this.id = 0;\n\n	this.object = null;\n	this.z = 0;\n};\n\n//\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author supereggbert / http://www.paulbrunt.co.uk/\n * @author julianwa / https://github.com/julianwa\n */\n_three2.default.RenderableFace = function () {\n\n	this.id = 0;\n\n	this.v1 = new _three2.default.RenderableVertex();\n	this.v2 = new _three2.default.RenderableVertex();\n	this.v3 = new _three2.default.RenderableVertex();\n\n	this.normalModel = new _three2.default.Vector3();\n\n	this.vertexNormalsModel = [new _three2.default.Vector3(), new _three2.default.Vector3(), new _three2.default.Vector3()];\n	this.vertexNormalsLength = 0;\n\n	this.color = new _three2.default.Color();\n	this.material = null;\n	this.uvs = [new _three2.default.Vector2(), new _three2.default.Vector2(), new _three2.default.Vector2()];\n\n	this.z = 0;\n};\n\n//\n\n_three2.default.RenderableVertex = function () {\n\n	this.position = new _three2.default.Vector3();\n	this.positionWorld = new _three2.default.Vector3();\n	this.positionScreen = new _three2.default.Vector4();\n\n	this.visible = true;\n};\n\n_three2.default.RenderableVertex.prototype.copy = function (vertex) {\n\n	this.positionWorld.copy(vertex.positionWorld);\n	this.positionScreen.copy(vertex.positionScreen);\n};\n\n//\n\n_three2.default.RenderableLine = function () {\n\n	this.id = 0;\n\n	this.v1 = new _three2.default.RenderableVertex();\n	this.v2 = new _three2.default.RenderableVertex();\n\n	this.vertexColors = [new _three2.default.Color(), new _three2.default.Color()];\n	this.material = null;\n\n	this.z = 0;\n};\n\n//\n\n_three2.default.RenderableSprite = function () {\n\n	this.id = 0;\n\n	this.object = null;\n\n	this.x = 0;\n	this.y = 0;\n	this.z = 0;\n\n	this.rotation = 0;\n	this.scale = new _three2.default.Vector2();\n\n	this.material = null;\n};\n\n//\n\n_three2.default.Projector = function () {\n\n	var _object,\n	    _objectCount,\n	    _objectPool = [],\n	    _objectPoolLength = 0,\n	    _vertex,\n	    _vertexCount,\n	    _vertexPool = [],\n	    _vertexPoolLength = 0,\n	    _face,\n	    _faceCount,\n	    _facePool = [],\n	    _facePoolLength = 0,\n	    _line,\n	    _lineCount,\n	    _linePool = [],\n	    _linePoolLength = 0,\n	    _sprite,\n	    _spriteCount,\n	    _spritePool = [],\n	    _spritePoolLength = 0,\n	    _renderData = { objects: [], lights: [], elements: [] },\n	    _vA = new _three2.default.Vector3(),\n	    _vB = new _three2.default.Vector3(),\n	    _vC = new _three2.default.Vector3(),\n	    _vector3 = new _three2.default.Vector3(),\n	    _vector4 = new _three2.default.Vector4(),\n	    _clipBox = new _three2.default.Box3(new _three2.default.Vector3(-1, -1, -1), new _three2.default.Vector3(1, 1, 1)),\n	    _boundingBox = new _three2.default.Box3(),\n	    _points3 = new Array(3),\n	    _points4 = new Array(4),\n	    _viewMatrix = new _three2.default.Matrix4(),\n	    _viewProjectionMatrix = new _three2.default.Matrix4(),\n	    _modelMatrix,\n	    _modelViewProjectionMatrix = new _three2.default.Matrix4(),\n	    _normalMatrix = new _three2.default.Matrix3(),\n	    _frustum = new _three2.default.Frustum(),\n	    _clippedVertex1PositionScreen = new _three2.default.Vector4(),\n	    _clippedVertex2PositionScreen = new _three2.default.Vector4();\n\n	//\n\n	this.projectVector = function (vector, camera) {\n\n		console.warn('THREE.Projector: .projectVector() is now vector.project().');\n		vector.project(camera);\n	};\n\n	this.unprojectVector = function (vector, camera) {\n\n		console.warn('THREE.Projector: .unprojectVector() is now vector.unproject().');\n		vector.unproject(camera);\n	};\n\n	this.pickingRay = function (vector, camera) {\n\n		console.error('THREE.Projector: .pickingRay() has been removed.');\n	};\n\n	//\n\n	var RenderList = function RenderList() {\n\n		var normals = [];\n		var uvs = [];\n\n		var object = null;\n		var material = null;\n\n		var normalMatrix = new _three2.default.Matrix3();\n\n		var setObject = function setObject(value) {\n\n			object = value;\n			material = object.material;\n\n			normalMatrix.getNormalMatrix(object.matrixWorld);\n\n			normals.length = 0;\n			uvs.length = 0;\n		};\n\n		var projectVertex = function projectVertex(vertex) {\n\n			var position = vertex.position;\n			var positionWorld = vertex.positionWorld;\n			var positionScreen = vertex.positionScreen;\n\n			positionWorld.copy(position).applyMatrix4(_modelMatrix);\n			positionScreen.copy(positionWorld).applyMatrix4(_viewProjectionMatrix);\n\n			var invW = 1 / positionScreen.w;\n\n			positionScreen.x *= invW;\n			positionScreen.y *= invW;\n			positionScreen.z *= invW;\n\n			vertex.visible = positionScreen.x >= -1 && positionScreen.x <= 1 && positionScreen.y >= -1 && positionScreen.y <= 1 && positionScreen.z >= -1 && positionScreen.z <= 1;\n		};\n\n		var pushVertex = function pushVertex(x, y, z) {\n\n			_vertex = getNextVertexInPool();\n			_vertex.position.set(x, y, z);\n\n			projectVertex(_vertex);\n		};\n\n		var pushNormal = function pushNormal(x, y, z) {\n\n			normals.push(x, y, z);\n		};\n\n		var pushUv = function pushUv(x, y) {\n\n			uvs.push(x, y);\n		};\n\n		var checkTriangleVisibility = function checkTriangleVisibility(v1, v2, v3) {\n\n			if (v1.visible === true || v2.visible === true || v3.visible === true) return true;\n\n			_points3[0] = v1.positionScreen;\n			_points3[1] = v2.positionScreen;\n			_points3[2] = v3.positionScreen;\n\n			return _clipBox.isIntersectionBox(_boundingBox.setFromPoints(_points3));\n		};\n\n		var checkBackfaceCulling = function checkBackfaceCulling(v1, v2, v3) {\n\n			return (v3.positionScreen.x - v1.positionScreen.x) * (v2.positionScreen.y - v1.positionScreen.y) - (v3.positionScreen.y - v1.positionScreen.y) * (v2.positionScreen.x - v1.positionScreen.x) < 0;\n		};\n\n		var pushLine = function pushLine(a, b) {\n\n			var v1 = _vertexPool[a];\n			var v2 = _vertexPool[b];\n\n			_line = getNextLineInPool();\n\n			_line.id = object.id;\n			_line.v1.copy(v1);\n			_line.v2.copy(v2);\n			_line.z = (v1.positionScreen.z + v2.positionScreen.z) / 2;\n\n			_line.material = object.material;\n\n			_renderData.elements.push(_line);\n		};\n\n		var pushTriangle = function pushTriangle(a, b, c) {\n\n			var v1 = _vertexPool[a];\n			var v2 = _vertexPool[b];\n			var v3 = _vertexPool[c];\n\n			if (checkTriangleVisibility(v1, v2, v3) === false) return;\n\n			if (material.side === _three2.default.DoubleSide || checkBackfaceCulling(v1, v2, v3) === true) {\n\n				_face = getNextFaceInPool();\n\n				_face.id = object.id;\n				_face.v1.copy(v1);\n				_face.v2.copy(v2);\n				_face.v3.copy(v3);\n				_face.z = (v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z) / 3;\n\n				for (var i = 0; i < 3; i++) {\n\n					var offset = arguments[i] * 3;\n					var normal = _face.vertexNormalsModel[i];\n\n					normal.set(normals[offset], normals[offset + 1], normals[offset + 2]);\n					normal.applyMatrix3(normalMatrix).normalize();\n\n					var offset2 = arguments[i] * 2;\n\n					var uv = _face.uvs[i];\n					uv.set(uvs[offset2], uvs[offset2 + 1]);\n				}\n\n				_face.vertexNormalsLength = 3;\n\n				_face.material = object.material;\n\n				_renderData.elements.push(_face);\n			}\n		};\n\n		return {\n			setObject: setObject,\n			projectVertex: projectVertex,\n			checkTriangleVisibility: checkTriangleVisibility,\n			checkBackfaceCulling: checkBackfaceCulling,\n			pushVertex: pushVertex,\n			pushNormal: pushNormal,\n			pushUv: pushUv,\n			pushLine: pushLine,\n			pushTriangle: pushTriangle\n		};\n	};\n\n	var renderList = new RenderList();\n\n	this.projectScene = function (scene, camera, sortObjects, sortElements) {\n\n		_faceCount = 0;\n		_lineCount = 0;\n		_spriteCount = 0;\n\n		_renderData.elements.length = 0;\n\n		if (scene.autoUpdate === true) scene.updateMatrixWorld();\n		if (camera.parent === undefined) camera.updateMatrixWorld();\n\n		_viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\n		_viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix);\n\n		_frustum.setFromMatrix(_viewProjectionMatrix);\n\n		//\n\n		_objectCount = 0;\n\n		_renderData.objects.length = 0;\n		_renderData.lights.length = 0;\n\n		scene.traverseVisible(function (object) {\n\n			if (object instanceof _three2.default.Light) {\n\n				_renderData.lights.push(object);\n			} else if (object instanceof _three2.default.Mesh || object instanceof _three2.default.Line || object instanceof _three2.default.Sprite) {\n\n				if (object.material.visible === false) return;\n\n				if (object.frustumCulled === false || _frustum.intersectsObject(object) === true) {\n\n					_object = getNextObjectInPool();\n					_object.id = object.id;\n					_object.object = object;\n\n					if (object.renderDepth !== null) {\n\n						_object.z = object.renderDepth;\n					} else {\n\n						_vector3.setFromMatrixPosition(object.matrixWorld);\n						_vector3.applyProjection(_viewProjectionMatrix);\n						_object.z = _vector3.z;\n					}\n\n					_renderData.objects.push(_object);\n				}\n			}\n		});\n\n		if (sortObjects === true) {\n\n			_renderData.objects.sort(painterSort);\n		}\n\n		//\n\n		for (var o = 0, ol = _renderData.objects.length; o < ol; o++) {\n\n			var object = _renderData.objects[o].object;\n			var geometry = object.geometry;\n\n			renderList.setObject(object);\n\n			_modelMatrix = object.matrixWorld;\n\n			_vertexCount = 0;\n\n			if (object instanceof _three2.default.Mesh) {\n\n				if (geometry instanceof _three2.default.BufferGeometry) {\n\n					var attributes = geometry.attributes;\n					var offsets = geometry.offsets;\n\n					if (attributes.position === undefined) continue;\n\n					var positions = attributes.position.array;\n\n					for (var i = 0, l = positions.length; i < l; i += 3) {\n\n						renderList.pushVertex(positions[i], positions[i + 1], positions[i + 2]);\n					}\n\n					if (attributes.normal !== undefined) {\n\n						var normals = attributes.normal.array;\n\n						for (var i = 0, l = normals.length; i < l; i += 3) {\n\n							renderList.pushNormal(normals[i], normals[i + 1], normals[i + 2]);\n						}\n					}\n\n					if (attributes.uv !== undefined) {\n\n						var uvs = attributes.uv.array;\n\n						for (var i = 0, l = uvs.length; i < l; i += 2) {\n\n							renderList.pushUv(uvs[i], uvs[i + 1]);\n						}\n					}\n\n					if (attributes.index !== undefined) {\n\n						var indices = attributes.index.array;\n\n						if (offsets.length > 0) {\n\n							for (var o = 0; o < offsets.length; o++) {\n\n								var offset = offsets[o];\n								var index = offset.index;\n\n								for (var i = offset.start, l = offset.start + offset.count; i < l; i += 3) {\n\n									renderList.pushTriangle(indices[i] + index, indices[i + 1] + index, indices[i + 2] + index);\n								}\n							}\n						} else {\n\n							for (var i = 0, l = indices.length; i < l; i += 3) {\n\n								renderList.pushTriangle(indices[i], indices[i + 1], indices[i + 2]);\n							}\n						}\n					} else {\n\n						for (var i = 0, l = positions.length / 3; i < l; i += 3) {\n\n							renderList.pushTriangle(i, i + 1, i + 2);\n						}\n					}\n				} else if (geometry instanceof _three2.default.Geometry) {\n\n					var vertices = geometry.vertices;\n					var faces = geometry.faces;\n					var faceVertexUvs = geometry.faceVertexUvs[0];\n\n					_normalMatrix.getNormalMatrix(_modelMatrix);\n\n					var isFaceMaterial = object.material instanceof _three2.default.MeshFaceMaterial;\n					var objectMaterials = isFaceMaterial === true ? object.material : null;\n\n					for (var v = 0, vl = vertices.length; v < vl; v++) {\n\n						var vertex = vertices[v];\n						renderList.pushVertex(vertex.x, vertex.y, vertex.z);\n					}\n\n					for (var f = 0, fl = faces.length; f < fl; f++) {\n\n						var face = faces[f];\n\n						var material = isFaceMaterial === true ? objectMaterials.materials[face.materialIndex] : object.material;\n\n						if (material === undefined) continue;\n\n						var side = material.side;\n\n						var v1 = _vertexPool[face.a];\n						var v2 = _vertexPool[face.b];\n						var v3 = _vertexPool[face.c];\n\n						if (material.morphTargets === true) {\n\n							var morphTargets = geometry.morphTargets;\n							var morphInfluences = object.morphTargetInfluences;\n\n							var v1p = v1.position;\n							var v2p = v2.position;\n							var v3p = v3.position;\n\n							_vA.set(0, 0, 0);\n							_vB.set(0, 0, 0);\n							_vC.set(0, 0, 0);\n\n							for (var t = 0, tl = morphTargets.length; t < tl; t++) {\n\n								var influence = morphInfluences[t];\n\n								if (influence === 0) continue;\n\n								var targets = morphTargets[t].vertices;\n\n								_vA.x += (targets[face.a].x - v1p.x) * influence;\n								_vA.y += (targets[face.a].y - v1p.y) * influence;\n								_vA.z += (targets[face.a].z - v1p.z) * influence;\n\n								_vB.x += (targets[face.b].x - v2p.x) * influence;\n								_vB.y += (targets[face.b].y - v2p.y) * influence;\n								_vB.z += (targets[face.b].z - v2p.z) * influence;\n\n								_vC.x += (targets[face.c].x - v3p.x) * influence;\n								_vC.y += (targets[face.c].y - v3p.y) * influence;\n								_vC.z += (targets[face.c].z - v3p.z) * influence;\n							}\n\n							v1.position.add(_vA);\n							v2.position.add(_vB);\n							v3.position.add(_vC);\n\n							renderList.projectVertex(v1);\n							renderList.projectVertex(v2);\n							renderList.projectVertex(v3);\n						}\n\n						if (renderList.checkTriangleVisibility(v1, v2, v3) === false) continue;\n\n						var visible = renderList.checkBackfaceCulling(v1, v2, v3);\n\n						if (side !== _three2.default.DoubleSide) {\n							if (side === _three2.default.FrontSide && visible === false) continue;\n							if (side === _three2.default.BackSide && visible === true) continue;\n						}\n\n						_face = getNextFaceInPool();\n\n						_face.id = object.id;\n						_face.v1.copy(v1);\n						_face.v2.copy(v2);\n						_face.v3.copy(v3);\n\n						_face.normalModel.copy(face.normal);\n\n						if (visible === false && (side === _three2.default.BackSide || side === _three2.default.DoubleSide)) {\n\n							_face.normalModel.negate();\n						}\n\n						_face.normalModel.applyMatrix3(_normalMatrix).normalize();\n\n						var faceVertexNormals = face.vertexNormals;\n\n						for (var n = 0, nl = Math.min(faceVertexNormals.length, 3); n < nl; n++) {\n\n							var normalModel = _face.vertexNormalsModel[n];\n							normalModel.copy(faceVertexNormals[n]);\n\n							if (visible === false && (side === _three2.default.BackSide || side === _three2.default.DoubleSide)) {\n\n								normalModel.negate();\n							}\n\n							normalModel.applyMatrix3(_normalMatrix).normalize();\n						}\n\n						_face.vertexNormalsLength = faceVertexNormals.length;\n\n						var vertexUvs = faceVertexUvs[f];\n\n						if (vertexUvs !== undefined) {\n\n							for (var u = 0; u < 3; u++) {\n\n								_face.uvs[u].copy(vertexUvs[u]);\n							}\n						}\n\n						_face.color = face.color;\n						_face.material = material;\n\n						_face.z = (v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z) / 3;\n\n						_renderData.elements.push(_face);\n					}\n				}\n			} else if (object instanceof _three2.default.Line) {\n\n				if (geometry instanceof _three2.default.BufferGeometry) {\n\n					var attributes = geometry.attributes;\n\n					if (attributes.position !== undefined) {\n\n						var positions = attributes.position.array;\n\n						for (var i = 0, l = positions.length; i < l; i += 3) {\n\n							renderList.pushVertex(positions[i], positions[i + 1], positions[i + 2]);\n						}\n\n						if (attributes.index !== undefined) {\n\n							var indices = attributes.index.array;\n\n							for (var i = 0, l = indices.length; i < l; i += 2) {\n\n								renderList.pushLine(indices[i], indices[i + 1]);\n							}\n						} else {\n\n							var step = object.mode === _three2.default.LinePieces ? 2 : 1;\n\n							for (var i = 0, l = positions.length / 3 - 1; i < l; i += step) {\n\n								renderList.pushLine(i, i + 1);\n							}\n						}\n					}\n				} else if (geometry instanceof _three2.default.Geometry) {\n\n					_modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix, _modelMatrix);\n\n					var vertices = object.geometry.vertices;\n\n					if (vertices.length === 0) continue;\n\n					v1 = getNextVertexInPool();\n					v1.positionScreen.copy(vertices[0]).applyMatrix4(_modelViewProjectionMatrix);\n\n					// Handle LineStrip and LinePieces\n					var step = object.mode === _three2.default.LinePieces ? 2 : 1;\n\n					for (var v = 1, vl = vertices.length; v < vl; v++) {\n\n						v1 = getNextVertexInPool();\n						v1.positionScreen.copy(vertices[v]).applyMatrix4(_modelViewProjectionMatrix);\n\n						if ((v + 1) % step > 0) continue;\n\n						v2 = _vertexPool[_vertexCount - 2];\n\n						_clippedVertex1PositionScreen.copy(v1.positionScreen);\n						_clippedVertex2PositionScreen.copy(v2.positionScreen);\n\n						if (clipLine(_clippedVertex1PositionScreen, _clippedVertex2PositionScreen) === true) {\n\n							// Perform the perspective divide\n							_clippedVertex1PositionScreen.multiplyScalar(1 / _clippedVertex1PositionScreen.w);\n							_clippedVertex2PositionScreen.multiplyScalar(1 / _clippedVertex2PositionScreen.w);\n\n							_line = getNextLineInPool();\n\n							_line.id = object.id;\n							_line.v1.positionScreen.copy(_clippedVertex1PositionScreen);\n							_line.v2.positionScreen.copy(_clippedVertex2PositionScreen);\n\n							_line.z = Math.max(_clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z);\n\n							_line.material = object.material;\n\n							if (object.material.vertexColors === _three2.default.VertexColors) {\n\n								_line.vertexColors[0].copy(object.geometry.colors[v]);\n								_line.vertexColors[1].copy(object.geometry.colors[v - 1]);\n							}\n\n							_renderData.elements.push(_line);\n						}\n					}\n				}\n			} else if (object instanceof _three2.default.Sprite) {\n\n				_vector4.set(_modelMatrix.elements[12], _modelMatrix.elements[13], _modelMatrix.elements[14], 1);\n				_vector4.applyMatrix4(_viewProjectionMatrix);\n\n				var invW = 1 / _vector4.w;\n\n				_vector4.z *= invW;\n\n				if (_vector4.z >= -1 && _vector4.z <= 1) {\n\n					_sprite = getNextSpriteInPool();\n					_sprite.id = object.id;\n					_sprite.x = _vector4.x * invW;\n					_sprite.y = _vector4.y * invW;\n					_sprite.z = _vector4.z;\n					_sprite.object = object;\n\n					_sprite.rotation = object.rotation;\n\n					_sprite.scale.x = object.scale.x * Math.abs(_sprite.x - (_vector4.x + camera.projectionMatrix.elements[0]) / (_vector4.w + camera.projectionMatrix.elements[12]));\n					_sprite.scale.y = object.scale.y * Math.abs(_sprite.y - (_vector4.y + camera.projectionMatrix.elements[5]) / (_vector4.w + camera.projectionMatrix.elements[13]));\n\n					_sprite.material = object.material;\n\n					_renderData.elements.push(_sprite);\n				}\n			}\n		}\n\n		if (sortElements === true) {\n\n			_renderData.elements.sort(painterSort);\n		}\n\n		return _renderData;\n	};\n\n	// Pools\n\n	function getNextObjectInPool() {\n\n		if (_objectCount === _objectPoolLength) {\n\n			var object = new _three2.default.RenderableObject();\n			_objectPool.push(object);\n			_objectPoolLength++;\n			_objectCount++;\n			return object;\n		}\n\n		return _objectPool[_objectCount++];\n	}\n\n	function getNextVertexInPool() {\n\n		if (_vertexCount === _vertexPoolLength) {\n\n			var vertex = new _three2.default.RenderableVertex();\n			_vertexPool.push(vertex);\n			_vertexPoolLength++;\n			_vertexCount++;\n			return vertex;\n		}\n\n		return _vertexPool[_vertexCount++];\n	}\n\n	function getNextFaceInPool() {\n\n		if (_faceCount === _facePoolLength) {\n\n			var face = new _three2.default.RenderableFace();\n			_facePool.push(face);\n			_facePoolLength++;\n			_faceCount++;\n			return face;\n		}\n\n		return _facePool[_faceCount++];\n	}\n\n	function getNextLineInPool() {\n\n		if (_lineCount === _linePoolLength) {\n\n			var line = new _three2.default.RenderableLine();\n			_linePool.push(line);\n			_linePoolLength++;\n			_lineCount++;\n			return line;\n		}\n\n		return _linePool[_lineCount++];\n	}\n\n	function getNextSpriteInPool() {\n\n		if (_spriteCount === _spritePoolLength) {\n\n			var sprite = new _three2.default.RenderableSprite();\n			_spritePool.push(sprite);\n			_spritePoolLength++;\n			_spriteCount++;\n			return sprite;\n		}\n\n		return _spritePool[_spriteCount++];\n	}\n\n	//\n\n	function painterSort(a, b) {\n\n		if (a.z !== b.z) {\n\n			return b.z - a.z;\n		} else if (a.id !== b.id) {\n\n			return a.id - b.id;\n		} else {\n\n			return 0;\n		}\n	}\n\n	function clipLine(s1, s2) {\n\n		var alpha1 = 0,\n		    alpha2 = 1,\n\n\n		// Calculate the boundary coordinate of each vertex for the near and far clip planes,\n		// Z = -1 and Z = +1, respectively.\n		bc1near = s1.z + s1.w,\n		    bc2near = s2.z + s2.w,\n		    bc1far = -s1.z + s1.w,\n		    bc2far = -s2.z + s2.w;\n\n		if (bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0) {\n\n			// Both vertices lie entirely within all clip planes.\n			return true;\n		} else if (bc1near < 0 && bc2near < 0 || bc1far < 0 && bc2far < 0) {\n\n			// Both vertices lie entirely outside one of the clip planes.\n			return false;\n		} else {\n\n			// The line segment spans at least one clip plane.\n\n			if (bc1near < 0) {\n\n				// v1 lies outside the near plane, v2 inside\n				alpha1 = Math.max(alpha1, bc1near / (bc1near - bc2near));\n			} else if (bc2near < 0) {\n\n				// v2 lies outside the near plane, v1 inside\n				alpha2 = Math.min(alpha2, bc1near / (bc1near - bc2near));\n			}\n\n			if (bc1far < 0) {\n\n				// v1 lies outside the far plane, v2 inside\n				alpha1 = Math.max(alpha1, bc1far / (bc1far - bc2far));\n			} else if (bc2far < 0) {\n\n				// v2 lies outside the far plane, v2 inside\n				alpha2 = Math.min(alpha2, bc1far / (bc1far - bc2far));\n			}\n\n			if (alpha2 < alpha1) {\n\n				// The line segment spans two boundaries, but is outside both of them.\n				// (This can't happen when we're only clipping against just near/far but good\n				//  to leave the check here for future usage if other clip planes are added.)\n				return false;\n			} else {\n\n				// Update the s1 and s2 vertices to match the clipped line segment.\n				s1.lerp(s2, alpha1);\n				s2.lerp(s1, 1 - alpha2);\n\n				return true;\n			}\n		}\n	}\n};\n\n//module.exports = THREE.Projector;\nexports.default = _three2.default.Projector;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Projector.js\n ** module id = 148\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Projector.js?");
},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n    value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * original @author stemkoski / http://github.com/stemkoski\n * modified by @kaosat-dev / http://github.com/kaosat-dev\n * Blend three textures additively\n * texel1 + texel2\n * + vec4(0.5, 0.75, 1.0, 1.0)\n */\n\nvar AdditiveBlendShader = {\n\n    uniforms: {\n\n        "tDiffuse1": { type: "t", value: null },\n        "tDiffuse2": { type: "t", value: null },\n        "tDiffuse3": { type: "t", value: null },\n        "normalThreshold": { type: "f", value: 0.1 },\n        "depthThreshold": { type: "f", value: 0.05 },\n        "strengh": { type: "f", value: 0.4 },\n        "color": { type: "c", value: new _three2.default.Color(0x000002) }\n    },\n\n    vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n    fragmentShader: ["uniform sampler2D tDiffuse1;", "uniform sampler2D tDiffuse2;", "uniform sampler2D tDiffuse3;", "uniform float normalThreshold;", "uniform float depthThreshold;", "uniform float strengh;", "uniform vec3 color;", "varying vec2 vUv;", "void main() {", "vec4 colorTexel = texture2D( tDiffuse1, vUv );", "vec4 normalTexel = texture2D( tDiffuse2, vUv );", "vec4 depthTexel = texture2D( tDiffuse3, vUv );", "gl_FragColor = colorTexel;", "if( normalTexel.r >= normalThreshold || depthTexel.r >=depthThreshold) {", "gl_FragColor= colorTexel*(1.0-strengh) + vec4(color[0], color[1], color[2],1);", "}", "}"].join("\\n")\n\n};\n\nexports.default = AdditiveBlendShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/AdditiveBlendShader.js\n ** module id = 149\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/AdditiveBlendShader.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Full-screen textured quad shader\n */\n\n_three2.default.CopyShader = {\n\n  uniforms: {\n\n    "tDiffuse": { type: "t", value: null },\n    "opacity": { type: "f", value: 1.0 }\n\n  },\n\n  vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n  fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.CopyShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/CopyShader.js\n ** module id = 150\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/CopyShader.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n    value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author zz85 / https://github.com/zz85 | https://www.lab4games.net/zz85/blog\n *\n * Edge Detection Shader using Sobel filter\n * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector\n *\n * aspect: vec2 of (1/width, 1/height)\n */\n\nvar EdgeShader3 = {\n\n    uniforms: {\n\n        "tDiffuse": { type: "t", value: null },\n        "aspect": { type: "v2", value: new _three2.default.Vector2(512, 512) }\n    },\n\n    vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n    fragmentShader: ["uniform sampler2D tDiffuse;", "varying vec2 vUv;", "uniform vec2 aspect;", "vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);", "mat3 G[2];", "const mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );", "const mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );", "void main(void)", "{", "mat3 I;", "float cnv[2];", "vec3 sample;", "G[0] = g0;", "G[1] = g1;",\n\n    /* fetch the 3x3 neighbourhood and use the RGB vector\'s length as intensity value */\n    "for (float i=0.0; i<3.0; i++)", "for (float j=0.0; j<3.0; j++) {", "sample = texture2D( tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;", "I[int(i)][int(j)] = length(sample);", "}",\n\n    /* calculate the convolution values for all the masks */\n    "for (int i=0; i<2; i++) {", "float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);", "cnv[i] = dp3 * dp3; ", "}", "gl_FragColor = vec4(0.5 * sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1]));", "} "].join("\\n")\n\n};\n\nexports.default = EdgeShader3;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/EdgeShader3.js\n ** module id = 151\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/EdgeShader3.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.EffectComposer = function (renderer, renderTarget) {\n\n  this.renderer = renderer;\n\n  if (renderTarget === undefined) {\n\n    var pixelRatio = renderer.getPixelRatio();\n\n    var width = Math.floor(renderer.context.canvas.width / pixelRatio) || 1;\n    var height = Math.floor(renderer.context.canvas.height / pixelRatio) || 1;\n    var parameters = { minFilter: _three2.default.LinearFilter, magFilter: _three2.default.LinearFilter, format: _three2.default.RGBFormat, stencilBuffer: false };\n\n    renderTarget = new _three2.default.WebGLRenderTarget(width, height, parameters);\n  }\n\n  this.renderTarget1 = renderTarget;\n  this.renderTarget2 = renderTarget.clone();\n\n  this.writeBuffer = this.renderTarget1;\n  this.readBuffer = this.renderTarget2;\n\n  this.passes = [];\n\n  if (_three2.default.CopyShader === undefined) console.error("THREE.EffectComposer relies on THREE.CopyShader");\n\n  this.copyPass = new _three2.default.ShaderPass(_three2.default.CopyShader);\n};\n\n_three2.default.EffectComposer.prototype = {\n\n  swapBuffers: function swapBuffers() {\n\n    var tmp = this.readBuffer;\n    this.readBuffer = this.writeBuffer;\n    this.writeBuffer = tmp;\n  },\n\n  addPass: function addPass(pass) {\n\n    this.passes.push(pass);\n  },\n\n  insertPass: function insertPass(pass, index) {\n\n    this.passes.splice(index, 0, pass);\n  },\n\n  render: function render(delta) {\n\n    this.writeBuffer = this.renderTarget1;\n    this.readBuffer = this.renderTarget2;\n\n    var maskActive = false;\n\n    var pass,\n        i,\n        il = this.passes.length;\n\n    for (i = 0; i < il; i++) {\n\n      pass = this.passes[i];\n\n      if (!pass.enabled) continue;\n\n      pass.render(this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive);\n\n      if (pass.needsSwap) {\n\n        if (maskActive) {\n\n          var context = this.renderer.context;\n\n          context.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);\n\n          this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, delta);\n\n          context.stencilFunc(context.EQUAL, 1, 0xffffffff);\n        }\n\n        this.swapBuffers();\n      }\n\n      if (pass instanceof _three2.default.MaskPass) {\n\n        maskActive = true;\n      } else if (pass instanceof _three2.default.ClearMaskPass) {\n\n        maskActive = false;\n      }\n    }\n  },\n\n  reset: function reset(renderTarget) {\n\n    if (renderTarget === undefined) {\n\n      renderTarget = this.renderTarget1.clone();\n\n      var pixelRatio = this.renderer.getPixelRatio();\n\n      renderTarget.width = Math.floor(this.renderer.context.canvas.width / pixelRatio);\n      renderTarget.height = Math.floor(this.renderer.context.canvas.height / pixelRatio);\n    }\n\n    this.renderTarget1 = renderTarget;\n    this.renderTarget2 = renderTarget.clone();\n\n    this.writeBuffer = this.renderTarget1;\n    this.readBuffer = this.renderTarget2;\n  },\n\n  setSize: function setSize(width, height) {\n\n    var renderTarget = this.renderTarget1.clone();\n\n    renderTarget.width = width;\n    renderTarget.height = height;\n\n    this.reset(renderTarget);\n  }\n\n};\nexports.default = _three2.default.EffectComposer;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/EffectComposer.js\n ** module id = 152\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/EffectComposer.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author davidedc / http://www.sketchpatch.net/\n *\n * NVIDIA FXAA by Timothy Lottes\n * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n * - WebGL port by @supereggbert\n * http://www.glge.org/demos/fxaa/\n */\n\n_three2.default.FXAAShader = {\n\n  uniforms: {\n\n    "tDiffuse": { type: "t", value: null },\n    "resolution": { type: "v2", value: new _three2.default.Vector2(1 / 1024, 1 / 512) }\n\n  },\n\n  vertexShader: ["void main() {", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n  fragmentShader: ["uniform sampler2D tDiffuse;", "uniform vec2 resolution;", "#define FXAA_REDUCE_MIN   (1.0/128.0)", "#define FXAA_REDUCE_MUL   (1.0/8.0)", "#define FXAA_SPAN_MAX     8.0", "void main() {", "vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;", "vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;", "vec4 rgbaM  = texture2D( tDiffuse,  gl_FragCoord.xy  * resolution );", "vec3 rgbM  = rgbaM.xyz;", "vec3 luma = vec3( 0.299, 0.587, 0.114 );", "float lumaNW = dot( rgbNW, luma );", "float lumaNE = dot( rgbNE, luma );", "float lumaSW = dot( rgbSW, luma );", "float lumaSE = dot( rgbSE, luma );", "float lumaM  = dot( rgbM,  luma );", "float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );", "float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );", "vec2 dir;", "dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));", "dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));", "float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );", "float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );", "dir = min( vec2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),", "max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),", "dir * rcpDirMin)) * resolution;", "vec4 rgbA = (1.0/2.0) * (", "texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (1.0/3.0 - 0.5)) +", "texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (2.0/3.0 - 0.5)));", "vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (", "texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (0.0/3.0 - 0.5)) +", "texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (3.0/3.0 - 0.5)));", "float lumaB = dot(rgbB, vec4(luma, 0.0));", "if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {", "gl_FragColor = rgbA;", "} else {", "gl_FragColor = rgbB;", "}", "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.FXAAShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/FXAAShader.js\n ** module id = 153\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/FXAAShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.ClearMaskPass = exports.MaskPass = undefined;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.MaskPass = function (scene, camera) {\n\n  this.scene = scene;\n  this.camera = camera;\n\n  this.enabled = true;\n  this.clear = true;\n  this.needsSwap = false;\n\n  this.inverse = false;\n};\n\n_three2.default.MaskPass.prototype = {\n\n  render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n    var context = renderer.context;\n\n    // don't update color or depth\n\n    context.colorMask(false, false, false, false);\n    context.depthMask(false);\n\n    // set up stencil\n\n    var writeValue, clearValue;\n\n    if (this.inverse) {\n\n      writeValue = 0;\n      clearValue = 1;\n    } else {\n\n      writeValue = 1;\n      clearValue = 0;\n    }\n\n    context.enable(context.STENCIL_TEST);\n    context.stencilOp(context.REPLACE, context.REPLACE, context.REPLACE);\n    context.stencilFunc(context.ALWAYS, writeValue, 0xffffffff);\n    context.clearStencil(clearValue);\n\n    // draw into the stencil buffer\n\n    renderer.render(this.scene, this.camera, readBuffer, this.clear);\n    renderer.render(this.scene, this.camera, writeBuffer, this.clear);\n\n    // re-enable update of color and depth\n\n    context.colorMask(true, true, true, true);\n    context.depthMask(true);\n\n    // only render where stencil is set to 1\n\n    context.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1\n    context.stencilOp(context.KEEP, context.KEEP, context.KEEP);\n  }\n\n};\n\n_three2.default.ClearMaskPass = function () {\n\n  this.enabled = true;\n};\n\n_three2.default.ClearMaskPass.prototype = {\n\n  render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n    var context = renderer.context;\n\n    context.disable(context.STENCIL_TEST);\n  }\n\n};\n\nvar MaskPass = _three2.default.MaskPass;\nvar ClearMaskPass = _three2.default.ClearMaskPass;\nexports.MaskPass = MaskPass;\nexports.ClearMaskPass = ClearMaskPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/MaskPass.js\n ** module id = 154\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/MaskPass.js?")},function(module,exports){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nvar shader = {\n  \'outline\': {\n    vertex_shader: ["uniform float offset;", "void main() {", "vec4 pos = vec4( position + normal * offset/2.0, 1.0 );", "gl_Position = projectionMatrix * modelViewMatrix * pos;", "}"].join("\\n"),\n\n    fragment_shader: ["uniform vec3 color;", "void main(){", "gl_FragColor = vec4(color,1.0);  //vec4( 1.0, 0.0, 0.0, 1.0 );", "}"].join("\\n")\n  }\n};\n\nexports.default = shader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/OutlineShader.js\n ** module id = 155\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/OutlineShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.RenderPass = function (scene, camera, overrideMaterial, clearColor, clearAlpha) {\n\n  this.scene = scene;\n  this.camera = camera;\n\n  this.overrideMaterial = overrideMaterial;\n\n  this.clearColor = clearColor;\n  this.clearAlpha = clearAlpha !== undefined ? clearAlpha : 1;\n\n  this.oldClearColor = new _three2.default.Color();\n  this.oldClearAlpha = 1;\n\n  this.enabled = true;\n  this.clear = true;\n  this.needsSwap = false;\n};\n\n_three2.default.RenderPass.prototype = {\n\n  render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n    this.scene.overrideMaterial = this.overrideMaterial;\n\n    if (this.clearColor) {\n\n      this.oldClearColor.copy(renderer.getClearColor());\n      this.oldClearAlpha = renderer.getClearAlpha();\n\n      renderer.setClearColor(this.clearColor, this.clearAlpha);\n    }\n\n    renderer.render(this.scene, this.camera, readBuffer, this.clear);\n\n    if (this.clearColor) {\n\n      renderer.setClearColor(this.oldClearColor, this.oldClearAlpha);\n    }\n\n    this.scene.overrideMaterial = null;\n  }\n\n};\n\nexports.default = _three2.default.RenderPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/RenderPass.js\n ** module id = 156\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/RenderPass.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.ShaderPass = function (shader, textureID) {\n\n  this.textureID = textureID !== undefined ? textureID : "tDiffuse";\n\n  this.uniforms = _three2.default.UniformsUtils.clone(shader.uniforms);\n\n  this.material = new _three2.default.ShaderMaterial({\n\n    defines: shader.defines || {},\n    uniforms: this.uniforms,\n    vertexShader: shader.vertexShader,\n    fragmentShader: shader.fragmentShader\n\n  });\n\n  this.renderToScreen = false;\n\n  this.enabled = true;\n  this.needsSwap = true;\n  this.clear = false;\n\n  this.camera = new _three2.default.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n  this.scene = new _three2.default.Scene();\n\n  this.quad = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(2, 2), null);\n  this.scene.add(this.quad);\n};\n\n_three2.default.ShaderPass.prototype = {\n\n  render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n    if (this.uniforms[this.textureID]) {\n\n      this.uniforms[this.textureID].value = readBuffer;\n    }\n\n    this.quad.material = this.material;\n\n    if (this.renderToScreen) {\n\n      renderer.render(this.scene, this.camera);\n    } else {\n\n      renderer.render(this.scene, this.camera, writeBuffer, this.clear);\n    }\n  }\n\n};\n\nexports.default = _three2.default.ShaderPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/ShaderPass.js\n ** module id = 157\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/ShaderPass.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Vignette shader\n * based on PaintEffect postprocess from ro.me\n * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js\n */\n\n_three2.default.VignetteShader = {\n\n  uniforms: {\n\n    "tDiffuse": { type: "t", value: null },\n    "offset": { type: "f", value: 1.0 },\n    "darkness": { type: "f", value: 1.0 }\n\n  },\n\n  vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n  fragmentShader: ["uniform float offset;", "uniform float darkness;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {",\n\n  // Eskil\'s vignette\n\n  "vec4 texel = texture2D( tDiffuse, vUv );", "vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );", "gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",\n\n  /*\n  // alternative version from glfx.js\n  // this one makes more "dusty" look (as opposed to "burned")\n   "vec4 color = texture2D( tDiffuse, vUv );",\n  "float dist = distance( vUv, vec2( 0.5 ) );",\n  "color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",\n  "gl_FragColor = color;",\n  */\n\n  "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.VignetteShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/vignetteShader.js\n ** module id = 158\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/vignetteShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _pointers = __webpack_require__(74);\n\nvar _sizing = __webpack_require__(75);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(69);\n\nvar _utils2 = __webpack_require__(3);\n\nvar _Selector = __webpack_require__(68);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\n\n\n// get original data +  picking infos\nfunction addPickingInfos(inStream$, containerResizes$, camera, scene) {\n  return inStream$.withLatestFrom(containerResizes$, function (event, clientRect) {\n    if (event) {\n      var input = document.querySelector('.container'); // canvas\n      var _clientRect = input.getBoundingClientRect();\n\n      var data = {\n        pos: {\n          x: event.clientX,\n          y: event.clientY },\n        rect: _clientRect,\n        width: _clientRect.width,\n        height: _clientRect.height,\n        event: event };\n      var mouseCoords = (0, _Selector.getCoordsFromPosSizeRect)(data);\n      return (0, _utils.selectionAt)(event, mouseCoords, camera, scene.children);\n    } else {\n      return {};\n    }\n  });\n}\n\n// extract the object & position from a pickingInfo data\nfunction objectAndPosition(pickingInfo) {\n  return { object: pickingInfo.object, point: pickingInfo.point };\n}\n\nfunction intent(sources, data) {\n  var DOM = sources.DOM;\n  var camera = data.camera;\n  var scene = data.scene;\n  var transformControls = data.transformControls;\n  var props$ = data.props$;\n  var settings$ = data.settings$;\n\n\n  var windowResizes$ = (0, _sizing.windowResizes)(1); // get from intents/interactions ?\n  var elementResizes$ = (0, _sizing.elementResizes)('.container', 1);\n\n  var _pointerInteractions = (0, _pointers.pointerInteractions)((0, _pointers.interactionsFromCEvents)(DOM));\n\n  var shortSingleTaps$ = _pointerInteractions.shortSingleTaps$;\n  var shortDoubleTaps$ = _pointerInteractions.shortDoubleTaps$;\n  var longTaps$ = _pointerInteractions.longTaps$;\n  var zooms$ = _pointerInteractions.zooms$;\n  var dragMoves$ = _pointerInteractions.dragMoves$;\n\n  // FIXME : needs to be done in a more coherent, reusable way\n  // shut down \"wobble effect if ANY user interaction takes place\"\n\n  var userAction$ = merge(shortSingleTaps$, shortDoubleTaps$, longTaps$, zooms$, dragMoves$); // .subscribe(e=>wobble.stop())\n\n  // Prevent contextmenu for all of the gl canvas FIXME: side effect ?\n  DOM.select('canvas').events('contextmenu').subscribe(function (e) {\n    return (0, _obsUtils.preventDefault)(e);\n  });\n\n  // stream of container resize events\n  var containerResizes$ = windowResizes$.map(function () {\n    var input = document.querySelector('.container'); // canvas\n    if (input) return input.getBoundingClientRect();\n  }).filter(_obsUtils.exists).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n  // are the transform controls active : ie we are dragging, rotating, scaling an object\n  var tControlsActive$ = merge(fromEvent(transformControls, 'mouseDown').map(true), fromEvent(transformControls, 'mouseUp').map(false)).startWith(false);\n  // .tap(e=>console.log( \"transform controls active\",e ))\n\n  var shortSingleTapsWPicking$ = addPickingInfos(shortSingleTaps$, windowResizes$, camera, scene).shareReplay(1);\n  var shortDoubleTapsWPicking$ = addPickingInfos(shortDoubleTaps$, windowResizes$, camera, scene).shareReplay(1);\n  var longTapsWPicking$ = addPickingInfos(longTaps$, windowResizes$, camera, scene).withLatestFrom(tControlsActive$, function (longTaps, tCActive) {\n    // disable long taps in case we are manipulating an object\n    if (tCActive) return undefined;\n    return longTaps;\n  }).filter(_obsUtils.exists).shareReplay(1);\n\n  // contextmenu observable should return undifined when any other basic interaction\n  // took place (to cancel displaying context menu , etc)\n  /* longTapsWPicking$ = longTapsWPicking$\n    .merge(\n      shortSingleTapsWPicking$.map(undefined),\n      shortDoubleTapsWPicking$.map(undefined),\n      dragMoves$.map(undefined)\n    )*/\n\n  // zoom action intent\n  var zoomInOnPoint$ = shortDoubleTapsWPicking$.map(function (e) {\n    return e.detail.pickingInfos.shift();\n  }).filter(_obsUtils.exists).map(objectAndPosition);\n\n  var zoomToFit$ = _rx2.default.Observable.just(true); // DOM.select('#zoomToFit').events(\"click\")\n\n  // Stream of selected meshes\n  var selectMeshes$ = merge(shortSingleTapsWPicking$.map(_utils.meshFrom), longTapsWPicking$.map(_utils.meshFrom)).map(_utils2.toArray) // important !! consumers expect arrays\n  // .distinctUntilChanged()\n  .shareReplay(1);\n\n  // if transformControls are active\n  // filter out dragMove gestures: ie prevent camera from moving/rotating\n  var fDragMoves$ = dragMoves$.withLatestFrom(tControlsActive$, function (dragMoves, tCActive) {\n    if (tCActive) return undefined;\n    return dragMoves;\n  }).filter(_obsUtils.exists);\n\n  // actual stream used for camera controls: dragMove gestures + zoom gestures\n  var filteredInteractions$ = { dragMoves$: fDragMoves$, zooms$: zooms$ };\n\n  var selections$ = props$.pluck('selections').startWith([]).filter(_obsUtils.exists).distinctUntilChanged().map(function (x) {\n    return x.map(function (y) {\n      return y.id;\n    });\n  }); // we just need the ids\n  var transforms$ = props$.pluck('meshes'); //.withLatestFrom(selections$,function(transforms, selections))\n  var activeTool$ = settings$.pluck('activeTool').startWith(undefined).distinctUntilChanged();\n\n  // stream of transformations done on the current selection\n  var selectionsTransforms$ = fromEvent(transformControls, 'objectChange')\n  //.tap(e=>console.log('sdfsdf',e))\n  .map(_utils.targetObject).withLatestFrom(selections$, activeTool$, transforms$, function (t, selections, activeTool, _transforms) {\n    var transform = { 'translate': 'pos', 'rotate': 'rot', 'scale': 'sca' }[activeTool];\n\n    /*FIXME: horrid, we have to deal with transforms on the meshes (horrors of OOP  & mutability)\n    //FIXME: also we need to do this whole thing since only ONE object is actually transformed\n    by transformcontrols, so we first compute the average of all mesh positions, then we get the\n    position of the updated position, do a difference between the avg & modified one, and add it to the changed value\n    HORRIBLY Convoluted, but will not be the case anymore with regl/functional opengl/webgl\n    */\n    function valueMap(mesh, transform) {\n      var mapper = {\n        pos: mesh.position.toArray().slice(0, 3),\n        rot: mesh.rotation.toArray().slice(0, 3),\n        sca: mesh.scale.toArray().slice(0, 3).map(function (val, index) {\n          return mesh.flipped && mesh.flipped[index] === 1 ? val * -1 : val;\n        }) //to handle negative scaling/mirrored data, as the transformControls always return values >0\n      };\n      return mapper[transform];\n    }\n\n    //FIXME : only needed if data storage is a hash\n    _transforms = selections.map(function (input) {\n      return _transforms[input];\n    }) // get only needed ones\n    .map(function (mesh) {\n      var res = {};\n      res[transform] = valueMap(mesh, transform);\n      return res;\n    });\n\n    var avg = (0, _ramda.pluck)(transform)(_transforms).reduce(function (acc, cur) {\n      if (!acc) return cur;\n      return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n        return x * 0.5;\n      });\n    }, undefined);\n\n    var tranformedValue = valueMap(t, transform);\n    var diff = [avg[0] - tranformedValue[0], avg[1] - tranformedValue[1], avg[2] - tranformedValue[2]];\n    var value = [diff[0] + tranformedValue[0], diff[1] + tranformedValue[1], diff[2] + tranformedValue[2]];\n\n    //const realValue =\n    return { value: value, trans: transform, ids: selections };\n  }).map(function (data) {\n    // format data so that we have an array of changes, by id\n    var value = data.value;\n    var trans = data.trans;\n    var ids = data.ids;\n\n    return ids.map(function (id) {\n      return { value: value, trans: trans, id: id };\n    });\n  });\n\n  return {\n    userAction$: userAction$,\n    zoomInOnPoint$: zoomInOnPoint$,\n    zoomToFit$: zoomToFit$,\n    selectMeshes$: selectMeshes$,\n    shortSingleTapsWPicking$: shortSingleTapsWPicking$,\n    shortDoubleTapsWPicking$: shortDoubleTapsWPicking$,\n    longTapsWPicking$: longTapsWPicking$,\n    filteredInteractions$: filteredInteractions$,\n    selectionsTransforms$: selectionsTransforms$ };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/intent.js\n ** module id = 159\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = model;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _ramda = __webpack_require__(4);\n\nvar _visualMakers = __webpack_require__(164);\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// let requestAnimationFrameScheduler = Rx.Scheduler.requestAnimationFrame\n// problem : this fires BEFORE the rest is ready\n// activeTool$.skip(1).filter(isTransformTool).subscribe(transformControls.setMode)\n\nfunction setFlags(mesh) {\n  mesh.selectable = true;\n  mesh.selectTrickleUp = false;\n  mesh.transformable = true;\n  // FIXME: not sure, these are very specific for visuals\n  mesh.castShadow = true;\n  return mesh;\n}\n\nfunction makeRemoteMeshVisual(meta, transform, mesh) {\n  if (meta && transform && mesh) {\n    var _ret = function () {\n\n      // this is for mirroring\n\n      var isOdd = function isOdd(num) {\n        return num % 2;\n      };\n\n      var handleMirroring = function handleMirroring() {\n        var flipped = mesh.flipped || [0, 0, 0];\n        var mS = new _three2.default.Matrix4().identity();\n        var conv = [0, 5, 10];\n\n        transform.sca.map(function (val) {\n          return val < 0;\n        }).forEach(function (val, index) {\n          if (val && flipped[index] === 0) {\n            mS.elements[conv[index]] = -1;\n            flipped[index] = 1;\n          }\n          // flip back\n          if (!val && flipped[index] === 1) {\n            mS.elements[conv[index]] = -1;\n            flipped[index] = 0;\n          }\n        });\n        mesh.geometry.applyMatrix(mS);\n        mesh.flipped = flipped;\n        var inversions = flipped.reduce(function (prev, curr) {\n          return prev + curr;\n        });\n        mesh.material.side = isOdd(inversions) ? _three2.default.BackSide : 0;\n      };\n\n      // only apply changes to mesh IF the current transform is different ?\n      // console.log(\"transforms\",transform)\n      if (!(0, _ramda.equals)(mesh.position.toArray(), transform.pos)) {\n        mesh.position.fromArray(transform.pos);\n      }\n      if (!(0, _ramda.equals)(mesh.rotation.toArray(), transform.rot)) {\n        mesh.rotation.fromArray(transform.rot);\n      }\n      if (!(0, _ramda.equals)(mesh.scale.toArray(), transform.sca)) {\n        mesh.scale.fromArray(transform.sca.map(Math.abs));\n      }\n      // color is stored in meta component\n      mesh.material.color.set(meta.color);\n      handleMirroring();\n\n      return {\n        v: setFlags(mesh)\n      };\n    }();\n\n    if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === \"object\") return _ret.v;\n  }\n}\n\nfunction getVisual(components) {\n  var meta = components.meta; // {components}\n\n  var keys = Object.keys(meta);\n  var metas = meta;\n\n  return keys.map(function (key) {\n    var meta = metas[key];\n    var transform = components.transforms[key];\n    var mesh = components.meshes[key];\n\n    // TODO: refactor this horror\n    if (meta.typeUid === 'A1') {\n      // typeUid:\"A1\"=> notes\n      return (0, _visualMakers.makeNoteVisual)(meta, components.meshes);\n    } else if (meta.typeUid === 'A2') {\n      return (0, _visualMakers.makeThicknessVisual)(meta, components.meshes);\n    } else if (meta.typeUid === 'A3') {\n      return (0, _visualMakers.makeDiameterVisual)(meta, components.meshes);\n    } else if (meta.typeUid === 'A4') {\n      return (0, _visualMakers.makeDistanceVisual)(meta, components.meshes);\n    } else if (meta.typeUid === 'A5') {\n      return (0, _visualMakers.makeAngleVisual)(meta, components.meshes);\n    } else {\n      return makeRemoteMeshVisual(meta, transform, mesh);\n    }\n  }).filter(function (m) {\n    return m !== undefined;\n  });\n}\n\nfunction model(props$, actions) {\n  var settings$ = props$.pluck('settings');\n  var selections$ = props$.pluck('selections').startWith([]).filter(_obsUtils.exists).distinctUntilChanged();\n  var activeTool$ = settings$.pluck('activeTool').startWith(undefined);\n  // every time either activeTool or selection changes, reset/update transform controls\n\n  // composite data\n  var meta$ = props$.pluck('meta').distinctUntilChanged();\n  var transforms$ = props$.pluck('transforms'); // .distinctUntilChanged()\n  var meshes$ = props$.pluck('meshes').filter(_obsUtils.exists).distinctUntilChanged(function (m) {\n    return Object.keys(m);\n  });\n  // this is for any NON composite data , so pure mesh /visuals withouth any metadata, transformsetc\n  var rawVisuals$ = props$.pluck('rawVisuals').startWith(undefined).distinctUntilChanged().tap(function (e) {\n    return console.log('rawVisuals', e);\n  });\n\n  // FIXME: items is emiting WAAY too much values, look into why it does so\n  // combine All needed components to apply any \"transforms\" to their visuals\n  var items0$ = (0, _obsUtils.combineLatestObj)({ meta$: meta$, transforms$: transforms$, meshes$: meshes$ }).debounce(1) // ignore if we have too fast changes in any of the 3 components\n  // .distinctUntilChanged()\n  .map(getVisual)\n  // .sample(0, requestAnimationFrameScheduler)\n  // .distinctUntilChanged()\n  // .tap(e => console.log('DONE with items in GLView', e))\n  .combineLatest(rawVisuals$, function (composites, raw) {\n    // console.log('composites', composites,'raw',raw)\n    return composites;\n  }).filter(_obsUtils.exists).tap(function (e) {\n    return console.log('items', e);\n  }).shareReplay(1);\n\n  var items$ = props$.debounce(1).map(function (props) {\n    var meta = props.meta;\n    var transforms = props.transforms;\n    var meshes = props.meshes;\n    var visual = getVisual({ meta: meta, transforms: transforms, meshes: meshes });\n    return visual.concat(props.rawVisuals);\n  }).startWith(undefined).filter(_obsUtils.exists)\n  // .tap(e => console.log('items2', e))\n  .shareReplay(1);\n\n  // \"external\" selected meshes\n  var selectedMeshesFromSelections$ = selections$.withLatestFrom(meshes$, function (selections, meshes) {\n    return selections.filter(_obsUtils.exists).map(function (s) {\n      return meshes[s.id];\n    });\n  }).distinctUntilChanged().startWith([]).shareReplay(1);\n\n  var selectedMeshes$ = actions.selectMeshes$ // these are only selections made WITHIN the GL view\n  .merge(selectedMeshesFromSelections$)\n  // this limits \"selectability\" to transforms & default\n  .withLatestFrom(activeTool$, function (meshes, tool) {\n    var idx = ['translate', 'rotate', 'scale', undefined].indexOf(tool);\n    var result = idx > -1 ? meshes : [];\n\n    return result;\n  }).distinctUntilChanged().startWith([]);\n\n  var focusedMeshesFromFocusedEntities$ = props$.pluck('focusedEntities').startWith([]).filter(_obsUtils.exists).distinctUntilChanged().withLatestFrom(meshes$, function (selections, meshes) {\n    return selections.filter(_obsUtils.exists).map(function (id) {\n      return meshes[id];\n    });\n  }).merge(actions.selectMeshes$.filter(function (sm) {\n    return sm.length === 0;\n  })) //we want to be able to reset selections to nothing\n  .tap(function (e) {\n    return console.log('selections in glView', e);\n  }).distinctUntilChanged().startWith([]);\n\n  return (0, _obsUtils.combineLatestObj)({\n    items$: items$,\n    selectedMeshes$: selectedMeshes$,\n    selectedMeshesFromSelections$: selectedMeshesFromSelections$,\n    focusedMeshesFromFocusedEntities$: focusedMeshesFromFocusedEntities$\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/model.js\n ** module id = 160\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/model.js?");
},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nvar presets = exports.presets = {\n  renderer: {\n    shadowMapEnabled: true,\n    shadowMapAutoUpdate: true,\n    shadowMapSoft: true,\n    shadowMapType: undefined, // THREE.PCFSoftShadowMap,//THREE.PCFSoftShadowMap,//PCFShadowMap\n    autoUpdateScene: true, // Default ?\n    physicallyBasedShading: false, // Default ?\n    autoClear: true, // Default ?\n    gammaInput: false,\n    gammaOutput: false\n  },\n  cameras: [{\n    name: 'mainCamera',\n    pos: [75, 75, 145], // [100,-100,100]\n    up: [0, 0, 1],\n    lens: {\n      fov: 45,\n      near: 0.1,\n      far: 20000\n    }\n  }],\n  controls: [{\n    up: [0, 0, 1],\n    rotateSpeed: 2.0,\n    panSpeed: 2.0,\n    zoomSpeed: 2.0,\n    autoRotate: {\n      enabled: false,\n      speed: 0.2\n    },\n    _enabled: true,\n    _active: true\n  }],\n  scenes: {\n    'main': [\n    // { type:\"hemisphereLight\", color:\"#FFFF33\", gndColor:\"#FF9480\", pos:[0, 0, 500], intensity:0.6 },\n    { type: 'hemisphereLight', color: '#FFEEEE', gndColor: '#FFFFEE', pos: [0, 1200, 1500], intensity: 0.8 }, { type: 'ambientLight', color: '#0x252525', intensity: 0.03 }, { type: 'directionalLight', color: '#262525', intensity: 0.2, pos: [150, 150, 1500], castShadow: true, onlyShadow: true }\n    // { type:\"directionalLight\", color:\"#FFFFFF\", intensity:0.2 , pos:[150,150,1500], castShadow:true, onlyShadow:true}\n    ],\n    'helpers': [{ type: 'LabeledGrid' }]\n  }\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/presets.js\n ** module id = 161\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/presets.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n	value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar GizmoMaterial = function GizmoMaterial(parameters) {\n\n	_three2.default.MeshBasicMaterial.call(this);\n\n	this.depthTest = false;\n	this.depthWrite = false;\n	this.side = _three2.default.FrontSide;\n	this.transparent = true;\n\n	this.setValues(parameters);\n\n	this.oldColor = this.color.clone();\n	this.oldOpacity = this.opacity;\n\n	this.highlight = function (highlighted) {\n\n		if (highlighted) {\n\n			this.color.setRGB(1, 1, 0);\n			this.opacity = 1;\n		} else {\n\n			this.color.copy(this.oldColor);\n			this.opacity = this.oldOpacity;\n		}\n	};\n}; /**\n    * @author arodic / https://github.com/arodic\n    */\n/*jshint sub:true*/\n\n\nGizmoMaterial.prototype = Object.create(_three2.default.MeshBasicMaterial.prototype);\n\nvar GizmoLineMaterial = function GizmoLineMaterial(parameters) {\n\n	_three2.default.LineBasicMaterial.call(this);\n\n	this.depthTest = false;\n	this.depthWrite = false;\n	this.transparent = true;\n	this.linewidth = 1;\n\n	this.setValues(parameters);\n\n	this.oldColor = this.color.clone();\n	this.oldOpacity = this.opacity;\n\n	this.highlight = function (highlighted) {\n\n		if (highlighted) {\n\n			this.color.setRGB(1, 1, 0);\n			this.opacity = 1;\n		} else {\n\n			this.color.copy(this.oldColor);\n			this.opacity = this.oldOpacity;\n		}\n	};\n};\n\nGizmoLineMaterial.prototype = Object.create(_three2.default.LineBasicMaterial.prototype);\n\n_three2.default.TransformGizmo = function () {\n\n	var scope = this;\n	var showPickers = false; //debug\n	var showActivePlane = false; //debug\n\n	this.init = function () {\n\n		_three2.default.Object3D.call(this);\n\n		this.handles = new _three2.default.Object3D();\n		this.pickers = new _three2.default.Object3D();\n		this.planes = new _three2.default.Object3D();\n\n		this.add(this.handles);\n		this.add(this.pickers);\n		this.add(this.planes);\n\n		//// PLANES\n\n		var planeGeometry = new _three2.default.PlaneGeometry(50, 50, 2, 2);\n		var planeMaterial = new _three2.default.MeshBasicMaterial({ wireframe: true });\n		planeMaterial.side = _three2.default.DoubleSide;\n\n		var planes = {\n			"XY": new _three2.default.Mesh(planeGeometry, planeMaterial),\n			"YZ": new _three2.default.Mesh(planeGeometry, planeMaterial),\n			"XZ": new _three2.default.Mesh(planeGeometry, planeMaterial),\n			"XYZE": new _three2.default.Mesh(planeGeometry, planeMaterial)\n		};\n\n		this.activePlane = planes["XYZE"];\n\n		planes["YZ"].rotation.set(0, Math.PI / 2, 0);\n		planes["XZ"].rotation.set(-Math.PI / 2, 0, 0);\n\n		for (var i in planes) {\n			planes[i].name = i;\n			this.planes.add(planes[i]);\n			this.planes[i] = planes[i];\n			planes[i].visible = false;\n		}\n\n		//// HANDLES AND PICKERS\n\n		var setupGizmos = function setupGizmos(gizmoMap, parent) {\n\n			for (var name in gizmoMap) {\n\n				for (i = gizmoMap[name].length; i--;) {\n\n					var object = gizmoMap[name][i][0];\n					var position = gizmoMap[name][i][1];\n					var rotation = gizmoMap[name][i][2];\n\n					object.name = name;\n\n					if (position) object.position.set(position[0], position[1], position[2]);\n					if (rotation) object.rotation.set(rotation[0], rotation[1], rotation[2]);\n\n					parent.add(object);\n				}\n			}\n		};\n\n		setupGizmos(this.handleGizmos, this.handles);\n		setupGizmos(this.pickerGizmos, this.pickers);\n\n		// reset Transformations\n\n		this.traverse(function (child) {\n			if (child instanceof _three2.default.Mesh) {\n				child.updateMatrix();\n\n				var tempGeometry = new _three2.default.Geometry();\n				tempGeometry.merge(child.geometry, child.matrix);\n\n				child.geometry = tempGeometry;\n				child.position.set(0, 0, 0);\n				child.rotation.set(0, 0, 0);\n				child.scale.set(1, 1, 1);\n			}\n		});\n	};\n\n	this.hide = function () {\n		this.traverse(function (child) {\n			child.visible = false;\n		});\n	};\n\n	this.show = function () {\n		this.traverse(function (child) {\n			child.visible = true;\n			if (child.parent == scope.pickers) child.visible = showPickers;\n			if (child.parent == scope.planes) child.visible = false;\n		});\n		this.activePlane.visible = showActivePlane;\n	};\n\n	this.highlight = function (axis) {\n		this.traverse(function (child) {\n			if (child.material && child.material.highlight) {\n				if (child.name == axis) {\n					child.material.highlight(true);\n				} else {\n					child.material.highlight(false);\n				}\n			}\n		});\n	};\n};\n\n_three2.default.TransformGizmo.prototype = Object.create(_three2.default.Object3D.prototype);\n\n_three2.default.TransformGizmo.prototype.update = function (rotation, eye) {\n\n	var vec1 = new _three2.default.Vector3(0, 0, 0);\n	var vec2 = new _three2.default.Vector3(0, 1, 0);\n	var lookAtMatrix = new _three2.default.Matrix4();\n\n	this.traverse(function (child) {\n		if (child.name.search("E") != -1) {\n			child.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(eye, vec1, vec2));\n		} else if (child.name.search("X") != -1 || child.name.search("Y") != -1 || child.name.search("Z") != -1) {\n			child.quaternion.setFromEuler(rotation);\n		}\n	});\n};\n\n_three2.default.TransformGizmoTranslate = function () {\n\n	_three2.default.TransformGizmo.call(this);\n\n	var arrowGeometry = new _three2.default.Geometry();\n	var mesh = new _three2.default.Mesh(new _three2.default.CylinderGeometry(0, 0.05, 0.2, 12, 1, false));\n	mesh.position.y = 0.5;\n	mesh.updateMatrix();\n\n	arrowGeometry.merge(mesh.geometry, mesh.matrix);\n\n	var lineXGeometry = new _three2.default.Geometry();\n	lineXGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(1, 0, 0));\n\n	var lineYGeometry = new _three2.default.Geometry();\n	lineYGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 1, 0));\n\n	var lineZGeometry = new _three2.default.Geometry();\n	lineZGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 0, 1));\n\n	this.handleGizmos = {\n		X: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0xff0000 })), [0.5, 0, 0], [0, 0, -Math.PI / 2]], [new _three2.default.Line(lineXGeometry, new GizmoLineMaterial({ color: 0xff0000 }))]],\n		Y: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x00ff00 })), [0, 0.5, 0]], [new _three2.default.Line(lineYGeometry, new GizmoLineMaterial({ color: 0x00ff00 }))]],\n		Z: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x0000ff })), [0, 0, 0.5], [Math.PI / 2, 0, 0]], [new _three2.default.Line(lineZGeometry, new GizmoLineMaterial({ color: 0x0000ff }))]],\n		XYZ: [[new _three2.default.Mesh(new _three2.default.OctahedronGeometry(0.1, 0), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 })), [0, 0, 0], [0, 0, 0]]],\n		XY: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 })), [0.15, 0.15, 0]]],\n		YZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0x00ffff, opacity: 0.25 })), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]],\n		XZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0xff00ff, opacity: 0.25 })), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]]\n	};\n\n	this.pickerGizmos = {\n		X: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],\n		Y: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0.6, 0]]],\n		Z: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],\n		XYZ: [[new _three2.default.Mesh(new _three2.default.OctahedronGeometry(0.2, 0), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]],\n		XY: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 })), [0.2, 0.2, 0]]],\n		YZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0x00ffff, opacity: 0.25 })), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],\n		XZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0xff00ff, opacity: 0.25 })), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]\n	};\n\n	this.setActivePlane = function (axis, eye) {\n\n		var tempMatrix = new _three2.default.Matrix4();\n		eye.applyMatrix4(tempMatrix.getInverse(tempMatrix.extractRotation(this.planes["XY"].matrixWorld)));\n\n		if (axis == "X") {\n			this.activePlane = this.planes["XY"];\n			if (Math.abs(eye.y) > Math.abs(eye.z)) this.activePlane = this.planes["XZ"];\n		}\n\n		if (axis == "Y") {\n			this.activePlane = this.planes["XY"];\n			if (Math.abs(eye.x) > Math.abs(eye.z)) this.activePlane = this.planes["YZ"];\n		}\n\n		if (axis == "Z") {\n			this.activePlane = this.planes["XZ"];\n			if (Math.abs(eye.x) > Math.abs(eye.y)) this.activePlane = this.planes["YZ"];\n		}\n\n		if (axis == "XYZ") this.activePlane = this.planes["XYZE"];\n\n		if (axis == "XY") this.activePlane = this.planes["XY"];\n\n		if (axis == "YZ") this.activePlane = this.planes["YZ"];\n\n		if (axis == "XZ") this.activePlane = this.planes["XZ"];\n\n		this.hide();\n		this.show();\n	};\n\n	this.init();\n};\n\n_three2.default.TransformGizmoTranslate.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\n_three2.default.TransformGizmoRotate = function () {\n\n	_three2.default.TransformGizmo.call(this);\n\n	var CircleGeometry = function CircleGeometry(radius, facing, arc) {\n\n		var geometry = new _three2.default.Geometry();\n		arc = arc ? arc : 1;\n		for (var i = 0; i <= 64 * arc; ++i) {\n			if (facing == \'x\') geometry.vertices.push(new _three2.default.Vector3(0, Math.cos(i / 32 * Math.PI), Math.sin(i / 32 * Math.PI)).multiplyScalar(radius));\n			if (facing == \'y\') geometry.vertices.push(new _three2.default.Vector3(Math.cos(i / 32 * Math.PI), 0, Math.sin(i / 32 * Math.PI)).multiplyScalar(radius));\n			if (facing == \'z\') geometry.vertices.push(new _three2.default.Vector3(Math.sin(i / 32 * Math.PI), Math.cos(i / 32 * Math.PI), 0).multiplyScalar(radius));\n		}\n\n		return geometry;\n	};\n\n	this.handleGizmos = {\n		X: [[new _three2.default.Line(new CircleGeometry(1, \'x\', 0.5), new GizmoLineMaterial({ color: 0xff0000 }))]],\n		Y: [[new _three2.default.Line(new CircleGeometry(1, \'y\', 0.5), new GizmoLineMaterial({ color: 0x00ff00 }))]],\n		Z: [[new _three2.default.Line(new CircleGeometry(1, \'z\', 0.5), new GizmoLineMaterial({ color: 0x0000ff }))]],\n		E: [[new _three2.default.Line(new CircleGeometry(1.25, \'z\', 1), new GizmoLineMaterial({ color: 0xcccc00 }))]],\n		XYZE: [[new _three2.default.Line(new CircleGeometry(1, \'z\', 1), new GizmoLineMaterial({ color: 0x787878 }))]]\n	};\n\n	this.pickerGizmos = {\n		X: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],\n		Y: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0, 0], [Math.PI / 2, 0, 0]]],\n		Z: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0], [0, 0, -Math.PI / 2]]],\n		E: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1.25, 0.12, 2, 24), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 }))]],\n		XYZE: [[new _three2.default.Mesh(new _three2.default.Geometry())] // TODO\n		]\n	};\n\n	this.setActivePlane = function (axis) {\n\n		if (axis == "E") this.activePlane = this.planes["XYZE"];\n\n		if (axis == "X") this.activePlane = this.planes["YZ"];\n\n		if (axis == "Y") this.activePlane = this.planes["XZ"];\n\n		if (axis == "Z") this.activePlane = this.planes["XY"];\n\n		this.hide();\n		this.show();\n	};\n\n	this.update = function (rotation, eye2) {\n\n		_three2.default.TransformGizmo.prototype.update.apply(this, arguments);\n\n		var group = {\n			handles: this["handles"],\n			pickers: this["pickers"]\n		};\n\n		var tempMatrix = new _three2.default.Matrix4();\n		var worldRotation = new _three2.default.Euler(0, 0, 1);\n		var tempQuaternion = new _three2.default.Quaternion();\n		var unitX = new _three2.default.Vector3(1, 0, 0);\n		var unitY = new _three2.default.Vector3(0, 1, 0);\n		var unitZ = new _three2.default.Vector3(0, 0, 1);\n		var quaternionX = new _three2.default.Quaternion();\n		var quaternionY = new _three2.default.Quaternion();\n		var quaternionZ = new _three2.default.Quaternion();\n		var eye = eye2.clone();\n\n		worldRotation.copy(this.planes["XY"].rotation);\n		tempQuaternion.setFromEuler(worldRotation);\n\n		tempMatrix.makeRotationFromQuaternion(tempQuaternion).getInverse(tempMatrix);\n		eye.applyMatrix4(tempMatrix);\n\n		this.traverse(function (child) {\n\n			tempQuaternion.setFromEuler(worldRotation);\n\n			if (child.name == "X") {\n				quaternionX.setFromAxisAngle(unitX, Math.atan2(-eye.y, eye.z));\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n				child.quaternion.copy(tempQuaternion);\n			}\n\n			if (child.name == "Y") {\n				quaternionY.setFromAxisAngle(unitY, Math.atan2(eye.x, eye.z));\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionY);\n				child.quaternion.copy(tempQuaternion);\n			}\n\n			if (child.name == "Z") {\n				quaternionZ.setFromAxisAngle(unitZ, Math.atan2(eye.y, eye.x));\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionZ);\n				child.quaternion.copy(tempQuaternion);\n			}\n		});\n	};\n\n	this.init();\n};\n\n_three2.default.TransformGizmoRotate.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\n_three2.default.TransformGizmoScale = function () {\n\n	_three2.default.TransformGizmo.call(this);\n\n	var arrowGeometry = new _three2.default.Geometry();\n	var mesh = new _three2.default.Mesh(new _three2.default.BoxGeometry(0.125, 0.125, 0.125));\n	mesh.position.y = 0.5;\n	mesh.updateMatrix();\n\n	arrowGeometry.merge(mesh.geometry, mesh.matrix);\n\n	var lineXGeometry = new _three2.default.Geometry();\n	lineXGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(1, 0, 0));\n\n	var lineYGeometry = new _three2.default.Geometry();\n	lineYGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 1, 0));\n\n	var lineZGeometry = new _three2.default.Geometry();\n	lineZGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 0, 1));\n\n	this.handleGizmos = {\n		X: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0xff0000 })), [0.5, 0, 0], [0, 0, -Math.PI / 2]], [new _three2.default.Line(lineXGeometry, new GizmoLineMaterial({ color: 0xff0000 }))]],\n		Y: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x00ff00 })), [0, 0.5, 0]], [new _three2.default.Line(lineYGeometry, new GizmoLineMaterial({ color: 0x00ff00 }))]],\n		Z: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x0000ff })), [0, 0, 0.5], [Math.PI / 2, 0, 0]], [new _three2.default.Line(lineZGeometry, new GizmoLineMaterial({ color: 0x0000ff }))]],\n		XYZ: [[new _three2.default.Mesh(new _three2.default.BoxGeometry(0.125, 0.125, 0.125), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]]\n	};\n\n	this.pickerGizmos = {\n		X: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],\n		Y: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0.6, 0]]],\n		Z: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],\n		XYZ: [[new _three2.default.Mesh(new _three2.default.BoxGeometry(0.4, 0.4, 0.4), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]]\n	};\n\n	this.setActivePlane = function (axis, eye) {\n\n		var tempMatrix = new _three2.default.Matrix4();\n		eye.applyMatrix4(tempMatrix.getInverse(tempMatrix.extractRotation(this.planes["XY"].matrixWorld)));\n\n		if (axis == "X") {\n			this.activePlane = this.planes["XY"];\n			if (Math.abs(eye.y) > Math.abs(eye.z)) this.activePlane = this.planes["XZ"];\n		}\n\n		if (axis == "Y") {\n			this.activePlane = this.planes["XY"];\n			if (Math.abs(eye.x) > Math.abs(eye.z)) this.activePlane = this.planes["YZ"];\n		}\n\n		if (axis == "Z") {\n			this.activePlane = this.planes["XZ"];\n			if (Math.abs(eye.x) > Math.abs(eye.y)) this.activePlane = this.planes["YZ"];\n		}\n\n		if (axis == "XYZ") this.activePlane = this.planes["XYZE"];\n\n		this.hide();\n		this.show();\n	};\n\n	this.init();\n};\n\n_three2.default.TransformGizmoScale.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\nvar TransformControls = function TransformControls(camera, domElement) {\n\n	// TODO: Make non-uniform scale and rotate play nice in hierarchies\n	// TODO: ADD RXYZ contol\n\n	_three2.default.Object3D.call(this);\n\n	//domElement = ( domElement !== undefined ) ? domElement : document;\n	//console.log("attaching TransformControls to",domElement);\n\n	this.gizmo = {};\n	this.gizmo["translate"] = new _three2.default.TransformGizmoTranslate();\n	this.gizmo["rotate"] = new _three2.default.TransformGizmoRotate();\n	this.gizmo["scale"] = new _three2.default.TransformGizmoScale();\n\n	this.add(this.gizmo["translate"]);\n	this.add(this.gizmo["rotate"]);\n	this.add(this.gizmo["scale"]);\n\n	this.gizmo["translate"].hide();\n	this.gizmo["rotate"].hide();\n	this.gizmo["scale"].hide();\n\n	this.object = undefined;\n	this.snap = null;\n	this.space = "world";\n	this.size = 1;\n	this.axis = null;\n\n	this.enabled = true;\n\n	var scope = this;\n\n	var _dragging = false;\n	var _mode = "translate";\n	var _plane = "XY";\n\n	var changeEvent = { type: "change" };\n	var mouseDownEvent = { type: "mouseDown" };\n	var mouseUpEvent = { type: "mouseUp", mode: _mode };\n	var objectChangeEvent = { type: "objectChange" };\n\n	var ray = new _three2.default.Raycaster();\n	var pointerVector = new _three2.default.Vector3();\n\n	var point = new _three2.default.Vector3();\n	var offset = new _three2.default.Vector3();\n\n	var rotation = new _three2.default.Vector3();\n	var offsetRotation = new _three2.default.Vector3();\n	var scale = 1;\n\n	var lookAtMatrix = new _three2.default.Matrix4();\n	var eye = new _three2.default.Vector3();\n\n	var tempMatrix = new _three2.default.Matrix4();\n	var tempVector = new _three2.default.Vector3();\n	var tempQuaternion = new _three2.default.Quaternion();\n	var unitX = new _three2.default.Vector3(1, 0, 0);\n	var unitY = new _three2.default.Vector3(0, 1, 0);\n	var unitZ = new _three2.default.Vector3(0, 0, 1);\n\n	var quaternionXYZ = new _three2.default.Quaternion();\n	var quaternionX = new _three2.default.Quaternion();\n	var quaternionY = new _three2.default.Quaternion();\n	var quaternionZ = new _three2.default.Quaternion();\n	var quaternionE = new _three2.default.Quaternion();\n\n	var oldPosition = new _three2.default.Vector3();\n	var oldScale = new _three2.default.Vector3();\n	var oldRotationMatrix = new _three2.default.Matrix4();\n\n	var parentRotationMatrix = new _three2.default.Matrix4();\n	var parentScale = new _three2.default.Vector3();\n\n	var worldPosition = new _three2.default.Vector3();\n	var worldRotation = new _three2.default.Euler();\n	var worldRotationMatrix = new _three2.default.Matrix4();\n	var camPosition = new _three2.default.Vector3();\n	var camRotation = new _three2.default.Euler();\n\n	/*domElement.addEventListener( "mousedown", onPointerDown, false );\n domElement.addEventListener( "touchstart", onPointerDown, false );\n 	domElement.addEventListener( "mousemove", onPointerHover, false );\n domElement.addEventListener( "touchmove", onPointerHover, false );\n 	domElement.addEventListener( "mousemove", onPointerMove, false );\n domElement.addEventListener( "touchmove", onPointerMove, false );\n 	domElement.addEventListener( "mouseup", onPointerUp, true );\n domElement.addEventListener( "mouseout", onPointerUp, true );\n domElement.addEventListener( "touchend", onPointerUp, true );\n domElement.addEventListener( "touchcancel", onPointerUp, true );\n domElement.addEventListener( "touchleave", onPointerUp, true );*/\n\n	this.setDomElement = function (domElement) {\n		scope.domElement = domElement !== undefined ? domElement : document;\n\n		domElement.addEventListener("mousedown", onPointerDown, false);\n		domElement.addEventListener("touchstart", onPointerDown, false);\n\n		domElement.addEventListener("mousemove", onPointerHover, false);\n		domElement.addEventListener("touchmove", onPointerHover, false);\n\n		domElement.addEventListener("mousemove", onPointerMove, false);\n		domElement.addEventListener("touchmove", onPointerMove, false);\n\n		domElement.addEventListener("mouseup", onPointerUp, true);\n		domElement.addEventListener("mouseout", onPointerUp, true);\n		domElement.addEventListener("touchend", onPointerUp, true);\n		domElement.addEventListener("touchcancel", onPointerUp, true);\n		domElement.addEventListener("touchleave", onPointerUp, true);\n	};\n\n	this.setObservables = function (observables) {\n		console.log("setting observables");\n		var dragMoves$ = observables.dragMoves$;\n		var zooms$ = observables.zooms$;\n	};\n\n	this.attach = function (object) {\n		scope.object = object;\n\n		this.gizmo["translate"].hide();\n		this.gizmo["rotate"].hide();\n		this.gizmo["scale"].hide();\n		this.gizmo[_mode].show();\n\n		scope.update();\n	};\n\n	this.detach = function (object) {\n		scope.object = undefined;\n		this.axis = null;\n\n		this.gizmo["translate"].hide();\n		this.gizmo["rotate"].hide();\n		this.gizmo["scale"].hide();\n	};\n\n	this.setMode = function (mode) {\n\n		_mode = mode ? mode : _mode;\n		//_mode = mode\n\n		if (_mode == "scale") scope.space = "local";\n\n		this.gizmo["translate"].hide();\n		this.gizmo["rotate"].hide();\n		this.gizmo["scale"].hide();\n		//if(_mode)\n		this.gizmo[_mode].show();\n\n		this.update();\n		scope.dispatchEvent(changeEvent);\n	};\n\n	this.setSnap = function (snap) {\n\n		scope.snap = snap;\n	};\n\n	this.setSize = function (size) {\n\n		scope.size = size;\n		this.update();\n		scope.dispatchEvent(changeEvent);\n	};\n\n	this.setSpace = function (space) {\n\n		scope.space = space;\n		this.update();\n		scope.dispatchEvent(changeEvent);\n	};\n\n	this.update = function () {\n\n		if (scope.object === undefined) return;\n		if (!scope.enabled) return;\n\n		scope.object.updateMatrixWorld();\n		worldPosition.setFromMatrixPosition(scope.object.matrixWorld);\n		worldRotation.setFromRotationMatrix(tempMatrix.extractRotation(scope.object.matrixWorld));\n\n		camera.updateMatrixWorld();\n		camPosition.setFromMatrixPosition(camera.matrixWorld);\n		camRotation.setFromRotationMatrix(tempMatrix.extractRotation(camera.matrixWorld));\n\n		scale = worldPosition.distanceTo(camPosition) / 6 * scope.size;\n		this.position.copy(worldPosition);\n		this.scale.set(scale, scale, scale);\n\n		eye.copy(camPosition).sub(worldPosition).normalize();\n\n		if (scope.space == "local") this.gizmo[_mode].update(worldRotation, eye);else if (scope.space == "world") this.gizmo[_mode].update(new _three2.default.Euler(), eye);\n\n		this.gizmo[_mode].highlight(scope.axis);\n	};\n\n	function onPointerHover(event) {\n		//  console.log("pointer move in Transform controls");\n		if (scope.object === undefined || _dragging === true) return;\n\n		event.preventDefault();\n\n		var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n		var intersect = intersectObjects(pointer, scope.gizmo[_mode].pickers.children);\n\n		var axis = null;\n\n		if (intersect) {\n\n			axis = intersect.object.name;\n		}\n\n		if (scope.axis !== axis) {\n\n			scope.axis = axis;\n			scope.update();\n			scope.dispatchEvent(changeEvent);\n		}\n	}\n\n	function onPointerDown(event) {\n		//console.log("pointer down in Transform controls");\n		if (scope.object === undefined || _dragging === true) return;\n\n		event.preventDefault();\n		//event.stopPropagation();\n\n		var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n		//console.log("pointer",pointer.button)\n\n		if (pointer.button === 0 || pointer.button === 2 || pointer.button === undefined) {\n\n			var intersect = intersectObjects(pointer, scope.gizmo[_mode].pickers.children);\n\n			if (intersect) {\n\n				//console.log("intersected")\n				scope.dispatchEvent(mouseDownEvent);\n\n				scope.axis = intersect.object.name;\n\n				scope.update();\n\n				eye.copy(camPosition).sub(worldPosition).normalize();\n\n				scope.gizmo[_mode].setActivePlane(scope.axis, eye);\n\n				var planeIntersect = intersectObjects(pointer, [scope.gizmo[_mode].activePlane]);\n\n				oldPosition.copy(scope.object.position);\n				oldScale.copy(scope.object.scale);\n\n				oldRotationMatrix.extractRotation(scope.object.matrix);\n				worldRotationMatrix.extractRotation(scope.object.matrixWorld);\n\n				parentRotationMatrix.extractRotation(scope.object.parent.matrixWorld);\n				parentScale.setFromMatrixScale(tempMatrix.getInverse(scope.object.parent.matrixWorld));\n\n				offset.copy(planeIntersect.point);\n			}\n		}\n\n		_dragging = true;\n	}\n\n	function onPointerMove(event) {\n\n		if (scope.object === undefined || scope.axis === null || _dragging === false) return;\n\n		event.preventDefault();\n		//event.stopPropagation();\n\n		var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n		var planeIntersect = intersectObjects(pointer, [scope.gizmo[_mode].activePlane]);\n\n		point.copy(planeIntersect.point);\n\n		if (_mode == "translate") {\n\n			point.sub(offset);\n			point.multiply(parentScale);\n\n			if (scope.space == "local") {\n\n				point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n				if (scope.axis.search("X") == -1) point.x = 0;\n				if (scope.axis.search("Y") == -1) point.y = 0;\n				if (scope.axis.search("Z") == -1) point.z = 0;\n\n				point.applyMatrix4(oldRotationMatrix);\n\n				scope.object.position.copy(oldPosition);\n				scope.object.position.add(point);\n			}\n\n			if (scope.space == "world" || scope.axis.search("XYZ") != -1) {\n\n				if (scope.axis.search("X") == -1) point.x = 0;\n				if (scope.axis.search("Y") == -1) point.y = 0;\n				if (scope.axis.search("Z") == -1) point.z = 0;\n\n				point.applyMatrix4(tempMatrix.getInverse(parentRotationMatrix));\n\n				scope.object.position.copy(oldPosition);\n				scope.object.position.add(point);\n			}\n\n			if (scope.snap !== null) {\n\n				if (scope.axis.search("X") != -1) scope.object.position.x = Math.round(scope.object.position.x / scope.snap) * scope.snap;\n				if (scope.axis.search("Y") != -1) scope.object.position.y = Math.round(scope.object.position.y / scope.snap) * scope.snap;\n				if (scope.axis.search("Z") != -1) scope.object.position.z = Math.round(scope.object.position.z / scope.snap) * scope.snap;\n			}\n		} else if (_mode == "scale") {\n\n			point.sub(offset);\n			point.multiply(parentScale);\n\n			if (scope.space == "local") {\n\n				if (scope.axis == "XYZ") {\n\n					scale = 1 + point.y / 50;\n\n					scope.object.scale.x = oldScale.x * scale;\n					scope.object.scale.y = oldScale.y * scale;\n					scope.object.scale.z = oldScale.z * scale;\n				} else {\n\n					point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n					if (scope.axis == "X") scope.object.scale.x = oldScale.x * (1 + point.x / 50);\n					if (scope.axis == "Y") scope.object.scale.y = oldScale.y * (1 + point.y / 50);\n					if (scope.axis == "Z") scope.object.scale.z = oldScale.z * (1 + point.z / 50);\n				}\n			}\n		} else if (_mode == "rotate") {\n\n			point.sub(worldPosition);\n			point.multiply(parentScale);\n			tempVector.copy(offset).sub(worldPosition);\n			tempVector.multiply(parentScale);\n\n			if (scope.axis == "E") {\n\n				point.applyMatrix4(tempMatrix.getInverse(lookAtMatrix));\n				tempVector.applyMatrix4(tempMatrix.getInverse(lookAtMatrix));\n\n				rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n				offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n				tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n\n				quaternionE.setFromAxisAngle(eye, rotation.z - offsetRotation.z);\n				quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionE);\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n				scope.object.quaternion.copy(tempQuaternion);\n			} else if (scope.axis == "XYZE") {\n\n				quaternionE.setFromEuler(point.clone().cross(tempVector).normalize()); // rotation axis\n\n				tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n				quaternionX.setFromAxisAngle(quaternionE, -point.clone().angleTo(tempVector));\n				quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n				scope.object.quaternion.copy(tempQuaternion);\n			} else if (scope.space == "local") {\n\n				point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n				tempVector.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n				rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n				offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n				quaternionXYZ.setFromRotationMatrix(oldRotationMatrix);\n				quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x);\n				quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y);\n				quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);\n\n				if (scope.axis == "X") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionX);\n				if (scope.axis == "Y") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionY);\n				if (scope.axis == "Z") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionZ);\n\n				scope.object.quaternion.copy(quaternionXYZ);\n			} else if (scope.space == "world") {\n\n				rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n				offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n				tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n\n				quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x);\n				quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y);\n				quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);\n				quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n				if (scope.axis == "X") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n				if (scope.axis == "Y") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionY);\n				if (scope.axis == "Z") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionZ);\n\n				tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n				scope.object.quaternion.copy(tempQuaternion);\n			}\n		}\n\n		scope.update();\n		scope.dispatchEvent(changeEvent);\n		scope.dispatchEvent(objectChangeEvent);\n	}\n\n	function onPointerUp(event) {\n		//console.log("pointer up in transform controls");\n		if (_dragging && scope.axis !== null) {\n			mouseUpEvent.mode = _mode;\n			scope.dispatchEvent(mouseUpEvent);\n			/*event.preventDefault();\n    event.stopPropagation();\n    event.stopImmediatePropagation();*/\n		}\n		_dragging = false;\n		onPointerHover(event);\n	}\n\n	function intersectObjects(pointer, objects) {\n\n		var rect = scope.domElement.getBoundingClientRect();\n		var x = (pointer.clientX - rect.left) / rect.width;\n		var y = (pointer.clientY - rect.top) / rect.height;\n\n		pointerVector.set(x * 2 - 1, -(y * 2) + 1, 0.5);\n		pointerVector.unproject(camera);\n\n		ray.set(camPosition, pointerVector.sub(camPosition).normalize());\n\n		var intersections = ray.intersectObjects(objects, true);\n		return intersections[0] ? intersections[0] : false;\n	}\n};\n\nTransformControls.prototype = Object.create(_three2.default.Object3D.prototype);\n\nexports.default = TransformControls;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/transforms/TransformControls.js\n ** module id = 162\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/transforms/TransformControls.js?');
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.getEntryExitThickness = getEntryExitThickness;\nexports.getObjectPointNormal = getObjectPointNormal;\nexports.getDistanceFromStartEnd = getDistanceFromStartEnd;\nexports.computeCenterDiaNormalFromThreePoints = computeCenterDiaNormalFromThreePoints;\nexports.computeAngleFromThreePoints = computeAngleFromThreePoints;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getEntryExitThickness(entryInteresect) {\n  var normalType = arguments.length <= 1 || arguments[1] === undefined ? 'face' : arguments[1];\n\n  var normal = entryInteresect.face.normal.clone();\n  switch (normalType) {\n    case 'face':\n      break;\n    case 'x':\n      normal = new _three2.default.Vector3(1, 0, 0);\n      break;\n    case 'y':\n      normal = new _three2.default.Vector3(0, 1, 0);\n      break;\n    case 'z':\n      normal = new _three2.default.Vector3(0, 0, 1);\n      break;\n  }\n\n  var object = entryInteresect.object;\n  if (!object) return undefined;\n\n  var entryPoint = entryInteresect.point.clone();\n  var flippedNormal = normal.clone().negate();\n  var offsetPoint = entryPoint.clone().add(flippedNormal.clone().multiplyScalar(10000));\n\n  // get escape entryPoint\n  var raycaster = new _three2.default.Raycaster(offsetPoint, normal.clone().normalize());\n  var intersects = raycaster.intersectObjects([object], true);\n\n  var exitPoint = null;\n  var minDist = Infinity;\n\n  intersects.map(function (entry) {\n    var curPt = entry.point;\n    var curLn = curPt.clone().sub(entryPoint).length();\n\n    if (curLn < minDist) {\n      exitPoint = curPt;\n      minDist = curLn;\n    }\n  });\n\n  // FIXME: todo or not ??\n  object.worldToLocal(entryPoint);\n\n  object.worldToLocal(exitPoint);\n\n  // compute actual thickness\n  var endToStart = exitPoint.clone().sub(entryPoint);\n  var thickness = endToStart.length();\n\n  return { object: object, entryPoint: entryPoint, exitPoint: exitPoint, thickness: thickness };\n}\n\nfunction getObjectPointNormal(pickingInfos) {\n  var point = pickingInfos.point; // closest point\n  var object = pickingInfos.object; // closest point\n  var face = pickingInfos.face; // closest face\n  var normal = face.normal;\n\n  // set point coordinates to be local , not global\n  // FIXME: are we sure about this?\n  object.worldToLocal(point);\n\n  return { object: object, point: point, normal: normal };\n}\n\nfunction getDistanceFromStartEnd(start, end) {\n  var endToStart = end.clone().sub(start);\n  var distance = endToStart.length();\n  return distance;\n}\n\n// compute center , dia/radius from three 3d points\nfunction computeCenterDiaNormalFromThreePoints(pointA, pointB, pointC) {\n  var plane = new _three2.default.Plane().setFromCoplanarPoints(pointA, pointB, pointC);\n  var center = new _three2.default.Vector3();\n\n  // see http://en.wikipedia.org/wiki/Circumscribed_circle\n  // triangle \"edges\"\n  var t = pointA.clone().sub(pointB);\n  var u = pointB.clone().sub(pointC);\n  var v = pointC.clone().sub(pointA);\n  var m = pointA.clone().sub(pointC);\n  var x = pointB.clone().sub(pointA);\n  var z = pointC.clone().sub(pointB);\n\n  var foo = t.clone().cross(u).length();\n  var bar = 2 * foo;\n  var baz = foo * foo;\n  var buu = 2 * baz;\n\n  var radius = t.length() * u.length() * v.length() / bar;\n\n  var alpha = u.lengthSq() * t.clone().dot(m) / buu;\n  var beta = m.lengthSq() * x.clone().dot(u) / buu;\n  var gamma = t.lengthSq() * v.clone().dot(z) / buu;\n\n  center = pointA.clone().multiplyScalar(alpha).add(pointB.clone().multiplyScalar(beta)).add(pointC.clone().multiplyScalar(gamma));\n\n  var diameter = radius * 2;\n  var normal = plane.normal;\n\n  return { center: center, diameter: diameter, normal: normal };\n}\n\nfunction computeAngleFromThreePoints(pointA, pointB, pointC) {\n  var v1 = pointA.clone().sub(pointB);\n  var v2 = pointC.clone().sub(pointB);\n  var angle = v1.angleTo(v2);\n  return angle;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/utils.js\n ** module id = 163\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/utils.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n// const annotations = helpers.annotations\n// faster object.assign\n\n\nexports.makeNoteVisual = makeNoteVisual;\nexports.makeDistanceVisual = makeDistanceVisual;\nexports.makeThicknessVisual = makeThicknessVisual;\nexports.makeDiameterVisual = makeDiameterVisual;\nexports.makeAngleVisual = makeAngleVisual;\n\nvar _glViewHelpers = __webpack_require__(60);\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar annotStyle = {\n  crossColor: '#000',\n  textColor: '#000',\n  lineColor: '#000',\n  arrowColor: '#000',\n  lineWidth: 2.2,\n  highlightColor: '#60C4F8', // \"#00F\",\n  fontFace: 'Open Sans'\n};\n\nfunction resolveMeshes(deps, meshes) {\n  return deps.map(function (dep) {\n    return meshes[dep];\n  }).filter(function (x) {\n    return x !== undefined;\n  });\n}\n\nfunction addMetaData(meta, visual) {\n  visual.userData.entity = { id: meta.id };\n  // special attributes\n  visual.pickable = true;\n  return visual;\n}\n\nfunction combineData(meta, deps, meshes, makeVisual) {\n  var depMeshes = resolveMeshes(deps, meshes);\n  var visual = makeVisual(depMeshes);\n  return addMetaData(meta, visual);\n}\n\n// actual visual makers\n\nfunction makeNoteVisual(meta, meshes) {\n  console.log('makeNoteVisual', meta, meshes);\n  var point = meta.target.point;\n  var deps = [meta.target.id];\n\n  function makeVisual(_ref) {\n    var _ref2 = _slicedToArray(_ref, 1);\n\n    var object = _ref2[0];\n\n    // mesh.updateMatrix()\n    // mesh.updateMatrixWorld()\n    var pt = new _three2.default.Vector3().fromArray(point); // .add(mesh.position)\n    pt = object.localToWorld(pt);\n\n    var params = {\n      point: pt,\n      object: object\n    };\n    params = (0, _modelUtils.mergeData)(params, annotStyle);\n\n    return new _glViewHelpers.annotations.NoteVisual(params);\n  }\n\n  return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeDistanceVisual(meta, meshes) {\n  var start = meta.target.start;\n  var end = meta.target.end;\n\n  var deps = [start.id, end.id];\n\n  function makeVisual(_ref3) {\n    var _ref4 = _slicedToArray(_ref3, 2);\n\n    var startMesh = _ref4[0];\n    var endMesh = _ref4[1];\n\n    var startPt = new _three2.default.Vector3().fromArray(start.point);\n    var endPt = new _three2.default.Vector3().fromArray(end.point);\n    startMesh.localToWorld(startPt);\n    endMesh.localToWorld(endPt);\n    // startMesh.worldToLocal(startPt)\n    // endMesh.worldToLocal(endPt)\n\n    var params = {\n      start: startPt,\n      startObject: startMesh,\n      end: endPt,\n      endObject: endMesh\n    };\n    params = (0, _modelUtils.mergeData)(params, annotStyle);\n\n    return new _glViewHelpers.annotations.DistanceVisual(params);\n  }\n\n  return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeThicknessVisual(meta, meshes) {\n  var deps = [meta.target.id];\n  var entryPoint = meta.target.entryPoint;\n  var exitPoint = meta.target.exitPoint;\n\n  function makeVisual(_ref5) {\n    var _ref6 = _slicedToArray(_ref5, 1);\n\n    var object = _ref6[0];\n\n    entryPoint = new _three2.default.Vector3().fromArray(entryPoint);\n    exitPoint = new _three2.default.Vector3().fromArray(exitPoint);\n    entryPoint = object.localToWorld(entryPoint);\n    exitPoint = object.localToWorld(exitPoint);\n\n    var params = {\n      entryPoint: entryPoint,\n      exitPoint: exitPoint,\n      object: object\n    };\n    params = (0, _modelUtils.mergeData)(params, annotStyle);\n    return new _glViewHelpers.annotations.ThicknessVisual(params);\n  }\n\n  return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeDiameterVisual(meta, meshes) {\n  var point = meta.target.point;\n  var normal = meta.target.normal;\n  var diameter = meta.value;\n  var deps = [meta.target.id];\n\n  function makeVisual(_ref7) {\n    var _ref8 = _slicedToArray(_ref7, 1);\n\n    var mesh = _ref8[0];\n\n    point = new _three2.default.Vector3().fromArray(point);\n    normal = new _three2.default.Vector3().fromArray(normal);\n    // mesh.updateMatrix()\n    // mesh.updateMatrixWorld()\n    point = mesh.localToWorld(point);\n\n    var params = {\n      center: point,\n      diameter: diameter,\n      orientation: normal\n    };\n    params = (0, _assign2.default)(params, annotStyle);\n\n    return new _glViewHelpers.annotations.DiameterVisual(params);\n  }\n\n  return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeAngleVisual(meta, meshes) {\n  var start = meta.target.start;\n  var mid = meta.target.mid;\n  var end = meta.target.end;\n  var angle = meta.value;\n\n  var deps = [start, mid, end].map(function (d) {\n    return d.id;\n  });\n\n  function makeVisual(_ref9) {\n    var _ref10 = _slicedToArray(_ref9, 3);\n\n    var startObject = _ref10[0];\n    var midObject = _ref10[1];\n    var endObject = _ref10[2];\n\n    var startPt = new _three2.default.Vector3().fromArray(start.point);\n    var midPt = new _three2.default.Vector3().fromArray(mid.point);\n    var endPt = new _three2.default.Vector3().fromArray(end.point);\n\n    var params = {\n      start: startPt,\n      mid: midPt,\n      end: endPt,\n      startObject: startObject,\n      midObject: midObject,\n      endObject: endObject,\n      angle: angle };\n    params = (0, _assign2.default)(params, annotStyle);\n\n    return new _glViewHelpers.annotations.AngleVisual(params);\n  }\n\n  return combineData(meta, deps, meshes, makeVisual);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/visualMakers.js\n ** module id = 164\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/visualMakers.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = FallbackPicker;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _dom = __webpack_require__(16);\n\n__webpack_require__(341);\n\nfunction FallbackPicker() {\n  var baseColors = {\n    'red': [255, 0, 0],\n    'pink': [255, 0, 255],\n    'blue': [0, 0, 255],\n    'turquois': [0, 255, 255],\n    'green': [0, 255, 0],\n    'yellow': [255, 255, 0],\n    'orange': [255, 102, 0],\n    'black': [0, 0, 0]\n  };\n\n  function componentToHex(rgbPosition) {\n    // translate the seperate rgb postions (0 -> 255) to its hex format\n    var hex = rgbPosition.toString(16);\n    return hex.length === 1 ? '0' + hex : hex;\n  }\n\n  function getColors() {\n    // creates a range for every basecolor. Does this by dividing the range (255 per primary color -> rgb)\n    // into steps and adding the steprange for every step untill it all adds up to white (we don't show the last step)\n    var steps = 8;\n    var stepRange = 32;\n    var htmlCodes = [];\n    for (var color in baseColors) {\n      var rgb = baseColors[color]; // array\n      var hex = [];\n      for (var i = 0; i < steps; i++) {\n        // always 1 less then the number of steps because last step is white for all\n        for (var j = 0; j < 3; j++) {\n          hex[j] = componentToHex(rgb[j]);\n\n          // from here we take it up a notch (make the color lighter by adding a the stepRange)\n          if (rgb[j] < 255) {\n            rgb[j] += stepRange;\n          }\n          if (rgb[j] > 255) {\n            // fallback for calculation differences because 255 / 66 does not devide to a round number\n            rgb[j] = 255;\n          }\n        }\n        var htmlCode = '#' + hex.join('');\n        htmlCodes.push(htmlCode);\n      }\n    }\n    return htmlCodes;\n  }\n\n  var colorGrid = getColors().map(function (color) {\n    return (0, _dom.h)('div.fallbackPickerSquare', { style: { backgroundColor: color }, attrs: { 'data-color': color } }, []);\n  });\n\n  var picker = (0, _snabbdomJsx.html)(\n    'div',\n    { className: 'colorGridWrapper' },\n    colorGrid\n  );\n  return picker;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/ColorPicker/fallbackPicker.js\n ** module id = 165\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/ColorPicker/fallbackPicker.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _utils = __webpack_require__(3);\n\nfunction intents(postMessage) {\n  var postMessage$ = postMessage.filter(_utils.exists).filter(function (p) {\n    return p.hasOwnProperty('data');\n  });\n\n  var captureScreen$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('captureScreen');\n  });\n  /* .withLatestFrom(drivers.DOM.select(\".glView .container canvas\").observable,function(request,element){\n    element = element[0]\n    return {request,element}\n  })*/\n\n  // this one might need refactoring\n  var getTransforms$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('getTransforms');\n  });\n\n  var getStatus$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('getStatus');\n  });\n\n  return {\n    captureScreen$: captureScreen$,\n    getTransforms$: getTransforms$,\n    getStatus$: getStatus$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/api/actions/fromPostMessage.js\n ** module id = 166\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/api/actions/fromPostMessage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = api;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _imgUtils = __webpack_require__(223);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge; // faster object.assign\n\nfunction api(actions, state$) {\n  var transforms$ = actions.apiActions.getTransforms$.withLatestFrom(state$.pluck('transforms'), function (request, transforms) {\n    // console.log(\"getTransforms\",request,transforms)\n    var transformsList = Object.keys(transforms).reduce(function (acc, key) {\n      var trs = (0, _assign2.default)({}, transforms[key], { id: key });\n      var out = acc.concat([trs]);\n      return out;\n    }, []);\n    return {\n      request: request,\n      response: transformsList,\n      requestName: 'getTransforms'\n    };\n  });\n\n  var status$ = actions.apiActions.getStatus$.withLatestFrom(state$.pluck('settings'), function (request, settings) {\n    var response = {\n      activeTool: settings.activeTool\n    };\n    return { request: request, response: response, requestName: 'getStatus' };\n  });\n\n  var screenCapture$ = actions.apiActions.captureScreen$.map(function (data) {\n    var request = data.request;\n    var element = data.element;\n\n    var img = (0, _imgUtils.domElementToImage)(element);\n    return { request: request, response: img, requestName: 'captureScreen' };\n  });\n\n  var apiOutputs$ = merge(transforms$, status$, screenCapture$);\n\n  // for now stop gap solution\n  // specific sinks, this requires us knowing the origin of the actions ...\n  // ie TODO!!!\n  var postMsg$ = apiOutputs$.map(function (data) {\n    var request = data.request;\n    var response = data.response;\n    var requestName = data.requestName;\n\n    return { target: request.source, message: response, targetOrigin: request.origin, requestName: requestName };\n  });\n\n  return { outputs$: apiOutputs$, postMsg$: postMsg$ };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/api/api.js\n ** module id = 167\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/api/api.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromPostMessage = __webpack_require__(166);\n\nvar _fromPostMessage2 = _interopRequireDefault(_fromPostMessage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n  var actionsSources = [(0, _fromPostMessage2.default)(sources.postMessage)];\n  return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/api/intents.js\n ** module id = 168\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/api/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\nfunction intent(addressbar, params) {\n  var setAuthToken$ = addressbar.get('authToken').flatMap(fromArray).filter(_utils.exists);\n\n  return {\n    setAuthToken$: setAuthToken$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/auth/actions/fromAddressbar.js\n ** module id = 169\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/auth/actions/fromAddressbar.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = auth;\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction setAuthToken(state, input) {\n  var output = (0, _modelUtils.mergeData)(state, { token: input });\n  return output;\n}\n\nfunction auth(actions, source) {\n  // /defaults, what else ?\n  var defaults = { token: undefined };\n\n  var updateFns = { setAuthToken: setAuthToken };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions, source);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/auth/auth.js\n ** module id = 170\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/auth/auth.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromAddressbar = __webpack_require__(169);\n\nvar _fromAddressbar2 = _interopRequireDefault(_fromAddressbar);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n  var actionsSources = [(0, _fromAddressbar2.default)(sources.addressbar)];\n  return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/auth/intents.js\n ** module id = 171\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/auth/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nfunction intent(events, params) {\n  var updateBomEntries$ = events.select('bom').events('editEntry$').map(_utils.toArray);\n\n  var upsertBomEntries$ = events.select('bom').events('addEntry$')\n  /* .map(function(data){//inject extra data\n    return mergeData({},data,{id:generateUUID()})\n  })*/\n  .map(function (data) {\n    return { id: data.id, data: data };\n  }) // convert data structure to something the BOM model can deal with\n  .map(_utils.toArray);\n\n  /* const removeBomEntries$ = events\n    .select('bom').events('removeEntry$')\n    .map(toArray) */\n\n  /*\n  function hasClear(data){\n    if(data && data.hasOwnProperty(\"clear\")) return true\n      return false\n  }\n  const clearBomEntries$ = merge(\n      drivers.DOM.select('.clearAll').events('click')\n      , drivers.DOM.select('.reset').events('click')//DEBUG ONLY\n      , drivers.postMessage\n        .filter(hasClear)\n    )*/\n\n  return {\n    updateBomEntries$: updateBomEntries$,\n    upsertBomEntries$: upsertBomEntries$\n    // ,removeBomEntries$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/bom/actions/fromEvents.js\n ** module id = 172\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/bom/actions/fromEvents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nvar _ramda = __webpack_require__(4);\n\nfunction intent(ym, params) {\n  var bom$ = ym.data.filter(function (res) {\n    return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'bom';\n  }).mergeAll().pluck('response');\n\n  var upsertBomEntries$ = bom$.map(function (data) {\n    return data.map(function (entry) {\n      var mapping = {\n        'part_uuid': 'id',\n        'part_version': 'version'\n      };\n      var typeMapping = {\n        'qty': parseFloat,\n        'phys_qty': parseFloat\n      };\n      var fieldNames = ['id', 'part_parameters', 'qty', 'phys_qty', 'unit', 'printable'];\n      var data = (0, _ramda.pick)(fieldNames, (0, _utils.coerceTypes)(typeMapping, (0, _utils.remapJson)(mapping, entry)));\n      // FIXME: coerceTypes should be doing this !!\n\n      return { id: data.id, data: data };\n    });\n  });\n  // .tap(e => console.log('upsertBomEntries (from ym)', e))\n\n  return {\n    upsertBomEntries$: upsertBomEntries$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/bom/actions/fromYm.js\n ** module id = 173\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/bom/actions/fromYm.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = bomIntent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _diffPatchUtils = __webpack_require__(76);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromEvents = __webpack_require__(172);\n\nvar _fromEvents2 = _interopRequireDefault(_fromEvents);\n\nvar _fromYm = __webpack_require__(173);\n\nvar _fromYm2 = _interopRequireDefault(_fromYm);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction bomIntent(sources, entityTypes$, metaActions, entityActions) {\n  var typeChanges$ = (0, _diffPatchUtils.changesFromObservableArrays)(entityTypes$).share();\n\n  // BOM\n  var upsertBomEntries$ = typeChanges$.pluck('upserted') // \"a new type was added\"\n  .filter(function (e) {\n    return e.length > 0;\n  }).tap(function (e) {\n    return console.log('type added', e);\n  }).map(function (typeDatas) {\n    return typeDatas.filter(function (x) {\n      return x.id !== undefined;\n    }) // we can only deal with data with actual ids\n    .map(function (_ref) {\n      var id = _ref.id;\n      var name = _ref.name;\n\n      // const data = {id, name, qty:0, phys_qty:0, version:\"0.0.1\", unit:\"QA\", printable:true}\n      var data = { id: id, name: name };\n      return { id: id, data: data };\n    });\n  });\n\n  var removeBomEntries$ = typeChanges$.pluck('removed').filter(function (e) {\n    return e.length > 0;\n  }).tap(function (e) {\n    return console.log('type removed', e);\n  }).map(function (typeDatas) {\n    return typeDatas.map(function (_ref2) {\n      var id = _ref2.id;\n\n      return { id: id };\n    });\n  });\n\n  var increaseBomEntries$ = metaActions.createComponents$\n  // .filter(exists)\n  .tap(function (e) {\n    return console.log('increaseBomEntries(from createComponents)', e);\n  }).map(function (data) {\n    return data.filter(function (dat) {\n      return dat.value.typeUid !== undefined;\n    }).map(function (dat) {\n      return { offset: 1, id: dat.value.typeUid };\n    });\n  }).merge(metaActions.duplicateComponents$.tap(function (e) {\n    return console.log('increaseBomEntries (from duplicateComponents)', e);\n  })\n  // .filter(exists)\n  .map(function (data) {\n    return data.filter(function (dat) {\n      return dat.typeUid !== undefined || dat.value.typeUid !== undefined;\n    }).map(function (dat) {\n      return { offset: 1, id: dat.typeUid };\n    });\n  }));\n\n  var decreaseBomEntries$ = entityActions.deleteInstances$.tap(function (e) {\n    return console.log('deleteInstances A1', e);\n  }).map(function (data) {\n    return data.filter(function (d) {\n      return d.id !== undefined || d.typeUid !== undefined;\n    }).map(function (dat) {\n      return {\n        offset: -1,\n        id: dat.typeUid\n      };\n    });\n  }).tap(function (e) {\n    return console.log('decreaseBomEntries', e);\n  });\n\n  var updateBomEntriesCount$ = merge(increaseBomEntries$, decreaseBomEntries$);\n\n  var clearBomEntries$ = merge(entityActions.clearDesign$);\n\n  var settingActionSources = [(0, _fromEvents2.default)(sources.events), (0, _fromYm2.default)(sources.ym)];\n  var extraActions = (0, _obsUtils.mergeActionsByName)(settingActionSources);\n\n  var upsertBomEntriesAll$ = extraActions.upsertBomEntries$.merge(upsertBomEntries$);\n  var updateBomEntries$ = extraActions.updateBomEntries$;\n  var removeBomEntriesAll$ = removeBomEntries$; // extraActions.removeBomEntries$.merge(removeBomEntries$)\n\n  var bomActions = (0, _modelUtils.mergeData)({\n    // upsertBomEntries$,\n    upsertBomEntries$: upsertBomEntriesAll$,\n    updateBomEntriesCount$: updateBomEntriesCount$,\n    updateBomEntries$: updateBomEntries$,\n    clearBomEntries$: clearBomEntries$,\n    removeBomEntries$: removeBomEntriesAll$\n  });\n\n  return bomActions;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/bom/intents.js\n ** module id = 174\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/bom/intents.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\nfunction intent(events, params) {\n  var addComments$ = events.select('comments').events('addComment$');\n\n  return {\n    addComments$: addComments$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/comments/actions/fromEvents.js\n ** module id = 175\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/comments/actions/fromEvents.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _log = __webpack_require__(77);\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar log = (0, _log2.default)(\'comments\');\nlog.setLevel(\'info\');\n\n// "comments" system\n// helper function to get data by key\n/*\nfunction bykey(key){\n  return comments.data.filter(function(e){\n    let equal = equals(e.key , key)\n    return equal\n  })\n}*/\n\nfunction addComments(state, input) {\n  log.info(\'adding comments\', input);\n  var newComments = (0, _utils.toArray)(input);\n\n  var comments = state.data.concat(newComments.map(function (comment) {\n    var _comment$target = comment.target;\n    var id = _comment$target.id;\n    var typeUid = _comment$target.typeUid;\n\n    var text = comment.text;\n    var author = \'jon doe\'; // FIXME: how to deal with authors ?\n\n    var key = [id, typeUid];\n    var entry = { text: text, author: author, key: key };\n    return entry;\n  }));\n  var updatedState = {\n    data: comments\n  };\n  return updatedState;\n}\n\nfunction comments(actions, source) {\n  // /defaults, what else ?\n  var defaults = {\n    data: [\n      /* {text:"bla bla details",author:"foo"},\n      {text:"oh yes cool ",author:"bar"},*/\n    ]\n  };\n\n  var updateFns = { addComments: addComments };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions, source, { doApplyTransform: true });\n}\n\nexports.default = comments;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/comments/comments.js\n ** module id = 176\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/comments/comments.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromEvents = __webpack_require__(175);\n\nvar _fromEvents2 = _interopRequireDefault(_fromEvents);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n  var actionsSources = [(0, _fromEvents2.default)(sources.events)];\n  return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/comments/intents.js\n ** module id = 177\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/comments/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\nfunction intent(addressbar, params) {\n  var loadDesign$ = addressbar.get('designId').flatMap(fromArray).filter(_utils.exists);\n  // .filter(isEmpty)\n\n  var setAuthToken$ = addressbar.get('authToken');\n  /*\n   export function authToken(addressbar, params){\n    return addressbar.get('authToken')\n      //.tap(e=>console.log(\"authToken\",e))\n  }*/\n\n  return {\n    loadDesign$: loadDesign$\n    // ,setAuthToken$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/actions/fromAddressbar.js\n ** module id = 178\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/actions/fromAddressbar.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\nfunction intent(DOM, params) {\n  var clearDesign$ = DOM.select('.reset').events('click');\n\n  return {\n    clearDesign$: clearDesign$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/actions/fromDOM.js\n ** module id = 179\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/actions/fromDOM.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nfunction intent(postMessage, params) {\n  var postMessage$ = postMessage.filter(_utils.exists).filter(function (p) {\n    return p.hasOwnProperty('data');\n  });\n\n  var loadDesign$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('designId');\n  }).map(function (data) {\n    return data.data.designId;\n  });\n\n  var clearDesign$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('clear');\n  });\n\n  return {\n    loadDesign$: loadDesign$,\n    clearDesign$: clearDesign$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/actions/fromPostMessage.js\n ** module id = 180\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/actions/fromPostMessage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = design;\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// faster object.assign\n\nvar defaults = {\n  /* name       : undefined\n  ,description: undefined\n  ,version    : undefined//\"0.0.0\",\n  ,authors    : []\n  ,tags       : []\n  ,licenses   : []\n  ,meta       : undefined\n   ,id         : undefined\n  ,uri        : undefined*/\n\n  id: undefined,\n  ns: undefined,\n  synched: false\n};\n\nfunction newDesign(state, input) {\n  var design = (0, _assign2.default)({}, defaults);\n  return design;\n}\n\nfunction updateDesign(state, input) {\n  // log.info('setting design data', input)\n  var design = (0, _assign2.default)({}, state, input);\n  return design;\n}\n\nfunction loadDesign(state, input) {\n  console.log('designInfos', input);\n  return { synched: true, id: input, ns: 'ym' };\n}\n\nfunction clearDesign(state, input) {\n  return defaults;\n}\n\nfunction design(actions, source) {\n  console.log('design');\n  var updateFns = { newDesign: newDesign, updateDesign: updateDesign, loadDesign: loadDesign, clearDesign: clearDesign };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions, source);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/design.js\n ** module id = 181\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/design.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromDOM = __webpack_require__(179);\n\nvar _fromDOM2 = _interopRequireDefault(_fromDOM);\n\nvar _fromAddressbar = __webpack_require__(178);\n\nvar _fromAddressbar2 = _interopRequireDefault(_fromAddressbar);\n\nvar _fromPostMessage = __webpack_require__(180);\n\nvar _fromPostMessage2 = _interopRequireDefault(_fromPostMessage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n  var actionsSources = [(0, _fromDOM2.default)(sources.DOM), (0, _fromAddressbar2.default)(sources.addressbar), (0, _fromPostMessage2.default)(sources.postMessage)];\n  return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/intents.js\n ** module id = 182\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/intents.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\nfunction intent(DOM, params) {\n  // const clearDesign$= DOM.select('.reset').events(\"click\")\n  var deleteInstances$ = DOM.select('.delete').events('click').map(undefined);\n  var duplicateInstances$ = DOM.select('.duplicate').events('click');\n  var mirrorInstances$ = DOM.select('.mirror-x').events('click').map(function (d) {\n    return { axis: 0 };\n  }).merge(DOM.select('.mirror-Y').events('click').map(function (d) {\n    return { axis: 1 };\n  })).merge(DOM.select('.mirror-Z').events('click').map(function (d) {\n    return { axis: 2 };\n  }));\n\n  return {\n    deleteInstances$: deleteInstances$,\n    duplicateInstances$: duplicateInstances$,\n    mirrorInstances$: mirrorInstances$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromDOM.js\n ** module id = 183\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromDOM.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _otherUtils = __webpack_require__(47);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction intent(events, params) {\n  // entities/components\n  var updateMetaComponent$ = events.select('entityInfos').events('changeMeta$').map(function (c) {\n    return { target: 'meta', data: c };\n  });\n\n  var updateTransformComponent$ = events.select('entityInfos').events('changeTransforms$').merge(events.select('gl').events('selectionsTransforms$').debounce(20)).map(function (c) {\n    return { target: 'transforms', data: c };\n  });\n\n  var updateComponent$ = merge(updateMetaComponent$, updateTransformComponent$);\n\n  var resetScaling$ = events.select('entityInfos').events('resetScaling$');\n\n  // measurements & annotations\n  var shortSingleTaps$ = events.select('gl').events('shortSingleTaps$');\n\n  var createAnnotationStep$ = shortSingleTaps$.map(function (event) {\n    return event.detail.pickingInfos;\n  }).filter(function (pickingInfos) {\n    return pickingInfos.length > 0;\n  }).map(_otherUtils.first).share();\n\n  var removePartData$ = events // same as removeBomEntries\n  .select('bom').events('removeEntry$').map(_utils.toArray);\n\n  var removeTypes$ = removePartData$.tap(function (e) {\n    return console.log('removeTypes(fromEvent:bom)', e);\n  });\n\n  var deleteInstances$ = removePartData$.map(function (data) {\n    return data.map(function (entry) {\n      return { typeUid: entry.id };\n    });\n  }).tap(function (e) {\n    return console.log('deleteInstances (fromEvent:bom)', e);\n  });\n\n  /* const annotationsActions =  {\n    creationStep$: actionsFromEvents.createAnnotationStep$\n  }*/\n\n  var addTypes$ = events // from bom\n  .select('bom').events('addEntry$').map(function (data) {\n    return { id: data.id, meta: data };\n  }); // convert data structure to something the BOM model can deal with\n  // .map(toArray)\n\n  return {\n    addTypes$: addTypes$,\n    removeTypes$: removeTypes$,\n    deleteInstances$: deleteInstances$,\n    updateComponent$: updateComponent$,\n    createAnnotationStep$: createAnnotationStep$,\n    resetScaling$: resetScaling$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromEvents.js\n ** module id = 184\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromEvents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\nfunction intent(postMessage, params) {\n  var postMessage$ = postMessage.filter(_utils.exists).filter(function (p) {\n    return p.hasOwnProperty('data');\n  });\n\n  var addPartData$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('addPartData');\n  }).map(function (data) {\n    return data.data.addPartData;\n  }).map(_utils.toArray).tap(function (e) {\n    return console.log('addPartData (fromPostMessage)', e);\n  });\n\n  var removePartData$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('removePartData');\n  }).map(function (data) {\n    return data.data.removePartData;\n  })\n  // .map(entry=>({id:entry.uuid}))\n  .map(_utils.toArray);\n\n  var removeTypes$ = removePartData$.map(function (data) {\n    return data.map(function (entry) {\n      return { id: entry.uuid };\n    });\n  }).tap(function (e) {\n    return console.log('removeTypes (fromPostMessage)', e);\n  });\n\n  var deleteInstances$ = removePartData$.map(function (data) {\n    return data.map(function (entry) {\n      return { typeUid: entry.uuid };\n    });\n  }).tap(function (e) {\n    return console.log('deleteInstances (fromPostMessage)', e);\n  });\n\n  // we create special \"read an html5 file \" requests with added id\n  var desktopRequests$ = addPartData$.map(function (data) {\n    return data.map(function (entry) {\n      return {\n        id: entry.uuid,\n        uri: entry.file.name, // name of the html5 File object\n        method: 'get',\n        data: entry.file,\n        // url:req.uri,\n        src: 'desktop',\n        type: 'resource'\n      };\n    });\n  }).flatMap(fromArray).tap(function (e) {\n    return console.log('desktopRequests (fromPostMessage)', e);\n  });\n\n  return {\n    addPartData$: addPartData$,\n    removePartData$: removePartData$,\n\n    removeTypes$: removeTypes$,\n    deleteInstances$: deleteInstances$,\n\n    // UGH\n    desktopRequests$: desktopRequests$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromPostMessage.js\n ** module id = 185\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromPostMessage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intentsFromResources;\nexports.default = intents;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _formatters = __webpack_require__(15);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// helper function to extract certain & infer data\nfunction intentsFromResources(rawParsedData$) {\n  var data$ = rawParsedData$.share();\n\n  var candidates$ = data$ // for these we need to infer type , metadata etc\n  .filter(function (d) {\n    return d.data.meshOnly === true;\n  }).map(function (_ref) {\n    var meta = _ref.meta;\n    var data = _ref.data;\n    return { data: (0, _ramda.head)(data.typesMeshes).mesh, meta: meta };\n  }).tap(function (e) {\n    return console.log('entityCandidates', e);\n  });\n\n  // these MIGHT become instances, or something else, we just are not 100% sure\n  var certains$ = data$ // for these we also have type, metadata etc, so we are CERTAIN of their data\n  .filter(function (d) {\n    return d.data.meshOnly === false;\n  }).tap(function (e) {\n    return console.log('entityCertains', e);\n  });\n\n  return {\n    candidates$: candidates$,\n    certains$: certains$\n  };\n}\n\nfunction intents(resources, params) {\n  var _intentsFromResources = intentsFromResources(resources);\n\n  var certains$ = _intentsFromResources.certains$;\n  var candidates$ = _intentsFromResources.candidates$;\n\n\n  var addInstanceCandidates$ = candidates$.filter(function (data) {\n    return data.meta.flags !== 'noInfer';\n  }).tap(function (e) {\n    return console.log('entityCandidates', e);\n  });\n\n  // components\n  var createMetaComponents$ = certains$.map(function (data) {\n    return data.data.instMeta;\n  })\n  // NOTE :we are doing these to make them compatible with remapMetaActions helpers, not sure this is the best\n  .map(function (datas) {\n    return datas.map(function (_ref2) {\n      var instUid = _ref2.instUid;\n      var typeUid = _ref2.typeUid;\n      var name = _ref2.name;\n      var color = _ref2.color;\n\n      return { id: instUid, value: { id: instUid, typeUid: typeUid, name: name, color: color } };\n    });\n  });\n  var createTransformComponents$ = certains$.map(function (data) {\n    return data.data.instTransforms;\n  }).map(function (datas) {\n    return datas.map(function (_ref3) {\n      var instUid = _ref3.instUid;\n      var transforms = _ref3.transforms;\n\n      return { id: instUid, value: { pos: [transforms[11], transforms[10], transforms[9]] } };\n    });\n  });\n  var createMeshComponents$ = certains$.map(function (data) {\n    return data.data.instMeta.map(function (instMeta) {\n      var meshData = (0, _ramda.head)(data.data.typesMeshes.filter(function (mesh) {\n        return mesh.typeUid === instMeta.typeUid;\n      }));\n      return {\n        id: instMeta.instUid,\n        value: { mesh: meshData.mesh.clone() } // TODO: check if this is redundant\n      };\n    });\n  });\n\n  // types handling\n\n  // infered 'possible' type: for example when drag & droping an stl file etc\n  var addTypeCandidate$ = candidates$.filter(function (data) {\n    return data.meta.id === undefined;\n  }).map(function (data) {\n    var name = (0, _formatters.nameCleanup)(data.meta.name);\n    return (0, _modelUtils.mergeData)(data, { meta: { name: name } });\n  }).tap(function (e) {\n    return console.log('adding type fromResource (candidate)', e);\n  });\n\n  // TODO : this would need to be filtered based on pre-existing type data\n  // this one is used for example for 3mf files or any other formats where the type is KNOWN\n  var addTypes$ = certains$.map(function (data) {\n    return data.data.typesMeta.map(function (typeMeta, index) {\n      if (typeMeta.name === undefined) {\n        // we want type names in any case, so we infer this base on \"file\" name\n        typeMeta.name = (0, _formatters.nameCleanup)(data.meta.name);\n        if (index > 0) {\n          typeMeta.name = typeMeta.name + index;\n        }\n      }\n      var result = (0, _modelUtils.mergeData)(typeMeta, { meta: typeMeta });\n\n      // extract mesh information\n      var _data = data.data.typesMeshes[index];\n      if (data) {\n        result = (0, _modelUtils.mergeData)(result, { data: _data.mesh });\n      }\n      return result;\n    });\n  }).tap(function (e) {\n    return console.log('adding type fromResource (certain)', e);\n  }).flatMap(function (items) {\n    return _rx2.default.Observable.from(items);\n  });\n\n  var alreadyExistingTypeMeshData$ = resources.filter(function (data) {\n    return data.meta.id !== undefined;\n  }).filter(function (data) {\n    return data.meta.flags !== 'noInfer';\n  }).tap(function (e) {\n    return console.log('alreadyExistingTypeMeshData', e);\n  });\n\n  // DO NOT cleanup the name/remove the extension, the entity types model takes care of that\n  // create new part type from basic type data & mesh data\n  var addTypeFromTypeAndMeshData$ = alreadyExistingTypeMeshData$.map(function (entry) {\n    var data = entry.data.typesMeshes[0].mesh;\n    var meta = {\n      name: (0, _formatters.nameCleanup)(entry.meta.name),\n      id: entry.meta.id\n    };\n    return { id: entry.meta.id, data: data, meta: meta };\n  }).tap(function (e) {\n    return console.log('addEntityTypesFromResource', e);\n  });\n\n  return {\n    addTypes$: addTypes$.merge(addTypeFromTypeAndMeshData$), // FIXME: is this one needed ? cause empty types/ bom entries when loading data from ym\n    addTypeCandidate$: addTypeCandidate$,\n    addInstanceCandidates$: addInstanceCandidates$,\n    createMetaComponents$: createMetaComponents$,\n    createTransformComponents$: createTransformComponents$,\n    createMeshComponents$: createMeshComponents$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromResources.js\n ** module id = 186\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromResources.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\n\n\nfunction rawData(ym) {\n  var parts = ym.data.filter(function (res) {\n    return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'parts';\n  }).mergeAll().pluck('response');\n  // .tap(e=>console.log(\"in parts: \",e))\n\n  var assemblies = ym.data.filter(function (res) {\n    return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'assemblyEntries';\n  })\n  // .mergeAll()\n  .flatMap(function (data) {\n    var response$ = data.pluck('response');\n    return response$.map(function (entries) {\n      return entries.map(function (entry) {\n        return (0, _modelUtils.mergeData)(entry, { assemblyId: data.request.assemblyId });\n      });\n    });\n  });\n  //.tap(e => console.log('in assemblies: ', e))\n\n  return {\n    parts: parts,\n    assemblies: assemblies\n  };\n}\n\nfunction intent(_ref, params) {\n  var ym = _ref.ym;\n  var resources = _ref.resources;\n\n  var data = rawData(ym);\n\n  var partsData$ = data.parts.share();\n\n  var assemblyData$ = data.assemblies.share();\n\n  var createMetaComponents$ = assemblyData$.map(function (datas) {\n    return datas.map(function (entry) {\n      var mapping = {\n        'uuid': 'id',\n        'part_uuid': 'typeUid'\n      };\n      // NOTE :we are doing these to make them compatible with remapMetaActions helpers, not sure this is the best\n      var fieldNames = ['name', 'color', 'id', 'typeUid', 'assemblyId'];\n      var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n      return {\n        id: data.id,\n        value: data\n      };\n    });\n  }).tap(function (e) {\n    return console.log('createMetaComponents (fromYm)', e);\n  });\n\n  var createTransformComponents$ = assemblyData$.map(function (datas) {\n    return datas.map(function (entry) {\n      var mapping = {\n        'uuid': 'id',\n        'part_uuid': 'typeUid'\n      };\n      var fieldNames = ['name', 'id', 'typeUid', 'pos', 'rot', 'sca'];\n      var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n\n      data.pos = data.pos.map(parseFloat);\n      data.rot = data.rot.map(parseFloat);\n      data.sca = data.sca.map(parseFloat);\n      // NOTE :we are doing these to make them compatible with remapMetaActions helpers, not sure this is the best\n      return {\n        id: data.id,\n        value: data\n      };\n    });\n  });\n  // .tap(e=>console.log(\"transforms\",e))\n  /* ext: \"stl\"\n  flags: \"noInfer\"\n  id: \"1535f856dd0iT\"\n  name: \"UM2CableChain_BedEnd.STL\"\n  uri: \"*/\n\n  // this makes sure that meshes ALWAYS get resolved, regardless of the order\n  // that mesh information and metadata gets recieved\n  function combineAndWaitUntil(meshesData$, assemblyData$) {\n    var obs = new _rx2.default.ReplaySubject();\n\n    var metas = [];\n    var meshes = {};\n    var dones = [];\n\n    function matchAttempt(id) {\n      metas.forEach(function (data) {\n        var mesh = meshes[data.typeUid];\n        if (mesh !== undefined) {\n          // mesh.userData = {}\n          if (dones.indexOf(data.id) === -1) {\n            var result = (0, _modelUtils.mergeData)(data, { value: { mesh: mesh } });\n            obs.onNext(result); // ONLY emit data when we have a match\n            dones.push(data.id);\n          }\n        }\n      });\n    }\n\n    meshesData$.forEach(function (meshData) {\n      var mesh = meshData.data.typesMeshes[0].mesh;\n      meshes[meshData.meta.id] = mesh;\n      matchAttempt(meshData.meta.id);\n    });\n\n    assemblyData$.flatMap(fromArray).forEach(function (data) {\n      metas.push(data);\n      matchAttempt(data.typeUid);\n    });\n\n    return obs;\n  }\n\n  var meshComponentMeshes$ = resources.filter(function (data) {\n    return data.meta.id !== undefined;\n  });\n\n  var meshComponentAssemblyData$ = assemblyData$.map(function (datas) {\n    return datas.map(function (entry) {\n      var mapping = {\n        'uuid': 'id',\n        'part_uuid': 'typeUid'\n      };\n      var fieldNames = ['id', 'typeUid', 'assemblyId'];\n      var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n      return { id: data.id, typeUid: data.typeUid, value: undefined };\n    });\n  });\n\n  var createMeshComponents$ = combineAndWaitUntil(meshComponentMeshes$, meshComponentAssemblyData$).map(_utils.toArray).tap(function (e) {\n    return console.log('createMeshComponents', e);\n  });\n\n  // TODO : this would need to be filtered based on pre-existing type data ?\n  var addTypes$ = partsData$.map(function (data) {\n    return data.map(function (entry) {\n      var mapping = {\n        'uuid': 'id'\n      };\n      var fieldNames = ['id', 'name', 'description', 'binary_document_id', 'binary_document_url', 'source_document_id', 'source_document_url'];\n      var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n      return { id: data.id, data: undefined, meta: data };\n    });\n  }).flatMap(fromArray);\n  // .forEach(e=>console.log(\"addEntityTypes\", e))\n\n  // send out requests to fetch data for meshes\n  var meshRequests$ = partsData$.map(function (data) {\n    return data.map(function (entry) {\n      var mapping = {\n        'uuid': 'id'\n      };\n      var fieldNames = ['id', 'name', 'description', 'binary_document_id', 'binary_document_url', 'source_document_id', 'source_document_url'];\n      var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n\n      return { src: 'http', method: 'get', uri: data.binary_document_url, url: data.binary_document_url, id: data.id, type: 'resource', flags: 'noInfer' };\n    });\n  }).flatMap(fromArray).filter(function (req) {\n    return req.uri !== undefined && req.uri !== '';\n  });\n  // .tap(e => console.log('meshRequests', e))\n\n  // set active assembly\n  var setActiveAssembly$ = assemblyData$.take(1).map(function (data) {\n    return (0, _ramda.head)(data);\n  }).filter(_utils.exists).pluck('assemblyId').distinctUntilChanged();\n  // .tap(e => console.log('setActiveAssembly', e))\n\n  return {\n    addTypes$: addTypes$,\n    createMetaComponents$: createMetaComponents$,\n    createTransformComponents$: createTransformComponents$,\n    createMeshComponents$: createMeshComponents$,\n\n    requests$: meshRequests$,\n    setActiveAssembly$: setActiveAssembly$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromYm.js\n ** module id = 187\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromYm.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.addAnnotation = addAnnotation;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(163);\n\nvar _otherUtils = __webpack_require__(47);\n\nvar _utils2 = __webpack_require__(3);\n\nvar _log = __webpack_require__(77);\n\nvar _log2 = _interopRequireDefault(_log);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar merge = Observable.merge;\n\n// import {clearActiveTool$} from\n\nvar log = (0, _log2.default)('annotations');\nlog.setLevel('error');\n\n// utilities\n/* generate note annotation data from input*/\nfunction generateNoteData(data) {\n  console.log('hey yo, add a note', data);\n  var object = data.object;\n  var point = data.point;\n  var normal = data.normal;\n\n\n  var annotation = {\n    typeUid: 'A1',\n    id: (0, _utils2.generateUUID)(),\n    cid: 1,\n    name: 'note',\n    target: {\n      point: point.toArray(),\n      normal: normal.toArray(),\n      typeUid: undefined,\n      id: object.userData.entity.id // here we could toggle, instance vs type\n    }\n  };\n\n  return annotation;\n}\n\n/* generate thickness annotation data from input*/\nfunction generateThicknessData(data) {\n  console.log('hey yo, add a thickness', data);\n\n  var object = data.object;\n  var entryPoint = data.entryPoint;\n  var exitPoint = data.exitPoint;\n  var thickness = data.thickness;\n\n\n  entryPoint = entryPoint.toArray();\n  exitPoint = exitPoint.toArray();\n\n  var annotation = {\n    typeUid: 'A2',\n    id: (0, _utils2.generateUUID)(),\n    cid: 2,\n    name: 'thickness',\n    value: thickness,\n    target: {\n      entryPoint: entryPoint,\n      exitPoint: exitPoint,\n      normal: undefined,\n      typeUid: undefined,\n      id: object.userData.entity.id // here we could toggle, instance vs type\n    }\n  };\n\n  return annotation;\n}\n\n/* generate distance annotation data from input*/\nfunction generateDistanceData(data) {\n  console.log('hey yo, add a distance', data);\n\n  var _data = _slicedToArray(data, 2);\n\n  var start = _data[0];\n  var end = _data[1];\n\n\n  var distance = (0, _utils.getDistanceFromStartEnd)(start.point, end.point);\n\n  var annotation = {\n    typeUid: 'A4',\n    id: (0, _utils2.generateUUID)(),\n    cid: 3, // categoryId\n    name: 'distance',\n    value: distance,\n    target: {\n      start: {\n        point: start.point.toArray(),\n        typeUid: undefined,\n        id: start.object.userData.entity.id\n      },\n      end: {\n        point: end.point.toArray(),\n        typeUid: undefined,\n        id: end.object.userData.entity.id\n      }\n    }\n  };\n  return annotation;\n}\n\n/* generate diameter annotation data from input*/\nfunction generateDiameterData(data) {\n  console.log('hey yo, add a diameter', data);\n\n  var _data2 = _slicedToArray(data, 3);\n\n  var start = _data2[0];\n  var mid = _data2[1];\n  var end = _data2[2];\n\n  var _computeCenterDiaNorm = (0, _utils.computeCenterDiaNormalFromThreePoints)(start.point, mid.point, end.point);\n\n  var center = _computeCenterDiaNorm.center;\n  var diameter = _computeCenterDiaNorm.diameter;\n  var normal = _computeCenterDiaNorm.normal;\n\n\n  var annotation = {\n    typeUid: 'A3',\n    id: (0, _utils2.generateUUID)(),\n    cid: 4, // categoryId\n    name: 'diameter',\n    value: diameter,\n    target: {\n      normal: normal.toArray(),\n      point: center.toArray(),\n      typeUid: undefined,\n      id: start.object.userData.entity.id\n    }\n  };\n\n  return annotation;\n}\n\n/* generate angle annotation data from input*/\nfunction generateAngleData(data) {\n  console.log('hey yo, add an angle', data);\n\n  var _data3 = _slicedToArray(data, 3);\n\n  var start = _data3[0];\n  var mid = _data3[1];\n  var end = _data3[2];\n\n  var angle = (0, _utils.computeAngleFromThreePoints)(start.point, mid.point, end.point);\n  angle = angle * 180 / Math.PI;\n\n  var annotation = {\n    typeUid: 'A5',\n    id: (0, _utils2.generateUUID)(),\n    cid: 5, // categoryId\n    name: 'angle',\n    value: angle,\n    target: {\n      start: {\n        point: start.point.toArray(),\n        typeUid: undefined,\n        id: start.object.userData.entity.id\n      },\n      mid: {\n        point: mid.point.toArray(),\n        typeUid: undefined,\n        id: mid.object.userData.entity.id\n      },\n      end: {\n        point: end.point.toArray(),\n        typeUid: undefined,\n        id: end.object.userData.entity.id\n      }\n    }\n  };\n\n  return annotation;\n}\n\n// /////////////\n// FIXME: where do these belong ? they are not really model side, so actions ?\n// also, they are indepdendant from other aspects, but they are \"sinks\"\n// also, perhaps each tool type shouls specify what cursor it wants ?\n/* toggleNote$\n  .map(function(val){\n    console.log(\"cursor\",val)\n    return val\n  })\n  .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleThicknessAnnot$\n  .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleDistanceAnnot$\n  .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleDiameterAnnot$\n  .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleAngleAnnot$\n  .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))*/\n// temporary hack for cursor\nfunction handleCursor(input) {\n  input.pluck('activeTool').subscribe(function (activeTool) {\n    /* switch(activeTool){\n      case :\n    }*/\n    if (activeTool !== undefined) {\n      (0, _otherUtils.toggleCursor)(true, 'crosshair');\n    }\n  });\n\n  // document.getElementById(\"mydiv\").style.cursor=\"move\"\n}\n\nfunction hasEntity(data) {\n  return data.object.userData.entity && data.object.userData.entity.id;\n}\n\n// /////////////\nfunction addAnnotation(actions, settings$) {\n  function dataOnly(entry) {\n    return entry.data;\n  }\n\n  var activeTool$ = settings$.pluck('activeTool');\n  var baseStream$ = actions.creationStep$.withLatestFrom(activeTool$, function (data, activeTool) {\n    return { data: data, activeTool: activeTool };\n  });\n\n  var noteAnnot$ = baseStream$.filter(function (data) {\n    return data.activeTool === 'addNote';\n  }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n  .map(generateNoteData);\n\n  var thickessAnnot$ = baseStream$.filter(function (data) {\n    return data.activeTool === 'measureThickness';\n  }).map(dataOnly).map(_utils.getEntryExitThickness).filter(hasEntity) // we need data to have entity infos\n  .map(generateThicknessData);\n\n  var distanceAnnot$ = baseStream$.filter(function (data) {\n    return data.activeTool === 'measureDistance';\n  }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n  .bufferWithCount(2) // we need 2 data points to generate a distance\n  .do(function (e) {\n    return console.log('measuring  distance', e);\n  }).map(generateDistanceData);\n\n  var diameterAnnot$ = baseStream$.filter(function (data) {\n    return data.activeTool === 'measureDiameter';\n  }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n  .bufferWithCount(3) // we need 3 data points to generate a diameter\n  .map(generateDiameterData);\n\n  var angleAnnot$ = baseStream$.filter(function (data) {\n    return data.activeTool === 'measureAngle';\n  }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n  .bufferWithCount(3) // we need 3 data points to generate an angle\n  .map(generateAngleData);\n\n  var additions$ = merge(noteAnnot$, thickessAnnot$, distanceAnnot$, diameterAnnot$, angleAnnot$).share();\n\n  return additions$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/annotations/annotations.js\n ** module id = 188\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/annotations/annotations.js?");
},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.default = types;\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _utils = __webpack_require__(3);\n\n// one typical entry\n/*\n{\n   "uuid": "xxxxx-xxxx-xxx-x",\n   "name": "some assembly",\n   "description": "test"\n }*/\n\n// actual api functions\n// TODO: if all we deal with is pseudo \'selection\' ie, active assembly, we\n// should move this to selections perhaps ?\n\nfunction setActiveAssembly(state, input) {\n  return (0, _modelUtils.mergeData)(state, { currentAssembly: input });\n}\n\nfunction types(actions, source) {\n  var defaults = { currentAssembly: (0, _utils.generateUUID)() };\n\n  var updateFns = { setActiveAssembly: setActiveAssembly };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/assemblies.js\n ** module id = 189\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/assemblies.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.makeBoundingSystem = makeBoundingSystem;\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\n// //BoundingBox//////\nfunction makeBoundingSystem(actions) {\n  var defaults = {};\n\n  var boundsDefaults = {\n    min: [0, 0, 0],\n    max: [0, 0, 0]\n  };\n\n  var updateFns = {\n    createComponents: _common.createComponents.bind(null, boundsDefaults),\n    duplicateComponents: _common.duplicateComponents,\n    removeComponents: _common.removeComponents\n  };\n\n  if (!actions) {\n    actions = (0, _common.makeActionsFromApiFns)(updateFns);\n  }\n\n  var bounds$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n\n  return {\n    bounds$: bounds$,\n    boundActions: actions\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/bounds.js\n ** module id = 190\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/bounds.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.makeMeshSystem = makeMeshSystem;\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// //Mesh//////\nfunction makeMeshSystem(actions) {\n  var defaults = {};\n\n  function createComponentsMesh(defaults, state, inputs) {\n    // console.log('createComponents for mesh', inputs)\n\n    return inputs.reduce(function (state, input) {\n      var inputValue = {};\n      if (input && input.value) {\n        inputValue = input.value;\n      }\n\n      var mesh = inputValue.mesh.clone(); // meh ?//FIXME : make sure there are no multiple clones\n      mesh.material = mesh.material.clone(); // {mesh: inputValue.mesh }// mergeData(defaults,inputValue)\n      var id = input.id;\n\n      mesh.userData.entity = { id: id };\n      mesh.pickable = true;\n\n      state = (0, _modelUtils.mergeData)({}, state);\n      state[id] = mesh;\n      // FIXME big hack, use immutability !!!\n\n      // console.log('done createComponents (mesh)', state)\n      return state;\n    }, state);\n  }\n\n  // TODO: should defaults be something like a stand in cube ?\n  var updateFns = {\n    createComponents: createComponentsMesh.bind(null, undefined),\n    duplicateComponents: _common.duplicateComponents,\n    removeComponents: _common.removeComponents\n  };\n\n  if (!actions) {\n    actions = (0, _common.makeActionsFromApiFns)(updateFns);\n  }\n\n  var meshes$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions, undefined, { doApplyTransform: false }); // last flag set to false because we\n  // do not want immutable data for meshes ?\n\n  return {\n    meshes$: meshes$,\n    meshActions: actions\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/mesh.js\n ** module id = 191\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/mesh.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.makeMetaSystem = makeMetaSystem;\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\n// //Entity Meta//////\nfunction makeMetaSystem(actions) {\n  var defaults = {};\n\n  // defaults for each component in this system\n  var componentDefaults = {\n    name: undefined,\n    id: undefined,\n    typeUid: undefined,\n    assemblyId: undefined,\n    color: '#07a9ff'\n  };\n\n  function updateComponents(state, inputs) {\n    console.log('update meta attributes', inputs); // , metaChanges, instIds)\n\n    return inputs.reduce(function (state, input) {\n      var id = input.id;\n\n      var newAttrs = input.value;\n      var orig = state[id];\n\n      state = (0, _modelUtils.mergeData)({}, state);\n      // FIXME big hack, use mutability\n      state[id] = (0, _modelUtils.mergeData)(orig, newAttrs);\n      return state;\n    }, state);\n  }\n\n  function clone(state, input) {\n    var id = input.id;\n\n    var newId = input.value;\n    var orig = state[id];\n\n    var cloneInst = (0, _modelUtils.mergeData)({}, orig);\n    cloneInst.id = newId;\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    // FIXME big hack, use mutability\n    state[newId] = cloneInst;\n\n    return state;\n  }\n\n  function clear(state, input) {\n    console.log('clearing meta');\n    return {};\n  }\n\n  var updateFns = {\n    updateComponents: updateComponents, // clone,\n    createComponents: _common.createComponents.bind(null, componentDefaults),\n    duplicateComponents: _common.duplicateComponents,\n    removeComponents: _common.removeComponents,\n    clear: clear\n  };\n\n  if (!actions) {\n    actions = (0, _common.makeActionsFromApiFns)(updateFns);\n  }\n\n  var meta$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n\n  return {\n    meta$: meta$,\n    metaActions: actions\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/meta.js\n ** module id = 192\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/meta.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.mirrorComponents = mirrorComponents;\nexports.resetScaling = resetScaling;\nexports.updateComponents = updateComponents;\nexports.makeTransformsSystem = makeTransformsSystem;\n\nvar _ramda = __webpack_require__(4);\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\n// //Transforms//////\n\nfunction applySnapping(transformValues, stepSize) {\n  var mapValue = arguments.length <= 2 || arguments[2] === undefined ? undefined : arguments[2];\n\n  // applies snapping for both rotation and scaling\n  // maps the rotationtransformValues from to degrees and back\n  var numberToRoundTo = 1 / stepSize;\n  for (var i = 0; i < transformValues.length; i++) {\n    var roundedNumber = transformValues[i];\n    roundedNumber = mapValue ? roundedNumber * (180 / Math.PI) : roundedNumber;\n    roundedNumber = Math.round(roundedNumber * numberToRoundTo) / numberToRoundTo;\n    if (mapValue) {\n      roundedNumber = roundedNumber * (Math.PI / 180);\n    }\n    transformValues[i] = roundedNumber;\n  }\n  return transformValues;\n}\n\nfunction applyUniformScaling(transformDefaults, transformValues) {\n  // sorts the values and sees which is different, because this is the changes\n  // then applies the new value to all dimension in respect to the minussign because this is added by mirroring\n  var sortedValues = JSON.parse(JSON.stringify(transformValues)); // deepcopy\n  sortedValues.forEach(function (part, i) {\n    if (sortedValues[i].isNaN) {\n      transformValues = sortedValues = transformDefaults.sca;\n    } // safety catch\n    sortedValues[i] = Math.abs(part);\n  });\n  sortedValues = sortedValues.slice().sort();\n  for (var i = 0; i < sortedValues.length; i++) {\n    if (sortedValues[i] === sortedValues[i + 1]) {\n      sortedValues.splice(i, 2);\n    }\n  }\n  var newValue = sortedValues[0];\n  for (var _i = 0; _i < transformValues.length; _i++) {\n    if (transformValues[_i] < 0) {\n      transformValues[_i] = -newValue;\n    } else {\n      transformValues[_i] = newValue;\n    }\n  }\n  return transformValues;\n}\n\nfunction applySnapAndUniformScaling(transformDefaults, transformationType, transformation, settings) {\n  var snapDefaults = {\n    pos: 0.1, // snap translation snaps to 0.1 units\n    rot: 10, // snap rotation snaps to tens of degrees\n    sca: 0.1 // snap scaling snaps to tens of percentages\n  };\n  //console.log('applySnapAndUniformScaling', transformation)\n  var uniformScaling = settings.uniformScaling;\n  var snapScaling = settings.snapScaling;\n  var snapRotation = settings.snapRotation;\n  var snapTranslation = settings.snapTranslation;\n\n\n  if (uniformScaling && transformationType === 'sca') {\n    transformation = applyUniformScaling(transformDefaults, transformation);\n  }\n  if (snapScaling && transformationType === 'sca') {\n    transformation = applySnapping(transformation, snapDefaults[transformationType]);\n  }\n  if (snapTranslation && transformationType === 'pos') {\n    transformation = applySnapping(transformation, snapDefaults[transformationType]);\n  }\n  if (snapRotation && transformationType === 'rot') {\n    transformation = applySnapping(transformation, snapDefaults[transformationType], 2 * Math.PI);\n  }\n  return transformation;\n}\n\nfunction mirrorComponents(transformDefaults, state, inputs) {\n  console.log('mirroring transforms', inputs);\n\n  return inputs.reduce(function (state, input) {\n    var id = input.id;\n\n\n    var sca = state[id].sca.map(function (d) {\n      return d;\n    }); // DO NOT REMOVE ! a lot of code relies on diffing, and if you mutate the original scale, it breaks !\n    sca[input.axis] *= -1;\n\n    var orig = state[id] || transformDefaults;\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    // FIXME big hack, use mutability\n    state[id] = (0, _modelUtils.mergeData)({}, orig, { sca: sca });\n\n    return state;\n  }, state);\n}\n\nfunction resetScaling(transformDefaults, state, inputs) {\n  return inputs.reduce(function (state, input) {\n    var id = input.id;\n\n\n    var sca = state[id].sca.map(function (d) {\n      return d;\n    }); // DO NOT REMOVE ! a lot of code relies on diffing, and if you mutate the original scale, it breaks !\n    sca = transformDefaults.sca;\n\n    var orig = state[id] || transformDefaults;\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    // FIXME big hack, use mutability\n    state[id] = (0, _modelUtils.mergeData)({}, orig, { sca: sca });\n\n    return state;\n  }, state);\n}\n\nfunction updateComponents(transformDefaults, state, inputs) {\n  var currentStateFlat = inputs.map(function (input) {\n    return state[input.id];\n  });\n\n  var transform = (0, _ramda.head)(inputs)['trans'];\n  var currentAvg = (0, _ramda.pluck)(transform)(currentStateFlat).reduce(function (acc, cur) {\n    if (!acc) return cur;\n    return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n      return x * 0.5;\n    });\n  }, undefined);\n\n  return inputs.reduce(function (state, input) {\n    state = (0, _modelUtils.mergeData)({}, state);\n    var id = input.id;\n\n\n    var diff = [input.value[0] - currentAvg[0], input.value[1] - currentAvg[1], input.value[2] - currentAvg[2]];\n\n    var transformation = diff.map(function (value, index) {\n      return state[id][input.trans][index] + value;\n    }) || transformDefaults;\n\n    var updateTransformation = applySnapAndUniformScaling(transformDefaults, input.trans, transformation, input.settings);\n    return (0, _ramda.assocPath)([id, input.trans], updateTransformation, state);\n  }, state);\n}\n\nfunction makeTransformsSystem(actions) {\n  var defaults = {};\n\n  var transformDefaults = {\n    pos: [0, 0, 0],\n    rot: [0, 0, 0],\n    sca: [1, 1, 1]\n  };\n\n  function updatePosition(state, input) {\n    console.log('updatePosition');\n    var id = input.id;\n    var pos = input.value || [0, 0, Math.random()];\n    var orig = state[id] || transformDefaults;\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    // FIXME big hack, use mutability\n    state[id] = (0, _modelUtils.mergeData)({}, orig, { pos: pos });\n    return state;\n  }\n\n  function updateRotation(state, input) {\n    console.log('updateRotation');\n    var id = input.id;\n\n    var rot = input.value || [0, 0, Math.random()];\n    var orig = state[id] || transformDefaults;\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    // FIXME big hack, use mutability\n    state[id] = (0, _modelUtils.mergeData)({}, orig, { rot: rot });\n    return state;\n  }\n\n  function updateScale(state, input) {\n    console.log('updateScale');\n    var id = input.id;\n\n    var sca = input.value || [1, 1, Math.random()];\n    var orig = state[id] || transformDefaults;\n\n    state = (0, _modelUtils.mergeData)({}, state);\n    // FIXME big hack, use mutability\n    state[id] = (0, _modelUtils.mergeData)({}, orig, { sca: sca });\n    return state;\n  }\n\n  var updateFns = {\n    updateRotation: updateRotation,\n    updatePosition: updatePosition,\n    updateScale: updateScale,\n    resetScaling: resetScaling.bind(null, transformDefaults),\n    mirrorComponents: mirrorComponents.bind(null, transformDefaults),\n    updateComponents: updateComponents.bind(null, transformDefaults),\n    createComponents: _common.createComponents.bind(null, transformDefaults),\n    duplicateComponents: _common.duplicateComponents,\n    removeComponents: _common.removeComponents\n  };\n\n  if (!actions) {\n    actions = (0, _common.makeActionsFromApiFns)(updateFns);\n  }\n\n  var transforms$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n\n  return {\n    transforms$: transforms$,\n    transformActions: actions\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/transforms.js\n ** module id = 193\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/transforms.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nexports.default = function (actions, entityTypes$, assembly$) {\n  /*\n  //addInstanceCandidates => -------------------------\n  //addType               => --T----------------------\n  */\n\n  var addInstancesCandidates$ = actions.entityActions.addInstanceCandidates$\n  // .filter(data=>data.meta.id === undefined)\n  .combineLatest(entityTypes$, function (candidateData, types) {\n    var meshName = (0, _formatters.nameCleanup)(candidateData.meta.name);\n    return (0, _ramda.find)((0, _ramda.propEq)('name', meshName))(types);\n  }).filter(_utils.exists).filter(function (candidate) {\n    return candidate.mesh !== undefined;\n  })\n  // .tap(e=>console.log(\"addInstancesCandidates\",e))\n  .map(_utils.toArray).take(1).repeat();\n\n  // create various components' baseis\n\n  var componentBase$ = addInstancesCandidates$.combineLatest(assembly$, function (newTypes, assemblyId) {\n    return { newTypes: newTypes, assemblyId: assemblyId };\n  }).map(function (_ref) {\n    var newTypes = _ref.newTypes;\n    var assemblyId = _ref.assemblyId;\n\n    return newTypes.map(function (typeData) {\n      var instUid = (0, _utils.generateUUID)();\n      var typeUid = typeData.id;\n      var instName = typeData.name + '_' + instUid;\n\n      var instanceData = {\n        id: instUid,\n        typeUid: typeUid,\n        name: instName,\n        assemblyId: assemblyId\n      };\n      return instanceData;\n    });\n  }).withLatestFrom(entityTypes$, function (instances, types) {\n    var data = instances.map(function (instance) {\n      var instUid = instance.id;\n      var typeUid = instance.typeUid;\n      var assemblyId = instance.assemblyId;\n\n      // is this a hack?\n      var entry = (0, _ramda.find)((0, _ramda.propEq)('id', typeUid))(types);\n      var mesh = entry.mesh;\n      var bbox = mesh.boundingBox;\n      var zOffset = bbox.max.clone().sub(bbox.min);\n      zOffset = zOffset.z / 2;\n      bbox = { min: bbox.min.toArray(), max: bbox.max.toArray() };\n\n      // injecting data like this is the right way ?\n      mesh.material = mesh.material.clone();\n      mesh = mesh.clone();\n\n      return {\n        instUid: instUid,\n        typeUid: typeUid,\n        assemblyId: assemblyId,\n        instance: instance,\n        mesh: mesh,\n        zOffset: zOffset,\n        bbox: bbox\n      };\n    });\n\n    return data;\n  }).shareReplay(1);\n\n  var createMeshComponents$ = actions.entityActions.createMeshComponents$.combineLatest(entityTypes$, function (meshComponents, types) {\n    return meshComponents.map(function (component) {\n      if (component.data) {\n        return component;\n      } else {\n        var typeUid = component.typeUid;\n\n        var entry = (0, _ramda.find)((0, _ramda.propEq)('id', typeUid))(types);\n        if (entry && entry.mesh) {\n          var mesh = entry.mesh;\n          // let bbox = mesh.boundingBox\n          // let zOffset = bbox.max.clone().sub(bbox.min)\n          // zOffset = zOffset.z/2\n          // bbox = { min:bbox.min.toArray(), max:bbox.max.toArray() }\n\n          // injecting data like this is the right way ?\n          mesh.material = mesh.material.clone();\n          mesh = mesh.clone();\n          return (0, _modelUtils.mergeData)({}, component, { value: { mesh: mesh } });\n        } else {\n          return component;\n        }\n      }\n    }).filter(function (data) {\n      return data.value !== undefined;\n    });\n  });\n\n  return {\n    componentBase$: componentBase$,\n    createMeshComponents$: createMeshComponents$,\n    assembly$: assembly$\n  };\n};\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _formatters = __webpack_require__(15);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar just = _rx2.default.Observable.just;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/entitiesExtra.js\n ** module id = 194\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/entitiesExtra.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromDOM = __webpack_require__(183);\n\nvar _fromDOM2 = _interopRequireDefault(_fromDOM);\n\nvar _fromEvents = __webpack_require__(184);\n\nvar _fromEvents2 = _interopRequireDefault(_fromEvents);\n\nvar _fromPostMessage = __webpack_require__(185);\n\nvar _fromPostMessage2 = _interopRequireDefault(_fromPostMessage);\n\nvar _fromYm = __webpack_require__(187);\n\nvar _fromYm2 = _interopRequireDefault(_fromYm);\n\nvar _fromResources = __webpack_require__(186);\n\nvar _fromResources2 = _interopRequireDefault(_fromResources);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n  console.log('here', sources);\n  var actionsSources = [(0, _fromDOM2.default)(sources.DOM), (0, _fromEvents2.default)(sources.events), (0, _fromPostMessage2.default)(sources.postMessage),\n\n  // special cases\n  (0, _fromResources2.default)(sources.resources.parsed$), (0, _fromYm2.default)({ ym: sources.ym, resources: sources.resources.parsed$ }) // special signature\n  ];\n\n  return (0, _obsUtils.mergeActionsByName)(actionsSources);\n  // returns the original actions, validate PLUS\n  // return validate(mergeActionsByName(actionsSources))\n}\n\n/* const entityActionNames = [\n  'reset'\n\n  ,'addTypes'\n  ,'addTypeCandidate'\n  ,'removeTypes'\n\n  ,'addInstanceCandidates'\n  ,'deleteInstances'\n  ,'duplicateInstances'\n\n  ,'updateComponent'\n  ,'createMetaComponents'\n  ,'createTransformComponents'\n  ,'createMeshComponents'\n]\n\nconst actionsSources = [\n  entityActionsFromDom, actionsFromPostMessage,\n  entityActionsFromResources, actionsFromEvents,\n  entityActionsFromYm, extras]\nconst entityActions  = mergeActionsByName(actionsSources, entityActionNames)*/\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/intents.js\n ** module id = 195\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = makeTypeInstanceMapping;\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction makeTypeInstanceMapping(instances$, types$) {\n  // register type=> instance & vice versa\n  // let base = {typeUidFromInstUid: {}, instUidFromTypeUid: {}}\n\n  instances$ = instances$.map(function (instances) {\n    var res = [];\n    Object.keys(instances).map(function (key) {\n      res.push(instances[key]);\n    });\n    return res;\n  });\n\n  return (0, _obsUtils.combineLatestObj)({ instances$: instances$, types$: types$ }).map(function (_ref) {\n    var instances = _ref.instances;\n    var types = _ref.types;\n\n    var instUidFromTypeUid = instances.reduce(function (prev, instance) {\n      if (!prev[instance.typeUid]) {\n        prev[instance.typeUid] = []; // instance.id\n      }\n\n      prev[instance.typeUid].push(instance.id);\n      return prev;\n    }, {});\n\n    var typeUidFromInstUid = instances.reduce(function (prev, instance) {\n      prev[instance.id] = instance.typeUid;\n      return prev;\n    }, {});\n\n    return { instUidFromTypeUid: instUidFromTypeUid, typeUidFromInstUid: typeUidFromInstUid };\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/typeInstanceMapping.js\n ** module id = 196\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/typeInstanceMapping.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.default = types;\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nvar _formatters = __webpack_require__(15);\n\nvar _computeBounds = __webpack_require__(48);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n// one typical entry\n/*\n{\n   "uuid": "a1",\n   "name": "FavoritePart",\n   "description": "test",\n   "binary_document_id": 38546,\n   "binary_document_url": "xxx/38546/UM2CableChain_BedEnd.STL",\n   "source_document_id": null,\n   "source_document_url": "",\n }*/\n\n// actual api functions\nfunction upsertTypes(state, input, index) {\n  var _input$meta = input.meta;\n  var id = _input$meta.id;\n  var name = _input$meta.name; // names are expected to be already \'cleaned up\' ie without extension\n\n  var mesh = input.data;\n\n  if (index === -1) {\n    // if we have a mesh that is not yet registered\n    if (mesh) {\n      (0, _computeBounds.computeBoundingSphere)(mesh);\n      (0, _computeBounds.computeBoundingBox)(mesh);\n    }\n    id = id || (0, _utils.generateUUID)();\n  } else {\n    id = state[index].id || (0, _utils.generateUUID)();\n  }\n  var entry = { id: id, name: name, mesh: mesh };\n\n  if (index === -1) {\n    state = state.concat((0, _utils.toArray)(entry));\n  } else {\n    var newEntry = (0, _modelUtils.mergeData)(state[index], entry);\n    state = [].concat(_toConsumableArray(state.slice(0, index)), [newEntry], _toConsumableArray(state.slice(index + 1)));\n  }\n  return state;\n}\n\nfunction addTypes(state, input) {\n  console.log(\'addTypes\', state, input);\n  // we have an id , we use that to search for pre-existing data\n  var index = (0, _ramda.findIndex)((0, _ramda.propEq)(\'id\', input.meta.id))(state);\n  return upsertTypes(state, input, index);\n}\n\n// create/infer a new type based on mesh + metadata\nfunction addTypeCandidate(state, input) {\n  console.log(\'addTypeCandidate\', state, input);\n  // we have a mesh name , we use that to search for pre-existing data\n  var index = (0, _ramda.findIndex)((0, _ramda.propEq)(\'name\', (0, _formatters.nameCleanup)(input.meta.name)))(state);\n  return upsertTypes(state, input, index);\n}\n\nfunction removeTypes(state, inputs) {\n  console.log(\'remove types\', state, inputs);\n  state = inputs.reduce(function (state, input) {\n    var index = (0, _ramda.findIndex)((0, _ramda.propEq)(\'id\', input.id))(state);\n    state = [].concat(_toConsumableArray(state.slice(0, index)), _toConsumableArray(state.slice(index + 1)));\n    return state;\n  }, state);\n  return state;\n}\n\nfunction clearTypes(state, input) {\n  // log.info("New design, clearing registry",regData)\n  return [];\n}\n\nfunction types(actions, source) {\n  var defaults = [];\n\n  var updateFns = { addTypes: addTypes, addTypeCandidate: addTypeCandidate, removeTypes: removeTypes, clearTypes: clearTypes };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions); // since we store THREE.js meshes, we cannot use actual immutable data\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/types.js\n ** module id = 197\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/types.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.remapEntityActions = remapEntityActions;\nexports.remapMetaActions = remapMetaActions;\nexports.remapMeshActions = remapMeshActions;\nexports.remapTransformActions = remapTransformActions;\nexports.remapBoundsActions = remapBoundsActions;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\n\n\n// function to add extra data to all entity component actions\nfunction remapEntityActions(entityActions, currentSelections$) {\n  var duplicateInstances$ = entityActions.duplicateInstances$.withLatestFrom(currentSelections$, function (_, selections) {\n    // console.log(\"selections to duplicate\",selections)\n    var newId = (0, _utils.generateUUID)();\n    return selections.map(function (s) {\n      return (0, _modelUtils.mergeData)(s, { newId: newId });\n    });\n  }).share();\n\n  var deleteInstances$ = entityActions.deleteInstances$.withLatestFrom(currentSelections$, function (deleteInfos, selections) {\n    // console.log(\"I am asked to delete instances\",deleteInfos,selections)\n    if (deleteInfos === undefined) {\n      // delete by id, based on selections\n      return selections;\n    } else {\n      // delete by typeUid, based on input data\n      return deleteInfos;\n    }\n  }).tap(function (e) {\n    return console.log('I am going to delete instances', e);\n  }).share();\n\n  var mirrorInstances$ = entityActions.mirrorInstances$.withLatestFrom(currentSelections$, function (mirrorInfos, selections) {\n    return selections.map(function (s) {\n      return (0, _modelUtils.mergeData)(s, mirrorInfos);\n    });\n  }).share();\n\n  return (0, _modelUtils.mergeData)(entityActions, {\n    duplicateInstances$: duplicateInstances$,\n    deleteInstances$: deleteInstances$,\n    mirrorInstances$: mirrorInstances$\n  });\n}\n\n// function to add extra data to meta component actions\nfunction remapMetaActions(entityActions, componentBase$, currentSelections$, annotationCreations$) {\n  var createComponentsFromBase$ = componentBase$.filter(function (c) {\n    return c.length > 0;\n  }).map(function (datas) {\n    return datas.map(function (_ref) {\n      var instUid = _ref.instUid;\n      var typeUid = _ref.typeUid;\n      var assemblyId = _ref.assemblyId;\n      var instance = _ref.instance;\n\n      return {\n        id: instUid,\n        value: { id: instUid, typeUid: typeUid, name: instance.name, assemblyId: assemblyId }\n      };\n    });\n  });\n\n  var createComponentsFromAnnots$ = annotationCreations$.filter(function (c) {\n    return c.length > 0;\n  }).map(function (datas) {\n    return datas.map(function (data) {\n      console.log('annotation data', data);\n      return { id: data.id, value: data };\n    });\n  });\n\n  var createComponents$ = merge(createComponentsFromBase$, createComponentsFromAnnots$, entityActions.createMetaComponents$ // not infered\n  ).share();\n  // .tap(e=>console.log(\"creating meta component\",e))\n\n  var updateComponents$ = entityActions.updateComponent$.filter(function (u) {\n    return u.target === 'meta';\n  }).pluck('data').withLatestFrom(currentSelections$.map(function (s) {\n    return s.map(function (s) {\n      return s.id;\n    });\n  }), function (metaChanges, instIds) {\n    return instIds.map(function (instId) {\n      return { id: instId, value: metaChanges };\n    });\n  });\n\n  return {\n    createComponents$: createComponents$,\n    updateComponents$: updateComponents$,\n    duplicateComponents$: entityActions.duplicateInstances$,\n    removeComponents$: entityActions.deleteInstances$,\n    clearDesign$: entityActions.clearDesign$\n  };\n}\n\n// function to add extra data to mesh component actions\nfunction remapMeshActions(entityActions, componentBase$) {\n  var createComponents$ = componentBase$.filter(function (c) {\n    return c.length > 0;\n  }).map(function (datas) {\n    return datas.map(function (_ref2) {\n      var instUid = _ref2.instUid;\n      var mesh = _ref2.mesh;\n\n      return { id: instUid, value: { mesh: mesh } };\n    });\n  }).merge(entityActions.createMeshComponents$); // not infered\n  // .tap(e=>console.log(\"creating mesh component\",e))\n\n  return {\n    createComponents$: createComponents$,\n    duplicateComponents$: entityActions.duplicateInstances$,\n    removeComponents$: entityActions.deleteInstances$,\n    clearDesign$: entityActions.clearDesign$\n  };\n}\n\n// function to add extra data to transform component actions\nfunction remapTransformActions(entityActions, componentBase$, settings$, currentSelections$) {\n  var createComponents$ = componentBase$.filter(function (c) {\n    return c.length > 0;\n  }).map(function (datas) {\n    return datas.map(function (_ref3) {\n      var instUid = _ref3.instUid;\n      var zOffset = _ref3.zOffset;\n\n      return { id: instUid, value: { pos: [0, 0, zOffset] } };\n    });\n  }).merge(entityActions.createTransformComponents$);\n  // .tap(e=>console.log(\"creating transforms component\",e))\n\n  var updateComponents$ = entityActions.updateComponent$.filter(function (u) {\n    return u.target === 'transforms';\n  }).pluck('data').map(_utils.toArray) // we always expect arrays of data\n  /*.withLatestFrom(settings$, function (transforms, settings) {\n    return transforms.map(function (transform, index) {\n      return {id: transform.id, value: transform || transforms[0], settings}\n    })\n  })*/\n  .withLatestFrom(settings$, function (transforms, settings) {\n    return transforms.map(function (transform, index) {\n      return (0, _modelUtils.mergeData)({}, transform, { settings: settings });\n      //return {id: transform.id, value: transform.value || transforms[0].value, settings}\n    });\n  });\n\n  return {\n    createComponents$: createComponents$,\n    updateComponents$: updateComponents$,\n    resetScaling$: entityActions.resetScaling$,\n    mirrorComponents$: entityActions.mirrorInstances$,\n    duplicateComponents$: entityActions.duplicateInstances$,\n    removeComponents$: entityActions.deleteInstances$,\n    clearDesign$: entityActions.clearDesign$\n  };\n}\n\n// function to add extra data to bounds component actions\nfunction remapBoundsActions(entityActions, componentBase$) {\n  var createComponents$ = componentBase$.filter(function (c) {\n    return c.length > 0;\n  }).map(function (datas) {\n    return datas.map(function (_ref4) {\n      var instUid = _ref4.instUid;\n      var bbox = _ref4.bbox;\n\n      return { id: instUid, value: bbox };\n    });\n  });\n\n  return {\n    createComponents$: createComponents$,\n    duplicateComponents$: entityActions.duplicateInstances$,\n    removeComponents$: entityActions.deleteInstances$,\n    clearDesign$: entityActions.clearDesign$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/utils.js\n ** module id = 198\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/utils.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _entityUtils = __webpack_require__(221);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intent(events, params) {\n  var selectEntities$ = events.select('gl').events('selectedMeshes$').map(extractEntities).map(_utils.toArray).shareReplay(1);\n\n  var selectBomEntries$ = events.select('bom').events('entryTapped$').map(_utils.toArray).shareReplay(1);\n\n  var focusOnEntities$ = events.select('bom').events('entryDoubleTapped$').map(_utils.toArray).shareReplay(1);\n\n  var setMultiSelectMode$ = events.select('gl').events('longTaps$').map(function (event) {\n    return event.detail.pickingInfos;\n  }).filter(function (pickingInfos) {\n    return pickingInfos.length > 0;\n  }).map(_ramda.head).filter(_utils.exists).pluck('object').filter(_entityUtils.hasEntity).map(_entityUtils.getEntity).map(function (e) {\n    return e.id;\n  }).merge(events.select('bom').events('entryLongTapped$').pluck('value').filter(_utils.exists).filter(function (x) {\n    return x.target && x.target.dataset && Object.keys(x.target.dataset).length > 0;\n  }).map(function (e) {\n    return { id: e.target.dataset.id, selected: (0, _utils.stringToBoolean)(e.target.dataset.selected) };\n  })) //.tap(e=>console.log('fsf',e)))\n\n  .map(function (e) {\n    return true;\n  }).shareReplay(1);\n  //.forEach(e=>console.log('setMultiSelectMode', e))\n\n  return reverseSelections({\n    selectEntities$: selectEntities$,\n    selectBomEntries$: selectBomEntries$,\n    focusOnEntities$: focusOnEntities$,\n    setMultiSelectMode$: setMultiSelectMode$\n  }, params);\n}\n\nfunction extractEntities(data) {\n  return data.filter(_entityUtils.hasEntity).map(_entityUtils.getEntity).map(function (e) {\n    return e.id;\n  });\n}\n\nfunction reverseSelections(intents, params) {\n  var idsMapper$ = params.idsMapper$;\n  var removeTypes$ = params.removeTypes$;\n  var removeInstances$ = params.removeInstances$;\n\n  // what we want is actually typeUid!\n  // select bom entries from entities\n\n  var selectBomEntries$ = intents.selectEntities$\n  // .do(e=>console.log(\"reversing instance selections to selectBomEntries\"))\n  .withLatestFrom(idsMapper$, function (entityIds, idsMapper) {\n    return {\n      ids: (0, _ramda.flatten)(entityIds.map(function (id) {\n        return idsMapper.typeUidFromInstUid[id];\n      })).filter(_utils.exists),\n      idsMapper: idsMapper\n    };\n  }).merge(intents.selectBomEntries$.map(function (x) {\n    return { ids: (0, _ramda.pluck)('id')(x) };\n  }));\n\n  // select entities from bom entries\n  var selectEntities$ = intents.selectBomEntries$\n  // .do(e=>console.log(\"reversing BOM selections to selectEntities\"))\n  .withLatestFrom(idsMapper$, function (bomIds, idsMapper) {\n    return {\n      //if the bom entrys are already selected we want to UNSELECT\n      ids: bomIds[0].selected ? [] : (0, _ramda.flatten)(bomIds.map(function (_ref) {\n        var id = _ref.id;\n        return idsMapper.instUidFromTypeUid[id];\n      })).filter(_utils.exists),\n      override: true,\n      idsMapper: idsMapper\n    };\n  })\n  // .do(e=>console.log(\"selectedEntities\",e))\n  //.merge(intents.selectEntities$.map(x => ({ ids: x })))\n  .merge(intents.selectEntities$.withLatestFrom(idsMapper$, function (ids, idsMapper) {\n    return {\n      ids: ids,\n      idsMapper: idsMapper\n    };\n  }));\n\n  ///////////\n  var selectBomEntries2$ = intents.selectBomEntries$.withLatestFrom(idsMapper$, function (ids, idsMapper) {\n    return {\n      ids: (0, _ramda.pluck)('id')(ids),\n      idsMapper: idsMapper,\n      type: 'types'\n    };\n  });\n\n  var selectEntities2$ = intents.selectEntities$.withLatestFrom(idsMapper$, function (ids, idsMapper) {\n    return {\n      ids: ids,\n      idsMapper: idsMapper,\n      type: 'instances'\n    };\n  });\n\n  var selectInstancesAndTypes$ = selectEntities2$.merge(selectBomEntries2$);\n\n  var focusOnEntities$ = intents.focusOnEntities$.withLatestFrom(idsMapper$, function (bomIds, idsMapper) {\n    return (0, _ramda.flatten)(bomIds.map(function (id) {\n      return idsMapper.instUidFromTypeUid[id];\n    })).filter(_utils.exists);\n  }).distinctUntilChanged(null, _ramda.equals);\n\n  return {\n    focusOnEntities$: focusOnEntities$,\n    selectInstancesAndTypes$: selectInstancesAndTypes$,\n    removeInstances$: removeInstances$.tap(function (e) {\n      return console.log('mlkmkll', e);\n    }),\n    removeTypes$: removeTypes$,\n    setMultiSelectMode$: intents.setMultiSelectMode$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/selections/actions/fromEvents.js\n ** module id = 199\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/selections/actions/fromEvents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromEvents = __webpack_require__(199);\n\nvar _fromEvents2 = _interopRequireDefault(_fromEvents);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources, params) {\n  var actionsSources = [(0, _fromEvents2.default)(sources.events, params)];\n\n  return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/selections/intents.js\n ** module id = 200\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/selections/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n/*rules:\n  - tap instance to select it, tap the same one to unselect it (basic multi select)\n  - tap bom entry/part to select it, tap the same one to unselect it (basic multi select)\n\n  - taping in 'empty space' unselects all\n\n  - even a single selected instance selects the whole part (bom entry) (can only unselect bom entry if there are no more selected instances)\n  - taping a bom entry selects all instances regardless of previous instance selections (override)\n\n*/\nfunction multiSelectionHelper(state, field, input) {\n  var ids = input.ids;\n  var override = input.override;\n\n  var newSelections = (0, _utils.toArray)(ids);\n  var existingSelections = state[field];\n\n  var nSelect = new Set(newSelections);\n  var oSelect = new Set(existingSelections);\n  var union = new Set([].concat(_toConsumableArray(nSelect), _toConsumableArray(oSelect)));\n  var intersection = new Set([].concat(_toConsumableArray(nSelect)).filter(function (x) {\n    return oSelect.has(x);\n  }));\n\n  // intersections are the ones we do NOT want\n  var newState = [];\n  if (newSelections.length !== 0) {\n    newState = override ? newSelections : (0, _ramda.without)([].concat(_toConsumableArray(intersection)), [].concat(_toConsumableArray(union)));\n  }\n  return newState;\n}\n\nfunction selectedInstancesFromTypes(state, input, instances) {\n  var selectedTypesByInstances = instances.reduce(function (acc, id) {\n    if (input.idsMapper) {\n      acc.push(input.idsMapper.typeUidFromInstUid[id]);\n    }\n    return acc;\n  }, []);\n  // selecting types based on instances\n  return multiSelectionHelper(state, 'bomIds', { ids: selectedTypesByInstances, override: true });\n}\n\nfunction selectedTypesFromInstances(state, input, types) {\n  var selectedInstancesByTypes = types.reduce(function (acc, id) {\n    if (input.idsMapper) {\n      acc.push(input.idsMapper.instUidFromTypeUid[id]);\n    }\n    return acc;\n  }, []);\n  // selecting instances based on types\n  return multiSelectionHelper(state, 'bomIds', { ids: (0, _ramda.flatten)(selectedInstancesByTypes), override: true });\n}\n\nfunction multiSelectionHelper2(state, input) {\n  var newInstancesBaseStates = void 0;\n  var newTypesBaseStates = void 0;\n  if (input.type === 'instances') {\n    newInstancesBaseStates = state.multiSelect ? multiSelectionHelper(state, 'instIds', input) : input.ids;\n    var selectedTypesByInstances = newInstancesBaseStates.reduce(function (acc, id) {\n      if (input.idsMapper) {\n        acc.push(input.idsMapper.typeUidFromInstUid[id]);\n      }\n      return acc;\n    }, []);\n\n    // selecting types based on instances\n    newTypesBaseStates = multiSelectionHelper(state, 'bomIds', { ids: selectedTypesByInstances, override: true });\n  }\n  if (input.type === 'types') {\n    newTypesBaseStates = state.multiSelect ? multiSelectionHelper(state, 'bomIds', input) : input.ids;\n    var selectedInstancesByTypes = newTypesBaseStates.reduce(function (acc, id) {\n      if (input.idsMapper) {\n        var foo = input.idsMapper.instUidFromTypeUid[id];\n        acc.push(foo);\n      }\n      return acc;\n    }, []);\n\n    // selecting instances based on types\n    newInstancesBaseStates = multiSelectionHelper(state, 'bomIds', { ids: (0, _ramda.flatten)(selectedInstancesByTypes), override: true });\n  }\n\n  var instIds = newInstancesBaseStates ? newInstancesBaseStates.filter(_utils.exists) : state.instIds;\n  var bomIds = newTypesBaseStates ? newTypesBaseStates.filter(_utils.exists) : state.bomIds;\n  var multiSelect = state.multiSelect && instIds.length > 0;\n\n  var newState = {\n    instIds: instIds,\n    bomIds: bomIds,\n    multiSelect: multiSelect\n  };\n\n  return newState;\n}\n\nfunction selectInstancesAndTypes(state, input) {\n  var newState = multiSelectionHelper2(state, input);\n  console.log('selected instances and types', newState);\n  return (0, _modelUtils.mergeData)(state, newState);\n}\n\n/*\nfunction selectEntities (state, input) {\n  console.info(\"selecting instances\",input)\n  const newState = multiSelectionHelper(state, 'instIds', input)\n  console.log('selected instances', newState)\n  return mergeData(state, {instIds: newState})\n}\n\nfunction selectBomEntries (state, input) {\n  console.info(\"selecting types\", input)\n  const newState = multiSelectionHelper(state, 'bomIds', input)\n  console.log('selected parts', newState)\n\n  return mergeData(state, {bomIds: newState})\n}*/\n\nfunction removeInstances(state, input) {\n  console.log('removeInstances from selections');\n  var instIds = (0, _ramda.without)((0, _ramda.pluck)('id')(input), state.instIds);\n  var bomIds = selectedTypesFromInstances(state, input, instIds);\n\n  return (0, _modelUtils.mergeData)(state, { bomIds: bomIds, instIds: instIds });\n}\n\nfunction removeTypes(state, input) {\n  console.log('removeTypes from selections');\n  var bomIds = (0, _ramda.without)((0, _ramda.pluck)('id')(input), state.bomIds);\n  var instIds = selectedInstancesFromTypes(state, input, bomIds);\n  return (0, _modelUtils.mergeData)(state, { bomIds: bomIds, instIds: instIds });\n}\n\nfunction setMultiSelectMode(state, input) {\n  console.log('setting multiSelect', input);\n  return (0, _modelUtils.mergeData)(state, { multiSelect: input });\n}\n\nfunction focusOnEntities(state, input) {\n  //console.info('focusing on entitites', input)\n  return (0, _modelUtils.mergeData)(state, { focusInstIds: (0, _utils.toArray)(input) });\n}\n\nfunction selections(actions, source) {\n  var defaults = {\n    instIds: [],\n    bomIds: [],\n    // for focusing (!== selection)\n    focusInstIds: [],\n    multiSelect: false\n  };\n\n  var updateFns = {\n    //selectEntities,\n    //selectBomEntries,\n    selectInstancesAndTypes: selectInstancesAndTypes,\n    removeInstances: removeInstances,\n    removeTypes: removeTypes,\n\n    setMultiSelectMode: setMultiSelectMode,\n\n    focusOnEntities: focusOnEntities\n  };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n}\n\nexports.default = selections;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/selections/selections.js\n ** module id = 201\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/selections/selections.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nvar _ramda = __webpack_require__(4);\n\nfunction intent(addressbar, params) {\n  var setAppMode$ = addressbar.get('appMode').map(function (d) {\n    return d.pop();\n  }); // what mode is the app in ? (\"editor\" or \"viewer\" only for now)\n\n  var setToolsets$ = addressbar.get('tools').map(function (d) {\n    return d.pop();\n  }).filter(function (data) {\n    return data.length > 0;\n  }).map(function (data) {\n    if (data.indexOf(',') > -1) {\n      return data.split(',').filter(function (d) {\n        return d.length > 0;\n      });\n    } else {\n      return data;\n    }\n  }).map(_utils.toArray);\n\n  var setAutoSave$ = addressbar.get('autoSave').map(function (data) {\n    return (0, _ramda.head)(data);\n  }).filter(_utils.exists).map(_utils.stringToBoolean);\n\n  var setAutoLoad$ = addressbar.get('autoLoad').map(function (data) {\n    return (0, _ramda.head)(data);\n  }).filter(_utils.exists).map(_utils.stringToBoolean);\n\n  return {\n    setAppMode$: setAppMode$,\n    setToolsets$: setToolsets$,\n    setAutoSave$: setAutoSave$,\n    setAutoLoad$: setAutoLoad$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/settings/actions/fromAddressbar.js\n ** module id = 202\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/settings/actions/fromAddressbar.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _keyboard = __webpack_require__(73);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction intent(DOM, params) {\n  // hack for firefox only as it does not correct get the \"checked\" value : note : this is not an issue in cycle.js\n  var is_firefox_or_chrome = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.toLowerCase().indexOf('chrome') > -1;\n  function checked(event) {\n    // if(is_firefox_or_chrome) return ! event.target.checked\n    return event.target.checked;\n  }\n\n  var toggleShowGrid$ = DOM.select('.settingsView .showGrid').events('change').map(checked);\n  var toggleShowAnnot$ = DOM.select('.settingsView .showAnnot').events('change').map(checked);\n  var toggleAutoRotate$ = DOM.select('.settingsView .autoRotate').events('change').map(checked);\n  var toggleFullScreen$ = DOM.select('.fullScreenToggler').events('click');\n\n  var toggleSnapScaling$ = DOM.select('.menuContent .snapScaling').events('change').map(checked);\n  var toggleUniformScaling$ = DOM.select('.menuContent .uniformScaling').events('change').map(checked);\n  var toggleSnapRotation$ = DOM.select('.menuContent .snapRotation').events('change').map(checked);\n  var toggleSnapTranslation$ = DOM.select('.menuContent .snapTranslation').events('change').map(checked);\n\n  // const toggleAutoSelectNewEntities$ = Rx.Observable.just(true) //TODO: make settable\n  // tools\n  // const toggleRepeatTool$            = Rx.Observable.just(false) // does a tool gets stopped after a single use or not\n\n  var keyUps$ = _rx2.default.Observable.fromEvent(document, 'keyup') // DOM.select(\":root\").events(\"keyup\")\n  .filter(_keyboard.isValidElementEvent); // stop for input, select, and textarea etc\n\n  var setActiveTool$ = merge(DOM.select('.toNameAndColorMode').events('click').map('nameAndColor'), DOM.select('.toTranslateMode').events('click').map('translate'), DOM.select('.toRotateMode').events('click').map('rotate'), DOM.select('.toScaleMode').events('click').map('scale'), DOM.select('.toMirrorMode').events('click').map('mirror'), DOM.select('.toMeasureMode').events('click').map('measure'),\n  // sub items of measureMode\n  DOM.select('.addNote').events('click').map('addNote'), DOM.select('.measureDistance').events('click').map('measureDistance'), DOM.select('.measureDiameter').events('click').map('measureDiameter'), DOM.select('.measureThickness').events('click').map('measureThickness'), DOM.select('.measureAngle').events('click').map('measureAngle'), keyUps$.map(function (e) {\n    return _keyboard.keycodes[e.keyCode];\n  }).filter(function (k) {\n    return k === 'm';\n  }).map('translate'), keyUps$.map(function (e) {\n    return _keyboard.keycodes[e.keyCode];\n  }).filter(function (k) {\n    return k === 't';\n  }).map('translate'), keyUps$.map(function (e) {\n    return _keyboard.keycodes[e.keyCode];\n  }).filter(function (k) {\n    return k === 'r';\n  }).map('rotate'), keyUps$.map(function (e) {\n    return _keyboard.keycodes[e.keyCode];\n  }).filter(function (k) {\n    return k === 's';\n  }).map('scale')).scan(function (acc, val) {\n    console.log('acc', acc, val);\n    if (acc === val && val !== undefined) {\n      acc = undefined;\n    } else {\n      acc = val;\n    }\n    return acc;\n  });\n\n  return {\n    setActiveTool$: setActiveTool$,\n    toggleAutoRotate$: toggleAutoRotate$,\n    toggleShowGrid$: toggleShowGrid$,\n    toggleShowAnnot$: toggleShowAnnot$,\n    toggleSnapScaling$: toggleSnapScaling$,\n    toggleUniformScaling$: toggleUniformScaling$,\n    toggleSnapRotation$: toggleSnapRotation$,\n    toggleSnapTranslation$: toggleSnapTranslation$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/settings/actions/fromDOM.js\n ** module id = 203\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/settings/actions/fromDOM.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\nfunction intent(localStorage, params) {\n  var setAllValues$ = localStorage.get('jam!-settings');\n\n  return {\n    setAllValues$: setAllValues$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/settings/actions/fromLocalStorage.js\n ** module id = 204\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/settings/actions/fromLocalStorage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nfunction intent(postMessage, params) {\n  var postMessage$ = postMessage.filter(_utils.exists).filter(function (p) {\n    return p.hasOwnProperty('data');\n  });\n\n  var setAutoSave$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('setAutoSave');\n  }).map(function (data) {\n    return data.data.setAutoSave;\n  }).filter(_utils.exists).map(_utils.stringToBoolean);\n\n  var setAutoLoad$ = postMessage$.filter(function (p) {\n    return p.data.hasOwnProperty('setAutoLoad');\n  }).map(function (data) {\n    return data.data.setAutoLoad;\n  }).filter(_utils.exists).map(_utils.stringToBoolean);\n\n  return {\n    setAutoSave$: setAutoSave$,\n    setAutoLoad$: setAutoLoad$\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/settings/actions/fromPostMessage.js\n ** module id = 205\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/settings/actions/fromPostMessage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromDOM = __webpack_require__(203);\n\nvar _fromDOM2 = _interopRequireDefault(_fromDOM);\n\nvar _fromAddressbar = __webpack_require__(202);\n\nvar _fromAddressbar2 = _interopRequireDefault(_fromAddressbar);\n\nvar _fromLocalStorage = __webpack_require__(204);\n\nvar _fromLocalStorage2 = _interopRequireDefault(_fromLocalStorage);\n\nvar _fromPostMessage = __webpack_require__(205);\n\nvar _fromPostMessage2 = _interopRequireDefault(_fromPostMessage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n  var actionsSources = [(0, _fromDOM2.default)(sources.DOM), (0, _fromAddressbar2.default)(sources.addressbar), (0, _fromLocalStorage2.default)(sources.localStorage), (0, _fromPostMessage2.default)(sources.postMessage)];\n  return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/settings/intents.js\n ** module id = 206\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/settings/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _ramda = __webpack_require__(4);\n\n/* shortcuts:[\n  {keys:'⌘+z,ctrl+z', \"command\":'undo'},\n  {keys:'⌘+shift+z,ctrl+shift+z', \"command\":'redo'},\n\n  {keys:'⌘+r,ctrl+d', \"command\":'duplicateEntities'},\n  {keys:'delete,backspace'    , \"command\":'removeEntities'},\n  {keys:'m'         , \"command\":'toTranslateMode'},\n  {keys:'r'         , \"command\":'toRotateMode'},\n  {keys:'s'         , \"command\":'toScaleMode'}\n],*/\n\n// use mainly when reloading settings from localstorage\nfunction setAllValues(state, input) {\n  // console.log(\"setting settings\")\n  // TODO : do validation ?\n  // FIXME: race condition !!! we are not sure this is the first !\n  // we coerce appMode to \"editor\" when setting all values like this\n  // same with autoSave && autoLoad\n  input = (0, _ramda.omit)(['autoSave', 'autoLoad', 'toolSets'], input); // we do not want to reload any of these\n\n  var output = (0, _modelUtils.mergeData)(state, (0, _modelUtils.mergeData)(input, {\n    appMode: 'editor',\n    activeTool: undefined\n  }));\n\n  return output;\n}\n\nfunction toggleShowGrid(state, input) {\n  console.log('toggleShowGrid', input);\n  var output = (0, _modelUtils.mergeData)(state, { grid: { show: input } });\n  return output;\n}\n\nfunction toggleShowAnnot(state, input) {\n  console.log('toggleShowAnnot', input);\n  var output = (0, _modelUtils.mergeData)(state, { annotations: { show: input } });\n  return output;\n}\n\nfunction toggleAutoRotate(state, input) {\n  console.log('toggleAutoRotate', input);\n  var output = (0, _modelUtils.mergeData)(state, { camera: { autoRotate: input } });\n  return output;\n}\n\nfunction toggleSnapScaling(state, input) {\n  console.log('toggleSnapScaling', input);\n  var output = (0, _modelUtils.mergeData)(state, { snapScaling: input });\n  return output;\n}\n\nfunction toggleUniformScaling(state, input) {\n  console.log('toggleUniformScaling', input);\n  var output = (0, _modelUtils.mergeData)(state, { uniformScaling: input });\n  return output;\n}\n\nfunction toggleSnapRotation(state, input) {\n  console.log('toggleSnapRotation', input);\n  var output = (0, _modelUtils.mergeData)(state, { snapRotation: input });\n  return output;\n}\n\nfunction toggleSnapTranslation(state, input) {\n  console.log('toggleSnapTranslation', input);\n  return (0, _modelUtils.mergeData)(state, { snapTranslation: input });\n}\n\nfunction setActiveTool(state, input) {\n  console.log('setting activeTool', input);\n  var output = (0, _modelUtils.mergeData)(state, { activeTool: input });\n  return output;\n}\n\nfunction setAppMode(state, input) {\n  var toolSets = void 0;\n  if (input === 'viewer') {\n    toolSets = ['view'];\n  } else if (input === 'editor') {\n    toolSets = ['view', 'edit'];\n  }\n  var output = (0, _modelUtils.mergeData)(state, { toolSets: toolSets });\n  return output;\n}\n\nfunction setToolsets(state, input) {\n  var output = (0, _modelUtils.mergeData)(state, { toolSets: input });\n  // console.log(\"setting app mode\",output)\n  return output;\n}\n\nfunction setAutoSave(state, input) {\n  var output = (0, _modelUtils.mergeData)(state, { autoSave: input });\n  console.log('setting autoSave mode', output);\n  return output;\n}\n\nfunction setAutoLoad(state, input) {\n  var output = (0, _modelUtils.mergeData)(state, { autoLoad: input });\n  console.log('setting autoLoad mode', output);\n  return output;\n}\n\nfunction settings(actions, source) {\n  // source = source || Rx.Observable.never()\n  // source = source.map(src => mergeData( src, {appMode:\"editor\"}) )//default appMode to editor, disregard saved settings\n\n  // /defaults, what else ?\n  var defaults = {\n    webglEnabled: true,\n    appMode: 'editor',\n\n    autoSelectNewEntities: true,\n    activeTool: undefined,\n    repeatTool: false,\n\n    toolSets: ['view', 'edit', 'annotate'], // what categories of tools do we want on screen\n\n    selections: undefined, // FIXME : not entirely sure this should even be here\n\n    // these are \"domain specific\", there should be a way for sub systems\n    // to \"hook up\" to the main data storage\n    viewMode: 'default',\n\n    camera: {\n      autoRotate: false\n    },\n    grid: {\n      show: true\n    },\n    annotations: {\n      show: true\n    },\n\n    // persistence\n    autoSave: false,\n    autoLoad: true,\n\n    //transforms\n    snapScaling: true,\n    uniformScaling: true,\n    snapRotation: true,\n    snapTranslation: true\n  };\n\n  var updateFns = { setAllValues: setAllValues, toggleShowGrid: toggleShowGrid, toggleAutoRotate: toggleAutoRotate,\n    toggleSnapScaling: toggleSnapScaling, toggleUniformScaling: toggleUniformScaling, toggleSnapRotation: toggleSnapRotation, toggleSnapTranslation: toggleSnapTranslation,\n    setActiveTool: setActiveTool, setAppMode: setAppMode, setToolsets: setToolsets, setAutoSave: setAutoSave, setAutoLoad: setAutoLoad };\n  return (0, _modelUtils.makeModel)(defaults, updateFns, actions, source);\n}\n\nexports.default = settings;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/settings/settings.js\n ** module id = 207\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/settings/settings.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = addressbarDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _addressbar = __webpack_require__(302);\n\nvar _addressbar2 = _interopRequireDefault(_addressbar);\n\nvar _urlUtils = __webpack_require__(226);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromEvent = _rx2.default.Observable.fromEvent;\n\n\n/* addressbar.addEventListener('change', function (event) {\n  event.preventDefault()\n  event.target.value // The value of the addressbar\n})\naddressbar.value = \"http://localhost:3001/index.html?foo=42\"\n\n*/\n\nfunction addressbarDriver(outgoing$) {\n  var address$ = fromEvent(_addressbar2.default, 'change').map(function (e) {\n    return e.target.value;\n  }).startWith(_addressbar2.default.value);\n\n  function get(paramName) {\n    return address$.map(function (url) {\n      return (0, _urlUtils.fetchUriParams)(url, paramName);\n    }).filter(_utils.exists).filter(function (a) {\n      return a.length > 0;\n    });\n  }\n\n  return {\n    address$: address$,\n    get: get\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/addressbarDriver.js\n ** module id = 208\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/addressbarDriver.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = appMetaDataDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction appMetaDataDriver() {\n  var pjson = __webpack_require__(273);\n  var appMetadata$ = _rx2.default.Observable.of({\n    version: pjson.version\n  });\n  return appMetadata$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/appMetaDataDriver.js\n ** module id = 209\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/appMetaDataDriver.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = browserCapsDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _Detector = __webpack_require__(67);\n\nvar _Detector2 = _interopRequireDefault(_Detector);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar of = _rx2.default.Observable.of;\n\n\n// source driver\nfunction browserCapsDriver() {\n  return (0, _obsUtils.combineLatestObj)({\n    webglEnabled: of(_Detector2.default.webgl)\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/browserCapabilities.js\n ** module id = 210\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/browserCapabilities.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = clipBoardDriver;\nfunction saveToClipBoard(_ref) {\n  var data = _ref.data;\n\n  function selectElementText(element) {\n    if (document.selection) {\n      var range = document.body.createTextRange();\n      range.moveToElementText(element);\n      range.select();\n    } else if (window.getSelection) {\n      var _range = document.createRange();\n      _range.selectNode(element);\n      window.getSelection().removeAllRanges();\n      window.getSelection().addRange(_range);\n    }\n  }\n\n  var element = document.createElement('DIV');\n  element.textContent = data;\n  document.body.appendChild(element);\n  selectElementText(element);\n  document.execCommand('copy');\n  element.remove();\n}\n\n/* driver used to output data to clipBoard  (browser only)*/\nfunction clipBoardDriver(outgoing$) {\n  if (outgoing$) {\n    outgoing$.forEach(saveToClipBoard);\n  }\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/clipBoardDriver.js\n ** module id = 211\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/clipBoardDriver.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.default = makeDesktopDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// let log = logger("desktop-store")\n// log.setLevel("warn")\n\nfunction makeDesktopDriver() {\n  return function desktopDriver(request$) {\n    function read(data) {\n      var obs = new _rx2.default.Subject();\n      var reader = new FileReader();\n      // log.debug("reading from " + data)\n\n      function onLoad(e) {\n        [e].filter(function (e) {\n          return e !== null;\n        }).map(function (e) {\n          return e.target.result;\n        }).forEach(function (e) {\n          return obs.onNext({ response: e });\n        });\n      }\n\n      function onProgress(e) {\n        [e].filter(function (e) {\n          return e.lengthComputable;\n        }).forEach(function (e) {\n          // log.debug("fetching percent", percentComplete)\n          obs.onNext({ progress: e.loaded / e.total, total: e.total });\n        });\n      }\n\n      function onError(error) {\n        // log.error("error", error)\n        obs.onError(error);\n      }\n\n      reader.onload = onLoad;\n      // reader.onloadend = onLoad\n      reader.onprogress = onProgress;\n      reader.onerror = onError;\n      reader.readAsBinaryString(data);\n      return obs;\n    }\n\n    function createResponse$(options) {\n      if (options.method === \'get\') {\n        return read(options.data);\n      }\n    }\n\n    var response$$ = request$.map(function (reqOptions) {\n      var response$ = createResponse$(reqOptions);\n      response$.request = reqOptions;\n      return response$;\n    }).replay(null, 1);\n    response$$.connect();\n\n    return response$$;\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/desktopStoreDriver.js\n ** module id = 212\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/desktopStoreDriver.js?');
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = eventDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// test hack/helper driver\nfunction eventDriver(outgoing$) {\n  outgoing$ = outgoing$ || _rx2.default.Observable.just({});\n\n  function deep_value(path, obj) {\n    try {\n      for (var i = 0, path = path.split('.'), len = path.length; i < len; i++) {\n        obj = obj[path[i]];\n      }\n      return obj;\n    } catch (error) {}\n  }\n\n  function makeEventsSelector(source$) {\n    return function events(eventName) {\n      return source$.flatMapLatest(function (source) {\n        if (!source) {\n          return _rx2.default.Observable.empty();\n        }\n        return source[eventName];\n      }).share();\n    };\n  }\n\n  function makeSourceSelector(path) {\n    var source$ = outgoing$.map(deep_value.bind(null, path)).filter(function (e) {\n      return e !== undefined;\n    });\n    // .shareReplay(1)\n    var events = makeEventsSelector(source$);\n    return {\n      events: events\n    };\n  }\n\n  return {\n    select: makeSourceSelector\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/eventDriver.js\n ** module id = 213\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/eventDriver.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = fileStorageDriver;\nfunction saveToFile(_ref) {\n  var name = _ref.name;\n  var type = _ref.type;\n  var data = _ref.data;\n\n  var text = data;\n  var a = document.createElement('a');\n  var file = new Blob([text], { type: type });\n  a.href = URL.createObjectURL(file);\n  a.download = name;\n  a.click();\n}\n\n/* driver used to output a file that gets saved on the user's hdd (browser only)*/\nfunction fileStorageDriver(outgoing$) {\n  if (outgoing$) {\n    outgoing$.forEach(saveToFile);\n  }\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/fileStorageDriver.js\n ** module id = 214\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/fileStorageDriver.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = localStorageDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar just = Observable.just;\n\nfunction localStorageDriver(outgoing$) {\n  function getItem(item) {\n    return just(localStorage.getItem(item)).map(_utils.safeJSONParse);\n  }\n\n  function setItem(key, value) {\n    return localStorage.setItem(key, value);\n  }\n\n  function remove(item) {\n    localStorage.removeItem(item);\n  }\n\n  function formatOutput(output) {\n    (0, _utils.toArray)(output).map(function (item) {\n      Object.keys(item).map(function (key) {\n        setItem(key, item[key]);\n        // console.log(item,key)\n      });\n    });\n  }\n\n  if (outgoing$) {\n    // outgoing$.subscribe(setItem)\n    outgoing$.distinctUntilChanged().subscribe(formatOutput);\n  }\n\n  return {\n    get: getItem,\n    set: setItem,\n    remove: remove\n  };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/localStorageDriver.js\n ** module id = 215\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/localStorageDriver.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = postMessageDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar fromEvent = Observable.fromEvent;\n// faster object.assign\n\nfunction sendMessage(data) {\n  var target = data.target;\n  var message = data.message;\n  var targetOrigin = data.targetOrigin;\n  var requestName = data.requestName;\n\n  message = (0, _assign2.default)({}, { data: message }, { source: 'jam', request: requestName }); // add source & request field for external use\n  target.postMessage(message, targetOrigin); // [transfer])\n}\n\n/* function isOriginValid (origins, event) {\n  return origins.indexOf(event.origin) > -1\n}*/\n\nfunction postMessageDriver(outgoing$) {\n  if (outgoing$) {\n    outgoing$.subscribe(sendMessage);\n  }\n\n  var incoming$ = fromEvent(window, 'message').map(function (e) {\n    return { data: e.data, origin: e.origin, source: e.source };\n  })\n  // .distinctUntilChanged()\n  .share();\n  // .do(e=>console.log(\"postMessage\",e))//why does this fire multiple time ?\n\n  return incoming$; // .filter( isOriginValid.bind(null,validOrigins) )\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/drivers/postMessageDriver.js\n ** module id = 216\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/drivers/postMessageDriver.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.observableDomDragAndDrop = observableDomDragAndDrop;\nexports.observableDragAndDrop_old = observableDragAndDrop_old;\nexports.observableDragAndDrop = observableDragAndDrop;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar fromEvent = Observable.fromEvent;\n\n// drag & drop behaviour from dom element\nfunction observableDomDragAndDrop(targetEl) {\n  var dragOvers$ = fromEvent(targetEl, 'dragover');\n  var drops$ = fromEvent(targetEl, 'drop');\n\n  drops$.subscribe(_obsUtils.preventDefault);\n  dragOvers$.subscribe(_obsUtils.preventDefault);\n\n  drops$.share();\n\n  var urls$ = drops$.map(function (event) {\n    return event.dataTransfer.getData('url');\n  }).filter(_obsUtils.isTextNotEmpty).map(function (data) {\n    return (0, _obsUtils.formatData)([data], 'url');\n  });\n\n  var texts$ = drops$.map(function (event) {\n    return event.dataTransfer.getData('Text');\n  }).filter(_obsUtils.isTextNotEmpty).map(function (data) {\n    return (0, _obsUtils.formatData)([data], 'text');\n  });\n\n  var files$ = drops$.map(function (event) {\n    return event.dataTransfer.files;\n  }).filter(_obsUtils.exists).map(function (data) {\n    return [].slice.call(data);\n  }).map(function (data) {\n    return (0, _obsUtils.formatData)(data, 'file');\n  });\n\n  return Observable.merge(urls$, texts$, files$);\n}\n\n// drag & drop behaviour\nfunction observableDragAndDrop_old(targetEl, root) {\n  function fromCEvent(targetEl, eventName) {\n    return root.get(targetEl, eventName);\n  }\n\n  var dragOvers$ = fromCEvent(targetEl, 'dragover');\n  var drops$ = fromCEvent(targetEl, 'drop');\n\n  drops$.subscribe(_obsUtils.preventDefault);\n  dragOvers$.subscribe(_obsUtils.preventDefault);\n\n  drops$.share();\n\n  var urls$ = drops$.map(function (event) {\n    return event.dataTransfer.getData('url');\n  }).filter(_obsUtils.isTextNotEmpty).map(function (data) {\n    return (0, _obsUtils.formatData)([data], 'url');\n  });\n\n  var texts$ = drops$.map(function (event) {\n    return event.dataTransfer.getData('Text');\n  }).filter(_obsUtils.isTextNotEmpty).map(function (data) {\n    return (0, _obsUtils.formatData)([data], 'text');\n  });\n\n  var files$ = drops$.map(function (event) {\n    return event.dataTransfer.files;\n  }).filter(_obsUtils.exists).map(function (data) {\n    return [].slice.call(data);\n  }).map(function (data) {\n    return (0, _obsUtils.formatData)(data, 'file');\n  });\n\n  return Observable.merge(urls$, texts$, files$);\n}\n\nfunction observableDragAndDrop(dragOvers$, drops$) {\n  /* let dragOvers$  = fromCEvent(targetEl, 'dragover')\n  let drops$      = fromCEvent(targetEl, 'drop')*/\n\n  drops$.subscribe(_obsUtils.preventDefault);\n  dragOvers$.subscribe(_obsUtils.preventDefault);\n\n  drops$.share();\n\n  var urls$ = drops$.map(function (event) {\n    return event.dataTransfer.getData('url');\n  }).filter(_obsUtils.isTextNotEmpty).map(function (data) {\n    return (0, _obsUtils.formatData)([data], 'url');\n  });\n\n  var texts$ = drops$.map(function (event) {\n    return event.dataTransfer.getData('Text');\n  }).filter(_obsUtils.isTextNotEmpty).map(function (data) {\n    return (0, _obsUtils.formatData)([data], 'text');\n  });\n\n  var files$ = drops$.map(function (event) {\n    return event.dataTransfer.files;\n  }).filter(_obsUtils.exists).map(function (data) {\n    return [].slice.call(data);\n  }).map(function (data) {\n    return (0, _obsUtils.formatData)(data, 'file');\n  });\n\n  return Observable.merge(urls$, texts$, files$);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/dragAndDrop.js\n ** module id = 217\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/dragAndDrop.js?")},function(module,exports){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.normalizeWheel = normalizeWheel;\nfunction normalizeWheel(event) {\n  var delta = { x: 0, y: 0 };\n  if (event.wheelDelta) {\n    // WebKit / Opera / Explorer 9\n    delta = event.wheelDelta;\n  } else if (event.detail) {\n    // Firefox older\n    delta = -event.detail;\n  } else if (event.deltaY) {\n    // Firefox\n    delta = -event.deltaY;\n  }\n\n  return delta;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/utils.js\n ** module id = 218\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/utils.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.resources = resources;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _ramda = __webpack_require__(4);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _parseUtils = __webpack_require__(225);\n\nvar _gcodeUtils = __webpack_require__(222);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar merge = _rx2.default.Observable.merge;\nvar of = _rx2.default.Observable.of;\nvar scase = _rx2.default.Observable.case; // faster object.assign\n\n//FIXME : hack !\n//import gcodeParser from './gcodeUtils'\n\n\nfunction getParser(extension) {\n  return lazyLoad(extension);\n}\n\nfunction lazyLoad(moduleNamePath) {\n  var obs = new _rx2.default.ReplaySubject(1);\n  // let waitForChunk = require('dynamic?' + moduleNamePath)\n\n  // require(\"bundle?lazy!usco-ctm-parser\")(function(module) {\n  // const requireStr = `bundle?lazy!./node_modules/${moduleNamePath}`\n  // const requireStr = `bundle?lazy!./`\n  // let req = require.context(\"./node-modules\", true, /^\\.\\/.*\\.jade$/)\n  // const requireStr = `bundle?lazy!./node_modules/${moduleNamePath}/lib/ctm-parser.js`\n\n  // var req = require.context('../../node_modules', true, /^\\.\\/.*\\.js$/)\n\n  /* require.ensure(['usco-ctm-parser'], function(require) {\n    //require('usco-ctm-parser')\n    let module = require(moduleNamePath)\n    console.log(\"dynamic load of module\",module)\n    //obs.onNext(module)\n  })*/\n  /* require(requireStr)(function(module) {\n    // now you can use the b-module\n    console.log(\"dynamic load of module\",module)\n    obs.onNext(module)\n  })*/\n  // System.import('usco-ctm-parser').then(module=>console.log(\"module\",module))\n\n  // FIXME: awfull, horrible horrrible horrible\n  // NOTE : chunk names can be specified like this : &name=stl-parser\n  switch (moduleNamePath) {\n    case 'stl':\n      __webpack_require__(232)(function (module) {\n        return obs.onNext(module);\n      });\n      break;\n    case 'ctm':\n      __webpack_require__(229)(function (module) {\n        return obs.onNext(module);\n      });\n      break;\n    case 'obj':\n      __webpack_require__(231)(function (module) {\n        return obs.onNext(module);\n      });\n      break;\n    case '3mf':\n      __webpack_require__(228)(function (module) {\n        return obs.onNext(module);\n      });\n      break;\n    case 'gcode':\n      __webpack_require__(230)(function (module) {\n        return obs.onNext(module);\n      });\n      //obs.onNext({default:gcodeParser})\n      break;\n    default:\n      obs.onError('No parser for \"' + moduleNamePath + '\" format');\n  }\n  return obs;\n}\n\n// this functions extracts data recieved from sources, adds error handling etc\nfunction fetch(sources) {\n  var sourceNames = arguments.length <= 1 || arguments[1] === undefined ? ['http', 'desktop'] : arguments[1];\n\n  var chosenSources = sourceNames.map(function (name) {\n    return sources[name];\n  });\n\n  var fetched$ = merge.apply(undefined, _toConsumableArray(chosenSources)).filter(function (res$) {\n    return res$.request.type === 'resource';\n  }) // only responses we deal with are resources\n  .flatMap(function (data) {\n    var responseWrapper$ = data.catch(function (e) {\n      console.log('caught error in fetching data', e);\n      return _rx2.default.Observable.empty();\n    });\n    var request$ = of(data.request);\n    var response$ = responseWrapper$.pluck('response');\n    var progress$ = responseWrapper$.pluck('progress');\n\n    return (0, _obsUtils.combineLatestObj)({ response$: response$, request$: request$, progress$: progress$ });\n  }).share();\n  return fetched$;\n}\n\n// parse the data extracted from a fetched data observable\nfunction parse(fetched$) {\n  var parseBase$ = fetched$.filter(function (data) {\n    return data.response !== undefined && data.progress === undefined;\n  })\n  // .distinctUntilChanged(d=>d.request.uri,equals)\n  .shareReplay(1);\n\n  var parsed$ = parseBase$.flatMap(function (data) {\n    var _data$request = data.request;\n    var uri = _data$request.uri;\n    var id = _data$request.id;\n    var flags = _data$request.flags; // extract uri & id if any\n\n    var _getNameAndExtension = (0, _utils.getNameAndExtension)(uri);\n\n    var name = _getNameAndExtension.name;\n    var ext = _getNameAndExtension.ext;\n\n    // pack up the data, the parser etc nicely\n\n    var data$ = of({ uri: uri, id: id, rawData: data.response, ext: ext, name: name, flags: flags });\n    var parser$ = getParser(ext).pluck('default'); // FIXME: for now workaround for es6 modules & babel\n    return (0, _obsUtils.combineLatestObj)({ data$: data$, parser$: parser$ });\n  })\n  // actual parsing part\n  .flatMap(function (_ref) {\n    var data = _ref.data;\n    var parser = _ref.parser;\n    var rawData = data.rawData;\n    var uri = data.uri;\n    var ext = data.ext;\n    var name = data.name;\n    var id = data.id;\n    var flags = data.flags;\n\n    var parseOptions = { useWorker: true };\n\n    var parsedObs$ = parser(rawData, parseOptions).doOnError(function (e) {\n      return console.log('error in parse', e);\n    });\n\n    var parsedData$ = parsedObs$.filter(function (e) {\n      return e.progress === undefined;\n    }); // seperate out progress data\n\n    // FIXME : hack !\n    if (ext !== 'gcode') {\n      parsedData$ = parsedData$.map(_parseUtils.postProcessParsedData);\n    } else {\n      console.log('here, gcode');\n      parsedData$ = parsedData$.map(function (d) {\n        return d[0];\n      }).map(_gcodeUtils.convert).map(function (data) {\n        console.log('ad', data);\n        return data;\n      });\n\n      /*.map(postProcessParsedData)\n      .map(e=>e.typesMeshes[0].mesh)\n      .map(function(data){\n         return [data]\n        obs.onNext([group])\n        obs.onNext({progress: 1, total: 1})\n      })*/\n    }\n    // .tap(e=>console.log(\"parsedData\",e))\n\n    var progress$ = parsedObs$.filter(function (e) {\n      return e.progress !== undefined;\n    }) // keep ONLY progress data\n    .pluck('progress').distinctUntilChanged().startWith(0);\n\n    var meta$ = of({ uri: uri, ext: ext, name: name, id: id, flags: flags });\n\n    return (0, _obsUtils.combineLatestObj)({ meta$: meta$, data: parsedData$, progress$: progress$ });\n  }).shareReplay(1);\n\n  return parsed$;\n}\n\n// helper function to output combine fetch & parse data\nfunction computeCombinedProgress(fetched$, parsed$) {\n  var fetchToParseRatio = 0.95;\n\n  function preProcess(selector, data$) {\n    return data$.map(selector)\n    // .distinctUntilChanged()\n    .filter(function (d) {\n      return (0, _utils.exists)(d.progress);\n    });\n  }\n\n  // we merge fetch information with parse information\n  var progress$ = merge(preProcess(function (f) {\n    return { id: f.request.uri, progress: f.progress };\n  }, fetched$).map(function (e) {\n    return { id: e.id, fetched: e.progress * fetchToParseRatio };\n  }), preProcess(function (f) {\n    return { id: f.meta.uri, progress: f.progress };\n  }, parsed$).map(function (e) {\n    return { id: e.id, parsed: e.progress * (1 - fetchToParseRatio) };\n  }));\n\n  var combinedProgress$ = progress$.scan(function (combined, entry) {\n    var fetched = entry.fetched || fetchToParseRatio;\n    var parsed = entry.parsed || 0;\n    var progress = fetched + parsed;\n\n    combined.entries[entry.id] = progress;\n\n    var totalProgress = Object.keys(combined.entries).reduce(function (acc, cur) {\n      return acc + combined.entries[cur];\n    }, 0);\n\n    totalProgress /= Object.keys(combined.entries).length;\n    combined.totalProgress = totalProgress;\n\n    return combined;\n  }, { entries: {}, totalProgress: 0 }).pluck('totalProgress').distinctUntilChanged(null, _ramda.equals).debounce(10);\n\n  return combinedProgress$;\n}\n\nfunction resources(sources) {\n  var fetched$ = fetch(sources); //.tap(e=>console.log('fetched',e))\n  var parsed$ = parse(fetched$);\n  var combinedProgress$ = computeCombinedProgress(fetched$, parsed$);\n\n  parsed$.catch(function (error) {\n    console.log('error in parse', error);\n  });\n\n  return { combinedProgress$: combinedProgress$, parsed$: parsed$ };\n}\n\n/* const fn = cond([\n  [equals(0),   always('water freezes at 0°C')],\n  [equals(100), always('water boils at 100°C')],\n  [T,           temp => 'nothing special happens at ' + temp + '°C']\n])\n\nconsole.log( fn(0) ) //=> 'water freezes at 0°C'\nconsole.log( fn(50) ) //=> 'nothing special happens at 50°C'\nconsole.log( fn(100) ) //=> 'water boils at 100°C'*/\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/assetManager.js\n ** module id = 219\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/assetManager.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = assetRequests;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// faster object.assign\n\nfunction isPreFormatedRequest(data) {\n  return data.hasOwnProperty && data.hasOwnProperty('uri') && data.hasOwnProperty('method'); // already preformated request\n}\n\nfunction isValidDataSource(data) {\n  var valid = isPreFormatedRequest(data) || (0, _utils.isValidFile)(data) || (0, _utils.isValidUrl)(data);\n  return valid;\n}\n\nfunction dataSource(data) {\n  if (isPreFormatedRequest(data)) {\n    return data;\n  } else if ((0, _utils.isValidFile)(data)) {\n    return {\n      src: 'desktop', uri: data.name\n    };\n  } else if ((0, _utils.isValidUrl)(data)) {\n    return {\n      src: 'http', uri: data\n    };\n  }\n}\n\nfunction assetRequests(inputs, sources) {\n  // FIXME: caching should be done at a higher level , to prevent useless requests\n  var resourceCache$ = undefined;\n  var cache = {};\n  function getCached(inputs) {\n    // this one needs to be store independant too\n  }\n\n  var baseRequest$ = inputs.flatMap(_rx2.default.Observable.fromArray).filter(_utils.exists).filter(function (data) {\n    return !(0, _utils.isEmpty)(data);\n  }).filter(isValidDataSource).map(function (data) {\n    var source = dataSource(data);\n    var uri = source.uri;\n\n    var _getNameAndExtension = (0, _utils.getNameAndExtension)(uri);\n\n    var name = _getNameAndExtension.name;\n    var ext = _getNameAndExtension.ext;\n\n    return { src: source.src, uri: uri, data: data, ext: ext, name: name };\n  });\n\n  var requests$ = baseRequest$.filter(function (req) {\n    var cached = cache[req.uri];\n    return cached === undefined;\n  }).tap(function (e) {\n    return console.log('assetRequest', e);\n  });\n\n  // request from http driver\n  var httpRequests$ = requests$.filter(function (r) {\n    return r.src === 'http';\n  }).map(function (req) {\n    return (0, _assign2.default)({ url: req.uri, method: 'get', type: 'resource' }, req);\n  });\n\n  // request from desktop store (source only)\n  var desktopRequests$ = requests$.filter(function (r) {\n    return r.src === 'desktop';\n  }).map(function (req) {\n    return (0, _assign2.default)({ url: req.uri, method: 'get', type: 'resource' }, req);\n  });\n\n  var requests = {\n    http$: httpRequests$, desktop$: desktopRequests$\n  };\n\n  return requests;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/assetRequests.js\n ** module id = 220\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/assetRequests.js?")},function(module,exports){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.hasEntity = hasEntity;\nexports.hasNoEntity = hasNoEntity;\nexports.getEntity = getEntity;\n// ///////////////////////////////\n// entity utils\nfunction hasEntity(input) {\n  return input && input.userData && input.userData.entity;\n}\n\n// this one should not be needed\nfunction hasNoEntity(input) {\n  return !(input && input.userData && input.userData.entity);\n}\n\nfunction getEntity(input) {\n  return input.userData.entity;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/entityUtils.js\n ** module id = 221\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/entityUtils.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.convert = convert;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction convert(data) {\n  var colors = data.colors;\n  var positions = data.positions;\n\n\n  var material = new _three2.default.LineBasicMaterial({\n    color: 0xffffff,\n    linewidth: 5,\n    vertexColors: _three2.default.VertexColors,\n    opacity: 0.5,\n    transparent: true\n  });\n\n  var geometry = new _three2.default.BufferGeometry();\n  geometry.addAttribute('position', new _three2.default.BufferAttribute(new Float32Array(positions), 3));\n  geometry.addAttribute('color', new _three2.default.BufferAttribute(new Float32Array(colors), 4));\n\n  var group = new _three2.default.Object3D();\n  group.add(new _three2.default.Line(geometry, material));\n\n  return group;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/gcodeUtils.js\n ** module id = 222\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/gcodeUtils.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.saveImage = saveImage;\nexports.domElementToImage = domElementToImage;\nexports.aspectResize = aspectResize;\nfunction saveImage() {\n  var fileName = arguments.length <= 0 || arguments[0] === undefined ? 'img' : arguments[0];\n  var format = arguments.length <= 1 || arguments[1] === undefined ? 'png' : arguments[1];\n\n  var link = document.createElement('a');\n  // var blob = new Blob([data],{type : 'image/'+format})\n  // var url =  window.URL.createObjectURL(blob)\n  // var blobURL = window.webkitURL.createObjectURL(blob)\n  link.href = data;\n  link.download = fileName;\n  link.click();\n}\n\nfunction domElementToImage(domElement, mimeType) {\n  var srcImg, _aspectResize;\n  var mimeType = mimeType || 'image/png';\n\n  if (!domElement) {\n    throw new Error('Cannot Do screenshot without canvas domElement');\n  }\n\n  srcImg = domElement.toDataURL(mimeType);\n  /*if(!width || !height){\n    callback(srcImg)\n  }else\n  {\n    aspectResize(srcImg, width, height, callback)\n  }*/\n  return srcImg;\n}\n\nfunction aspectResize(srcUrl, dstW, dstH, callback) {\n  /*\n  resize an image to another resolution while preserving aspect\n   @param {String} srcUrl the url of the image to resize\n  @param {Number} dstWidth the destination width of the image\n  @param {Number} dstHeight the destination height of the image\n  @param {Number} callback the callback to notify once completed with callback(newImageUrl)\n  */\n\n  var cpuScaleAspect, img, onLoad;\n  cpuScaleAspect = function cpuScaleAspect(maxW, maxH, curW, curH) {\n    var ratio;\n    ratio = curH / curW;\n    if (curW >= maxW && ratio <= 1) {\n      curW = maxW;\n      curH = maxW * ratio;\n    } else if (curH >= maxH) {\n      curH = maxH;\n      curW = maxH / ratio;\n    }\n    return {\n      width: curW,\n      height: curH\n    };\n  };\n\n  onLoad = function onLoad() {\n    var canvas, ctx, mimetype, newDataUrl, offsetX, offsetY, scaled;\n    canvas = document.createElement('canvas');\n    canvas.width = dstW;\n    canvas.height = dstH;\n    ctx = canvas.getContext('2d');\n    scaled = cpuScaleAspect(canvas.width, canvas.height, img.width, img.height);\n    offsetX = (canvas.width - scaled.width) / 2;\n    offsetY = (canvas.height - scaled.height) / 2;\n    ctx.drawImage(img, offsetX, offsetY, scaled.width, scaled.height);\n    mimetype = 'image/png';\n    newDataUrl = canvas.toDataURL(mimetype);\n    callback(newDataUrl);\n  };\n\n  img = new Image();\n  img.onload = onLoad;\n  img.src = srcUrl;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/imgUtils.js\n ** module id = 223\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/imgUtils.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.unIndexGeometryData = unIndexGeometryData;\nexports.postProcessMesh = postProcessMesh;\nexports.geometryFromBuffers = geometryFromBuffers;\nexports.meshTohash = meshTohash;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\n  un-indexes raw geometry data hash with indices\n  @geomData: hash containing arraybuffers, by attributes : ie\n  {\n      position: [....],\n      normal: [....],\n      indices: [...]\n  }\n*/\nfunction unIndexGeometryData(geomData) {\n  if (!('indices' in geomData)) {\n    return geomData;\n  }\n  var bufferTypes = ['positions', 'normals', 'colors', 'uvs'];\n  var bufferTypeSizes = { positions: 3, normals: 3, colors: 4, uvs: 3 };\n  var output = {};\n  geomData.indices.forEach(function (inputIndex, outIndex) {\n    bufferTypes.forEach(function (bufferType) {\n      if (geomData[bufferType] && geomData[bufferType].length > 0) {\n        var size = bufferTypeSizes[bufferType];\n\n        if (!output[bufferType]) {\n          output[bufferType] = new Float32Array(geomData.indices.length * size);\n        }\n\n        for (var i = 0; i < size; i++) {\n          output[bufferType][outIndex * size + i] = geomData[bufferType][inputIndex * size + i];\n        }\n        // output[bufferType][outIndex * size] = geomData[bufferType][inputIndex * size]\n        // output[bufferType][outIndex * size + 1] = geomData[bufferType][inputIndex * size + 1]\n        // output[bufferType][outIndex * size + 2] = geomData[bufferType][inputIndex * size + 2]\n      }\n    });\n  });\n  return output;\n}\n\n// TODO: UNIFY api for parsers, this is redundant\nfunction postProcessMesh(shape) {\n  // geometry\n  if (!(shape instanceof _three2.default.Object3D)) {\n    var material = new _three2.default.MeshPhongMaterial({ color: 0x17a9f5, specular: 0xffffff, shininess: 5, shading: _three2.default.FlatShading });\n    if ('color' in shape.attributes) {\n      material.vertexColors = _three2.default.VertexColors;\n      material.color.set(0xffffff);\n      material.specular.set(0xffffff);\n    }\n    shape = new _three2.default.Mesh(shape, material);\n  }\n\n  // FIXME  should this be handled by the asset manager or the parsers ?\n  // ie , this won't work for loaded hierarchies etc\n  var geometry = shape.geometry;\n  if (geometry) {\n    geometry.computeFaceNormals();\n    geometry.computeVertexNormals(); // needed at least for .ply files\n  }\n\n  /* OLD STUFF, needs to be sorted out\n    var vs = require('./vertShader.vert')()\n    var fs = require('./fragShader.frag')()\n     var material = new THREE.RawShaderMaterial( {\n            uniforms: {\n              time: { type: \"f\", value: 1.0 }\n            },\n            vertexShader: vs,\n            fragmentShader: fs,\n            side: THREE.DoubleSide,\n            transparent: true\n           } )\n    var material = new this.defaultMaterialType({color:color, specular: 0xffffff, shininess: 2, shading: THREE.FlatShading});//,vertexColors: THREE.VertexColors\n  */\n\n  // Additional hack, only for buffer geometry\n  if (!geometry.morphTargets) geometry.morphTargets = [];\n  if (!geometry.morphNormals) geometry.morphNormals = [];\n  return shape;\n}\n\nfunction geometryFromBuffers(_ref) {\n  var positions = _ref.positions;\n  var normals = _ref.normals;\n  var indices = _ref.indices;\n  var colors = _ref.colors;\n\n  var geometry = new _three2.default.BufferGeometry();\n\n  geometry.addAttribute('position', new _three2.default.BufferAttribute(positions, 3));\n\n  if (normals && normals.length > 0) {\n    geometry.addAttribute('normal', new _three2.default.BufferAttribute(normals, 3));\n  }\n  if (indices && indices.length > 0) {\n    geometry.addAttribute('index', new _three2.default.BufferAttribute(indices, 3));\n  }\n  if (colors && colors.length > 0) {\n    geometry.addAttribute('color', new _three2.default.BufferAttribute(colors, 4));\n  }\n\n  return geometry;\n}\n\n// import Hashes from 'jshashes'\nfunction meshTohash(mesh) {\n  // let SHA512 = new Hashes.SHA512\n  // geometry.vertices\n  // for each mesh , compute /update hash based on vertices\n  var modelHash = hash.hex();\n  return modelHash;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/meshUtils.js\n ** module id = 224\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/meshUtils.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };\n\nexports.postProcessParsedData = postProcessParsedData;\n\nvar _utils = __webpack_require__(3);\n\nvar _meshUtils = __webpack_require__(224);\n\nvar _glViewHelpers = __webpack_require__(60);\n\nvar centerMesh = _glViewHelpers.meshTools.centerMesh;\nfunction postProcessParsedData(data) {\n  // TODO: unify parsers\' returned data/api ?\n  // console.log("postProcessMesh/data",data)\n  var mesh = void 0;\n  if (\'objects\' in data) {\n    var _ret = function () {\n      // for 3mf , etc\n      var typesMetaHash = {};\n      var typesMeshes = [];\n      var typesMeta = [];\n\n      // we need to make ids unique\n      var idLookup = {};\n\n      for (var objectId in data.objects) {\n        // console.log("objectId",objectId, data.objects[objectId])\n        var item = data.objects[objectId];\n\n        var typeUid = (0, _utils.generateUUID)();\n        idLookup[item.id] = typeUid;\n\n        var meta = { id: typeUid, name: item.name };\n        // special color handling\n        if (item.colors && item.colors.length > 0) {\n          meta.color = \'#FFFFFF\';\n          console.log(\'added color\');\n        }\n        typesMeta.push(meta);\n        typesMetaHash[typeUid] = meta;\n\n        // console.log(\'mesh data\', item)\n        mesh = (0, _meshUtils.geometryFromBuffers)(item);\n        mesh = (0, _meshUtils.postProcessMesh)(mesh);\n        mesh = centerMesh(mesh);\n        typesMeshes.push({ typeUid: typeUid, mesh: mesh });\n      }\n\n      // now for the instances data\n      var instMeta = [];\n      var instTransforms = [];\n      data.build.map(function (item) {\n        var instUid = (0, _utils.generateUUID)();\n        var id = idLookup[item.objectid];\n\n        instMeta.push({ instUid: instUid, typeUid: id }); // TODO : auto generate name\n        if (\'transforms\' in item) {\n          instTransforms.push({ instUid: instUid, transforms: item.transforms });\n        } else {\n          instTransforms.push({ instUid: instUid, transforms: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] });\n        }\n      });\n      // console.log("typesMeta",typesMeta,"typesMeshes",typesMeshes,"instMeta",instMeta,"instTransforms",instTransforms)\n      var result = { meshOnly: false, typesMeshes: typesMeshes, typesMeta: typesMeta, instMeta: instMeta, instTransforms: instTransforms };\n      console.log(\'data\', result);\n      return {\n        v: result\n      };\n    }();\n\n    if ((typeof _ret === \'undefined\' ? \'undefined\' : _typeof(_ret)) === "object") return _ret.v;\n  } else {\n    mesh = data;\n    // FIXME: just a test , in case we need to un-index geometric data\n    // mesh = unIndexGeometryData(mesh)\n    mesh = (0, _meshUtils.geometryFromBuffers)(mesh);\n    mesh = (0, _meshUtils.postProcessMesh)(mesh);\n    mesh = centerMesh(mesh);\n\n    var _typesMeshes = [{ typeUid: undefined, mesh: mesh }];\n\n    return { meshOnly: true, typesMeshes: _typesMeshes };\n  }\n\n  return mesh;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/parseUtils.js\n ** module id = 225\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/parseUtils.js?');
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.fetchUriParams = fetchUriParams;\nexports.getUriQuery = getUriQuery;\nexports.setWindowPathAndTitle = setWindowPathAndTitle;\n\nvar _url = __webpack_require__(348);\n\nvar _url2 = _interopRequireDefault(_url);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction fetchUriParams(uri, paramName) {\n  var params = _url2.default.parse(uri, true);\n  var result = params.query;\n  // TODO: always return query\n  if (paramName in result) return [].concat(result[paramName]);\n  return [];\n}\n\nfunction getUriQuery(uri) {\n  var uriData = _url2.default.parse(uri);\n  var query = uriData.query;\n  return query;\n}\n\nfunction setWindowPathAndTitle(urlPath) {\n  var title = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];\n\n  // clear url related stuff\n  urlPath = urlPath || location.protocol + '//' + location.host + location.pathname;\n  var pageTitle = title;\n  document.title = pageTitle;\n  window.history.pushState({ 'pageTitle': pageTitle }, '', urlPath);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/urlUtils.js\n ** module id = 226\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/urlUtils.js?")},function(module,exports,__webpack_require__){eval("var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n	'use strict';\n\n  var Arr = (typeof Uint8Array !== 'undefined')\n    ? Uint8Array\n    : Array\n\n	var PLUS   = '+'.charCodeAt(0)\n	var SLASH  = '/'.charCodeAt(0)\n	var NUMBER = '0'.charCodeAt(0)\n	var LOWER  = 'a'.charCodeAt(0)\n	var UPPER  = 'A'.charCodeAt(0)\n	var PLUS_URL_SAFE = '-'.charCodeAt(0)\n	var SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n	function decode (elt) {\n		var code = elt.charCodeAt(0)\n		if (code === PLUS ||\n		    code === PLUS_URL_SAFE)\n			return 62 // '+'\n		if (code === SLASH ||\n		    code === SLASH_URL_SAFE)\n			return 63 // '/'\n		if (code < NUMBER)\n			return -1 //no match\n		if (code < NUMBER + 10)\n			return code - NUMBER + 26 + 26\n		if (code < UPPER + 26)\n			return code - UPPER\n		if (code < LOWER + 26)\n			return code - LOWER + 26\n	}\n\n	function b64ToByteArray (b64) {\n		var i, j, l, tmp, placeHolders, arr\n\n		if (b64.length % 4 > 0) {\n			throw new Error('Invalid string. Length must be a multiple of 4')\n		}\n\n		// the number of equal signs (place holders)\n		// if there are two placeholders, than the two characters before it\n		// represent one byte\n		// if there is only one, then the three characters before it represent 2 bytes\n		// this is just a cheap hack to not do indexOf twice\n		var len = b64.length\n		placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n		// base64 is 4/3 + up to two characters of the original data\n		arr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n		// if there are placeholders, only get up to the last complete 4 chars\n		l = placeHolders > 0 ? b64.length - 4 : b64.length\n\n		var L = 0\n\n		function push (v) {\n			arr[L++] = v\n		}\n\n		for (i = 0, j = 0; i < l; i += 4, j += 3) {\n			tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n			push((tmp & 0xFF0000) >> 16)\n			push((tmp & 0xFF00) >> 8)\n			push(tmp & 0xFF)\n		}\n\n		if (placeHolders === 2) {\n			tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n			push(tmp & 0xFF)\n		} else if (placeHolders === 1) {\n			tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n			push((tmp >> 8) & 0xFF)\n			push(tmp & 0xFF)\n		}\n\n		return arr\n	}\n\n	function uint8ToBase64 (uint8) {\n		var i,\n			extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n			output = \"\",\n			temp, length\n\n		function encode (num) {\n			return lookup.charAt(num)\n		}\n\n		function tripletToBase64 (num) {\n			return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n		}\n\n		// go through the array every three bytes, we'll deal with trailing stuff later\n		for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n			temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n			output += tripletToBase64(temp)\n		}\n\n		// pad the end with zeros, but make sure to not forget the extra bytes\n		switch (extraBytes) {\n			case 1:\n				temp = uint8[uint8.length - 1]\n				output += encode(temp >> 2)\n				output += encode((temp << 4) & 0x3F)\n				output += '=='\n				break\n			case 2:\n				temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n				output += encode(temp >> 10)\n				output += encode((temp >> 4) & 0x3F)\n				output += encode((temp << 2) & 0x3F)\n				output += '='\n				break\n		}\n\n		return output\n	}\n\n	exports.toByteArray = b64ToByteArray\n	exports.fromByteArray = uint8ToBase64\n}( false ? (this.base64js = {}) : exports))\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/base64-js/lib/b64.js\n ** module id = 227\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/base64-js/lib/b64.js?")},function(module,exports,__webpack_require__){eval("module.exports = function(cb) {\n	!/* require.ensure */(function(require) {\n		cb(__webpack_require__(349));\n	}(__webpack_require__));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/bundle-loader?lazy!./~/usco-3mf-parser/lib/browser/3mf-parser.js\n ** module id = 228\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-3mf-parser/lib/browser/3mf-parser.js?./~/bundle-loader?lazy")},function(module,exports,__webpack_require__){eval("module.exports = function(cb) {\n	!/* require.ensure */(function(require) {\n		cb(__webpack_require__(350));\n	}(__webpack_require__));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/bundle-loader?lazy!./~/usco-ctm-parser/lib/browser/ctm-parser.js\n ** module id = 229\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-ctm-parser/lib/browser/ctm-parser.js?./~/bundle-loader?lazy")},function(module,exports,__webpack_require__){eval("module.exports = function(cb) {\n	!/* require.ensure */(function(require) {\n		cb(__webpack_require__(351));\n	}(__webpack_require__));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/bundle-loader?lazy!./~/usco-gcode-parser/lib/browser/gcode-parser.js\n ** module id = 230\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-gcode-parser/lib/browser/gcode-parser.js?./~/bundle-loader?lazy")},function(module,exports,__webpack_require__){eval("module.exports = function(cb) {\n	!/* require.ensure */(function(require) {\n		cb(__webpack_require__(352));\n	}(__webpack_require__));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/bundle-loader?lazy!./~/usco-obj-parser/lib/browser/obj-parser.js\n ** module id = 231\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-obj-parser/lib/browser/obj-parser.js?./~/bundle-loader?lazy")},function(module,exports,__webpack_require__){eval("module.exports = function(cb) {\n	!/* require.ensure */(function(require) {\n		cb(__webpack_require__(353));\n	}(__webpack_require__));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/bundle-loader?lazy!./~/usco-stl-parser/lib/browser/stl-parser.js\n ** module id = 232\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-stl-parser/lib/browser/stl-parser.js?./~/bundle-loader?lazy")},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".bom{height:auto;cursor:default;font-weight:600;font-size:.9em}.bom .bomToggler{float:right;margin:0;top:10px;right:20px;position:absolute}.bom .toolTipButtonContainer{position:inherit}.bom .tableContainer{height:calc(100% - 132px);pointer-events:none}.bom table{font-size:13px;border-collapse:collapse;background:#fff;width:100%}.bom .column0{width:40%}.bom .column1{width:10%}.bom .column2{width:15%}.bom .column3{width:10%}.bom .column4{width:15%}.bom .column5{width:10%}.bom #tableheader{cursor:pointer}.bom #tablebody,.bom #tableheader{border:1px solid #f7f6f6;pointer-events:auto}.bom #tablebody{max-height:80%;overflow-x:hidden;overflow-y:auto;border-top:0;position:absolute}.bom tr:hover{background-color:#f4f4f4;color:#000}.bom tr:hover,.bom tr:hover input{font-weight:700}.bom tr.selected{background-color:#5bc3fa;color:#fff}.bom .adderRow td{border:1px solid #f7f6f6}.bom td.column0,.bom th.column4{text-align:left}.bom .cell,.readOnly th.column4{text-align:center}.bom .cell{vertical-align:middle;padding:5}.bom .directionArrow{font-size:.6em}.bom .directionArrow .asc:after{content:\\"\\\\25B2\\"}.bom .directionArrow .desc:after{content:\\"\\\\25BC\\"}.bom .directionArrow .neut:after{content:\\"\\\\2B0D\\";font-size:12px}.bom input[type=text]{border:none;background:none;color:#555;font-family:Open Sans,sans-serif;padding-left:3px}.bom tr.selected input[type=text]{border:none;background:none;color:#fff}.bom .name input[type=text]{min-width:150px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.bom .qty input[type=number]{width:50px;box-sizing:border-box;-moz-box-sizing:border-box;border-width:0;width:10em;max-width:50px;border:none;line-height:.8em;font-size:.8em;font-family:inherit}.bom tr.selected input[type=number]{color:#fff}.bom .phys_qty input[type=number]{width:50px;box-sizing:border-box;-moz-box-sizing:border-box;border-width:0;width:10em;max-width:50px;border:none;line-height:.8em;font-size:.8em;font-family:inherit}.bom .adder{font-style:italic;color:#827d7d}.bom .adder td{border-collapse:separate;border:1px solid #efefef!important}.bom .adder input[type=text]{color:#827d7d;font-style:italic!important}.bom .adder ::-webkit-input-placeholder{color:#827d7d;font-style:italic!important}.bom .adder :-moz-placeholder,.bom .adder ::-moz-placeholder{color:#827d7d;font-style:italic!important}.bom .adder :-ms-input-placeholder{color:#827d7d;font-style:italic!important}.bom .adder button{color:#fff;padding:2 5;background:#5fc5fb;margin:0}.bom .bomEntry button{margin:0}.bom .bomEntry button,.bom .bomEntry button .icon{background:hsla(0,0%,96%,0)}.bom .bomEntry button:hover .icon{background:#5bc3fa}.bom .removeBomEntry{color:red;padding:1px}.bom .removal{height:42px}.bom .removal span{padding:5;font-size:11px}.bom .removal button{color:#fff;padding:2 5;background:#5fc5fb;margin-right:3px}.bom tr select:disabled{-webkit-appearance:none;-moz-appearance:none;text-indent:1px;text-overflow:\'\';border:none}.bom tr input[type=number]:disabled,.bom tr select:disabled{background:transparent;color:#000}.bom tr.selected input[type=number]:disabled,.bom tr.selected select:disabled{color:#fff}.bom .export button{padding:0 2px;margin:0 2px 0 0}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/Bom/bom.css\n ** module id = 233\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Bom/bom.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".comments{position:absolute;bottom:10px;left:10px;font-size:.7em}.comments textarea{border:none;overflow:auto;outline:none;box-shadow:none;width:100%;height:100%}.commentDetails{position:absolute;left:5px;bottom:30px;min-width:280px;padding:10px;background:hsla(0,0%,96%,.25)}.commentDetails .new .textInput{padding:10px}.commentDetails .new{padding-left:0}.commentDetails .new .icon path{fill:#00b2ff}.commentDetails .new header{font-weight:600}.commentDetails .new button{background-color:#00b2ff;border:none;margin:10px;font-weight:300;color:#fff;float:right}.commentDetails header{padding-bottom:5px}.commentDetails header .author{text-decoration:underline}.commentDetails .icon{width:16px;height:16px;margin:-5px 10px;border-radius:50%;background:#ede6e6}.commentDetails .icon path{fill:#898989}.commentDetails .content{background:#fff;border:1px solid #eae7e7;padding:10px;margin-left:30px}.commentDetails .textInput{padding:15px;line-height:12px;width:100%;text-align:center;border-top:10px}.commentsList{list-style:none;padding-left:0;max-height:300px;overflow:auto}.commentsList .item{padding-top:10px;padding-bottom:5px}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/Comments/comments.css\n ** module id = 234\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/comments.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".movingSubTools,.rotationSubTools,.scalingSubTools{width:200px;display:block}.scalingSubTools{width:260px}.transformsGroup{margin:10px}.optionsGroup,.transformsGroup{width:180px;display:inline-block}.optionsGroup{white-space:nowrap;clear:both;margin:0 10px 10px}.scalingSubTools .defaultsGroup,.scalingSubTools .optionsGroup,.scalingSubTools .transformsGroup{width:240px}.transformsGroup .axisData{display:inline-block;margin-bottom:3px}.transformsGroup input[type=number]{color:#828282;background:#fff;border:none}.transformsGroup input[type=number]:disabled{color:#d3d3d3}.transformsGroup .percent{color:#828282;width:78%;padding:5px}.transformsGroup .value{color:#636363;width:60%;padding:4px;padding-left:6px}.transformsGroup .valueGroup{border:1px solid red;display:block}.transformsGroup .valueGroup .axisName,.transformsGroup .valueGroup label{color:#fff;padding:5 12;background-color:red;display:inline-block}.transformsGroup .percentGroup{border:1px solid red}.transformsGroup .x-axis .percentGroup,.transformsGroup .x-axis .valueGroup{border-color:#ed8d00}.transformsGroup .x-axis .valueGroup .axisName,.transformsGroup .x-axis .valueGroup label{background-color:#ed8d00}.transformsGroup .y-axis .percentGroup,.transformsGroup .y-axis .valueGroup{border-color:#89c718}.transformsGroup .y-axis .valueGroup .axisName,.transformsGroup .y-axis .valueGroup label{background-color:#89c718}.transformsGroup .z-axis .percentGroup,.transformsGroup .z-axis .valueGroup{border-color:#5bc3fa}.transformsGroup .z-axis .valueGroup .axisName,.transformsGroup .z-axis .valueGroup label{background-color:#5bc3fa}.transformsGroup .unit{color:#aaa;padding:0;display:inline-block}.twoColumns .valueGroup{width:60%;float:left}.twoColumns .percentGroup{width:35%;float:right}.defaultsGroup{padding:15px 10px;display:block;border-top:1px solid #ddd;text-align:right}.nameAndColorSubTools{width:270px;display:block;padding:10px}.nameAndColorSubTools input[type=text]{text-overflow:ellipsis;font-size:.8em!important;margin-left:5px}.nameAndColorSubTools label{padding:5px;background:#cacaca;color:#fff;width:20%}.nameAndColorSubTools span{display:inline-flex;width:100%;margin-top:4px}.nameAndColorSubTools .inputWrapper{width:80%;border:1px solid #cacaca!important;padding:0;margin:0}.nameAndColorSubTools input[type=color]{width:100%;opacity:0;display:block;height:22px;border:none}.nameAndColorSubTools input[type=color]:focus,.toolbarBottom input[type=number]:focus,.toolbarBottom input[type=text]:focus{outline:none}.entityInfos .icon{width:16px;height:16px;top:4px;position:relative;padding:0}.entityInfos .icon path{fill:#989898}.entityInfos .icon:hover path{background:none;color:none;fill:#989898}.entityInfos .transformInput{padding:7 0 0 13px}.color{width:24px;margin:0;border:0;padding:0;height:20px;display:inline;outline:none;position:static;float:left;bottom:0;left:0}.colorPicker .body{width:150px;height:90px;position:absolute;bottom:35px;border:1px solid #d8d8d8;padding:5px}.colorPicker .body .mainGradient{height:70px;width:100%;margin:2px}.colorPicker .body .smallGradient{height:20px;width:100%;margin:2px;background:linear-gradient(90deg,red,orange,#ff0,green,blue,indigo,violet)}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/EntityInfos/style.css\n ** module id = 235\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/style.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".settings{z-index:2}.settings .settingEntry{padding:6px;text-align:justify}.settings .content{background:#fff;font-size:.8em;width:200px}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/Settings/settings.css\n ** module id = 236\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/settings.css?./~/css-loader')},function(module,exports,__webpack_require__){eval("exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, \"body{padding:0;margin:0}#jamRoot,body{width:100%;height:100%;overflow:hidden}#jamRoot{font-family:Open Sans,sans-serif;-webkit-transition:opacity .5s ease-in;opacity:1;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jam{position:absolute;top:0;left:0;width:100%}.jam input[type=number],.jam input[type=text]{background-color:hsla(0,0%,96%,.25)}:invalid{box-shadow:none}:-moz-submit-invalid,:-moz-ui-invalid{box-shadow:none}.textLink{font-size:.8em;color:#5bc3fa;text-decoration:underline;cursor:pointer}button path{fill:#555!important}button:focus{outline:0}button{line-height:1.8;appearance:none;box-shadow:none;border-radius:0;border:0;background:#f5f5f5;padding:0;cursor:pointer}button:hover:enabled{background:#5bc3fa}button:enabled:hover path{fill:#fff!important;stroke:#fff!important}button:enabled:hover svg *{fill:#fff}button:disabled:hover,button:disabled svg *,button[disabled=disabled],button[disabled=disabled]:hover{fill:#d3d3d3;stroke:#d3d3d3}.measureDiameter{padding:9px}.helpToggler{padding:6px}.containerToggler{width:45px;height:45px;margin:2px}.fadesIn{opacity:0;transition:opacity .4s ease-in;-ms-transition:opacity .4s ease-in;-moz-transition:opacity .4s ease-in;-webkit-transition:opacity .4s ease-in}.fadesOut{opacity:1;transition:opacity .4s ease-out;-ms-transition:opacity .4s ease-out;-moz-transition:opacity .4s ease-out;-webkit-transition:opacity .4s ease-out}.visible{opacity:1}.active{background:#5bc3fa}.active,.active path{fill:#fff!important}.active svg *{fill:#fff}.camViewControls{position:absolute;width:256px;height:128px;left:0;bottom:48px}.glView{width:100%;height:100%;cursor:default}@keyframes spinner{to{transform:rotate(1turn)}}@-webkit-keyframes spinner{to{-webkit-transform:rotate(1turn)}}.spinner{min-width:30px;min-height:30px}.spinner:before{content:'Loading\\\\2026';position:absolute;top:50%;left:50%;width:24px;height:24px;margin-top:-13px;margin-left:-13px}.spinner:not(:required):before{content:'';border-radius:50%;border:1px solid #ccc;border-top-color:#03ade0;animation:spinner .6s linear infinite;-webkit-animation:spinner .6s linear infinite}.loading{opacity:0!important}.visible{opacity:1!important}.innerWrapper{opacity:0;transition:opacity 1s ease-in-out;-moz-transition:opacity 1s ease-in-out;-webkit-transition:opacity 1s ease-in-out}.mainError{position:absolute;width:100%;height:100%;top:25%}.mainError,a{color:#3d6179}a:hover{text-decoration:none}.mainError{text-align:center}.mainError h1{font-size:1.5em;margin-bottom:40px;line-height:1.5em;font-weight:600}div.container-heading{max-width:80%;margin:40px auto;border-bottom:1px solid #efefef;padding:0 10px}div.container-text{max-width:90%;margin:40px auto;padding:0 10px}div.largeIcon{margin:80px auto;width:80px;height:80px;text-align:center}.debugDisplay{position:absolute;top:0;left:0}.textInput.placeholder{color:#c2c2c2}#test{position:absolute;z-index:10;left:100;top:300}\", \"\"]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/main/app.css\n ** module id = 237\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/app.css?./~/css-loader")},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, "#bottomToolBar{position:absolute;bottom:0;right:0;display:flex;padding:10 20}#bottomToolBar .containerToggler:hover{background:#5bc3fa}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/main/bottomToolBar.css\n ** module id = 238\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/bottomToolBar.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, "#leftToolbar{padding:0;position:absolute;top:10px;left:10px;width:180px;height:90%}#leftToolbar h1{display:inline-block;padding:4px;margin:0;margin-left:5px;font-size:1.3em;font-weight:500;min-width:200px}#leftToolbar input[type=text]{color:#60c4f8;outline:none;font-size:1.1em;font-weight:500;min-width:10em;width:100%;box-sizing:border-box;-moz-box-sizing:border-box;border:none;border-width:0}#leftToolbar input[type=text]:focus{outline:none}#leftToolbar .history,#leftToolbar .social{padding-left:5px;padding-right:5px}#leftToolbar section{display:inline-flex;flex-direction:column}#leftToolbar button{width:45px;height:45px;margin:2px}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/main/leftToolbar.css\n ** module id = 239\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/leftToolbar.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".notifications{color:#a5a5a5;font-size:.7em;margin-top:10px;vertical-align:text-top;text-align:center}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/main/notifications.css\n ** module id = 240\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/notifications.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".toolTips .icon{margin:-10px 0}.tooltip,[data-tooltip]{position:relative;cursor:pointer}.tooltip:after,.tooltip:before,[data-tooltip]:after,[data-tooltip]:before{position:absolute;visibility:hidden;-ms-filter:\\"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\\";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;-webkit-transition:opacity .2s ease-in-out,visibility .2s ease-in-out,-webkit-transform .2s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .2s ease-in-out,visibility .2s ease-in-out,transform .2s cubic-bezier(.71,1.7,.77,1.24);-webkit-transform:translateZ(0);transform:translateZ(0);pointer-events:none}.tooltip:hover:after,.tooltip:hover:before,[data-tooltip]:hover:after,[data-tooltip]:hover:before{visibility:visible;-ms-filter:\\"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)\\";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.tooltip:before,[data-tooltip]:before{z-index:1001;border:6px solid transparent;background:transparent;content:\\"\\"}.tooltip:after,[data-tooltip]:after{z-index:1000;padding:3px;width:60px;background-color:#000;background-color:rgba(51,51,51,.9);color:#fff;content:attr(data-tooltip);font-size:12px;line-height:1}.tooltip-top:after,.tooltip-top:before,.tooltip:after,.tooltip:before,[data-tooltip]:after,[data-tooltip]:before{bottom:100%;left:50%}.tooltip-top:before,.tooltip:before,[data-tooltip]:before{margin-left:-6px;margin-bottom:-11px;border-top-color:#000;border-top-color:rgba(51,51,51,.9)}.tooltip-top:after,.tooltip:after,[data-tooltip]:after{margin-left:-20px}.tooltip-top:hover:after,.tooltip-top:hover:before,.tooltip:hover:after,.tooltip:hover:before,[data-tooltip]:hover:after,[data-tooltip]:hover:before{-webkit-transform:translateY(-12px);transform:translateY(-12px)}.tooltip-left:after,.tooltip-left:before{right:100%;bottom:50%;left:auto}.tooltip-left:before{margin-left:0;margin-right:-12px;margin-bottom:0;border-top-color:transparent;border-left-color:#000;border-left-color:rgba(51,51,51,.9)}.tooltip-left:hover:after,.tooltip-left:hover:before{-webkit-transform:translateX(-12px);transform:translateX(-12px)}.tooltip-bottom:after,.tooltip-bottom:before{top:100%;bottom:auto;left:50%}.tooltip-bottom:before{margin-top:-11px;margin-bottom:0;border-top-color:transparent;border-bottom-color:#000;border-bottom-color:rgba(51,51,51,.9)}.tooltip-bottom:hover:after,.tooltip-bottom:hover:before{-webkit-transform:translateY(12px);transform:translateY(12px)}.tooltip-right:after,.tooltip-right:before{bottom:50%;left:100%}.tooltip-right:before{margin-bottom:0;margin-left:-12px;border-top-color:transparent;border-right-color:#000;border-right-color:rgba(51,51,51,.9)}.tooltip-right:hover:after,.tooltip-right:hover:before{-webkit-transform:translateX(12px);transform:translateX(12px)}.tooltip-left:before,.tooltip-right:before{top:3px}.tooltip-left:after,.tooltip-right:after{margin-left:0;margin-bottom:-16px}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/main/tooltips.css\n ** module id = 241\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/tooltips.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, "#topToolbar{position:absolute;top:0;left:0;width:100%}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/main/topToolbar.css\n ** module id = 242\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/topToolbar.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".checkbox{width:28px;height:28px;top:0;background:#fff;position:relative;padding:0;margin:0;margin-right:10px;display:inline-block;border:1px solid #e5e5e5}.checkbox input[type=checkbox]{visibility:hidden}.checkbox label{cursor:pointer;position:absolute;width:20px;height:20px;left:4px;top:4px}.checkbox label:after{-ms-filter:\\"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\\";filter:alpha(opacity=0);opacity:0;content:\'\';position:absolute;width:9px;height:5px;background:transparent;top:4px;left:4px;border:3px solid #000;border-top:none;border-right:none;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.checkbox label:hover:after{-ms-filter:\\"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)\\";filter:alpha(opacity=30);opacity:.3}.checkbox input[type=checkbox]:checked+label:after{-ms-filter:\\"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)\\";filter:alpha(opacity=100);opacity:1}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/widgets/Checkbox/style.css\n ** module id = 243\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/Checkbox/style.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".colorGridWrapper{width:100%;margin-top:20px}.fallbackPickerSquare{display:inline-block;margin-bottom:5px;width:12.5%;height:20px;cursor:pointer}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/widgets/ColorPicker/style.css\n ** module id = 244\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/ColorPicker/style.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".fullScreenToggler{border:none;padding:0;z-index:2}.fullScreenToggler button{padding:0}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/widgets/FullScreenToggler/fullScreenToggler.css\n ** module id = 245\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/FullScreenToggler/fullScreenToggler.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".help{z-index:2;cursor:default}.help .content{background:#fff;font-size:.8em;width:250px;padding:5px;text-align:justify}.help .content ul{margin-left:0;border:none;padding:0 0 0 20}.help .content .appVersion{text-align:center;width:100%;height:10px;padding:2px;font-size:.8em;display:block;line-height:1}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/widgets/Help/help.css\n ** module id = 246\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/Help/help.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, "@-webkit-keyframes dropInEffect-fromLeft{0%{opacity:0;height:0;margin-left:-20px}90%{margin-left:2px}to{opacity:1;height:auto;margin-left:0}}@keyframes dropInEffect-fromLeft{0%{opacity:0;height:0;margin-left:-20px}90%{margin-left:2px}to{opacity:1;height:auto;margin-left:0}}.toolTipButtonContainer{position:relative}.subItemsIndicator{position:absolute;bottom:2;right:2;border-bottom:8px solid #000;border-top:8px solid transparent;border-left:8px solid transparent}.menu{display:none;position:absolute;z-index:999;background-color:#fff;border:1px solid #ddd;font-size:.8em}.menu input[type=checkbox]{margin-right:10px}.menuContent{display:block;float:left;font-size:.8em;cursor:pointer;width:50%}.menuContent .checkbox{margin-right:5px}.menu.active-content{display:block;-webkit-animation-duration:.2s;-webkit-animation-timing-function:ease-in-out;animation-duration:.2s;animation-timing-function:ease-in-out}.menu-bottom .notch{position:absolute;top:-10px;left:17px;margin:0;border-top:0;border-left:10px solid transparent;border-right:10px solid transparent;border-bottom:10px solid #fff;padding:0;width:0;height:0;font-size:0;line-height:0;_border-right-color:pink;_border-left-color:pink;_filter:chroma(color=pink)}.menu-bottom .border-notch{border-bottom-color:#ddd;top:-11px}.menu-left{top:0;bottom:auto;right:120%}.menu-right{top:-8;bottom:auto;left:52}.menu-right.arrowOffset{top:0;bottom:auto;left:120%}.menu-right .notch{position:absolute;top:10px;left:-20px;margin:0;border-left:10px solid transparent;border-right:10px solid #fff;border-bottom:10px solid transparent;border-top:10px solid transparent;padding:0;width:0;height:0}.menu-right .border-notch{border-left:8px solid transparent;border-right:11px solid #ddd;border-top:12px solid transparent}.menu-right.active-content{-webkit-animation-name:dropInEffect-fromLeft;animation-name:dropInEffect-fromLeft}.menu-top{right:calc(0% + 2px);bottom:calc(200% + 4px)}.menu-top.arrowOffset{top:-35;bottom:auto;left:-100}.menu-top .notch{position:absolute;top:10px;left:-20px;margin:0;border-left:10px solid transparent;border-right:10px solid #fff;border-bottom:10px solid transparent;border-top:10px solid transparent;padding:0;width:0;height:0}.menu-top .border-notch{border-left:8px solid transparent;border-right:11px solid #ddd;border-top:12px solid transparent}.menu-top.active-content{-webkit-animation-name:dropInEffect-fromBottom;animation-name:dropInEffect-fromBottom}@-webkit-keyframes dropInEffect-fromBottom{0%{opacity:0;height:0;margin-bottom:-20px}90%{margin-bottom:2px}to{opacity:1;height:auto;margin-bottom:0}}@keyframes dropInEffect-fromBottom{0%{opacity:0;height:0;margin-bottom:-20px}90%{margin-bottom:2px}to{opacity:1;height:auto;margin-bottom:0}}.menu-bottom{right:20;top:60}.menu-bottom.arrowOffset{top:-35;bottom:auto;left:-100}.menu-bottom .notch{position:absolute;top:10px;left:-20px;margin:0;border-left:10px solid transparent;border-right:10px solid #fff;border-bottom:10px solid transparent;border-top:10px solid transparent;padding:0;width:0;height:0}.menu-bottom .border-notch{border-left:8px solid transparent;border-right:11px solid #ddd;border-top:12px solid transparent}.menu-bottom.active-content{-webkit-animation-name:dropInEffect-fromTop;animation-name:dropInEffect-fromTop}@-webkit-keyframes dropInEffect-fromTop{0%{opacity:0;height:0;margin-top:-20px}90%{margin-top:2px}to{opacity:1;height:auto;margin-top:0}}@keyframes dropInEffect-fromTop{0%{opacity:0;height:0;margin-top:-20px}90%{margin-top:2px}to{opacity:1;height:auto;margin-top:0}}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/widgets/Menu/style.css\n ** module id = 247\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/Menu/style.css?./~/css-loader');
},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".progressBar{height:5px;width:100%;position:absolute;top:0;left:0}.progressBar .fill{background:#00b2ff;height:100%;position:absolute}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/widgets/ProgressBar/style.css\n ** module id = 248\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/ProgressBar/style.css?./~/css-loader')},function(module,exports,__webpack_require__){eval('exports = module.exports = __webpack_require__(7)();\n// imports\n\n\n// module\nexports.push([module.id, ".icon{width:50%;height:auto;padding:6px}.icon path{fill:#ddd}.icon:hover path{fill:#60c4f8}", ""]);\n\n// exports\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/css-loader!./src/components/widgets/icon/style.css\n ** module id = 249\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/icon/style.css?./~/css-loader')},function(module,exports){eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n  this._events = this._events || {};\n  this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n  if (!isNumber(n) || n < 0 || isNaN(n))\n    throw TypeError('n must be a positive number');\n  this._maxListeners = n;\n  return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n  var er, handler, len, args, i, listeners;\n\n  if (!this._events)\n    this._events = {};\n\n  // If there is no 'error' event listener then throw.\n  if (type === 'error') {\n    if (!this._events.error ||\n        (isObject(this._events.error) && !this._events.error.length)) {\n      er = arguments[1];\n      if (er instanceof Error) {\n        throw er; // Unhandled 'error' event\n      }\n      throw TypeError('Uncaught, unspecified \"error\" event.');\n    }\n  }\n\n  handler = this._events[type];\n\n  if (isUndefined(handler))\n    return false;\n\n  if (isFunction(handler)) {\n    switch (arguments.length) {\n      // fast cases\n      case 1:\n        handler.call(this);\n        break;\n      case 2:\n        handler.call(this, arguments[1]);\n        break;\n      case 3:\n        handler.call(this, arguments[1], arguments[2]);\n        break;\n      // slower\n      default:\n        args = Array.prototype.slice.call(arguments, 1);\n        handler.apply(this, args);\n    }\n  } else if (isObject(handler)) {\n    args = Array.prototype.slice.call(arguments, 1);\n    listeners = handler.slice();\n    len = listeners.length;\n    for (i = 0; i < len; i++)\n      listeners[i].apply(this, args);\n  }\n\n  return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n  var m;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events)\n    this._events = {};\n\n  // To avoid recursion in the case that type === \"newListener\"! Before\n  // adding it to the listeners, first emit \"newListener\".\n  if (this._events.newListener)\n    this.emit('newListener', type,\n              isFunction(listener.listener) ?\n              listener.listener : listener);\n\n  if (!this._events[type])\n    // Optimize the case of one listener. Don't need the extra array object.\n    this._events[type] = listener;\n  else if (isObject(this._events[type]))\n    // If we've already got an array, just append.\n    this._events[type].push(listener);\n  else\n    // Adding the second element, need to change to array.\n    this._events[type] = [this._events[type], listener];\n\n  // Check for listener leak\n  if (isObject(this._events[type]) && !this._events[type].warned) {\n    if (!isUndefined(this._maxListeners)) {\n      m = this._maxListeners;\n    } else {\n      m = EventEmitter.defaultMaxListeners;\n    }\n\n    if (m && m > 0 && this._events[type].length > m) {\n      this._events[type].warned = true;\n      console.error('(node) warning: possible EventEmitter memory ' +\n                    'leak detected. %d listeners added. ' +\n                    'Use emitter.setMaxListeners() to increase limit.',\n                    this._events[type].length);\n      if (typeof console.trace === 'function') {\n        // not supported in IE 10\n        console.trace();\n      }\n    }\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  var fired = false;\n\n  function g() {\n    this.removeListener(type, g);\n\n    if (!fired) {\n      fired = true;\n      listener.apply(this, arguments);\n    }\n  }\n\n  g.listener = listener;\n  this.on(type, g);\n\n  return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n  var list, position, length, i;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events || !this._events[type])\n    return this;\n\n  list = this._events[type];\n  length = list.length;\n  position = -1;\n\n  if (list === listener ||\n      (isFunction(list.listener) && list.listener === listener)) {\n    delete this._events[type];\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n\n  } else if (isObject(list)) {\n    for (i = length; i-- > 0;) {\n      if (list[i] === listener ||\n          (list[i].listener && list[i].listener === listener)) {\n        position = i;\n        break;\n      }\n    }\n\n    if (position < 0)\n      return this;\n\n    if (list.length === 1) {\n      list.length = 0;\n      delete this._events[type];\n    } else {\n      list.splice(position, 1);\n    }\n\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n  var key, listeners;\n\n  if (!this._events)\n    return this;\n\n  // not listening for removeListener, no need to emit\n  if (!this._events.removeListener) {\n    if (arguments.length === 0)\n      this._events = {};\n    else if (this._events[type])\n      delete this._events[type];\n    return this;\n  }\n\n  // emit removeListener for all listeners on all events\n  if (arguments.length === 0) {\n    for (key in this._events) {\n      if (key === 'removeListener') continue;\n      this.removeAllListeners(key);\n    }\n    this.removeAllListeners('removeListener');\n    this._events = {};\n    return this;\n  }\n\n  listeners = this._events[type];\n\n  if (isFunction(listeners)) {\n    this.removeListener(type, listeners);\n  } else if (listeners) {\n    // LIFO order\n    while (listeners.length)\n      this.removeListener(type, listeners[listeners.length - 1]);\n  }\n  delete this._events[type];\n\n  return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n  var ret;\n  if (!this._events || !this._events[type])\n    ret = [];\n  else if (isFunction(this._events[type]))\n    ret = [this._events[type]];\n  else\n    ret = this._events[type].slice();\n  return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n  if (this._events) {\n    var evlistener = this._events[type];\n\n    if (isFunction(evlistener))\n      return 1;\n    else if (evlistener)\n      return evlistener.length;\n  }\n  return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n  return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/events/events.js\n ** module id = 250\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/events/events.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper = __webpack_require__(13);\n\nvar _BaseHelper2 = _interopRequireDefault(_BaseHelper);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\n//TODO: make this into a mesh / geometry subclass\n*/\nvar ArcHelper = function ArcHelper(options) {\n  _BaseHelper2.default.call(this);\n\n  var options = options || {};\n\n  var position = options.position || new _three2.default.Vector3();\n\n  var direction = this.direction = options.direction || new _three2.default.Vector3();\n  this.color = options.color !== undefined ? options.color : "#000";\n\n  this.textBgColor = options.textBgColor !== undefined ? options.textBgColor : "#ffd200";\n  this.mode = options.mode !== undefined ? options.mode : "line"; //line, outline, or filled\n\n  this.arrowsLength = options.arrowsLength !== undefined ? options.arrowsLength : 4;\n  this.arrowColor = options.arrowColor !== undefined ? options.arrowColor : 0x000000;\n  this.drawLeftArrow = options.drawLeftArrow !== undefined ? options.drawLeftArrow : true;\n  this.drawRightArrow = options.drawRightArrow !== undefined ? options.drawRightArrow : true;\n  this.arrowHeadWidth = 1;\n\n  this.outerRadius = 0;\n  this.innerRadius = 0;\n  this.startAngle = 0;\n  this.endAngle = 0;\n\n  this.start = new _three2.default.Vector3();\n  this.mid = new _three2.default.Vector3();\n  this.end = new _three2.default.Vector3();\n  this.origin = new _three2.default.Vector3();\n\n  this.leftArrow = new _three2.default.ArrowHelper(new _three2.default.Vector3(1, 0, 0), this.start, 15, this.arrowColor);\n  //this.leftArrow.hide();\n  this.add(this.leftArrow);\n\n  this.rightArrow = new _three2.default.ArrowHelper(new _three2.default.Vector3(-1, 0, 0), this.end, 15, this.arrowColor);\n  //this.rightArrow.hide();\n  this.add(this.rightArrow);\n\n  var defaultMaterial = new _three2.default.MeshBasicMaterial({ color: this.textBgColor,\n    depthTest: false, depthWrite: false, side: _three2.default.DoubleSide });\n  this.material = options.material !== undefined ? options.material : defaultMaterial;\n\n  this.lineMaterial = new _GizmoMaterial.GizmoLineMaterial({ color: 0x000000, depthTest: false, depthWrite: false, opacity: 0.4, transparent: true, linewidth: 2 });\n\n  //this.setRadius(this.radius);\n  this._generate();\n};\n\nArcHelper.prototype = Object.create(_BaseHelper2.default.prototype);\nArcHelper.prototype.constructor = ArcHelper;\n\nArcHelper.prototype._generate = function () {\n\n  if (this.arcLine) this.remove(this.arcLine);\n\n  //points.vertices.shift();\n  if (this.mode == "line") {\n    var curve = new _three2.default.QuadraticBezierCurve3(this.start, this.mid, this.end);\n    var geometry = new _three2.default.Geometry();\n    geometry.vertices = curve.getPoints(50);\n    geometry.computeLineDistances();\n\n    this.arcLine = new _three2.default.Line(geometry, this.lineMaterial);\n\n    //TODO: auto set arrow positon;\n    /*var arrowsSizeRadians = this.arrowSize * Math.PI/180;\n    if(arrowsSizeRadians*2 > this.start.angleTo( this.end ) )\n    {\n    \n    \n    }*/\n    //this.origin;\n    //var offsetPoint = curve.getPointAt( this.arrowsLength );\n    var midToEnd = this.end.clone().sub(this.mid);\n    midToEnd.normalize();\n    var rightArrowStart = this.end.clone().sub(midToEnd.clone().multiplyScalar(this.arrowsLength));\n    this.rightArrow.setLength(this.arrowsLength, this.arrowsLength, this.arrowHeadWidth);\n    this.rightArrow.setDirection(midToEnd);\n    this.rightArrow.position.copy(rightArrowStart);\n\n    var midToStart = this.start.clone().sub(this.mid);\n    midToStart.normalize();\n    var leftArrowStart = this.start.clone().sub(midToStart.clone().multiplyScalar(this.arrowsLength));\n    this.leftArrow.setLength(this.arrowsLength, this.arrowsLength, this.arrowHeadWidth);\n    this.leftArrow.setDirection(midToStart);\n    this.leftArrow.position.copy(leftArrowStart);\n  } else {\n    var circleShape = new _three2.default.Shape();\n    circleShape.absarc(0, 0, this.outerRadius, this.start, this.end, true);\n    circleShape.absarc(0, 0, this.innerRadius, this.start, this.end, false);\n    var points = circleShape.createPointsGeometry();\n  }\n\n  /*\n  else if(this.mode == "outline"){\n    this.arcLine = new THREE.Line( points, this.lineMaterial );\n  }\n  else if(this.mode == "filled"){\n    var filledArcGeometry = new THREE.ShapeGeometry( circleShape, {curveSegments:30} );\n    this.arcLine = new THREE.Mesh( filledArcGeometry, this.material );\n    this.arcLine.renderDepth = 1e20;\n  }*/\n\n  this.add(this.arcLine);\n};\n\nArcHelper.prototype.setRadius = function (radius) {\n\n  /*var circleRadius = this.radius = radius;; \n  var circleShape = new THREE.Shape();\n  circleShape.moveTo( 0, 0 );\n  circleShape.absarc( 0, 0, circleRadius, 0, Math.PI*2, false );\n  var points  = circleShape.createSpacedPointsGeometry( 100 );\n  \n  if(this.rCircle) this.remove( this.rCircle );\n  \n  this.rCircle = new THREE.Line(points, this.material );\n  this.add( this.rCircle );*/\n};\n\nArcHelper.prototype.setOrigin = function (origin) {\n  this.origin = origin;\n  this._generate();\n};\n\nArcHelper.prototype.setStart = function (start) {\n  this.start = start;\n  this._generate();\n};\n\nArcHelper.prototype.setMid = function (mid) {\n  this.mid = mid;\n  this._generate();\n};\n\nArcHelper.prototype.setEnd = function (end) {\n  this.end = end;\n  this._generate();\n};\n\nArcHelper.prototype.setStartAngle = function (startAngle) {\n  this.startAngle = startAngle;\n  this._generate();\n};\n\nArcHelper.prototype.setEndAngle = function (endAngle) {\n  this.endAngle = endAngle;\n  this._generate();\n};\n\nArcHelper.prototype.setOuterRadius = function (outerRadius) {\n  this.outerRadius = outerRadius;\n  this._generate();\n};\n\nArcHelper.prototype.setInnerRadius = function (innerRadius) {\n  this.innerRadius = innerRadius;\n  this._generate();\n};\n\nexports.default = ArcHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/ArcHelper.js\n ** module id = 251\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/ArcHelper.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n			value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ArrowHelper = (function (_THREE$Object3D) {\n			_inherits(ArrowHelper, _THREE$Object3D);\n\n			function ArrowHelper(direction, origin, length, color, headLength, headRadius, headColor) {\n						_classCallCheck(this, ArrowHelper);\n\n						var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ArrowHelper).call(this));\n\n						_this.direction = direction || new _three2.default.Vector3(1, 0, 0);\n						_this.origin = origin || new _three2.default.Vector3(0, 0, 0);\n						_this.length = length || 50;\n						_this.color = color || "#FF0000";\n						_this.headLength = headLength || 6;\n						_this.headRadius = headRadius || headLength / 7;\n						_this.headColor = headColor || _this.color;\n\n						//dir, origin, length, hex\n						var lineGeometry = new _three2.default.Geometry();\n						lineGeometry.vertices.push(_this.origin);\n						lineGeometry.vertices.push(_this.direction.setLength(_this.length));\n						_this.line = new _three2.default.Line(lineGeometry, new _three2.default.LineBasicMaterial({ color: _this.color }));\n						_this.add(_this.line);\n\n						_this.arrowHeadRootPosition = _this.origin.clone().add(_this.direction);\n						_this.head = new _three2.default.Mesh(new _three2.default.CylinderGeometry(0, _this.headRadius, _this.headLength, 8, 1, false), new _three2.default.MeshBasicMaterial({ color: _this.headColor }));\n						_this.head.position.copy(_this.arrowHeadRootPosition);\n\n						_this.head.lookAt(_this.arrowHeadRootPosition.clone().add(_this.direction.clone().setLength(_this.headLength)));\n						_this.head.rotateX(Math.PI / 2);\n\n						_this.add(_this.head);\n						return _this;\n			}\n\n			return ArrowHelper;\n})(_three2.default.Object3D);\n\nexports.default = ArrowHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/ArrowHelper.js\n ** module id = 252\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/ArrowHelper.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/**\nBased on ArrowHelper by : \n * @author WestLangley / http://github.com/WestLangley\n * @author zz85 / http://github.com/zz85\n * @author bhouston / http://exocortex.com\n *\n * Creates an arrow for visualizing directions\n *\n * Parameters:\n *  dir - Vector3\n *  origin - Vector3\n *  length - Number\n *  color - color in hex value\n *  headLength - Number\n *  headWidth - Number\n */\n\nvar ArrowHelper = (function (_THREE$Object3D) {\n  _inherits(ArrowHelper, _THREE$Object3D);\n\n  function ArrowHelper(dir, origin, length, color, headLength, headWidth, headType) {\n    _classCallCheck(this, ArrowHelper);\n\n    var lineGeometry = new _three2.default.Geometry();\n    lineGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 1, 0));\n\n    var headGeometry = new _three2.default.CylinderGeometry(0, 0.5, 1, 5, 1);\n    headGeometry.applyMatrix(new _three2.default.Matrix4().makeTranslation(0, -0.5, 0));\n\n    // dir is assumed to be normalized\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ArrowHelper).call(this));\n\n    if (color === undefined) color = 0xffff00;\n    if (length === undefined) length = 1;\n    if (headLength === undefined) headLength = 0.2 * length;\n    if (headWidth === undefined) headWidth = 0.2 * headLength;\n    if (headType) {\n      switch (headType) {\n        case "sphere":\n          headGeometry = new _three2.default.SphereGeometry(0.5, 32, 32);\n          headGeometry.applyMatrix(new _three2.default.Matrix4().makeTranslation(0, -0.5, 0));\n          headLength = headWidth;\n          break;\n        case "arrowOutline":\n          var arrowShape = new _three2.default.Shape();\n          arrowShape.moveTo(-headWidth / 2, 0);\n          arrowShape.lineTo(0, -headLength);\n          arrowShape.lineTo(headWidth / 2, 0);\n          arrowShape.lineTo(headWidth / 2, 0);\n          headGeometry = new _three2.default.ShapeGeometry(arrowShape);\n          //let textBorderOutline = new THREE.Line( textBorderGeom, material )\n          break;\n\n      }\n    }\n\n    _this.position.copy(origin);\n\n    _this.line = new _three2.default.Line(lineGeometry, new _three2.default.LineBasicMaterial({ color: color }));\n    _this.line.matrixAutoUpdate = false;\n    _this.add(_this.line);\n\n    _this.head = new _three2.default.Mesh(headGeometry, new _three2.default.MeshBasicMaterial({ color: color }));\n    _this.head.matrixAutoUpdate = false;\n    _this.add(_this.head);\n\n    _this.setDirection(dir);\n    _this.setLength(length, headLength, headWidth);\n    return _this;\n  }\n\n  _createClass(ArrowHelper, [{\n    key: "setDirection",\n    value: function setDirection(dir) {\n      var axis = new _three2.default.Vector3();\n      var radians;\n      // dir is assumed to be normalized\n\n      if (dir.y > 0.99999) {\n\n        this.quaternion.set(0, 0, 0, 1);\n      } else if (dir.y < -0.99999) {\n\n        this.quaternion.set(1, 0, 0, 0);\n      } else {\n\n        axis.set(dir.z, 0, -dir.x).normalize();\n\n        radians = Math.acos(dir.y);\n\n        this.quaternion.setFromAxisAngle(axis, radians);\n      }\n    }\n  }, {\n    key: "setLength",\n    value: function setLength(length, headLength, headWidth) {\n      if (headLength === undefined) headLength = 0.2 * length;\n      if (headWidth === undefined) headWidth = 0.2 * headLength;\n\n      this.line.scale.set(1, length - headLength, 1);\n      this.line.updateMatrix();\n\n      this.head.scale.set(headWidth, headLength, headWidth);\n      this.head.position.y = length;\n      this.head.updateMatrix();\n    }\n  }, {\n    key: "setColor",\n    value: function setColor(color) {\n      this.line.material.color.set(color);\n      this.head.material.color.set(color);\n    }\n  }]);\n\n  return ArrowHelper;\n})(_three2.default.Object3D);\n\nexports.default = ArrowHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/ArrowHelper2.js\n ** module id = 253\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/ArrowHelper2.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.LabeledGrid = exports.CircularLabeledGrid = undefined;\n\nvar _CircularLabeledGrid = __webpack_require__(266);\n\nvar _CircularLabeledGrid2 = _interopRequireDefault(_CircularLabeledGrid);\n\nvar _LabeledGrid = __webpack_require__(81);\n\nvar _LabeledGrid2 = _interopRequireDefault(_LabeledGrid);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*module.exports ={\n  CircularLabeledGrid: require('./grids/CircularLabeledGrid'),\n  LabeledGrid: require('./grids/LabeledGrid')\n}*/\n\nexports.CircularLabeledGrid = _CircularLabeledGrid2.default;\nexports.LabeledGrid = _LabeledGrid2.default;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/Grids.js\n ** module id = 254\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/Grids.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _ArrowHelper = __webpack_require__(252);\n\nvar _ArrowHelper2 = _interopRequireDefault(_ArrowHelper);\n\nvar _LabelHelper = __webpack_require__(39);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar LabeledAxes = (function (_THREE$Object3D) {\n  _inherits(LabeledAxes, _THREE$Object3D);\n\n  function LabeledAxes(options) {\n    _classCallCheck(this, LabeledAxes);\n\n    /*const DEFAULTS = {\n      name : "",\n      debug:false\n    }\n    let options = Object.assign({}, DEFAULTS, options); \n    super(options);\n    \n    Object.assign(this, options);*/\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LabeledAxes).call(this));\n\n    var options = options || {};\n    _this.size = options.size !== undefined ? options.size : 50;\n    _this.xColor = options.xColor !== undefined ? options.xColor : "#FF7700";\n    _this.yColor = options.yColor !== undefined ? options.yColor : "#77FF00";\n    _this.zColor = options.zColor !== undefined ? options.zColor : "#0077FF";\n\n    _this.fontSize = options.fontSize !== undefined ? options.fontSize : 8;\n    _this.textColor = options.textColor !== undefined ? options.textColor : "#000";\n    _this.fontFace = options.fontFace !== undefined ? options.fontFace : "Jura";\n    _this.arrowSize = options.arrowSize !== undefined ? options.arrowSize : 3;\n\n    var addLabels = options.addLabels !== undefined ? options.addLabels : true;\n    var addArrows = options.addArrows !== undefined ? options.addArrows : true;\n\n    _this.xColor = new _three2.default.Color(_this.xColor);\n    _this.yColor = new _three2.default.Color(_this.yColor);\n    _this.zColor = new _three2.default.Color(_this.zColor);\n\n    if (addLabels == true) {\n      var s = _this.size;\n      var fontSize = _this.fontSize;\n\n      var textOptions = {\n        fontSize: _this.fontSize,\n        fontFace: _this.fontFace,\n        //fontWeight: this.fontWeight,\n        //fontStyle: this.fontStyle,\n        color: _this.textColor,\n        bgColor: _this.textBgColor,\n        highlightColor: _this.highlightColor\n      };\n\n      _this.xLabel = //this._drawText("X",fontSize);\n      new _LabelHelper.LabelHelper3d(Object.assign({ text: "X" }, textOptions));\n      _this.xLabel.position.set(s, 0, 0);\n\n      _this.yLabel = new _LabelHelper.LabelHelper3d(Object.assign({ text: "Y" }, textOptions));\n      _this.yLabel.position.set(0, s, 0);\n\n      _this.zLabel = new _LabelHelper.LabelHelper3d(Object.assign({ text: "Z" }, textOptions));\n      _this.zLabel.position.set(0, 0, s);\n    }\n    if (addArrows == true) {\n      s = _this.size / 1.25; // THREE.ArrowHelper arrow length\n      _this.xArrow = new _ArrowHelper2.default(new _three2.default.Vector3(1, 0, 0), new _three2.default.Vector3(0, 0, 0), s, _this.xColor, _this.arrowSize);\n      _this.yArrow = new _ArrowHelper2.default(new _three2.default.Vector3(0, 1, 0), new _three2.default.Vector3(0, 0, 0), s, _this.yColor, _this.arrowSize);\n      _this.zArrow = new _ArrowHelper2.default(new _three2.default.Vector3(0, 0, 1), new _three2.default.Vector3(0, 0, 0), s, _this.zColor, _this.arrowSize);\n      _this.add(_this.xArrow);\n      _this.add(_this.yArrow);\n      _this.add(_this.zArrow);\n    } else {\n      _this._buildAxes();\n    }\n\n    _this.add(_this.xLabel);\n    _this.add(_this.yLabel);\n    _this.add(_this.zLabel);\n    _this.name = "axes";\n\n    //Make sure arrows are always visible (through objects)\n    //not working in all cases ?\n    _this.xArrow.line.material.depthTest = false;\n    _this.xArrow.head.material.depthTest = false;\n\n    _this.yArrow.line.material.depthTest = false;\n    _this.yArrow.head.material.depthTest = false;\n\n    _this.zArrow.line.material.depthTest = false;\n    _this.zArrow.head.material.depthTest = false;\n    return _this;\n  }\n\n  _createClass(LabeledAxes, [{\n    key: \'toggle\',\n    value: function toggle(_toggle) {\n      //apply visibility settings to all children\n      this.traverse(function (child) {\n        child.visible = _toggle;\n      });\n    }\n  }, {\n    key: \'_buildAxes\',\n    value: function _buildAxes() {\n\n      lineGeometryX = new _three2.default.Geometry();\n      lineGeometryX.vertices.push(new _three2.default.Vector3(-this.size, 0, 0));\n      lineGeometryX.vertices.push(new _three2.default.Vector3(this.size, 0, 0));\n      xLine = new _three2.default.Line(lineGeometryX, new _three2.default.LineBasicMaterial({ color: this.xColor }));\n\n      lineGeometryY = new _three2.default.Geometry();\n      lineGeometryY.vertices.push(new _three2.default.Vector3(0, -this.size, 0));\n      lineGeometryY.vertices.push(new _three2.default.Vector3(0, this.size, 0));\n      yLine = new _three2.default.Line(lineGeometryY, new _three2.default.LineBasicMaterial({ color: this.yColor }));\n\n      lineGeometryZ = new _three2.default.Geometry();\n      lineGeometryZ.vertices.push(new _three2.default.Vector3(0, 0, -this.size));\n      lineGeometryZ.vertices.push(new _three2.default.Vector3(0, 0, this.size));\n      zLine = new _three2.default.Line(lineGeometryZ, new _three2.default.LineBasicMaterial({ color: this.zColor }));\n\n      this.add(xLine);\n      this.add(yLine);\n      this.add(zLine);\n    }\n  }, {\n    key: \'_drawText\',\n    value: function _drawText(text, fontSize, fontFace, textColor, background, scale) {\n      var fontSize = fontSize || 18;\n      var fontFace = fontFace || "Arial";\n      var textColor = textColor || "#000000";\n      var background = background || false;\n      var scale = scale || 1.0;\n\n      var canvas = document.createElement(\'canvas\');\n      var context = canvas.getContext(\'2d\');\n      context.font = "Bold " + fontSize + "px " + fontFace;\n\n      // get size data (height depends only on font size)\n      var metrics = context.measureText(text);\n      var textWidth = metrics.width;\n\n      // text color\n      context.strokeStyle = textColor;\n      context.fillStyle = textColor;\n      context.fillText(text, canvas.width / 2, canvas.height / 2);\n      //context.strokeText(text, canvas.width/2, canvas.height/2)\n\n      // canvas contents will be used for a texture\n      var texture = new _three2.default.Texture(canvas);\n      texture.needsUpdate = true;\n\n      var spriteMaterial = new _three2.default.SpriteMaterial({ map: texture, useScreenCoordinates: false, color: 0xffffff });\n      spriteMaterial.depthTest = false;\n      //spriteMaterial.renderDepth = 1e20\n\n      var sprite = new _three2.default.Sprite(spriteMaterial);\n      sprite.scale.set(100 * scale, 50 * scale, 1.0);\n      return sprite;\n    }\n  }]);\n\n  return LabeledAxes;\n})(_three2.default.Object3D);\n\n//module.exports = LabeledAxes;\n//weird issues with export: apparently browserify sets a "is_es_Module" flag\n\nexports.default = LabeledAxes;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/LabeledAxes.js\n ** module id = 255\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/LabeledAxes.js?');
},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n//TODO:should inherit from THREE.MESH, but some weird stuff going on\n\nvar LineHelper = (function (_BaseHelper) {\n  _inherits(LineHelper, _BaseHelper);\n\n  function LineHelper(options) {\n    _classCallCheck(this, LineHelper);\n\n    var DEFAULTS = {\n      start: new _three2.default.Vector3(),\n      end: new _three2.default.Vector3(),\n      length: 0,\n\n      lineWidth: 1,\n      color: "#000"\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LineHelper).call(this, options));\n\n    Object.assign(_this, options);\n\n    console.log("LINE", _this.lineWidth);\n    _this.material = new _GizmoMaterial.GizmoLineMaterial({\n      lineWidth: _this.lineWidth,\n      color: _this.color,\n      opacity: 0.4,\n      transparent: true,\n      highlightColor: _this.highlightColor });\n    _this._updateGeometry();\n    //super( this._geometry, this._material ) \n    return _this;\n  }\n\n  _createClass(LineHelper, [{\n    key: "_makeGeometry",\n    value: function _makeGeometry() {\n      if (!this.start || !this.end) return;\n      this._geometry = new _three2.default.Geometry();\n\n      this._geometry.vertices.push(this.start);\n      this._geometry.vertices.push(this.end);\n      /**/\n    }\n  }, {\n    key: "_updateGeometry",\n    value: function _updateGeometry() {\n      /*this.geometry.dynamic = true\n      this.geometry.vertices[0] = this.start \n      this.geometry.vertices[1] = this.end \n      this.geometry.verticesNeedUpdate = true*/\n\n      if (!this.start || !this.end) return;\n      var geometry = new _three2.default.Geometry();\n\n      geometry.vertices.push(this.start);\n      geometry.vertices.push(this.end);\n\n      if (this.line) this.remove(this.line);\n      this.line = new _three2.default.Line(geometry, this.material);\n      this.add(this.line);\n    }\n  }, {\n    key: "setStart",\n    value: function setStart(start) {\n      this.start = start || new _three2.default.Vector3();\n      this._updateGeometry();\n    }\n  }, {\n    key: "setEnd",\n    value: function setEnd(end) {\n      this.end = end || new _three2.default.Vector3();\n      this._updateGeometry();\n    }\n  }, {\n    key: "setLength",\n    value: function setLength(length) {\n      this.length = length || 0;\n      this.end = this.end.clone().sub(this.start).setLength(this.length);\n      this._updateGeometry();\n    }\n  }]);\n\n  return LineHelper;\n})(_BaseHelper3.default);\n\nmodule.exports = LineHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/LineHelper.js\n ** module id = 256\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/LineHelper.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nmodule.exports = {\n  ImagePlane: __webpack_require__(269),\n  MirrorPlane: __webpack_require__(271),\n  ShadowPlane: __webpack_require__(272)\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/Planes.js\n ** module id = 257\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/Planes.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _AnnotationVisual = __webpack_require__(22);\n\nvar _AnnotationVisual2 = _interopRequireDefault(_AnnotationVisual);\n\nvar _CrossHelper = __webpack_require__(17);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _LabelHelper = __webpack_require__(39);\n\nvar _SizeHelper = __webpack_require__(40);\n\nvar _SizeHelper2 = _interopRequireDefault(_SizeHelper);\n\nvar _ArcHelper = __webpack_require__(251);\n\nvar _ArcHelper2 = _interopRequireDefault(_ArcHelper);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction AngleVisual(options) {\n  _AnnotationVisual2.default.call(this);\n  var options = options || {};\n  //Todo : auto adjust arrows : if not enough space, arrows shoud be outside\n  this.up = new _three2.default.Vector3(0, 0, 1);\n\n  var DEFAULTS = {\n    angle: 0 //in degrees , not radians\n    , direction: new _three2.default.Vector3(1, 0, 0) //should this be oposite angle ?\n\n    , textBgColor: "#ffd200",\n    textColor: "#ff0077",\n    centerColor: "#F00",\n    crossColor: "#F00",\n\n    tolerance: 0 //FIXME: this needs to be in all of the numerical measurement or not ?\n\n    , drawSideLines: true,\n    sideLength: 3,\n    sideLengthExtra: 3,\n    leftArrow: true,\n    rightArrow: true,\n    arrowHeadSize: 4\n  };\n\n  options = Object.assign({}, DEFAULTS, options);\n\n  //var text      = options.text      !== undefined? options.text   : angle.toFixed(precision) + ""//coerce as str\n  //this.labelType  = options.labelType!== undefined ? options.labelType : "frontFacing"\n\n  this.radius = 20;\n\n  //initialise internal sub objects\n  this.startCross = new _CrossHelper2.default({ color: 0xFF0000, size: 5 });\n  this.startCross.hide();\n  this.add(this.startCross);\n\n  this.midCross = new _CrossHelper2.default({ color: 0x0000FF, size: 5 });\n  this.midCross.hide();\n  this.add(this.midCross);\n\n  this.endCross = new _CrossHelper2.default({ color: 0x00FF00, size: 5 });\n  this.endCross.hide();\n  this.add(this.endCross);\n\n  //TODO: this is too specific, needs a wrapper\n  this.label = new _LabelHelper.LabelHelperPlane({ text: "", fontSize: this.fontSize, bgColor: this.textBgColor });\n  this.label.hide();\n  this.add(this.label);\n  //this.setLabelType()\n\n  //line from start to mid\n  this.startMidLine = new _SizeHelper2.default({ drawLeftArrow: false, arrowsPlacement: "inside",\n    drawLabel: false, arrowColor: this.arrowColor,\n    linesColor: this.arrowColor,\n    textBgColor: this.textBgColor, textColor: this.textColor, labelType: this.labelType });\n  this.startMidLine.hide();\n  this.add(this.startMidLine);\n\n  //line from mid to end\n  this.midEndLine = new _SizeHelper2.default({\n    drawRightArrow: false,\n    arrowsPlacement: "inside",\n    drawLabel: false,\n    arrowColor: this.arrowColor,\n    linesColor: this.arrowColor,\n    textBgColor: this.textBgColor,\n    textColor: this.textColor,\n    labelType: this.labelType });\n\n  this.midEndLine.hide();\n  this.add(this.midEndLine);\n  this.add(this.midEndLine);\n\n  this.arc = new _ArcHelper2.default({ textBgColor: this.textBgColor });\n  this.arc.hide();\n  this.add(this.arc);\n\n  this.start = options.start !== undefined ? options.start : undefined;\n  this.startObject = options.startObject !== undefined ? options.startObject : undefined;\n  this.mid = options.mid !== undefined ? options.mid : undefined;\n  this.midObject = options.midObject !== undefined ? options.midObject : undefined;\n  this.end = options.end !== undefined ? options.end : undefined;\n  this.endObject = options.endObject !== undefined ? options.endObject : undefined;\n\n  this.angle = options.angle * Math.PI / 180;\n\n  if (options.start) this.setStart(this.start, this.startObject);\n  if (options.mid) this.setMid(this.mid, this.midObject);\n  if (options.end) this.setEnd(this.end, this.endObject);\n\n  this.setAsSelectionRoot(true);\n}\n\nAngleVisual.prototype = Object.create(_AnnotationVisual2.default.prototype);\nAngleVisual.prototype.constructor = AngleVisual;\n\nAngleVisual.prototype.setStart = function (start, object) {\n  this.start = start;\n  this.startObject = object;\n\n  this.startCross.position.copy(this.start);\n  this.startCross.show();\n\n  this.startMidLine.setStart(this.start);\n};\n\nAngleVisual.prototype.setMid = function (mid, object) {\n  this.mid = mid;\n  this.midObject = object;\n\n  this.midCross.position.copy(this.mid);\n  this.midCross.show();\n\n  this.startMidLine.setEnd(this.mid);\n  this.startMidLine.show();\n\n  this.midEndLine.setStart(this.mid);\n};\n\nAngleVisual.prototype.setEnd = function (end, object) {\n  this.end = end;\n  this.endObject = object;\n\n  this.endCross.position.copy(this.end);\n  this.endCross.show();\n\n  this.midEndLine.setEnd(this.end);\n  this.midEndLine.show();\n\n  //EXPERIMENTAL\n  //draw arc\n  //get the plane from the 3 points\n  this.opositeAngle = false;\n  this.debug = false;\n  if (this.opositeAngle) {\n    this.angle = Math.PI * 2 - this.angle;\n  }\n  var angle = this.angle;\n  var plane = new _three2.default.Plane().setFromCoplanarPoints(this.end, this.mid, this.start);\n\n  var midToStart = this.start.clone().sub(this.mid);\n  var midToEnd = this.end.clone().sub(this.mid);\n  var midToStartDir = midToStart.clone().normalize();\n  var midToEndDir = midToEnd.clone().normalize();\n\n  var side = midToEnd;\n  var sideLength = side.length();\n  //offset start is a point on the vector mid -> start that is a far away from mid as end is\n  var offsetStart = midToStartDir.clone().multiplyScalar(sideLength);\n  offsetStart.add(this.mid);\n  var endToOffsetStart = this.end.clone().sub(offsetStart);\n\n  var radius = midToEnd.length();\n  var arcOuterRadius = radius / 1.5;\n  var arcInnerRadius = radius / 2;\n\n  //console.log("start", this.start, "offsetStart", offsetStart, "end", this.end)\n\n  //first parallel is :\n  //endToOffsetStart\n  //make a second, going through mid\n  var paral = endToOffsetStart.clone().normalize(); //.add( this.mid )\n  paral = new _three2.default.Vector3(0, -1, 0);\n  var midToStartAngle = paral.angleTo(midToStart);\n  //console.log("midToStartAngle",midToStartAngle*180/Math.PI)\n\n  var arcAngle = this.angle;\n  var arcAngleStart = -Math.PI / 2 + midToStartAngle;\n  var arcAngleEnd = arcAngleStart + arcAngle;\n\n  //console.log("Start Angle (rad/deg)", arcAngleStart, (arcAngleStart*180/Math.PI).toFixed(2) )\n  //console.log("End   Angle (rad/deg)",   arcAngleEnd,  (arcAngleEnd*180/Math.PI).toFixed(2) )\n  var arcCenter = this.end.clone().sub(offsetStart).divideScalar(2).add(offsetStart);\n  var direction = arcCenter.clone().sub(this.mid).normalize();\n  if (this.opositeAngle) {\n    direction.negate();\n  }\n  var offsetMid = this.mid.clone().add(direction.multiplyScalar(radius));\n\n  /*this.arc.setStart( arcAngleStart )\n  this.arc.setEnd( arcAngleEnd )\n  this.arc.setOuterRadius( arcOuterRadius )\n  this.arc.setInnerRadius( arcInnerRadius )*/\n  this.arc.setStart(offsetStart);\n  this.arc.setMid(offsetMid);\n  this.arc.setEnd(this.end);\n\n  this.arc.show();\n\n  // some methods to create and draw great circles on a sphere\n\n  this.label.setText((this.angle * 180 / Math.PI).toFixed(2));\n  this.label.position.copy(arcCenter);\n  this.label.show();\n\n  if (this.debug) {\n    this.debugHelpers = new _three2.default.Object3D();\n    //this.debugHelpers.add( new THREE.ArrowHelper(direction,this.mid,20,0XFF0000) )\n    this.debugHelpers.add(new _CrossHelper2.default({ position: offsetStart, color: 0xFF00FF }));\n    //this.debugHelpers.add( new CrossHelper({position:this.start,color:0x0000FF} ) )\n\n    this.debugHelpers.add(new _CrossHelper2.default({ position: arcCenter, color: 0x0000FF }));\n    this.debugHelpers.add(new _three2.default.ArrowHelper(plane.normal, arcCenter, 20, 0XFF0000));\n    this.debugHelpers.add(new _three2.default.ArrowHelper(midToStartDir, this.mid, 20, 0XFF0000));\n\n    this.debugHelpers.add(new _three2.default.ArrowHelper(paral, this.mid, 20, 0XFFFF00));\n    this.debugHelpers.add(new _three2.default.ArrowHelper(endToOffsetStart.clone().normalize(), offsetStart, 20, 0XFFFF00));\n\n    this.add(this.debugHelpers);\n  }\n};\n\nAngleVisual.prototype.set = function () {\n  var angleStart = 0.3;\n  var radius = this.radius;\n  var angle = this.angle;\n\n  var startSideLineOrientation = new _three2.default.Vector3(1, 0, 0);\n  var arcMidOrientation = new _three2.default.Vector3(1, 0, 0);\n  var endSideLineOrientation = new _three2.default.Vector3(1, 0, 0);\n\n  var matrix = new _three2.default.Matrix4().makeRotationAxis(new _three2.default.Vector3(0, 0, 1), angleStart);\n  startSideLineOrientation.applyMatrix4(matrix);\n\n  matrix = new _three2.default.Matrix4().makeRotationAxis(new _three2.default.Vector3(0, 0, 1), angleStart + angle / 2);\n  arcMidOrientation.applyMatrix4(matrix);\n\n  matrix = new _three2.default.Matrix4().makeRotationAxis(new _three2.default.Vector3(0, 0, 1), angleStart + angle);\n  endSideLineOrientation.applyMatrix4(matrix);\n\n  var lineMaterial = new _three2.default.LineBasicMaterial({ color: this.linesColor, linewidth: 1, depthTest: false, depthWrite: false, renderDepth: 1e20, opacity: 0.8, transparent: true });\n\n  var startPos = startSideLineOrientation.clone().multiplyScalar(radius);\n  var endPos = endSideLineOrientation.clone().multiplyScalar(radius);\n\n  if (this.drawSideLines) {\n    var startSLPos = startSideLineOrientation.clone().multiplyScalar(radius - this.sideLength / 2);\n    var startSLPos2 = startSideLineOrientation.clone().multiplyScalar(radius + this.sideLength / 2 + this.sideLengthExtra);\n\n    var sideLineGeometry = new _three2.default.Geometry();\n    sideLineGeometry.vertices.push(startSLPos);\n    sideLineGeometry.vertices.push(startSLPos2);\n\n    var startSideLine = new _three2.default.Line(sideLineGeometry, lineMaterial);\n\n    var endSLPos = endSideLineOrientation.clone().multiplyScalar(radius - this.sideLength / 2);\n    var endSLPos2 = endSideLineOrientation.clone().multiplyScalar(radius + this.sideLength / 2 + this.sideLengthExtra);\n    //FIXME: perhaps do this with just a matrix transform (rotate by angle, translate by radius, of original startLineGeometry)\n    var sideLineGeometry = new _three2.default.Geometry();\n    sideLineGeometry.vertices.push(endSLPos);\n    sideLineGeometry.vertices.push(endSLPos2);\n\n    var endSideLine = new _three2.default.Line(sideLineGeometry, lineMaterial);\n\n    this.startSideLine = startSideLine;\n    this.endSideLine = endSideLine;\n    this.add(startSideLine);\n    this.add(endSideLine);\n  }\n\n  var leftArrowDir = new _three2.default.Vector3(1, 0, 0);\n  var rightArrowDir = new _three2.default.Vector3(-1, 0, 0);\n  var leftArrowPos = new _three2.default.Vector3().copy(startPos); //0,sideLength,0)\n  var rightArrowPos = new _three2.default.Vector3().copy(endPos); //0,sideLength,0)\n  var arrowHeadSize = 4;\n  var arrowSize = arrowHeadSize; //length/2\n\n  var arcMidPosition = arcMidOrientation.clone().multiplyScalar(radius);\n\n  //sin(ang/2) = (arrowHeadSize/2) / radius\n  //ang/2 = asin( (arrowHeadSize/2) / radius )\n  var cBase = arrowHeadSize / 2 / radius;\n  var fooAngle = Math.asin(cBase);\n  //cBase = Math.sin(fooAngle) * radius\n  var cHeight = Math.cos(fooAngle) * radius;\n\n  var blaOrient = new _three2.default.Vector3(1, 0, 0);\n  var matrix = new _three2.default.Matrix4().makeRotationAxis(new _three2.default.Vector3(0, 0, 1), angleStart + fooAngle * 2);\n  blaOrient.applyMatrix4(matrix);\n  leftArrowPos = blaOrient.clone().multiplyScalar(radius);\n  //var leftADirTest = Math.cos(angle/2)*radius\n  leftArrowDir = startPos.clone().sub(leftArrowPos);\n\n  var leftArrowHeadSize = rightArrowHeadSize = 0;\n  if (this.leftArrow) leftArrowHeadSize = arrowHeadSize;\n  if (this.rightArrow) rightArrowHeadSize = arrowHeadSize;\n  //direction, origin, length, color, headLength, headRadius, headColor\n  var mainArrowLeft = new _three2.default.ArrowHelper(leftArrowDir, leftArrowPos, arrowSize, this.arrowColor, leftArrowHeadSize, 2);\n  var mainArrowRight = new _three2.default.ArrowHelper(rightArrowDir, rightArrowPos, arrowSize, this.arrowColor, rightArrowHeadSize, 2);\n  mainArrowLeft.scale.z = 0.1;\n  mainArrowRight.scale.z = 0.1;\n\n  this.mainArrowLeft = mainArrowLeft;\n  this.mainArrowRight = mainArrowRight;\n\n  this.add(mainArrowLeft);\n  this.add(mainArrowRight);\n\n  mainArrowLeft.line.material.linewidth = this.lineWidth;\n  mainArrowRight.line.material.linewidth = this.lineWidth;\n  mainArrowLeft.line.material.linecap = "miter";\n  mainArrowRight.line.material.linecap = "miter";\n\n  //draw arc\n  var arcGeom = new _three2.default.CircleGeometry(radius, 30, angleStart, angle);\n  arcGeom.vertices.shift();\n  this.arcLine = new _three2.default.Line(arcGeom, lineMaterial);\n  this.add(this.arcLine);\n\n  //general attributes\n  var angle = new _three2.default.Vector3(1, 0, 0).angleTo(this.direction); //new THREE.Vector3(1,0,0).cross( direction )\n  this.setRotationFromAxisAngle(this.direction, angle);\n\n  mainArrowRight.renderDepth = 1e20;\n  mainArrowRight.cone.material.depthTest = false;\n  mainArrowRight.cone.material.depthWrite = false;\n  mainArrowRight.line.material.depthTest = false;\n  mainArrowRight.line.material.depthWrite = false;\n\n  mainArrowLeft.renderDepth = 1e20;\n  mainArrowLeft.cone.material.depthTest = false;\n  mainArrowLeft.cone.material.depthWrite = false;\n  mainArrowLeft.line.material.depthTest = false;\n  mainArrowLeft.line.material.depthWrite = false;\n};\n\nAngleVisual.prototype.unset = function () {\n\n  this.label.hide();\n  this.arc.hide();\n\n  this.startCross.hide();\n  this.midCross.hide();\n  this.endCross.hide();\n\n  this.startMidLine.hide();\n  this.midEndLine.hide();\n\n  //if( this.debugHelpers ) this.remove( this.debugHelpers )\n};\n\n/*AngleVisual.prototype.setLabelType = function(){\n  \n  var degAngle = this.angle*180/Math.PI\n  this.text = new String(degAngle.toFixed(2))+"°"\n  this.remove( this.label )\n  switch(this.labelType)\n  {\n    case "flat":\n      this.label = new LabelHelperPlane({text:this.text,fontSize:this.fontSize,bgColor:this.textBgColor})\n    break\n    case "frontFacing":\n      this.label = new LabelHelper3d({text:this.text,fontSize:this.fontSize,bgColor:this.textBgColor})\n    break\n  }\n  this.label.hide()\n  this.add( this.label )\n  //this.label.position.copy( this.mid )\n}*/\n\nexports.default = AngleVisual;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/AngleVisual.js\n ** module id = 258\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/AngleVisual.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _AnnotationVisual2 = __webpack_require__(22);\n\nvar _AnnotationVisual3 = _interopRequireDefault(_AnnotationVisual2);\n\nvar _CrossHelper = __webpack_require__(17);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _CircleHelper = __webpack_require__(78);\n\nvar _CircleHelper2 = _interopRequireDefault(_CircleHelper);\n\nvar _SizeHelper = __webpack_require__(40);\n\nvar _SizeHelper2 = _interopRequireDefault(_SizeHelper);\n\nvar _LeaderLineHelper = __webpack_require__(80);\n\nvar _LeaderLineHelper2 = _interopRequireDefault(_LeaderLineHelper);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n  Helper to measure ... diameters\n  \n  Two step interactive version : \n    - place center\n    - place diameter\n*/\n\nvar DiameterVisual = (function (_AnnotationVisual) {\n  _inherits(DiameterVisual, _AnnotationVisual);\n\n  function DiameterVisual(options) {\n    _classCallCheck(this, DiameterVisual);\n\n    var DEFAULTS = {\n      diameter: 10,\n      _position: new _three2.default.Vector3(),\n      orientation: new _three2.default.Vector3(),\n      textColor: "#ff0077",\n      centerColor: "#F00",\n      crossColor: "#F00",\n\n      tolerance: 0 };\n\n    //FIXME: this needs to be in all of the numerical measurement or not ?\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DiameterVisual).call(this, options));\n\n    _this.text = options.text !== undefined ? options.text : _this.diameter.toFixed(2);\n\n    //FIXME: hack\n    /*this.textColor = "#ff0077"\n    this.arrowColor = this.textColor\n    this.centerColor = this.textColor\n    this.crossColor  = this.textColor\n    this.textBgColor = "rgba(255, 255, 255, 0)"*/\n\n    _this.lineMaterial = new _GizmoMaterial.GizmoLineMaterial({\n      color: _this.lineColor,\n      lineWidth: _this.lineWidth,\n      polygonOffset: true,\n      polygonOffsetFactor: -0.5,\n      side: _three2.default.FrontSide,\n      depthWrite: false,\n      depthTest: false,\n\n      highlightColor: _this.highlightColor\n    });\n    //depthTest:false, depthWrite:false,renderDepth : 1e20\n\n    _this.dimDisplayType = options.dimDisplayType !== undefined ? options.dimDisplayType : "offsetLine";\n    _this.centerCrossSize = 1.5;\n\n    _this.center = undefined;\n    _this.object = undefined;\n    _this.pointA = undefined;\n    _this.pointB = undefined;\n    _this.pointC = undefined;\n\n    _this._setupVisuals();\n    _this.setAsSelectionRoot(true);\n\n    if (options.center) _this.setCenter(options.center);\n    if (options.diameter) _this.setDiameter(options.diameter);\n    if (options.orientation) _this.setOrientation(options.orientation);\n\n    return _this;\n  }\n\n  _createClass(DiameterVisual, [{\n    key: "set",\n    value: function set() {\n      this.setCenter();\n      this.setDiameter();\n    }\n  }, {\n    key: "unset",\n    value: function unset() {\n\n      this.centerCross.hide();\n      this.pointACross.hide();\n      this.pointBCross.hide();\n      this.pointCCross.hide();\n\n      //this.sizeArrow.hide()\n      this.leaderLine.hide();\n\n      this.diaCircle.hide();\n\n      this.position.copy(new _three2.default.Vector3());\n      this.setOrientation(new _three2.default.Vector3(0, 0, 1));\n    }\n\n    /*configure all the basic visuals of this helper*/\n\n  }, {\n    key: "_setupVisuals",\n    value: function _setupVisuals() {\n      //initialise internal sub objects\n      this.centerCross = new _CrossHelper2.default({\n        size: this.centerCrossSize,\n        color: this.crossColor,\n        highlightColor: this.highlightColor });\n      this.centerCross.hide();\n      this.add(this.centerCross);\n\n      this.diaCircle = new _CircleHelper2.default({\n        material: this.lineMaterial,\n        highlightColor: this.highlightColor });\n      this.diaCircle.hide();\n      this.add(this.diaCircle);\n\n      /*//pointA cross\n      this.pointACross = new CrossHelper({size:this.centerCrossSize,color:this.crossColor})\n      this.pointACross.hide()\n      this.add( this.pointACross )\n       \n      //pointB cross\n      this.pointBCross = new CrossHelper({size:this.centerCrossSize,color:this.crossColor})\n      this.pointBCross.hide()\n      this.add( this.pointBCross )\n           //pointC cross\n      this.pointCCross = new CrossHelper({size:this.centerCrossSize,color:this.crossColor})\n      this.pointCCross.hide()\n      this.add( this.pointCCross )*/\n\n      /*this.sizeArrow = new SizeHelper({\n      fontSize: this.fontSize,\n      textColor: this.textColor, textBgColor:this.textBgColor, labelType:this.labelType,\n      arrowColor:this.textColor, \n      sideLineColor:this.textColor,\n      textPrefix:"∅ ",\n      })\n      this.sizeArrow.hide()\n      this.add( this.sizeArrow )*/\n\n      //TODO: add settable swtich between size helper & leader line\n      //leader line\n\n      //let text = this.text\n      var text = this.tolerance === 0 ? this.text : this.text + "±" + this.tolerance;\n      //text:"∅"+this.text+"±0.15"\n\n      this.leaderLine = new _LeaderLineHelper2.default({\n        text: text,\n        radius: this.diameter / 2,\n        fontSize: this.fontSize,\n        fontFace: this.fontFace,\n        textColor: this.textColor,\n        textBgColor: this.textBgColor,\n        labelType: this.labelType,\n        arrowColor: this.textColor,\n        linesColor: this.lineColor,\n        lineWidth: this.lineWidth,\n        highlightColor: this.highlightColor\n      });\n\n      this.leaderLine.hide();\n      this.add(this.leaderLine);\n    }\n  }, {\n    key: "setCenter",\n    value: function setCenter(center, object) {\n      if (center) this.position.copy(center);\n      if (center) this.center = center;\n      if (object) this.object = object;\n\n      this.centerCross.show();\n      //FIXME: only needed if we do not offset this whole helper for positioning on the diam\n      //this.centerCross.position.copy( this.center )\n    }\n\n    //for 3 point letiant\n\n  }, {\n    key: "setPointA",\n    value: function setPointA(pointA, object) {\n      if (pointA) this.pointA = pointA;\n      this.object = object;\n      this.pointACross.position.copy(pointA);\n      this.pointACross.show();\n    }\n  }, {\n    key: "setPointB",\n    value: function setPointB(pointB, object) {\n      if (pointB) this.pointB = pointB;\n      this.object = object;\n      this.pointBCross.position.copy(pointB);\n      this.pointBCross.show();\n    }\n  }, {\n    key: "setPointC",\n    value: function setPointC(pointC, object) {\n      if (pointC) this.pointC = pointC;\n      this.object = object;\n      this.pointCCross.position.copy(pointC);\n      this.pointCCross.show();\n\n      this.setDataFromThreePoints();\n    }\n  }, {\n    key: "setDiameter",\n    value: function setDiameter(diameter) {\n      if (!diameter && !this.diameter) {\n        return;\n      }\n      this.diameter = diameter;\n      this.text = this.diameter.toFixed(2);\n\n      //this.sizeArrow.setLength( this.diameter )\n      //this.sizeArrow.setSideLength( this.diameter/2+10 )\n\n      this.diaCircle.setRadius(this.diameter / 2);\n\n      //this.sizeArrow.show()\n      this.leaderLine.show();\n      this.diaCircle.show();\n    }\n  }, {\n    key: "setRadius",\n    value: function setRadius(radius) {\n      if (!radius && !this.diameter) {\n        return;\n      }\n      this.setDiameter(radius * 2);\n    }\n\n    /*Sets the radius/diameter from one 3d point\n    */\n\n  }, {\n    key: "setRadiusPoint",\n    value: function setRadiusPoint(point, normal) {\n      var radius = point.clone().sub(this.position).length();\n      this.setDiameter(radius * 2);\n    }\n\n    //compute center , dia/radius from three 3d points\n\n  }, {\n    key: "setDataFromThreePoints",\n    value: (function (_setDataFromThreePoints) {\n      function setDataFromThreePoints() {\n        return _setDataFromThreePoints.apply(this, arguments);\n      }\n\n      setDataFromThreePoints.toString = function () {\n        return _setDataFromThreePoints.toString();\n      };\n\n      return setDataFromThreePoints;\n    })(function () {\n      throw new Error("do not use");\n\n      var _setDataFromThreePoin = setDataFromThreePoints(this.pointA, this.pointB, this.pointC);\n\n      var center = _setDataFromThreePoin.center;\n      var diameter = _setDataFromThreePoin.diameter;\n      var normal = _setDataFromThreePoin.normal;\n\n      this.setOrientation(plane.normal);\n      this.setCenter(center);\n      this.setRadius(radius);\n\n      this.pointACross.position.copy(this.pointA.clone().sub(this.position));\n      this.pointBCross.position.copy(this.pointB.clone().sub(this.position));\n      this.pointCCross.position.copy(this.pointC.clone().sub(this.position));\n    })\n  }, {\n    key: "setOrientation",\n    value: function setOrientation(orientation) {\n      this.orientation = orientation;\n      //console.log("this.orientation",this.orientation)\n\n      var defaultOrientation = new _three2.default.Vector3(0, 0, 1);\n      var quaternion = new _three2.default.Quaternion();\n      quaternion.setFromUnitVectors(defaultOrientation, this.orientation.clone());\n      this.rotation.setFromQuaternion(quaternion);\n    }\n  }]);\n\n  return DiameterVisual;\n})(_AnnotationVisual3.default);\n\nexports.default = DiameterVisual;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/DiameterVisual.js\n ** module id = 259\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/DiameterVisual.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _AnnotationVisual3 = __webpack_require__(22);\n\nvar _AnnotationVisual4 = _interopRequireDefault(_AnnotationVisual3);\n\nvar _SizeHelper = __webpack_require__(40);\n\nvar _SizeHelper2 = _interopRequireDefault(_SizeHelper);\n\nvar _CrossHelper = __webpack_require__(17);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _utils = __webpack_require__(79);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar DistanceVisual = (function (_AnnotationVisual) {\n  _inherits(DistanceVisual, _AnnotationVisual);\n\n  function DistanceVisual(options) {\n    _classCallCheck(this, DistanceVisual);\n\n    var DEFAULTS = {\n      crossSize: 3,\n      crossColor: "#000",\n\n      distance: undefined,\n      start: undefined,\n      startObject: undefined,\n      end: undefined,\n      endObject: undefined\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DistanceVisual).call(this, options));\n\n    Object.assign(_this, options);\n\n    //initialise internal sub objects\n    _this._setupVisuals();\n    _this._computeBasics();\n\n    _this.setAsSelectionRoot(true);\n    return _this;\n  }\n\n  /*configure all the basic visuals of this helper*/\n\n  _createClass(DistanceVisual, [{\n    key: "_setupVisuals",\n    value: function _setupVisuals() {\n      this.startCross = new _CrossHelper2.default({ size: this.crossSize, color: this.crossColor });\n      this.startCross.hide();\n      this.add(this.startCross);\n\n      this.endCross = new _CrossHelper2.default({ size: this.crossSize, color: this.crossColor });\n      this.endCross.hide();\n      this.add(this.endCross);\n\n      this.sizeArrow = new _SizeHelper2.default({\n        lineWidth: this.lineWidth,\n        textColor: this.textColor,\n        textBgColor: this.textBgColor,\n        fontSize: this.fontSize,\n        fontFace: this.fontFace,\n        labelType: this.labelType,\n        arrowColor: this.arrowColor,\n        sideLength: this.sideLength, //6\n        sideLineColor: this.arrowColor,\n        sideLineSide: "back" });\n\n      this.sizeArrow.hide();\n      this.add(this.sizeArrow);\n    }\n  }, {\n    key: "_computeBasics",\n    value: function _computeBasics() {\n      var start = this.start;\n      var end = this.end;\n      var startObject = this.startObject;\n      var endObject = this.endObject;\n\n      if (!start || !end || !startObject || !endObject) return;\n\n      var endToStart = end.clone().sub(start);\n      this.distance = endToStart.length();\n\n      try {\n        var midPoint = endToStart.divideScalar(2).add(start);\n        this._putSide = (0, _utils.getTargetBoundsData)(startObject, midPoint);\n      } catch (error) {\n        console.error(error);\n      }\n\n      //all done, now update the visuals\n      this._updateVisuals();\n    }\n  }, {\n    key: "_updateVisuals",\n    value: function _updateVisuals() {\n      console.log("this._putSide", this._putSide);\n      this.sizeArrow.setFromParams({\n        start: this.start,\n        end: this.end,\n        debug: true\n        //facingSide:new THREE.Vector3(0,0,1)\n        //facingSide:this._putSide,\n      });\n\n      this.sizeArrow.show();\n      this.startCross.show();\n      this.endCross.show();\n\n      this.startCross.position.copy(this.start);\n      this.endCross.position.copy(this.end);\n    }\n\n    /*start: vector3D\n    object: optional : on which object is the start point\n    */\n\n  }, {\n    key: "setStart",\n    value: function setStart(start, object) {\n      if (!start) return;\n      this.start = start;\n      if (object) this.startObject = object;\n      object = this.startObject;\n      //console.log("setting start",start, object, object.worldToLocal(start.clone()) )\n\n      this.startCross.position.copy(this.start);\n      this.sizeArrow.setStart(this.start);\n    }\n  }, {\n    key: "setEnd",\n    value: function setEnd(end, object) {\n      if (!end) return;\n      this.end = end;\n      if (object) this.endObject = object;\n      object = this.endObject;\n\n      this.distance = end.clone().sub(this.start).length();\n\n      this.endCross.position.copy(this.end);\n      this.endCross.show();\n\n      this.sizeArrow.setEnd(this.end);\n      this.sizeArrow.show();\n    }\n  }, {\n    key: "unset",\n    value: function unset() {\n      this.startCross.hide();\n      this.sizeArrow.hide();\n\n      this._endHook = null;\n      this._startHook = null;\n    }\n  }]);\n\n  return DistanceVisual;\n})(_AnnotationVisual4.default);\n\nvar DistanceVisual__ = (function (_AnnotationVisual2) {\n  _inherits(DistanceVisual__, _AnnotationVisual2);\n\n  function DistanceVisual__(options) {\n    _classCallCheck(this, DistanceVisual__);\n\n    var DEFAULTS = {\n      crossSize: 3,\n      crossColor: "#000",\n\n      distance: undefined,\n      start: undefined,\n      startObject: undefined,\n      end: undefined,\n      endObject: undefined\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this2 = _possibleConstructorReturn(this, Object.getPrototypeOf(DistanceVisual__).call(this, options));\n\n    Object.assign(_this2, options);\n\n    //initialise internal sub objects\n    _this2._setupVisuals();\n    _this2._computeBasics();\n\n    _this2.updatable = false;\n    _this2.setAsSelectionRoot(true);\n    //FIXME: do this in a more coherent way\n    _this2._setName();\n    return _this2;\n  }\n\n  //getters & setters\n  /*get start () {\n    return this._start\n  }\n  set start (val) {\n    console.log("setting start",val)\n    let start = this._start = val\n    this._computeStartHooks()\n    \n    if(!this.startCross ) return\n    this.startCross.position.copy( this.start )\n    this.startCross.show()\n  }\n  \n  get startObject () {\n    return this._startObject\n  }\n  set startObject (val) {\n    console.log("setting start object",val)\n    let startObject = this._startObject = val\n    this._computeStartHooks()\n  }\n  \n  get end() {\n    return this._end\n  }\n  set end(val) {\n    console.log("setting end",val)\n    let start = this._end = val\n    this._computeEndHooks()\n  }\n  \n  get endObject () {\n    return this._endObject\n  }\n  set endObject (val) {\n    console.log("setting end object",val)\n    let endObject = this._endObject = val\n    this._computeEndHooks()\n  }\n   _computeStartHooks(){\n  \n    if(!this.start || !this.startObject) return\n    this.curStartObjectPos = this.startObject.position.clone()\n    \n    this._startOffset = this.start.clone().sub( this.curStartObjectPos )\n    if(!this._startHook){\n      this._startHook = new THREE.Object3D()\n      this._startHook.position.copy( this.start.clone().sub( this.startObject.position ) )//object.worldToLocal(this.start) )\n      this.startObject.add( this._startHook )\n    }\n  }\n  \n  _computeEndHooks(){\n    if(!this.end || !this.endObject) return\n    \n    //FIXME: experimental\n    this.curEndObjectPos = this.endObject.position.clone()\n     this._endOffset = this.end.clone().sub( this.curEndObjectPos )\n    \n    if(!this._endHook){\n      this._endHook = new THREE.Object3D()\n      this._endHook.position.copy( this.end.clone().sub( this.endObject.position ) )//object.worldToLocal(this.end) )\n      this.endObject.add( this._endHook )\n    }\n    \n    this._computeBasics()\n  }*/\n\n  _createClass(DistanceVisual__, [{\n    key: "_computeBasics",\n    value: function _computeBasics() {\n      var start = this.start;\n      var end = this.end;\n      var startObject = this.startObject;\n      var endObject = this.endObject;\n\n      if (!start || !end || !startObject || !endObject) return;\n\n      var endToStart = end.clone().sub(start);\n      this.distance = endToStart.length();\n\n      try {\n        var midPoint = endToStart.divideScalar(2).add(start);\n        this._putSide = this.getTargetBoundsData(startObject, midPoint);\n      } catch (error) {\n        console.error(error);\n      }\n\n      //all done, now update the visuals\n      this._updateVisuals();\n\n      this.sizeArrow.show();\n      this.startCross.show();\n    }\n\n    /*configure all the basic visuals of this helper*/\n\n  }, {\n    key: "_setupVisuals",\n    value: function _setupVisuals() {\n      this.startCross = new _CrossHelper2.default({ size: this.crossSize, color: this.crossColor });\n      this.startCross.hide();\n      this.add(this.startCross);\n\n      this.sizeArrow = new _SizeHelper2.default({\n        textColor: this.textColor,\n        textBgColor: this.textBgColor,\n        fontSize: this.fontSize,\n        fontFace: this.fontFace,\n        labelType: this.labelType,\n        arrowColor: this.arrowColor,\n        sideLength: this.sideLength, //6\n        sideLineColor: this.arrowColor,\n        sideLineSide: "back" });\n\n      this.sizeArrow.hide();\n      this.add(this.sizeArrow);\n    }\n  }, {\n    key: "_updateVisuals",\n    value: function _updateVisuals() {\n      this.sizeArrow.setFromParams({\n        start: this.start,\n        end: this.end,\n        facingSide: this._putSide\n      });\n\n      this.startCross.position.copy(this.start);\n    }\n\n    /*start: vector3D\n    object: optional : on which object is the start point\n    */\n\n  }, {\n    key: "setStart",\n    value: function setStart(start, object) {\n      if (!start) return;\n      this.start = start;\n      if (object) this.startObject = object;\n      object = this.startObject;\n      //console.log("setting start",start, object, object.worldToLocal(start.clone()) )\n\n      //FIXME: experimental\n      this.curStartObjectPos = object.position.clone();\n\n      this._startOffset = start.clone().sub(this.curStartObjectPos);\n      if (!this._startHook) {\n        this._startHook = new _three2.default.Object3D();\n        this._startHook.position.copy(this.start.clone().sub(object.position)); //object.worldToLocal(this.start) )\n        object.add(this._startHook);\n      }\n\n      this.startCross.position.copy(this.start);\n      this.sizeArrow.setStart(this.start);\n    }\n  }, {\n    key: "setEnd",\n    value: function setEnd(end, object) {\n      if (!end) return;\n      this.end = end;\n      if (object) this.endObject = object;\n\n      object = this.endObject;\n\n      //FIXME: experimental\n      this.curEndObjectPos = object.position.clone();\n\n      this._endOffset = end.clone().sub(this.curEndObjectPos);\n\n      if (!this._endHook) {\n        this._endHook = new _three2.default.Object3D();\n        this._endHook.position.copy(this.end.clone().sub(object.position)); //object.worldToLocal(this.end) )\n        object.add(this._endHook);\n      }\n\n      this.distance = end.clone().sub(this.start).length();\n\n      this.sizeArrow.setEnd(this.end);\n      this.sizeArrow.show();\n    }\n  }, {\n    key: "unset",\n    value: function unset() {\n      this.startCross.hide();\n      this.sizeArrow.hide();\n\n      this._endHook = null;\n      this._startHook = null;\n    }\n  }]);\n\n  return DistanceVisual__;\n})(_AnnotationVisual4.default);\n\nexports.default = DistanceVisual;\n\n/*brute force update method, to update the star & end positions\nwhen the objects they are attached to change (position, rotation,scale)\nupdate( ){\n  return\n  //TODO: find a way to only call this when needed\n  if(!this.visible) return\n  if(!this.updatable) return\n  let changed = false\n  \n  this.startObject.updateMatrix()\n  this.startObject.updateMatrixWorld()\n  this.endObject.updateMatrix()\n  this.endObject.updateMatrixWorld()\n  \n  this.setStart( this.startObject.localToWorld( this._startHook.position.clone() ) )\n  this.setEnd( this.endObject.localToWorld( this._endHook.position.clone()) )\n  \n  this._setName()\n}*/\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/DistanceVisual.js\n ** module id = 260\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/DistanceVisual.js?');
},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _AnnotationVisual2 = __webpack_require__(22);\n\nvar _AnnotationVisual3 = _interopRequireDefault(_AnnotationVisual2);\n\nvar _CrossHelper = __webpack_require__(17);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _CircleHelper = __webpack_require__(78);\n\nvar _CircleHelper2 = _interopRequireDefault(_CircleHelper);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nvar _LeaderLineHelper = __webpack_require__(80);\n\nvar _LeaderLineHelper2 = _interopRequireDefault(_LeaderLineHelper);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n  Helper for basic notes (single point)\n*/\n\nvar NoteVisual = (function (_AnnotationVisual) {\n  _inherits(NoteVisual, _AnnotationVisual);\n\n  function NoteVisual(options) {\n    _classCallCheck(this, NoteVisual);\n\n    var DEFAULTS = {\n      crossColor: "#000",\n      text: "A"\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    //initialise internal sub objects\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoteVisual).call(this, options));\n\n    _this._setupVisuals();\n\n    _this.point = options.point !== undefined ? options.point : undefined;\n    _this.normal = options.normal !== undefined ? options.normal : undefined;\n    _this.object = options.object !== undefined ? options.object : undefined;\n\n    if (options.point) _this.setPoint(_this.point, _this.object);\n\n    _this.setAsSelectionRoot(true);\n    return _this;\n  }\n\n  _createClass(NoteVisual, [{\n    key: "_setupVisuals",\n    value: function _setupVisuals() {\n      console.log("highlightColor", this.highlightColor, this.crossColor);\n      this.pointCross = new _CrossHelper2.default({\n        size: 1.5,\n        lineWidth: this.lineWidth,\n        color: this.crossColor,\n        highlightColor: this.highlightColor\n      });\n      this.pointCross.hide();\n      this.add(this.pointCross);\n\n      //this.pointCube = new THREE.Mesh(new THREE.SphereGeometry(1,20,20), new THREE.MeshBasicMaterial({color:0xFF00FF}))\n      //this.pointCube.hide()\n      //this.add( this.pointCube )\n\n      /*let material = new THREE.LineBasicMaterial({ color: 0x0000ff } )\n      let circleGeometry = new THREE.CircleGeometry( 10, 64 )\n      //circleGeometry.vertices.shift()      \n      this.pointCircle = new THREE.Mesh( circleGeometry, material )\n      this.add( this.pointCircle )*/\n\n      this.lineMaterial = new _GizmoMaterial.GizmoLineMaterial({\n        color: this.lineColor,\n        lineWidth: this.lineWidth,\n        polygonOffset: true,\n        polygonOffsetFactor: -0.5,\n        side: _three2.default.FrontSide,\n        depthWrite: false,\n        depthTest: false,\n\n        highlightColor: this.highlightColor\n      });\n      this.pointCircle = new _CircleHelper2.default({\n        material: this.lineMaterial,\n        highlightColor: this.highlightColor });\n      //this.pointCircle.hide()\n      //this.pointCircle.setRadius(2.5)\n      //this.add( this.pointCircle )\n\n      this.leaderLine = new _LeaderLineHelper2.default({\n        text: this.text,\n        radius: 0,\n        fontSize: this.fontSize,\n        fontFace: this.fontFace,\n        textColor: this.textColor,\n        textBgColor: this.textBgColor,\n        labelType: this.labelType,\n        arrowColor: this.textColor,\n        linesColor: this.lineColor,\n        lineWidth: this.lineWidth,\n        highlightColor: this.highlightColor,\n\n        textBorder: "rectangle"\n      });\n\n      this.leaderLine.hide();\n      this.add(this.leaderLine);\n    }\n  }, {\n    key: "unset",\n    value: function unset() {\n      this.pointCross.hide();\n      //this.pointCircle.hide()\n    }\n  }, {\n    key: "setPoint",\n    value: function setPoint(point, object) {\n      if (point) this.point = point;\n      if (object) this.object = object;\n\n      //point location cross\n      this.pointCross.position.copy(this.point);\n      this.pointCross.show();\n\n      //this.pointCube.position.copy( this.point )\n      //this.pointCircle.position.copy(this.point)\n      //this.pointCircle.show()\n\n      this.leaderLine.position.copy(this.point);\n      this.leaderLine.show();\n    }\n  }]);\n\n  return NoteVisual;\n})(_AnnotationVisual3.default);\n\nexports.default = NoteVisual;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/NoteVisual.js\n ** module id = 261\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/NoteVisual.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _AnnotationVisual2 = __webpack_require__(22);\n\nvar _AnnotationVisual3 = _interopRequireDefault(_AnnotationVisual2);\n\nvar _CrossHelper = __webpack_require__(17);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _SizeHelper = __webpack_require__(40);\n\nvar _SizeHelper2 = _interopRequireDefault(_SizeHelper);\n\nvar _BaseHelper = __webpack_require__(13);\n\nvar _BaseHelper2 = _interopRequireDefault(_BaseHelper);\n\nvar _utils = __webpack_require__(79);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ThicknessVisual = (function (_AnnotationVisual) {\n  _inherits(ThicknessVisual, _AnnotationVisual);\n\n  function ThicknessVisual(options) {\n    _classCallCheck(this, ThicknessVisual);\n\n    var DEFAULTS = {\n      normalType: "face", //can be, face, x,y,z\n      sideLength: 10,\n\n      object: undefined,\n      entryPoint: undefined,\n      exitPoint: undefined,\n      thickness: undefined\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ThicknessVisual).call(this, options));\n\n    Object.assign(_this, options); //unsure\n\n    _this.DEFAULTS = DEFAULTS;\n    //initialise visuals\n    _this._setupVisuals();\n    _this._computeBasics();\n\n    _this.setAsSelectionRoot(true);\n    return _this;\n  }\n\n  _createClass(ThicknessVisual, [{\n    key: "_computeBasics",\n    value: function _computeBasics() {\n      var entryPoint = this.entryPoint;\n      var exitPoint = this.exitPoint;\n      var object = this.object;\n\n      if (!entryPoint || !exitPoint || !object) return;\n\n      var endToStart = exitPoint.clone().sub(entryPoint);\n      this.thickness = endToStart.length();\n\n      var putSide = new _three2.default.Vector3();\n      try {\n        var midPoint = endToStart.divideScalar(2).add(entryPoint);\n        putSide = (0, _utils.getTargetBoundsData)(object, midPoint);\n      } catch (error) {\n        console.error(error);\n      }\n\n      this.ThicknessVisualArrows.setFromParams({\n        start: entryPoint,\n        end: exitPoint,\n        facingSide: putSide\n      });\n      this.ThicknessVisualArrows.show();\n    }\n\n    /*configure all the basic visuals of this helper*/\n\n  }, {\n    key: "_setupVisuals",\n    value: function _setupVisuals() {\n      this.ThicknessVisualArrows = new _SizeHelper2.default({\n        lineWidth: this.lineWidth,\n        textColor: this.textColor,\n        textBgColor: this.textBgColor,\n        fontSize: this.fontSize,\n        fontFace: this.fontFace,\n        labelType: "flat",\n        arrowsPlacement: "outside",\n        arrowColor: this.arrowColor,\n        sideLength: this.sideLength,\n\n        highlightColor: this.highlightColor\n      });\n      this.ThicknessVisualArrows.hide();\n      this.add(this.ThicknessVisualArrows);\n\n      //debug helpers\n      this.faceNormalHelper = new _three2.default.ArrowHelper(new _three2.default.Vector3(), new _three2.default.Vector3(), 15, 0XFF0000);\n      this.faceNormalHelper2 = new _three2.default.ArrowHelper(new _three2.default.Vector3(), new _three2.default.Vector3(), 15, 0X00FF00);\n      this.entryPointHelper = new _CrossHelper2.default({ color: 0xFF0000 });\n      this.exitPointHelper = new _CrossHelper2.default({ color: 0x00FF00 });\n\n      this.debugHelpers = new _BaseHelper2.default();\n      this.debugHelpers.add(this.faceNormalHelper);\n      this.debugHelpers.add(this.faceNormalHelper2);\n      this.debugHelpers.add(this.entryPointHelper);\n      this.debugHelpers.add(this.exitPointHelper);\n\n      //this.add( this.debugHelpers )\n\n      if (!this.debug) {\n        this.debugHelpers.hide();\n      }\n    }\n  }, {\n    key: "_updateVisuals",\n    value: function _updateVisuals() {\n      this.faceNormalHelper.setStart(this.entryPoint);\n      this.faceNormalHelper.setDirection(this.exitPoint.clone().sub(this.entryPoint));\n\n      this.faceNormalHelper2.setStart(this.exitPoint);\n      this.faceNormalHelper2.setDirection(this.entryPoint.clone().sub(this.exitPoint));\n\n      this.entryPointHelper.position.copy(this.entryPoint);\n      this.exitPointHelper.position.copy(this.exitPoint);\n    }\n  }, {\n    key: "setThickness",\n    value: function setThickness(thickness) {\n      this.thickness = thickness;\n    }\n  }, {\n    key: "setEntryPoint",\n    value: function setEntryPoint(entryPoint, object) {\n      this.entryPoint = entryPoint;\n      this.object = object;\n    }\n  }, {\n    key: "setExitPoint",\n    value: function setExitPoint(exitPoint) {\n      this.exitPoint = exitPoint;\n    }\n  }, {\n    key: "set",\n    value: function set(entryInteresect) {\n      var _getEntryAndExit = getEntryAndExit(entryInteresect, this.normalType);\n\n      var object = _getEntryAndExit.object;\n      var entryPoint = _getEntryAndExit.entryPoint;\n      var exitPoint = _getEntryAndExit.exitPoint;\n      var thickness = _getEntryAndExit.thickness;\n\n      this.position.setFromMatrixPosition(object.matrixWorld);\n\n      //set letious internal attributes\n      this.setEntryPoint(entryPoint, object);\n      this.exitPoint = exitPoint;\n      try {\n        var midPoint = endToStart.divideScalar(2).add(entryPoint);\n        console.log("midPoint", entryPoint, midPoint, exitPoint);\n        var _putSide = this.getTargetBoundsData(object, midPoint);\n      } catch (error) {\n        console.error(error);\n      }\n      this.ThicknessVisualArrows.setFromParams({\n        start: entryPoint,\n        end: exitPoint,\n        facingSide: putSide\n      });\n      this.ThicknessVisualArrows.show();\n    }\n  }, {\n    key: "unset",\n    value: function unset() {\n      //this.thickness = undefined\n      this.position.set(0, 0, 0);\n      var options = Object.assign({}, this.DEFAULTS, options);\n      Object.assign(this, options); //unsure\n      this.ThicknessVisualArrows.hide();\n    }\n  }]);\n\n  return ThicknessVisual;\n})(_AnnotationVisual3.default);\n\nmodule.exports = ThicknessVisual;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/ThicknessVisual.js\n ** module id = 262\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/ThicknessVisual.js?')},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.default = zoomInOn;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _tween = __webpack_require__(94);\n\nvar _tween2 = _interopRequireDefault(_tween);\n\nvar _assign2 = __webpack_require__(8);\n\nvar _assign3 = _interopRequireDefault(_assign2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//faster object.assign\n\nfunction zoomInOn(object, camera, options) {\n\n  var defaults = {\n    position: undefined //to force a given "point " vector\n    , orientation: undefined //to force a given "look at " vector\n    , distance: 3,\n    zoomTime: 400,\n    precision: 0.001\n  };\n\n  if (!object) return;\n  if (!camera) return;\n\n  var _assign = (0, _assign3.default)({}, defaults, options);\n\n  var position = _assign.position;\n  var orientation = _assign.orientation;\n  var distance = _assign.distance;\n  var zoomTime = _assign.zoomTime;\n  var precision = _assign.precision;\n  //console.log("ZoomInOnObject", object,options)\n\n  if (!position) {\n    distance = object.boundingSphere.radius * distance;\n    position = object.position.clone();\n  } else {\n    distance = position.clone().sub(object.position).length() * distance * 2;\n  }\n\n  var camPos = camera.position.clone();\n  var camTgt = (camera.target || new _three2.default.Vector3()).clone();\n  var camTgtTarget = position.clone();\n  var camPosTarget = camera.position.clone().sub(position);\n\n  //camera.target.copy( object.position );\n  //determin camera "look-at" vector\n  var camLookatVector = new _three2.default.Vector3(0, 0, 1);\n  camLookatVector.applyQuaternion(camera.quaternion);\n  camLookatVector.normalize();\n  camLookatVector.multiplyScalar(distance);\n  camLookatVector = position.clone().add(camLookatVector);\n\n  camPosTarget = camLookatVector;\n\n  //Simply using vector.equals( otherVector) is not good enough\n  if (Math.abs(camPos.x - camPosTarget.x) <= precision && Math.abs(camPos.y - camPosTarget.y) <= precision && Math.abs(camPos.z - camPosTarget.z) <= precision) {\n    //already at target, do nothing\n    return;\n  }\n\n  //possible api change, to have function return data instead of mutating anything, making things more testable too\n  /*\n    //return a set of end /final points , both for the position...and target\n    return { pos:camPosTarget, tgt:camTgtTarget}\n  \n    }\n    return {\n    starts:[camPos,camTgt]//order matters\n    ,ends:[camTgt, camTgtTarget]\n    ,attrs:["position","target"]\n    ,easing:[TWEEN.Easing.Quadratic.In,TWEEN.Easing.Quadratic.In]\n    ,duration:zoomTime}\n  }*/\n\n  var tween = new _tween2.default.Tween(camPos).to(camPosTarget, zoomTime).easing(_tween2.default.Easing.Quadratic.In).onUpdate(function () {\n    camera.position.copy(camPos);\n  }).start();\n\n  var tween2 = new _tween2.default.Tween(camTgt).to(camTgtTarget, zoomTime).easing(_tween2.default.Easing.Quadratic.In).onUpdate(function () {\n    camera.target.copy(camTgt);\n  }).start();\n  //tween2.chain( tween );\n  //tween2.start();\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/cameraEffects/zoomInOn.js\n ** module id = 263\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/cameraEffects/zoomInOn.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = zoomToFit;\nexports.pointCameraTo = pointCameraTo;\nexports.positionOfCameraPointedTo = positionOfCameraPointedTo;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _computeBounds = __webpack_require__(48);\n\nvar _computeCenterOfGravity = __webpack_require__(268);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//from http://stackoverflow.com/questions/15761644/threejs-how-to-implement-zoomall-and-make-sure-a-given-box-fills-the-canvas-are\n/**\n *  Zoom to object\n */\nfunction zoomToFit(object, camera, target) {\n\n  var bbox = (0, _computeBounds.computeBoundingBox)(object);\n  if (bbox.empty()) {\n    return;\n  }\n  var COG = bbox.center();\n\n  pointCameraTo(COG, target, camera);\n  camera.lookAt(COG);\n\n  var sphereSize = bbox.size().length() * 0.5;\n  var distToCenter = sphereSize / Math.sin(Math.PI / 180.0 * camera.fov * 0.5);\n\n  // move the camera backward\n  var vec = new _three2.default.Vector3();\n  //compute vector from cam position to target\n  vec.subVectors(camera.position, target);\n  //set that vector's length to the distance to the center\n  vec.setLength(distToCenter);\n  //offset camera position by offset distance + target\n  camera.position.addVectors(vec, target);\n  camera.updateProjectionMatrix();\n\n  //possible api change, to have function return data instead of mutating anything\n  /*vec.addVectors(vec, target)\n  \n  return {COG,offset:vec}\n   //in other function ??\n  pointCameraTo(COG, target, camera)\n  camera.lookAt(COG)*/\n}\n\n/**\n * point the current camera to the center\n * of the graphical object (zoom factor is not affected)\n *\n * the camera is moved in its  x,z plane so that the orientation \n * is not affected either\n */\nfunction pointCameraTo(COG, target, camera) {\n  // Refocus camera to the center of the new object\n  var v = new _three2.default.Vector3();\n  v.subVectors(COG, target);\n\n  camera.position.addVectors(camera.position, v);\n}\n\n//non mutating\nfunction positionOfCameraPointedTo(COG, target, camera) {\n  // Refocus camera to the center of the new object\n  var v = new _three2.default.Vector3();\n  v.subVectors(COG, target);\n\n  return camera.position.clone().addVectors(camera.position, v);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/cameraEffects/zoomToFit.js\n ** module id = 264\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/cameraEffects/zoomToFit.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nvar _LabeledAxes = __webpack_require__(255);\n\nvar _LabeledAxes2 = _interopRequireDefault(_LabeledAxes);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n//FIXME: hack\n_three2.default.Vector3.prototype.pickingRay = function (camera) {\n  var tan = Math.tan(0.5 * _three2.default.Math.degToRad(camera.fov)) / camera.zoom;\n\n  this.x *= tan * camera.aspect;\n  this.y *= tan;\n  this.z = -1;\n\n  return this.transformDirection(camera.matrixWorld);\n};\n\nvar CubeEdge = (function (_THREE$Mesh) {\n  _inherits(CubeEdge, _THREE$Mesh);\n\n  function CubeEdge(size, width, color, position, selectionCallback) {\n    _classCallCheck(this, CubeEdge);\n\n    var size = size || 10;\n    var width = width || 4;\n    var position = position || new _three2.default.Vector3();\n    var color = color || 0xFF0000;\n\n    var midSize = size - width * 2;\n    var planeGeometry = new _three2.default.PlaneGeometry(midSize, width, 2, 2);\n    planeGeometry.applyMatrix(new _three2.default.Matrix4().makeRotationX(Math.PI / 2));\n    planeGeometry.applyMatrix(new _three2.default.Matrix4().makeRotationY(Math.PI / 2));\n    planeGeometry.applyMatrix(new _three2.default.Matrix4().makeTranslation(-width / 2, 0, size / 2));\n\n    var planeGeometry2 = planeGeometry.clone();\n    planeGeometry2.applyMatrix(new _three2.default.Matrix4().makeRotationZ(Math.PI / 2));\n\n    //final geometry\n    var geometry = new _three2.default.Geometry();\n    geometry.merge(planeGeometry);\n    geometry.merge(planeGeometry2);\n    //geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, width/2 , 0 ) );\n    geometry = new _three2.default.BoxGeometry(width, width, midSize);\n    geometry.applyMatrix(new _three2.default.Matrix4().makeTranslation(-width / 2, -width / 2, size / 2));\n\n    var material = new _GizmoMaterial.GizmoMaterial({ color: color\n    });\n    //depthTest:false, depthWrite:false\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CubeEdge).call(this, geometry, material));\n\n    _this.selectionCallback = selectionCallback;\n    _this.position.copy(position);\n    return _this;\n  }\n\n  _createClass(CubeEdge, [{\n    key: "onSelect",\n    value: function onSelect() {\n      if (this.selectionCallback) {\n        this.selectionCallback(this.name);\n      }\n    }\n  }]);\n\n  return CubeEdge;\n})(_three2.default.Mesh);\n\nvar CubePlane = (function (_THREE$Mesh2) {\n  _inherits(CubePlane, _THREE$Mesh2);\n\n  function CubePlane(size, color, position, selectionCallback) {\n    _classCallCheck(this, CubePlane);\n\n    var size = size || 10;\n    var position = position || new _three2.default.Vector3();\n    var color = color || 0xFF0000;\n\n    var geometry = new _three2.default.PlaneBufferGeometry(size, size, 2, 2);\n    var material = new _GizmoMaterial.GizmoMaterial({ color: color\n    });\n\n    var _this2 = _possibleConstructorReturn(this, Object.getPrototypeOf(CubePlane).call(this, geometry, material));\n\n    _this2.position.copy(position);\n    _this2.selectionCallback = selectionCallback;\n    return _this2;\n  }\n\n  _createClass(CubePlane, [{\n    key: "onSelect",\n    value: function onSelect() {\n      if (this.selectionCallback) {\n        this.selectionCallback(this.name);\n      }\n    }\n  }]);\n\n  return CubePlane;\n})(_three2.default.Mesh);\n\nvar CubeCorner = (function (_THREE$Mesh3) {\n  _inherits(CubeCorner, _THREE$Mesh3);\n\n  function CubeCorner(size, color, position, selectionCallback) {\n    _classCallCheck(this, CubeCorner);\n\n    var size = size || 10;\n    var position = position || new _three2.default.Vector3();\n    var color = color || 0xFF0000;\n\n    var geometry = new _three2.default.BoxGeometry(size, size, size);\n    var material = new _GizmoMaterial.GizmoMaterial({ color: color\n    });\n\n    var _this3 = _possibleConstructorReturn(this, Object.getPrototypeOf(CubeCorner).call(this, geometry, material));\n\n    _this3.selectionCallback = selectionCallback;\n    _this3.position.copy(position);\n    return _this3;\n  }\n\n  _createClass(CubeCorner, [{\n    key: "onSelect",\n    value: function onSelect() {\n      if (this.selectionCallback) {\n        this.selectionCallback(this.name);\n      }\n    }\n  }]);\n\n  return CubeCorner;\n})(_three2.default.Mesh);\n\nvar ViewCubeGizmo = (function (_THREE$Object3D) {\n  _inherits(ViewCubeGizmo, _THREE$Object3D);\n\n  function ViewCubeGizmo(controlledCameras, position, options) {\n    _classCallCheck(this, ViewCubeGizmo);\n\n    var _this4 = _possibleConstructorReturn(this, Object.getPrototypeOf(ViewCubeGizmo).call(this));\n\n    var options = options || {};\n\n    _this4.size = options.size !== undefined ? options.size : 15;\n    _this4.cornerWidth = options.cornerWidth !== undefined ? options.cornerWidth : 3;\n\n    _this4.planesColor = options.planesColor !== undefined ? options.planesColor : 0x77FF00;\n    _this4.edgesColor = options.edgesColor !== undefined ? options.edgesColor : 0xFF7700;\n    _this4.cornersColor = options.cornersColor !== undefined ? options.cornersColor : 0x0077FF;\n    _this4.highlightColor = options.highlightColor !== undefined ? options.highlightColor : 0xFFFF00;\n    _this4.opacity = options.opacity !== undefined ? options.opacity : 1;\n\n    var position = position || new _three2.default.Vector3();\n    var cornerWidth = _this4.cornerWidth;\n    var size = _this4.size;\n    var planesColor = _this4.planesColor;\n    var edgesColor = _this4.edgesColor;\n    var cornersColor = _this4.cornersColor;\n\n    /*var size        = size || 10;\n    var cornerWidth = cornerWidth || 4;\n    \n    var planesColor = planesColor || 0x00FF00;\n    var edgesColor  = edgesColor  || 0x0000FF;\n    var cornersColor= cornersColor|| 0xFF0000;*/\n    var controlledCameras = controlledCameras;\n\n    _this4.edges = new _three2.default.Object3D();\n    _this4.planes = new _three2.default.Object3D();\n    _this4.corners = new _three2.default.Object3D();\n\n    var orientationMap = {\n      "F": "Front",\n      "B": "Back",\n      "L": "Left",\n      "R": "Right",\n      "A": "Top",\n      "U": "Bottom",\n\n      "FL": "FrontLeft",\n      "FR": "FrontRight",\n      "FT": "FrontTop",\n      "FB": "FrontBottom",\n\n      "BL": "BackLeft",\n      "BR": "BackRight",\n      "BT": "BackTop",\n      "BB": "BackBottom",\n\n      "LT": "LeftTop",\n      "LB": "LeftBottom",\n      "RT": "RightTop",\n      "RB": "RightBottom",\n\n      "FTL": "FrontTopLeft",\n      "FTR": "FrontTopRight",\n      "FBL": "FrontBottomLeft",\n      "FBR": "FrontBottomRight",\n\n      "BTL": "BackTopLeft",\n      "BTR": "BackTopRight",\n      "BBL": "BackBottomLeft",\n      "BBR": "BackBottomRight"\n    };\n\n    var orientationCallback = function orientationCallback(orientationShortName) {\n      for (var i = 0; i < controlledCameras.length; i++) {\n        var controlledCamera = controlledCameras[i];\n        //console.log("yeahn orientation selected : "+orientationShortName+" in ",controlledCamera);\n        //controlledCamera.orientation = orientationMap[orientationShortName];\n        var methodName = "to" + orientationMap[orientationShortName] + "View";\n        console.log("yeahn orientation selected : " + orientationShortName + " in ", controlledCamera, "callin", methodName);\n        if (controlledCamera[methodName]) controlledCamera[methodName]();\n      }\n    };\n\n    //planes\n    var plSize = size - cornerWidth * 2;\n    var planes = {\n      "F": new CubePlane(plSize, planesColor, null, orientationCallback),\n      "B": new CubePlane(plSize, planesColor, null, orientationCallback),\n      "L": new CubePlane(plSize, planesColor, null, orientationCallback),\n      "R": new CubePlane(plSize, planesColor, null, orientationCallback),\n      "A": new CubePlane(plSize, planesColor, null, orientationCallback),\n      "U": new CubePlane(plSize, planesColor, null, orientationCallback)\n    };\n\n    planes["F"].rotation.set(0, Math.PI / 2, 0);\n    planes["F"].position.set(size / 2, 0, size / 2);\n    planes["B"].rotation.set(0, -Math.PI / 2, 0);\n    planes["B"].position.set(-size / 2, 0, size / 2);\n\n    planes["L"].rotation.set(-Math.PI / 2, 0, -Math.PI);\n    planes["L"].position.set(0, size / 2, size / 2);\n    planes["R"].rotation.set(-Math.PI / 2, 0, -Math.PI);\n    planes["R"].position.set(0, -size / 2, size / 2);\n\n    planes["A"].position.set(0, 0, size);\n    planes["U"].position.set(0, 0, 0);\n\n    for (var i in planes) {\n      planes[i].name = i;\n      _this4.planes.add(planes[i]);\n      _this4.planes[i] = planes[i];\n      planes[i].visible = false;\n    }\n\n    //edges\n    var edges = {\n      "FL": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "FR": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "FT": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "FB": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n\n      "BL": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "BR": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "BT": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "BB": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n\n      "LT": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "LB": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "RT": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback),\n      "RB": new CubeEdge(size, cornerWidth, edgesColor, null, orientationCallback)\n    };\n\n    size += 0.1;\n    //front\n    edges["FL"].rotation.set(0, 0, -Math.PI / 2);\n    edges["FL"].position.set(size / 2, -size / 2, 0);\n    edges["FR"].position.set(size / 2, size / 2, 0);\n\n    edges["FT"].rotation.set(Math.PI / 2, 0, 0);\n    edges["FT"].position.set(size / 2, size / 2, size);\n    edges["FB"].rotation.set(-Math.PI / 2, 0, 0);\n    edges["FB"].position.set(size / 2, -size / 2, 0);\n\n    //back	\n    edges["BL"].rotation.set(0, 0, Math.PI / 2);\n    edges["BL"].position.set(-size / 2, size / 2, 0);\n    edges["BR"].rotation.set(0, 0, -Math.PI);\n    edges["BR"].position.set(-size / 2, -size / 2, 0);\n\n    edges["BT"].rotation.set(Math.PI / 2, Math.PI, 0);\n    edges["BT"].position.set(-size / 2, -size / 2, size);\n    edges["BB"].rotation.set(-Math.PI / 2, Math.PI, 0);\n    edges["BB"].position.set(-size / 2, size / 2, 0);\n\n    //sides (left/right)\n    edges["LT"].rotation.set(Math.PI / 2, -Math.PI / 2, 0);\n    edges["LT"].position.set(size / 2, -size / 2, size);\n    edges["LB"].rotation.set(Math.PI, -Math.PI / 2, 0);\n    edges["LB"].position.set(size / 2, -size / 2, 0);\n\n    edges["RT"].rotation.set(Math.PI / 2, Math.PI / 2, 0);\n    edges["RT"].position.set(-size / 2, size / 2, size);\n\n    edges["RB"].rotation.set(0, Math.PI / 2, 0);\n    edges["RB"].position.set(-size / 2, size / 2, 0);\n\n    for (var i in edges) {\n      edges[i].name = i;\n      _this4.edges.add(edges[i]);\n      _this4.edges[i] = edges[i];\n      edges[i].visible = false;\n    }\n\n    //corners\n    size -= 0.1;\n    var cSize = cornerWidth;\n    var corners = {\n      "FTL": new CubeCorner(cSize, cornersColor, null, orientationCallback),\n      "FTR": new CubeCorner(cSize, cornersColor, null, orientationCallback),\n      "FBL": new CubeCorner(cSize, cornersColor, null, orientationCallback),\n      "FBR": new CubeCorner(cSize, cornersColor, null, orientationCallback),\n\n      "BTL": new CubeCorner(cSize, cornersColor, null, orientationCallback),\n      "BTR": new CubeCorner(cSize, cornersColor, null, orientationCallback),\n      "BBL": new CubeCorner(cSize, cornersColor, null, orientationCallback),\n      "BBR": new CubeCorner(cSize, cornersColor, null, orientationCallback)\n    };\n\n    corners["FTL"].position.set((size - cSize) / 2, -(size - cSize) / 2, size - cSize / 2);\n    corners["FTR"].position.set((size - cSize) / 2, (size - cSize) / 2, size - cSize / 2);\n    corners["FBL"].position.set((size - cSize) / 2, -(size - cSize) / 2, cSize / 2);\n    corners["FBR"].position.set((size - cSize) / 2, (size - cSize) / 2, cSize / 2);\n\n    corners["BTL"].position.set(-(size - cSize) / 2, -(size - cSize) / 2, size - cSize / 2);\n    corners["BTR"].position.set(-(size - cSize) / 2, (size - cSize) / 2, size - cSize / 2);\n    corners["BBL"].position.set(-(size - cSize) / 2, -(size - cSize) / 2, cSize / 2);\n    corners["BBR"].position.set(-(size - cSize) / 2, (size - cSize) / 2, cSize / 2);\n\n    for (var i in corners) {\n      corners[i].name = i;\n      _this4.corners.add(corners[i]);\n      _this4.corners[i] = corners[i];\n      corners[i].visible = false;\n    }\n\n    _this4.add(_this4.edges);\n    _this4.add(_this4.planes);\n    _this4.add(_this4.corners);\n\n    _this4.position.copy(position);\n\n    var self = _this4;\n    _this4.traverse(function (child) {\n      if (child.material) {\n        child.material.opacity = self.opacity;\n        child.material.transparent = true;\n        if (child.material.highlightColor) {\n          child.material.highlightColor = self.highlightColor;\n        }\n      }\n    });\n    return _this4;\n  }\n\n  _createClass(ViewCubeGizmo, [{\n    key: "hide",\n    value: function hide() {\n      this.traverse(function (child) {\n        child.visible = false;\n      });\n    }\n  }, {\n    key: "show",\n    value: function show() {\n      this.traverse(function (child) {\n        child.visible = true;\n      });\n    }\n  }, {\n    key: "highlight",\n    value: function highlight(item) {\n      this.traverse(function (child) {\n        if (child.material && child.material.highlight) {\n          if (child.name == item) {\n            child.material.highlight(true);\n          } else {\n            child.material.highlight(false);\n          }\n        }\n      });\n    }\n  }]);\n\n  return ViewCubeGizmo;\n})(_three2.default.Object3D);\n\nvar CamViewControls = (function (_THREE$Object3D2) {\n  _inherits(CamViewControls, _THREE$Object3D2);\n\n  function CamViewControls(options, controlledCameras) {\n    _classCallCheck(this, CamViewControls);\n\n    var _this5 = _possibleConstructorReturn(this, Object.getPrototypeOf(CamViewControls).call(this));\n\n    var options = options || {};\n\n    _this5.planesColor = options.planesColor !== undefined ? options.planesColor : 0x00FF00;\n    _this5.edgesColor = options.edgesColor !== undefined ? options.edgesColor : 0xFF0000;\n    _this5.cornersColor = options.cornersColor !== undefined ? options.cornersColor : 0x0000FF;\n    _this5.highlightColor = options.highlightColor !== undefined ? options.highlightColor : 0xFFFF00;\n    _this5.opacity = options.opacity !== undefined ? options.opacity : 1;\n\n    _this5.size = options.size !== undefined ? options.size : 15;\n    _this5.cornerWidth = options.cornerWidth !== undefined ? options.cornerWidth : 3;\n\n    var gizmoPos = new _three2.default.Vector3(_this5.size / 2, _this5.size / 2, 0);\n    _this5.viewCubeGizmo = new ViewCubeGizmo(controlledCameras, gizmoPos, options);\n    /*new ViewCubeGizmo(this.size, this.cornerWidth, \n     \n     , this.edgesColor, this.planesColor, this.cornersColor, controlledCameras);*/\n\n    _this5.add(_this5.viewCubeGizmo);\n    _this5.add(new _LabeledAxes2.default(options));\n    return _this5;\n  }\n\n  _createClass(CamViewControls, [{\n    key: "init",\n    value: function init(camera, domElement) {\n      console.log("attaching CamViewControls controls to", domElement);\n      this.domElement = domElement;\n      this.camera = camera;\n\n      var scope = this;\n\n      var ray = new _three2.default.Raycaster();\n      var pointerVector = new _three2.default.Vector3();\n\n      var point = new _three2.default.Vector3();\n      var offset = new _three2.default.Vector3();\n\n      var camPosition = new _three2.default.Vector3();\n      var camRotation = new _three2.default.Euler();\n\n      this.camPosition = camPosition;\n      this.camRotation = camRotation;\n\n      var useCapture = false;\n      var changeEvent = { type: \'change\' };\n\n      domElement.addEventListener("mousedown", onPointerDown, useCapture);\n      domElement.addEventListener("touchstart", onPointerDown, useCapture);\n\n      domElement.addEventListener("mousemove", onPointerMove, useCapture);\n      domElement.addEventListener("touchmove", onPointerMove, useCapture);\n\n      domElement.addEventListener("mouseup", onPointerUp, useCapture);\n      domElement.addEventListener("mouseout", onPointerUp, useCapture);\n      domElement.addEventListener("touchend", onPointerUp, useCapture);\n      domElement.addEventListener("touchcancel", onPointerUp, useCapture);\n      domElement.addEventListener("touchleave", onPointerUp, useCapture);\n\n      function intersectObjects(pointer, objects, isOrtho) {\n\n        var rect = domElement.getBoundingClientRect();\n        var x = pointer.offsetX; //;( pointer.offsetX - rect.left ) / rect.width;\n        var y = pointer.offsetY; //;( pointer.offsetX - rect.top ) / rect.height;\n\n        //pointerVector.set( (x / rect.width) * 2 - 1, -(y / rect.height) * 2 + 1, 1  );\n\n        var x = (pointer.clientX - rect.left) / rect.width;\n        var y = (pointer.clientY - rect.top) / rect.height;\n\n        pointerVector.set(x * 2 - 1, -(y * 2) + 1, 0.5);\n\n        if (!isOrtho) {\n          pointerVector.unproject(camera);\n\n          ray.set(camPosition, pointerVector.sub(camPosition).normalize());\n\n          var intersections = ray.intersectObjects(objects, true);\n        } else {\n\n          pointerVector.pickingRay(camera);\n          ray.set(camPosition, pointerVector);\n          var intersections = ray.intersectObjects(objects, true);\n        }\n        return intersections[0] ? intersections[0] : false;\n      }\n\n      function onPointerMove(event) {\n\n        event.preventDefault();\n        event.stopPropagation();\n\n        var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n        var intersect = intersectObjects(pointer, scope.viewCubeGizmo.children, true);\n\n        if (intersect && intersect.object.name) {\n          scope.activeItem = intersect.object.name;\n          scope.viewCubeGizmo.show();\n        } else {\n          scope.activeItem = null;\n          scope.viewCubeGizmo.hide();\n        }\n        //intersect\n        //point.copy( planeIntersect.point );\n        scope.dispatchEvent(changeEvent);\n      }\n      function onPointerDown(event) {\n        //console.log("pointer up in camView controls");\n\n        var pointer = event.changedTouches ? event.changedTouches[0] : event;\n        var intersect = intersectObjects(pointer, scope.viewCubeGizmo.children, true);\n        if (intersect && intersect.object.onSelect) {\n          event.preventDefault();\n          event.stopPropagation();\n          event.stopImmediatePropagation();\n\n          intersect.object.onSelect();\n\n          scope.dispatchEvent(changeEvent);\n        }\n      }\n\n      function onPointerUp(event) {\n        scope.activeItem = null;\n        scope.viewCubeGizmo.hide();\n      }\n    }\n  }, {\n    key: "intersectObjects",\n    value: function intersectObjects(pointer, objects) {\n\n      var rect = domElement.getBoundingClientRect();\n      var x = (pointer.clientX - rect.left) / rect.width;\n      var y = (pointer.clientY - rect.top) / rect.height;\n\n      pointerVector.set(x * 2 - 1, -(y * 2) + 1, 0.5);\n      pointerVector.unproject(camera);\n\n      ray.set(camPosition, pointerVector.sub(camPosition).normalize());\n\n      var intersections = ray.intersectObjects(objects, true);\n      return intersections[0] ? intersections[0] : false;\n    }\n  }, {\n    key: "update",\n    value: function update() {\n      this.camera.updateMatrixWorld();\n      this.camPosition.setFromMatrixPosition(this.camera.matrixWorld);\n      //this.camRotation.setFromRotationMatrix( tempMatrix.extractRotation( camera.matrixWorld ) );\n      //this.gizmo[_mode].highlight( scope.axis );\n      this.viewCubeGizmo.highlight(this.activeItem);\n    }\n\n    //event listener stuff\n\n  }, {\n    key: "addEventListener",\n    value: function addEventListener(type, listener) {\n\n      if (this._listeners === undefined) this._listeners = {};\n\n      var listeners = this._listeners;\n\n      if (listeners[type] === undefined) {\n\n        listeners[type] = [];\n      }\n\n      if (listeners[type].indexOf(listener) === -1) {\n\n        listeners[type].push(listener);\n      }\n    }\n  }, {\n    key: "hasEventListener",\n    value: function hasEventListener(type, listener) {\n\n      if (this._listeners === undefined) return false;\n\n      var listeners = this._listeners;\n\n      if (listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1) {\n\n        return true;\n      }\n\n      return false;\n    }\n  }, {\n    key: "removeEventListener",\n    value: function removeEventListener(type, listener) {\n\n      if (this._listeners === undefined) return;\n\n      var listeners = this._listeners;\n      var listenerArray = listeners[type];\n\n      if (listenerArray !== undefined) {\n\n        var index = listenerArray.indexOf(listener);\n\n        if (index !== -1) {\n\n          listenerArray.splice(index, 1);\n        }\n      }\n    }\n  }, {\n    key: "dispatchEvent",\n    value: function dispatchEvent(event) {\n      if (this._listeners === undefined) return;\n\n      var listeners = this._listeners;\n      var listenerArray = listeners[event.type];\n\n      if (listenerArray !== undefined) {\n\n        event.target = this;\n\n        var array = [];\n        var length = listenerArray.length;\n\n        for (var i = 0; i < length; i++) {\n\n          array[i] = listenerArray[i];\n        }\n\n        for (var i = 0; i < length; i++) {\n\n          array[i].call(this, event);\n        }\n      }\n    }\n  }]);\n\n  return CamViewControls;\n})(_three2.default.Object3D);\n\nexports.default = CamViewControls;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/controls/CamViewControls2.js\n ** module id = 265\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/controls/CamViewControls2.js?');
},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n//TODO refactor HEAVILLY\n\nvar CircularLabeledGrid = (function (_THREE$Object3D) {\n  _inherits(CircularLabeledGrid, _THREE$Object3D);\n\n  function CircularLabeledGrid(diameter, step, upVector, color, opacity, text, textColor, textPosition) {\n    _classCallCheck(this, CircularLabeledGrid);\n\n    var DEFAULTS = {\n      diameter: 200,\n      step: 100,\n      color: 0xFFFFFF,\n      opacity: 0.1,\n      addText: true,\n      textColor: "#FFFFFF",\n      textLocation: "f",\n      rootAssembly: null\n    };\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CircularLabeledGrid).call(this));\n\n    _this.diameter = diameter || 200;\n    _this.step = step || 100;\n    _this.color = color || 0x00baff;\n    _this.opacity = opacity || 0.2;\n    _this.text = text || true;\n    _this.textColor = textColor || "#000000";\n    _this.textPosition = "center";\n    _this.upVector = upVector || new _three2.default.Vector3(0, 1, 0);\n\n    _this.name = "grid";\n\n    //TODO: clean this up\n    _this.marginSize = 10;\n    _this.stepSubDivisions = 10;\n\n    _this._drawGrid();\n\n    //default grid orientation is z up, rotate if not the case\n    var upVector = _this.upVector;\n    _this.up = upVector;\n    _this.lookAt(upVector);\n    return _this;\n  }\n\n  _createClass(CircularLabeledGrid, [{\n    key: "_drawGrid",\n    value: function _drawGrid() {\n      var gridGeometry, gridMaterial, mainGridZ, planeFragmentShader, planeGeometry, planeMaterial, subGridGeometry, subGridMaterial, subGridZ;\n\n      //offset to avoid z fighting\n      mainGridZ = -0.05;\n      gridGeometry = new _three2.default.Geometry();\n      gridMaterial = new _three2.default.LineBasicMaterial({\n        color: new _three2.default.Color().setHex(this.color),\n        opacity: this.opacity,\n        linewidth: 2,\n        transparent: true\n      });\n\n      subGridZ = -0.05;\n      subGridGeometry = new _three2.default.Geometry();\n      subGridMaterial = new _three2.default.LineBasicMaterial({\n        color: new _three2.default.Color().setHex(this.color),\n        opacity: this.opacity / 2,\n        transparent: true\n      });\n\n      var step = this.step;\n      var stepSubDivisions = this.stepSubDivisions;\n      var diameter = this.diameter;\n      var radius = diameter / 2;\n      var width = this.diameter;\n      var length = this.diameter;\n\n      var centerBased = true;\n\n      function getStart(offset) {\n        var angle = Math.asin(offset / radius);\n\n        var start = Math.cos(angle) * radius;\n        return start;\n      }\n\n      if (centerBased) {\n        for (var i = 0; i <= width / 2; i += step / stepSubDivisions) {\n          var start = getStart(i);\n\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-start, i, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(start, i, subGridZ));\n\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-start, -i, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(start, -i, subGridZ));\n\n          if (i % step == 0) {\n            gridGeometry.vertices.push(new _three2.default.Vector3(-start, i, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(start, i, mainGridZ));\n\n            gridGeometry.vertices.push(new _three2.default.Vector3(-start, -i, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(start, -i, mainGridZ));\n          }\n        }\n        for (var i = 0; i <= length / 2; i += step / stepSubDivisions) {\n          var start = getStart(i);\n          subGridGeometry.vertices.push(new _three2.default.Vector3(i, -start, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(i, start, subGridZ));\n\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-i, -start, subGridZ));\n          subGridGeometry.vertices.push(new _three2.default.Vector3(-i, start, subGridZ));\n\n          if (i % step == 0) {\n            gridGeometry.vertices.push(new _three2.default.Vector3(i, -start, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(i, start, mainGridZ));\n\n            gridGeometry.vertices.push(new _three2.default.Vector3(-i, -start, mainGridZ));\n            gridGeometry.vertices.push(new _three2.default.Vector3(-i, start, mainGridZ));\n          }\n        }\n      }\n      //create main & sub grid objects\n      this.mainGrid = new _three2.default.Line(gridGeometry, gridMaterial, _three2.default.LinePieces);\n      this.subGrid = new _three2.default.Line(subGridGeometry, subGridMaterial, _three2.default.LinePieces);\n\n      //create margin\n      var offsetWidth = width + this.marginSize;\n      var offsetLength = length + this.marginSize;\n      var segments = 128;\n\n      var marginGeometry = new _three2.default.CircleGeometry(diameter / 2 + this.marginSize / 2, segments);\n      var marginGeometry2 = new _three2.default.CircleGeometry(diameter / 2, segments);\n\n      marginGeometry.vertices.shift();\n      marginGeometry2.vertices.shift();\n      marginGeometry.merge(marginGeometry2);\n\n      var strongGridMaterial = new _three2.default.LineBasicMaterial({\n        color: new _three2.default.Color().setHex(this.color),\n        opacity: this.opacity * 2,\n        linewidth: 2,\n        transparent: true\n      });\n      this.margin = new _three2.default.Line(marginGeometry, strongGridMaterial);\n\n      //add all grids, subgrids, margins etc\n      this.add(this.mainGrid);\n      this.add(this.subGrid);\n      this.add(this.margin);\n\n      //this._drawNumbering();\n    }\n  }, {\n    key: "toggle",\n    value: function toggle(_toggle) {\n      //apply visibility settings to all children\n      this.traverse(function (child) {\n        child.visible = _toggle;\n      });\n    }\n  }, {\n    key: "setOpacity",\n    value: function setOpacity(opacity) {\n      this.opacity = opacity;\n      this.mainGrid.material.opacity = opacity;\n      this.subGrid.material.opacity = opacity / 2;\n      this.margin.material.opacity = opacity * 2;\n    }\n  }, {\n    key: "setColor",\n    value: function setColor(color) {\n      this.color = color;\n      this.mainGrid.material.color = new _three2.default.Color().setHex(this.color);\n      this.subGrid.material.color = new _three2.default.Color().setHex(this.color);\n      this.margin.material.color = new _three2.default.Color().setHex(this.color);\n    }\n  }, {\n    key: "toggleText",\n    value: function toggleText(toggle) {\n      this.text = toggle;\n      var labels = this.labels.children;\n      for (var i = 0; i < this.labels.children.length; i++) {\n        var label = labels[i];\n        label.visible = toggle;\n      }\n    }\n  }, {\n    key: "setTextColor",\n    value: function setTextColor(color) {\n      this.textColor = color;\n      this._drawNumbering();\n    }\n  }, {\n    key: "setTextLocation",\n    value: function setTextLocation(location) {\n      this.textLocation = location;\n      return this._drawNumbering();\n    }\n  }, {\n    key: "setUp",\n    value: function setUp(upVector) {\n      this.upVector = upVector;\n      this.up = upVector;\n      this.lookAt(upVector);\n    }\n  }, {\n    key: "resize",\n    value: function resize(width, length) {\n      if (width && length) {\n        var width = Math.max(width, 10);\n        this.diameter = width;\n\n        var length = Math.max(length, 10);\n        this.length = length;\n\n        this.step = Math.max(this.step, 5);\n\n        this.remove(this.mainGrid);\n        this.remove(this.subGrid);\n        this.remove(this.margin);\n        //this.remove(this.plane);\n        return this._drawGrid();\n      }\n    }\n  }, {\n    key: "_drawNumbering",\n    value: function _drawNumbering() {\n      var label, sizeLabel, sizeLabel2, xLabelsLeft, xLabelsRight, yLabelsBack, yLabelsFront;\n      var step = this.step;\n\n      this._labelStore = {};\n\n      if (this.labels != null) {\n        this.mainGrid.remove(this.labels);\n      }\n      this.labels = new _three2.default.Object3D();\n\n      var width = this.width;\n      var length = this.length;\n      var numbering = this.numbering = "centerBased";\n\n      var labelsFront = new _three2.default.Object3D();\n      var labelsSideRight = new _three2.default.Object3D();\n\n      if (numbering == "centerBased") {\n        for (var i = 0; i <= width / 2; i += step) {\n          var sizeLabel = this.drawTextOnPlane("" + i, 32);\n          var sizeLabel2 = sizeLabel.clone();\n\n          sizeLabel.position.set(length / 2, -i, 0.1);\n          sizeLabel.rotation.z = -Math.PI / 2;\n          labelsFront.add(sizeLabel);\n\n          sizeLabel2.position.set(length / 2, i, 0.1);\n          sizeLabel2.rotation.z = -Math.PI / 2;\n          labelsFront.add(sizeLabel2);\n        }\n\n        for (var i = 0; i <= length / 2; i += step) {\n          var sizeLabel = this.drawTextOnPlane("" + i, 32);\n          var sizeLabel2 = sizeLabel.clone();\n\n          sizeLabel.position.set(-i, width / 2, 0.1);\n          //sizeLabel.rotation.z = -Math.PI / 2;\n          labelsSideRight.add(sizeLabel);\n\n          sizeLabel2.position.set(i, width / 2, 0.1);\n          //sizeLabel2.rotation.z = -Math.PI / 2;\n          labelsSideRight.add(sizeLabel2);\n        }\n\n        labelsSideLeft = labelsSideRight.clone();\n        labelsSideLeft.rotation.z = -Math.PI;\n        //labelsSideLeft = labelsSideRight.clone().translateY(- width );\n\n        labelsBack = labelsFront.clone();\n        labelsBack.rotation.z = -Math.PI;\n      }\n      /*if (this.textLocation === "center") {\n        yLabelsRight.translateY(- length/ 2);\n        xLabelsFront.translateX(- width / 2);\n      } else {\n        yLabelsLeft = yLabelsRight.clone().translateY( -width );\n        xLabelsBack = xLabelsFront.clone().translateX( -length );\n        \n        this.labels.add( yLabelsLeft );\n        this.labels.add( xLabelsBack) ;\n      }*/\n      //this.labels.add( yLabelsRight );\n      this.labels.add(labelsFront);\n      this.labels.add(labelsBack);\n\n      this.labels.add(labelsSideRight);\n      this.labels.add(labelsSideLeft);\n\n      //apply visibility settings to all labels\n      var textVisible = this.text;\n      this.labels.traverse(function (child) {\n        child.visible = textVisible;\n      });\n\n      this.mainGrid.add(this.labels);\n    }\n  }, {\n    key: "drawTextOnPlane",\n    value: function drawTextOnPlane(text, size) {\n      var canvas, context, material, plane, texture;\n\n      if (size == null) {\n        size = 256;\n      }\n\n      canvas = document.createElement(\'canvas\');\n      var size = 128;\n      canvas.width = size;\n      canvas.height = size;\n      context = canvas.getContext(\'2d\');\n      context.font = "18px sans-serif";\n      context.textAlign = \'center\';\n      context.fillStyle = this.textColor;\n      context.fillText(text, canvas.width / 2, canvas.height / 2);\n      context.strokeStyle = this.textColor;\n      context.strokeText(text, canvas.width / 2, canvas.height / 2);\n\n      texture = new _three2.default.Texture(canvas);\n      texture.needsUpdate = true;\n      texture.generateMipmaps = true;\n      texture.magFilter = _three2.default.LinearFilter;\n      texture.minFilter = _three2.default.LinearFilter;\n\n      material = new _three2.default.MeshBasicMaterial({\n        map: texture,\n        transparent: true,\n        color: 0xffffff,\n        alphaTest: 0.3\n      });\n      plane = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(size / 8, size / 8), material);\n      plane.doubleSided = true;\n      plane.overdraw = true;\n\n      return plane;\n    }\n  }]);\n\n  return CircularLabeledGrid;\n})(_three2.default.Object3D);\n\n//export {CircularLabeledGrid};\n\nmodule.exports = CircularLabeledGrid;\n\n//\n\n//autoresize, disabled for now\n/*\nupdateGridSize() {\n      var max, maxX, maxY, min, minX, minY, size, subchild, _getBounds, _i, _len, _ref,\n        _this = this;\n      minX = 99999;\n      maxX = -99999;\n      minY = 99999;\n      maxY = -99999;\n      _getBounds = function(mesh) {\n        var bBox, subchild, _i, _len, _ref, _results;\n        if (mesh instanceof THREE.Mesh) {\n          mesh.geometry.computeBoundingBox();\n          bBox = mesh.geometry.boundingBox;\n          minX = Math.min(minX, bBox.min.x);\n          maxX = Math.max(maxX, bBox.max.x);\n          minY = Math.min(minY, bBox.min.y);\n          maxY = Math.max(maxY, bBox.max.y);\n          _ref = mesh.children;\n          _results = [];\n          for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n            subchild = _ref[_i];\n            _results.push(_getBounds(subchild));\n          }\n          return _results;\n        }\n      };\n      if (this.rootAssembly != null) {\n        _ref = this.rootAssembly.children;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          subchild = _ref[_i];\n          if (subchild.name !== "renderSubs" && subchild.name !== "connectors") {\n            _getBounds(subchild);\n          }\n        }\n      }\n      max = Math.max(Math.max(maxX, maxY), 100);\n      min = Math.min(Math.min(minX, minY), -100);\n      size = (Math.max(max, Math.abs(min))) * 2;\n      size = Math.ceil(size / 10) * 10;\n      if (size >= 200) {\n        return this.resize(size);\n      }\n};\n*/\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/grids/CircularLabeledGrid.js\n ** module id = 266\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/grids/CircularLabeledGrid.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.default = centerMesh;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _computeBounds = __webpack_require__(48);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction centerMesh(object, onX, onY, onZ) {\n  //TODO: should this be added to our object/mesh classes\n  onX = onX === undefined ? false : onX;\n  onY = onY === undefined ? false : onY;\n  onZ = onZ === undefined ? false : onZ;\n\n  //centering hack\n  if (!object.boundingSphere) (0, _computeBounds.computeBoundingSphere)(object);\n  var offset = object.boundingSphere.center;\n\n  object.traverse(function (item) {\n    if (item.geometry) {\n      item.geometry.applyMatrix(new _three2.default.Matrix4().makeTranslation(-offset.x, -offset.y, -offset.z));\n    }\n  });\n\n  //offset to move the object above given planes\n  if (onZ) {\n    var h = object.boundingBox.max.z - object.boundingBox.min.z;\n    object.applyMatrix(new _three2.default.Matrix4().makeTranslation(0, 0, h / 2));\n  }\n\n  if (onY) {\n    var d = object.boundingBox.max.y - object.boundingBox.min.y;\n    object.applyMatrix(new _three2.default.Matrix4().makeTranslation(0, d / 2, 0));\n  }\n\n  if (onX) {\n    var w = object.boundingBox.max.x - object.boundingBox.min.x;\n    object.applyMatrix(new _three2.default.Matrix4().makeTranslation(w / 2, 0, 0));\n  }\n  return object;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/meshTools/centerMesh.js\n ** module id = 267\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/meshTools/centerMesh.js?')},function(module,exports){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.default = computeCenterOfGravity;\nfunction computeCenterOfGravity(boundingBox) {\n\n  return THREE.addVectors(boundingBox.min, boundingBox.max).divideScalar(2);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/meshTools/computeCenterOfGravity.js\n ** module id = 268\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/meshTools/computeCenterOfGravity.js?')},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n//faster object.assign\n\nvar ImagePlane = (function (_THREE$Object3D) {\n  _inherits(ImagePlane, _THREE$Object3D);\n\n  function ImagePlane(width, length, imgUrl, resolution, upVector) {\n    _classCallCheck(this, ImagePlane);\n\n    var DEFAULTS = {\n      width: 200,\n      length: 200,\n      imgUrl: "",\n      upVector: new _three2.default.Vector3(0, 1, 0)\n    };\n\n    options = Object.assign({}, DEFAULTS, options);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ImagePlane).call(this, options));\n\n    _this.DEFAULTS = DEFAULTS; //keep defaults\n\n    Object.assign(_this, options);\n\n    _this.userData.unselectable = true; // this should never be selectable\n    _this._drawPlane();\n    return _this;\n  }\n\n  _createClass(ImagePlane, [{\n    key: \'_drawPlane\',\n    value: function _drawPlane() {\n      //create plane for shadow projection  \n      var width = this.width;\n      var length = this.length;\n      var shadowColor = this.shadowColor;\n\n      var planeGeometry = new _three2.default.PlaneBufferGeometry(-width, length, 1, 1);\n      var texture = _three2.default.ImageUtils.loadTexture(this.imgUrl);\n      var planeMaterial = new _three2.default.MeshLambertMaterial({ map: texture, side: _three2.default.DoubleSide });\n      //create plane for image display   \n      this.plane = new _three2.default.Mesh(planeGeometry, planeMaterial);\n      this.plane.rotation.x = Math.PI;\n      this.plane.position.z = -0.2;\n      this.name = "shadowPlane";\n      this.plane.receiveShadow = true;\n\n      this.add(this.plane);\n    }\n  }, {\n    key: \'setUp\',\n    value: function setUp(upVector) {\n      this.upVector = upVector;\n      this.up = upVector;\n      this.lookAt(upVector);\n    }\n  }]);\n\n  return ImagePlane;\n})(_three2.default.Object3D);\n\n//export { ImagePlane }\n\nmodule.exports = ImagePlane;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/planes/ImagePlane.js\n ** module id = 269\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/planes/ImagePlane.js?')},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n	value: true\n});\nexports.THREE_Mirror = undefined;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author Slayvin / http://slayvin.net\n */\n\n_three2.default.ShaderLib[\'mirror\'] = {\n\n	uniforms: { "mirrorColor": { type: "c", value: new _three2.default.Color(0x7F7F7F) },\n		"mirrorSampler": { type: "t", value: null },\n		"textureMatrix": { type: "m4", value: new _three2.default.Matrix4() }\n	},\n\n	vertexShader: ["uniform mat4 textureMatrix;", "varying vec4 mirrorCoord;", "void main() {", "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", "vec4 worldPosition = modelMatrix * vec4( position, 1.0 );", "mirrorCoord = textureMatrix * worldPosition;", "gl_Position = projectionMatrix * mvPosition;", "}"].join("\\n"),\n\n	fragmentShader: ["uniform vec3 mirrorColor;", "uniform sampler2D mirrorSampler;", "varying vec4 mirrorCoord;", "float blendOverlay(float base, float blend) {", "return( base < 0.5 ? ( 2.0 * base * blend ) : (1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );", "}", "void main() {", "vec4 color = texture2DProj(mirrorSampler, mirrorCoord);", "color = vec4(blendOverlay(mirrorColor.r, color.r), blendOverlay(mirrorColor.g, color.g), blendOverlay(mirrorColor.b, color.b), 1.0);", "gl_FragColor = color;", "}"].join("\\n")\n\n};\n\nvar THREE_Mirror = function THREE_Mirror(renderer, camera, options) {\n\n	_three2.default.Object3D.call(this);\n\n	this.name = \'mirror_\' + this.id;\n\n	options = options || {};\n\n	this.matrixNeedsUpdate = true;\n\n	var width = options.textureWidth !== undefined ? options.textureWidth : 512;\n	var height = options.textureHeight !== undefined ? options.textureHeight : 512;\n\n	this.clipBias = options.clipBias !== undefined ? options.clipBias : 0.0;\n\n	var mirrorColor = options.color !== undefined ? new _three2.default.Color(options.color) : new _three2.default.Color(0x7F7F7F);\n\n	this.renderer = renderer;\n	this.mirrorPlane = new _three2.default.Plane();\n	this.normal = new _three2.default.Vector3(0, 0, 1);\n	this.mirrorWorldPosition = new _three2.default.Vector3();\n	this.cameraWorldPosition = new _three2.default.Vector3();\n	this.rotationMatrix = new _three2.default.Matrix4();\n	this.lookAtPosition = new _three2.default.Vector3(0, 0, -1);\n	this.clipPlane = new _three2.default.Vector4();\n\n	// For debug only, show the normal and plane of the mirror\n	var debugMode = options.debugMode !== undefined ? options.debugMode : false;\n\n	if (debugMode) {\n\n		var arrow = new _three2.default.ArrowHelper(new _three2.default.Vector3(0, 0, 1), new _three2.default.Vector3(0, 0, 0), 10, 0xffff80);\n		var planeGeometry = new _three2.default.Geometry();\n		planeGeometry.vertices.push(new _three2.default.Vector3(-10, -10, 0));\n		planeGeometry.vertices.push(new _three2.default.Vector3(10, -10, 0));\n		planeGeometry.vertices.push(new _three2.default.Vector3(10, 10, 0));\n		planeGeometry.vertices.push(new _three2.default.Vector3(-10, 10, 0));\n		planeGeometry.vertices.push(planeGeometry.vertices[0]);\n		var plane = new _three2.default.Line(planeGeometry, new _three2.default.LineBasicMaterial({ color: 0xffff80 }));\n\n		this.add(arrow);\n		this.add(plane);\n	}\n\n	if (camera instanceof _three2.default.PerspectiveCamera) {\n\n		this.camera = camera;\n	} else {\n\n		this.camera = new _three2.default.PerspectiveCamera();\n		console.log(this.name + \': camera is not a Perspective Camera!\');\n	}\n\n	this.textureMatrix = new _three2.default.Matrix4();\n\n	this.mirrorCamera = this.camera.clone();\n\n	this.texture = new _three2.default.WebGLRenderTarget(width, height);\n	this.tempTexture = new _three2.default.WebGLRenderTarget(width, height);\n\n	var mirrorShader = _three2.default.ShaderLib["mirror"];\n	var mirrorUniforms = _three2.default.UniformsUtils.clone(mirrorShader.uniforms);\n\n	this.material = new _three2.default.ShaderMaterial({\n\n		fragmentShader: mirrorShader.fragmentShader,\n		vertexShader: mirrorShader.vertexShader,\n		uniforms: mirrorUniforms\n\n	});\n\n	this.material.uniforms.mirrorSampler.value = this.texture;\n	this.material.uniforms.mirrorColor.value = mirrorColor;\n	this.material.uniforms.textureMatrix.value = this.textureMatrix;\n\n	if (!_three2.default.Math.isPowerOfTwo(width) || !_three2.default.Math.isPowerOfTwo(height)) {\n\n		this.texture.generateMipmaps = false;\n		this.tempTexture.generateMipmaps = false;\n	}\n\n	this.updateTextureMatrix();\n	this.render();\n};\n\nTHREE_Mirror.prototype = Object.create(_three2.default.Object3D.prototype);\n\nTHREE_Mirror.prototype.renderWithMirror = function (otherMirror) {\n\n	// update the mirror matrix to mirror the current view\n	this.updateTextureMatrix();\n	this.matrixNeedsUpdate = false;\n\n	// set the camera of the other mirror so the mirrored view is the reference view\n	var tempCamera = otherMirror.camera;\n	otherMirror.camera = this.mirrorCamera;\n\n	// render the other mirror in temp texture\n	otherMirror.renderTemp();\n	otherMirror.material.uniforms.mirrorSampler.value = otherMirror.tempTexture;\n\n	// render the current mirror\n	this.render();\n	this.matrixNeedsUpdate = true;\n\n	// restore material and camera of other mirror\n	otherMirror.material.uniforms.mirrorSampler.value = otherMirror.texture;\n	otherMirror.camera = tempCamera;\n\n	// restore texture matrix of other mirror\n	otherMirror.updateTextureMatrix();\n};\n\nTHREE_Mirror.prototype.updateTextureMatrix = function () {\n\n	var sign = Math.sign;\n\n	this.updateMatrixWorld();\n	this.camera.updateMatrixWorld();\n\n	this.mirrorWorldPosition.setFromMatrixPosition(this.matrixWorld);\n	this.cameraWorldPosition.setFromMatrixPosition(this.camera.matrixWorld);\n\n	this.rotationMatrix.extractRotation(this.matrixWorld);\n\n	this.normal.set(0, 0, 1);\n	this.normal.applyMatrix4(this.rotationMatrix);\n\n	var view = this.mirrorWorldPosition.clone().sub(this.cameraWorldPosition);\n	view.reflect(this.normal).negate();\n	view.add(this.mirrorWorldPosition);\n\n	this.rotationMatrix.extractRotation(this.camera.matrixWorld);\n\n	this.lookAtPosition.set(0, 0, -1);\n	this.lookAtPosition.applyMatrix4(this.rotationMatrix);\n	this.lookAtPosition.add(this.cameraWorldPosition);\n\n	var target = this.mirrorWorldPosition.clone().sub(this.lookAtPosition);\n	target.reflect(this.normal).negate();\n	target.add(this.mirrorWorldPosition);\n\n	this.up.set(0, -1, 0);\n	this.up.applyMatrix4(this.rotationMatrix);\n	this.up.reflect(this.normal).negate();\n\n	this.mirrorCamera.position.copy(view);\n	this.mirrorCamera.up = this.up;\n	this.mirrorCamera.lookAt(target);\n\n	this.mirrorCamera.updateProjectionMatrix();\n	this.mirrorCamera.updateMatrixWorld();\n	this.mirrorCamera.matrixWorldInverse.getInverse(this.mirrorCamera.matrixWorld);\n\n	// Update the texture matrix\n	this.textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);\n	this.textureMatrix.multiply(this.mirrorCamera.projectionMatrix);\n	this.textureMatrix.multiply(this.mirrorCamera.matrixWorldInverse);\n\n	// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html\n	// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf\n	this.mirrorPlane.setFromNormalAndCoplanarPoint(this.normal, this.mirrorWorldPosition);\n	this.mirrorPlane.applyMatrix4(this.mirrorCamera.matrixWorldInverse);\n\n	this.clipPlane.set(this.mirrorPlane.normal.x, this.mirrorPlane.normal.y, this.mirrorPlane.normal.z, this.mirrorPlane.constant);\n\n	var q = new _three2.default.Vector4();\n	var projectionMatrix = this.mirrorCamera.projectionMatrix;\n\n	q.x = (sign(this.clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];\n	q.y = (sign(this.clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];\n	q.z = -1.0;\n	q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];\n\n	// Calculate the scaled plane vector\n	var c = new _three2.default.Vector4();\n	c = this.clipPlane.multiplyScalar(2.0 / this.clipPlane.dot(q));\n\n	// Replacing the third row of the projection matrix\n	projectionMatrix.elements[2] = c.x;\n	projectionMatrix.elements[6] = c.y;\n	projectionMatrix.elements[10] = c.z + 1.0 - this.clipBias;\n	projectionMatrix.elements[14] = c.w;\n};\n\nTHREE_Mirror.prototype.render = function () {\n\n	if (this.matrixNeedsUpdate) this.updateTextureMatrix();\n\n	this.matrixNeedsUpdate = true;\n\n	// Render the mirrored view of the current scene into the target texture\n	var scene = this;\n\n	while (scene.parent !== undefined) {\n\n		scene = scene.parent;\n	}\n\n	if (scene !== undefined && scene instanceof _three2.default.Scene) {\n\n		this.renderer.render(scene, this.mirrorCamera, this.texture, true);\n	}\n};\n\nTHREE_Mirror.prototype.renderTemp = function () {\n\n	if (this.matrixNeedsUpdate) this.updateTextureMatrix();\n\n	this.matrixNeedsUpdate = true;\n\n	// Render the mirrored view of the current scene into the target texture\n	var scene = this;\n\n	while (scene.parent !== undefined) {\n\n		scene = scene.parent;\n	}\n\n	if (scene !== undefined && scene instanceof _three2.default.Scene) {\n\n		this.renderer.render(scene, this.mirrorCamera, this.tempTexture, true);\n	}\n};\n\nexports.THREE_Mirror = THREE_Mirror;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/planes/Mirror.js\n ** module id = 270\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/planes/Mirror.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _Mirror = __webpack_require__(270);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar MirrorPlane = (function (_THREE$Object3D) {\n  _inherits(MirrorPlane, _THREE$Object3D);\n\n  function MirrorPlane(width, length, resolution, color, upVector) {\n    _classCallCheck(this, MirrorPlane);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(MirrorPlane).call(this));\n\n    _this.width = width || 200;\n    _this.length = length || 200;\n    _this.resolution = resolution || 128;\n    _this.color = color || 0x777777;\n    _this.upVector = upVector || new _three2.default.Vector3(0, 1, 0);\n\n    _this.userData.unselectable = true; // this should never be selectable\n    _this._drawPlane();\n    return _this;\n  }\n\n  _createClass(MirrorPlane, [{\n    key: "_drawPlane",\n    value: function _drawPlane() {\n      //create plane for shadow projection  \n      var width = this.width;\n      var length = this.length;\n\n      var groundMirror = new _Mirror.THREE_Mirror(null, null, { clipBias: 0.003, textureWidth: this.resolution, textureHeight: this.resolution, color: this.color });\n      var planeGeometry = new _three2.default.PlaneBufferGeometry(width, length, 1, 1);\n      var planeMaterial = groundMirror.material;\n\n      //create plane for reflection\n      this.plane = new _three2.default.Mesh(planeGeometry, planeMaterial);\n      this.plane.position.z = -0.8;\n      this.plane.doubleSided = true;\n      this.name = "MirrorPlane";\n      this.plane.add(groundMirror);\n      this.mirrorCamera = groundMirror;\n\n      this.add(this.plane);\n    }\n  }, {\n    key: "setUp",\n    value: function setUp(upVector) {\n      this.upVector = upVector;\n      this.up = upVector;\n      this.lookAt(upVector);\n    }\n  }]);\n\n  return MirrorPlane;\n})(_three2.default.Object3D);\n\n//export { MirrorPlane };\n\nmodule.exports = MirrorPlane;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/planes/MirrorPlane.js\n ** module id = 271\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/planes/MirrorPlane.js?');
},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ShadowPlane = (function (_THREE$Object3D) {\n  _inherits(ShadowPlane, _THREE$Object3D);\n\n  function ShadowPlane(width, length, shadowColor, upVector) {\n    _classCallCheck(this, ShadowPlane);\n\n    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ShadowPlane).call(this));\n\n    _this.width = width || 200;\n    _this.length = length || 200;\n    _this.shadowColor = shadowColor || new _three2.default.Color(1, 1, 1);\n    _this.upVector = upVector || new _three2.default.Vector3(0, 1, 0);\n\n    _this.userData.unselectable = true; // this should never be selectable\n    _this._drawPlane();\n    return _this;\n  }\n\n  _createClass(ShadowPlane, [{\n    key: "_drawPlane",\n    value: function _drawPlane() {\n      //create plane for shadow projection  \n      var width = this.width;\n      var length = this.length;\n      var shadowColor = this.shadowColor;\n\n      var planeGeometry = new _three2.default.PlaneBufferGeometry(-width, length, 1, 1);\n      var planeFragmentShader = ["uniform vec3 diffuse;", "uniform float opacity;", "uniform vec3 shadowColor;", _three2.default.ShaderChunk["color_pars_fragment"], _three2.default.ShaderChunk["map_pars_fragment"], _three2.default.ShaderChunk["lightmap_pars_fragment"], _three2.default.ShaderChunk["envmap_pars_fragment"], _three2.default.ShaderChunk["fog_pars_fragment"], _three2.default.ShaderChunk["shadowmap_pars_fragment"], _three2.default.ShaderChunk["specularmap_pars_fragment"], "void main() {", "gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 );", _three2.default.ShaderChunk["map_fragment"], _three2.default.ShaderChunk["alphatest_fragment"], _three2.default.ShaderChunk["specularmap_fragment"], _three2.default.ShaderChunk["lightmap_fragment"], _three2.default.ShaderChunk["color_fragment"], _three2.default.ShaderChunk["envmap_fragment"], _three2.default.ShaderChunk["shadowmap_fragment"], _three2.default.ShaderChunk["linear_to_gamma_fragment"], _three2.default.ShaderChunk["fog_fragment"], "gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 - shadowColor.x );", "}"].join("\\n");\n\n      //= vec3(0.0,0.0,0.0)\n      var uniforms = _three2.default.ShaderLib[\'basic\'].uniforms;\n      if (!("shadowColor" in uniforms)) {\n        uniforms["shadowColor"] = { type: \'c\', value: shadowColor };\n      }\n\n      var planeMaterial = new _three2.default.ShaderMaterial({\n        uniforms: uniforms,\n        vertexShader: _three2.default.ShaderLib[\'basic\'].vertexShader,\n        fragmentShader: planeFragmentShader,\n        color: 0x0000FF,\n        transparent: true\n      });\n\n      //create plane for shadow projection   \n      this.plane = new _three2.default.Mesh(planeGeometry, planeMaterial);\n      this.plane.rotation.x = Math.PI;\n      this.plane.position.z = -0.2;\n      this.name = "shadowPlane";\n      this.plane.receiveShadow = true;\n      this.plane.castShadow = false;\n\n      this.add(this.plane);\n    }\n  }, {\n    key: "setUp",\n    value: function setUp(upVector) {\n      this.upVector = upVector;\n      this.up = upVector;\n      this.lookAt(upVector);\n    }\n  }]);\n\n  return ShadowPlane;\n})(_three2.default.Object3D);\n\nexports.default = ShadowPlane;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/planes/ShadowPlane.js\n ** module id = 272\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/planes/ShadowPlane.js?')},function(module,exports){eval('module.exports = {\n	"name": "jam",\n	"version": "0.15.1",\n	"description": "jam! View , annotate , measure 3d designs & more !",\n	"main": "index.js",\n	"scripts": {\n		"test": "ava \'./src/**/*.spec.js\' --require babel-register --verbose",\n		"test2": "ava \'./src/**/*.spec.js\' --require babel-register --watch --verbose",\n		"test-browser": "testem",\n		"lint": "standard src/**/*.js",\n		"start": "NODE_ENV=dev MODE=test node server.js",\n		"build": "NODE_ENV=production MODE=production webpack -p",\n		"build-test": "NODE_ENV=production MODE=test webpack -p",\n		"profile": "webpack --profile --json > stats.json",\n		"release": "npm run release-patch",\n		"release-patch": "git checkout master; npm version patch && npm run build; git commit -a -m \'chore(dist): built dist/\'; git push origin master --tags ",\n		"release-minor": "git checkout master; npm version minor && npm run build; git commit -a -m \'chore(dist): built dist/\'; git push origin master --tags ",\n		"release-major": "git checkout master; npm version major && npm run build; git commit -a -m \'chore(dist): built dist/\'; git push origin master --tags ",\n		"make-offline_simple": "babel src/components/webgl/view.js --out-file dist/jam-headless.js",\n		"make-offline-webpack": "webpack --config webpack.config.headless.js"\n	},\n	"author": "Mark \'kaosat-dev\' Moissette",\n	"license": "AGPL-3.0",\n	"repository": "usco/Jam",\n	"devDependencies": {\n		"ava": "^0.15.2",\n		"babel-cli": "^6.3.15",\n		"babel-core": "^6.2.1",\n		"babel-loader": "^6.1.0",\n		"babel-plugin-transform-react-jsx": "^6.8.0",\n		"babel-preset-es2015": "^6.1.18",\n		"babel-preset-react": "^6.1.18",\n		"babel-register": "^6.7.2",\n		"bundle-loader": "^0.5.4",\n		"compression-webpack-plugin": "^0.1.2",\n		"css-loader": "^0.23.0",\n		"dynamic-loader": "0.0.2",\n		"imports-loader": "^0.6.5",\n		"install": "^0.8.1",\n		"jimp": "^0.2.21",\n		"json-loader": "^0.5.1",\n		"npm": "^3.10.3",\n		"react-hot-loader": "^1.2.2",\n		"snabbdom-jsx": "^0.3.0",\n		"standard": "^6.0.8",\n		"string-replace-webpack-plugin": "0.0.3",\n		"style-loader": "^0.13.0",\n		"webpack": "^1.7.2",\n		"webpack-dev-server": "^1.7.0",\n		"webpack-strip": "^0.1.0",\n		"webpack-strip-logs": "^0.1.2"\n	},\n	"dependencies": {\n		"@cycle/dom": "^10.0.5",\n		"@cycle/rx-run": "^7.0.0",\n		"addressbar": "^0.4.3",\n		"classnames": "^2.2.1",\n		"cycle-simple-http-driver": "kaosat-dev/cycle-simple-http-driver",\n		"fast.js": "^0.1.1",\n		"gl": "^2.1.5",\n		"glView-helpers": "usco/glView-helpers",\n		"jsondiffpatch": "^0.1.41",\n		"log-minim": "usco/log-minim",\n		"loglevel": "^1.2.0",\n		"o-validator": "^1.0.1",\n		"pngjs": "^2.2.0",\n		"ramda": "^0.21.0",\n		"rx": "^4.0.7",\n		"rx-dom": "^5.0.3",\n		"screenfull": "^3.0.0",\n		"three": "^0.70.0",\n		"tween.js": "^0.14.0",\n		"usco-3mf-parser": "usco/usco-3mf-parser",\n		"usco-ctm-parser": "usco/usco-ctm-parser",\n		"usco-gcode-parser": "github:usco/usco-gcode-parser",\n		"usco-obj-parser": "usco/usco-obj-parser",\n		"usco-stl-parser": "usco/usco-stl-parser",\n		"usco-utils": "github:usco/usco-utils",\n		"usco-ym-storage": "github:usco/usco-ym-storage",\n		"viewport-size": "0.0.1",\n		"xstream": "^5.1.0"\n	}\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./package.json\n ** module id = 273\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./package.json?')},function(module,exports,__webpack_require__){eval('var map = {\n	"./diff_match_patch_uncompressed": 49,\n	"./diff_match_patch_uncompressed.js": 49\n};\nfunction webpackContext(req) {\n	return __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n	return map[req] || (function() { throw new Error("Cannot find module \'" + req + "\'.") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n	return Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 274;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/public/external ^\\.\\/.*$\n ** module id = 274\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/public/external_^\\.\\/.*$?')},function(module,exports,__webpack_require__){eval('var map = {\n	"./annotated": 30,\n	"./annotated.js": 30,\n	"./base": 14,\n	"./base.js": 14,\n	"./console": 42,\n	"./console.js": 42,\n	"./html": 31,\n	"./html.js": 31,\n	"./index": 35,\n	"./index.js": 35,\n	"./jsonpatch": 32,\n	"./jsonpatch.js": 32\n};\nfunction webpackContext(req) {\n	return __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n	return map[req] || (function() { throw new Error("Cannot find module \'" + req + "\'.") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n	return Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 275;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/formatters ^\\.\\/.*$\n ** module id = 275\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/formatters_^\\.\\/.*$?')},function(module,exports,__webpack_require__){eval('var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*\r\n* loglevel - https://github.com/pimterry/loglevel\r\n*\r\n* Copyright (c) 2013 Tim Perry\r\n* Licensed under the MIT license.\r\n*/\r\n(function (root, definition) {\r\n    "use strict";\r\n    if (typeof module === \'object\' && module.exports && "function" === \'function\') {\r\n        module.exports = definition();\r\n    } else if (true) {\r\n        !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === \'function\' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r\n    } else {\r\n        root.log = definition();\r\n    }\r\n}(this, function () {\r\n    "use strict";\r\n    var noop = function() {};\r\n    var undefinedType = "undefined";\r\n\r\n    function realMethod(methodName) {\r\n        if (typeof console === undefinedType) {\r\n            return false; // We can\'t build a real method without a console to log to\r\n        } else if (console[methodName] !== undefined) {\r\n            return bindMethod(console, methodName);\r\n        } else if (console.log !== undefined) {\r\n            return bindMethod(console, \'log\');\r\n        } else {\r\n            return noop;\r\n        }\r\n    }\r\n\r\n    function bindMethod(obj, methodName) {\r\n        var method = obj[methodName];\r\n        if (typeof method.bind === \'function\') {\r\n            return method.bind(obj);\r\n        } else {\r\n            try {\r\n                return Function.prototype.bind.call(method, obj);\r\n            } catch (e) {\r\n                // Missing bind shim or IE8 + Modernizr, fallback to wrapping\r\n                return function() {\r\n                    return Function.prototype.apply.apply(method, [obj, arguments]);\r\n                };\r\n            }\r\n        }\r\n    }\r\n\r\n    // these private functions always need `this` to be set properly\r\n\r\n    function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {\r\n        return function () {\r\n            if (typeof console !== undefinedType) {\r\n                replaceLoggingMethods.call(this, level, loggerName);\r\n                this[methodName].apply(this, arguments);\r\n            }\r\n        };\r\n    }\r\n\r\n    function replaceLoggingMethods(level, loggerName) {\r\n        /*jshint validthis:true */\r\n        for (var i = 0; i < logMethods.length; i++) {\r\n            var methodName = logMethods[i];\r\n            this[methodName] = (i < level) ?\r\n                noop :\r\n                this.methodFactory(methodName, level, loggerName);\r\n        }\r\n    }\r\n\r\n    function defaultMethodFactory(methodName, level, loggerName) {\r\n        /*jshint validthis:true */\r\n        return realMethod(methodName) ||\r\n               enableLoggingWhenConsoleArrives.apply(this, arguments);\r\n    }\r\n\r\n    var logMethods = [\r\n        "trace",\r\n        "debug",\r\n        "info",\r\n        "warn",\r\n        "error"\r\n    ];\r\n\r\n    function Logger(name, defaultLevel, factory) {\r\n      var self = this;\r\n      var currentLevel;\r\n      var storageKey = "loglevel";\r\n      if (name) {\r\n        storageKey += ":" + name;\r\n      }\r\n\r\n      function persistLevelIfPossible(levelNum) {\r\n          var levelName = (logMethods[levelNum] || \'silent\').toUpperCase();\r\n\r\n          // Use localStorage if available\r\n          try {\r\n              window.localStorage[storageKey] = levelName;\r\n              return;\r\n          } catch (ignore) {}\r\n\r\n          // Use session cookie as fallback\r\n          try {\r\n              window.document.cookie =\r\n                encodeURIComponent(storageKey) + "=" + levelName + ";";\r\n          } catch (ignore) {}\r\n      }\r\n\r\n      function getPersistedLevel() {\r\n          var storedLevel;\r\n\r\n          try {\r\n              storedLevel = window.localStorage[storageKey];\r\n          } catch (ignore) {}\r\n\r\n          if (typeof storedLevel === undefinedType) {\r\n              try {\r\n                  var cookie = window.document.cookie;\r\n                  var location = cookie.indexOf(\r\n                      encodeURIComponent(storageKey) + "=");\r\n                  if (location) {\r\n                      storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];\r\n                  }\r\n              } catch (ignore) {}\r\n          }\r\n\r\n          // If the stored level is not valid, treat it as if nothing was stored.\r\n          if (self.levels[storedLevel] === undefined) {\r\n              storedLevel = undefined;\r\n          }\r\n\r\n          return storedLevel;\r\n      }\r\n\r\n      /*\r\n       *\r\n       * Public API\r\n       *\r\n       */\r\n\r\n      self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,\r\n          "ERROR": 4, "SILENT": 5};\r\n\r\n      self.methodFactory = factory || defaultMethodFactory;\r\n\r\n      self.getLevel = function () {\r\n          return currentLevel;\r\n      };\r\n\r\n      self.setLevel = function (level, persist) {\r\n          if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {\r\n              level = self.levels[level.toUpperCase()];\r\n          }\r\n          if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {\r\n              currentLevel = level;\r\n              if (persist !== false) {  // defaults to true\r\n                  persistLevelIfPossible(level);\r\n              }\r\n              replaceLoggingMethods.call(self, level, name);\r\n              if (typeof console === undefinedType && level < self.levels.SILENT) {\r\n                  return "No console available for logging";\r\n              }\r\n          } else {\r\n              throw "log.setLevel() called with invalid level: " + level;\r\n          }\r\n      };\r\n\r\n      self.setDefaultLevel = function (level) {\r\n          if (!getPersistedLevel()) {\r\n              self.setLevel(level, false);\r\n          }\r\n      };\r\n\r\n      self.enableAll = function(persist) {\r\n          self.setLevel(self.levels.TRACE, persist);\r\n      };\r\n\r\n      self.disableAll = function(persist) {\r\n          self.setLevel(self.levels.SILENT, persist);\r\n      };\r\n\r\n      // Initialize with the right level\r\n      var initialLevel = getPersistedLevel();\r\n      if (initialLevel == null) {\r\n          initialLevel = defaultLevel == null ? "WARN" : defaultLevel;\r\n      }\r\n      self.setLevel(initialLevel, false);\r\n    }\r\n\r\n    /*\r\n     *\r\n     * Package-level API\r\n     *\r\n     */\r\n\r\n    var defaultLogger = new Logger();\r\n\r\n    var _loggersByName = {};\r\n    defaultLogger.getLogger = function getLogger(name) {\r\n        if (typeof name !== "string" || name === "") {\r\n          throw new TypeError("You must supply a name when creating a logger.");\r\n        }\r\n\r\n        var logger = _loggersByName[name];\r\n        if (!logger) {\r\n          logger = _loggersByName[name] = new Logger(\r\n            name, defaultLogger.getLevel(), defaultLogger.methodFactory);\r\n        }\r\n        return logger;\r\n    };\r\n\r\n    // Grab the current global log variable in case of overwrite\r\n    var _log = (typeof window !== undefinedType) ? window.log : undefined;\r\n    defaultLogger.noConflict = function() {\r\n        if (typeof window !== undefinedType &&\r\n               window.log === defaultLogger) {\r\n            window.log = _log;\r\n        }\r\n\r\n        return defaultLogger;\r\n    };\r\n\r\n    return defaultLogger;\r\n}));\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/loglevel/lib/loglevel.js\n ** module id = 276\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/loglevel/lib/loglevel.js?')},function(module,exports){eval("// shim for using process in browser\n\nvar process = module.exports = {};\n\nprocess.nextTick = (function () {\n    var canSetImmediate = typeof window !== 'undefined'\n    && window.setImmediate;\n    var canPost = typeof window !== 'undefined'\n    && window.postMessage && window.addEventListener\n    ;\n\n    if (canSetImmediate) {\n        return function (f) { return window.setImmediate(f) };\n    }\n\n    if (canPost) {\n        var queue = [];\n        window.addEventListener('message', function (ev) {\n            var source = ev.source;\n            if ((source === window || source === null) && ev.data === 'process-tick') {\n                ev.stopPropagation();\n                if (queue.length > 0) {\n                    var fn = queue.shift();\n                    fn();\n                }\n            }\n        }, true);\n\n        return function nextTick(fn) {\n            queue.push(fn);\n            window.postMessage('process-tick', '*');\n        };\n    }\n\n    return function nextTick(fn) {\n        setTimeout(fn, 0);\n    };\n})();\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n}\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 277\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/process/browser.js?")},function(module,exports,__webpack_require__){eval("var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n	/** Detect free variables */\n	var freeExports = typeof exports == 'object' && exports &&\n		!exports.nodeType && exports;\n	var freeModule = typeof module == 'object' && module &&\n		!module.nodeType && module;\n	var freeGlobal = typeof global == 'object' && global;\n	if (\n		freeGlobal.global === freeGlobal ||\n		freeGlobal.window === freeGlobal ||\n		freeGlobal.self === freeGlobal\n	) {\n		root = freeGlobal;\n	}\n\n	/**\n	 * The `punycode` object.\n	 * @name punycode\n	 * @type Object\n	 */\n	var punycode,\n\n	/** Highest positive signed 32-bit float value */\n	maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n	/** Bootstring parameters */\n	base = 36,\n	tMin = 1,\n	tMax = 26,\n	skew = 38,\n	damp = 700,\n	initialBias = 72,\n	initialN = 128, // 0x80\n	delimiter = '-', // '\\x2D'\n\n	/** Regular expressions */\n	regexPunycode = /^xn--/,\n	regexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n	regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n	/** Error messages */\n	errors = {\n		'overflow': 'Overflow: input needs wider integers to process',\n		'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n		'invalid-input': 'Invalid input'\n	},\n\n	/** Convenience shortcuts */\n	baseMinusTMin = base - tMin,\n	floor = Math.floor,\n	stringFromCharCode = String.fromCharCode,\n\n	/** Temporary variable */\n	key;\n\n	/*--------------------------------------------------------------------------*/\n\n	/**\n	 * A generic error utility function.\n	 * @private\n	 * @param {String} type The error type.\n	 * @returns {Error} Throws a `RangeError` with the applicable error message.\n	 */\n	function error(type) {\n		throw new RangeError(errors[type]);\n	}\n\n	/**\n	 * A generic `Array#map` utility function.\n	 * @private\n	 * @param {Array} array The array to iterate over.\n	 * @param {Function} callback The function that gets called for every array\n	 * item.\n	 * @returns {Array} A new array of values returned by the callback function.\n	 */\n	function map(array, fn) {\n		var length = array.length;\n		var result = [];\n		while (length--) {\n			result[length] = fn(array[length]);\n		}\n		return result;\n	}\n\n	/**\n	 * A simple `Array#map`-like wrapper to work with domain name strings or email\n	 * addresses.\n	 * @private\n	 * @param {String} domain The domain name or email address.\n	 * @param {Function} callback The function that gets called for every\n	 * character.\n	 * @returns {Array} A new string of characters returned by the callback\n	 * function.\n	 */\n	function mapDomain(string, fn) {\n		var parts = string.split('@');\n		var result = '';\n		if (parts.length > 1) {\n			// In email addresses, only the domain name should be punycoded. Leave\n			// the local part (i.e. everything up to `@`) intact.\n			result = parts[0] + '@';\n			string = parts[1];\n		}\n		// Avoid `split(regex)` for IE8 compatibility. See #17.\n		string = string.replace(regexSeparators, '\\x2E');\n		var labels = string.split('.');\n		var encoded = map(labels, fn).join('.');\n		return result + encoded;\n	}\n\n	/**\n	 * Creates an array containing the numeric code points of each Unicode\n	 * character in the string. While JavaScript uses UCS-2 internally,\n	 * this function will convert a pair of surrogate halves (each of which\n	 * UCS-2 exposes as separate characters) into a single code point,\n	 * matching UTF-16.\n	 * @see `punycode.ucs2.encode`\n	 * @see <https://mathiasbynens.be/notes/javascript-encoding>\n	 * @memberOf punycode.ucs2\n	 * @name decode\n	 * @param {String} string The Unicode input string (UCS-2).\n	 * @returns {Array} The new array of code points.\n	 */\n	function ucs2decode(string) {\n		var output = [],\n		    counter = 0,\n		    length = string.length,\n		    value,\n		    extra;\n		while (counter < length) {\n			value = string.charCodeAt(counter++);\n			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n				// high surrogate, and there is a next character\n				extra = string.charCodeAt(counter++);\n				if ((extra & 0xFC00) == 0xDC00) { // low surrogate\n					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n				} else {\n					// unmatched surrogate; only append this code unit, in case the next\n					// code unit is the high surrogate of a surrogate pair\n					output.push(value);\n					counter--;\n				}\n			} else {\n				output.push(value);\n			}\n		}\n		return output;\n	}\n\n	/**\n	 * Creates a string based on an array of numeric code points.\n	 * @see `punycode.ucs2.decode`\n	 * @memberOf punycode.ucs2\n	 * @name encode\n	 * @param {Array} codePoints The array of numeric code points.\n	 * @returns {String} The new Unicode string (UCS-2).\n	 */\n	function ucs2encode(array) {\n		return map(array, function(value) {\n			var output = '';\n			if (value > 0xFFFF) {\n				value -= 0x10000;\n				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n				value = 0xDC00 | value & 0x3FF;\n			}\n			output += stringFromCharCode(value);\n			return output;\n		}).join('');\n	}\n\n	/**\n	 * Converts a basic code point into a digit/integer.\n	 * @see `digitToBasic()`\n	 * @private\n	 * @param {Number} codePoint The basic numeric code point value.\n	 * @returns {Number} The numeric value of a basic code point (for use in\n	 * representing integers) in the range `0` to `base - 1`, or `base` if\n	 * the code point does not represent a value.\n	 */\n	function basicToDigit(codePoint) {\n		if (codePoint - 48 < 10) {\n			return codePoint - 22;\n		}\n		if (codePoint - 65 < 26) {\n			return codePoint - 65;\n		}\n		if (codePoint - 97 < 26) {\n			return codePoint - 97;\n		}\n		return base;\n	}\n\n	/**\n	 * Converts a digit/integer into a basic code point.\n	 * @see `basicToDigit()`\n	 * @private\n	 * @param {Number} digit The numeric value of a basic code point.\n	 * @returns {Number} The basic code point whose value (when used for\n	 * representing integers) is `digit`, which needs to be in the range\n	 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n	 * used; else, the lowercase form is used. The behavior is undefined\n	 * if `flag` is non-zero and `digit` has no uppercase form.\n	 */\n	function digitToBasic(digit, flag) {\n		//  0..25 map to ASCII a..z or A..Z\n		// 26..35 map to ASCII 0..9\n		return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n	}\n\n	/**\n	 * Bias adaptation function as per section 3.4 of RFC 3492.\n	 * https://tools.ietf.org/html/rfc3492#section-3.4\n	 * @private\n	 */\n	function adapt(delta, numPoints, firstTime) {\n		var k = 0;\n		delta = firstTime ? floor(delta / damp) : delta >> 1;\n		delta += floor(delta / numPoints);\n		for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n			delta = floor(delta / baseMinusTMin);\n		}\n		return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n	}\n\n	/**\n	 * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n	 * symbols.\n	 * @memberOf punycode\n	 * @param {String} input The Punycode string of ASCII-only symbols.\n	 * @returns {String} The resulting string of Unicode symbols.\n	 */\n	function decode(input) {\n		// Don't use UCS-2\n		var output = [],\n		    inputLength = input.length,\n		    out,\n		    i = 0,\n		    n = initialN,\n		    bias = initialBias,\n		    basic,\n		    j,\n		    index,\n		    oldi,\n		    w,\n		    k,\n		    digit,\n		    t,\n		    /** Cached calculation results */\n		    baseMinusT;\n\n		// Handle the basic code points: let `basic` be the number of input code\n		// points before the last delimiter, or `0` if there is none, then copy\n		// the first basic code points to the output.\n\n		basic = input.lastIndexOf(delimiter);\n		if (basic < 0) {\n			basic = 0;\n		}\n\n		for (j = 0; j < basic; ++j) {\n			// if it's not a basic code point\n			if (input.charCodeAt(j) >= 0x80) {\n				error('not-basic');\n			}\n			output.push(input.charCodeAt(j));\n		}\n\n		// Main decoding loop: start just after the last delimiter if any basic code\n		// points were copied; start at the beginning otherwise.\n\n		for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n			// `index` is the index of the next character to be consumed.\n			// Decode a generalized variable-length integer into `delta`,\n			// which gets added to `i`. The overflow checking is easier\n			// if we increase `i` as we go, then subtract off its starting\n			// value at the end to obtain `delta`.\n			for (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n				if (index >= inputLength) {\n					error('invalid-input');\n				}\n\n				digit = basicToDigit(input.charCodeAt(index++));\n\n				if (digit >= base || digit > floor((maxInt - i) / w)) {\n					error('overflow');\n				}\n\n				i += digit * w;\n				t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n				if (digit < t) {\n					break;\n				}\n\n				baseMinusT = base - t;\n				if (w > floor(maxInt / baseMinusT)) {\n					error('overflow');\n				}\n\n				w *= baseMinusT;\n\n			}\n\n			out = output.length + 1;\n			bias = adapt(i - oldi, out, oldi == 0);\n\n			// `i` was supposed to wrap around from `out` to `0`,\n			// incrementing `n` each time, so we'll fix that now:\n			if (floor(i / out) > maxInt - n) {\n				error('overflow');\n			}\n\n			n += floor(i / out);\n			i %= out;\n\n			// Insert `n` at position `i` of the output\n			output.splice(i++, 0, n);\n\n		}\n\n		return ucs2encode(output);\n	}\n\n	/**\n	 * Converts a string of Unicode symbols (e.g. a domain name label) to a\n	 * Punycode string of ASCII-only symbols.\n	 * @memberOf punycode\n	 * @param {String} input The string of Unicode symbols.\n	 * @returns {String} The resulting Punycode string of ASCII-only symbols.\n	 */\n	function encode(input) {\n		var n,\n		    delta,\n		    handledCPCount,\n		    basicLength,\n		    bias,\n		    j,\n		    m,\n		    q,\n		    k,\n		    t,\n		    currentValue,\n		    output = [],\n		    /** `inputLength` will hold the number of code points in `input`. */\n		    inputLength,\n		    /** Cached calculation results */\n		    handledCPCountPlusOne,\n		    baseMinusT,\n		    qMinusT;\n\n		// Convert the input in UCS-2 to Unicode\n		input = ucs2decode(input);\n\n		// Cache the length\n		inputLength = input.length;\n\n		// Initialize the state\n		n = initialN;\n		delta = 0;\n		bias = initialBias;\n\n		// Handle the basic code points\n		for (j = 0; j < inputLength; ++j) {\n			currentValue = input[j];\n			if (currentValue < 0x80) {\n				output.push(stringFromCharCode(currentValue));\n			}\n		}\n\n		handledCPCount = basicLength = output.length;\n\n		// `handledCPCount` is the number of code points that have been handled;\n		// `basicLength` is the number of basic code points.\n\n		// Finish the basic string - if it is not empty - with a delimiter\n		if (basicLength) {\n			output.push(delimiter);\n		}\n\n		// Main encoding loop:\n		while (handledCPCount < inputLength) {\n\n			// All non-basic code points < n have been handled already. Find the next\n			// larger one:\n			for (m = maxInt, j = 0; j < inputLength; ++j) {\n				currentValue = input[j];\n				if (currentValue >= n && currentValue < m) {\n					m = currentValue;\n				}\n			}\n\n			// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n			// but guard against overflow\n			handledCPCountPlusOne = handledCPCount + 1;\n			if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n				error('overflow');\n			}\n\n			delta += (m - n) * handledCPCountPlusOne;\n			n = m;\n\n			for (j = 0; j < inputLength; ++j) {\n				currentValue = input[j];\n\n				if (currentValue < n && ++delta > maxInt) {\n					error('overflow');\n				}\n\n				if (currentValue == n) {\n					// Represent delta as a generalized variable-length integer\n					for (q = delta, k = base; /* no condition */; k += base) {\n						t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n						if (q < t) {\n							break;\n						}\n						qMinusT = q - t;\n						baseMinusT = base - t;\n						output.push(\n							stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n						);\n						q = floor(qMinusT / baseMinusT);\n					}\n\n					output.push(stringFromCharCode(digitToBasic(q, 0)));\n					bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n					delta = 0;\n					++handledCPCount;\n				}\n			}\n\n			++delta;\n			++n;\n\n		}\n		return output.join('');\n	}\n\n	/**\n	 * Converts a Punycode string representing a domain name or an email address\n	 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n	 * it doesn't matter if you call it on a string that has already been\n	 * converted to Unicode.\n	 * @memberOf punycode\n	 * @param {String} input The Punycoded domain name or email address to\n	 * convert to Unicode.\n	 * @returns {String} The Unicode representation of the given Punycode\n	 * string.\n	 */\n	function toUnicode(input) {\n		return mapDomain(input, function(string) {\n			return regexPunycode.test(string)\n				? decode(string.slice(4).toLowerCase())\n				: string;\n		});\n	}\n\n	/**\n	 * Converts a Unicode string representing a domain name or an email address to\n	 * Punycode. Only the non-ASCII parts of the domain name will be converted,\n	 * i.e. it doesn't matter if you call it with a domain that's already in\n	 * ASCII.\n	 * @memberOf punycode\n	 * @param {String} input The domain name or email address to convert, as a\n	 * Unicode string.\n	 * @returns {String} The Punycode representation of the given domain name or\n	 * email address.\n	 */\n	function toASCII(input) {\n		return mapDomain(input, function(string) {\n			return regexNonASCII.test(string)\n				? 'xn--' + encode(string)\n				: string;\n		});\n	}\n\n	/*--------------------------------------------------------------------------*/\n\n	/** Define the public API */\n	punycode = {\n		/**\n		 * A string representing the current Punycode.js version number.\n		 * @memberOf punycode\n		 * @type String\n		 */\n		'version': '1.4.1',\n		/**\n		 * An object of methods to convert from JavaScript's internal character\n		 * representation (UCS-2) to Unicode code points, and back.\n		 * @see <https://mathiasbynens.be/notes/javascript-encoding>\n		 * @memberOf punycode\n		 * @type Object\n		 */\n		'ucs2': {\n			'decode': ucs2decode,\n			'encode': ucs2encode\n		},\n		'decode': decode,\n		'encode': encode,\n		'toASCII': toASCII,\n		'toUnicode': toUnicode\n	};\n\n	/** Expose `punycode` */\n	// Some AMD build optimizers, like r.js, check for specific condition patterns\n	// like the following:\n	if (\n		true\n	) {\n		!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n			return punycode;\n		}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n	} else if (freeExports && freeModule) {\n		if (module.exports == freeExports) {\n			// in Node.js, io.js, or RingoJS v0.8.0+\n			freeModule.exports = punycode;\n		} else {\n			// in Narwhal or RingoJS v0.7.0-\n			for (key in punycode) {\n				punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n			}\n		}\n	} else {\n		// in Rhino or a web browser\n		root.punycode = punycode;\n	}\n\n}(this));\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module), (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/punycode/punycode.js\n ** module id = 278\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/punycode/punycode.js?");
},function(module,exports){eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n  return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n  sep = sep || '&';\n  eq = eq || '=';\n  var obj = {};\n\n  if (typeof qs !== 'string' || qs.length === 0) {\n    return obj;\n  }\n\n  var regexp = /\\+/g;\n  qs = qs.split(sep);\n\n  var maxKeys = 1000;\n  if (options && typeof options.maxKeys === 'number') {\n    maxKeys = options.maxKeys;\n  }\n\n  var len = qs.length;\n  // maxKeys <= 0 means that we should not limit keys count\n  if (maxKeys > 0 && len > maxKeys) {\n    len = maxKeys;\n  }\n\n  for (var i = 0; i < len; ++i) {\n    var x = qs[i].replace(regexp, '%20'),\n        idx = x.indexOf(eq),\n        kstr, vstr, k, v;\n\n    if (idx >= 0) {\n      kstr = x.substr(0, idx);\n      vstr = x.substr(idx + 1);\n    } else {\n      kstr = x;\n      vstr = '';\n    }\n\n    k = decodeURIComponent(kstr);\n    v = decodeURIComponent(vstr);\n\n    if (!hasOwnProperty(obj, k)) {\n      obj[k] = v;\n    } else if (Array.isArray(obj[k])) {\n      obj[k].push(v);\n    } else {\n      obj[k] = [obj[k], v];\n    }\n  }\n\n  return obj;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/querystring/decode.js\n ** module id = 279\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/querystring/decode.js?")},function(module,exports){eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n  switch (typeof v) {\n    case 'string':\n      return v;\n\n    case 'boolean':\n      return v ? 'true' : 'false';\n\n    case 'number':\n      return isFinite(v) ? v : '';\n\n    default:\n      return '';\n  }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n  sep = sep || '&';\n  eq = eq || '=';\n  if (obj === null) {\n    obj = undefined;\n  }\n\n  if (typeof obj === 'object') {\n    return Object.keys(obj).map(function(k) {\n      var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n      if (Array.isArray(obj[k])) {\n        return obj[k].map(function(v) {\n          return ks + encodeURIComponent(stringifyPrimitive(v));\n        }).join(sep);\n      } else {\n        return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n      }\n    }).join(sep);\n\n  }\n\n  if (!name) return '';\n  return encodeURIComponent(stringifyPrimitive(name)) + eq +\n         encodeURIComponent(stringifyPrimitive(obj));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/querystring/encode.js\n ** module id = 280\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/querystring/encode.js?")},function(module,exports,__webpack_require__){eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.\n\r\n;(function (factory) {\n  var objectTypes = {\n    'boolean': false,\n    'function': true,\n    'object': true,\n    'number': false,\n    'string': false,\n    'undefined': false\n  };\n\n  var root = (objectTypes[typeof window] && window) || this,\n    freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,\n    freeModule = objectTypes[typeof module] && module && !module.nodeType && module,\n    moduleExports = freeModule && freeModule.exports === freeExports && freeExports,\n    freeGlobal = objectTypes[typeof global] && global;\n\n  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {\n    root = freeGlobal;\n  }\n\n  // Because of build optimizers\n  if (true) {\n    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) {\n      root.Rx = factory(root, exports, Rx);\n      return root.Rx;\n    }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n  } else if (typeof module === 'object' && module && module.exports === freeExports) {\n    module.exports = factory(root, module.exports, require('rx'));\n  } else {\n    root.Rx = factory(root, {}, root.Rx);\n  }\n}.call(this, function (root, exp, Rx, undefined) {\n\r\n  var Observable = Rx.Observable,\n    observableProto = Observable.prototype,\n    AnonymousObservable = Rx.AnonymousObservable,\n    observerCreate = Rx.Observer.create,\n    disposableCreate = Rx.Disposable.create,\n    CompositeDisposable = Rx.CompositeDisposable,\n    SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,\n    AsyncSubject = Rx.AsyncSubject,\n    Subject = Rx.Subject,\n    Scheduler = Rx.Scheduler,\n    defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),\n    dom = Rx.DOM = {},\n    hasOwnProperty = {}.hasOwnProperty,\n    noop = Rx.helpers.noop;\n\r\n  function createListener (element, name, handler) {\n    if (element.addEventListener) {\n      element.addEventListener(name, handler, false);\n      return disposableCreate(function () {\n        element.removeEventListener(name, handler, false);\n      });\n    }\n    throw new Error('No listener found');\n  }\n\n  function createEventListener (el, eventName, handler) {\n    var disposables = new CompositeDisposable();\n\n    // Asume NodeList\n    if (Object.prototype.toString.call(el) === '[object NodeList]') {\n      for (var i = 0, len = el.length; i < len; i++) {\n        disposables.add(createEventListener(el.item(i), eventName, handler));\n      }\n    } else if (el) {\n      disposables.add(createListener(el, eventName, handler));\n    }\n\n    return disposables;\n  }\n\n  /**\n   * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.\n   *\n   * @example\n   *   var source = Rx.DOM.fromEvent(element, 'mouseup');\n   * \n   * @param {Object} element The DOMElement or NodeList to attach a listener.\n   * @param {String} eventName The event name to attach the observable sequence.\n   * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.     \n   * @returns {Observable} An observable sequence of events from the specified element and the specified event.\n   */\n  var fromEvent = dom.fromEvent = function (element, eventName, selector) {\n\n    return new AnonymousObservable(function (observer) {\n      return createEventListener(\n        element, \n        eventName, \n        function handler (e) { \n          var results = e;\n\n          if (selector) {\n            try {\n              results = selector(arguments);\n            } catch (err) {\n              observer.onError(err);\n              return\n            }\n          }\n\n          observer.onNext(results); \n        });\n    }).publish().refCount();\n  };\n\r\n  (function () {\n    var events = \"blur focus focusin focusout load resize scroll unload click dblclick \" +\n      \"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n      \"change select submit keydown keypress keyup error contextmenu\";\n\n    if (root.PointerEvent) {\n      events += \" pointerdown pointerup pointermove pointerover pointerout pointerenter pointerleave\";\n    }\n\n    if (root.TouchEvent) {\n      events += \" touchstart touchend touchmove touchcancel\";\n    }\n\n    events = events.split(' ');\n\n    for(var i = 0, len = events.length; i < len; i++) {\n      (function (e) {\n        dom[e] = function (element, selector) {\n          return fromEvent(element, e, selector);\n        };\n      }(events[i]))\n    }\n  }());\n\r\n  /**\n   * Creates an observable sequence when the DOM is loaded\n   * @returns {Observable} An observable sequence fired when the DOM is loaded\n   */\n  dom.ready = function () {\n    return new AnonymousObservable(function (observer) {\n      var addedHandlers = false;\n\n      function handler () {\n        observer.onNext();\n        observer.onCompleted();\n      }\n\n      if (document.readyState === 'complete') {\n        setTimeout(handler, 0);\n      } else {\n        addedHandlers = true;\n        document.addEventListener( 'DOMContentLoaded', handler, false );\n        root.addEventListener( 'load', handler, false );\n      }\n\n      return function () {\n        if (!addedHandlers) { return; }\n        document.removeEventListener( 'DOMContentLoaded', handler, false );\n        root.removeEventListener( 'load', handler, false );\n      };\n    });\n  };\n\r\n\n  // Gets the proper XMLHttpRequest for support for older IE\n  function getXMLHttpRequest() {\n    if (root.XMLHttpRequest) {\n      return new root.XMLHttpRequest();\n    } else {\n      var progId;\n      try {\n        var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];\n        for(var i = 0; i < 3; i++) {\n          try {\n            progId = progIds[i];\n            if (new root.ActiveXObject(progId)) {\n              break;\n            }\n          } catch(e) { }\n        }\n        return new root.ActiveXObject(progId);\n      } catch (e) {\n        throw new Error('XMLHttpRequest is not supported by your browser');\n      }\n    }\n  }\n\n  // Get CORS support even for older IE\n  function getCORSRequest() {\n    var xhr = new root.XMLHttpRequest();\n    if ('withCredentials' in xhr) {\n      return xhr;\n    } else if (!!root.XDomainRequest) {\n      return new XDomainRequest();\n    } else {\n      throw new Error('CORS is not supported by your browser');\n    }\n  }\n\nfunction normalizeAjaxLoadEvent(e, xhr, settings) {\n    var response = ('response' in xhr) ? xhr.response : xhr.responseText;\n    response = settings.responseType === 'json' ? JSON.parse(response) : response;\n    return {\n      response: response,\n      status: xhr.status,\n      responseType: xhr.responseType,\n      xhr: xhr,\n      originalEvent: e\n    };\n  }\n\n  function normalizeAjaxErrorEvent(e, xhr, type) {\n    return {\n      type: type,\n      status: xhr.status,\n      xhr: xhr,\n      originalEvent: e\n    };\n  }\n\n  /**\n   * Creates an observable for an Ajax request with either a settings object with url, headers, etc or a string for a URL.\n   *\n   * @example\n   *   source = Rx.DOM.ajax('/products');\n   *   source = Rx.DOM.ajax( url: 'products', method: 'GET' });\n   *\n   * @param {Object} settings Can be one of the following:\n   *\n   *  A string of the URL to make the Ajax call.\n   *  An object with the following properties\n   *   - url: URL of the request\n   *   - body: The body of the request\n   *   - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE\n   *   - async: Whether the request is async\n   *   - headers: Optional headers\n   *   - crossDomain: true if a cross domain request, else false\n   *\n   * @returns {Observable} An observable sequence containing the XMLHttpRequest.\n  */\n  var ajaxRequest = dom.ajax = function (options) {\n    var settings = {\n      method: 'GET',\n      crossDomain: false,\n      contentType: 'application/x-www-form-urlencoded; charset=UTF-8',\n      async: true,\n      headers: {},\n      responseType: 'text'\n    };\n\n    if(typeof options === 'string') {\n      settings.url = options;\n    } else {\n      for(var prop in options) {\n        if(hasOwnProperty.call(options, prop)) {\n          settings[prop] = options[prop];\n        }\n      }\n    }\n\n    if (!settings.crossDomain && !settings.headers['X-Requested-With']) {\n      settings.headers['X-Requested-With'] = 'XMLHttpRequest';\n    }\n    settings.hasContent = settings.body !== undefined;\n\n    return new AnonymousObservable(function (observer) {\n      var isDone = false;\n\n      try {\n        var xhr = settings.crossDomain ? getCORSRequest() : getXMLHttpRequest();\n      } catch (err) {\n        observer.onError(err);\n      }\n\n      try {\n        if (settings.user) {\n          xhr.open(settings.method, settings.url, settings.async, settings.user, settings.password);\n        } else {\n          xhr.open(settings.method, settings.url, settings.async);\n        }\n\n        var headers = settings.headers;\n        for (var header in headers) {\n          if (hasOwnProperty.call(headers, header)) {\n            xhr.setRequestHeader(header, headers[header]);\n          }\n        }\n\n        if(!!xhr.upload || (!('withCredentials' in xhr) && !!root.XDomainRequest)) {\n          xhr.onload = function(e) {\n            if(settings.progressObserver) {\n              settings.progressObserver.onNext(e);\n              settings.progressObserver.onCompleted();\n            }\n            observer.onNext(normalizeAjaxLoadEvent(e, xhr, settings));\n            observer.onCompleted();\n            isDone = true;\n          };\n\n          if(settings.progressObserver) {\n            xhr.onprogress = function(e) {\n              settings.progressObserver.onNext(e);\n            };\n          }\n\n          xhr.onerror = function(e) {\n            settings.progressObserver && settings.progressObserver.onError(e);\n            observer.onError(normalizeAjaxErrorEvent(e, xhr, 'error'));\n            isDone = true;\n          };\n\n          xhr.onabort = function(e) {\n            settings.progressObserver && settings.progressObserver.onError(e);\n            observer.onError(normalizeAjaxErrorEvent(e, xhr, 'abort'));\n            isDone = true;\n          };\n        } else {\n\n          xhr.onreadystatechange = function (e) {\n            if (xhr.readyState === 4) {\n              var status = xhr.status == 1223 ? 204 : xhr.status;\n              if ((status >= 200 && status <= 300) || status === 0 || status === '') {\n                observer.onNext(normalizeAjaxLoadEvent(e, xhr, settings));\n                observer.onCompleted();\n              } else {\n                observer.onError(normalizeAjaxErrorEvent(e, xhr, 'error'));\n              }\n              isDone = true;\n            }\n          };\n        }\n\n        xhr.send(settings.hasContent && settings.body || null);\n      } catch (e) {\n        observer.onError(e);\n      }\n\n      return function () {\n        if (!isDone && xhr.readyState !== 4) { xhr.abort(); }\n      };\n    });\n  };\n\n  /**\n   * Creates an observable sequence from an Ajax POST Request with the body.\n   *\n   * @param {String} url The URL to POST\n   * @param {Object} body The body to POST\n   * @returns {Observable} The observable sequence which contains the response from the Ajax POST.\n   */\n  dom.post = function (url, body) {\n    return ajaxRequest({ url: url, body: body, method: 'POST' });\n  };\n\n  /**\n   * Creates an observable sequence from an Ajax GET Request with the body.\n   *\n   * @param {String} url The URL to GET\n   * @returns {Observable} The observable sequence which contains the response from the Ajax GET.\n   */\n  var observableGet = dom.get = function (url) {\n    return ajaxRequest({ url: url });\n  };\n\n  /**\n   * Creates an observable sequence from JSON from an Ajax request\n   *\n   * @param {String} url The URL to GET\n   * @returns {Observable} The observable sequence which contains the parsed JSON.\n   */\n  dom.getJSON = function (url) {\n    if (!root.JSON && typeof root.JSON.parse !== 'function') { throw new TypeError('JSON is not supported in your runtime.'); }\n    return ajaxRequest({url: url, responseType: 'json'}).map(function (x) {\n      return x.response;\n    });\n  };\n\r\n  /** @private\n   * Destroys the current element\n   */\n  var destroy = (function () {\n    var trash = document.createElement('div');\n    return function (element) {\n      trash.appendChild(element);\n      trash.innerHTML = '';\n    };\n  })();\n\n  /**\n   * Creates an observable JSONP Request with the specified settings.\n   *\n   * @example\n   *   source = Rx.DOM.jsonpRequest('http://www.bing.com/?q=foo&JSONPCallback=?');\n   *   source = Rx.DOM.jsonpRequest( url: 'http://bing.com/?q=foo', jsonp: 'JSONPCallback' });\n   *\n   * @param {Object} settings Can be one of the following:\n   *\n   *  A string of the URL to make the JSONP call with the JSONPCallback=? in the url.\n   *  An object with the following properties\n   *   - url: URL of the request\n   *   - jsonp: The named callback parameter for the JSONP call\n   *   - jsonpCallback: Callback to execute. For when the JSONP callback can't be changed\n   *\n   * @returns {Observable} A cold observable containing the results from the JSONP call.\n   */\n   dom.jsonpRequest = (function() {\n     var id = 0;\n\n     return function(options) {\n       return new AnonymousObservable(function(observer) {\n\n         var callbackId = 'callback_' + (id++).toString(36);\n\n         var settings = {\n           jsonp: 'JSONPCallback',\n           async: true,\n           jsonpCallback: 'rxjsjsonpCallbacks' + callbackId\n         };\n\n         if(typeof options === 'string') {\n           settings.url = options;\n         } else {\n           for(var prop in options) {\n             if(hasOwnProperty.call(options, prop)) {\n               settings[prop] = options[prop];\n             }\n           }\n         }\n\n         var script = document.createElement('script');\n         script.type = 'text/javascript';\n         script.async = settings.async;\n         script.src = settings.url.replace(settings.jsonp, settings.jsonpCallback);\n\n         root[settings.jsonpCallback] = function(data) {\n           root[settings.jsonpCallback].called = true;\n           root[settings.jsonpCallback].data = data;\n         };\n\n         var handler = function(e) {\n           if(e.type === 'load' && !root[settings.jsonpCallback].called) {\n             e = { type: 'error' };\n           }\n           var status = e.type === 'error' ? 400 : 200;\n           var data = root[settings.jsonpCallback].data;\n\n           if(status === 200) {\n             observer.onNext({\n               status: status,\n               responseType: 'jsonp',\n               response: data,\n               originalEvent: e\n             });\n\n             observer.onCompleted();\n           }\n           else {\n             observer.onError({\n               type: 'error',\n               status: status,\n               originalEvent: e\n             });\n           }\n         };\n\n         script.onload = script.onreadystatechanged = script.onerror = handler;\n\n         var head = document.getElementsByTagName('head')[0] || document.documentElement;\n         head.insertBefore(script, head.firstChild);\n\n         return function() {\n           script.onload = script.onreadystatechanged = script.onerror = null;\n           destroy(script);\n           script = null;\n         };\n       });\n     }\n   }());\n\r\n   /**\n   * Creates a WebSocket Subject with a given URL, protocol and an optional observer for the open event.\n   *\n   * @example\n   *  var socket = Rx.DOM.fromWebSocket('http://localhost:8080', 'stock-protocol', openObserver, closingObserver);\n   *\n   * @param {String} url The URL of the WebSocket.\n   * @param {String} protocol The protocol of the WebSocket.\n   * @param {Observer} [openObserver] An optional Observer to capture the open event.\n   * @param {Observer} [closingObserver] An optional Observer to capture the moment before the underlying socket is closed.\n   * @returns {Subject} An observable sequence wrapping a WebSocket.\n   */\n  dom.fromWebSocket = function (url, protocol, openObserver, closingObserver) {\n    if (!WebSocket) { throw new TypeError('WebSocket not implemented in your runtime.'); }\n\n    var socket;\n\n    function socketClose(code, reason) {\n      if (socket) {\n        if (closingObserver) {\n          closingObserver.onNext();\n          closingObserver.onCompleted();\n        }\n        if (!code) {\n          socket.close();\n        } else {\n          socket.close(code, reason);\n        }\n      }\n    }\n\n    var observable = new AnonymousObservable(function (obs) {\n      socket = protocol ? new WebSocket(url, protocol) : new WebSocket(url);\n\n      function openHandler(e) {\n        openObserver.onNext(e);\n        openObserver.onCompleted();\n        socket.removeEventListener('open', openHandler, false);\n      }\n      function messageHandler(e) { obs.onNext(e); }\n      function errHandler(e) { obs.onError(e); }\n      function closeHandler(e) {\n        if (e.code !== 1000 || !e.wasClean) { return obs.onError(e); }\n        obs.onCompleted();\n      }\n\n      openObserver && socket.addEventListener('open', openHandler, false);\n      socket.addEventListener('message', messageHandler, false);\n      socket.addEventListener('error', errHandler, false);\n      socket.addEventListener('close', closeHandler, false);\n\n      return function () {\n        socketClose();\n\n        socket.removeEventListener('message', messageHandler, false);\n        socket.removeEventListener('error', errHandler, false);\n        socket.removeEventListener('close', closeHandler, false);\n      };\n    });\n\n    var observer = observerCreate(\n      function (data) {\n        socket && socket.readyState === WebSocket.OPEN && socket.send(data);\n      },\n      function(e) {\n        if (!e.code) {\n          throw new Error('no code specified. be sure to pass { code: ###, reason: \"\" } to onError()');\n        }\n        socketClose(e.code, e.reason || '');\n      },\n      function() {\n        socketClose(1000, '');\n      }\n    );\n\n    return Subject.create(observer, observable);\n  };\n\r\n  /**\n   * Creates a Web Worker with a given URL as a Subject.\n   *\n   * @example\n   * var worker = Rx.DOM.fromWebWorker('worker.js');\n   *\n   * @param {String} url The URL of the Web Worker.\n   * @returns {Subject} A Subject wrapping the Web Worker.\n   */\n  dom.fromWebWorker = function (url) {\n    if (!root.Worker) { throw new TypeError('Worker not implemented in your runtime.'); }\n    var worker = new root.Worker(url);\n\n    var observable = new AnonymousObservable(function (obs) {\n\n      function messageHandler(data) { obs.onNext(data); }\n      function errHandler(err) { obs.onError(err); }\n\n      worker.addEventListener('message', messageHandler, false);\n      worker.addEventListener('error', errHandler, false);\n\n      return function () {\n        worker.close();\n        worker.removeEventListener('message', messageHandler, false);\n        worker.removeEventListener('error', errHandler, false);\n      };\n    });\n\n    var observer = observerCreate(function (data) {\n      worker.postMessage(data);\n    });\n\n    return Subject.create(observer, observable);\n  };\n\r\n  /**\n   * This method wraps an EventSource as an observable sequence.\n   * @param {String} url The url of the server-side script.\n   * @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event.\n   * @returns {Observable} An observable sequence which represents the data from a server-side event.\n   */\n  dom.fromEventSource = function (url, openObserver) {\n    if (!root.EventSource) { throw new TypeError('EventSource not implemented in your runtime.'); }\n    return new AnonymousObservable(function (observer) {\n      var source = new root.EventSource(url);\n\n      function onOpen(e) {\n        openObserver.onNext(e);\n        openObserver.onCompleted();\n        source.removeEventListener('open', onOpen, false);\n      }\n\n      function onError(e) {\n        if (e.readyState === EventSource.CLOSED) {\n          observer.onCompleted();\n        } else {\n          observer.onError(e);\n        }\n      }\n\n      function onMessage(e) {\n        observer.onNext(e);\n      }\n\n      openObserver && source.addEventListener('open', onOpen, false);\n      source.addEventListener('error', onError, false);\n      source.addEventListener('message', onMessage, false);\n\n      return function () {\n        source.removeEventListener('error', onError, false);\n        source.removeEventListener('message', onMessage, false);\n        source.close();\n      };\n    });\n  };\n\r\n  /**\n   * Creates an observable sequence from a Mutation Observer.\n   * MutationObserver provides developers a way to react to changes in a DOM.\n   * @example\n   *  Rx.DOM.fromMutationObserver(document.getElementById('foo'), { attributes: true, childList: true, characterData: true });\n   *\n   * @param {Object} target The Node on which to obserave DOM mutations.\n   * @param {Object} options A MutationObserverInit object, specifies which DOM mutations should be reported.\n   * @returns {Observable} An observable sequence which contains mutations on the given DOM target.\n   */\n  dom.fromMutationObserver = function (target, options) {\n    var BrowserMutationObserver = root.MutationObserver || root.WebKitMutationObserver;\n    if (!BrowserMutationObserver) { throw new TypeError('MutationObserver not implemented in your runtime.'); }\n    return observableCreate(function (observer) {\n      var mutationObserver = new BrowserMutationObserver(observer.onNext.bind(observer));\n      mutationObserver.observe(target, options);\n\n      return mutationObserver.disconnect.bind(mutationObserver);\n    });\n  };\n\r\n  // Get the right animation frame method\n  var requestAnimFrame, cancelAnimFrame;\n  if (root.requestAnimationFrame) {\n    requestAnimFrame = root.requestAnimationFrame;\n    cancelAnimFrame = root.cancelAnimationFrame;\n  } else if (root.mozRequestAnimationFrame) {\n    requestAnimFrame = root.mozRequestAnimationFrame;\n    cancelAnimFrame = root.mozCancelAnimationFrame;\n  } else if (root.webkitRequestAnimationFrame) {\n    requestAnimFrame = root.webkitRequestAnimationFrame;\n    cancelAnimFrame = root.webkitCancelAnimationFrame;\n  } else if (root.msRequestAnimationFrame) {\n    requestAnimFrame = root.msRequestAnimationFrame;\n    cancelAnimFrame = root.msCancelAnimationFrame;\n  } else if (root.oRequestAnimationFrame) {\n    requestAnimFrame = root.oRequestAnimationFrame;\n    cancelAnimFrame = root.oCancelAnimationFrame;\n  } else {\n    requestAnimFrame = function(cb) { root.setTimeout(cb, 1000 / 60); };\n    cancelAnimFrame = root.clearTimeout;\n  }\n\n  /**\n   * Gets a scheduler that schedules schedules work on the requestAnimationFrame for immediate actions.\n   */\n  Scheduler.requestAnimationFrame = (function () {\n\n    function scheduleNow(state, action) {\n      var scheduler = this,\n        disposable = new SingleAssignmentDisposable();\n      var id = requestAnimFrame(function () {\n        !disposable.isDisposed && (disposable.setDisposable(action(scheduler, state)));\n      });\n      return new CompositeDisposable(disposable, disposableCreate(function () {\n        cancelAnimFrame(id);\n      }));\n    }\n\n    function scheduleRelative(state, dueTime, action) {\n      var scheduler = this, dt = Scheduler.normalize(dueTime);\n      if (dt === 0) { return scheduler.scheduleWithState(state, action); }\n      var disposable = new SingleAssignmentDisposable();\n      var id = root.setTimeout(function () {\n        if (!disposable.isDisposed) {\n          disposable.setDisposable(action(scheduler, state));\n        }\n      }, dt);\n      return new CompositeDisposable(disposable, disposableCreate(function () {\n        root.clearTimeout(id);\n      }));\n    }\n\n    function scheduleAbsolute(state, dueTime, action) {\n      return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);\n    }\n\n    return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);\n\n  }());\n\r\n  /**\n   * Scheduler that uses a MutationObserver changes as the scheduling mechanism\n   */\n  Scheduler.microtask = (function () {\n\n    var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false, scheduleMethod;\n\n    function clearMethod(handle) {\n      delete tasksByHandle[handle];\n    }\n\n    function runTask(handle) {\n      if (currentlyRunning) {\n        root.setTimeout(function () { runTask(handle) }, 0);\n      } else {\n        var task = tasksByHandle[handle];\n        if (task) {\n          currentlyRunning = true;\n          try {\n            task();\n          } catch (e) {\n            throw e;\n          } finally {\n            clearMethod(handle);\n            currentlyRunning = false;\n          }\n        }\n      }\n    }\n\n    function postMessageSupported () {\n      // Ensure not in a worker\n      if (!root.postMessage || root.importScripts) { return false; }\n      var isAsync = false, oldHandler = root.onmessage;\n      // Test for async\n      root.onmessage = function () { isAsync = true; };\n      root.postMessage('', '*');\n      root.onmessage = oldHandler;\n\n      return isAsync;\n    }\n\n    // Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout\n    var BrowserMutationObserver = root.MutationObserver || root.WebKitMutationObserver;\n    if (!!BrowserMutationObserver) {\n\n      var PREFIX = 'drainqueue_';\n\n      var observer = new BrowserMutationObserver(function(mutations) {\n        mutations.forEach(function (mutation) {\n          runTask(mutation.attributeName.substring(PREFIX.length));\n        })\n      });\n\n      var element = document.createElement('div');\n      observer.observe(element, { attributes: true });\n\n      // Prevent leaks\n      root.addEventListener('unload', function () {\n        observer.disconnect();\n        observer = null;\n      }, false);\n\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        element.setAttribute(PREFIX + id, 'drainQueue');\n        return id;\n      };\n    } else if (typeof root.setImmediate === 'function') {\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        root.setImmediate(function () {\n          runTask(id);\n        });\n\n        return id;\n      };\n    } else if (postMessageSupported()) {\n      var MSG_PREFIX = 'ms.rx.schedule' + Math.random();\n\n      function onGlobalPostMessage(event) {\n        // Only if we're a match to avoid any other global events\n        if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {\n          runTask(event.data.substring(MSG_PREFIX.length));\n        }\n      }\n\n      if (root.addEventListener) {\n        root.addEventListener('message', onGlobalPostMessage, false);\n      } else if (root.attachEvent){\n        root.attachEvent('onmessage', onGlobalPostMessage);\n      }\n\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[currentId] = action;\n        root.postMessage(MSG_PREFIX + currentId, '*');\n        return id;\n      };\n    } else if (!!root.MessageChannel) {\n      var channel = new root.MessageChannel();\n\n      channel.port1.onmessage = function (event) {\n        runTask(event.data);\n      };\n\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        channel.port2.postMessage(id);\n        return id;\n      };\n    } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {\n\n      scheduleMethod = function (action) {\n        var scriptElement = root.document.createElement('script');\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n\n        scriptElement.onreadystatechange = function () {\n          runTask(id);\n          scriptElement.onreadystatechange = null;\n          scriptElement.parentNode.removeChild(scriptElement);\n          scriptElement = null;\n        };\n        root.document.documentElement.appendChild(scriptElement);\n\n        return id;\n      };\n\n    } else {\n      scheduleMethod = function (action) {\n        var id = nextHandle++;\n        tasksByHandle[id] = action;\n        root.setTimeout(function () {\n          runTask(id);\n        }, 0);\n\n        return id;\n      };\n    }\n\n    function scheduleNow(state, action) {\n\n      var scheduler = this,\n        disposable = new SingleAssignmentDisposable();\n\n      var id = scheduleMethod(function () {\n        !disposable.isDisposed && (disposable.setDisposable(action(scheduler, state)));\n      });\n\n      return new CompositeDisposable(disposable, disposableCreate(function () {\n        clearMethod(id);\n      }));\n    }\n\n    function scheduleRelative(state, dueTime, action) {\n      var scheduler = this, dt = Scheduler.normalize(dueTime);\n      if (dt === 0) { return scheduler.scheduleWithState(state, action); }\n      var disposable = new SingleAssignmentDisposable();\n      var id = root.setTimeout(function () {\n        if (!disposable.isDisposed) {\n          disposable.setDisposable(action(scheduler, state));\n        }\n      }, dt);\n      return new CompositeDisposable(disposable, disposableCreate(function () {\n        root.clearTimeout(id);\n      }));\n    }\n\n    function scheduleAbsolute(state, dueTime, action) {\n      return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);\n    }\n\n    return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);\n  }());\n\r\n  Rx.DOM.geolocation = {\n    /**\n    * Obtains the geographic position, in terms of latitude and longitude coordinates, of the device.\n    * @param {Object} [geolocationOptions] An object literal to specify one or more of the following attributes and desired values:\n    *   - enableHighAccuracy: Specify true to obtain the most accurate position possible, or false to optimize in favor of performance and power consumption.\n    *   - timeout: An Integer value that indicates the time, in milliseconds, allowed for obtaining the position.\n    *              If timeout is Infinity, (the default value) the location request will not time out.\n    *              If timeout is zero (0) or negative, the results depend on the behavior of the location provider.\n    *   - maximumAge: An Integer value indicating the maximum age, in milliseconds, of cached position information.\n    *                 If maximumAge is non-zero, and a cached position that is no older than maximumAge is available, the cached position is used instead of obtaining an updated location.\n    *                 If maximumAge is zero (0), watchPosition always tries to obtain an updated position, even if a cached position is already available.\n    *                 If maximumAge is Infinity, any cached position is used, regardless of its age, and watchPosition only tries to obtain an updated position if no cached position data exists.\n    * @returns {Observable} An observable sequence with the geographical location of the device running the client.\n    */\n    getCurrentPosition: function (geolocationOptions) {\n      if (!root.navigator && !root.navigation.geolocation) { throw new TypeError('geolocation not available'); }\n\n      return new AnonymousObservable(function (observer) {\n        root.navigator.geolocation.getCurrentPosition(\n          function (data) {\n            observer.onNext(data);\n            observer.onCompleted();\n          },\n          observer.onError.bind(observer),\n          geolocationOptions);\n      });\n    },\n\n    /**\n    * Begins listening for updates to the current geographical location of the device running the client.\n    * @param {Object} [geolocationOptions] An object literal to specify one or more of the following attributes and desired values:\n    *   - enableHighAccuracy: Specify true to obtain the most accurate position possible, or false to optimize in favor of performance and power consumption.\n    *   - timeout: An Integer value that indicates the time, in milliseconds, allowed for obtaining the position.\n    *              If timeout is Infinity, (the default value) the location request will not time out.\n    *              If timeout is zero (0) or negative, the results depend on the behavior of the location provider.\n    *   - maximumAge: An Integer value indicating the maximum age, in milliseconds, of cached position information.\n    *                 If maximumAge is non-zero, and a cached position that is no older than maximumAge is available, the cached position is used instead of obtaining an updated location.\n    *                 If maximumAge is zero (0), watchPosition always tries to obtain an updated position, even if a cached position is already available.\n    *                 If maximumAge is Infinity, any cached position is used, regardless of its age, and watchPosition only tries to obtain an updated position if no cached position data exists.\n    * @returns {Observable} An observable sequence with the current geographical location of the device running the client.\n    */\n    watchPosition: function (geolocationOptions) {\n      if (!root.navigator && !root.navigation.geolocation) { throw new TypeError('geolocation not available'); }\n\n      return new AnonymousObservable(function (observer) {\n        var watchId = root.navigator.geolocation.watchPosition(\n          observer.onNext.bind(observer),\n          observer.onError.bind(observer),\n          geolocationOptions);\n\n        return function () {\n          root.navigator.geolocation.clearWatch(watchId);\n        };\n      }).publish().refCount();\n    }\n  };\n\r\n  /**\n   * The FileReader object lets web applications asynchronously read the contents of\n   * files (or raw data buffers) stored on the user's computer, using File or Blob objects\n   * to specify the file or data to read as an observable sequence.\n   * @param {String} file The file to read.\n   * @param {Observer} An observer to watch for progress.\n   * @returns {Object} An object which contains methods for reading the data.\n   */\n  dom.fromReader = function(file, progressObserver) {\n    if (!root.FileReader) { throw new TypeError('FileReader not implemented in your runtime.'); }\n\n    function _fromReader(readerFn, file, encoding) {\n      return new AnonymousObservable(function(observer) {\n        var reader = new root.FileReader();\n        var subject = new AsyncSubject();\n\n        function loadHandler(e) {\n          progressObserver && progressObserver.onCompleted();\n          subject.onNext(e.target.result);\n          subject.onCompleted();\n        }\n\n        function errorHandler(e) {\n          subject.onError(e.target.error);\n        }\n\n        function progressHandler(e) {\n          progressObserver.onNext(e);\n        }\n\n        reader.addEventListener('load', loadHandler, false);\n        reader.addEventListener('error', errorHandler, false);\n        progressObserver && reader.addEventListener('progress', progressHandler, false);\n\n        reader[readerFn](file, encoding);\n\n        return new CompositeDisposable(subject.subscribe(observer), disposableCreate(function () {\n          reader.readyState == root.FileReader.LOADING && reader.abort();\n          reader.removeEventListener('load', loadHandler, false);\n          reader.removeEventListener('error', errorHandler, false);\n          progressObserver && reader.removeEventListener('progress', progressHandler, false);\n        }));\n      });\n    }\n\n    return {\n      /**\n       * This method is used to read the file as an ArrayBuffer as an Observable stream.\n       * @returns {Observable} An observable stream of an ArrayBuffer\n       */\n      asArrayBuffer : function() {\n        return _fromReader('readAsArrayBuffer', file);\n      },\n      /**\n       * This method is used to read the file as a binary data string as an Observable stream.\n       * @returns {Observable} An observable stream of a binary data string.\n       */\n      asBinaryString : function() {\n        return _fromReader('readAsBinaryString', file);\n      },\n      /**\n       * This method is used to read the file as a URL of the file's data as an Observable stream.\n       * @returns {Observable} An observable stream of a URL representing the file's data.\n       */\n      asDataURL : function() {\n        return _fromReader('readAsDataURL', file);\n      },\n      /**\n       * This method is used to read the file as a string as an Observable stream.\n       * @returns {Observable} An observable stream of the string contents of the file.\n       */\n      asText : function(encoding) {\n        return _fromReader('readAsText', file, encoding);\n      }\n    };\n  };\n\r\n  return Rx;\n}));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module), (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/rx-dom/dist/rx.dom.js\n ** module id = 281\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/rx-dom/dist/rx.dom.js?");
},function(module,exports){eval("/*!\n* screenfull\n* v3.0.0 - 2015-11-24\n* (c) Sindre Sorhus; MIT License\n*/\n(function () {\n	'use strict';\n\n	var isCommonjs = typeof module !== 'undefined' && module.exports;\n	var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element;\n\n	var fn = (function () {\n		var val;\n		var valLength;\n\n		var fnMap = [\n			[\n				'requestFullscreen',\n				'exitFullscreen',\n				'fullscreenElement',\n				'fullscreenEnabled',\n				'fullscreenchange',\n				'fullscreenerror'\n			],\n			// new WebKit\n			[\n				'webkitRequestFullscreen',\n				'webkitExitFullscreen',\n				'webkitFullscreenElement',\n				'webkitFullscreenEnabled',\n				'webkitfullscreenchange',\n				'webkitfullscreenerror'\n\n			],\n			// old WebKit (Safari 5.1)\n			[\n				'webkitRequestFullScreen',\n				'webkitCancelFullScreen',\n				'webkitCurrentFullScreenElement',\n				'webkitCancelFullScreen',\n				'webkitfullscreenchange',\n				'webkitfullscreenerror'\n\n			],\n			[\n				'mozRequestFullScreen',\n				'mozCancelFullScreen',\n				'mozFullScreenElement',\n				'mozFullScreenEnabled',\n				'mozfullscreenchange',\n				'mozfullscreenerror'\n			],\n			[\n				'msRequestFullscreen',\n				'msExitFullscreen',\n				'msFullscreenElement',\n				'msFullscreenEnabled',\n				'MSFullscreenChange',\n				'MSFullscreenError'\n			]\n		];\n\n		var i = 0;\n		var l = fnMap.length;\n		var ret = {};\n\n		for (; i < l; i++) {\n			val = fnMap[i];\n			if (val && val[1] in document) {\n				for (i = 0, valLength = val.length; i < valLength; i++) {\n					ret[fnMap[0][i]] = val[i];\n				}\n				return ret;\n			}\n		}\n\n		return false;\n	})();\n\n	var screenfull = {\n		request: function (elem) {\n			var request = fn.requestFullscreen;\n\n			elem = elem || document.documentElement;\n\n			// Work around Safari 5.1 bug: reports support for\n			// keyboard in fullscreen even though it doesn't.\n			// Browser sniffing, since the alternative with\n			// setTimeout is even worse.\n			if (/5\\.1[\\.\\d]* Safari/.test(navigator.userAgent)) {\n				elem[request]();\n			} else {\n				elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);\n			}\n		},\n		exit: function () {\n			document[fn.exitFullscreen]();\n		},\n		toggle: function (elem) {\n			if (this.isFullscreen) {\n				this.exit();\n			} else {\n				this.request(elem);\n			}\n		},\n		raw: fn\n	};\n\n	if (!fn) {\n		if (isCommonjs) {\n			module.exports = false;\n		} else {\n			window.screenfull = false;\n		}\n\n		return;\n	}\n\n	Object.defineProperties(screenfull, {\n		isFullscreen: {\n			get: function () {\n				return Boolean(document[fn.fullscreenElement]);\n			}\n		},\n		element: {\n			enumerable: true,\n			get: function () {\n				return document[fn.fullscreenElement];\n			}\n		},\n		enabled: {\n			enumerable: true,\n			get: function () {\n				// Coerce to boolean in case of old WebKit\n				return Boolean(document[fn.fullscreenEnabled]);\n			}\n		}\n	});\n\n	if (isCommonjs) {\n		module.exports = screenfull;\n	} else {\n		window.screenfull = screenfull;\n	}\n})();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/screenfull/dist/screenfull.js\n ** module id = 282\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/screenfull/dist/screenfull.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = classNameFromVNode;\n\nvar _selectorParser2 = __webpack_require__(85);\n\nvar _selectorParser3 = _interopRequireDefault(_selectorParser2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction classNameFromVNode(vNode) {\n  var _selectorParser = (0, _selectorParser3.default)(vNode.sel);\n\n  var cn = _selectorParser.className;\n\n  if (!vNode.data) {\n    return cn;\n  }\n\n  var _vNode$data = vNode.data;\n  var dataClass = _vNode$data.class;\n  var props = _vNode$data.props;\n\n  if (dataClass) {\n    var c = Object.keys(vNode.data.class).filter(function (cl) {\n      return vNode.data.class[cl];\n    });\n    cn += ' ' + c.join(' ');\n  }\n\n  if (props && props.className) {\n    cn += ' ' + props.className;\n  }\n\n  return cn.trim();\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-selector/lib/classNameFromVNode.js\n ** module id = 283\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-selector/lib/classNameFromVNode.js?")},function(module,exports){eval("\n// All SVG children elements, not in this list, should self-close\n\nmodule.exports = {\n  // http://www.w3.org/TR/SVG/intro.html#TermContainerElement\n  'a': true,\n  'defs': true,\n  'glyph': true,\n  'g': true,\n  'marker': true,\n  'mask': true,\n  'missing-glyph': true,\n  'pattern': true,\n  'svg': true,\n  'switch': true,\n  'symbol': true,\n\n  // http://www.w3.org/TR/SVG/intro.html#TermDescriptiveElement\n  'desc': true,\n  'metadata': true,\n  'title': true\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/container-elements.js\n ** module id = 284\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/container-elements.js?")},function(module,exports,__webpack_require__){eval("\nvar parseSelector = __webpack_require__(86);\nvar VOID_ELEMENTS = __webpack_require__(288);\nvar CONTAINER_ELEMENTS = __webpack_require__(284);\n\nmodule.exports = function init(modules) {\n  function parse(data) {\n    return modules.reduce(function (arr, fn) {\n      arr.push(fn(data));\n      return arr;\n    }, []).filter(function (result) {\n      return result !== '';\n    });\n  }\n\n  return function renderToString(vnode) {\n    if (!vnode.sel && vnode.text) {\n      return vnode.text;\n    }\n\n    vnode.data = vnode.data || {};\n\n    // Support thunks\n    if (typeof vnode.sel === 'string' && vnode.sel.slice(0, 5) === 'thunk') {\n      vnode = vnode.data.fn.apply(null, vnode.data.args);\n    }\n\n    var tagName = parseSelector(vnode.sel).tagName;\n    var attributes = parse(vnode);\n    var svg = vnode.data.ns === 'http://www.w3.org/2000/svg';\n    var tag = [];\n\n    // Open tag\n    tag.push('<' + tagName);\n    if (attributes.length) {\n      tag.push(' ' + attributes.join(' '));\n    }\n    if (svg && CONTAINER_ELEMENTS[tagName] !== true) {\n      tag.push(' /');\n    }\n    tag.push('>');\n\n    // Close tag, if needed\n    if (VOID_ELEMENTS[tagName] !== true && !svg || svg && CONTAINER_ELEMENTS[tagName] === true) {\n      if (vnode.data.props && vnode.data.props.innerHTML) {\n        tag.push(vnode.data.props.innerHTML);\n      } else if (vnode.text) {\n        tag.push(vnode.text);\n      } else if (vnode.children) {\n        vnode.children.forEach(function (child) {\n          tag.push(renderToString(child));\n        });\n      }\n      tag.push('</' + tagName + '>');\n    }\n\n    return tag.join('');\n  };\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/init.js\n ** module id = 285\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/init.js?")},function(module,exports,__webpack_require__){eval("\nvar forOwn = __webpack_require__(91);\nvar escape = __webpack_require__(90);\nvar union = __webpack_require__(321);\n\nvar parseSelector = __webpack_require__(86);\n\n// data.attrs, data.props, data.class\n\nmodule.exports = function attributes(vnode) {\n  var selector = parseSelector(vnode.sel);\n  var parsedClasses = selector.className.split(' ');\n\n  var attributes = [];\n  var classes = [];\n  var values = {};\n\n  if (selector.id) {\n    values.id = selector.id;\n  }\n\n  setAttributes(vnode.data.props, values);\n  setAttributes(vnode.data.attrs, values); // `attrs` override `props`, not sure if this is good so\n\n  if (vnode.data.class) {\n    // Omit `className` attribute if `class` is set on vnode\n    values.class = undefined;\n  }\n  forOwn(vnode.data.class, function (value, key) {\n    if (value === true) {\n      classes.push(key);\n    }\n  });\n  classes = union(classes, values.class, parsedClasses).filter(function (x) {\n    return x !== '';\n  });\n\n  if (classes.length) {\n    values.class = classes.join(' ');\n  }\n\n  forOwn(values, function (value, key) {\n    attributes.push(value === true ? key : key + '=\"' + escape(value) + '\"');\n  });\n\n  return attributes.length ? attributes.join(' ') : '';\n};\n\nfunction setAttributes(values, target) {\n  forOwn(values, function (value, key) {\n    if (key === 'htmlFor') {\n      target['for'] = value;\n      return;\n    }\n    if (key === 'className') {\n      target['class'] = value.split(' ');\n      return;\n    }\n    if (key === 'innerHTML') {\n      return;\n    }\n    target[key] = value;\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/modules/attributes.js\n ** module id = 286\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/modules/attributes.js?")},function(module,exports,__webpack_require__){eval("var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar forOwn = __webpack_require__(91);\nvar escape = __webpack_require__(90);\nvar kebabCase = __webpack_require__(318);\n\n// data.style\n\nmodule.exports = function style(vnode) {\n  var styles = [];\n  var style = vnode.data.style || {};\n\n  // merge in `delayed` properties\n  if (style.delayed) {\n    _extends(style, style.delayed);\n  }\n\n  forOwn(style, function (value, key) {\n    // omit hook objects\n    if (typeof value === 'string') {\n      styles.push(kebabCase(key) + ': ' + escape(value));\n    }\n  });\n\n  return styles.length ? 'style=\"' + styles.join('; ') + '\"' : '';\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/modules/style.js\n ** module id = 287\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/modules/style.js?")},function(module,exports){eval("\n// http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements\n\nmodule.exports = {\n  area: true,\n  base: true,\n  br: true,\n  col: true,\n  embed: true,\n  hr: true,\n  img: true,\n  input: true,\n  keygen: true,\n  link: true,\n  meta: true,\n  param: true,\n  source: true,\n  track: true,\n  wbr: true\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/void-elements.js\n ** module id = 288\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/void-elements.js?")},function(module,exports,__webpack_require__){eval("var VNode = __webpack_require__(58);\nvar is = __webpack_require__(44);\n\nfunction addNS(data, children) {\n  data.ns = 'http://www.w3.org/2000/svg';\n  if (children !== undefined) {\n    for (var i = 0; i < children.length; ++i) {\n      addNS(children[i].data, children[i].children);\n    }\n  }\n}\n\nmodule.exports = function h(sel, b, c) {\n  var data = {}, children, text, i;\n  if (arguments.length === 3) {\n    data = b;\n    if (is.array(c)) { children = c; }\n    else if (is.primitive(c)) { text = c; }\n  } else if (arguments.length === 2) {\n    if (is.array(b)) { children = b; }\n    else if (is.primitive(b)) { text = b; }\n    else { data = b; }\n  }\n  if (is.array(children)) {\n    for (i = 0; i < children.length; ++i) {\n      if (is.primitive(children[i])) children[i] = VNode(undefined, undefined, undefined, children[i]);\n    }\n  }\n  if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g') {\n    addNS(data, children);\n  }\n  return VNode(sel, data, children, text, undefined);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/h.js\n ** module id = 289\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/h.js?")},function(module,exports){eval("function createElement(tagName){\n  return document.createElement(tagName);\n}\n\nfunction createElementNS(namespaceURI, qualifiedName){\n  return document.createElementNS(namespaceURI, qualifiedName);\n}\n\nfunction createTextNode(text){\n  return document.createTextNode(text);\n}\n\n\nfunction insertBefore(parentNode, newNode, referenceNode){\n  parentNode.insertBefore(newNode, referenceNode);\n}\n\n\nfunction removeChild(node, child){\n  node.removeChild(child);\n}\n\nfunction appendChild(node, child){\n  node.appendChild(child);\n}\n\nfunction parentNode(node){\n  return node.parentElement;\n}\n\nfunction nextSibling(node){\n  return node.nextSibling;\n}\n\nfunction tagName(node){\n  return node.tagName;\n}\n\nfunction setTextContent(node, text){\n  node.textContent = text;\n}\n\nmodule.exports = {\n  createElement: createElement,\n  createElementNS: createElementNS,\n  createTextNode: createTextNode,\n  appendChild: appendChild,\n  removeChild: removeChild,\n  insertBefore: insertBefore,\n  parentNode: parentNode,\n  nextSibling: nextSibling,\n  tagName: tagName,\n  setTextContent: setTextContent\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/htmldomapi.js\n ** module id = 290\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/htmldomapi.js?")},function(module,exports){eval('var booleanAttrs = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "compact", "controls", "declare", \n                "default", "defaultchecked", "defaultmuted", "defaultselected", "defer", "disabled", "draggable", \n                "enabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "itemscope", "loop", "multiple", \n                "muted", "nohref", "noresize", "noshade", "novalidate", "nowrap", "open", "pauseonexit", "readonly", \n                "required", "reversed", "scoped", "seamless", "selected", "sortable", "spellcheck", "translate", \n                "truespeed", "typemustmatch", "visible"];\n    \nvar booleanAttrsDict = {};\nfor(var i=0, len = booleanAttrs.length; i < len; i++) {\n  booleanAttrsDict[booleanAttrs[i]] = true;\n}\n    \nfunction updateAttrs(oldVnode, vnode) {\n  var key, cur, old, elm = vnode.elm,\n      oldAttrs = oldVnode.data.attrs || {}, attrs = vnode.data.attrs || {};\n  \n  // update modified attributes, add new attributes\n  for (key in attrs) {\n    cur = attrs[key];\n    old = oldAttrs[key];\n    if (old !== cur) {\n      // TODO: add support to namespaced attributes (setAttributeNS)\n      if(!cur && booleanAttrsDict[key])\n        elm.removeAttribute(key);\n      else\n        elm.setAttribute(key, cur);\n    }\n  }\n  //remove removed attributes\n  // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)\n  // the other option is to remove all attributes with value == undefined\n  for (key in oldAttrs) {\n    if (!(key in attrs)) {\n      elm.removeAttribute(key);\n    }\n  }\n}\n\nmodule.exports = {create: updateAttrs, update: updateAttrs};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/modules/attributes.js\n ** module id = 291\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/modules/attributes.js?')},function(module,exports){eval("function updateClass(oldVnode, vnode) {\n  var cur, name, elm = vnode.elm,\n      oldClass = oldVnode.data.class || {},\n      klass = vnode.data.class || {};\n  for (name in oldClass) {\n    if (!klass[name]) {\n      elm.classList.remove(name);\n    }\n  }\n  for (name in klass) {\n    cur = klass[name];\n    if (cur !== oldClass[name]) {\n      elm.classList[cur ? 'add' : 'remove'](name);\n    }\n  }\n}\n\nmodule.exports = {create: updateClass, update: updateClass};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/modules/class.js\n ** module id = 292\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/modules/class.js?")},function(module,exports,__webpack_require__){eval("var is = __webpack_require__(44);\n\nfunction arrInvoker(arr) {\n  return function() {\n    // Special case when length is two, for performance\n    arr.length === 2 ? arr[0](arr[1]) : arr[0].apply(undefined, arr.slice(1));\n  };\n}\n\nfunction fnInvoker(o) {\n  return function(ev) { o.fn(ev); };\n}\n\nfunction updateEventListeners(oldVnode, vnode) {\n  var name, cur, old, elm = vnode.elm,\n      oldOn = oldVnode.data.on || {}, on = vnode.data.on;\n  if (!on) return;\n  for (name in on) {\n    cur = on[name];\n    old = oldOn[name];\n    if (old === undefined) {\n      if (is.array(cur)) {\n        elm.addEventListener(name, arrInvoker(cur));\n      } else {\n        cur = {fn: cur};\n        on[name] = cur;\n        elm.addEventListener(name, fnInvoker(cur));\n      }\n    } else if (is.array(old)) {\n      // Deliberately modify old array since it's captured in closure created with `arrInvoker`\n      old.length = cur.length;\n      for (var i = 0; i < old.length; ++i) old[i] = cur[i];\n      on[name]  = old;\n    } else {\n      old.fn = cur;\n      on[name] = old;\n    }\n  }\n}\n\nmodule.exports = {create: updateEventListeners, update: updateEventListeners};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/modules/eventlisteners.js\n ** module id = 293\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/modules/eventlisteners.js?")},function(module,exports){eval("var raf = (typeof window !== 'undefined' && window.requestAnimationFrame) || setTimeout;\nvar nextFrame = function(fn) { raf(function() { raf(fn); }); };\n\nfunction setNextFrame(obj, prop, val) {\n  nextFrame(function() { obj[prop] = val; });\n}\n\nfunction getTextNodeRect(textNode) {\n  var rect;\n  if (document.createRange) {\n    var range = document.createRange();\n    range.selectNodeContents(textNode);\n    if (range.getBoundingClientRect) {\n        rect = range.getBoundingClientRect();\n    }\n  }\n  return rect;\n}\n\nfunction calcTransformOrigin(isTextNode, textRect, boundingRect) {\n  if (isTextNode) {\n    if (textRect) {\n      //calculate pixels to center of text from left edge of bounding box\n      var relativeCenterX = textRect.left + textRect.width/2 - boundingRect.left;\n      var relativeCenterY = textRect.top + textRect.height/2 - boundingRect.top;\n      return relativeCenterX + 'px ' + relativeCenterY + 'px';\n    }\n  }\n  return '0 0'; //top left\n}\n\nfunction getTextDx(oldTextRect, newTextRect) {\n  if (oldTextRect && newTextRect) {\n    return ((oldTextRect.left + oldTextRect.width/2) - (newTextRect.left + newTextRect.width/2));\n  }\n  return 0;\n}\nfunction getTextDy(oldTextRect, newTextRect) {\n  if (oldTextRect && newTextRect) {\n    return ((oldTextRect.top + oldTextRect.height/2) - (newTextRect.top + newTextRect.height/2));\n  }\n  return 0;\n}\n\nfunction isTextElement(elm) {\n  return elm.childNodes.length === 1 && elm.childNodes[0].nodeType === 3;\n}\n\nvar removed, created;\n\nfunction pre(oldVnode, vnode) {\n  removed = {};\n  created = [];\n}\n\nfunction create(oldVnode, vnode) {\n  var hero = vnode.data.hero;\n  if (hero && hero.id) {\n    created.push(hero.id);\n    created.push(vnode);\n  }\n}\n\nfunction destroy(vnode) {\n  var hero = vnode.data.hero;\n  if (hero && hero.id) {\n    var elm = vnode.elm;\n    vnode.isTextNode = isTextElement(elm); //is this a text node?\n    vnode.boundingRect = elm.getBoundingClientRect(); //save the bounding rectangle to a new property on the vnode\n    vnode.textRect = vnode.isTextNode ? getTextNodeRect(elm.childNodes[0]) : null; //save bounding rect of inner text node\n    var computedStyle = window.getComputedStyle(elm, null); //get current styles (includes inherited properties)\n    vnode.savedStyle = JSON.parse(JSON.stringify(computedStyle)); //save a copy of computed style values\n    removed[hero.id] = vnode;\n  }\n}\n\nfunction post() {\n  var i, id, newElm, oldVnode, oldElm, hRatio, wRatio,\n      oldRect, newRect, dx, dy, origTransform, origTransition,\n      newStyle, oldStyle, newComputedStyle, isTextNode,\n      newTextRect, oldTextRect;\n  for (i = 0; i < created.length; i += 2) {\n    id = created[i];\n    newElm = created[i+1].elm;\n    oldVnode = removed[id];\n    if (oldVnode) {\n      isTextNode = oldVnode.isTextNode && isTextElement(newElm); //Are old & new both text?\n      newStyle = newElm.style;\n      newComputedStyle = window.getComputedStyle(newElm, null); //get full computed style for new element\n      oldElm = oldVnode.elm;\n      oldStyle = oldElm.style;\n      //Overall element bounding boxes\n      newRect = newElm.getBoundingClientRect();\n      oldRect = oldVnode.boundingRect; //previously saved bounding rect\n      //Text node bounding boxes & distances\n      if (isTextNode) {\n        newTextRect = getTextNodeRect(newElm.childNodes[0]);\n        oldTextRect = oldVnode.textRect;\n        dx = getTextDx(oldTextRect, newTextRect);\n        dy = getTextDy(oldTextRect, newTextRect);\n      } else {\n        //Calculate distances between old & new positions\n        dx = oldRect.left - newRect.left;\n        dy = oldRect.top - newRect.top;\n      }\n      hRatio = newRect.height / (Math.max(oldRect.height, 1));\n      wRatio = isTextNode ? hRatio : newRect.width / (Math.max(oldRect.width, 1)); //text scales based on hRatio\n      // Animate new element\n      origTransform = newStyle.transform;\n      origTransition = newStyle.transition;\n      if (newComputedStyle.display === 'inline') //inline elements cannot be transformed\n        newStyle.display = 'inline-block';        //this does not appear to have any negative side effects\n      newStyle.transition = origTransition + 'transform 0s';\n      newStyle.transformOrigin = calcTransformOrigin(isTextNode, newTextRect, newRect);\n      newStyle.opacity = '0';\n      newStyle.transform = origTransform + 'translate('+dx+'px, '+dy+'px) ' +\n                               'scale('+1/wRatio+', '+1/hRatio+')';\n      setNextFrame(newStyle, 'transition', origTransition);\n      setNextFrame(newStyle, 'transform', origTransform);\n      setNextFrame(newStyle, 'opacity', '1');\n      // Animate old element\n      for (var key in oldVnode.savedStyle) { //re-apply saved inherited properties\n        if (parseInt(key) != key) {\n          var ms = key.substring(0,2) === 'ms';\n          var moz = key.substring(0,3) === 'moz';\n          var webkit = key.substring(0,6) === 'webkit';\n      	  if (!ms && !moz && !webkit) //ignore prefixed style properties\n        	  oldStyle[key] = oldVnode.savedStyle[key];\n        }\n      }\n      oldStyle.position = 'absolute';\n      oldStyle.top = oldRect.top + 'px'; //start at existing position\n      oldStyle.left = oldRect.left + 'px';\n      oldStyle.width = oldRect.width + 'px'; //Needed for elements who were sized relative to their parents\n      oldStyle.height = oldRect.height + 'px'; //Needed for elements who were sized relative to their parents\n      oldStyle.margin = 0; //Margin on hero element leads to incorrect positioning\n      oldStyle.transformOrigin = calcTransformOrigin(isTextNode, oldTextRect, oldRect);\n      oldStyle.transform = '';\n      oldStyle.opacity = '1';\n      document.body.appendChild(oldElm);\n      setNextFrame(oldStyle, 'transform', 'translate('+ -dx +'px, '+ -dy +'px) scale('+wRatio+', '+hRatio+')'); //scale must be on far right for translate to be correct\n      setNextFrame(oldStyle, 'opacity', '0');\n      oldElm.addEventListener('transitionend', function(ev) {\n        if (ev.propertyName === 'transform')\n          document.body.removeChild(ev.target);\n      });\n    }\n  }\n  removed = created = undefined;\n}\n\nmodule.exports = {pre: pre, create: create, destroy: destroy, post: post};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/modules/hero.js\n ** module id = 294\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/modules/hero.js?")},function(module,exports){eval("function updateProps(oldVnode, vnode) {\n  var key, cur, old, elm = vnode.elm,\n      oldProps = oldVnode.data.props || {}, props = vnode.data.props || {};\n  for (key in oldProps) {\n    if (!props[key]) {\n      delete elm[key];\n    }\n  }\n  for (key in props) {\n    cur = props[key];\n    old = oldProps[key];\n    if (old !== cur && (key !== 'value' || elm[key] !== cur)) {\n      elm[key] = cur;\n    }\n  }\n}\n\nmodule.exports = {create: updateProps, update: updateProps};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/modules/props.js\n ** module id = 295\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/modules/props.js?")},function(module,exports){eval("var raf = (typeof window !== 'undefined' && window.requestAnimationFrame) || setTimeout;\nvar nextFrame = function(fn) { raf(function() { raf(fn); }); };\n\nfunction setNextFrame(obj, prop, val) {\n  nextFrame(function() { obj[prop] = val; });\n}\n\nfunction updateStyle(oldVnode, vnode) {\n  var cur, name, elm = vnode.elm,\n      oldStyle = oldVnode.data.style || {},\n      style = vnode.data.style || {},\n      oldHasDel = 'delayed' in oldStyle;\n  for (name in oldStyle) {\n    if (!style[name]) {\n      elm.style[name] = '';\n    }\n  }\n  for (name in style) {\n    cur = style[name];\n    if (name === 'delayed') {\n      for (name in style.delayed) {\n        cur = style.delayed[name];\n        if (!oldHasDel || cur !== oldStyle.delayed[name]) {\n          setNextFrame(elm.style, name, cur);\n        }\n      }\n    } else if (name !== 'remove' && cur !== oldStyle[name]) {\n      elm.style[name] = cur;\n    }\n  }\n}\n\nfunction applyDestroyStyle(vnode) {\n  var style, name, elm = vnode.elm, s = vnode.data.style;\n  if (!s || !(style = s.destroy)) return;\n  for (name in style) {\n    elm.style[name] = style[name];\n  }\n}\n\nfunction applyRemoveStyle(vnode, rm) {\n  var s = vnode.data.style;\n  if (!s || !s.remove) {\n    rm();\n    return;\n  }\n  var name, elm = vnode.elm, idx, i = 0, maxDur = 0,\n      compStyle, style = s.remove, amount = 0, applied = [];\n  for (name in style) {\n    applied.push(name);\n    elm.style[name] = style[name];\n  }\n  compStyle = getComputedStyle(elm);\n  var props = compStyle['transition-property'].split(', ');\n  for (; i < props.length; ++i) {\n    if(applied.indexOf(props[i]) !== -1) amount++;\n  }\n  elm.addEventListener('transitionend', function(ev) {\n    if (ev.target === elm) --amount;\n    if (amount === 0) rm();\n  });\n}\n\nmodule.exports = {create: updateStyle, update: updateStyle, destroy: applyDestroyStyle, remove: applyRemoveStyle};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/modules/style.js\n ** module id = 296\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/modules/style.js?")},function(module,exports,__webpack_require__){eval("// jshint newcap: false\n/* global require, module, document, Node */\n'use strict';\n\nvar VNode = __webpack_require__(58);\nvar is = __webpack_require__(44);\nvar domApi = __webpack_require__(290);\n\nfunction isUndef(s) { return s === undefined; }\nfunction isDef(s) { return s !== undefined; }\n\nvar emptyNode = VNode('', {}, [], undefined, undefined);\n\nfunction sameVnode(vnode1, vnode2) {\n  return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;\n}\n\nfunction createKeyToOldIdx(children, beginIdx, endIdx) {\n  var i, map = {}, key;\n  for (i = beginIdx; i <= endIdx; ++i) {\n    key = children[i].key;\n    if (isDef(key)) map[key] = i;\n  }\n  return map;\n}\n\nvar hooks = ['create', 'update', 'remove', 'destroy', 'pre', 'post'];\n\nfunction init(modules, api) {\n  var i, j, cbs = {};\n\n  if (isUndef(api)) api = domApi;\n\n  for (i = 0; i < hooks.length; ++i) {\n    cbs[hooks[i]] = [];\n    for (j = 0; j < modules.length; ++j) {\n      if (modules[j][hooks[i]] !== undefined) cbs[hooks[i]].push(modules[j][hooks[i]]);\n    }\n  }\n\n  function emptyNodeAt(elm) {\n    return VNode(api.tagName(elm).toLowerCase(), {}, [], undefined, elm);\n  }\n\n  function createRmCb(childElm, listeners) {\n    return function() {\n      if (--listeners === 0) {\n        var parent = api.parentNode(childElm);\n        api.removeChild(parent, childElm);\n      }\n    };\n  }\n\n  function createElm(vnode, insertedVnodeQueue) {\n    var i, thunk, data = vnode.data;\n    if (isDef(data)) {\n      if (isDef(i = data.hook) && isDef(i = i.init)) i(vnode);\n      if (isDef(i = data.vnode)) {\n          thunk = vnode;\n          vnode = i;\n      }\n    }\n    var elm, children = vnode.children, sel = vnode.sel;\n    if (isDef(sel)) {\n      // Parse selector\n      var hashIdx = sel.indexOf('#');\n      var dotIdx = sel.indexOf('.', hashIdx);\n      var hash = hashIdx > 0 ? hashIdx : sel.length;\n      var dot = dotIdx > 0 ? dotIdx : sel.length;\n      var tag = hashIdx !== -1 || dotIdx !== -1 ? sel.slice(0, Math.min(hash, dot)) : sel;\n      elm = vnode.elm = isDef(data) && isDef(i = data.ns) ? api.createElementNS(i, tag)\n                                                          : api.createElement(tag);\n      if (hash < dot) elm.id = sel.slice(hash + 1, dot);\n      if (dotIdx > 0) elm.className = sel.slice(dot+1).replace(/\\./g, ' ');\n      if (is.array(children)) {\n        for (i = 0; i < children.length; ++i) {\n          api.appendChild(elm, createElm(children[i], insertedVnodeQueue));\n        }\n      } else if (is.primitive(vnode.text)) {\n        api.appendChild(elm, api.createTextNode(vnode.text));\n      }\n      for (i = 0; i < cbs.create.length; ++i) cbs.create[i](emptyNode, vnode);\n      i = vnode.data.hook; // Reuse variable\n      if (isDef(i)) {\n        if (i.create) i.create(emptyNode, vnode);\n        if (i.insert) insertedVnodeQueue.push(vnode);\n      }\n    } else {\n      elm = vnode.elm = api.createTextNode(vnode.text);\n    }\n    if (isDef(thunk)) thunk.elm = vnode.elm;\n    return vnode.elm;\n  }\n\n  function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {\n    for (; startIdx <= endIdx; ++startIdx) {\n      api.insertBefore(parentElm, createElm(vnodes[startIdx], insertedVnodeQueue), before);\n    }\n  }\n\n  function invokeDestroyHook(vnode) {\n    var i, j, data = vnode.data;\n    if (isDef(data)) {\n      if (isDef(i = data.hook) && isDef(i = i.destroy)) i(vnode);\n      for (i = 0; i < cbs.destroy.length; ++i) cbs.destroy[i](vnode);\n      if (isDef(i = vnode.children)) {\n        for (j = 0; j < vnode.children.length; ++j) {\n          invokeDestroyHook(vnode.children[j]);\n        }\n      }\n      if (isDef(i = data.vnode)) invokeDestroyHook(i);\n    }\n  }\n\n  function removeVnodes(parentElm, vnodes, startIdx, endIdx) {\n    for (; startIdx <= endIdx; ++startIdx) {\n      var i, listeners, rm, ch = vnodes[startIdx];\n      if (isDef(ch)) {\n        if (isDef(ch.sel)) {\n          invokeDestroyHook(ch);\n          listeners = cbs.remove.length + 1;\n          rm = createRmCb(ch.elm, listeners);\n          for (i = 0; i < cbs.remove.length; ++i) cbs.remove[i](ch, rm);\n          if (isDef(i = ch.data) && isDef(i = i.hook) && isDef(i = i.remove)) {\n            i(ch, rm);\n          } else {\n            rm();\n          }\n        } else { // Text node\n          api.removeChild(parentElm, ch.elm);\n        }\n      }\n    }\n  }\n\n  function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) {\n    var oldStartIdx = 0, newStartIdx = 0;\n    var oldEndIdx = oldCh.length - 1;\n    var oldStartVnode = oldCh[0];\n    var oldEndVnode = oldCh[oldEndIdx];\n    var newEndIdx = newCh.length - 1;\n    var newStartVnode = newCh[0];\n    var newEndVnode = newCh[newEndIdx];\n    var oldKeyToIdx, idxInOld, elmToMove, before;\n\n    while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n      if (isUndef(oldStartVnode)) {\n        oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left\n      } else if (isUndef(oldEndVnode)) {\n        oldEndVnode = oldCh[--oldEndIdx];\n      } else if (sameVnode(oldStartVnode, newStartVnode)) {\n        patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);\n        oldStartVnode = oldCh[++oldStartIdx];\n        newStartVnode = newCh[++newStartIdx];\n      } else if (sameVnode(oldEndVnode, newEndVnode)) {\n        patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);\n        oldEndVnode = oldCh[--oldEndIdx];\n        newEndVnode = newCh[--newEndIdx];\n      } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right\n        patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);\n        api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));\n        oldStartVnode = oldCh[++oldStartIdx];\n        newEndVnode = newCh[--newEndIdx];\n      } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left\n        patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);\n        api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);\n        oldEndVnode = oldCh[--oldEndIdx];\n        newStartVnode = newCh[++newStartIdx];\n      } else {\n        if (isUndef(oldKeyToIdx)) oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);\n        idxInOld = oldKeyToIdx[newStartVnode.key];\n        if (isUndef(idxInOld)) { // New element\n          api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);\n          newStartVnode = newCh[++newStartIdx];\n        } else {\n          elmToMove = oldCh[idxInOld];\n          patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);\n          oldCh[idxInOld] = undefined;\n          api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);\n          newStartVnode = newCh[++newStartIdx];\n        }\n      }\n    }\n    if (oldStartIdx > oldEndIdx) {\n      before = isUndef(newCh[newEndIdx+1]) ? null : newCh[newEndIdx+1].elm;\n      addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);\n    } else if (newStartIdx > newEndIdx) {\n      removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);\n    }\n  }\n\n  function patchVnode(oldVnode, vnode, insertedVnodeQueue) {\n    var i, hook;\n    if (isDef(i = vnode.data) && isDef(hook = i.hook) && isDef(i = hook.prepatch)) {\n      i(oldVnode, vnode);\n    }\n    if (isDef(i = oldVnode.data) && isDef(i = i.vnode)) oldVnode = i;\n    if (isDef(i = vnode.data) && isDef(i = i.vnode)) {\n      patchVnode(oldVnode, i, insertedVnodeQueue);\n      vnode.elm = i.elm;\n      return;\n    }\n    var elm = vnode.elm = oldVnode.elm, oldCh = oldVnode.children, ch = vnode.children;\n    if (oldVnode === vnode) return;\n    if (!sameVnode(oldVnode, vnode)) {\n      var parentElm = api.parentNode(oldVnode.elm);\n      elm = createElm(vnode, insertedVnodeQueue);\n      api.insertBefore(parentElm, elm, oldVnode.elm);\n      removeVnodes(parentElm, [oldVnode], 0, 0);\n      return;\n    }\n    if (isDef(vnode.data)) {\n      for (i = 0; i < cbs.update.length; ++i) cbs.update[i](oldVnode, vnode);\n      i = vnode.data.hook;\n      if (isDef(i) && isDef(i = i.update)) i(oldVnode, vnode);\n    }\n    if (isUndef(vnode.text)) {\n      if (isDef(oldCh) && isDef(ch)) {\n        if (oldCh !== ch) updateChildren(elm, oldCh, ch, insertedVnodeQueue);\n      } else if (isDef(ch)) {\n        if (isDef(oldVnode.text)) api.setTextContent(elm, '');\n        addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);\n      } else if (isDef(oldCh)) {\n        removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n      } else if (isDef(oldVnode.text)) {\n        api.setTextContent(elm, '');\n      }\n    } else if (oldVnode.text !== vnode.text) {\n      api.setTextContent(elm, vnode.text);\n    }\n    if (isDef(hook) && isDef(i = hook.postpatch)) {\n      i(oldVnode, vnode);\n    }\n  }\n\n  return function(oldVnode, vnode) {\n    var i, elm, parent;\n    var insertedVnodeQueue = [];\n    for (i = 0; i < cbs.pre.length; ++i) cbs.pre[i]();\n\n    if (isUndef(oldVnode.sel)) {\n      oldVnode = emptyNodeAt(oldVnode);\n    }\n\n    if (sameVnode(oldVnode, vnode)) {\n      patchVnode(oldVnode, vnode, insertedVnodeQueue);\n    } else {\n      elm = oldVnode.elm;\n      parent = api.parentNode(elm);\n\n      createElm(vnode, insertedVnodeQueue);\n\n      if (parent !== null) {\n        api.insertBefore(parent, vnode.elm, api.nextSibling(elm));\n        removeVnodes(parent, [oldVnode], 0, 0);\n      }\n    }\n\n    for (i = 0; i < insertedVnodeQueue.length; ++i) {\n      insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]);\n    }\n    for (i = 0; i < cbs.post.length; ++i) cbs.post[i]();\n    return vnode;\n  };\n}\n\nmodule.exports = {init: init};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/snabbdom.js\n ** module id = 297\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/snabbdom.js?");
},function(module,exports,__webpack_require__){eval("var h = __webpack_require__(289);\n\nfunction init(thunk) {\n  var i, cur = thunk.data;\n  cur.vnode = cur.fn.apply(undefined, cur.args);\n}\n\nfunction prepatch(oldThunk, thunk) {\n  var i, old = oldThunk.data, cur = thunk.data;\n  var oldArgs = old.args, args = cur.args;\n  cur.vnode = old.vnode;\n  if (old.fn !== cur.fn || oldArgs.length !== args.length) {\n    cur.vnode = cur.fn.apply(undefined, args);\n    return;\n  }\n  for (i = 0; i < args.length; ++i) {\n    if (oldArgs[i] !== args[i]) {\n      cur.vnode = cur.fn.apply(undefined, args);\n      return;\n    }\n  }\n}\n\nmodule.exports = function(name, fn /* args */) {\n  var i, args = [];\n  for (i = 2; i < arguments.length; ++i) {\n    args[i - 2] = arguments[i];\n  }\n  return h('thunk' + name, {\n    hook: {init: init, prepatch: prepatch},\n    fn: fn, args: args,\n  });\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/thunk.js\n ** module id = 298\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/thunk.js?")},function(module,exports){eval('"use strict";\nfunction logToConsoleError(err) {\n    var target = err.stack || err;\n    if (console && console.error) {\n        console.error(target);\n    }\n    else if (console && console.log) {\n        console.log(target);\n    }\n}\nfunction makeSinkProxies(drivers, streamAdapter) {\n    var sinkProxies = {};\n    for (var name_1 in drivers) {\n        if (drivers.hasOwnProperty(name_1)) {\n            var holdSubject = streamAdapter.makeSubject();\n            var driverStreamAdapter = drivers[name_1].streamAdapter || streamAdapter;\n            var stream = driverStreamAdapter.adapt(holdSubject.stream, streamAdapter.streamSubscribe);\n            sinkProxies[name_1] = {\n                stream: stream,\n                observer: holdSubject.observer,\n            };\n        }\n    }\n    return sinkProxies;\n}\nfunction callDrivers(drivers, sinkProxies, streamAdapter) {\n    var sources = {};\n    for (var name_2 in drivers) {\n        if (drivers.hasOwnProperty(name_2)) {\n            var driverOutput = drivers[name_2](sinkProxies[name_2].stream, streamAdapter, name_2);\n            var driverStreamAdapter = drivers[name_2].streamAdapter;\n            if (driverStreamAdapter && driverStreamAdapter.isValidStream(driverOutput)) {\n                sources[name_2] = streamAdapter.adapt(driverOutput, driverStreamAdapter.streamSubscribe);\n            }\n            else {\n                sources[name_2] = driverOutput;\n            }\n        }\n    }\n    return sources;\n}\nfunction replicateMany(sinks, sinkProxies, streamAdapter) {\n    var results = Object.keys(sinks)\n        .filter(function (name) { return !!sinkProxies[name]; })\n        .map(function (name) {\n        return streamAdapter.streamSubscribe(sinks[name], {\n            next: function (x) { sinkProxies[name].observer.next(x); },\n            error: function (err) {\n                logToConsoleError(err);\n                sinkProxies[name].observer.error(err);\n            },\n            complete: function (x) {\n                sinkProxies[name].observer.complete(x);\n            }\n        });\n    });\n    var disposeFunctions = results\n        .filter(function (dispose) { return typeof dispose === \'function\'; });\n    return function () {\n        disposeFunctions.forEach(function (dispose) { return dispose(); });\n    };\n}\nfunction disposeSources(sources) {\n    for (var k in sources) {\n        if (sources.hasOwnProperty(k) && sources[k]\n            && typeof sources[k].dispose === \'function\') {\n            sources[k].dispose();\n        }\n    }\n}\nvar isObjectEmpty = function (obj) { return Object.keys(obj).length === 0; };\nfunction Cycle(main, drivers, options) {\n    if (typeof main !== "function") {\n        throw new Error("First argument given to Cycle must be the \'main\' " +\n            "function.");\n    }\n    if (typeof drivers !== "object" || drivers === null) {\n        throw new Error("Second argument given to Cycle must be an object " +\n            "with driver functions as properties.");\n    }\n    if (isObjectEmpty(drivers)) {\n        throw new Error("Second argument given to Cycle must be an object " +\n            "with at least one driver function declared as a property.");\n    }\n    var streamAdapter = options.streamAdapter;\n    if (!streamAdapter || isObjectEmpty(streamAdapter)) {\n        throw new Error("Third argument given to Cycle must be an options object " +\n            "with the streamAdapter key supplied with a valid stream adapter.");\n    }\n    var sinkProxies = makeSinkProxies(drivers, streamAdapter);\n    var sources = callDrivers(drivers, sinkProxies, streamAdapter);\n    var sinks = main(sources);\n    if (typeof window !== \'undefined\') {\n        window.Cyclejs = { sinks: sinks };\n    }\n    var run = function () {\n        var disposeReplication = replicateMany(sinks, sinkProxies, streamAdapter);\n        return function () {\n            disposeSources(sources);\n            disposeReplication();\n        };\n    };\n    return { sinks: sinks, sources: sources, run: run };\n}\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.default = Cycle;\n//# sourceMappingURL=index.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/base/lib/index.js\n ** module id = 299\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/base/lib/index.js?')},function(module,exports,__webpack_require__){eval("\"use strict\";\nvar Rx = __webpack_require__(2);\nvar RxJSAdapter = {\n    adapt: function (originStream, originStreamSubscribe) {\n        if (this.isValidStream(originStream)) {\n            return originStream;\n        }\n        return Rx.Observable.create(function (destinationObserver) {\n            var originObserver = {\n                next: function (x) { return destinationObserver.onNext(x); },\n                error: function (e) { return destinationObserver.onError(e); },\n                complete: function () { return destinationObserver.onCompleted(); },\n            };\n            var dispose = originStreamSubscribe(originStream, originObserver);\n            return function () {\n                if (typeof dispose === 'function') {\n                    dispose.call(null);\n                }\n            };\n        });\n    },\n    remember: function (observable) {\n        return observable.shareReplay(1);\n    },\n    makeSubject: function () {\n        var stream = new Rx.Subject();\n        var observer = {\n            next: function (x) { stream.onNext(x); },\n            error: function (err) { stream.onError(err); },\n            complete: function (x) { stream.onCompleted(); }\n        };\n        return { stream: stream, observer: observer };\n    },\n    isValidStream: function (stream) {\n        return (typeof stream.subscribeOnNext === 'function' &&\n            typeof stream.onValue !== 'function');\n    },\n    streamSubscribe: function (stream, observer) {\n        var subscription = stream.subscribe(function (x) { return observer.next(x); }, function (e) { return observer.error(e); }, function (x) { return observer.complete(x); });\n        return function () {\n            subscription.dispose();\n        };\n    }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = RxJSAdapter;\n//# sourceMappingURL=index.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/rx-adapter/lib/index.js\n ** module id = 300\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/rx-adapter/lib/index.js?")},function(module,exports,__webpack_require__){eval('"use strict";\nvar base_1 = __webpack_require__(299);\nvar rx_adapter_1 = __webpack_require__(300);\n/**\n * Takes a `main` function and circularly connects it to the given collection\n * of driver functions.\n *\n * **Example:**\n * ```js\n * import {run} from \'@cycle/rx-run\';\n * const dispose = Cycle.run(main, drivers);\n * // ...\n * dispose();\n * ```\n *\n * The `main` function expects a collection of "source" Observables (returned\n * from drivers) as input, and should return a collection of "sink" Observables\n * (to be given to drivers). A "collection of Observables" is a JavaScript\n * object where keys match the driver names registered by the `drivers` object,\n * and values are the Observables. Refer to the documentation of each driver to\n * see more details on what types of sources it outputs and sinks it receives.\n *\n * @param {Function} main a function that takes `sources` as input\n * and outputs a collection of `sinks` Observables.\n * @param {Object} drivers an object where keys are driver names and values\n * are driver functions.\n * @return {Function} a dispose function, used to terminate the execution of the\n * Cycle.js program, cleaning up resources used.\n * @function run\n */\nfunction run(main, drivers) {\n    var run = base_1.default(main, drivers, { streamAdapter: rx_adapter_1.default }).run;\n    return run();\n}\nexports.run = run;\n/**\n * A function that prepares the Cycle application to be executed. Takes a `main`\n * function and prepares to circularly connects it to the given collection of\n * driver functions. As an output, `Cycle()` returns an object with three\n * properties: `sources`, `sinks` and `run`. Only when `run()` is called will\n * the application actually execute. Refer to the documentation of `run()` for\n * more details.\n *\n * **Example:**\n * ```js\n * import Cycle from \'@cycle/rx-run\';\n * const {sources, sinks, run} = Cycle(main, drivers);\n * // ...\n * const dispose = run(); // Executes the application\n * // ...\n * dispose();\n * ```\n *\n * @param {Function} main a function that takes `sources` as input\n * and outputs a collection of `sinks` Observables.\n * @param {Object} drivers an object where keys are driver names and values\n * are driver functions.\n * @return {Object} an object with three properties: `sources`, `sinks` and\n * `run`. `sources` is the collection of driver sources, `sinks` is the\n * collection of driver sinks, these can be used for debugging or testing. `run`\n * is the function that once called will execute the application.\n * @function Cycle\n */\nvar Cycle = function (main, drivers) {\n    return base_1.default(main, drivers, { streamAdapter: rx_adapter_1.default });\n};\nCycle.run = run;\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.default = Cycle;\n//# sourceMappingURL=index.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/rx-run/lib/index.js\n ** module id = 301\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/rx-run/lib/index.js?')},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(global) {var URL = __webpack_require__(95);\nvar EventEmitter = __webpack_require__(250).EventEmitter;\nvar instance = null;\n\nvar location = window.location;\n\nmodule.exports = (function () {\n\n  if (instance) {\n    return instance;\n  }\n\n  var eventEmitter = new EventEmitter();\n\n  eventEmitter.addEventListener = eventEmitter.addListener;\n  eventEmitter.removeEventListener = eventEmitter.removeListener;\n\n  var initialUrl = location.href;\n  var uri = URL(initialUrl);\n  var origin = uri.protocol + '//' + uri.host;\n  var isPreventingDefault = false;\n  var doReplace = false;\n  var prevUrl = '';\n  var linkClicked = false;\n  var isEmitting = false;\n  var setSyncUrl = false;\n\n  var emitChange = function (url, event) {\n    eventEmitter.emit('change', {\n      preventDefault: function () {\n        event && event.preventDefault();\n        isPreventingDefault = true;\n      },\n      target: {\n        value: url ? origin + url : location.href\n      }\n    });\n  };\n\n  var onUrlChange = function (type) {\n    return function (event) {\n\n      if (location.href === prevUrl) {\n        return;\n      }\n\n      // Fixes bug where trailing slash is converted to normal url\n      if (location.href[location.href.length - 1] === '/') {\n        doReplace = true;\n      }\n\n      isEmitting = true;\n      emitChange();\n      isEmitting = false;\n\n      if (!setSyncUrl && isPreventingDefault) {\n        history.replaceState({}, '', (prevUrl || initialUrl).replace(origin, ''));\n      }\n\n      prevUrl = location.href;\n      isPreventingDefault = false;\n      setSyncUrl = false;\n      doReplace = false;\n\n    };\n  };\n\n  global.addEventListener('popstate', onUrlChange('pop'));\n\n  Object.defineProperty(eventEmitter, 'value', {\n    get: function () {\n      return location.href;\n    },\n    set: function (value) {\n\n      if (typeof value !== 'string') {\n          doReplace = Boolean(value.replace);\n          value = value.value;\n      }\n\n      // If emitting a change we flag that we are setting\n      // a url based on the event being emitted\n      if (isEmitting) {\n        setSyncUrl = true;\n      }\n\n      // Ensure full url\n      if (value.indexOf(origin) === -1) {\n        value = origin + value;\n      }\n\n      // If it is same url, forget about it\n      if (value === location.href) {\n        return;\n      }\n\n      // We might need to replace the url if we are fixing\n      // for example trailing slash issue\n      if (doReplace) {\n        history.replaceState({}, '', value.replace(origin, ''));\n        doReplace = false;\n      } else {\n        history.pushState({}, '', value.replace(origin, ''));\n      }\n\n      prevUrl = location.href;\n      isPreventingDefault = false;\n\n    }\n  });\n\n  // expose URLUtils like API https://developer.mozilla.org/en-US/docs/Web/API/URLUtils\n  // thanks https://github.com/cofounders/urlutils for reference\n  Object.defineProperty(eventEmitter, 'origin', {\n    get: function () {\n      var uri = URL(location.href);\n      return uri.protocol + '//' + uri.host;\n    }\n  });\n\n  Object.defineProperty(eventEmitter, 'protocol', {\n    get: function () {\n      return URL(location.href).protocol;\n    }\n  });\n\n  Object.defineProperty(eventEmitter, 'port', {\n    get: function () {\n      return URL(location.href).port;\n    }\n  });\n\n  Object.defineProperty(eventEmitter, 'hostname', {\n    get: function () {\n      return URL(location.href).hostname;\n    }\n  });\n\n  Object.defineProperty(eventEmitter, 'pathname', {\n    get: function () {\n      return URL(location.href).pathname;\n    }\n  });\n\n  Object.defineProperty(eventEmitter, 'hash', {\n    get: function () {\n      return URL(location.href).hash;\n    }\n  });\n\n  /*\n    This code is from the Page JS source code. Amazing work on handling all\n    kinds of scenarios with hyperlinks, thanks!\n   */\n\n  var isSameOrigin = function (href) {\n    return (href && (0 === href.indexOf(origin)));\n  }\n\n  var getClickedHref = function (event) {\n    // check which button\n    if (1 !== (null === event.which ? event.button : event.which)) { return false };\n\n    // check for modifiers\n    if (event.metaKey || event.ctrlKey || event.shiftKey) { return false };\n    if (event.defaultPrevented) { return false };\n\n    // ensure link\n    var element = event.target;\n    while (element && 'A' !== element.nodeName) { element = element.parentNode };\n    if (!element || 'A' !== element.nodeName) { return false };\n\n    // Ignore if tag has\n    // 1. \"download\" attribute\n    // 2. rel=\"external\" attribute\n    if (element.hasAttribute('download') || element.getAttribute('rel') === 'external') { return false };\n\n    // Check for mailto: in the href\n    var href = element.getAttribute('href');\n    if (href && href.indexOf('mailto:') > -1) { return false };\n\n    // check target\n    if (element.target) { return false };\n\n    // x-origin\n    if (!isSameOrigin(element.href)) { return false };\n\n    return href;\n  }\n\n  global.addEventListener(document.ontouchstart ? 'touchstart' : 'click', function (event) {\n    var href = getClickedHref(event);\n    if (href) {\n      linkClicked = true;\n      isEmitting = true;\n      emitChange(href, event);\n      isEmitting = false;\n      if (isPreventingDefault) {\n        linkClicked = false;\n      }\n      prevUrl = href;\n      isPreventingDefault = false;\n    }\n  });\n\n  instance = eventEmitter;\n\n  return eventEmitter;\n\n}());\n\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/addressbar/index.js\n ** module id = 302\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/addressbar/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(module) {'use strict';\n\nfunction assembleStyles () {\n	var styles = {\n		modifiers: {\n			reset: [0, 0],\n			bold: [1, 22], // 21 isn't widely supported and 22 does the same thing\n			dim: [2, 22],\n			italic: [3, 23],\n			underline: [4, 24],\n			inverse: [7, 27],\n			hidden: [8, 28],\n			strikethrough: [9, 29]\n		},\n		colors: {\n			black: [30, 39],\n			red: [31, 39],\n			green: [32, 39],\n			yellow: [33, 39],\n			blue: [34, 39],\n			magenta: [35, 39],\n			cyan: [36, 39],\n			white: [37, 39],\n			gray: [90, 39]\n		},\n		bgColors: {\n			bgBlack: [40, 49],\n			bgRed: [41, 49],\n			bgGreen: [42, 49],\n			bgYellow: [43, 49],\n			bgBlue: [44, 49],\n			bgMagenta: [45, 49],\n			bgCyan: [46, 49],\n			bgWhite: [47, 49]\n		}\n	};\n\n	// fix humans\n	styles.colors.grey = styles.colors.gray;\n\n	Object.keys(styles).forEach(function (groupName) {\n		var group = styles[groupName];\n\n		Object.keys(group).forEach(function (styleName) {\n			var style = group[styleName];\n\n			styles[styleName] = group[styleName] = {\n				open: '\\u001b[' + style[0] + 'm',\n				close: '\\u001b[' + style[1] + 'm'\n			};\n		});\n\n		Object.defineProperty(styles, groupName, {\n			value: group,\n			enumerable: false\n		});\n	});\n\n	return styles;\n}\n\nObject.defineProperty(module, 'exports', {\n	enumerable: true,\n	get: assembleStyles\n});\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module)))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/ansi-styles/index.js\n ** module id = 303\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/ansi-styles/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(process) {'use strict';\nvar escapeStringRegexp = __webpack_require__(306);\nvar ansiStyles = __webpack_require__(303);\nvar stripAnsi = __webpack_require__(327);\nvar hasAnsi = __webpack_require__(307);\nvar supportsColor = __webpack_require__(328);\nvar defineProps = Object.defineProperties;\nvar isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(({\"NODE_ENV\":\"production\"}).TERM);\n\nfunction Chalk(options) {\n	// detect mode if not set manually\n	this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;\n}\n\n// use bright blue on Windows as the normal blue color is illegible\nif (isSimpleWindowsTerm) {\n	ansiStyles.blue.open = '\\u001b[94m';\n}\n\nvar styles = (function () {\n	var ret = {};\n\n	Object.keys(ansiStyles).forEach(function (key) {\n		ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');\n\n		ret[key] = {\n			get: function () {\n				return build.call(this, this._styles.concat(key));\n			}\n		};\n	});\n\n	return ret;\n})();\n\nvar proto = defineProps(function chalk() {}, styles);\n\nfunction build(_styles) {\n	var builder = function () {\n		return applyStyle.apply(builder, arguments);\n	};\n\n	builder._styles = _styles;\n	builder.enabled = this.enabled;\n	// __proto__ is used because we must return a function, but there is\n	// no way to create a function with a different prototype.\n	/* eslint-disable no-proto */\n	builder.__proto__ = proto;\n\n	return builder;\n}\n\nfunction applyStyle() {\n	// support varags, but simply cast to string in case there's only one arg\n	var args = arguments;\n	var argsLen = args.length;\n	var str = argsLen !== 0 && String(arguments[0]);\n\n	if (argsLen > 1) {\n		// don't slice `arguments`, it prevents v8 optimizations\n		for (var a = 1; a < argsLen; a++) {\n			str += ' ' + args[a];\n		}\n	}\n\n	if (!this.enabled || !str) {\n		return str;\n	}\n\n	var nestedStyles = this._styles;\n	var i = nestedStyles.length;\n\n	// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,\n	// see https://github.com/chalk/chalk/issues/58\n	// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.\n	var originalDim = ansiStyles.dim.open;\n	if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {\n		ansiStyles.dim.open = '';\n	}\n\n	while (i--) {\n		var code = ansiStyles[nestedStyles[i]];\n\n		// Replace any instances already present with a re-opening code\n		// otherwise only the part of the string until said closing code\n		// will be colored, and the rest will simply be 'plain'.\n		str = code.open + str.replace(code.closeRe, code.open) + code.close;\n	}\n\n	// Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.\n	ansiStyles.dim.open = originalDim;\n\n	return str;\n}\n\nfunction init() {\n	var ret = {};\n\n	Object.keys(styles).forEach(function (name) {\n		ret[name] = {\n			get: function () {\n				return build.call(this, [name]);\n			}\n		};\n	});\n\n	return ret;\n}\n\ndefineProps(Chalk.prototype, init());\n\nmodule.exports = new Chalk();\nmodule.exports.styles = ansiStyles;\nmodule.exports.hasColor = hasAnsi;\nmodule.exports.stripColor = stripAnsi;\nmodule.exports.supportsColor = supportsColor;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/chalk/index.js\n ** module id = 304\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/chalk/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(process) {'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.createResponse$ = createResponse$;\nexports.default = makeHttpDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar isNode = typeof process !== 'undefined' && process.versions && !!process.versions.node;\nif (isNode) {\n  var _XMLHttpRequest = __webpack_require__(363).XMLHttpRequest;\n}\n\nfunction createResponse$(options) {\n  var defaults = {\n    method: 'get',\n    encoding: 'utf8',\n    mimeType: 'text/plain; charset=x-user-defined',\n    responseType: '',\n    timeout: undefined,\n    send: undefined,\n    withCredentials: false\n  };\n  options = Object.assign({}, defaults, options);\n\n  var obs = new _rx2.default.Subject();\n\n  var request = new XMLHttpRequest();\n\n  function handleProgress(e) {\n    [e].filter(function (e) {\n      return e.lengthComputable;\n    }).forEach(function (e) {\n      obs.onNext({ progress: e.loaded / e.total, total: e.total });\n    });\n  }\n  function handleComplete(e) {\n    var response = request.response;\n    if (request.responseType === '' || request.responseType === 'text' && response === null || response === undefined) {\n      response = request.responseText;\n    }\n\n    var status = parseInt((request.status + '').charAt(0), 10);\n    var statusWhiteList = [1, 2]; // valid http status codes are 1XX or 2XX , nothing else\n    if (statusWhiteList.indexOf(status) === -1) {\n      obs.onError(e);\n    } else {\n      // response = options.responseType === 'json' ? JSON.parse(response) : response\n      obs.onNext({ response: response });\n      obs.onCompleted();\n    }\n  }\n\n  function handleError(e) {\n    console.log('error in httpDriver', e);\n    obs.onError(e);\n  }\n\n  function handleAbort(e) {\n    console.log('abort in httpDriver', e);\n    obs.onError(e);\n  }\n\n  function handleTimeout(e) {\n    console.log('timeout in httpDriver', e);\n    obs.onError(e);\n  }\n\n  request.addEventListener('progress', handleProgress);\n  request.addEventListener('load', handleComplete);\n  request.addEventListener('error', handleError);\n  request.addEventListener('abort', handleError);\n  request.addEventListener('timeout', handleTimeout);\n\n  request.open(options.method, options.url, true);\n  if (options.mimeType !== null && request.overrideMimeType !== null) {\n    request.overrideMimeType(options.mimeType);\n  }\n  request.timeout = options.timeout;\n  request.responseType = options.responseType;\n  request.withCredentials = options.withCredentials;\n\n  request.send(options.send);\n\n  return obs;\n}\n\nfunction makeHttpDriver() {\n  var _ref = arguments.length <= 0 || arguments[0] === undefined ? { eager: false } : arguments[0];\n\n  var _ref$eager = _ref.eager;\n  var eager = _ref$eager === undefined ? false : _ref$eager;\n\n  return function httpDriver(request$) {\n    var response$$ = request$.map(function (reqOptions) {\n      var response$ = createResponse$(reqOptions);\n      if (eager || reqOptions.eager) {\n        response$ = response$.replay(null, 1);\n        response$.connect();\n      }\n      response$.request = reqOptions;\n      return response$;\n    }).replay(null, 1);\n    response$$.connect();\n    return response$$;\n  };\n}\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/cycle-simple-http-driver/lib/index.js\n ** module id = 305\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/cycle-simple-http-driver/lib/index.js?")},function(module,exports){eval("'use strict';\n\nvar matchOperatorsRe = /[|\\\\{}()[\\]^$+*?.]/g;\n\nmodule.exports = function (str) {\n	if (typeof str !== 'string') {\n		throw new TypeError('Expected a string');\n	}\n\n	return str.replace(matchOperatorsRe, '\\\\$&');\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/escape-string-regexp/index.js\n ** module id = 306\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/escape-string-regexp/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\nvar ansiRegex = __webpack_require__(87);\nvar re = new RegExp(ansiRegex().source); // remove the `g` flag\nmodule.exports = re.test.bind(re);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/has-ansi/index.js\n ** module id = 307\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/has-ansi/index.js?")},function(module,exports){eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n  var e, m\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var nBits = -7\n  var i = isLE ? (nBytes - 1) : 0\n  var d = isLE ? -1 : 1\n  var s = buffer[offset + i]\n\n  i += d\n\n  e = s & ((1 << (-nBits)) - 1)\n  s >>= (-nBits)\n  nBits += eLen\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  m = e & ((1 << (-nBits)) - 1)\n  e >>= (-nBits)\n  nBits += mLen\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  if (e === 0) {\n    e = 1 - eBias\n  } else if (e === eMax) {\n    return m ? NaN : ((s ? -1 : 1) * Infinity)\n  } else {\n    m = m + Math.pow(2, mLen)\n    e = e - eBias\n  }\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n  var e, m, c\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n  var i = isLE ? 0 : (nBytes - 1)\n  var d = isLE ? 1 : -1\n  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n  value = Math.abs(value)\n\n  if (isNaN(value) || value === Infinity) {\n    m = isNaN(value) ? 1 : 0\n    e = eMax\n  } else {\n    e = Math.floor(Math.log(value) / Math.LN2)\n    if (value * (c = Math.pow(2, -e)) < 1) {\n      e--\n      c *= 2\n    }\n    if (e + eBias >= 1) {\n      value += rt / c\n    } else {\n      value += rt * Math.pow(2, 1 - eBias)\n    }\n    if (value * c >= 2) {\n      e++\n      c /= 2\n    }\n\n    if (e + eBias >= eMax) {\n      m = 0\n      e = eMax\n    } else if (e + eBias >= 1) {\n      m = (value * c - 1) * Math.pow(2, mLen)\n      e = e + eBias\n    } else {\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n      e = 0\n    }\n  }\n\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n  e = (e << mLen) | m\n  eLen += mLen\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n  buffer[offset + i - d] |= s * 128\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/ieee754/index.js\n ** module id = 308\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/ieee754/index.js?")},function(module,exports){eval("module.exports = Array.isArray || function (arr) {\n  return Object.prototype.toString.call(arr) == '[object Array]';\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/isarray/index.js\n ** module id = 309\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/isarray/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.1.4 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar isArguments = __webpack_require__(92),\n    isArray = __webpack_require__(93);\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n  var index = -1,\n      length = values.length,\n      offset = array.length;\n\n  while (++index < length) {\n    array[offset + index] = values[index];\n  }\n  return array;\n}\n\n/**\n * The base implementation of `_.flatten` with added support for restricting\n * flattening and specifying the start index.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {boolean} [isDeep] Specify a deep flatten.\n * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, isDeep, isStrict, result) {\n  result || (result = []);\n\n  var index = -1,\n      length = array.length;\n\n  while (++index < length) {\n    var value = array[index];\n    if (isObjectLike(value) && isArrayLike(value) &&\n        (isStrict || isArray(value) || isArguments(value))) {\n      if (isDeep) {\n        // Recursively flatten arrays (susceptible to call stack limits).\n        baseFlatten(value, isDeep, isStrict, result);\n      } else {\n        arrayPush(result, value);\n      }\n    } else if (!isStrict) {\n      result[result.length] = value;\n    }\n  }\n  return result;\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n  return function(object) {\n    return object == null ? undefined : object[key];\n  };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\nfunction isArrayLike(value) {\n  return value != null && isLength(getLength(value));\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n  return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = baseFlatten;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._baseflatten/index.js\n ** module id = 310\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._baseflatten/index.js?");
},function(module,exports){eval('/**\n * lodash 3.0.3 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports="npm" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * Creates a base function for methods like `_.forIn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n  return function(object, iteratee, keysFunc) {\n    var index = -1,\n        iterable = Object(object),\n        props = keysFunc(object),\n        length = props.length;\n\n    while (length--) {\n      var key = props[fromRight ? length : ++index];\n      if (iteratee(iterable[key], key, iterable) === false) {\n        break;\n      }\n    }\n    return object;\n  };\n}\n\nmodule.exports = baseFor;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._basefor/index.js\n ** module id = 311\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._basefor/index.js?')},function(module,exports){eval('/**\n * lodash 3.1.0 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports="npm" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * The base implementation of `_.indexOf` without support for binary searches.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n  if (value !== value) {\n    return indexOfNaN(array, fromIndex);\n  }\n  var index = fromIndex - 1,\n      length = array.length;\n\n  while (++index < length) {\n    if (array[index] === value) {\n      return index;\n    }\n  }\n  return -1;\n}\n\n/**\n * Gets the index at which the first occurrence of `NaN` is found in `array`.\n * If `fromRight` is provided elements of `array` are iterated from right to left.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched `NaN`, else `-1`.\n */\nfunction indexOfNaN(array, fromIndex, fromRight) {\n  var length = array.length,\n      index = fromIndex + (fromRight ? 0 : -1);\n\n  while ((fromRight ? index-- : ++index < length)) {\n    var other = array[index];\n    if (other !== other) {\n      return index;\n    }\n  }\n  return -1;\n}\n\nmodule.exports = baseIndexOf;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._baseindexof/index.js\n ** module id = 312\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._baseindexof/index.js?')},function(module,exports,__webpack_require__){eval('/**\n * lodash 3.0.3 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports="npm" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar baseIndexOf = __webpack_require__(312),\n    cacheIndexOf = __webpack_require__(315),\n    createCache = __webpack_require__(316);\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniq` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The function invoked per iteration.\n * @returns {Array} Returns the new duplicate-value-free array.\n */\nfunction baseUniq(array, iteratee) {\n  var index = -1,\n      indexOf = baseIndexOf,\n      length = array.length,\n      isCommon = true,\n      isLarge = isCommon && length >= LARGE_ARRAY_SIZE,\n      seen = isLarge ? createCache() : null,\n      result = [];\n\n  if (seen) {\n    indexOf = cacheIndexOf;\n    isCommon = false;\n  } else {\n    isLarge = false;\n    seen = iteratee ? [] : result;\n  }\n  outer:\n  while (++index < length) {\n    var value = array[index],\n        computed = iteratee ? iteratee(value, index, array) : value;\n\n    if (isCommon && value === value) {\n      var seenIndex = seen.length;\n      while (seenIndex--) {\n        if (seen[seenIndex] === computed) {\n          continue outer;\n        }\n      }\n      if (iteratee) {\n        seen.push(computed);\n      }\n      result.push(value);\n    }\n    else if (indexOf(seen, computed, 0) < 0) {\n      if (iteratee || isLarge) {\n        seen.push(computed);\n      }\n      result.push(value);\n    }\n  }\n  return result;\n}\n\nmodule.exports = baseUniq;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._baseuniq/index.js\n ** module id = 313\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._baseuniq/index.js?')},function(module,exports){eval("/**\n * lodash 3.0.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction bindCallback(func, thisArg, argCount) {\n  if (typeof func != 'function') {\n    return identity;\n  }\n  if (thisArg === undefined) {\n    return func;\n  }\n  switch (argCount) {\n    case 1: return function(value) {\n      return func.call(thisArg, value);\n    };\n    case 3: return function(value, index, collection) {\n      return func.call(thisArg, value, index, collection);\n    };\n    case 4: return function(accumulator, value, index, collection) {\n      return func.call(thisArg, accumulator, value, index, collection);\n    };\n    case 5: return function(value, other, key, object, source) {\n      return func.call(thisArg, value, other, key, object, source);\n    };\n  }\n  return function() {\n    return func.apply(thisArg, arguments);\n  };\n}\n\n/**\n * This method returns the first argument provided to it.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'user': 'fred' };\n *\n * _.identity(object) === object;\n * // => true\n */\nfunction identity(value) {\n  return value;\n}\n\nmodule.exports = bindCallback;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._bindcallback/index.js\n ** module id = 314\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._bindcallback/index.js?")},function(module,exports){eval("/**\n * lodash 3.0.2 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * Checks if `value` is in `cache` mimicking the return signature of\n * `_.indexOf` by returning `0` if the value is found, else `-1`.\n *\n * @private\n * @param {Object} cache The cache to search.\n * @param {*} value The value to search for.\n * @returns {number} Returns `0` if `value` is found, else `-1`.\n */\nfunction cacheIndexOf(cache, value) {\n  var data = cache.data,\n      result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];\n\n  return result ? 0 : -1;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n  // Avoid a V8 JIT bug in Chrome 19-20.\n  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n  var type = typeof value;\n  return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = cacheIndexOf;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._cacheindexof/index.js\n ** module id = 315\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._cacheindexof/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(global) {/**\n * lodash 3.1.2 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar getNative = __webpack_require__(89);\n\n/** Native method references. */\nvar Set = getNative(global, 'Set');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeCreate = getNative(Object, 'create');\n\n/**\n *\n * Creates a cache object to store unique values.\n *\n * @private\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n  var length = values ? values.length : 0;\n\n  this.data = { 'hash': nativeCreate(null), 'set': new Set };\n  while (length--) {\n    this.push(values[length]);\n  }\n}\n\n/**\n * Adds `value` to the cache.\n *\n * @private\n * @name push\n * @memberOf SetCache\n * @param {*} value The value to cache.\n */\nfunction cachePush(value) {\n  var data = this.data;\n  if (typeof value == 'string' || isObject(value)) {\n    data.set.add(value);\n  } else {\n    data.hash[value] = true;\n  }\n}\n\n/**\n * Creates a `Set` cache object to optimize linear searches of large arrays.\n *\n * @private\n * @param {Array} [values] The values to cache.\n * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.\n */\nfunction createCache(values) {\n  return (nativeCreate && Set) ? new SetCache(values) : null;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n  // Avoid a V8 JIT bug in Chrome 19-20.\n  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n  var type = typeof value;\n  return !!value && (type == 'object' || type == 'function');\n}\n\n// Add functions to the `Set` cache.\nSetCache.prototype.push = cachePush;\n\nmodule.exports = createCache;\n\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._createcache/index.js\n ** module id = 316\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._createcache/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.2.0 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar root = __webpack_require__(61);\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match latin-1 supplementary letters (excluding mathematical operators). */\nvar reLatin1 = /[\\xc0-\\xd6\\xd8-\\xde\\xdf-\\xf6\\xf8-\\xff]/g;\n\n/** Used to compose unicode character classes. */\nvar rsComboMarksRange = '\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe23',\n    rsComboSymbolsRange = '\\\\u20d0-\\\\u20f0';\n\n/** Used to compose unicode capture groups. */\nvar rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']';\n\n/**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\nvar reComboMark = RegExp(rsCombo, 'g');\n\n/** Used to map latin-1 supplementary letters to basic latin letters. */\nvar deburredLetters = {\n  '\\xc0': 'A',  '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n  '\\xe0': 'a',  '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n  '\\xc7': 'C',  '\\xe7': 'c',\n  '\\xd0': 'D',  '\\xf0': 'd',\n  '\\xc8': 'E',  '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n  '\\xe8': 'e',  '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n  '\\xcC': 'I',  '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n  '\\xeC': 'i',  '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n  '\\xd1': 'N',  '\\xf1': 'n',\n  '\\xd2': 'O',  '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n  '\\xf2': 'o',  '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n  '\\xd9': 'U',  '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n  '\\xf9': 'u',  '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n  '\\xdd': 'Y',  '\\xfd': 'y', '\\xff': 'y',\n  '\\xc6': 'Ae', '\\xe6': 'ae',\n  '\\xde': 'Th', '\\xfe': 'th',\n  '\\xdf': 'ss'\n};\n\n/**\n * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\nfunction deburrLetter(letter) {\n  return deburredLetters[letter];\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n    symbolToString = Symbol ? symbolProto.toString : undefined;\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n  return typeof value == 'symbol' ||\n    (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n  // Exit early for strings to avoid a performance hit in some environments.\n  if (typeof value == 'string') {\n    return value;\n  }\n  if (value == null) {\n    return '';\n  }\n  if (isSymbol(value)) {\n    return Symbol ? symbolToString.call(value) : '';\n  }\n  var result = (value + '');\n  return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\nfunction deburr(string) {\n  string = toString(string);\n  return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');\n}\n\nmodule.exports = deburr;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.deburr/index.js\n ** module id = 317\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.deburr/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.1.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar deburr = __webpack_require__(317),\n    words = __webpack_require__(322);\n\n/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n  var index = -1,\n      length = array.length;\n\n  if (initAccum && length) {\n    accumulator = array[++index];\n  }\n  while (++index < length) {\n    accumulator = iteratee(accumulator, array[index], index, array);\n  }\n  return accumulator;\n}\n\n/**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\nfunction createCompounder(callback) {\n  return function(string) {\n    return arrayReduce(words(deburr(string)), callback, '');\n  };\n}\n\n/**\n * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__foo_bar__');\n * // => 'foo-bar'\n */\nvar kebabCase = createCompounder(function(result, word, index) {\n  return result + (index ? '-' : '') + word.toLowerCase();\n});\n\nmodule.exports = kebabCase;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.kebabcase/index.js\n ** module id = 318\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.kebabcase/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.1.2 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar getNative = __webpack_require__(89),\n    isArguments = __webpack_require__(92),\n    isArray = __webpack_require__(93);\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^\\d+$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = getNative(Object, 'keys');\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n  return function(object) {\n    return object == null ? undefined : object[key];\n  };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\nfunction isArrayLike(value) {\n  return value != null && isLength(getLength(value));\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n  value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n  length = length == null ? MAX_SAFE_INTEGER : length;\n  return value > -1 && value % 1 == 0 && value < length;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n  return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction shimKeys(object) {\n  var props = keysIn(object),\n      propsLength = props.length,\n      length = propsLength && object.length;\n\n  var allowIndexes = !!length && isLength(length) &&\n    (isArray(object) || isArguments(object));\n\n  var index = -1,\n      result = [];\n\n  while (++index < propsLength) {\n    var key = props[index];\n    if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n      result.push(key);\n    }\n  }\n  return result;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n  // Avoid a V8 JIT bug in Chrome 19-20.\n  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n  var type = typeof value;\n  return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n *   this.a = 1;\n *   this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nvar keys = !nativeKeys ? shimKeys : function(object) {\n  var Ctor = object == null ? undefined : object.constructor;\n  if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n      (typeof object != 'function' && isArrayLike(object))) {\n    return shimKeys(object);\n  }\n  return isObject(object) ? nativeKeys(object) : [];\n};\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n *   this.a = 1;\n *   this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n  if (object == null) {\n    return [];\n  }\n  if (!isObject(object)) {\n    object = Object(object);\n  }\n  var length = object.length;\n  length = (length && isLength(length) &&\n    (isArray(object) || isArguments(object)) && length) || 0;\n\n  var Ctor = object.constructor,\n      index = -1,\n      isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n      result = Array(length),\n      skipIndexes = length > 0;\n\n  while (++index < length) {\n    result[index] = (index + '');\n  }\n  for (var key in object) {\n    if (!(skipIndexes && isIndex(key, length)) &&\n        !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n      result.push(key);\n    }\n  }\n  return result;\n}\n\nmodule.exports = keys;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.keys/index.js\n ** module id = 319\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.keys/index.js?")},function(module,exports){eval("/**\n * lodash 3.6.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n *   return what + ' ' + _.initial(names).join(', ') +\n *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction restParam(func, start) {\n  if (typeof func != 'function') {\n    throw new TypeError(FUNC_ERROR_TEXT);\n  }\n  start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n  return function() {\n    var args = arguments,\n        index = -1,\n        length = nativeMax(args.length - start, 0),\n        rest = Array(length);\n\n    while (++index < length) {\n      rest[index] = args[start + index];\n    }\n    switch (start) {\n      case 0: return func.call(this, rest);\n      case 1: return func.call(this, args[0], rest);\n      case 2: return func.call(this, args[0], args[1], rest);\n    }\n    var otherArgs = Array(start + 1);\n    index = -1;\n    while (++index < start) {\n      otherArgs[index] = args[index];\n    }\n    otherArgs[start] = rest;\n    return func.apply(this, otherArgs);\n  };\n}\n\nmodule.exports = restParam;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.restparam/index.js\n ** module id = 320\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.restparam/index.js?")},function(module,exports,__webpack_require__){eval('/**\n * lodash 3.1.0 (Custom Build) <https://lodash.com/>\n * Build: `lodash modern modularize exports="npm" -o ./`\n * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar baseFlatten = __webpack_require__(310),\n    baseUniq = __webpack_require__(313),\n    restParam = __webpack_require__(320);\n\n/**\n * Creates an array of unique values, in order, of the provided arrays using\n * `SameValueZero` for equality comparisons.\n *\n * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)\n * comparisons are like strict equality comparisons, e.g. `===`, except that\n * `NaN` matches `NaN`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([1, 2], [4, 2], [2, 1]);\n * // => [1, 2, 4]\n */\nvar union = restParam(function(arrays) {\n  return baseUniq(baseFlatten(arrays, false, true));\n});\n\nmodule.exports = union;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.union/index.js\n ** module id = 321\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.union/index.js?');
},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.2.0 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\nvar root = __webpack_require__(61);\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n    rsComboMarksRange = '\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe23',\n    rsComboSymbolsRange = '\\\\u20d0-\\\\u20f0',\n    rsDingbatRange = '\\\\u2700-\\\\u27bf',\n    rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n    rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n    rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n    rsQuoteRange = '\\\\u2018\\\\u2019\\\\u201c\\\\u201d',\n    rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n    rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n    rsVarRange = '\\\\ufe0e\\\\ufe0f',\n    rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;\n\n/** Used to compose unicode capture groups. */\nvar rsBreak = '[' + rsBreakRange + ']',\n    rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',\n    rsDigits = '\\\\d+',\n    rsDingbat = '[' + rsDingbatRange + ']',\n    rsLower = '[' + rsLowerRange + ']',\n    rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n    rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n    rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n    rsNonAstral = '[^' + rsAstralRange + ']',\n    rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n    rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n    rsUpper = '[' + rsUpperRange + ']',\n    rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',\n    rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',\n    reOptMod = rsModifier + '?',\n    rsOptVar = '[' + rsVarRange + ']?',\n    rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n    rsSeq = rsOptVar + reOptMod + rsOptJoin,\n    rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;\n\n/** Used to match non-compound words composed of alphanumeric characters. */\nvar reBasicWord = /[a-zA-Z0-9]+/g;\n\n/** Used to match complex or compound words. */\nvar reComplexWord = RegExp([\n  rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n  rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',\n  rsUpper + '?' + rsLowerMisc + '+',\n  rsUpper + '+',\n  rsDigits,\n  rsEmoji\n].join('|'), 'g');\n\n/** Used to detect strings that need a more robust regexp to match words. */\nvar reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n    symbolToString = Symbol ? symbolProto.toString : undefined;\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n  return typeof value == 'symbol' ||\n    (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n  // Exit early for strings to avoid a performance hit in some environments.\n  if (typeof value == 'string') {\n    return value;\n  }\n  if (value == null) {\n    return '';\n  }\n  if (isSymbol(value)) {\n    return Symbol ? symbolToString.call(value) : '';\n  }\n  var result = (value + '');\n  return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\nfunction words(string, pattern, guard) {\n  string = toString(string);\n  pattern = guard ? undefined : pattern;\n\n  if (pattern === undefined) {\n    pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord;\n  }\n  return string.match(pattern) || [];\n}\n\nmodule.exports = words;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.words/index.js\n ** module id = 322\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.words/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nexports.decode = exports.parse = __webpack_require__(279);\nexports.encode = exports.stringify = __webpack_require__(280);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/querystring/index.js\n ** module id = 323\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/querystring/index.js?")},function(module,exports){eval("'use strict';\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Simple query string parser.\n *\n * @param {String} query The query string that needs to be parsed.\n * @returns {Object}\n * @api public\n */\nfunction querystring(query) {\n  var parser = /([^=?&]+)=([^&]*)/g\n    , result = {}\n    , part;\n\n  //\n  // Little nifty parsing hack, leverage the fact that RegExp.exec increments\n  // the lastIndex property so we can continue executing this loop until we've\n  // parsed all results.\n  //\n  for (;\n    part = parser.exec(query);\n    result[decodeURIComponent(part[1])] = decodeURIComponent(part[2])\n  );\n\n  return result;\n}\n\n/**\n * Transform a query string to an object.\n *\n * @param {Object} obj Object that should be transformed.\n * @param {String} prefix Optional prefix.\n * @returns {String}\n * @api public\n */\nfunction querystringify(obj, prefix) {\n  prefix = prefix || '';\n\n  var pairs = [];\n\n  //\n  // Optionally prefix with a '?' if needed\n  //\n  if ('string' !== typeof prefix) prefix = '?';\n\n  for (var key in obj) {\n    if (has.call(obj, key)) {\n      pairs.push(encodeURIComponent(key) +'='+ encodeURIComponent(obj[key]));\n    }\n  }\n\n  return pairs.length ? prefix + pairs.join('&') : '';\n}\n\n//\n// Expose the module.\n//\nexports.stringify = querystringify;\nexports.parse = querystring;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/querystringify/index.js\n ** module id = 324\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/querystringify/index.js?")},function(module,exports){eval("'use strict';\n\n/**\n * Check if we're required to add a port number.\n *\n * @see https://url.spec.whatwg.org/#default-port\n * @param {Number|String} port Port number we need to check\n * @param {String} protocol Protocol we need to check against.\n * @returns {Boolean} Is it a default port for the given protocol\n * @api private\n */\nmodule.exports = function required(port, protocol) {\n  protocol = protocol.split(':')[0];\n  port = +port;\n\n  if (!port) return false;\n\n  switch (protocol) {\n    case 'http':\n    case 'ws':\n    return port !== 80;\n\n    case 'https':\n    case 'wss':\n    return port !== 443;\n\n    case 'ftp':\n    return port !== 21;\n\n    case 'gopher':\n    return port !== 70;\n\n    case 'file':\n    return false;\n  }\n\n  return port !== 0;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/requires-port/index.js\n ** module id = 325\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/requires-port/index.js?")},function(module,exports,__webpack_require__){eval("\nvar init = __webpack_require__(285);\n\nmodule.exports = init([__webpack_require__(286), __webpack_require__(287)]);\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/index.js\n ** module id = 326\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\nvar ansiRegex = __webpack_require__(87)();\n\nmodule.exports = function (str) {\n	return typeof str === 'string' ? str.replace(ansiRegex, '') : str;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/strip-ansi/index.js\n ** module id = 327\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/strip-ansi/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(process) {'use strict';\nvar argv = process.argv;\n\nvar terminator = argv.indexOf('--');\nvar hasFlag = function (flag) {\n	flag = '--' + flag;\n	var pos = argv.indexOf(flag);\n	return pos !== -1 && (terminator !== -1 ? pos < terminator : true);\n};\n\nmodule.exports = (function () {\n	if ('FORCE_COLOR' in ({\"NODE_ENV\":\"production\"})) {\n		return true;\n	}\n\n	if (hasFlag('no-color') ||\n		hasFlag('no-colors') ||\n		hasFlag('color=false')) {\n		return false;\n	}\n\n	if (hasFlag('color') ||\n		hasFlag('colors') ||\n		hasFlag('color=true') ||\n		hasFlag('color=always')) {\n		return true;\n	}\n\n	if (process.stdout && !process.stdout.isTTY) {\n		return false;\n	}\n\n	if (process.platform === 'win32') {\n		return true;\n	}\n\n	if ('COLORTERM' in ({\"NODE_ENV\":\"production\"})) {\n		return true;\n	}\n\n	if (({\"NODE_ENV\":\"production\"}).TERM === 'dumb') {\n		return false;\n	}\n\n	if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(({\"NODE_ENV\":\"production\"}).TERM)) {\n		return true;\n	}\n\n	return false;\n})();\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/supports-color/index.js\n ** module id = 328\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/supports-color/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = makeYMDriver;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(97);\n\nvar _utils = __webpack_require__(63);\n\nvar _diffPatchUtils = __webpack_require__(354);\n\nvar _ramda = __webpack_require__(4);\n\nvar _helpers = __webpack_require__(359);\n\nvar _saveHelpers = __webpack_require__(361);\n\nvar _loadHelpers = __webpack_require__(360);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar merge = Observable.merge;\nvar just = Observable.just;\n\n\n// actual driver stuff\n// storage driver for YouMagine designs & data etc\nfunction makeYMDriver(httpDriver) {\n  var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n\n  function youMagineStorageDriver(outgoing$) {\n    // ////////////////////////\n    // deal with designInfos\n    var designInfos$ = outgoing$.filter(function (data) {\n      return data.query === 'designExists';\n    }).pluck('data').share();\n\n    var apiEndpoint$ = outgoing$.pluck('data', 'apiEndpoint').filter(_utils.exists).shareReplay(1);\n\n    var designExistsRequest$ = outgoing$.filter(function (data) {\n      return data.query === 'designExists';\n    }).distinctUntilChanged().pluck('data').map(function (_ref) {\n      var design = _ref.design;\n      var authData = _ref.authData;\n      var apiEndpoint = _ref.apiEndpoint;\n      return { designId: design.id, authToken: authData.token, apiEndpoint: apiEndpoint };\n    }).map(function (data) {\n      var designId = data.designId;\n      var authToken = data.authToken;\n      var apiEndpoint = data.apiEndpoint;\n\n      var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n      var designUri = apiEndpoint + '/designs/' + designId + authTokenStr;\n      return {\n        url: designUri,\n        method: 'get',\n        type: 'ymLoad',\n        typeDetail: 'designExists',\n        withCredentials: true\n      };\n    });\n\n    // all that is needed for save & load\n    // deal with saving\n    var save$ = outgoing$.debounce(50) // only save if last events were less than 50 ms appart\n    .filter(function (data) {\n      return data.method === 'save';\n    }).pluck('data').share();\n\n    var design$ = save$.pluck('design');\n    var authData$ = save$.pluck('authData');\n\n    // deal wiht loading basics\n    var load$ = outgoing$.debounce(50) // only load if last events were less than 50 ms appart\n    .filter(function (data) {\n      return data.method === 'load';\n    }).pluck('data').share();\n\n    var lDesign$ = load$.pluck('design');\n\n    var lAuthData$ = load$.pluck('authData');\n\n    // saving stuff\n    var dataDebounceRate = 1000; // debounce rate (in ms) for the input RAW data , affects the rate of request GENERATION, not of outbound requests\n    var requestDebounceRate = 500; // time in ms between each emited http request : ie don't spam the api !\n\n    var bom$ = (0, _diffPatchUtils.changesFromObservableArrays)(save$.pluck('bom').distinctUntilChanged(null, _ramda.equals).debounce(dataDebounceRate));\n\n    var parts$ = (0, _diffPatchUtils.changesFromObservableArrays)(save$.pluck('bom').distinctUntilChanged(null, _ramda.equals).debounce(dataDebounceRate));\n\n    var assemblies$ = (0, _diffPatchUtils.changesFromObservableArrays)((0, _obsUtils.combineLatestObj)({\n      metadata: save$.pluck('eMetas'),\n      transforms: save$.pluck('eTrans'),\n      meshes: save$.pluck('eMeshs')\n    }).debounce(dataDebounceRate).filter(_utils.exists).map(_saveHelpers.dataFromItems));\n\n    //requests sent out to the server for CUD operations\n    var partsOut$ = (0, _helpers.makeApiStream)(parts$, _saveHelpers.toParts, design$, authData$, apiEndpoint$);\n    var bomOut$ = (0, _helpers.makeApiStream)(bom$, _saveHelpers.toBom, design$, authData$, apiEndpoint$);\n    var assemblyOut$ = (0, _helpers.makeApiStream)(assemblies$, _saveHelpers.toAssemblies, design$, authData$, apiEndpoint$);\n\n    //requests sent out to the server for Read operations\n    var partsIn$ = (0, _loadHelpers.makeApiStreamGets)(load$, _loadHelpers.getParts, lDesign$, lAuthData$, apiEndpoint$);\n    var bomIn$ = (0, _loadHelpers.makeApiStreamGets)(load$, _loadHelpers.getBom, lDesign$, lAuthData$, apiEndpoint$);\n    var assembliesIn$ = (0, _loadHelpers.makeGetStreamForAssemblies)(load$, null, lDesign$, lAuthData$, apiEndpoint$);\n    var assemblyEntriesIn$ = (0, _loadHelpers.makeApiStreamGets)((0, _loadHelpers.otherHelper)(httpDriver(assembliesIn$)), _loadHelpers.getAssemblyEntries, lDesign$, lAuthData$, apiEndpoint$);\n\n    // Finally put it all together\n    var allSaveRequests$ = (0, _helpers.spreadRequests)(requestDebounceRate, merge(partsOut$, bomOut$, assemblyOut$));\n    var allLoadRequests$ = merge(partsIn$, bomIn$, assemblyEntriesIn$);\n\n    //and send them on their way\n    var outToHttp$ = merge(designExistsRequest$, allSaveRequests$, allLoadRequests$);\n\n    var inputs$ = httpDriver(outToHttp$).merge((0, _loadHelpers.getAssemblyEntriesNoAssemblyFound)((0, _loadHelpers.otherHelper)(httpDriver(assembliesIn$))));\n\n    // starts when outputing data, done when confirmation recieved\n    function confirmSaveDone(what) {\n      var confirmation$ = inputs$.filter(function (r) {\n        return r.request;\n      }).filter(function (res$) {\n        return res$.request.type === 'ymSave';\n      }) // handle errors etc\n      .flatMap(function (data) {\n        var responseWrapper$ = data.catch(function (e) {\n          return _rx2.default.Observable.empty();\n        });\n        var request$ = just(data.request);\n        var response$ = responseWrapper$.pluck('response');\n        return (0, _obsUtils.combineLatestObj)({ response$: response$, request$: request$ }); // .materialize()//FIXME: still do not get this one\n      }).map(function (data) {\n        return data.request.typeDetail;\n      }).filter(function (data) {\n        return data === what;\n      });\n      return confirmation$;\n    }\n\n    function computeSaveProgress(outObs$, what) {\n      return outObs$.map(function (_) {\n        return true;\n      }).merge(confirmSaveDone(what).map(function (_) {\n        return false;\n      }));\n    }\n\n    var saveInProgressParts$ = computeSaveProgress(partsOut$, 'parts');\n    var saveInProgressBom$ = computeSaveProgress(bomOut$, 'bom');\n    var saveInProgressAssembly$ = computeSaveProgress(assemblyOut$, 'assemblies');\n    var saveInProgress$ = merge(saveInProgressParts$, saveInProgressBom$, saveInProgressAssembly$).map(function (data) {\n      return { saveInProgress: data };\n    });\n\n    return {\n      data: inputs$,\n      progress: saveInProgress$\n    };\n  }\n\n  return youMagineStorageDriver;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-ym-storage/lib/index.js\n ** module id = 329\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-ym-storage/lib/index.js?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(233);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./bom.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./bom.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Bom/bom.css\n ** module id = 330\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Bom/bom.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(234);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./comments.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./comments.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/comments.css\n ** module id = 331\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/comments.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(235);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./style.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./style.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/style.css\n ** module id = 332\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/style.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(236);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./settings.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./settings.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/settings.css\n ** module id = 333\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/settings.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(237);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./app.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./app.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/app.css\n ** module id = 334\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/app.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(238);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./bottomToolBar.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./bottomToolBar.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/bottomToolBar.css\n ** module id = 335\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/bottomToolBar.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(239);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./leftToolbar.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./leftToolbar.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/leftToolbar.css\n ** module id = 336\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/leftToolbar.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(240);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./notifications.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./notifications.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/notifications.css\n ** module id = 337\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/notifications.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(241);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./tooltips.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./tooltips.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/tooltips.css\n ** module id = 338\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/tooltips.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(242);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../node_modules/css-loader/index.js!./topToolbar.css\", function() {\n			var newContent = require(\"!!./../../../node_modules/css-loader/index.js!./topToolbar.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/topToolbar.css\n ** module id = 339\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/topToolbar.css?")},[366,243],[366,244],function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(245);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../../node_modules/css-loader/index.js!./fullScreenToggler.css\", function() {\n			var newContent = require(\"!!./../../../../node_modules/css-loader/index.js!./fullScreenToggler.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/FullScreenToggler/fullScreenToggler.css\n ** module id = 342\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/FullScreenToggler/fullScreenToggler.css?")},function(module,exports,__webpack_require__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(246);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../../node_modules/css-loader/index.js!./help.css\", function() {\n			var newContent = require(\"!!./../../../../node_modules/css-loader/index.js!./help.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/Help/help.css\n ** module id = 343\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/Help/help.css?");
},[366,247],[366,248],[366,249],function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\nvar slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\\/\\//;\n\n/**\n * These properties should not be copied or inherited from. This is only needed\n * for all non blob URL's as a blob URL does not include a hash, only the\n * origin.\n *\n * @type {Object}\n * @private\n */\nvar ignore = { hash: 1, query: 1 }\n  , URL;\n\n/**\n * The location object differs when your code is loaded through a normal page,\n * Worker or through a worker using a blob. And with the blobble begins the\n * trouble as the location object will contain the URL of the blob, not the\n * location of the page where our code is loaded in. The actual origin is\n * encoded in the `pathname` so we can thankfully generate a good \"default\"\n * location from it so we can generate proper relative URL's again.\n *\n * @param {Object|String} loc Optional default location object.\n * @returns {Object} lolcation object.\n * @api public\n */\nmodule.exports = function lolcation(loc) {\n  loc = loc || global.location || {};\n  URL = URL || __webpack_require__(95);\n\n  var finaldestination = {}\n    , type = typeof loc\n    , key;\n\n  if ('blob:' === loc.protocol) {\n    finaldestination = new URL(unescape(loc.pathname), {});\n  } else if ('string' === type) {\n    finaldestination = new URL(loc, {});\n    for (key in ignore) delete finaldestination[key];\n  } else if ('object' === type) {\n    for (key in loc) {\n      if (key in ignore) continue;\n      finaldestination[key] = loc[key];\n    }\n\n    if (finaldestination.slashes === undefined) {\n      finaldestination.slashes = slashes.test(loc.href);\n    }\n  }\n\n  return finaldestination;\n};\n\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/url-parse/lolcation.js\n ** module id = 347\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/url-parse/lolcation.js?")},function(module,exports,__webpack_require__){eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar punycode = __webpack_require__(278);\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n  this.protocol = null;\n  this.slashes = null;\n  this.auth = null;\n  this.host = null;\n  this.port = null;\n  this.hostname = null;\n  this.hash = null;\n  this.search = null;\n  this.query = null;\n  this.pathname = null;\n  this.path = null;\n  this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n    portPattern = /:[0-9]*$/,\n\n    // RFC 2396: characters reserved for delimiting URLs.\n    // We actually just auto-escape these.\n    delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n    // RFC 2396: characters not allowed for various reasons.\n    unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n    // Allowed by RFCs, but cause of XSS attacks.  Always escape these.\n    autoEscape = ['\\''].concat(unwise),\n    // Characters that are never ever allowed in a hostname.\n    // Note that any invalid chars are also handled, but these\n    // are the ones that are *expected* to be seen, so we fast-path\n    // them.\n    nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n    hostEndingChars = ['/', '?', '#'],\n    hostnameMaxLen = 255,\n    hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/,\n    hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/,\n    // protocols that can allow \"unsafe\" and \"unwise\" chars.\n    unsafeProtocol = {\n      'javascript': true,\n      'javascript:': true\n    },\n    // protocols that never have a hostname.\n    hostlessProtocol = {\n      'javascript': true,\n      'javascript:': true\n    },\n    // protocols that always contain a // bit.\n    slashedProtocol = {\n      'http': true,\n      'https': true,\n      'ftp': true,\n      'gopher': true,\n      'file': true,\n      'http:': true,\n      'https:': true,\n      'ftp:': true,\n      'gopher:': true,\n      'file:': true\n    },\n    querystring = __webpack_require__(323);\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n  if (url && isObject(url) && url instanceof Url) return url;\n\n  var u = new Url;\n  u.parse(url, parseQueryString, slashesDenoteHost);\n  return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n  if (!isString(url)) {\n    throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n  }\n\n  var rest = url;\n\n  // trim before proceeding.\n  // This is to support parse stuff like \"  http://foo.com  \\n\"\n  rest = rest.trim();\n\n  var proto = protocolPattern.exec(rest);\n  if (proto) {\n    proto = proto[0];\n    var lowerProto = proto.toLowerCase();\n    this.protocol = lowerProto;\n    rest = rest.substr(proto.length);\n  }\n\n  // figure out if it's got a host\n  // user@server is *always* interpreted as a hostname, and url\n  // resolution will treat //foo/bar as host=foo,path=bar because that's\n  // how the browser resolves relative URLs.\n  if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n    var slashes = rest.substr(0, 2) === '//';\n    if (slashes && !(proto && hostlessProtocol[proto])) {\n      rest = rest.substr(2);\n      this.slashes = true;\n    }\n  }\n\n  if (!hostlessProtocol[proto] &&\n      (slashes || (proto && !slashedProtocol[proto]))) {\n\n    // there's a hostname.\n    // the first instance of /, ?, ;, or # ends the host.\n    //\n    // If there is an @ in the hostname, then non-host chars *are* allowed\n    // to the left of the last @ sign, unless some host-ending character\n    // comes *before* the @-sign.\n    // URLs are obnoxious.\n    //\n    // ex:\n    // http://a@b@c/ => user:a@b host:c\n    // http://a@b?@c => user:a host:c path:/?@c\n\n    // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n    // Review our test case against browsers more comprehensively.\n\n    // find the first instance of any hostEndingChars\n    var hostEnd = -1;\n    for (var i = 0; i < hostEndingChars.length; i++) {\n      var hec = rest.indexOf(hostEndingChars[i]);\n      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n        hostEnd = hec;\n    }\n\n    // at this point, either we have an explicit point where the\n    // auth portion cannot go past, or the last @ char is the decider.\n    var auth, atSign;\n    if (hostEnd === -1) {\n      // atSign can be anywhere.\n      atSign = rest.lastIndexOf('@');\n    } else {\n      // atSign must be in auth portion.\n      // http://a@b/c@d => host:b auth:a path:/c@d\n      atSign = rest.lastIndexOf('@', hostEnd);\n    }\n\n    // Now we have a portion which is definitely the auth.\n    // Pull that off.\n    if (atSign !== -1) {\n      auth = rest.slice(0, atSign);\n      rest = rest.slice(atSign + 1);\n      this.auth = decodeURIComponent(auth);\n    }\n\n    // the host is the remaining to the left of the first non-host char\n    hostEnd = -1;\n    for (var i = 0; i < nonHostChars.length; i++) {\n      var hec = rest.indexOf(nonHostChars[i]);\n      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n        hostEnd = hec;\n    }\n    // if we still have not hit it, then the entire thing is a host.\n    if (hostEnd === -1)\n      hostEnd = rest.length;\n\n    this.host = rest.slice(0, hostEnd);\n    rest = rest.slice(hostEnd);\n\n    // pull out port.\n    this.parseHost();\n\n    // we've indicated that there is a hostname,\n    // so even if it's empty, it has to be present.\n    this.hostname = this.hostname || '';\n\n    // if hostname begins with [ and ends with ]\n    // assume that it's an IPv6 address.\n    var ipv6Hostname = this.hostname[0] === '[' &&\n        this.hostname[this.hostname.length - 1] === ']';\n\n    // validate a little.\n    if (!ipv6Hostname) {\n      var hostparts = this.hostname.split(/\\./);\n      for (var i = 0, l = hostparts.length; i < l; i++) {\n        var part = hostparts[i];\n        if (!part) continue;\n        if (!part.match(hostnamePartPattern)) {\n          var newpart = '';\n          for (var j = 0, k = part.length; j < k; j++) {\n            if (part.charCodeAt(j) > 127) {\n              // we replace non-ASCII char with a temporary placeholder\n              // we need this to make sure size of hostname is not\n              // broken by replacing non-ASCII by nothing\n              newpart += 'x';\n            } else {\n              newpart += part[j];\n            }\n          }\n          // we test again with ASCII char only\n          if (!newpart.match(hostnamePartPattern)) {\n            var validParts = hostparts.slice(0, i);\n            var notHost = hostparts.slice(i + 1);\n            var bit = part.match(hostnamePartStart);\n            if (bit) {\n              validParts.push(bit[1]);\n              notHost.unshift(bit[2]);\n            }\n            if (notHost.length) {\n              rest = '/' + notHost.join('.') + rest;\n            }\n            this.hostname = validParts.join('.');\n            break;\n          }\n        }\n      }\n    }\n\n    if (this.hostname.length > hostnameMaxLen) {\n      this.hostname = '';\n    } else {\n      // hostnames are always lower case.\n      this.hostname = this.hostname.toLowerCase();\n    }\n\n    if (!ipv6Hostname) {\n      // IDNA Support: Returns a puny coded representation of \"domain\".\n      // It only converts the part of the domain name that\n      // has non ASCII characters. I.e. it dosent matter if\n      // you call it with a domain that already is in ASCII.\n      var domainArray = this.hostname.split('.');\n      var newOut = [];\n      for (var i = 0; i < domainArray.length; ++i) {\n        var s = domainArray[i];\n        newOut.push(s.match(/[^A-Za-z0-9_-]/) ?\n            'xn--' + punycode.encode(s) : s);\n      }\n      this.hostname = newOut.join('.');\n    }\n\n    var p = this.port ? ':' + this.port : '';\n    var h = this.hostname || '';\n    this.host = h + p;\n    this.href += this.host;\n\n    // strip [ and ] from the hostname\n    // the host field still retains them, though\n    if (ipv6Hostname) {\n      this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n      if (rest[0] !== '/') {\n        rest = '/' + rest;\n      }\n    }\n  }\n\n  // now rest is set to the post-host stuff.\n  // chop off any delim chars.\n  if (!unsafeProtocol[lowerProto]) {\n\n    // First, make 100% sure that any \"autoEscape\" chars get\n    // escaped, even if encodeURIComponent doesn't think they\n    // need to be.\n    for (var i = 0, l = autoEscape.length; i < l; i++) {\n      var ae = autoEscape[i];\n      var esc = encodeURIComponent(ae);\n      if (esc === ae) {\n        esc = escape(ae);\n      }\n      rest = rest.split(ae).join(esc);\n    }\n  }\n\n\n  // chop off from the tail first.\n  var hash = rest.indexOf('#');\n  if (hash !== -1) {\n    // got a fragment string.\n    this.hash = rest.substr(hash);\n    rest = rest.slice(0, hash);\n  }\n  var qm = rest.indexOf('?');\n  if (qm !== -1) {\n    this.search = rest.substr(qm);\n    this.query = rest.substr(qm + 1);\n    if (parseQueryString) {\n      this.query = querystring.parse(this.query);\n    }\n    rest = rest.slice(0, qm);\n  } else if (parseQueryString) {\n    // no query string, but parseQueryString still requested\n    this.search = '';\n    this.query = {};\n  }\n  if (rest) this.pathname = rest;\n  if (slashedProtocol[lowerProto] &&\n      this.hostname && !this.pathname) {\n    this.pathname = '/';\n  }\n\n  //to support http.request\n  if (this.pathname || this.search) {\n    var p = this.pathname || '';\n    var s = this.search || '';\n    this.path = p + s;\n  }\n\n  // finally, reconstruct the href based on what has been validated.\n  this.href = this.format();\n  return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n  // ensure it's an object, and not a string url.\n  // If it's an obj, this is a no-op.\n  // this way, you can call url_format() on strings\n  // to clean up potentially wonky urls.\n  if (isString(obj)) obj = urlParse(obj);\n  if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n  return obj.format();\n}\n\nUrl.prototype.format = function() {\n  var auth = this.auth || '';\n  if (auth) {\n    auth = encodeURIComponent(auth);\n    auth = auth.replace(/%3A/i, ':');\n    auth += '@';\n  }\n\n  var protocol = this.protocol || '',\n      pathname = this.pathname || '',\n      hash = this.hash || '',\n      host = false,\n      query = '';\n\n  if (this.host) {\n    host = auth + this.host;\n  } else if (this.hostname) {\n    host = auth + (this.hostname.indexOf(':') === -1 ?\n        this.hostname :\n        '[' + this.hostname + ']');\n    if (this.port) {\n      host += ':' + this.port;\n    }\n  }\n\n  if (this.query &&\n      isObject(this.query) &&\n      Object.keys(this.query).length) {\n    query = querystring.stringify(this.query);\n  }\n\n  var search = this.search || (query && ('?' + query)) || '';\n\n  if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n  // only the slashedProtocols get the //.  Not mailto:, xmpp:, etc.\n  // unless they had them to begin with.\n  if (this.slashes ||\n      (!protocol || slashedProtocol[protocol]) && host !== false) {\n    host = '//' + (host || '');\n    if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n  } else if (!host) {\n    host = '';\n  }\n\n  if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n  if (search && search.charAt(0) !== '?') search = '?' + search;\n\n  pathname = pathname.replace(/[?#]/g, function(match) {\n    return encodeURIComponent(match);\n  });\n  search = search.replace('#', '%23');\n\n  return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n  return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n  return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n  if (!source) return relative;\n  return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n  if (isString(relative)) {\n    var rel = new Url();\n    rel.parse(relative, false, true);\n    relative = rel;\n  }\n\n  var result = new Url();\n  Object.keys(this).forEach(function(k) {\n    result[k] = this[k];\n  }, this);\n\n  // hash is always overridden, no matter what.\n  // even href=\"\" will remove it.\n  result.hash = relative.hash;\n\n  // if the relative url is empty, then there's nothing left to do here.\n  if (relative.href === '') {\n    result.href = result.format();\n    return result;\n  }\n\n  // hrefs like //foo/bar always cut to the protocol.\n  if (relative.slashes && !relative.protocol) {\n    // take everything except the protocol from relative\n    Object.keys(relative).forEach(function(k) {\n      if (k !== 'protocol')\n        result[k] = relative[k];\n    });\n\n    //urlParse appends trailing / to urls like http://www.example.com\n    if (slashedProtocol[result.protocol] &&\n        result.hostname && !result.pathname) {\n      result.path = result.pathname = '/';\n    }\n\n    result.href = result.format();\n    return result;\n  }\n\n  if (relative.protocol && relative.protocol !== result.protocol) {\n    // if it's a known url protocol, then changing\n    // the protocol does weird things\n    // first, if it's not file:, then we MUST have a host,\n    // and if there was a path\n    // to begin with, then we MUST have a path.\n    // if it is file:, then the host is dropped,\n    // because that's known to be hostless.\n    // anything else is assumed to be absolute.\n    if (!slashedProtocol[relative.protocol]) {\n      Object.keys(relative).forEach(function(k) {\n        result[k] = relative[k];\n      });\n      result.href = result.format();\n      return result;\n    }\n\n    result.protocol = relative.protocol;\n    if (!relative.host && !hostlessProtocol[relative.protocol]) {\n      var relPath = (relative.pathname || '').split('/');\n      while (relPath.length && !(relative.host = relPath.shift()));\n      if (!relative.host) relative.host = '';\n      if (!relative.hostname) relative.hostname = '';\n      if (relPath[0] !== '') relPath.unshift('');\n      if (relPath.length < 2) relPath.unshift('');\n      result.pathname = relPath.join('/');\n    } else {\n      result.pathname = relative.pathname;\n    }\n    result.search = relative.search;\n    result.query = relative.query;\n    result.host = relative.host || '';\n    result.auth = relative.auth;\n    result.hostname = relative.hostname || relative.host;\n    result.port = relative.port;\n    // to support http.request\n    if (result.pathname || result.search) {\n      var p = result.pathname || '';\n      var s = result.search || '';\n      result.path = p + s;\n    }\n    result.slashes = result.slashes || relative.slashes;\n    result.href = result.format();\n    return result;\n  }\n\n  var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n      isRelAbs = (\n          relative.host ||\n          relative.pathname && relative.pathname.charAt(0) === '/'\n      ),\n      mustEndAbs = (isRelAbs || isSourceAbs ||\n                    (result.host && relative.pathname)),\n      removeAllDots = mustEndAbs,\n      srcPath = result.pathname && result.pathname.split('/') || [],\n      relPath = relative.pathname && relative.pathname.split('/') || [],\n      psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n  // if the url is a non-slashed url, then relative\n  // links like ../.. should be able\n  // to crawl up to the hostname, as well.  This is strange.\n  // result.protocol has already been set by now.\n  // Later on, put the first path part into the host field.\n  if (psychotic) {\n    result.hostname = '';\n    result.port = null;\n    if (result.host) {\n      if (srcPath[0] === '') srcPath[0] = result.host;\n      else srcPath.unshift(result.host);\n    }\n    result.host = '';\n    if (relative.protocol) {\n      relative.hostname = null;\n      relative.port = null;\n      if (relative.host) {\n        if (relPath[0] === '') relPath[0] = relative.host;\n        else relPath.unshift(relative.host);\n      }\n      relative.host = null;\n    }\n    mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n  }\n\n  if (isRelAbs) {\n    // it's absolute.\n    result.host = (relative.host || relative.host === '') ?\n                  relative.host : result.host;\n    result.hostname = (relative.hostname || relative.hostname === '') ?\n                      relative.hostname : result.hostname;\n    result.search = relative.search;\n    result.query = relative.query;\n    srcPath = relPath;\n    // fall through to the dot-handling below.\n  } else if (relPath.length) {\n    // it's relative\n    // throw away the existing file, and take the new path instead.\n    if (!srcPath) srcPath = [];\n    srcPath.pop();\n    srcPath = srcPath.concat(relPath);\n    result.search = relative.search;\n    result.query = relative.query;\n  } else if (!isNullOrUndefined(relative.search)) {\n    // just pull out the search.\n    // like href='?foo'.\n    // Put this after the other two cases because it simplifies the booleans\n    if (psychotic) {\n      result.hostname = result.host = srcPath.shift();\n      //occationaly the auth can get stuck only in host\n      //this especialy happens in cases like\n      //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n      var authInHost = result.host && result.host.indexOf('@') > 0 ?\n                       result.host.split('@') : false;\n      if (authInHost) {\n        result.auth = authInHost.shift();\n        result.host = result.hostname = authInHost.shift();\n      }\n    }\n    result.search = relative.search;\n    result.query = relative.query;\n    //to support http.request\n    if (!isNull(result.pathname) || !isNull(result.search)) {\n      result.path = (result.pathname ? result.pathname : '') +\n                    (result.search ? result.search : '');\n    }\n    result.href = result.format();\n    return result;\n  }\n\n  if (!srcPath.length) {\n    // no path at all.  easy.\n    // we've already handled the other stuff above.\n    result.pathname = null;\n    //to support http.request\n    if (result.search) {\n      result.path = '/' + result.search;\n    } else {\n      result.path = null;\n    }\n    result.href = result.format();\n    return result;\n  }\n\n  // if a url ENDs in . or .., then it must get a trailing slash.\n  // however, if it ends in anything else non-slashy,\n  // then it must NOT get a trailing slash.\n  var last = srcPath.slice(-1)[0];\n  var hasTrailingSlash = (\n      (result.host || relative.host) && (last === '.' || last === '..') ||\n      last === '');\n\n  // strip single dots, resolve double dots to parent dir\n  // if the path tries to go above the root, `up` ends up > 0\n  var up = 0;\n  for (var i = srcPath.length; i >= 0; i--) {\n    last = srcPath[i];\n    if (last == '.') {\n      srcPath.splice(i, 1);\n    } else if (last === '..') {\n      srcPath.splice(i, 1);\n      up++;\n    } else if (up) {\n      srcPath.splice(i, 1);\n      up--;\n    }\n  }\n\n  // if the path is allowed to go above the root, restore leading ..s\n  if (!mustEndAbs && !removeAllDots) {\n    for (; up--; up) {\n      srcPath.unshift('..');\n    }\n  }\n\n  if (mustEndAbs && srcPath[0] !== '' &&\n      (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n    srcPath.unshift('');\n  }\n\n  if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n    srcPath.push('');\n  }\n\n  var isAbsolute = srcPath[0] === '' ||\n      (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n  // put the host back\n  if (psychotic) {\n    result.hostname = result.host = isAbsolute ? '' :\n                                    srcPath.length ? srcPath.shift() : '';\n    //occationaly the auth can get stuck only in host\n    //this especialy happens in cases like\n    //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n    var authInHost = result.host && result.host.indexOf('@') > 0 ?\n                     result.host.split('@') : false;\n    if (authInHost) {\n      result.auth = authInHost.shift();\n      result.host = result.hostname = authInHost.shift();\n    }\n  }\n\n  mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n  if (mustEndAbs && !isAbsolute) {\n    srcPath.unshift('');\n  }\n\n  if (!srcPath.length) {\n    result.pathname = null;\n    result.path = null;\n  } else {\n    result.pathname = srcPath.join('/');\n  }\n\n  //to support request.http\n  if (!isNull(result.pathname) || !isNull(result.search)) {\n    result.path = (result.pathname ? result.pathname : '') +\n                  (result.search ? result.search : '');\n  }\n  result.auth = relative.auth || result.auth;\n  result.slashes = result.slashes || relative.slashes;\n  result.href = result.format();\n  return result;\n};\n\nUrl.prototype.parseHost = function() {\n  var host = this.host;\n  var port = portPattern.exec(host);\n  if (port) {\n    port = port[0];\n    if (port !== ':') {\n      this.port = port.substr(1);\n    }\n    host = host.substr(0, host.length - port.length);\n  }\n  if (host) this.hostname = host;\n};\n\nfunction isString(arg) {\n  return typeof arg === \"string\";\n}\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\n\nfunction isNull(arg) {\n  return arg === null;\n}\nfunction isNullOrUndefined(arg) {\n  return  arg == null;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/url/url.js\n ** module id = 348\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/url/url.js?")},function(module,exports,__webpack_require__){eval("var require;var require;/* WEBPACK VAR INJECTION */(function(global, Buffer, setImmediate) {(function(f){if(true){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.mfParser = f()}})(function(){var define,module,exports;return (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 require(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n	'use strict';\n\n  var Arr = (typeof Uint8Array !== 'undefined')\n    ? Uint8Array\n    : Array\n\n	var PLUS   = '+'.charCodeAt(0)\n	var SLASH  = '/'.charCodeAt(0)\n	var NUMBER = '0'.charCodeAt(0)\n	var LOWER  = 'a'.charCodeAt(0)\n	var UPPER  = 'A'.charCodeAt(0)\n	var PLUS_URL_SAFE = '-'.charCodeAt(0)\n	var SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n	function decode (elt) {\n		var code = elt.charCodeAt(0)\n		if (code === PLUS ||\n		    code === PLUS_URL_SAFE)\n			return 62 // '+'\n		if (code === SLASH ||\n		    code === SLASH_URL_SAFE)\n			return 63 // '/'\n		if (code < NUMBER)\n			return -1 //no match\n		if (code < NUMBER + 10)\n			return code - NUMBER + 26 + 26\n		if (code < UPPER + 26)\n			return code - UPPER\n		if (code < LOWER + 26)\n			return code - LOWER + 26\n	}\n\n	function b64ToByteArray (b64) {\n		var i, j, l, tmp, placeHolders, arr\n\n		if (b64.length % 4 > 0) {\n			throw new Error('Invalid string. Length must be a multiple of 4')\n		}\n\n		// the number of equal signs (place holders)\n		// if there are two placeholders, than the two characters before it\n		// represent one byte\n		// if there is only one, then the three characters before it represent 2 bytes\n		// this is just a cheap hack to not do indexOf twice\n		var len = b64.length\n		placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n		// base64 is 4/3 + up to two characters of the original data\n		arr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n		// if there are placeholders, only get up to the last complete 4 chars\n		l = placeHolders > 0 ? b64.length - 4 : b64.length\n\n		var L = 0\n\n		function push (v) {\n			arr[L++] = v\n		}\n\n		for (i = 0, j = 0; i < l; i += 4, j += 3) {\n			tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n			push((tmp & 0xFF0000) >> 16)\n			push((tmp & 0xFF00) >> 8)\n			push(tmp & 0xFF)\n		}\n\n		if (placeHolders === 2) {\n			tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n			push(tmp & 0xFF)\n		} else if (placeHolders === 1) {\n			tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n			push((tmp >> 8) & 0xFF)\n			push(tmp & 0xFF)\n		}\n\n		return arr\n	}\n\n	function uint8ToBase64 (uint8) {\n		var i,\n			extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n			output = \"\",\n			temp, length\n\n		function encode (num) {\n			return lookup.charAt(num)\n		}\n\n		function tripletToBase64 (num) {\n			return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n		}\n\n		// go through the array every three bytes, we'll deal with trailing stuff later\n		for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n			temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n			output += tripletToBase64(temp)\n		}\n\n		// pad the end with zeros, but make sure to not forget the extra bytes\n		switch (extraBytes) {\n			case 1:\n				temp = uint8[uint8.length - 1]\n				output += encode(temp >> 2)\n				output += encode((temp << 4) & 0x3F)\n				output += '=='\n				break\n			case 2:\n				temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n				output += encode(temp >> 10)\n				output += encode((temp >> 4) & 0x3F)\n				output += encode((temp << 2) & 0x3F)\n				output += '='\n				break\n		}\n\n		return output\n	}\n\n	exports.toByteArray = b64ToByteArray\n	exports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n\n},{}],2:[function(require,module,exports){\n\n},{}],3:[function(require,module,exports){\n(function (global){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license  MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n *   === true    Use Uint8Array implementation (fastest)\n *   === false   Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n *   - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property\n *     on objects.\n *\n *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n *     incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n  ? global.TYPED_ARRAY_SUPPORT\n  : typedArraySupport()\n\nfunction typedArraySupport () {\n  function Bar () {}\n  try {\n    var arr = new Uint8Array(1)\n    arr.foo = function () { return 42 }\n    arr.constructor = Bar\n    return arr.foo() === 42 && // typed array instances can be augmented\n        arr.constructor === Bar && // constructor can be set\n        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n  } catch (e) {\n    return false\n  }\n}\n\nfunction kMaxLength () {\n  return Buffer.TYPED_ARRAY_SUPPORT\n    ? 0x7fffffff\n    : 0x3fffffff\n}\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (arg) {\n  if (!(this instanceof Buffer)) {\n    // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n    if (arguments.length > 1) return new Buffer(arg, arguments[1])\n    return new Buffer(arg)\n  }\n\n  if (!Buffer.TYPED_ARRAY_SUPPORT) {\n    this.length = 0\n    this.parent = undefined\n  }\n\n  // Common case.\n  if (typeof arg === 'number') {\n    return fromNumber(this, arg)\n  }\n\n  // Slightly less common case.\n  if (typeof arg === 'string') {\n    return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n  }\n\n  // Unusual.\n  return fromObject(this, arg)\n}\n\nfunction fromNumber (that, length) {\n  that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) {\n    for (var i = 0; i < length; i++) {\n      that[i] = 0\n    }\n  }\n  return that\n}\n\nfunction fromString (that, string, encoding) {\n  if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n  // Assumption: byteLength() return value is always < kMaxLength.\n  var length = byteLength(string, encoding) | 0\n  that = allocate(that, length)\n\n  that.write(string, encoding)\n  return that\n}\n\nfunction fromObject (that, object) {\n  if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n  if (isArray(object)) return fromArray(that, object)\n\n  if (object == null) {\n    throw new TypeError('must start with number, buffer, array or string')\n  }\n\n  if (typeof ArrayBuffer !== 'undefined') {\n    if (object.buffer instanceof ArrayBuffer) {\n      return fromTypedArray(that, object)\n    }\n    if (object instanceof ArrayBuffer) {\n      return fromArrayBuffer(that, object)\n    }\n  }\n\n  if (object.length) return fromArrayLike(that, object)\n\n  return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n  var length = checked(buffer.length) | 0\n  that = allocate(that, length)\n  buffer.copy(that, 0, 0, length)\n  return that\n}\n\nfunction fromArray (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  // Truncating the elements is probably not what people expect from typed\n  // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n  // of the old Buffer constructor.\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nfunction fromArrayBuffer (that, array) {\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    array.byteLength\n    that = Buffer._augment(new Uint8Array(array))\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    that = fromTypedArray(that, new Uint8Array(array))\n  }\n  return that\n}\n\nfunction fromArrayLike (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n  var array\n  var length = 0\n\n  if (object.type === 'Buffer' && isArray(object.data)) {\n    array = object.data\n    length = checked(array.length) | 0\n  }\n  that = allocate(that, length)\n\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n  Buffer.prototype.__proto__ = Uint8Array.prototype\n  Buffer.__proto__ = Uint8Array\n} else {\n  // pre-set for values that may exist in the future\n  Buffer.prototype.length = undefined\n  Buffer.prototype.parent = undefined\n}\n\nfunction allocate (that, length) {\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    that = Buffer._augment(new Uint8Array(length))\n    that.__proto__ = Buffer.prototype\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    that.length = length\n    that._isBuffer = true\n  }\n\n  var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n  if (fromPool) that.parent = rootParent\n\n  return that\n}\n\nfunction checked (length) {\n  // Note: cannot use `length < kMaxLength` here because that fails when\n  // length is NaN (which is otherwise coerced to zero.)\n  if (length >= kMaxLength()) {\n    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n                         'size: 0x' + kMaxLength().toString(16) + ' bytes')\n  }\n  return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n  if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n  var buf = new Buffer(subject, encoding)\n  delete buf.parent\n  return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n  return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n    throw new TypeError('Arguments must be Buffers')\n  }\n\n  if (a === b) return 0\n\n  var x = a.length\n  var y = b.length\n\n  var i = 0\n  var len = Math.min(x, y)\n  while (i < len) {\n    if (a[i] !== b[i]) break\n\n    ++i\n  }\n\n  if (i !== len) {\n    x = a[i]\n    y = b[i]\n  }\n\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'binary':\n    case 'base64':\n    case 'raw':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.concat = function concat (list, length) {\n  if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n  if (list.length === 0) {\n    return new Buffer(0)\n  }\n\n  var i\n  if (length === undefined) {\n    length = 0\n    for (i = 0; i < list.length; i++) {\n      length += list[i].length\n    }\n  }\n\n  var buf = new Buffer(length)\n  var pos = 0\n  for (i = 0; i < list.length; i++) {\n    var item = list[i]\n    item.copy(buf, pos)\n    pos += item.length\n  }\n  return buf\n}\n\nfunction byteLength (string, encoding) {\n  if (typeof string !== 'string') string = '' + string\n\n  var len = string.length\n  if (len === 0) return 0\n\n  // Use a for loop to avoid recursion\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'ascii':\n      case 'binary':\n      // Deprecated\n      case 'raw':\n      case 'raws':\n        return len\n      case 'utf8':\n      case 'utf-8':\n        return utf8ToBytes(string).length\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return len * 2\n      case 'hex':\n        return len >>> 1\n      case 'base64':\n        return base64ToBytes(string).length\n      default:\n        if (loweredCase) return utf8ToBytes(string).length // assume utf8\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n  var loweredCase = false\n\n  start = start | 0\n  end = end === undefined || end === Infinity ? this.length : end | 0\n\n  if (!encoding) encoding = 'utf8'\n  if (start < 0) start = 0\n  if (end > this.length) end = this.length\n  if (end <= start) return ''\n\n  while (true) {\n    switch (encoding) {\n      case 'hex':\n        return hexSlice(this, start, end)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Slice(this, start, end)\n\n      case 'ascii':\n        return asciiSlice(this, start, end)\n\n      case 'binary':\n        return binarySlice(this, start, end)\n\n      case 'base64':\n        return base64Slice(this, start, end)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return utf16leSlice(this, start, end)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = (encoding + '').toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toString = function toString () {\n  var length = this.length | 0\n  if (length === 0) return ''\n  if (arguments.length === 0) return utf8Slice(this, 0, length)\n  return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return true\n  return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n  var str = ''\n  var max = exports.INSPECT_MAX_BYTES\n  if (this.length > 0) {\n    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n    if (this.length > max) str += ' ... '\n  }\n  return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return 0\n  return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n  if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n  else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n  byteOffset >>= 0\n\n  if (this.length === 0) return -1\n  if (byteOffset >= this.length) return -1\n\n  // Negative offsets start from the end of the buffer\n  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n  if (typeof val === 'string') {\n    if (val.length === 0) return -1 // special case: looking for empty string always fails\n    return String.prototype.indexOf.call(this, val, byteOffset)\n  }\n  if (Buffer.isBuffer(val)) {\n    return arrayIndexOf(this, val, byteOffset)\n  }\n  if (typeof val === 'number') {\n    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n    }\n    return arrayIndexOf(this, [ val ], byteOffset)\n  }\n\n  function arrayIndexOf (arr, val, byteOffset) {\n    var foundIndex = -1\n    for (var i = 0; byteOffset + i < arr.length; i++) {\n      if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n        if (foundIndex === -1) foundIndex = i\n        if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n      } else {\n        foundIndex = -1\n      }\n    }\n    return -1\n  }\n\n  throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` is deprecated\nBuffer.prototype.get = function get (offset) {\n  console.log('.get() is deprecated. Access using array indexes instead.')\n  return this.readUInt8(offset)\n}\n\n// `set` is deprecated\nBuffer.prototype.set = function set (v, offset) {\n  console.log('.set() is deprecated. Access using array indexes instead.')\n  return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  // must be an even number of digits\n  var strLen = string.length\n  if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; i++) {\n    var parsed = parseInt(string.substr(i * 2, 2), 16)\n    if (isNaN(parsed)) throw new Error('Invalid hex string')\n    buf[offset + i] = parsed\n  }\n  return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n  return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n  return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n  return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n  // Buffer#write(string)\n  if (offset === undefined) {\n    encoding = 'utf8'\n    length = this.length\n    offset = 0\n  // Buffer#write(string, encoding)\n  } else if (length === undefined && typeof offset === 'string') {\n    encoding = offset\n    length = this.length\n    offset = 0\n  // Buffer#write(string, offset[, length][, encoding])\n  } else if (isFinite(offset)) {\n    offset = offset | 0\n    if (isFinite(length)) {\n      length = length | 0\n      if (encoding === undefined) encoding = 'utf8'\n    } else {\n      encoding = length\n      length = undefined\n    }\n  // legacy write(string, encoding, offset, length) - remove in v0.13\n  } else {\n    var swap = encoding\n    encoding = offset\n    offset = length | 0\n    length = swap\n  }\n\n  var remaining = this.length - offset\n  if (length === undefined || length > remaining) length = remaining\n\n  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n    throw new RangeError('attempt to write outside buffer bounds')\n  }\n\n  if (!encoding) encoding = 'utf8'\n\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'hex':\n        return hexWrite(this, string, offset, length)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Write(this, string, offset, length)\n\n      case 'ascii':\n        return asciiWrite(this, string, offset, length)\n\n      case 'binary':\n        return binaryWrite(this, string, offset, length)\n\n      case 'base64':\n        // Warning: maxLength not taken into account in base64Write\n        return base64Write(this, string, offset, length)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return ucs2Write(this, string, offset, length)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nfunction base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction utf8Slice (buf, start, end) {\n  end = Math.min(buf.length, end)\n  var res = []\n\n  var i = start\n  while (i < end) {\n    var firstByte = buf[i]\n    var codePoint = null\n    var bytesPerSequence = (firstByte > 0xEF) ? 4\n      : (firstByte > 0xDF) ? 3\n      : (firstByte > 0xBF) ? 2\n      : 1\n\n    if (i + bytesPerSequence <= end) {\n      var secondByte, thirdByte, fourthByte, tempCodePoint\n\n      switch (bytesPerSequence) {\n        case 1:\n          if (firstByte < 0x80) {\n            codePoint = firstByte\n          }\n          break\n        case 2:\n          secondByte = buf[i + 1]\n          if ((secondByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n            if (tempCodePoint > 0x7F) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 3:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 4:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          fourthByte = buf[i + 3]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n              codePoint = tempCodePoint\n            }\n          }\n      }\n    }\n\n    if (codePoint === null) {\n      // we did not generate a valid codePoint so insert a\n      // replacement char (U+FFFD) and advance only 1 byte\n      codePoint = 0xFFFD\n      bytesPerSequence = 1\n    } else if (codePoint > 0xFFFF) {\n      // encode to utf16 (surrogate pair dance)\n      codePoint -= 0x10000\n      res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n      codePoint = 0xDC00 | codePoint & 0x3FF\n    }\n\n    res.push(codePoint)\n    i += bytesPerSequence\n  }\n\n  return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n  var len = codePoints.length\n  if (len <= MAX_ARGUMENTS_LENGTH) {\n    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n  }\n\n  // Decode in chunks to avoid \"call stack size exceeded\".\n  var res = ''\n  var i = 0\n  while (i < len) {\n    res += String.fromCharCode.apply(\n      String,\n      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n    )\n  }\n  return res\n}\n\nfunction asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i] & 0x7F)\n  }\n  return ret\n}\n\nfunction binarySlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i])\n  }\n  return ret\n}\n\nfunction hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; i++) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n  var len = this.length\n  start = ~~start\n  end = end === undefined ? len : ~~end\n\n  if (start < 0) {\n    start += len\n    if (start < 0) start = 0\n  } else if (start > len) {\n    start = len\n  }\n\n  if (end < 0) {\n    end += len\n    if (end < 0) end = 0\n  } else if (end > len) {\n    end = len\n  }\n\n  if (end < start) end = start\n\n  var newBuf\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    newBuf = Buffer._augment(this.subarray(start, end))\n  } else {\n    var sliceLen = end - start\n    newBuf = new Buffer(sliceLen, undefined)\n    for (var i = 0; i < sliceLen; i++) {\n      newBuf[i] = this[i + start]\n    }\n  }\n\n  if (newBuf.length) newBuf.parent = this.parent || this\n\n  return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    checkOffset(offset, byteLength, this.length)\n  }\n\n  var val = this[offset + --byteLength]\n  var mul = 1\n  while (byteLength > 0 && (mul *= 0x100)) {\n    val += this[offset + --byteLength] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return ((this[offset]) |\n      (this[offset + 1] << 8) |\n      (this[offset + 2] << 16)) +\n      (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] * 0x1000000) +\n    ((this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var i = byteLength\n  var mul = 1\n  var val = this[offset + --i]\n  while (i > 0 && (mul *= 0x100)) {\n    val += this[offset + --i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  if (!(this[offset] & 0x80)) return (this[offset])\n  return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset] | (this[offset + 1] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset + 1] | (this[offset] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset]) |\n    (this[offset + 1] << 8) |\n    (this[offset + 2] << 16) |\n    (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] << 24) |\n    (this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n  if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var mul = 1\n  var i = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var i = byteLength - 1\n  var mul = 1\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n      (littleEndian ? i : 1 - i) * 8\n  }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffffffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset + 3] = (value >>> 24)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 1] = (value >>> 8)\n    this[offset] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = 0\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  if (value < 0) value = 0xff + value + 1\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 3] = (value >>> 24)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (value < 0) value = 0xffffffff + value + 1\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n  if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n  return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n  return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (targetStart >= target.length) targetStart = target.length\n  if (!targetStart) targetStart = 0\n  if (end > 0 && end < start) end = start\n\n  // Copy 0 bytes; we're done\n  if (end === start) return 0\n  if (target.length === 0 || this.length === 0) return 0\n\n  // Fatal error conditions\n  if (targetStart < 0) {\n    throw new RangeError('targetStart out of bounds')\n  }\n  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n  if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n  // Are we oob?\n  if (end > this.length) end = this.length\n  if (target.length - targetStart < end - start) {\n    end = target.length - targetStart + start\n  }\n\n  var len = end - start\n  var i\n\n  if (this === target && start < targetStart && targetStart < end) {\n    // descending copy from end\n    for (i = len - 1; i >= 0; i--) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n    // ascending copy from start\n    for (i = 0; i < len; i++) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else {\n    target._set(this.subarray(start, start + len), targetStart)\n  }\n\n  return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n  if (!value) value = 0\n  if (!start) start = 0\n  if (!end) end = this.length\n\n  if (end < start) throw new RangeError('end < start')\n\n  // Fill 0 bytes; we're done\n  if (end === start) return\n  if (this.length === 0) return\n\n  if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n  if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n  var i\n  if (typeof value === 'number') {\n    for (i = start; i < end; i++) {\n      this[i] = value\n    }\n  } else {\n    var bytes = utf8ToBytes(value.toString())\n    var len = bytes.length\n    for (i = start; i < end; i++) {\n      this[i] = bytes[i % len]\n    }\n  }\n\n  return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n  if (typeof Uint8Array !== 'undefined') {\n    if (Buffer.TYPED_ARRAY_SUPPORT) {\n      return (new Buffer(this)).buffer\n    } else {\n      var buf = new Uint8Array(this.length)\n      for (var i = 0, len = buf.length; i < len; i += 1) {\n        buf[i] = this[i]\n      }\n      return buf.buffer\n    }\n  } else {\n    throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n  }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n  arr.constructor = Buffer\n  arr._isBuffer = true\n\n  // save reference to original Uint8Array set method before overwriting\n  arr._set = arr.set\n\n  // deprecated\n  arr.get = BP.get\n  arr.set = BP.set\n\n  arr.write = BP.write\n  arr.toString = BP.toString\n  arr.toLocaleString = BP.toString\n  arr.toJSON = BP.toJSON\n  arr.equals = BP.equals\n  arr.compare = BP.compare\n  arr.indexOf = BP.indexOf\n  arr.copy = BP.copy\n  arr.slice = BP.slice\n  arr.readUIntLE = BP.readUIntLE\n  arr.readUIntBE = BP.readUIntBE\n  arr.readUInt8 = BP.readUInt8\n  arr.readUInt16LE = BP.readUInt16LE\n  arr.readUInt16BE = BP.readUInt16BE\n  arr.readUInt32LE = BP.readUInt32LE\n  arr.readUInt32BE = BP.readUInt32BE\n  arr.readIntLE = BP.readIntLE\n  arr.readIntBE = BP.readIntBE\n  arr.readInt8 = BP.readInt8\n  arr.readInt16LE = BP.readInt16LE\n  arr.readInt16BE = BP.readInt16BE\n  arr.readInt32LE = BP.readInt32LE\n  arr.readInt32BE = BP.readInt32BE\n  arr.readFloatLE = BP.readFloatLE\n  arr.readFloatBE = BP.readFloatBE\n  arr.readDoubleLE = BP.readDoubleLE\n  arr.readDoubleBE = BP.readDoubleBE\n  arr.writeUInt8 = BP.writeUInt8\n  arr.writeUIntLE = BP.writeUIntLE\n  arr.writeUIntBE = BP.writeUIntBE\n  arr.writeUInt16LE = BP.writeUInt16LE\n  arr.writeUInt16BE = BP.writeUInt16BE\n  arr.writeUInt32LE = BP.writeUInt32LE\n  arr.writeUInt32BE = BP.writeUInt32BE\n  arr.writeIntLE = BP.writeIntLE\n  arr.writeIntBE = BP.writeIntBE\n  arr.writeInt8 = BP.writeInt8\n  arr.writeInt16LE = BP.writeInt16LE\n  arr.writeInt16BE = BP.writeInt16BE\n  arr.writeInt32LE = BP.writeInt32LE\n  arr.writeInt32BE = BP.writeInt32BE\n  arr.writeFloatLE = BP.writeFloatLE\n  arr.writeFloatBE = BP.writeFloatBE\n  arr.writeDoubleLE = BP.writeDoubleLE\n  arr.writeDoubleBE = BP.writeDoubleBE\n  arr.fill = BP.fill\n  arr.inspect = BP.inspect\n  arr.toArrayBuffer = BP.toArrayBuffer\n\n  return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n  // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n  str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n  // Node converts strings with length < 2 to ''\n  if (str.length < 2) return ''\n  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n  while (str.length % 4 !== 0) {\n    str = str + '='\n  }\n  return str\n}\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n  units = units || Infinity\n  var codePoint\n  var length = string.length\n  var leadSurrogate = null\n  var bytes = []\n\n  for (var i = 0; i < length; i++) {\n    codePoint = string.charCodeAt(i)\n\n    // is surrogate component\n    if (codePoint > 0xD7FF && codePoint < 0xE000) {\n      // last char was a lead\n      if (!leadSurrogate) {\n        // no lead yet\n        if (codePoint > 0xDBFF) {\n          // unexpected trail\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        } else if (i + 1 === length) {\n          // unpaired lead\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        }\n\n        // valid lead\n        leadSurrogate = codePoint\n\n        continue\n      }\n\n      // 2 leads in a row\n      if (codePoint < 0xDC00) {\n        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n        leadSurrogate = codePoint\n        continue\n      }\n\n      // valid surrogate pair\n      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n    } else if (leadSurrogate) {\n      // valid bmp char, but last char was a lead\n      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n    }\n\n    leadSurrogate = null\n\n    // encode utf8\n    if (codePoint < 0x80) {\n      if ((units -= 1) < 0) break\n      bytes.push(codePoint)\n    } else if (codePoint < 0x800) {\n      if ((units -= 2) < 0) break\n      bytes.push(\n        codePoint >> 0x6 | 0xC0,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x10000) {\n      if ((units -= 3) < 0) break\n      bytes.push(\n        codePoint >> 0xC | 0xE0,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x110000) {\n      if ((units -= 4) < 0) break\n      bytes.push(\n        codePoint >> 0x12 | 0xF0,\n        codePoint >> 0xC & 0x3F | 0x80,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else {\n      throw new Error('Invalid code point')\n    }\n  }\n\n  return bytes\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    // Node's code seems to be doing this and not & 0x7F..\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    if ((units -= 2) < 0) break\n\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  for (var i = 0; i < length; i++) {\n    if ((i + offset >= dst.length) || (i >= src.length)) break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"base64-js\":1,\"ieee754\":9,\"isarray\":4}],4:[function(require,module,exports){\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n  return toString.call(arr) == '[object Array]';\n};\n\n},{}],5:[function(require,module,exports){\n(function (process){\n(function () {\n  // Hueristics.\n  var isNode = typeof process !== 'undefined' && process.versions && !!process.versions.node;\n  var isBrowser = typeof window !== 'undefined';\n  var isModule = typeof module !== 'undefined' && !!module.exports;\n\n  // Export.\n  var detect = (isModule ? exports : (this.detect = {}));\n  detect.isNode = isNode;\n  detect.isBrowser = isBrowser;\n  detect.isModule = isModule;\n}).call(this);\n}).call(this,require('_process'))\n},{\"_process\":53}],6:[function(require,module,exports){\n(function (Buffer){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n  if (Array.isArray) {\n    return Array.isArray(arg);\n  }\n  return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n  return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n  return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n  return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n  return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n  return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n  return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n  return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n  return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n  return arg === null ||\n         typeof arg === 'boolean' ||\n         typeof arg === 'number' ||\n         typeof arg === 'string' ||\n         typeof arg === 'symbol' ||  // ES6 symbol\n         typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n  return Object.prototype.toString.call(o);\n}\n\n}).call(this,{\"isBuffer\":require(\"../../is-buffer/index.js\")})\n},{\"../../is-buffer/index.js\":11}],7:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n  this._events = this._events || {};\n  this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n  if (!isNumber(n) || n < 0 || isNaN(n))\n    throw TypeError('n must be a positive number');\n  this._maxListeners = n;\n  return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n  var er, handler, len, args, i, listeners;\n\n  if (!this._events)\n    this._events = {};\n\n  // If there is no 'error' event listener then throw.\n  if (type === 'error') {\n    if (!this._events.error ||\n        (isObject(this._events.error) && !this._events.error.length)) {\n      er = arguments[1];\n      if (er instanceof Error) {\n        throw er; // Unhandled 'error' event\n      }\n      throw TypeError('Uncaught, unspecified \"error\" event.');\n    }\n  }\n\n  handler = this._events[type];\n\n  if (isUndefined(handler))\n    return false;\n\n  if (isFunction(handler)) {\n    switch (arguments.length) {\n      // fast cases\n      case 1:\n        handler.call(this);\n        break;\n      case 2:\n        handler.call(this, arguments[1]);\n        break;\n      case 3:\n        handler.call(this, arguments[1], arguments[2]);\n        break;\n      // slower\n      default:\n        args = Array.prototype.slice.call(arguments, 1);\n        handler.apply(this, args);\n    }\n  } else if (isObject(handler)) {\n    args = Array.prototype.slice.call(arguments, 1);\n    listeners = handler.slice();\n    len = listeners.length;\n    for (i = 0; i < len; i++)\n      listeners[i].apply(this, args);\n  }\n\n  return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n  var m;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events)\n    this._events = {};\n\n  // To avoid recursion in the case that type === \"newListener\"! Before\n  // adding it to the listeners, first emit \"newListener\".\n  if (this._events.newListener)\n    this.emit('newListener', type,\n              isFunction(listener.listener) ?\n              listener.listener : listener);\n\n  if (!this._events[type])\n    // Optimize the case of one listener. Don't need the extra array object.\n    this._events[type] = listener;\n  else if (isObject(this._events[type]))\n    // If we've already got an array, just append.\n    this._events[type].push(listener);\n  else\n    // Adding the second element, need to change to array.\n    this._events[type] = [this._events[type], listener];\n\n  // Check for listener leak\n  if (isObject(this._events[type]) && !this._events[type].warned) {\n    if (!isUndefined(this._maxListeners)) {\n      m = this._maxListeners;\n    } else {\n      m = EventEmitter.defaultMaxListeners;\n    }\n\n    if (m && m > 0 && this._events[type].length > m) {\n      this._events[type].warned = true;\n      console.error('(node) warning: possible EventEmitter memory ' +\n                    'leak detected. %d listeners added. ' +\n                    'Use emitter.setMaxListeners() to increase limit.',\n                    this._events[type].length);\n      if (typeof console.trace === 'function') {\n        // not supported in IE 10\n        console.trace();\n      }\n    }\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  var fired = false;\n\n  function g() {\n    this.removeListener(type, g);\n\n    if (!fired) {\n      fired = true;\n      listener.apply(this, arguments);\n    }\n  }\n\n  g.listener = listener;\n  this.on(type, g);\n\n  return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n  var list, position, length, i;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events || !this._events[type])\n    return this;\n\n  list = this._events[type];\n  length = list.length;\n  position = -1;\n\n  if (list === listener ||\n      (isFunction(list.listener) && list.listener === listener)) {\n    delete this._events[type];\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n\n  } else if (isObject(list)) {\n    for (i = length; i-- > 0;) {\n      if (list[i] === listener ||\n          (list[i].listener && list[i].listener === listener)) {\n        position = i;\n        break;\n      }\n    }\n\n    if (position < 0)\n      return this;\n\n    if (list.length === 1) {\n      list.length = 0;\n      delete this._events[type];\n    } else {\n      list.splice(position, 1);\n    }\n\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n  var key, listeners;\n\n  if (!this._events)\n    return this;\n\n  // not listening for removeListener, no need to emit\n  if (!this._events.removeListener) {\n    if (arguments.length === 0)\n      this._events = {};\n    else if (this._events[type])\n      delete this._events[type];\n    return this;\n  }\n\n  // emit removeListener for all listeners on all events\n  if (arguments.length === 0) {\n    for (key in this._events) {\n      if (key === 'removeListener') continue;\n      this.removeAllListeners(key);\n    }\n    this.removeAllListeners('removeListener');\n    this._events = {};\n    return this;\n  }\n\n  listeners = this._events[type];\n\n  if (isFunction(listeners)) {\n    this.removeListener(type, listeners);\n  } else if (listeners) {\n    // LIFO order\n    while (listeners.length)\n      this.removeListener(type, listeners[listeners.length - 1]);\n  }\n  delete this._events[type];\n\n  return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n  var ret;\n  if (!this._events || !this._events[type])\n    ret = [];\n  else if (isFunction(this._events[type]))\n    ret = [this._events[type]];\n  else\n    ret = this._events[type].slice();\n  return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n  if (this._events) {\n    var evlistener = this._events[type];\n\n    if (isFunction(evlistener))\n      return 1;\n    else if (evlistener)\n      return evlistener.length;\n  }\n  return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n  return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\n/**\n * Analogue of Object.assign().\n * Copies properties from one or more source objects to\n * a target object. Existing keys on the target object will be overwritten.\n *\n * > Note: This differs from spec in some important ways:\n * > 1. Will throw if passed non-objects, including `undefined` or `null` values.\n * > 2. Does not support the curious Exception handling behavior, exceptions are thrown immediately.\n * > For more details, see:\n * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n *\n *\n *\n * @param  {Object} target      The target object to copy properties to.\n * @param  {Object} source, ... The source(s) to copy properties from.\n * @return {Object}             The updated target object.\n */\nmodule.exports = function fastAssign (target) {\n  var totalArgs = arguments.length,\n      source, i, totalKeys, keys, key, j;\n\n  for (i = 1; i < totalArgs; i++) {\n    source = arguments[i];\n    keys = Object.keys(source);\n    totalKeys = keys.length;\n    for (j = 0; j < totalKeys; j++) {\n      key = keys[j];\n      target[key] = source[key];\n    }\n  }\n  return target;\n};\n\n},{}],9:[function(require,module,exports){\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n  var e, m\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var nBits = -7\n  var i = isLE ? (nBytes - 1) : 0\n  var d = isLE ? -1 : 1\n  var s = buffer[offset + i]\n\n  i += d\n\n  e = s & ((1 << (-nBits)) - 1)\n  s >>= (-nBits)\n  nBits += eLen\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  m = e & ((1 << (-nBits)) - 1)\n  e >>= (-nBits)\n  nBits += mLen\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  if (e === 0) {\n    e = 1 - eBias\n  } else if (e === eMax) {\n    return m ? NaN : ((s ? -1 : 1) * Infinity)\n  } else {\n    m = m + Math.pow(2, mLen)\n    e = e - eBias\n  }\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n  var e, m, c\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n  var i = isLE ? 0 : (nBytes - 1)\n  var d = isLE ? 1 : -1\n  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n  value = Math.abs(value)\n\n  if (isNaN(value) || value === Infinity) {\n    m = isNaN(value) ? 1 : 0\n    e = eMax\n  } else {\n    e = Math.floor(Math.log(value) / Math.LN2)\n    if (value * (c = Math.pow(2, -e)) < 1) {\n      e--\n      c *= 2\n    }\n    if (e + eBias >= 1) {\n      value += rt / c\n    } else {\n      value += rt * Math.pow(2, 1 - eBias)\n    }\n    if (value * c >= 2) {\n      e++\n      c /= 2\n    }\n\n    if (e + eBias >= eMax) {\n      m = 0\n      e = eMax\n    } else if (e + eBias >= 1) {\n      m = (value * c - 1) * Math.pow(2, mLen)\n      e = e + eBias\n    } else {\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n      e = 0\n    }\n  }\n\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n  e = (e << mLen) | m\n  eLen += mLen\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n  buffer[offset + i - d] |= s * 128\n}\n\n},{}],10:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n  // implementation from standard node.js 'util' module\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    ctor.prototype = Object.create(superCtor.prototype, {\n      constructor: {\n        value: ctor,\n        enumerable: false,\n        writable: true,\n        configurable: true\n      }\n    });\n  };\n} else {\n  // old school shim for old browsers\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    var TempCtor = function () {}\n    TempCtor.prototype = superCtor.prototype\n    ctor.prototype = new TempCtor()\n    ctor.prototype.constructor = ctor\n  }\n}\n\n},{}],11:[function(require,module,exports){\n/**\n * Determine if an object is Buffer\n *\n * Author:   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * License:  MIT\n *\n * `npm install is-buffer`\n */\n\nmodule.exports = function (obj) {\n  return !!(obj != null &&\n    (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)\n      (obj.constructor &&\n      typeof obj.constructor.isBuffer === 'function' &&\n      obj.constructor.isBuffer(obj))\n    ))\n}\n\n},{}],12:[function(require,module,exports){\n'use strict';\nvar DataReader = require('./dataReader');\n\nfunction ArrayReader(data) {\n    if (data) {\n        this.data = data;\n        this.length = this.data.length;\n        this.index = 0;\n        this.zero = 0;\n\n        for(var i = 0; i < this.data.length; i++) {\n            data[i] = data[i] & 0xFF;\n        }\n    }\n}\nArrayReader.prototype = new DataReader();\n/**\n * @see DataReader.byteAt\n */\nArrayReader.prototype.byteAt = function(i) {\n    return this.data[this.zero + i];\n};\n/**\n * @see DataReader.lastIndexOfSignature\n */\nArrayReader.prototype.lastIndexOfSignature = function(sig) {\n    var sig0 = sig.charCodeAt(0),\n        sig1 = sig.charCodeAt(1),\n        sig2 = sig.charCodeAt(2),\n        sig3 = sig.charCodeAt(3);\n    for (var i = this.length - 4; i >= 0; --i) {\n        if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {\n            return i - this.zero;\n        }\n    }\n\n    return -1;\n};\n/**\n * @see DataReader.readData\n */\nArrayReader.prototype.readData = function(size) {\n    this.checkOffset(size);\n    if(size === 0) {\n        return [];\n    }\n    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n    this.index += size;\n    return result;\n};\nmodule.exports = ArrayReader;\n\n},{\"./dataReader\":17}],13:[function(require,module,exports){\n'use strict';\n// private property\nvar _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n\n// public method for encoding\nexports.encode = function(input, utf8) {\n    var output = \"\";\n    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n    var i = 0;\n\n    while (i < input.length) {\n\n        chr1 = input.charCodeAt(i++);\n        chr2 = input.charCodeAt(i++);\n        chr3 = input.charCodeAt(i++);\n\n        enc1 = chr1 >> 2;\n        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n        enc4 = chr3 & 63;\n\n        if (isNaN(chr2)) {\n            enc3 = enc4 = 64;\n        }\n        else if (isNaN(chr3)) {\n            enc4 = 64;\n        }\n\n        output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);\n\n    }\n\n    return output;\n};\n\n// public method for decoding\nexports.decode = function(input, utf8) {\n    var output = \"\";\n    var chr1, chr2, chr3;\n    var enc1, enc2, enc3, enc4;\n    var i = 0;\n\n    input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n\n    while (i < input.length) {\n\n        enc1 = _keyStr.indexOf(input.charAt(i++));\n        enc2 = _keyStr.indexOf(input.charAt(i++));\n        enc3 = _keyStr.indexOf(input.charAt(i++));\n        enc4 = _keyStr.indexOf(input.charAt(i++));\n\n        chr1 = (enc1 << 2) | (enc2 >> 4);\n        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n        chr3 = ((enc3 & 3) << 6) | enc4;\n\n        output = output + String.fromCharCode(chr1);\n\n        if (enc3 != 64) {\n            output = output + String.fromCharCode(chr2);\n        }\n        if (enc4 != 64) {\n            output = output + String.fromCharCode(chr3);\n        }\n\n    }\n\n    return output;\n\n};\n\n},{}],14:[function(require,module,exports){\n'use strict';\nfunction CompressedObject() {\n    this.compressedSize = 0;\n    this.uncompressedSize = 0;\n    this.crc32 = 0;\n    this.compressionMethod = null;\n    this.compressedContent = null;\n}\n\nCompressedObject.prototype = {\n    /**\n     * Return the decompressed content in an unspecified format.\n     * The format will depend on the decompressor.\n     * @return {Object} the decompressed content.\n     */\n    getContent: function() {\n        return null; // see implementation\n    },\n    /**\n     * Return the compressed content in an unspecified format.\n     * The format will depend on the compressed conten source.\n     * @return {Object} the compressed content.\n     */\n    getCompressedContent: function() {\n        return null; // see implementation\n    }\n};\nmodule.exports = CompressedObject;\n\n},{}],15:[function(require,module,exports){\n'use strict';\nexports.STORE = {\n    magic: \"\\x00\\x00\",\n    compress: function(content, compressionOptions) {\n        return content; // no compression\n    },\n    uncompress: function(content) {\n        return content; // no compression\n    },\n    compressInputType: null,\n    uncompressInputType: null\n};\nexports.DEFLATE = require('./flate');\n\n},{\"./flate\":20}],16:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\n\nvar table = [\n    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,\n    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,\n    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,\n    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,\n    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,\n    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,\n    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,\n    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,\n    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,\n    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,\n    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,\n    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,\n    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,\n    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,\n    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,\n    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,\n    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,\n    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,\n    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,\n    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,\n    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,\n    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,\n    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,\n    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,\n    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,\n    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,\n    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,\n    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,\n    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,\n    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,\n    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,\n    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,\n    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,\n    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,\n    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,\n    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,\n    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,\n    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,\n    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,\n    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,\n    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,\n    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,\n    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,\n    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,\n    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,\n    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,\n    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,\n    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,\n    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,\n    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,\n    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,\n    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,\n    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,\n    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,\n    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,\n    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,\n    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,\n    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,\n    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,\n    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,\n    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,\n    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,\n    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,\n    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D\n];\n\n/**\n *\n *  Javascript crc32\n *  http://www.webtoolkit.info/\n *\n */\nmodule.exports = function crc32(input, crc) {\n    if (typeof input === \"undefined\" || !input.length) {\n        return 0;\n    }\n\n    var isArray = utils.getTypeOf(input) !== \"string\";\n\n    if (typeof(crc) == \"undefined\") {\n        crc = 0;\n    }\n    var x = 0;\n    var y = 0;\n    var b = 0;\n\n    crc = crc ^ (-1);\n    for (var i = 0, iTop = input.length; i < iTop; i++) {\n        b = isArray ? input[i] : input.charCodeAt(i);\n        y = (crc ^ b) & 0xFF;\n        x = table[y];\n        crc = (crc >>> 8) ^ x;\n    }\n\n    return crc ^ (-1);\n};\n// vim: set shiftwidth=4 softtabstop=4:\n\n},{\"./utils\":33}],17:[function(require,module,exports){\n'use strict';\nvar utils = require('./utils');\n\nfunction DataReader(data) {\n    this.data = null; // type : see implementation\n    this.length = 0;\n    this.index = 0;\n    this.zero = 0;\n}\nDataReader.prototype = {\n    /**\n     * Check that the offset will not go too far.\n     * @param {string} offset the additional offset to check.\n     * @throws {Error} an Error if the offset is out of bounds.\n     */\n    checkOffset: function(offset) {\n        this.checkIndex(this.index + offset);\n    },\n    /**\n     * Check that the specifed index will not be too far.\n     * @param {string} newIndex the index to check.\n     * @throws {Error} an Error if the index is out of bounds.\n     */\n    checkIndex: function(newIndex) {\n        if (this.length < this.zero + newIndex || newIndex < 0) {\n            throw new Error(\"End of data reached (data length = \" + this.length + \", asked index = \" + (newIndex) + \"). Corrupted zip ?\");\n        }\n    },\n    /**\n     * Change the index.\n     * @param {number} newIndex The new index.\n     * @throws {Error} if the new index is out of the data.\n     */\n    setIndex: function(newIndex) {\n        this.checkIndex(newIndex);\n        this.index = newIndex;\n    },\n    /**\n     * Skip the next n bytes.\n     * @param {number} n the number of bytes to skip.\n     * @throws {Error} if the new index is out of the data.\n     */\n    skip: function(n) {\n        this.setIndex(this.index + n);\n    },\n    /**\n     * Get the byte at the specified index.\n     * @param {number} i the index to use.\n     * @return {number} a byte.\n     */\n    byteAt: function(i) {\n        // see implementations\n    },\n    /**\n     * Get the next number with a given byte size.\n     * @param {number} size the number of bytes to read.\n     * @return {number} the corresponding number.\n     */\n    readInt: function(size) {\n        var result = 0,\n            i;\n        this.checkOffset(size);\n        for (i = this.index + size - 1; i >= this.index; i--) {\n            result = (result << 8) + this.byteAt(i);\n        }\n        this.index += size;\n        return result;\n    },\n    /**\n     * Get the next string with a given byte size.\n     * @param {number} size the number of bytes to read.\n     * @return {string} the corresponding string.\n     */\n    readString: function(size) {\n        return utils.transformTo(\"string\", this.readData(size));\n    },\n    /**\n     * Get raw data without conversion, <size> bytes.\n     * @param {number} size the number of bytes to read.\n     * @return {Object} the raw data, implementation specific.\n     */\n    readData: function(size) {\n        // see implementations\n    },\n    /**\n     * Find the last occurence of a zip signature (4 bytes).\n     * @param {string} sig the signature to find.\n     * @return {number} the index of the last occurence, -1 if not found.\n     */\n    lastIndexOfSignature: function(sig) {\n        // see implementations\n    },\n    /**\n     * Get the next date.\n     * @return {Date} the date.\n     */\n    readDate: function() {\n        var dostime = this.readInt(4);\n        return new Date(\n        ((dostime >> 25) & 0x7f) + 1980, // year\n        ((dostime >> 21) & 0x0f) - 1, // month\n        (dostime >> 16) & 0x1f, // day\n        (dostime >> 11) & 0x1f, // hour\n        (dostime >> 5) & 0x3f, // minute\n        (dostime & 0x1f) << 1); // second\n    }\n};\nmodule.exports = DataReader;\n\n},{\"./utils\":33}],18:[function(require,module,exports){\n'use strict';\nexports.base64 = false;\nexports.binary = false;\nexports.dir = false;\nexports.createFolders = false;\nexports.date = null;\nexports.compression = null;\nexports.compressionOptions = null;\nexports.comment = null;\nexports.unixPermissions = null;\nexports.dosPermissions = null;\n\n},{}],19:[function(require,module,exports){\n'use strict';\nvar utils = require('./utils');\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.string2binary = function(str) {\n    return utils.string2binary(str);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.string2Uint8Array = function(str) {\n    return utils.transformTo(\"uint8array\", str);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.uint8Array2String = function(array) {\n    return utils.transformTo(\"string\", array);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.string2Blob = function(str) {\n    var buffer = utils.transformTo(\"arraybuffer\", str);\n    return utils.arrayBuffer2Blob(buffer);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.arrayBuffer2Blob = function(buffer) {\n    return utils.arrayBuffer2Blob(buffer);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.transformTo = function(outputType, input) {\n    return utils.transformTo(outputType, input);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.getTypeOf = function(input) {\n    return utils.getTypeOf(input);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.checkSupport = function(type) {\n    return utils.checkSupport(type);\n};\n\n/**\n * @deprecated\n * This value will be removed in a future version without replacement.\n */\nexports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS;\n\n/**\n * @deprecated\n * This value will be removed in a future version without replacement.\n */\nexports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS;\n\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.pretty = function(str) {\n    return utils.pretty(str);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.findCompression = function(compressionMethod) {\n    return utils.findCompression(compressionMethod);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.isRegExp = function (object) {\n    return utils.isRegExp(object);\n};\n\n\n},{\"./utils\":33}],20:[function(require,module,exports){\n'use strict';\nvar USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined');\n\nvar pako = require(\"pako\");\nexports.uncompressInputType = USE_TYPEDARRAY ? \"uint8array\" : \"array\";\nexports.compressInputType = USE_TYPEDARRAY ? \"uint8array\" : \"array\";\n\nexports.magic = \"\\x08\\x00\";\nexports.compress = function(input, compressionOptions) {\n    return pako.deflateRaw(input, {\n        level : compressionOptions.level || -1 // default compression\n    });\n};\nexports.uncompress =  function(input) {\n    return pako.inflateRaw(input);\n};\n\n},{\"pako\":36}],21:[function(require,module,exports){\n'use strict';\n\nvar base64 = require('./base64');\n\n/**\nUsage:\n   zip = new JSZip();\n   zip.file(\"hello.txt\", \"Hello, World!\").file(\"tempfile\", \"nothing\");\n   zip.folder(\"images\").file(\"smile.gif\", base64Data, {base64: true});\n   zip.file(\"Xmas.txt\", \"Ho ho ho !\", {date : new Date(\"December 25, 2007 00:00:01\")});\n   zip.remove(\"tempfile\");\n\n   base64zip = zip.generate();\n\n**/\n\n/**\n * Representation a of zip file in js\n * @constructor\n * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional).\n * @param {Object=} options the options for creating this objects (optional).\n */\nfunction JSZip(data, options) {\n    // if this constructor is used without `new`, it adds `new` before itself:\n    if(!(this instanceof JSZip)) return new JSZip(data, options);\n\n    // object containing the files :\n    // {\n    //   \"folder/\" : {...},\n    //   \"folder/data.txt\" : {...}\n    // }\n    this.files = {};\n\n    this.comment = null;\n\n    // Where we are in the hierarchy\n    this.root = \"\";\n    if (data) {\n        this.load(data, options);\n    }\n    this.clone = function() {\n        var newObj = new JSZip();\n        for (var i in this) {\n            if (typeof this[i] !== \"function\") {\n                newObj[i] = this[i];\n            }\n        }\n        return newObj;\n    };\n}\nJSZip.prototype = require('./object');\nJSZip.prototype.load = require('./load');\nJSZip.support = require('./support');\nJSZip.defaults = require('./defaults');\n\n/**\n * @deprecated\n * This namespace will be removed in a future version without replacement.\n */\nJSZip.utils = require('./deprecatedPublicUtils');\n\nJSZip.base64 = {\n    /**\n     * @deprecated\n     * This method will be removed in a future version without replacement.\n     */\n    encode : function(input) {\n        return base64.encode(input);\n    },\n    /**\n     * @deprecated\n     * This method will be removed in a future version without replacement.\n     */\n    decode : function(input) {\n        return base64.decode(input);\n    }\n};\nJSZip.compressions = require('./compressions');\nmodule.exports = JSZip;\n\n},{\"./base64\":13,\"./compressions\":15,\"./defaults\":18,\"./deprecatedPublicUtils\":19,\"./load\":22,\"./object\":25,\"./support\":29}],22:[function(require,module,exports){\n'use strict';\nvar base64 = require('./base64');\nvar utf8 = require('./utf8');\nvar utils = require('./utils');\nvar ZipEntries = require('./zipEntries');\nmodule.exports = function(data, options) {\n    var files, zipEntries, i, input;\n    options = utils.extend(options || {}, {\n        base64: false,\n        checkCRC32: false,\n        optimizedBinaryString : false,\n        createFolders: false,\n        decodeFileName: utf8.utf8decode\n    });\n    if (options.base64) {\n        data = base64.decode(data);\n    }\n\n    zipEntries = new ZipEntries(data, options);\n    files = zipEntries.files;\n    for (i = 0; i < files.length; i++) {\n        input = files[i];\n        this.file(input.fileNameStr, input.decompressed, {\n            binary: true,\n            optimizedBinaryString: true,\n            date: input.date,\n            dir: input.dir,\n            comment : input.fileCommentStr.length ? input.fileCommentStr : null,\n            unixPermissions : input.unixPermissions,\n            dosPermissions : input.dosPermissions,\n            createFolders: options.createFolders\n        });\n    }\n    if (zipEntries.zipComment.length) {\n        this.comment = zipEntries.zipComment;\n    }\n\n    return this;\n};\n\n},{\"./base64\":13,\"./utf8\":32,\"./utils\":33,\"./zipEntries\":34}],23:[function(require,module,exports){\n(function (Buffer){\n'use strict';\nmodule.exports = function(data, encoding){\n    return new Buffer(data, encoding);\n};\nmodule.exports.test = function(b){\n    return Buffer.isBuffer(b);\n};\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":3}],24:[function(require,module,exports){\n'use strict';\nvar Uint8ArrayReader = require('./uint8ArrayReader');\n\nfunction NodeBufferReader(data) {\n    this.data = data;\n    this.length = this.data.length;\n    this.index = 0;\n    this.zero = 0;\n}\nNodeBufferReader.prototype = new Uint8ArrayReader();\n\n/**\n * @see DataReader.readData\n */\nNodeBufferReader.prototype.readData = function(size) {\n    this.checkOffset(size);\n    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n    this.index += size;\n    return result;\n};\nmodule.exports = NodeBufferReader;\n\n},{\"./uint8ArrayReader\":30}],25:[function(require,module,exports){\n'use strict';\nvar support = require('./support');\nvar utils = require('./utils');\nvar crc32 = require('./crc32');\nvar signature = require('./signature');\nvar defaults = require('./defaults');\nvar base64 = require('./base64');\nvar compressions = require('./compressions');\nvar CompressedObject = require('./compressedObject');\nvar nodeBuffer = require('./nodeBuffer');\nvar utf8 = require('./utf8');\nvar StringWriter = require('./stringWriter');\nvar Uint8ArrayWriter = require('./uint8ArrayWriter');\n\n/**\n * Returns the raw data of a ZipObject, decompress the content if necessary.\n * @param {ZipObject} file the file to use.\n * @return {String|ArrayBuffer|Uint8Array|Buffer} the data.\n */\nvar getRawData = function(file) {\n    if (file._data instanceof CompressedObject) {\n        file._data = file._data.getContent();\n        file.options.binary = true;\n        file.options.base64 = false;\n\n        if (utils.getTypeOf(file._data) === \"uint8array\") {\n            var copy = file._data;\n            // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array.\n            // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file).\n            file._data = new Uint8Array(copy.length);\n            // with an empty Uint8Array, Opera fails with a \"Offset larger than array size\"\n            if (copy.length !== 0) {\n                file._data.set(copy, 0);\n            }\n        }\n    }\n    return file._data;\n};\n\n/**\n * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it.\n * @param {ZipObject} file the file to use.\n * @return {String|ArrayBuffer|Uint8Array|Buffer} the data.\n */\nvar getBinaryData = function(file) {\n    var result = getRawData(file),\n        type = utils.getTypeOf(result);\n    if (type === \"string\") {\n        if (!file.options.binary) {\n            // unicode text !\n            // unicode string => binary string is a painful process, check if we can avoid it.\n            if (support.nodebuffer) {\n                return nodeBuffer(result, \"utf-8\");\n            }\n        }\n        return file.asBinary();\n    }\n    return result;\n};\n\n/**\n * Transform this._data into a string.\n * @param {function} filter a function String -> String, applied if not null on the result.\n * @return {String} the string representing this._data.\n */\nvar dataToString = function(asUTF8) {\n    var result = getRawData(this);\n    if (result === null || typeof result === \"undefined\") {\n        return \"\";\n    }\n    // if the data is a base64 string, we decode it before checking the encoding !\n    if (this.options.base64) {\n        result = base64.decode(result);\n    }\n    if (asUTF8 && this.options.binary) {\n        // JSZip.prototype.utf8decode supports arrays as input\n        // skip to array => string step, utf8decode will do it.\n        result = out.utf8decode(result);\n    }\n    else {\n        // no utf8 transformation, do the array => string step.\n        result = utils.transformTo(\"string\", result);\n    }\n\n    if (!asUTF8 && !this.options.binary) {\n        result = utils.transformTo(\"string\", out.utf8encode(result));\n    }\n    return result;\n};\n/**\n * A simple object representing a file in the zip file.\n * @constructor\n * @param {string} name the name of the file\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data\n * @param {Object} options the options of the file\n */\nvar ZipObject = function(name, data, options) {\n    this.name = name;\n    this.dir = options.dir;\n    this.date = options.date;\n    this.comment = options.comment;\n    this.unixPermissions = options.unixPermissions;\n    this.dosPermissions = options.dosPermissions;\n\n    this._data = data;\n    this.options = options;\n\n    /*\n     * This object contains initial values for dir and date.\n     * With them, we can check if the user changed the deprecated metadata in\n     * `ZipObject#options` or not.\n     */\n    this._initialMetadata = {\n      dir : options.dir,\n      date : options.date\n    };\n};\n\nZipObject.prototype = {\n    /**\n     * Return the content as UTF8 string.\n     * @return {string} the UTF8 string.\n     */\n    asText: function() {\n        return dataToString.call(this, true);\n    },\n    /**\n     * Returns the binary content.\n     * @return {string} the content as binary.\n     */\n    asBinary: function() {\n        return dataToString.call(this, false);\n    },\n    /**\n     * Returns the content as a nodejs Buffer.\n     * @return {Buffer} the content as a Buffer.\n     */\n    asNodeBuffer: function() {\n        var result = getBinaryData(this);\n        return utils.transformTo(\"nodebuffer\", result);\n    },\n    /**\n     * Returns the content as an Uint8Array.\n     * @return {Uint8Array} the content as an Uint8Array.\n     */\n    asUint8Array: function() {\n        var result = getBinaryData(this);\n        return utils.transformTo(\"uint8array\", result);\n    },\n    /**\n     * Returns the content as an ArrayBuffer.\n     * @return {ArrayBuffer} the content as an ArrayBufer.\n     */\n    asArrayBuffer: function() {\n        return this.asUint8Array().buffer;\n    }\n};\n\n/**\n * Transform an integer into a string in hexadecimal.\n * @private\n * @param {number} dec the number to convert.\n * @param {number} bytes the number of bytes to generate.\n * @returns {string} the result.\n */\nvar decToHex = function(dec, bytes) {\n    var hex = \"\",\n        i;\n    for (i = 0; i < bytes; i++) {\n        hex += String.fromCharCode(dec & 0xff);\n        dec = dec >>> 8;\n    }\n    return hex;\n};\n\n/**\n * Transforms the (incomplete) options from the user into the complete\n * set of options to create a file.\n * @private\n * @param {Object} o the options from the user.\n * @return {Object} the complete set of options.\n */\nvar prepareFileAttrs = function(o) {\n    o = o || {};\n    if (o.base64 === true && (o.binary === null || o.binary === undefined)) {\n        o.binary = true;\n    }\n    o = utils.extend(o, defaults);\n    o.date = o.date || new Date();\n    if (o.compression !== null) o.compression = o.compression.toUpperCase();\n\n    return o;\n};\n\n/**\n * Add a file in the current folder.\n * @private\n * @param {string} name the name of the file\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file\n * @param {Object} o the options of the file\n * @return {Object} the new file.\n */\nvar fileAdd = function(name, data, o) {\n    // be sure sub folders exist\n    var dataType = utils.getTypeOf(data),\n        parent;\n\n    o = prepareFileAttrs(o);\n\n    if (typeof o.unixPermissions === \"string\") {\n        o.unixPermissions = parseInt(o.unixPermissions, 8);\n    }\n\n    // UNX_IFDIR  0040000 see zipinfo.c\n    if (o.unixPermissions && (o.unixPermissions & 0x4000)) {\n        o.dir = true;\n    }\n    // Bit 4    Directory\n    if (o.dosPermissions && (o.dosPermissions & 0x0010)) {\n        o.dir = true;\n    }\n\n    if (o.dir) {\n        name = forceTrailingSlash(name);\n    }\n\n    if (o.createFolders && (parent = parentFolder(name))) {\n        folderAdd.call(this, parent, true);\n    }\n\n    if (o.dir || data === null || typeof data === \"undefined\") {\n        o.base64 = false;\n        o.binary = false;\n        data = null;\n        dataType = null;\n    }\n    else if (dataType === \"string\") {\n        if (o.binary && !o.base64) {\n            // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask\n            if (o.optimizedBinaryString !== true) {\n                // this is a string, not in a base64 format.\n                // Be sure that this is a correct \"binary string\"\n                data = utils.string2binary(data);\n            }\n        }\n    }\n    else { // arraybuffer, uint8array, ...\n        o.base64 = false;\n        o.binary = true;\n\n        if (!dataType && !(data instanceof CompressedObject)) {\n            throw new Error(\"The data of '\" + name + \"' is in an unsupported format !\");\n        }\n\n        // special case : it's way easier to work with Uint8Array than with ArrayBuffer\n        if (dataType === \"arraybuffer\") {\n            data = utils.transformTo(\"uint8array\", data);\n        }\n    }\n\n    var object = new ZipObject(name, data, o);\n    this.files[name] = object;\n    return object;\n};\n\n/**\n * Find the parent folder of the path.\n * @private\n * @param {string} path the path to use\n * @return {string} the parent folder, or \"\"\n */\nvar parentFolder = function (path) {\n    if (path.slice(-1) == '/') {\n        path = path.substring(0, path.length - 1);\n    }\n    var lastSlash = path.lastIndexOf('/');\n    return (lastSlash > 0) ? path.substring(0, lastSlash) : \"\";\n};\n\n\n/**\n * Returns the path with a slash at the end.\n * @private\n * @param {String} path the path to check.\n * @return {String} the path with a trailing slash.\n */\nvar forceTrailingSlash = function(path) {\n    // Check the name ends with a /\n    if (path.slice(-1) != \"/\") {\n        path += \"/\"; // IE doesn't like substr(-1)\n    }\n    return path;\n};\n/**\n * Add a (sub) folder in the current folder.\n * @private\n * @param {string} name the folder's name\n * @param {boolean=} [createFolders] If true, automatically create sub\n *  folders. Defaults to false.\n * @return {Object} the new folder.\n */\nvar folderAdd = function(name, createFolders) {\n    createFolders = (typeof createFolders !== 'undefined') ? createFolders : false;\n\n    name = forceTrailingSlash(name);\n\n    // Does this folder already exist?\n    if (!this.files[name]) {\n        fileAdd.call(this, name, null, {\n            dir: true,\n            createFolders: createFolders\n        });\n    }\n    return this.files[name];\n};\n\n/**\n * Generate a JSZip.CompressedObject for a given zipOject.\n * @param {ZipObject} file the object to read.\n * @param {JSZip.compression} compression the compression to use.\n * @param {Object} compressionOptions the options to use when compressing.\n * @return {JSZip.CompressedObject} the compressed result.\n */\nvar generateCompressedObjectFrom = function(file, compression, compressionOptions) {\n    var result = new CompressedObject(),\n        content;\n\n    // the data has not been decompressed, we might reuse things !\n    if (file._data instanceof CompressedObject) {\n        result.uncompressedSize = file._data.uncompressedSize;\n        result.crc32 = file._data.crc32;\n\n        if (result.uncompressedSize === 0 || file.dir) {\n            compression = compressions['STORE'];\n            result.compressedContent = \"\";\n            result.crc32 = 0;\n        }\n        else if (file._data.compressionMethod === compression.magic) {\n            result.compressedContent = file._data.getCompressedContent();\n        }\n        else {\n            content = file._data.getContent();\n            // need to decompress / recompress\n            result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions);\n        }\n    }\n    else {\n        // have uncompressed data\n        content = getBinaryData(file);\n        if (!content || content.length === 0 || file.dir) {\n            compression = compressions['STORE'];\n            content = \"\";\n        }\n        result.uncompressedSize = content.length;\n        result.crc32 = crc32(content);\n        result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions);\n    }\n\n    result.compressedSize = result.compressedContent.length;\n    result.compressionMethod = compression.magic;\n\n    return result;\n};\n\n\n\n\n/**\n * Generate the UNIX part of the external file attributes.\n * @param {Object} unixPermissions the unix permissions or null.\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\n * @return {Number} a 32 bit integer.\n *\n * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute :\n *\n * TTTTsstrwxrwxrwx0000000000ADVSHR\n * ^^^^____________________________ file type, see zipinfo.c (UNX_*)\n *     ^^^_________________________ setuid, setgid, sticky\n *        ^^^^^^^^^________________ permissions\n *                 ^^^^^^^^^^______ not used ?\n *                           ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only\n */\nvar generateUnixExternalFileAttr = function (unixPermissions, isDir) {\n\n    var result = unixPermissions;\n    if (!unixPermissions) {\n        // I can't use octal values in strict mode, hence the hexa.\n        //  040775 => 0x41fd\n        // 0100664 => 0x81b4\n        result = isDir ? 0x41fd : 0x81b4;\n    }\n\n    return (result & 0xFFFF) << 16;\n};\n\n/**\n * Generate the DOS part of the external file attributes.\n * @param {Object} dosPermissions the dos permissions or null.\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\n * @return {Number} a 32 bit integer.\n *\n * Bit 0     Read-Only\n * Bit 1     Hidden\n * Bit 2     System\n * Bit 3     Volume Label\n * Bit 4     Directory\n * Bit 5     Archive\n */\nvar generateDosExternalFileAttr = function (dosPermissions, isDir) {\n\n    // the dir flag is already set for compatibility\n\n    return (dosPermissions || 0)  & 0x3F;\n};\n\n/**\n * Generate the various parts used in the construction of the final zip file.\n * @param {string} name the file name.\n * @param {ZipObject} file the file content.\n * @param {JSZip.CompressedObject} compressedObject the compressed object.\n * @param {number} offset the current offset from the start of the zip file.\n * @param {String} platform let's pretend we are this platform (change platform dependents fields)\n * @param {Function} encodeFileName the function to encode the file name / comment.\n * @return {object} the zip parts.\n */\nvar generateZipParts = function(name, file, compressedObject, offset, platform, encodeFileName) {\n    var data = compressedObject.compressedContent,\n        useCustomEncoding = encodeFileName !== utf8.utf8encode,\n        encodedFileName = utils.transformTo(\"string\", encodeFileName(file.name)),\n        utfEncodedFileName = utils.transformTo(\"string\", utf8.utf8encode(file.name)),\n        comment = file.comment || \"\",\n        encodedComment = utils.transformTo(\"string\", encodeFileName(comment)),\n        utfEncodedComment = utils.transformTo(\"string\", utf8.utf8encode(comment)),\n        useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,\n        useUTF8ForComment = utfEncodedComment.length !== comment.length,\n        o = file.options,\n        dosTime,\n        dosDate,\n        extraFields = \"\",\n        unicodePathExtraField = \"\",\n        unicodeCommentExtraField = \"\",\n        dir, date;\n\n\n    // handle the deprecated options.dir\n    if (file._initialMetadata.dir !== file.dir) {\n        dir = file.dir;\n    } else {\n        dir = o.dir;\n    }\n\n    // handle the deprecated options.date\n    if(file._initialMetadata.date !== file.date) {\n        date = file.date;\n    } else {\n        date = o.date;\n    }\n\n    var extFileAttr = 0;\n    var versionMadeBy = 0;\n    if (dir) {\n        // dos or unix, we set the dos dir flag\n        extFileAttr |= 0x00010;\n    }\n    if(platform === \"UNIX\") {\n        versionMadeBy = 0x031E; // UNIX, version 3.0\n        extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir);\n    } else { // DOS or other, fallback to DOS\n        versionMadeBy = 0x0014; // DOS, version 2.0\n        extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);\n    }\n\n    // date\n    // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html\n    // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html\n    // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html\n\n    dosTime = date.getHours();\n    dosTime = dosTime << 6;\n    dosTime = dosTime | date.getMinutes();\n    dosTime = dosTime << 5;\n    dosTime = dosTime | date.getSeconds() / 2;\n\n    dosDate = date.getFullYear() - 1980;\n    dosDate = dosDate << 4;\n    dosDate = dosDate | (date.getMonth() + 1);\n    dosDate = dosDate << 5;\n    dosDate = dosDate | date.getDate();\n\n    if (useUTF8ForFileName) {\n        // set the unicode path extra field. unzip needs at least one extra\n        // field to correctly handle unicode path, so using the path is as good\n        // as any other information. This could improve the situation with\n        // other archive managers too.\n        // This field is usually used without the utf8 flag, with a non\n        // unicode path in the header (winrar, winzip). This helps (a bit)\n        // with the messy Windows' default compressed folders feature but\n        // breaks on p7zip which doesn't seek the unicode path extra field.\n        // So for now, UTF-8 everywhere !\n        unicodePathExtraField =\n            // Version\n            decToHex(1, 1) +\n            // NameCRC32\n            decToHex(crc32(encodedFileName), 4) +\n            // UnicodeName\n            utfEncodedFileName;\n\n        extraFields +=\n            // Info-ZIP Unicode Path Extra Field\n            \"\\x75\\x70\" +\n            // size\n            decToHex(unicodePathExtraField.length, 2) +\n            // content\n            unicodePathExtraField;\n    }\n\n    if(useUTF8ForComment) {\n\n        unicodeCommentExtraField =\n            // Version\n            decToHex(1, 1) +\n            // CommentCRC32\n            decToHex(this.crc32(encodedComment), 4) +\n            // UnicodeName\n            utfEncodedComment;\n\n        extraFields +=\n            // Info-ZIP Unicode Path Extra Field\n            \"\\x75\\x63\" +\n            // size\n            decToHex(unicodeCommentExtraField.length, 2) +\n            // content\n            unicodeCommentExtraField;\n    }\n\n    var header = \"\";\n\n    // version needed to extract\n    header += \"\\x0A\\x00\";\n    // general purpose bit flag\n    // set bit 11 if utf8\n    header += !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment) ? \"\\x00\\x08\" : \"\\x00\\x00\";\n    // compression method\n    header += compressedObject.compressionMethod;\n    // last mod file time\n    header += decToHex(dosTime, 2);\n    // last mod file date\n    header += decToHex(dosDate, 2);\n    // crc-32\n    header += decToHex(compressedObject.crc32, 4);\n    // compressed size\n    header += decToHex(compressedObject.compressedSize, 4);\n    // uncompressed size\n    header += decToHex(compressedObject.uncompressedSize, 4);\n    // file name length\n    header += decToHex(encodedFileName.length, 2);\n    // extra field length\n    header += decToHex(extraFields.length, 2);\n\n\n    var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;\n\n    var dirRecord = signature.CENTRAL_FILE_HEADER +\n    // version made by (00: DOS)\n    decToHex(versionMadeBy, 2) +\n    // file header (common to file and central directory)\n    header +\n    // file comment length\n    decToHex(encodedComment.length, 2) +\n    // disk number start\n    \"\\x00\\x00\" +\n    // internal file attributes TODO\n    \"\\x00\\x00\" +\n    // external file attributes\n    decToHex(extFileAttr, 4) +\n    // relative offset of local header\n    decToHex(offset, 4) +\n    // file name\n    encodedFileName +\n    // extra field\n    extraFields +\n    // file comment\n    encodedComment;\n\n    return {\n        fileRecord: fileRecord,\n        dirRecord: dirRecord,\n        compressedObject: compressedObject\n    };\n};\n\n\n// return the actual prototype of JSZip\nvar out = {\n    /**\n     * Read an existing zip and merge the data in the current JSZip object.\n     * The implementation is in jszip-load.js, don't forget to include it.\n     * @param {String|ArrayBuffer|Uint8Array|Buffer} stream  The stream to load\n     * @param {Object} options Options for loading the stream.\n     *  options.base64 : is the stream in base64 ? default : false\n     * @return {JSZip} the current JSZip object\n     */\n    load: function(stream, options) {\n        throw new Error(\"Load method is not defined. Is the file jszip-load.js included ?\");\n    },\n\n    /**\n     * Filter nested files/folders with the specified function.\n     * @param {Function} search the predicate to use :\n     * function (relativePath, file) {...}\n     * It takes 2 arguments : the relative path and the file.\n     * @return {Array} An array of matching elements.\n     */\n    filter: function(search) {\n        var result = [],\n            filename, relativePath, file, fileClone;\n        for (filename in this.files) {\n            if (!this.files.hasOwnProperty(filename)) {\n                continue;\n            }\n            file = this.files[filename];\n            // return a new object, don't let the user mess with our internal objects :)\n            fileClone = new ZipObject(file.name, file._data, utils.extend(file.options));\n            relativePath = filename.slice(this.root.length, filename.length);\n            if (filename.slice(0, this.root.length) === this.root && // the file is in the current root\n            search(relativePath, fileClone)) { // and the file matches the function\n                result.push(fileClone);\n            }\n        }\n        return result;\n    },\n\n    /**\n     * Add a file to the zip file, or search a file.\n     * @param   {string|RegExp} name The name of the file to add (if data is defined),\n     * the name of the file to find (if no data) or a regex to match files.\n     * @param   {String|ArrayBuffer|Uint8Array|Buffer} data  The file data, either raw or base64 encoded\n     * @param   {Object} o     File options\n     * @return  {JSZip|Object|Array} this JSZip object (when adding a file),\n     * a file (when searching by string) or an array of files (when searching by regex).\n     */\n    file: function(name, data, o) {\n        if (arguments.length === 1) {\n            if (utils.isRegExp(name)) {\n                var regexp = name;\n                return this.filter(function(relativePath, file) {\n                    return !file.dir && regexp.test(relativePath);\n                });\n            }\n            else { // text\n                return this.filter(function(relativePath, file) {\n                    return !file.dir && relativePath === name;\n                })[0] || null;\n            }\n        }\n        else { // more than one argument : we have data !\n            name = this.root + name;\n            fileAdd.call(this, name, data, o);\n        }\n        return this;\n    },\n\n    /**\n     * Add a directory to the zip file, or search.\n     * @param   {String|RegExp} arg The name of the directory to add, or a regex to search folders.\n     * @return  {JSZip} an object with the new directory as the root, or an array containing matching folders.\n     */\n    folder: function(arg) {\n        if (!arg) {\n            return this;\n        }\n\n        if (utils.isRegExp(arg)) {\n            return this.filter(function(relativePath, file) {\n                return file.dir && arg.test(relativePath);\n            });\n        }\n\n        // else, name is a new folder\n        var name = this.root + arg;\n        var newFolder = folderAdd.call(this, name);\n\n        // Allow chaining by returning a new object with this folder as the root\n        var ret = this.clone();\n        ret.root = newFolder.name;\n        return ret;\n    },\n\n    /**\n     * Delete a file, or a directory and all sub-files, from the zip\n     * @param {string} name the name of the file to delete\n     * @return {JSZip} this JSZip object\n     */\n    remove: function(name) {\n        name = this.root + name;\n        var file = this.files[name];\n        if (!file) {\n            // Look for any folders\n            if (name.slice(-1) != \"/\") {\n                name += \"/\";\n            }\n            file = this.files[name];\n        }\n\n        if (file && !file.dir) {\n            // file\n            delete this.files[name];\n        } else {\n            // maybe a folder, delete recursively\n            var kids = this.filter(function(relativePath, file) {\n                return file.name.slice(0, name.length) === name;\n            });\n            for (var i = 0; i < kids.length; i++) {\n                delete this.files[kids[i].name];\n            }\n        }\n\n        return this;\n    },\n\n    /**\n     * Generate the complete zip file\n     * @param {Object} options the options to generate the zip file :\n     * - base64, (deprecated, use type instead) true to generate base64.\n     * - compression, \"STORE\" by default.\n     * - type, \"base64\" by default. Values are : string, base64, uint8array, arraybuffer, blob.\n     * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file\n     */\n    generate: function(options) {\n        options = utils.extend(options || {}, {\n            base64: true,\n            compression: \"STORE\",\n            compressionOptions : null,\n            type: \"base64\",\n            platform: \"DOS\",\n            comment: null,\n            mimeType: 'application/zip',\n            encodeFileName: utf8.utf8encode\n        });\n\n        utils.checkSupport(options.type);\n\n        // accept nodejs `process.platform`\n        if(\n          options.platform === 'darwin' ||\n          options.platform === 'freebsd' ||\n          options.platform === 'linux' ||\n          options.platform === 'sunos'\n        ) {\n          options.platform = \"UNIX\";\n        }\n        if (options.platform === 'win32') {\n          options.platform = \"DOS\";\n        }\n\n        var zipData = [],\n            localDirLength = 0,\n            centralDirLength = 0,\n            writer, i,\n            encodedComment = utils.transformTo(\"string\", options.encodeFileName(options.comment || this.comment || \"\"));\n\n        // first, generate all the zip parts.\n        for (var name in this.files) {\n            if (!this.files.hasOwnProperty(name)) {\n                continue;\n            }\n            var file = this.files[name];\n\n            var compressionName = file.options.compression || options.compression.toUpperCase();\n            var compression = compressions[compressionName];\n            if (!compression) {\n                throw new Error(compressionName + \" is not a valid compression method !\");\n            }\n            var compressionOptions = file.options.compressionOptions || options.compressionOptions || {};\n\n            var compressedObject = generateCompressedObjectFrom.call(this, file, compression, compressionOptions);\n\n            var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength, options.platform, options.encodeFileName);\n            localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize;\n            centralDirLength += zipPart.dirRecord.length;\n            zipData.push(zipPart);\n        }\n\n        var dirEnd = \"\";\n\n        // end of central dir signature\n        dirEnd = signature.CENTRAL_DIRECTORY_END +\n        // number of this disk\n        \"\\x00\\x00\" +\n        // number of the disk with the start of the central directory\n        \"\\x00\\x00\" +\n        // total number of entries in the central directory on this disk\n        decToHex(zipData.length, 2) +\n        // total number of entries in the central directory\n        decToHex(zipData.length, 2) +\n        // size of the central directory   4 bytes\n        decToHex(centralDirLength, 4) +\n        // offset of start of central directory with respect to the starting disk number\n        decToHex(localDirLength, 4) +\n        // .ZIP file comment length\n        decToHex(encodedComment.length, 2) +\n        // .ZIP file comment\n        encodedComment;\n\n\n        // we have all the parts (and the total length)\n        // time to create a writer !\n        var typeName = options.type.toLowerCase();\n        if(typeName===\"uint8array\"||typeName===\"arraybuffer\"||typeName===\"blob\"||typeName===\"nodebuffer\") {\n            writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length);\n        }else{\n            writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length);\n        }\n\n        for (i = 0; i < zipData.length; i++) {\n            writer.append(zipData[i].fileRecord);\n            writer.append(zipData[i].compressedObject.compressedContent);\n        }\n        for (i = 0; i < zipData.length; i++) {\n            writer.append(zipData[i].dirRecord);\n        }\n\n        writer.append(dirEnd);\n\n        var zip = writer.finalize();\n\n\n\n        switch(options.type.toLowerCase()) {\n            // case \"zip is an Uint8Array\"\n            case \"uint8array\" :\n            case \"arraybuffer\" :\n            case \"nodebuffer\" :\n               return utils.transformTo(options.type.toLowerCase(), zip);\n            case \"blob\" :\n               return utils.arrayBuffer2Blob(utils.transformTo(\"arraybuffer\", zip), options.mimeType);\n            // case \"zip is a string\"\n            case \"base64\" :\n               return (options.base64) ? base64.encode(zip) : zip;\n            default : // case \"string\" :\n               return zip;\n         }\n\n    },\n\n    /**\n     * @deprecated\n     * This method will be removed in a future version without replacement.\n     */\n    crc32: function (input, crc) {\n        return crc32(input, crc);\n    },\n\n    /**\n     * @deprecated\n     * This method will be removed in a future version without replacement.\n     */\n    utf8encode: function (string) {\n        return utils.transformTo(\"string\", utf8.utf8encode(string));\n    },\n\n    /**\n     * @deprecated\n     * This method will be removed in a future version without replacement.\n     */\n    utf8decode: function (input) {\n        return utf8.utf8decode(input);\n    }\n};\nmodule.exports = out;\n\n},{\"./base64\":13,\"./compressedObject\":14,\"./compressions\":15,\"./crc32\":16,\"./defaults\":18,\"./nodeBuffer\":23,\"./signature\":26,\"./stringWriter\":28,\"./support\":29,\"./uint8ArrayWriter\":31,\"./utf8\":32,\"./utils\":33}],26:[function(require,module,exports){\n'use strict';\nexports.LOCAL_FILE_HEADER = \"PK\\x03\\x04\";\nexports.CENTRAL_FILE_HEADER = \"PK\\x01\\x02\";\nexports.CENTRAL_DIRECTORY_END = \"PK\\x05\\x06\";\nexports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = \"PK\\x06\\x07\";\nexports.ZIP64_CENTRAL_DIRECTORY_END = \"PK\\x06\\x06\";\nexports.DATA_DESCRIPTOR = \"PK\\x07\\x08\";\n\n},{}],27:[function(require,module,exports){\n'use strict';\nvar DataReader = require('./dataReader');\nvar utils = require('./utils');\n\nfunction StringReader(data, optimizedBinaryString) {\n    this.data = data;\n    if (!optimizedBinaryString) {\n        this.data = utils.string2binary(this.data);\n    }\n    this.length = this.data.length;\n    this.index = 0;\n    this.zero = 0;\n}\nStringReader.prototype = new DataReader();\n/**\n * @see DataReader.byteAt\n */\nStringReader.prototype.byteAt = function(i) {\n    return this.data.charCodeAt(this.zero + i);\n};\n/**\n * @see DataReader.lastIndexOfSignature\n */\nStringReader.prototype.lastIndexOfSignature = function(sig) {\n    return this.data.lastIndexOf(sig) - this.zero;\n};\n/**\n * @see DataReader.readData\n */\nStringReader.prototype.readData = function(size) {\n    this.checkOffset(size);\n    // this will work because the constructor applied the \"& 0xff\" mask.\n    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n    this.index += size;\n    return result;\n};\nmodule.exports = StringReader;\n\n},{\"./dataReader\":17,\"./utils\":33}],28:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\n\n/**\n * An object to write any content to a string.\n * @constructor\n */\nvar StringWriter = function() {\n    this.data = [];\n};\nStringWriter.prototype = {\n    /**\n     * Append any content to the current string.\n     * @param {Object} input the content to add.\n     */\n    append: function(input) {\n        input = utils.transformTo(\"string\", input);\n        this.data.push(input);\n    },\n    /**\n     * Finalize the construction an return the result.\n     * @return {string} the generated string.\n     */\n    finalize: function() {\n        return this.data.join(\"\");\n    }\n};\n\nmodule.exports = StringWriter;\n\n},{\"./utils\":33}],29:[function(require,module,exports){\n(function (Buffer){\n'use strict';\nexports.base64 = true;\nexports.array = true;\nexports.string = true;\nexports.arraybuffer = typeof ArrayBuffer !== \"undefined\" && typeof Uint8Array !== \"undefined\";\n// contains true if JSZip can read/generate nodejs Buffer, false otherwise.\n// Browserify will provide a Buffer implementation for browsers, which is\n// an augmented Uint8Array (i.e., can be used as either Buffer or U8).\nexports.nodebuffer = typeof Buffer !== \"undefined\";\n// contains true if JSZip can read/generate Uint8Array, false otherwise.\nexports.uint8array = typeof Uint8Array !== \"undefined\";\n\nif (typeof ArrayBuffer === \"undefined\") {\n    exports.blob = false;\n}\nelse {\n    var buffer = new ArrayBuffer(0);\n    try {\n        exports.blob = new Blob([buffer], {\n            type: \"application/zip\"\n        }).size === 0;\n    }\n    catch (e) {\n        try {\n            var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\n            var builder = new Builder();\n            builder.append(buffer);\n            exports.blob = builder.getBlob('application/zip').size === 0;\n        }\n        catch (e) {\n            exports.blob = false;\n        }\n    }\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":3}],30:[function(require,module,exports){\n'use strict';\nvar ArrayReader = require('./arrayReader');\n\nfunction Uint8ArrayReader(data) {\n    if (data) {\n        this.data = data;\n        this.length = this.data.length;\n        this.index = 0;\n        this.zero = 0;\n    }\n}\nUint8ArrayReader.prototype = new ArrayReader();\n/**\n * @see DataReader.readData\n */\nUint8ArrayReader.prototype.readData = function(size) {\n    this.checkOffset(size);\n    if(size === 0) {\n        // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].\n        return new Uint8Array(0);\n    }\n    var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);\n    this.index += size;\n    return result;\n};\nmodule.exports = Uint8ArrayReader;\n\n},{\"./arrayReader\":12}],31:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\n\n/**\n * An object to write any content to an Uint8Array.\n * @constructor\n * @param {number} length The length of the array.\n */\nvar Uint8ArrayWriter = function(length) {\n    this.data = new Uint8Array(length);\n    this.index = 0;\n};\nUint8ArrayWriter.prototype = {\n    /**\n     * Append any content to the current array.\n     * @param {Object} input the content to add.\n     */\n    append: function(input) {\n        if (input.length !== 0) {\n            // with an empty Uint8Array, Opera fails with a \"Offset larger than array size\"\n            input = utils.transformTo(\"uint8array\", input);\n            this.data.set(input, this.index);\n            this.index += input.length;\n        }\n    },\n    /**\n     * Finalize the construction an return the result.\n     * @return {Uint8Array} the generated array.\n     */\n    finalize: function() {\n        return this.data;\n    }\n};\n\nmodule.exports = Uint8ArrayWriter;\n\n},{\"./utils\":33}],32:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar support = require('./support');\nvar nodeBuffer = require('./nodeBuffer');\n\n/**\n * The following functions come from pako, from pako/lib/utils/strings\n * released under the MIT license, see pako https://github.com/nodeca/pako/\n */\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new Array(256);\nfor (var i=0; i<256; i++) {\n  _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);\n}\n_utf8len[254]=_utf8len[254]=1; // Invalid sequence start\n\n// convert string to array (typed, when possible)\nvar string2buf = function (str) {\n    var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n    // count binary size\n    for (m_pos = 0; m_pos < str_len; m_pos++) {\n        c = str.charCodeAt(m_pos);\n        if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {\n            c2 = str.charCodeAt(m_pos+1);\n            if ((c2 & 0xfc00) === 0xdc00) {\n                c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n                m_pos++;\n            }\n        }\n        buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n    }\n\n    // allocate buffer\n    if (support.uint8array) {\n        buf = new Uint8Array(buf_len);\n    } else {\n        buf = new Array(buf_len);\n    }\n\n    // convert\n    for (i=0, m_pos = 0; i < buf_len; m_pos++) {\n        c = str.charCodeAt(m_pos);\n        if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {\n            c2 = str.charCodeAt(m_pos+1);\n            if ((c2 & 0xfc00) === 0xdc00) {\n                c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n                m_pos++;\n            }\n        }\n        if (c < 0x80) {\n            /* one byte */\n            buf[i++] = c;\n        } else if (c < 0x800) {\n            /* two bytes */\n            buf[i++] = 0xC0 | (c >>> 6);\n            buf[i++] = 0x80 | (c & 0x3f);\n        } else if (c < 0x10000) {\n            /* three bytes */\n            buf[i++] = 0xE0 | (c >>> 12);\n            buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n            buf[i++] = 0x80 | (c & 0x3f);\n        } else {\n            /* four bytes */\n            buf[i++] = 0xf0 | (c >>> 18);\n            buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n            buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n            buf[i++] = 0x80 | (c & 0x3f);\n        }\n    }\n\n    return buf;\n};\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max   - length limit (mandatory);\nvar utf8border = function(buf, max) {\n    var pos;\n\n    max = max || buf.length;\n    if (max > buf.length) { max = buf.length; }\n\n    // go back from last position, until start of sequence found\n    pos = max-1;\n    while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n    // Fuckup - very small and broken sequence,\n    // return max, because we should return something anyway.\n    if (pos < 0) { return max; }\n\n    // If we came to start of buffer - that means vuffer is too small,\n    // return max too.\n    if (pos === 0) { return max; }\n\n    return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n\n// convert array to string\nvar buf2string = function (buf) {\n    var str, i, out, c, c_len;\n    var len = buf.length;\n\n    // Reserve max possible length (2 words per char)\n    // NB: by unknown reasons, Array is significantly faster for\n    //     String.fromCharCode.apply than Uint16Array.\n    var utf16buf = new Array(len*2);\n\n    for (out=0, i=0; i<len;) {\n        c = buf[i++];\n        // quick process ascii\n        if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n        c_len = _utf8len[c];\n        // skip 5 & 6 byte codes\n        if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; }\n\n        // apply mask on first byte\n        c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n        // join the rest\n        while (c_len > 1 && i < len) {\n            c = (c << 6) | (buf[i++] & 0x3f);\n            c_len--;\n        }\n\n        // terminated by end of string?\n        if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n        if (c < 0x10000) {\n            utf16buf[out++] = c;\n        } else {\n            c -= 0x10000;\n            utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n            utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n        }\n    }\n\n    // shrinkBuf(utf16buf, out)\n    if (utf16buf.length !== out) {\n        if(utf16buf.subarray) {\n            utf16buf = utf16buf.subarray(0, out);\n        } else {\n            utf16buf.length = out;\n        }\n    }\n\n    // return String.fromCharCode.apply(null, utf16buf);\n    return utils.applyFromCharCode(utf16buf);\n};\n\n\n// That's all for the pako functions.\n\n\n/**\n * Transform a javascript string into an array (typed if possible) of bytes,\n * UTF-8 encoded.\n * @param {String} str the string to encode\n * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.\n */\nexports.utf8encode = function utf8encode(str) {\n    if (support.nodebuffer) {\n        return nodeBuffer(str, \"utf-8\");\n    }\n\n    return string2buf(str);\n};\n\n\n/**\n * Transform a bytes array (or a representation) representing an UTF-8 encoded\n * string into a javascript string.\n * @param {Array|Uint8Array|Buffer} buf the data de decode\n * @return {String} the decoded string.\n */\nexports.utf8decode = function utf8decode(buf) {\n    if (support.nodebuffer) {\n        return utils.transformTo(\"nodebuffer\", buf).toString(\"utf-8\");\n    }\n\n    buf = utils.transformTo(support.uint8array ? \"uint8array\" : \"array\", buf);\n\n    // return buf2string(buf);\n    // Chrome prefers to work with \"small\" chunks of data\n    // for the method buf2string.\n    // Firefox and Chrome has their own shortcut, IE doesn't seem to really care.\n    var result = [], k = 0, len = buf.length, chunk = 65536;\n    while (k < len) {\n        var nextBoundary = utf8border(buf, Math.min(k + chunk, len));\n        if (support.uint8array) {\n            result.push(buf2string(buf.subarray(k, nextBoundary)));\n        } else {\n            result.push(buf2string(buf.slice(k, nextBoundary)));\n        }\n        k = nextBoundary;\n    }\n    return result.join(\"\");\n\n};\n// vim: set shiftwidth=4 softtabstop=4:\n\n},{\"./nodeBuffer\":23,\"./support\":29,\"./utils\":33}],33:[function(require,module,exports){\n'use strict';\nvar support = require('./support');\nvar compressions = require('./compressions');\nvar nodeBuffer = require('./nodeBuffer');\n/**\n * Convert a string to a \"binary string\" : a string containing only char codes between 0 and 255.\n * @param {string} str the string to transform.\n * @return {String} the binary string.\n */\nexports.string2binary = function(str) {\n    var result = \"\";\n    for (var i = 0; i < str.length; i++) {\n        result += String.fromCharCode(str.charCodeAt(i) & 0xff);\n    }\n    return result;\n};\nexports.arrayBuffer2Blob = function(buffer, mimeType) {\n    exports.checkSupport(\"blob\");\n	mimeType = mimeType || 'application/zip';\n\n    try {\n        // Blob constructor\n        return new Blob([buffer], {\n            type: mimeType\n        });\n    }\n    catch (e) {\n\n        try {\n            // deprecated, browser only, old way\n            var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\n            var builder = new Builder();\n            builder.append(buffer);\n            return builder.getBlob(mimeType);\n        }\n        catch (e) {\n\n            // well, fuck ?!\n            throw new Error(\"Bug : can't construct the Blob.\");\n        }\n    }\n\n\n};\n/**\n * The identity function.\n * @param {Object} input the input.\n * @return {Object} the same input.\n */\nfunction identity(input) {\n    return input;\n}\n\n/**\n * Fill in an array with a string.\n * @param {String} str the string to use.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated).\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.\n */\nfunction stringToArrayLike(str, array) {\n    for (var i = 0; i < str.length; ++i) {\n        array[i] = str.charCodeAt(i) & 0xFF;\n    }\n    return array;\n}\n\n/**\n * Transform an array-like object to a string.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.\n * @return {String} the result.\n */\nfunction arrayLikeToString(array) {\n    // Performances notes :\n    // --------------------\n    // String.fromCharCode.apply(null, array) is the fastest, see\n    // see http://jsperf.com/converting-a-uint8array-to-a-string/2\n    // but the stack is limited (and we can get huge arrays !).\n    //\n    // result += String.fromCharCode(array[i]); generate too many strings !\n    //\n    // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2\n    var chunk = 65536;\n    var result = [],\n        len = array.length,\n        type = exports.getTypeOf(array),\n        k = 0,\n        canUseApply = true;\n      try {\n         switch(type) {\n            case \"uint8array\":\n               String.fromCharCode.apply(null, new Uint8Array(0));\n               break;\n            case \"nodebuffer\":\n               String.fromCharCode.apply(null, nodeBuffer(0));\n               break;\n         }\n      } catch(e) {\n         canUseApply = false;\n      }\n\n      // no apply : slow and painful algorithm\n      // default browser on android 4.*\n      if (!canUseApply) {\n         var resultStr = \"\";\n         for(var i = 0; i < array.length;i++) {\n            resultStr += String.fromCharCode(array[i]);\n         }\n    return resultStr;\n    }\n    while (k < len && chunk > 1) {\n        try {\n            if (type === \"array\" || type === \"nodebuffer\") {\n                result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len))));\n            }\n            else {\n                result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len))));\n            }\n            k += chunk;\n        }\n        catch (e) {\n            chunk = Math.floor(chunk / 2);\n        }\n    }\n    return result.join(\"\");\n}\n\nexports.applyFromCharCode = arrayLikeToString;\n\n\n/**\n * Copy the data from an array-like to an other array-like.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated.\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.\n */\nfunction arrayLikeToArrayLike(arrayFrom, arrayTo) {\n    for (var i = 0; i < arrayFrom.length; i++) {\n        arrayTo[i] = arrayFrom[i];\n    }\n    return arrayTo;\n}\n\n// a matrix containing functions to transform everything into everything.\nvar transform = {};\n\n// string to ?\ntransform[\"string\"] = {\n    \"string\": identity,\n    \"array\": function(input) {\n        return stringToArrayLike(input, new Array(input.length));\n    },\n    \"arraybuffer\": function(input) {\n        return transform[\"string\"][\"uint8array\"](input).buffer;\n    },\n    \"uint8array\": function(input) {\n        return stringToArrayLike(input, new Uint8Array(input.length));\n    },\n    \"nodebuffer\": function(input) {\n        return stringToArrayLike(input, nodeBuffer(input.length));\n    }\n};\n\n// array to ?\ntransform[\"array\"] = {\n    \"string\": arrayLikeToString,\n    \"array\": identity,\n    \"arraybuffer\": function(input) {\n        return (new Uint8Array(input)).buffer;\n    },\n    \"uint8array\": function(input) {\n        return new Uint8Array(input);\n    },\n    \"nodebuffer\": function(input) {\n        return nodeBuffer(input);\n    }\n};\n\n// arraybuffer to ?\ntransform[\"arraybuffer\"] = {\n    \"string\": function(input) {\n        return arrayLikeToString(new Uint8Array(input));\n    },\n    \"array\": function(input) {\n        return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));\n    },\n    \"arraybuffer\": identity,\n    \"uint8array\": function(input) {\n        return new Uint8Array(input);\n    },\n    \"nodebuffer\": function(input) {\n        return nodeBuffer(new Uint8Array(input));\n    }\n};\n\n// uint8array to ?\ntransform[\"uint8array\"] = {\n    \"string\": arrayLikeToString,\n    \"array\": function(input) {\n        return arrayLikeToArrayLike(input, new Array(input.length));\n    },\n    \"arraybuffer\": function(input) {\n        return input.buffer;\n    },\n    \"uint8array\": identity,\n    \"nodebuffer\": function(input) {\n        return nodeBuffer(input);\n    }\n};\n\n// nodebuffer to ?\ntransform[\"nodebuffer\"] = {\n    \"string\": arrayLikeToString,\n    \"array\": function(input) {\n        return arrayLikeToArrayLike(input, new Array(input.length));\n    },\n    \"arraybuffer\": function(input) {\n        return transform[\"nodebuffer\"][\"uint8array\"](input).buffer;\n    },\n    \"uint8array\": function(input) {\n        return arrayLikeToArrayLike(input, new Uint8Array(input.length));\n    },\n    \"nodebuffer\": identity\n};\n\n/**\n * Transform an input into any type.\n * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer.\n * If no output type is specified, the unmodified input will be returned.\n * @param {String} outputType the output type.\n * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.\n * @throws {Error} an Error if the browser doesn't support the requested output type.\n */\nexports.transformTo = function(outputType, input) {\n    if (!input) {\n        // undefined, null, etc\n        // an empty string won't harm.\n        input = \"\";\n    }\n    if (!outputType) {\n        return input;\n    }\n    exports.checkSupport(outputType);\n    var inputType = exports.getTypeOf(input);\n    var result = transform[inputType][outputType](input);\n    return result;\n};\n\n/**\n * Return the type of the input.\n * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.\n * @param {Object} input the input to identify.\n * @return {String} the (lowercase) type of the input.\n */\nexports.getTypeOf = function(input) {\n    if (typeof input === \"string\") {\n        return \"string\";\n    }\n    if (Object.prototype.toString.call(input) === \"[object Array]\") {\n        return \"array\";\n    }\n    if (support.nodebuffer && nodeBuffer.test(input)) {\n        return \"nodebuffer\";\n    }\n    if (support.uint8array && input instanceof Uint8Array) {\n        return \"uint8array\";\n    }\n    if (support.arraybuffer && input instanceof ArrayBuffer) {\n        return \"arraybuffer\";\n    }\n};\n\n/**\n * Throw an exception if the type is not supported.\n * @param {String} type the type to check.\n * @throws {Error} an Error if the browser doesn't support the requested type.\n */\nexports.checkSupport = function(type) {\n    var supported = support[type.toLowerCase()];\n    if (!supported) {\n        throw new Error(type + \" is not supported by this browser\");\n    }\n};\nexports.MAX_VALUE_16BITS = 65535;\nexports.MAX_VALUE_32BITS = -1; // well, \"\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\" is parsed as -1\n\n/**\n * Prettify a string read as binary.\n * @param {string} str the string to prettify.\n * @return {string} a pretty string.\n */\nexports.pretty = function(str) {\n    var res = '',\n        code, i;\n    for (i = 0; i < (str || \"\").length; i++) {\n        code = str.charCodeAt(i);\n        res += '\\\\x' + (code < 16 ? \"0\" : \"\") + code.toString(16).toUpperCase();\n    }\n    return res;\n};\n\n/**\n * Find a compression registered in JSZip.\n * @param {string} compressionMethod the method magic to find.\n * @return {Object|null} the JSZip compression object, null if none found.\n */\nexports.findCompression = function(compressionMethod) {\n    for (var method in compressions) {\n        if (!compressions.hasOwnProperty(method)) {\n            continue;\n        }\n        if (compressions[method].magic === compressionMethod) {\n            return compressions[method];\n        }\n    }\n    return null;\n};\n/**\n* Cross-window, cross-Node-context regular expression detection\n* @param  {Object}  object Anything\n* @return {Boolean}        true if the object is a regular expression,\n* false otherwise\n*/\nexports.isRegExp = function (object) {\n    return Object.prototype.toString.call(object) === \"[object RegExp]\";\n};\n\n/**\n * Merge the objects passed as parameters into a new one.\n * @private\n * @param {...Object} var_args All objects to merge.\n * @return {Object} a new object with the data of the others.\n */\nexports.extend = function() {\n    var result = {}, i, attr;\n    for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers\n        for (attr in arguments[i]) {\n            if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === \"undefined\") {\n                result[attr] = arguments[i][attr];\n            }\n        }\n    }\n    return result;\n};\n\n\n},{\"./compressions\":15,\"./nodeBuffer\":23,\"./support\":29}],34:[function(require,module,exports){\n'use strict';\nvar StringReader = require('./stringReader');\nvar NodeBufferReader = require('./nodeBufferReader');\nvar Uint8ArrayReader = require('./uint8ArrayReader');\nvar ArrayReader = require('./arrayReader');\nvar utils = require('./utils');\nvar sig = require('./signature');\nvar ZipEntry = require('./zipEntry');\nvar support = require('./support');\nvar jszipProto = require('./object');\n//  class ZipEntries {{{\n/**\n * All the entries in the zip file.\n * @constructor\n * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load.\n * @param {Object} loadOptions Options for loading the stream.\n */\nfunction ZipEntries(data, loadOptions) {\n    this.files = [];\n    this.loadOptions = loadOptions;\n    if (data) {\n        this.load(data);\n    }\n}\nZipEntries.prototype = {\n    /**\n     * Check that the reader is on the speficied signature.\n     * @param {string} expectedSignature the expected signature.\n     * @throws {Error} if it is an other signature.\n     */\n    checkSignature: function(expectedSignature) {\n        var signature = this.reader.readString(4);\n        if (signature !== expectedSignature) {\n            throw new Error(\"Corrupted zip or bug : unexpected signature \" + \"(\" + utils.pretty(signature) + \", expected \" + utils.pretty(expectedSignature) + \")\");\n        }\n    },\n    /**\n     * Check if the given signature is at the given index.\n     * @param {number} askedIndex the index to check.\n     * @param {string} expectedSignature the signature to expect.\n     * @return {boolean} true if the signature is here, false otherwise.\n     */\n    isSignature: function(askedIndex, expectedSignature) {\n        var currentIndex = this.reader.index;\n        this.reader.setIndex(askedIndex);\n        var signature = this.reader.readString(4);\n        var result = signature === expectedSignature;\n        this.reader.setIndex(currentIndex);\n        return result;\n    },\n    /**\n     * Read the end of the central directory.\n     */\n    readBlockEndOfCentral: function() {\n        this.diskNumber = this.reader.readInt(2);\n        this.diskWithCentralDirStart = this.reader.readInt(2);\n        this.centralDirRecordsOnThisDisk = this.reader.readInt(2);\n        this.centralDirRecords = this.reader.readInt(2);\n        this.centralDirSize = this.reader.readInt(4);\n        this.centralDirOffset = this.reader.readInt(4);\n\n        this.zipCommentLength = this.reader.readInt(2);\n        // warning : the encoding depends of the system locale\n        // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded.\n        // On a windows machine, this field is encoded with the localized windows code page.\n        var zipComment = this.reader.readData(this.zipCommentLength);\n        var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\n        // To get consistent behavior with the generation part, we will assume that\n        // this is utf8 encoded unless specified otherwise.\n        var decodeContent = utils.transformTo(decodeParamType, zipComment);\n        this.zipComment = this.loadOptions.decodeFileName(decodeContent);\n    },\n    /**\n     * Read the end of the Zip 64 central directory.\n     * Not merged with the method readEndOfCentral :\n     * The end of central can coexist with its Zip64 brother,\n     * I don't want to read the wrong number of bytes !\n     */\n    readBlockZip64EndOfCentral: function() {\n        this.zip64EndOfCentralSize = this.reader.readInt(8);\n        this.versionMadeBy = this.reader.readString(2);\n        this.versionNeeded = this.reader.readInt(2);\n        this.diskNumber = this.reader.readInt(4);\n        this.diskWithCentralDirStart = this.reader.readInt(4);\n        this.centralDirRecordsOnThisDisk = this.reader.readInt(8);\n        this.centralDirRecords = this.reader.readInt(8);\n        this.centralDirSize = this.reader.readInt(8);\n        this.centralDirOffset = this.reader.readInt(8);\n\n        this.zip64ExtensibleData = {};\n        var extraDataSize = this.zip64EndOfCentralSize - 44,\n            index = 0,\n            extraFieldId,\n            extraFieldLength,\n            extraFieldValue;\n        while (index < extraDataSize) {\n            extraFieldId = this.reader.readInt(2);\n            extraFieldLength = this.reader.readInt(4);\n            extraFieldValue = this.reader.readString(extraFieldLength);\n            this.zip64ExtensibleData[extraFieldId] = {\n                id: extraFieldId,\n                length: extraFieldLength,\n                value: extraFieldValue\n            };\n        }\n    },\n    /**\n     * Read the end of the Zip 64 central directory locator.\n     */\n    readBlockZip64EndOfCentralLocator: function() {\n        this.diskWithZip64CentralDirStart = this.reader.readInt(4);\n        this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8);\n        this.disksCount = this.reader.readInt(4);\n        if (this.disksCount > 1) {\n            throw new Error(\"Multi-volumes zip are not supported\");\n        }\n    },\n    /**\n     * Read the local files, based on the offset read in the central part.\n     */\n    readLocalFiles: function() {\n        var i, file;\n        for (i = 0; i < this.files.length; i++) {\n            file = this.files[i];\n            this.reader.setIndex(file.localHeaderOffset);\n            this.checkSignature(sig.LOCAL_FILE_HEADER);\n            file.readLocalPart(this.reader);\n            file.handleUTF8();\n            file.processAttributes();\n        }\n    },\n    /**\n     * Read the central directory.\n     */\n    readCentralDir: function() {\n        var file;\n\n        this.reader.setIndex(this.centralDirOffset);\n        while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) {\n            file = new ZipEntry({\n                zip64: this.zip64\n            }, this.loadOptions);\n            file.readCentralPart(this.reader);\n            this.files.push(file);\n        }\n\n        if (this.centralDirRecords !== this.files.length) {\n            if (this.centralDirRecords !== 0 && this.files.length === 0) {\n                // We expected some records but couldn't find ANY.\n                // This is really suspicious, as if something went wrong.\n                throw new Error(\"Corrupted zip or bug: expected \" + this.centralDirRecords + \" records in central dir, got \" + this.files.length);\n            } else {\n                // We found some records but not all.\n                // Something is wrong but we got something for the user: no error here.\n                // console.warn(\"expected\", this.centralDirRecords, \"records in central dir, got\", this.files.length);\n            }\n        }\n    },\n    /**\n     * Read the end of central directory.\n     */\n    readEndOfCentral: function() {\n        var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);\n        if (offset < 0) {\n            // Check if the content is a truncated zip or complete garbage.\n            // A \"LOCAL_FILE_HEADER\" is not required at the beginning (auto\n            // extractible zip for example) but it can give a good hint.\n            // If an ajax request was used without responseType, we will also\n            // get unreadable data.\n            var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);\n\n            if (isGarbage) {\n                throw new Error(\"Can't find end of central directory : is this a zip file ? \" +\n                                \"If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html\");\n            } else {\n                throw new Error(\"Corrupted zip : can't find end of central directory\");\n            }\n        }\n        this.reader.setIndex(offset);\n        var endOfCentralDirOffset = offset;\n        this.checkSignature(sig.CENTRAL_DIRECTORY_END);\n        this.readBlockEndOfCentral();\n\n\n        /* extract from the zip spec :\n            4)  If one of the fields in the end of central directory\n                record is too small to hold required data, the field\n                should be set to -1 (0xFFFF or 0xFFFFFFFF) and the\n                ZIP64 format record should be created.\n            5)  The end of central directory record and the\n                Zip64 end of central directory locator record must\n                reside on the same disk when splitting or spanning\n                an archive.\n         */\n        if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {\n            this.zip64 = true;\n\n            /*\n            Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from\n            the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents\n            all numbers as 64-bit double precision IEEE 754 floating point numbers.\n            So, we have 53bits for integers and bitwise operations treat everything as 32bits.\n            see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators\n            and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5\n            */\n\n            // should look for a zip64 EOCD locator\n            offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\n            if (offset < 0) {\n                throw new Error(\"Corrupted zip : can't find the ZIP64 end of central directory locator\");\n            }\n            this.reader.setIndex(offset);\n            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\n            this.readBlockZip64EndOfCentralLocator();\n\n            // now the zip64 EOCD record\n            if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) {\n                // console.warn(\"ZIP64 end of central directory not where expected.\");\n                this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\n                if (this.relativeOffsetEndOfZip64CentralDir < 0) {\n                    throw new Error(\"Corrupted zip : can't find the ZIP64 end of central directory\");\n                }\n            }\n            this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);\n            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\n            this.readBlockZip64EndOfCentral();\n        }\n\n        var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;\n        if (this.zip64) {\n            expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator\n            expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize;\n        }\n\n        var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;\n\n        if (extraBytes > 0) {\n            // console.warn(extraBytes, \"extra bytes at beginning or within zipfile\");\n            if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) {\n                // The offsets seem wrong, but we have something at the specified offset.\n                // So… we keep it.\n            } else {\n                // the offset is wrong, update the \"zero\" of the reader\n                // this happens if data has been prepended (crx files for example)\n                this.reader.zero = extraBytes;\n            }\n        } else if (extraBytes < 0) {\n            throw new Error(\"Corrupted zip: missing \" + Math.abs(extraBytes) + \" bytes.\");\n        }\n    },\n    prepareReader: function(data) {\n        var type = utils.getTypeOf(data);\n        utils.checkSupport(type);\n        if (type === \"string\" && !support.uint8array) {\n            this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString);\n        }\n        else if (type === \"nodebuffer\") {\n            this.reader = new NodeBufferReader(data);\n        }\n        else if (support.uint8array) {\n            this.reader = new Uint8ArrayReader(utils.transformTo(\"uint8array\", data));\n        } else if (support.array) {\n            this.reader = new ArrayReader(utils.transformTo(\"array\", data));\n        } else {\n            throw new Error(\"Unexpected error: unsupported type '\" + type + \"'\");\n        }\n    },\n    /**\n     * Read a zip file and create ZipEntries.\n     * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.\n     */\n    load: function(data) {\n        this.prepareReader(data);\n        this.readEndOfCentral();\n        this.readCentralDir();\n        this.readLocalFiles();\n    }\n};\n// }}} end of ZipEntries\nmodule.exports = ZipEntries;\n\n},{\"./arrayReader\":12,\"./nodeBufferReader\":24,\"./object\":25,\"./signature\":26,\"./stringReader\":27,\"./support\":29,\"./uint8ArrayReader\":30,\"./utils\":33,\"./zipEntry\":35}],35:[function(require,module,exports){\n'use strict';\nvar StringReader = require('./stringReader');\nvar utils = require('./utils');\nvar CompressedObject = require('./compressedObject');\nvar jszipProto = require('./object');\nvar support = require('./support');\n\nvar MADE_BY_DOS = 0x00;\nvar MADE_BY_UNIX = 0x03;\n\n// class ZipEntry {{{\n/**\n * An entry in the zip file.\n * @constructor\n * @param {Object} options Options of the current file.\n * @param {Object} loadOptions Options for loading the stream.\n */\nfunction ZipEntry(options, loadOptions) {\n    this.options = options;\n    this.loadOptions = loadOptions;\n}\nZipEntry.prototype = {\n    /**\n     * say if the file is encrypted.\n     * @return {boolean} true if the file is encrypted, false otherwise.\n     */\n    isEncrypted: function() {\n        // bit 1 is set\n        return (this.bitFlag & 0x0001) === 0x0001;\n    },\n    /**\n     * say if the file has utf-8 filename/comment.\n     * @return {boolean} true if the filename/comment is in utf-8, false otherwise.\n     */\n    useUTF8: function() {\n        // bit 11 is set\n        return (this.bitFlag & 0x0800) === 0x0800;\n    },\n    /**\n     * Prepare the function used to generate the compressed content from this ZipFile.\n     * @param {DataReader} reader the reader to use.\n     * @param {number} from the offset from where we should read the data.\n     * @param {number} length the length of the data to read.\n     * @return {Function} the callback to get the compressed content (the type depends of the DataReader class).\n     */\n    prepareCompressedContent: function(reader, from, length) {\n        return function() {\n            var previousIndex = reader.index;\n            reader.setIndex(from);\n            var compressedFileData = reader.readData(length);\n            reader.setIndex(previousIndex);\n\n            return compressedFileData;\n        };\n    },\n    /**\n     * Prepare the function used to generate the uncompressed content from this ZipFile.\n     * @param {DataReader} reader the reader to use.\n     * @param {number} from the offset from where we should read the data.\n     * @param {number} length the length of the data to read.\n     * @param {JSZip.compression} compression the compression used on this file.\n     * @param {number} uncompressedSize the uncompressed size to expect.\n     * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class).\n     */\n    prepareContent: function(reader, from, length, compression, uncompressedSize) {\n        return function() {\n\n            var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent());\n            var uncompressedFileData = compression.uncompress(compressedFileData);\n\n            if (uncompressedFileData.length !== uncompressedSize) {\n                throw new Error(\"Bug : uncompressed data size mismatch\");\n            }\n\n            return uncompressedFileData;\n        };\n    },\n    /**\n     * Read the local part of a zip file and add the info in this object.\n     * @param {DataReader} reader the reader to use.\n     */\n    readLocalPart: function(reader) {\n        var compression, localExtraFieldsLength;\n\n        // we already know everything from the central dir !\n        // If the central dir data are false, we are doomed.\n        // On the bright side, the local part is scary  : zip64, data descriptors, both, etc.\n        // The less data we get here, the more reliable this should be.\n        // Let's skip the whole header and dash to the data !\n        reader.skip(22);\n        // in some zip created on windows, the filename stored in the central dir contains \\ instead of /.\n        // Strangely, the filename here is OK.\n        // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes\n        // or APPNOTE#4.4.17.1, \"All slashes MUST be forward slashes '/'\") but there are a lot of bad zip generators...\n        // Search \"unzip mismatching \"local\" filename continuing with \"central\" filename version\" on\n        // the internet.\n        //\n        // I think I see the logic here : the central directory is used to display\n        // content and the local directory is used to extract the files. Mixing / and \\\n        // may be used to display \\ to windows users and use / when extracting the files.\n        // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394\n        this.fileNameLength = reader.readInt(2);\n        localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir\n        this.fileName = reader.readData(this.fileNameLength);\n        reader.skip(localExtraFieldsLength);\n\n        if (this.compressedSize == -1 || this.uncompressedSize == -1) {\n            throw new Error(\"Bug or corrupted zip : didn't get enough informations from the central directory \" + \"(compressedSize == -1 || uncompressedSize == -1)\");\n        }\n\n        compression = utils.findCompression(this.compressionMethod);\n        if (compression === null) { // no compression found\n            throw new Error(\"Corrupted zip : compression \" + utils.pretty(this.compressionMethod) + \" unknown (inner file : \" +  utils.transformTo(\"string\", this.fileName) + \")\");\n        }\n        this.decompressed = new CompressedObject();\n        this.decompressed.compressedSize = this.compressedSize;\n        this.decompressed.uncompressedSize = this.uncompressedSize;\n        this.decompressed.crc32 = this.crc32;\n        this.decompressed.compressionMethod = this.compressionMethod;\n        this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression);\n        this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize);\n\n        // we need to compute the crc32...\n        if (this.loadOptions.checkCRC32) {\n            this.decompressed = utils.transformTo(\"string\", this.decompressed.getContent());\n            if (jszipProto.crc32(this.decompressed) !== this.crc32) {\n                throw new Error(\"Corrupted zip : CRC32 mismatch\");\n            }\n        }\n    },\n\n    /**\n     * Read the central part of a zip file and add the info in this object.\n     * @param {DataReader} reader the reader to use.\n     */\n    readCentralPart: function(reader) {\n        this.versionMadeBy = reader.readInt(2);\n        this.versionNeeded = reader.readInt(2);\n        this.bitFlag = reader.readInt(2);\n        this.compressionMethod = reader.readString(2);\n        this.date = reader.readDate();\n        this.crc32 = reader.readInt(4);\n        this.compressedSize = reader.readInt(4);\n        this.uncompressedSize = reader.readInt(4);\n        this.fileNameLength = reader.readInt(2);\n        this.extraFieldsLength = reader.readInt(2);\n        this.fileCommentLength = reader.readInt(2);\n        this.diskNumberStart = reader.readInt(2);\n        this.internalFileAttributes = reader.readInt(2);\n        this.externalFileAttributes = reader.readInt(4);\n        this.localHeaderOffset = reader.readInt(4);\n\n        if (this.isEncrypted()) {\n            throw new Error(\"Encrypted zip are not supported\");\n        }\n\n        this.fileName = reader.readData(this.fileNameLength);\n        this.readExtraFields(reader);\n        this.parseZIP64ExtraField(reader);\n        this.fileComment = reader.readData(this.fileCommentLength);\n    },\n\n    /**\n     * Parse the external file attributes and get the unix/dos permissions.\n     */\n    processAttributes: function () {\n        this.unixPermissions = null;\n        this.dosPermissions = null;\n        var madeBy = this.versionMadeBy >> 8;\n\n        // Check if we have the DOS directory flag set.\n        // We look for it in the DOS and UNIX permissions\n        // but some unknown platform could set it as a compatibility flag.\n        this.dir = this.externalFileAttributes & 0x0010 ? true : false;\n\n        if(madeBy === MADE_BY_DOS) {\n            // first 6 bits (0 to 5)\n            this.dosPermissions = this.externalFileAttributes & 0x3F;\n        }\n\n        if(madeBy === MADE_BY_UNIX) {\n            this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF;\n            // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);\n        }\n\n        // fail safe : if the name ends with a / it probably means a folder\n        if (!this.dir && this.fileNameStr.slice(-1) === '/') {\n            this.dir = true;\n        }\n    },\n\n    /**\n     * Parse the ZIP64 extra field and merge the info in the current ZipEntry.\n     * @param {DataReader} reader the reader to use.\n     */\n    parseZIP64ExtraField: function(reader) {\n\n        if (!this.extraFields[0x0001]) {\n            return;\n        }\n\n        // should be something, preparing the extra reader\n        var extraReader = new StringReader(this.extraFields[0x0001].value);\n\n        // I really hope that these 64bits integer can fit in 32 bits integer, because js\n        // won't let us have more.\n        if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {\n            this.uncompressedSize = extraReader.readInt(8);\n        }\n        if (this.compressedSize === utils.MAX_VALUE_32BITS) {\n            this.compressedSize = extraReader.readInt(8);\n        }\n        if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {\n            this.localHeaderOffset = extraReader.readInt(8);\n        }\n        if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {\n            this.diskNumberStart = extraReader.readInt(4);\n        }\n    },\n    /**\n     * Read the central part of a zip file and add the info in this object.\n     * @param {DataReader} reader the reader to use.\n     */\n    readExtraFields: function(reader) {\n        var start = reader.index,\n            extraFieldId,\n            extraFieldLength,\n            extraFieldValue;\n\n        this.extraFields = this.extraFields || {};\n\n        while (reader.index < start + this.extraFieldsLength) {\n            extraFieldId = reader.readInt(2);\n            extraFieldLength = reader.readInt(2);\n            extraFieldValue = reader.readString(extraFieldLength);\n\n            this.extraFields[extraFieldId] = {\n                id: extraFieldId,\n                length: extraFieldLength,\n                value: extraFieldValue\n            };\n        }\n    },\n    /**\n     * Apply an UTF8 transformation if needed.\n     */\n    handleUTF8: function() {\n        var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\n        if (this.useUTF8()) {\n            this.fileNameStr = jszipProto.utf8decode(this.fileName);\n            this.fileCommentStr = jszipProto.utf8decode(this.fileComment);\n        } else {\n            var upath = this.findExtraFieldUnicodePath();\n            if (upath !== null) {\n                this.fileNameStr = upath;\n            } else {\n                var fileNameByteArray =  utils.transformTo(decodeParamType, this.fileName);\n                this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray);\n            }\n\n            var ucomment = this.findExtraFieldUnicodeComment();\n            if (ucomment !== null) {\n                this.fileCommentStr = ucomment;\n            } else {\n                var commentByteArray =  utils.transformTo(decodeParamType, this.fileComment);\n                this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray);\n            }\n        }\n    },\n\n    /**\n     * Find the unicode path declared in the extra field, if any.\n     * @return {String} the unicode path, null otherwise.\n     */\n    findExtraFieldUnicodePath: function() {\n        var upathField = this.extraFields[0x7075];\n        if (upathField) {\n            var extraReader = new StringReader(upathField.value);\n\n            // wrong version\n            if (extraReader.readInt(1) !== 1) {\n                return null;\n            }\n\n            // the crc of the filename changed, this field is out of date.\n            if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) {\n                return null;\n            }\n\n            return jszipProto.utf8decode(extraReader.readString(upathField.length - 5));\n        }\n        return null;\n    },\n\n    /**\n     * Find the unicode comment declared in the extra field, if any.\n     * @return {String} the unicode comment, null otherwise.\n     */\n    findExtraFieldUnicodeComment: function() {\n        var ucommentField = this.extraFields[0x6375];\n        if (ucommentField) {\n            var extraReader = new StringReader(ucommentField.value);\n\n            // wrong version\n            if (extraReader.readInt(1) !== 1) {\n                return null;\n            }\n\n            // the crc of the comment changed, this field is out of date.\n            if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) {\n                return null;\n            }\n\n            return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5));\n        }\n        return null;\n    }\n};\nmodule.exports = ZipEntry;\n\n},{\"./compressedObject\":14,\"./object\":25,\"./stringReader\":27,\"./support\":29,\"./utils\":33}],36:[function(require,module,exports){\n// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign    = require('./lib/utils/common').assign;\n\nvar deflate   = require('./lib/deflate');\nvar inflate   = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n\n},{\"./lib/deflate\":37,\"./lib/inflate\":38,\"./lib/utils/common\":39,\"./lib/zlib/constants\":42}],37:[function(require,module,exports){\n'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils        = require('./utils/common');\nvar strings      = require('./utils/strings');\nvar msg          = require('./zlib/messages');\nvar ZStream      = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH      = 0;\nvar Z_FINISH        = 4;\n\nvar Z_OK            = 0;\nvar Z_STREAM_END    = 1;\nvar Z_SYNC_FLUSH    = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY    = 0;\n\nvar Z_DEFLATED  = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overriden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param)  or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n *    (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n *   - `text` (Boolean) - true if compressed data believed to be text\n *   - `time` (Number) - modification time, unix timestamp\n *   - `os` (Number) - operation system code\n *   - `extra` (Array) - array of bytes with extra data (max 65536)\n *   - `name` (String) - file name (binary string)\n *   - `comment` (String) - comment (binary string)\n *   - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true);  // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n  if (!(this instanceof Deflate)) return new Deflate(options);\n\n  this.options = utils.assign({\n    level: Z_DEFAULT_COMPRESSION,\n    method: Z_DEFLATED,\n    chunkSize: 16384,\n    windowBits: 15,\n    memLevel: 8,\n    strategy: Z_DEFAULT_STRATEGY,\n    to: ''\n  }, options || {});\n\n  var opt = this.options;\n\n  if (opt.raw && (opt.windowBits > 0)) {\n    opt.windowBits = -opt.windowBits;\n  }\n\n  else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n    opt.windowBits += 16;\n  }\n\n  this.err    = 0;      // error code, if happens (0 = Z_OK)\n  this.msg    = '';     // error message\n  this.ended  = false;  // used to avoid multiple onEnd() calls\n  this.chunks = [];     // chunks of compressed data\n\n  this.strm = new ZStream();\n  this.strm.avail_out = 0;\n\n  var status = zlib_deflate.deflateInit2(\n    this.strm,\n    opt.level,\n    opt.method,\n    opt.windowBits,\n    opt.memLevel,\n    opt.strategy\n  );\n\n  if (status !== Z_OK) {\n    throw new Error(msg[status]);\n  }\n\n  if (opt.header) {\n    zlib_deflate.deflateSetHeader(this.strm, opt.header);\n  }\n\n  if (opt.dictionary) {\n    var dict;\n    // Convert data if needed\n    if (typeof opt.dictionary === 'string') {\n      // If we need to compress text, change encoding to utf8.\n      dict = strings.string2buf(opt.dictionary);\n    } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n      dict = new Uint8Array(opt.dictionary);\n    } else {\n      dict = opt.dictionary;\n    }\n\n    status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n    if (status !== Z_OK) {\n      throw new Error(msg[status]);\n    }\n\n    this._dict_set = true;\n  }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n *   converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true);  // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n  var strm = this.strm;\n  var chunkSize = this.options.chunkSize;\n  var status, _mode;\n\n  if (this.ended) { return false; }\n\n  _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n  // Convert data if needed\n  if (typeof data === 'string') {\n    // If we need to compress text, change encoding to utf8.\n    strm.input = strings.string2buf(data);\n  } else if (toString.call(data) === '[object ArrayBuffer]') {\n    strm.input = new Uint8Array(data);\n  } else {\n    strm.input = data;\n  }\n\n  strm.next_in = 0;\n  strm.avail_in = strm.input.length;\n\n  do {\n    if (strm.avail_out === 0) {\n      strm.output = new utils.Buf8(chunkSize);\n      strm.next_out = 0;\n      strm.avail_out = chunkSize;\n    }\n    status = zlib_deflate.deflate(strm, _mode);    /* no bad return value */\n\n    if (status !== Z_STREAM_END && status !== Z_OK) {\n      this.onEnd(status);\n      this.ended = true;\n      return false;\n    }\n    if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n      if (this.options.to === 'string') {\n        this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n      } else {\n        this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n      }\n    }\n  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n  // Finalize on the last chunk.\n  if (_mode === Z_FINISH) {\n    status = zlib_deflate.deflateEnd(this.strm);\n    this.onEnd(status);\n    this.ended = true;\n    return status === Z_OK;\n  }\n\n  // callback interim results if Z_SYNC_FLUSH.\n  if (_mode === Z_SYNC_FLUSH) {\n    this.onEnd(Z_OK);\n    strm.avail_out = 0;\n    return true;\n  }\n\n  return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): ouput data. Type of array depends\n *   on js engine support. When string output requested, each chunk\n *   will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n  this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n *   other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n  // On success - join\n  if (status === Z_OK) {\n    if (this.options.to === 'string') {\n      this.result = this.chunks.join('');\n    } else {\n      this.result = utils.flattenChunks(this.chunks);\n    }\n  }\n  this.chunks = [];\n  this.err = status;\n  this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n *   negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n *    (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n *   , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n  var deflator = new Deflate(options);\n\n  deflator.push(input, true);\n\n  // That will never happens, if you don't cheat with options :)\n  if (deflator.err) { throw deflator.msg; }\n\n  return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n  options = options || {};\n  options.raw = true;\n  return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n  options = options || {};\n  options.gzip = true;\n  return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n\n},{\"./utils/common\":39,\"./utils/strings\":40,\"./zlib/deflate\":44,\"./zlib/messages\":49,\"./zlib/zstream\":51}],38:[function(require,module,exports){\n'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils        = require('./utils/common');\nvar strings      = require('./utils/strings');\nvar c            = require('./zlib/constants');\nvar msg          = require('./zlib/messages');\nvar ZStream      = require('./zlib/zstream');\nvar GZheader     = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overriden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n *   from utf8 to utf16 (javascript) string. When string output requested,\n *   chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true);  // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n  if (!(this instanceof Inflate)) return new Inflate(options);\n\n  this.options = utils.assign({\n    chunkSize: 16384,\n    windowBits: 0,\n    to: ''\n  }, options || {});\n\n  var opt = this.options;\n\n  // Force window size for `raw` data, if not set directly,\n  // because we have no header for autodetect.\n  if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n    opt.windowBits = -opt.windowBits;\n    if (opt.windowBits === 0) { opt.windowBits = -15; }\n  }\n\n  // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n  if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n      !(options && options.windowBits)) {\n    opt.windowBits += 32;\n  }\n\n  // Gzip header has no info about windows size, we can do autodetect only\n  // for deflate. So, if window size not set, force it to max when gzip possible\n  if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n    // bit 3 (16) -> gzipped data\n    // bit 4 (32) -> autodetect gzip/deflate\n    if ((opt.windowBits & 15) === 0) {\n      opt.windowBits |= 15;\n    }\n  }\n\n  this.err    = 0;      // error code, if happens (0 = Z_OK)\n  this.msg    = '';     // error message\n  this.ended  = false;  // used to avoid multiple onEnd() calls\n  this.chunks = [];     // chunks of compressed data\n\n  this.strm   = new ZStream();\n  this.strm.avail_out = 0;\n\n  var status  = zlib_inflate.inflateInit2(\n    this.strm,\n    opt.windowBits\n  );\n\n  if (status !== c.Z_OK) {\n    throw new Error(msg[status]);\n  }\n\n  this.header = new GZheader();\n\n  zlib_inflate.inflateGetHeader(this.strm, this.header);\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true);  // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n  var strm = this.strm;\n  var chunkSize = this.options.chunkSize;\n  var dictionary = this.options.dictionary;\n  var status, _mode;\n  var next_out_utf8, tail, utf8str;\n  var dict;\n\n  // Flag to properly process Z_BUF_ERROR on testing inflate call\n  // when we check that all output data was flushed.\n  var allowBufError = false;\n\n  if (this.ended) { return false; }\n  _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n  // Convert data if needed\n  if (typeof data === 'string') {\n    // Only binary strings can be decompressed on practice\n    strm.input = strings.binstring2buf(data);\n  } else if (toString.call(data) === '[object ArrayBuffer]') {\n    strm.input = new Uint8Array(data);\n  } else {\n    strm.input = data;\n  }\n\n  strm.next_in = 0;\n  strm.avail_in = strm.input.length;\n\n  do {\n    if (strm.avail_out === 0) {\n      strm.output = new utils.Buf8(chunkSize);\n      strm.next_out = 0;\n      strm.avail_out = chunkSize;\n    }\n\n    status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH);    /* no bad return value */\n\n    if (status === c.Z_NEED_DICT && dictionary) {\n      // Convert data if needed\n      if (typeof dictionary === 'string') {\n        dict = strings.string2buf(dictionary);\n      } else if (toString.call(dictionary) === '[object ArrayBuffer]') {\n        dict = new Uint8Array(dictionary);\n      } else {\n        dict = dictionary;\n      }\n\n      status = zlib_inflate.inflateSetDictionary(this.strm, dict);\n\n    }\n\n    if (status === c.Z_BUF_ERROR && allowBufError === true) {\n      status = c.Z_OK;\n      allowBufError = false;\n    }\n\n    if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n      this.onEnd(status);\n      this.ended = true;\n      return false;\n    }\n\n    if (strm.next_out) {\n      if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n        if (this.options.to === 'string') {\n\n          next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n          tail = strm.next_out - next_out_utf8;\n          utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n          // move tail\n          strm.next_out = tail;\n          strm.avail_out = chunkSize - tail;\n          if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n          this.onData(utf8str);\n\n        } else {\n          this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n        }\n      }\n    }\n\n    // When no more input data, we should check that internal inflate buffers\n    // are flushed. The only way to do it when avail_out = 0 - run one more\n    // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n    // Here we set flag to process this error properly.\n    //\n    // NOTE. Deflate does not return error in this case and does not needs such\n    // logic.\n    if (strm.avail_in === 0 && strm.avail_out === 0) {\n      allowBufError = true;\n    }\n\n  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n  if (status === c.Z_STREAM_END) {\n    _mode = c.Z_FINISH;\n  }\n\n  // Finalize on the last chunk.\n  if (_mode === c.Z_FINISH) {\n    status = zlib_inflate.inflateEnd(this.strm);\n    this.onEnd(status);\n    this.ended = true;\n    return status === c.Z_OK;\n  }\n\n  // callback interim results if Z_SYNC_FLUSH.\n  if (_mode === c.Z_SYNC_FLUSH) {\n    this.onEnd(c.Z_OK);\n    strm.avail_out = 0;\n    return true;\n  }\n\n  return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): ouput data. Type of array depends\n *   on js engine support. When string output requested, each chunk\n *   will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n  this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n *   other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n  // On success - join\n  if (status === c.Z_OK) {\n    if (this.options.to === 'string') {\n      // Glue & convert here, until we teach pako to send\n      // utf8 alligned strings to onData\n      this.result = this.chunks.join('');\n    } else {\n      this.result = utils.flattenChunks(this.chunks);\n    }\n  }\n  this.chunks = [];\n  this.err = status;\n  this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n *   negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n *   from utf8 to utf16 (javascript) string. When string output requested,\n *   chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n *   , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n *   , output;\n *\n * try {\n *   output = pako.inflate(input);\n * } catch (err)\n *   console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n  var inflator = new Inflate(options);\n\n  inflator.push(input, true);\n\n  // That will never happens, if you don't cheat with options :)\n  if (inflator.err) { throw inflator.msg; }\n\n  return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n  options = options || {};\n  options.raw = true;\n  return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip  = inflate;\n\n},{\"./utils/common\":39,\"./utils/strings\":40,\"./zlib/constants\":42,\"./zlib/gzheader\":45,\"./zlib/inflate\":47,\"./zlib/messages\":49,\"./zlib/zstream\":51}],39:[function(require,module,exports){\n'use strict';\n\n\nvar TYPED_OK =  (typeof Uint8Array !== 'undefined') &&\n                (typeof Uint16Array !== 'undefined') &&\n                (typeof Int32Array !== 'undefined');\n\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n  var sources = Array.prototype.slice.call(arguments, 1);\n  while (sources.length) {\n    var source = sources.shift();\n    if (!source) { continue; }\n\n    if (typeof source !== 'object') {\n      throw new TypeError(source + 'must be non-object');\n    }\n\n    for (var p in source) {\n      if (source.hasOwnProperty(p)) {\n        obj[p] = source[p];\n      }\n    }\n  }\n\n  return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n  if (buf.length === size) { return buf; }\n  if (buf.subarray) { return buf.subarray(0, size); }\n  buf.length = size;\n  return buf;\n};\n\n\nvar fnTyped = {\n  arraySet: function (dest, src, src_offs, len, dest_offs) {\n    if (src.subarray && dest.subarray) {\n      dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n      return;\n    }\n    // Fallback to ordinary array\n    for (var i = 0; i < len; i++) {\n      dest[dest_offs + i] = src[src_offs + i];\n    }\n  },\n  // Join array of chunks to single array.\n  flattenChunks: function (chunks) {\n    var i, l, len, pos, chunk, result;\n\n    // calculate data length\n    len = 0;\n    for (i = 0, l = chunks.length; i < l; i++) {\n      len += chunks[i].length;\n    }\n\n    // join chunks\n    result = new Uint8Array(len);\n    pos = 0;\n    for (i = 0, l = chunks.length; i < l; i++) {\n      chunk = chunks[i];\n      result.set(chunk, pos);\n      pos += chunk.length;\n    }\n\n    return result;\n  }\n};\n\nvar fnUntyped = {\n  arraySet: function (dest, src, src_offs, len, dest_offs) {\n    for (var i = 0; i < len; i++) {\n      dest[dest_offs + i] = src[src_offs + i];\n    }\n  },\n  // Join array of chunks to single array.\n  flattenChunks: function (chunks) {\n    return [].concat.apply([], chunks);\n  }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n  if (on) {\n    exports.Buf8  = Uint8Array;\n    exports.Buf16 = Uint16Array;\n    exports.Buf32 = Int32Array;\n    exports.assign(exports, fnTyped);\n  } else {\n    exports.Buf8  = Array;\n    exports.Buf16 = Array;\n    exports.Buf32 = Array;\n    exports.assign(exports, fnUntyped);\n  }\n};\n\nexports.setTyped(TYPED_OK);\n\n},{}],40:[function(require,module,exports){\n// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safary\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n  _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n  var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n  // count binary size\n  for (m_pos = 0; m_pos < str_len; m_pos++) {\n    c = str.charCodeAt(m_pos);\n    if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n      c2 = str.charCodeAt(m_pos + 1);\n      if ((c2 & 0xfc00) === 0xdc00) {\n        c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n        m_pos++;\n      }\n    }\n    buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n  }\n\n  // allocate buffer\n  buf = new utils.Buf8(buf_len);\n\n  // convert\n  for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n    c = str.charCodeAt(m_pos);\n    if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n      c2 = str.charCodeAt(m_pos + 1);\n      if ((c2 & 0xfc00) === 0xdc00) {\n        c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n        m_pos++;\n      }\n    }\n    if (c < 0x80) {\n      /* one byte */\n      buf[i++] = c;\n    } else if (c < 0x800) {\n      /* two bytes */\n      buf[i++] = 0xC0 | (c >>> 6);\n      buf[i++] = 0x80 | (c & 0x3f);\n    } else if (c < 0x10000) {\n      /* three bytes */\n      buf[i++] = 0xE0 | (c >>> 12);\n      buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n      buf[i++] = 0x80 | (c & 0x3f);\n    } else {\n      /* four bytes */\n      buf[i++] = 0xf0 | (c >>> 18);\n      buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n      buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n      buf[i++] = 0x80 | (c & 0x3f);\n    }\n  }\n\n  return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n  // use fallback for big arrays to avoid stack overflow\n  if (len < 65537) {\n    if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n      return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n    }\n  }\n\n  var result = '';\n  for (var i = 0; i < len; i++) {\n    result += String.fromCharCode(buf[i]);\n  }\n  return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n  return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n  var buf = new utils.Buf8(str.length);\n  for (var i = 0, len = buf.length; i < len; i++) {\n    buf[i] = str.charCodeAt(i);\n  }\n  return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n  var i, out, c, c_len;\n  var len = max || buf.length;\n\n  // Reserve max possible length (2 words per char)\n  // NB: by unknown reasons, Array is significantly faster for\n  //     String.fromCharCode.apply than Uint16Array.\n  var utf16buf = new Array(len * 2);\n\n  for (out = 0, i = 0; i < len;) {\n    c = buf[i++];\n    // quick process ascii\n    if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n    c_len = _utf8len[c];\n    // skip 5 & 6 byte codes\n    if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n    // apply mask on first byte\n    c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n    // join the rest\n    while (c_len > 1 && i < len) {\n      c = (c << 6) | (buf[i++] & 0x3f);\n      c_len--;\n    }\n\n    // terminated by end of string?\n    if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n    if (c < 0x10000) {\n      utf16buf[out++] = c;\n    } else {\n      c -= 0x10000;\n      utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n      utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n    }\n  }\n\n  return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max   - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n  var pos;\n\n  max = max || buf.length;\n  if (max > buf.length) { max = buf.length; }\n\n  // go back from last position, until start of sequence found\n  pos = max - 1;\n  while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n  // Fuckup - very small and broken sequence,\n  // return max, because we should return something anyway.\n  if (pos < 0) { return max; }\n\n  // If we came to start of buffer - that means vuffer is too small,\n  // return max too.\n  if (pos === 0) { return max; }\n\n  return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n\n},{\"./common\":39}],41:[function(require,module,exports){\n'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It doesn't worth to make additional optimizationa as in original.\n// Small size is preferable.\n\nfunction adler32(adler, buf, len, pos) {\n  var s1 = (adler & 0xffff) |0,\n      s2 = ((adler >>> 16) & 0xffff) |0,\n      n = 0;\n\n  while (len !== 0) {\n    // Set limit ~ twice less than 5552, to keep\n    // s2 in 31-bits, because we force signed ints.\n    // in other case %= will fail.\n    n = len > 2000 ? 2000 : len;\n    len -= n;\n\n    do {\n      s1 = (s1 + buf[pos++]) |0;\n      s2 = (s2 + s1) |0;\n    } while (--n);\n\n    s1 %= 65521;\n    s2 %= 65521;\n  }\n\n  return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n\n},{}],42:[function(require,module,exports){\n'use strict';\n\n\nmodule.exports = {\n\n  /* Allowed flush values; see deflate() and inflate() below for details */\n  Z_NO_FLUSH:         0,\n  Z_PARTIAL_FLUSH:    1,\n  Z_SYNC_FLUSH:       2,\n  Z_FULL_FLUSH:       3,\n  Z_FINISH:           4,\n  Z_BLOCK:            5,\n  Z_TREES:            6,\n\n  /* Return codes for the compression/decompression functions. Negative values\n  * are errors, positive values are used for special but normal events.\n  */\n  Z_OK:               0,\n  Z_STREAM_END:       1,\n  Z_NEED_DICT:        2,\n  Z_ERRNO:           -1,\n  Z_STREAM_ERROR:    -2,\n  Z_DATA_ERROR:      -3,\n  //Z_MEM_ERROR:     -4,\n  Z_BUF_ERROR:       -5,\n  //Z_VERSION_ERROR: -6,\n\n  /* compression levels */\n  Z_NO_COMPRESSION:         0,\n  Z_BEST_SPEED:             1,\n  Z_BEST_COMPRESSION:       9,\n  Z_DEFAULT_COMPRESSION:   -1,\n\n\n  Z_FILTERED:               1,\n  Z_HUFFMAN_ONLY:           2,\n  Z_RLE:                    3,\n  Z_FIXED:                  4,\n  Z_DEFAULT_STRATEGY:       0,\n\n  /* Possible values of the data_type field (though see inflate()) */\n  Z_BINARY:                 0,\n  Z_TEXT:                   1,\n  //Z_ASCII:                1, // = Z_TEXT (deprecated)\n  Z_UNKNOWN:                2,\n\n  /* The deflate compression method */\n  Z_DEFLATED:               8\n  //Z_NULL:                 null // Use -1 or null inline, depending on var type\n};\n\n},{}],43:[function(require,module,exports){\n'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n  var c, table = [];\n\n  for (var n = 0; n < 256; n++) {\n    c = n;\n    for (var k = 0; k < 8; k++) {\n      c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n    }\n    table[n] = c;\n  }\n\n  return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n  var t = crcTable,\n      end = pos + len;\n\n  crc ^= -1;\n\n  for (var i = pos; i < end; i++) {\n    crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n  }\n\n  return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n\n},{}],44:[function(require,module,exports){\n'use strict';\n\nvar utils   = require('../utils/common');\nvar trees   = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32   = require('./crc32');\nvar msg     = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH      = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH    = 2;\nvar Z_FULL_FLUSH    = 3;\nvar Z_FINISH        = 4;\nvar Z_BLOCK         = 5;\n//var Z_TREES         = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK            = 0;\nvar Z_STREAM_END    = 1;\n//var Z_NEED_DICT     = 2;\n//var Z_ERRNO         = -1;\nvar Z_STREAM_ERROR  = -2;\nvar Z_DATA_ERROR    = -3;\n//var Z_MEM_ERROR     = -4;\nvar Z_BUF_ERROR     = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION      = 0;\n//var Z_BEST_SPEED          = 1;\n//var Z_BEST_COMPRESSION    = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED            = 1;\nvar Z_HUFFMAN_ONLY        = 2;\nvar Z_RLE                 = 3;\nvar Z_FIXED               = 4;\nvar Z_DEFAULT_STRATEGY    = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY              = 0;\n//var Z_TEXT                = 1;\n//var Z_ASCII               = 1; // = Z_TEXT\nvar Z_UNKNOWN             = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED  = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES  = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS      = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES       = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES       = 30;\n/* number of distance codes */\nvar BL_CODES      = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE     = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS  = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE      = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE     = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE    = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n  strm.msg = msg[errorCode];\n  return errorCode;\n}\n\nfunction rank(f) {\n  return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n  var s = strm.state;\n\n  //_tr_flush_bits(s);\n  var len = s.pending;\n  if (len > strm.avail_out) {\n    len = strm.avail_out;\n  }\n  if (len === 0) { return; }\n\n  utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n  strm.next_out += len;\n  s.pending_out += len;\n  strm.total_out += len;\n  strm.avail_out -= len;\n  s.pending -= len;\n  if (s.pending === 0) {\n    s.pending_out = 0;\n  }\n}\n\n\nfunction flush_block_only(s, last) {\n  trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n  s.block_start = s.strstart;\n  flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n  s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n//  put_byte(s, (Byte)(b >> 8));\n//  put_byte(s, (Byte)(b & 0xff));\n  s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n  s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read.  All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n  var len = strm.avail_in;\n\n  if (len > size) { len = size; }\n  if (len === 0) { return 0; }\n\n  strm.avail_in -= len;\n\n  // zmemcpy(buf, strm->next_in, len);\n  utils.arraySet(buf, strm.input, strm.next_in, len, start);\n  if (strm.state.wrap === 1) {\n    strm.adler = adler32(strm.adler, buf, len, start);\n  }\n\n  else if (strm.state.wrap === 2) {\n    strm.adler = crc32(strm.adler, buf, len, start);\n  }\n\n  strm.next_in += len;\n  strm.total_in += len;\n\n  return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n  var chain_length = s.max_chain_length;      /* max hash chain length */\n  var scan = s.strstart; /* current string */\n  var match;                       /* matched string */\n  var len;                           /* length of current match */\n  var best_len = s.prev_length;              /* best match length so far */\n  var nice_match = s.nice_match;             /* stop if match long enough */\n  var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n      s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n  var _win = s.window; // shortcut\n\n  var wmask = s.w_mask;\n  var prev  = s.prev;\n\n  /* Stop when cur_match becomes <= limit. To simplify the code,\n   * we prevent matches with the string of window index 0.\n   */\n\n  var strend = s.strstart + MAX_MATCH;\n  var scan_end1  = _win[scan + best_len - 1];\n  var scan_end   = _win[scan + best_len];\n\n  /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n   * It is easy to get rid of this optimization if necessary.\n   */\n  // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n  /* Do not waste too much time if we already have a good match: */\n  if (s.prev_length >= s.good_match) {\n    chain_length >>= 2;\n  }\n  /* Do not look for matches beyond the end of the input. This is necessary\n   * to make deflate deterministic.\n   */\n  if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n  // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n  do {\n    // Assert(cur_match < s->strstart, \"no future\");\n    match = cur_match;\n\n    /* Skip to next match if the match length cannot increase\n     * or if the match length is less than 2.  Note that the checks below\n     * for insufficient lookahead only occur occasionally for performance\n     * reasons.  Therefore uninitialized memory will be accessed, and\n     * conditional jumps will be made that depend on those values.\n     * However the length of the match is limited to the lookahead, so\n     * the output of deflate is not affected by the uninitialized values.\n     */\n\n    if (_win[match + best_len]     !== scan_end  ||\n        _win[match + best_len - 1] !== scan_end1 ||\n        _win[match]                !== _win[scan] ||\n        _win[++match]              !== _win[scan + 1]) {\n      continue;\n    }\n\n    /* The check at best_len-1 can be removed because it will be made\n     * again later. (This heuristic is not always a win.)\n     * It is not necessary to compare scan[2] and match[2] since they\n     * are always equal when the other bytes match, given that\n     * the hash keys are equal and that HASH_BITS >= 8.\n     */\n    scan += 2;\n    match++;\n    // Assert(*scan == *match, \"match[2]?\");\n\n    /* We check for insufficient lookahead only every 8th comparison;\n     * the 256th check will be made at strstart+258.\n     */\n    do {\n      /*jshint noempty:false*/\n    } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             scan < strend);\n\n    // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n    len = MAX_MATCH - (strend - scan);\n    scan = strend - MAX_MATCH;\n\n    if (len > best_len) {\n      s.match_start = cur_match;\n      best_len = len;\n      if (len >= nice_match) {\n        break;\n      }\n      scan_end1  = _win[scan + best_len - 1];\n      scan_end   = _win[scan + best_len];\n    }\n  } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n  if (best_len <= s.lookahead) {\n    return best_len;\n  }\n  return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n *    At least one byte has been read, or avail_in == 0; reads are\n *    performed for at least two bytes (required for the zip translate_eol\n *    option -- not supported here).\n */\nfunction fill_window(s) {\n  var _w_size = s.w_size;\n  var p, n, m, more, str;\n\n  //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n  do {\n    more = s.window_size - s.lookahead - s.strstart;\n\n    // JS ints have 32 bit, block below not needed\n    /* Deal with !@#$% 64K limit: */\n    //if (sizeof(int) <= 2) {\n    //    if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n    //        more = wsize;\n    //\n    //  } else if (more == (unsigned)(-1)) {\n    //        /* Very unlikely, but possible on 16 bit machine if\n    //         * strstart == 0 && lookahead == 1 (input done a byte at time)\n    //         */\n    //        more--;\n    //    }\n    //}\n\n\n    /* If the window is almost full and there is insufficient lookahead,\n     * move the upper half to the lower one to make room in the upper half.\n     */\n    if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n      utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n      s.match_start -= _w_size;\n      s.strstart -= _w_size;\n      /* we now have strstart >= MAX_DIST */\n      s.block_start -= _w_size;\n\n      /* Slide the hash table (could be avoided with 32 bit values\n       at the expense of memory usage). We slide even when level == 0\n       to keep the hash table consistent if we switch back to level > 0\n       later. (Using level 0 permanently is not an optimal usage of\n       zlib, so we don't care about this pathological case.)\n       */\n\n      n = s.hash_size;\n      p = n;\n      do {\n        m = s.head[--p];\n        s.head[p] = (m >= _w_size ? m - _w_size : 0);\n      } while (--n);\n\n      n = _w_size;\n      p = n;\n      do {\n        m = s.prev[--p];\n        s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n        /* If n is not on any hash chain, prev[n] is garbage but\n         * its value will never be used.\n         */\n      } while (--n);\n\n      more += _w_size;\n    }\n    if (s.strm.avail_in === 0) {\n      break;\n    }\n\n    /* If there was no sliding:\n     *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n     *    more == window_size - lookahead - strstart\n     * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n     * => more >= window_size - 2*WSIZE + 2\n     * In the BIG_MEM or MMAP case (not yet supported),\n     *   window_size == input_size + MIN_LOOKAHEAD  &&\n     *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n     * Otherwise, window_size == 2*WSIZE so more >= 2.\n     * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n     */\n    //Assert(more >= 2, \"more < 2\");\n    n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n    s.lookahead += n;\n\n    /* Initialize the hash value now that we have some input: */\n    if (s.lookahead + s.insert >= MIN_MATCH) {\n      str = s.strstart - s.insert;\n      s.ins_h = s.window[str];\n\n      /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n//        Call update_hash() MIN_MATCH-3 more times\n//#endif\n      while (s.insert) {\n        /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n        s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n        s.prev[str & s.w_mask] = s.head[s.ins_h];\n        s.head[s.ins_h] = str;\n        str++;\n        s.insert--;\n        if (s.lookahead + s.insert < MIN_MATCH) {\n          break;\n        }\n      }\n    }\n    /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n     * but this is not important since only literal bytes will be emitted.\n     */\n\n  } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n  /* If the WIN_INIT bytes after the end of the current data have never been\n   * written, then zero those bytes in order to avoid memory check reports of\n   * the use of uninitialized (or uninitialised as Julian writes) bytes by\n   * the longest match routines.  Update the high water mark for the next\n   * time through here.  WIN_INIT is set to MAX_MATCH since the longest match\n   * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n   */\n//  if (s.high_water < s.window_size) {\n//    var curr = s.strstart + s.lookahead;\n//    var init = 0;\n//\n//    if (s.high_water < curr) {\n//      /* Previous high water mark below current data -- zero WIN_INIT\n//       * bytes or up to end of window, whichever is less.\n//       */\n//      init = s.window_size - curr;\n//      if (init > WIN_INIT)\n//        init = WIN_INIT;\n//      zmemzero(s->window + curr, (unsigned)init);\n//      s->high_water = curr + init;\n//    }\n//    else if (s->high_water < (ulg)curr + WIN_INIT) {\n//      /* High water mark at or above current data, but below current data\n//       * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n//       * to end of window, whichever is less.\n//       */\n//      init = (ulg)curr + WIN_INIT - s->high_water;\n//      if (init > s->window_size - s->high_water)\n//        init = s->window_size - s->high_water;\n//      zmemzero(s->window + s->high_water, (unsigned)init);\n//      s->high_water += init;\n//    }\n//  }\n//\n//  Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n//    \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n  /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n   * to pending_buf_size, and each stored block has a 5 byte header:\n   */\n  var max_block_size = 0xffff;\n\n  if (max_block_size > s.pending_buf_size - 5) {\n    max_block_size = s.pending_buf_size - 5;\n  }\n\n  /* Copy as much as possible from input to output: */\n  for (;;) {\n    /* Fill the window as much as possible: */\n    if (s.lookahead <= 1) {\n\n      //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n      //  s->block_start >= (long)s->w_size, \"slide too late\");\n//      if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n//        s.block_start >= s.w_size)) {\n//        throw  new Error(\"slide too late\");\n//      }\n\n      fill_window(s);\n      if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n        return BS_NEED_MORE;\n      }\n\n      if (s.lookahead === 0) {\n        break;\n      }\n      /* flush the current block */\n    }\n    //Assert(s->block_start >= 0L, \"block gone\");\n//    if (s.block_start < 0) throw new Error(\"block gone\");\n\n    s.strstart += s.lookahead;\n    s.lookahead = 0;\n\n    /* Emit a stored block if pending_buf will be full: */\n    var max_start = s.block_start + max_block_size;\n\n    if (s.strstart === 0 || s.strstart >= max_start) {\n      /* strstart == 0 is possible when wraparound on 16-bit machine */\n      s.lookahead = s.strstart - max_start;\n      s.strstart = max_start;\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n\n\n    }\n    /* Flush if we may have to slide, otherwise block_start may become\n     * negative and the data will be gone:\n     */\n    if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n\n  s.insert = 0;\n\n  if (flush === Z_FINISH) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n\n  if (s.strstart > s.block_start) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n\n  return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n  var hash_head;        /* head of the hash chain */\n  var bflush;           /* set if current block must be flushed */\n\n  for (;;) {\n    /* Make sure that we always have enough lookahead, except\n     * at the end of the input file. We need MAX_MATCH bytes\n     * for the next match, plus MIN_MATCH bytes to insert the\n     * string following the next match.\n     */\n    if (s.lookahead < MIN_LOOKAHEAD) {\n      fill_window(s);\n      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n        return BS_NEED_MORE;\n      }\n      if (s.lookahead === 0) {\n        break; /* flush the current block */\n      }\n    }\n\n    /* Insert the string window[strstart .. strstart+2] in the\n     * dictionary, and set hash_head to the head of the hash chain:\n     */\n    hash_head = 0/*NIL*/;\n    if (s.lookahead >= MIN_MATCH) {\n      /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n      s.head[s.ins_h] = s.strstart;\n      /***/\n    }\n\n    /* Find the longest match, discarding those <= prev_length.\n     * At this point we have always match_length < MIN_MATCH\n     */\n    if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n      /* To simplify the code, we prevent matches with the string\n       * of window index 0 (in particular we have to avoid a match\n       * of the string with itself at the start of the input file).\n       */\n      s.match_length = longest_match(s, hash_head);\n      /* longest_match() sets match_start */\n    }\n    if (s.match_length >= MIN_MATCH) {\n      // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n      /*** _tr_tally_dist(s, s.strstart - s.match_start,\n                     s.match_length - MIN_MATCH, bflush); ***/\n      bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n      s.lookahead -= s.match_length;\n\n      /* Insert new strings in the hash table only if the match length\n       * is not too large. This saves time but degrades compression.\n       */\n      if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n        s.match_length--; /* string at strstart already in table */\n        do {\n          s.strstart++;\n          /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n          s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n          s.head[s.ins_h] = s.strstart;\n          /***/\n          /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n           * always MIN_MATCH bytes ahead.\n           */\n        } while (--s.match_length !== 0);\n        s.strstart++;\n      } else\n      {\n        s.strstart += s.match_length;\n        s.match_length = 0;\n        s.ins_h = s.window[s.strstart];\n        /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n        s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n//                Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n        /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n         * matter since it will be recomputed at next deflate call.\n         */\n      }\n    } else {\n      /* No match, output a literal byte */\n      //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n      bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n      s.lookahead--;\n      s.strstart++;\n    }\n    if (bflush) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n  s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n  if (flush === Z_FINISH) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n  return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n  var hash_head;          /* head of hash chain */\n  var bflush;              /* set if current block must be flushed */\n\n  var max_insert;\n\n  /* Process the input block. */\n  for (;;) {\n    /* Make sure that we always have enough lookahead, except\n     * at the end of the input file. We need MAX_MATCH bytes\n     * for the next match, plus MIN_MATCH bytes to insert the\n     * string following the next match.\n     */\n    if (s.lookahead < MIN_LOOKAHEAD) {\n      fill_window(s);\n      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n        return BS_NEED_MORE;\n      }\n      if (s.lookahead === 0) { break; } /* flush the current block */\n    }\n\n    /* Insert the string window[strstart .. strstart+2] in the\n     * dictionary, and set hash_head to the head of the hash chain:\n     */\n    hash_head = 0/*NIL*/;\n    if (s.lookahead >= MIN_MATCH) {\n      /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n      s.head[s.ins_h] = s.strstart;\n      /***/\n    }\n\n    /* Find the longest match, discarding those <= prev_length.\n     */\n    s.prev_length = s.match_length;\n    s.prev_match = s.match_start;\n    s.match_length = MIN_MATCH - 1;\n\n    if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n        s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n      /* To simplify the code, we prevent matches with the string\n       * of window index 0 (in particular we have to avoid a match\n       * of the string with itself at the start of the input file).\n       */\n      s.match_length = longest_match(s, hash_head);\n      /* longest_match() sets match_start */\n\n      if (s.match_length <= 5 &&\n         (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n        /* If prev_match is also MIN_MATCH, match_start is garbage\n         * but we will ignore the current match anyway.\n         */\n        s.match_length = MIN_MATCH - 1;\n      }\n    }\n    /* If there was a match at the previous step and the current\n     * match is not better, output the previous match:\n     */\n    if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n      max_insert = s.strstart + s.lookahead - MIN_MATCH;\n      /* Do not insert strings in hash table beyond this. */\n\n      //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n      /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n                     s.prev_length - MIN_MATCH, bflush);***/\n      bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n      /* Insert in hash table all strings up to the end of the match.\n       * strstart-1 and strstart are already inserted. If there is not\n       * enough lookahead, the last two strings are not inserted in\n       * the hash table.\n       */\n      s.lookahead -= s.prev_length - 1;\n      s.prev_length -= 2;\n      do {\n        if (++s.strstart <= max_insert) {\n          /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n          s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n          s.head[s.ins_h] = s.strstart;\n          /***/\n        }\n      } while (--s.prev_length !== 0);\n      s.match_available = 0;\n      s.match_length = MIN_MATCH - 1;\n      s.strstart++;\n\n      if (bflush) {\n        /*** FLUSH_BLOCK(s, 0); ***/\n        flush_block_only(s, false);\n        if (s.strm.avail_out === 0) {\n          return BS_NEED_MORE;\n        }\n        /***/\n      }\n\n    } else if (s.match_available) {\n      /* If there was no match at the previous position, output a\n       * single literal. If there was a match but the current match\n       * is longer, truncate the previous match to a single literal.\n       */\n      //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n      /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n      bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n      if (bflush) {\n        /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n        flush_block_only(s, false);\n        /***/\n      }\n      s.strstart++;\n      s.lookahead--;\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n    } else {\n      /* There is no previous match to compare with, wait for\n       * the next step to decide.\n       */\n      s.match_available = 1;\n      s.strstart++;\n      s.lookahead--;\n    }\n  }\n  //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n  if (s.match_available) {\n    //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n    /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n    bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n    s.match_available = 0;\n  }\n  s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n  if (flush === Z_FINISH) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n\n  return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one.  Do not maintain a hash table.  (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n  var bflush;            /* set if current block must be flushed */\n  var prev;              /* byte at distance one to match */\n  var scan, strend;      /* scan goes up to strend for length of run */\n\n  var _win = s.window;\n\n  for (;;) {\n    /* Make sure that we always have enough lookahead, except\n     * at the end of the input file. We need MAX_MATCH bytes\n     * for the longest run, plus one for the unrolled loop.\n     */\n    if (s.lookahead <= MAX_MATCH) {\n      fill_window(s);\n      if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n        return BS_NEED_MORE;\n      }\n      if (s.lookahead === 0) { break; } /* flush the current block */\n    }\n\n    /* See how many times the previous byte repeats */\n    s.match_length = 0;\n    if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n      scan = s.strstart - 1;\n      prev = _win[scan];\n      if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n        strend = s.strstart + MAX_MATCH;\n        do {\n          /*jshint noempty:false*/\n        } while (prev === _win[++scan] && prev === _win[++scan] &&\n                 prev === _win[++scan] && prev === _win[++scan] &&\n                 prev === _win[++scan] && prev === _win[++scan] &&\n                 prev === _win[++scan] && prev === _win[++scan] &&\n                 scan < strend);\n        s.match_length = MAX_MATCH - (strend - scan);\n        if (s.match_length > s.lookahead) {\n          s.match_length = s.lookahead;\n        }\n      }\n      //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n    }\n\n    /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n    if (s.match_length >= MIN_MATCH) {\n      //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n      /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n      bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n      s.lookahead -= s.match_length;\n      s.strstart += s.match_length;\n      s.match_length = 0;\n    } else {\n      /* No match, output a literal byte */\n      //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n      bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n      s.lookahead--;\n      s.strstart++;\n    }\n    if (bflush) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n  s.insert = 0;\n  if (flush === Z_FINISH) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n  return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n  var bflush;             /* set if current block must be flushed */\n\n  for (;;) {\n    /* Make sure that we have a literal to write. */\n    if (s.lookahead === 0) {\n      fill_window(s);\n      if (s.lookahead === 0) {\n        if (flush === Z_NO_FLUSH) {\n          return BS_NEED_MORE;\n        }\n        break;      /* flush the current block */\n      }\n    }\n\n    /* Output a literal byte */\n    s.match_length = 0;\n    //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n    /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n    bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n    s.lookahead--;\n    s.strstart++;\n    if (bflush) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n  s.insert = 0;\n  if (flush === Z_FINISH) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n  return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n  this.good_length = good_length;\n  this.max_lazy = max_lazy;\n  this.nice_length = nice_length;\n  this.max_chain = max_chain;\n  this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n  /*      good lazy nice chain */\n  new Config(0, 0, 0, 0, deflate_stored),          /* 0 store only */\n  new Config(4, 4, 8, 4, deflate_fast),            /* 1 max speed, no lazy matches */\n  new Config(4, 5, 16, 8, deflate_fast),           /* 2 */\n  new Config(4, 6, 32, 32, deflate_fast),          /* 3 */\n\n  new Config(4, 4, 16, 16, deflate_slow),          /* 4 lazy matches */\n  new Config(8, 16, 32, 32, deflate_slow),         /* 5 */\n  new Config(8, 16, 128, 128, deflate_slow),       /* 6 */\n  new Config(8, 32, 128, 256, deflate_slow),       /* 7 */\n  new Config(32, 128, 258, 1024, deflate_slow),    /* 8 */\n  new Config(32, 258, 258, 4096, deflate_slow)     /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n  s.window_size = 2 * s.w_size;\n\n  /*** CLEAR_HASH(s); ***/\n  zero(s.head); // Fill with NIL (= 0);\n\n  /* Set the default configuration parameters:\n   */\n  s.max_lazy_match = configuration_table[s.level].max_lazy;\n  s.good_match = configuration_table[s.level].good_length;\n  s.nice_match = configuration_table[s.level].nice_length;\n  s.max_chain_length = configuration_table[s.level].max_chain;\n\n  s.strstart = 0;\n  s.block_start = 0;\n  s.lookahead = 0;\n  s.insert = 0;\n  s.match_length = s.prev_length = MIN_MATCH - 1;\n  s.match_available = 0;\n  s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n  this.strm = null;            /* pointer back to this zlib stream */\n  this.status = 0;            /* as the name implies */\n  this.pending_buf = null;      /* output still pending */\n  this.pending_buf_size = 0;  /* size of pending_buf */\n  this.pending_out = 0;       /* next pending byte to output to the stream */\n  this.pending = 0;           /* nb of bytes in the pending buffer */\n  this.wrap = 0;              /* bit 0 true for zlib, bit 1 true for gzip */\n  this.gzhead = null;         /* gzip header information to write */\n  this.gzindex = 0;           /* where in extra, name, or comment */\n  this.method = Z_DEFLATED; /* can only be DEFLATED */\n  this.last_flush = -1;   /* value of flush param for previous deflate call */\n\n  this.w_size = 0;  /* LZ77 window size (32K by default) */\n  this.w_bits = 0;  /* log2(w_size)  (8..16) */\n  this.w_mask = 0;  /* w_size - 1 */\n\n  this.window = null;\n  /* Sliding window. Input bytes are read into the second half of the window,\n   * and move to the first half later to keep a dictionary of at least wSize\n   * bytes. With this organization, matches are limited to a distance of\n   * wSize-MAX_MATCH bytes, but this ensures that IO is always\n   * performed with a length multiple of the block size.\n   */\n\n  this.window_size = 0;\n  /* Actual size of window: 2*wSize, except when the user input buffer\n   * is directly used as sliding window.\n   */\n\n  this.prev = null;\n  /* Link to older string with same hash index. To limit the size of this\n   * array to 64K, this link is maintained only for the last 32K strings.\n   * An index in this array is thus a window index modulo 32K.\n   */\n\n  this.head = null;   /* Heads of the hash chains or NIL. */\n\n  this.ins_h = 0;       /* hash index of string to be inserted */\n  this.hash_size = 0;   /* number of elements in hash table */\n  this.hash_bits = 0;   /* log2(hash_size) */\n  this.hash_mask = 0;   /* hash_size-1 */\n\n  this.hash_shift = 0;\n  /* Number of bits by which ins_h must be shifted at each input\n   * step. It must be such that after MIN_MATCH steps, the oldest\n   * byte no longer takes part in the hash key, that is:\n   *   hash_shift * MIN_MATCH >= hash_bits\n   */\n\n  this.block_start = 0;\n  /* Window position at the beginning of the current output block. Gets\n   * negative when the window is moved backwards.\n   */\n\n  this.match_length = 0;      /* length of best match */\n  this.prev_match = 0;        /* previous match */\n  this.match_available = 0;   /* set if previous match exists */\n  this.strstart = 0;          /* start of string to insert */\n  this.match_start = 0;       /* start of matching string */\n  this.lookahead = 0;         /* number of valid bytes ahead in window */\n\n  this.prev_length = 0;\n  /* Length of the best match at previous step. Matches not greater than this\n   * are discarded. This is used in the lazy match evaluation.\n   */\n\n  this.max_chain_length = 0;\n  /* To speed up deflation, hash chains are never searched beyond this\n   * length.  A higher limit improves compression ratio but degrades the\n   * speed.\n   */\n\n  this.max_lazy_match = 0;\n  /* Attempt to find a better match only when the current match is strictly\n   * smaller than this value. This mechanism is used only for compression\n   * levels >= 4.\n   */\n  // That's alias to max_lazy_match, don't use directly\n  //this.max_insert_length = 0;\n  /* Insert new strings in the hash table only if the match length is not\n   * greater than this length. This saves time but degrades compression.\n   * max_insert_length is used only for compression levels <= 3.\n   */\n\n  this.level = 0;     /* compression level (1..9) */\n  this.strategy = 0;  /* favor or force Huffman coding*/\n\n  this.good_match = 0;\n  /* Use a faster search when the previous match is longer than this */\n\n  this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n              /* used by trees.c: */\n\n  /* Didn't use ct_data typedef below to suppress compiler warning */\n\n  // struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */\n  // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n  // struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */\n\n  // Use flat array of DOUBLE size, with interleaved fata,\n  // because JS does not support effective\n  this.dyn_ltree  = new utils.Buf16(HEAP_SIZE * 2);\n  this.dyn_dtree  = new utils.Buf16((2 * D_CODES + 1) * 2);\n  this.bl_tree    = new utils.Buf16((2 * BL_CODES + 1) * 2);\n  zero(this.dyn_ltree);\n  zero(this.dyn_dtree);\n  zero(this.bl_tree);\n\n  this.l_desc   = null;         /* desc. for literal tree */\n  this.d_desc   = null;         /* desc. for distance tree */\n  this.bl_desc  = null;         /* desc. for bit length tree */\n\n  //ush bl_count[MAX_BITS+1];\n  this.bl_count = new utils.Buf16(MAX_BITS + 1);\n  /* number of codes at each bit length for an optimal tree */\n\n  //int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */\n  this.heap = new utils.Buf16(2 * L_CODES + 1);  /* heap used to build the Huffman trees */\n  zero(this.heap);\n\n  this.heap_len = 0;               /* number of elements in the heap */\n  this.heap_max = 0;               /* element of largest frequency */\n  /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n   * The same heap array is used to build all trees.\n   */\n\n  this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n  zero(this.depth);\n  /* Depth of each subtree used as tie breaker for trees of equal frequency\n   */\n\n  this.l_buf = 0;          /* buffer index for literals or lengths */\n\n  this.lit_bufsize = 0;\n  /* Size of match buffer for literals/lengths.  There are 4 reasons for\n   * limiting lit_bufsize to 64K:\n   *   - frequencies can be kept in 16 bit counters\n   *   - if compression is not successful for the first block, all input\n   *     data is still in the window so we can still emit a stored block even\n   *     when input comes from standard input.  (This can also be done for\n   *     all blocks if lit_bufsize is not greater than 32K.)\n   *   - if compression is not successful for a file smaller than 64K, we can\n   *     even emit a stored file instead of a stored block (saving 5 bytes).\n   *     This is applicable only for zip (not gzip or zlib).\n   *   - creating new Huffman trees less frequently may not provide fast\n   *     adaptation to changes in the input data statistics. (Take for\n   *     example a binary file with poorly compressible code followed by\n   *     a highly compressible string table.) Smaller buffer sizes give\n   *     fast adaptation but have of course the overhead of transmitting\n   *     trees more frequently.\n   *   - I can't count above 4\n   */\n\n  this.last_lit = 0;      /* running index in l_buf */\n\n  this.d_buf = 0;\n  /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n   * the same number of elements. To use different lengths, an extra flag\n   * array would be necessary.\n   */\n\n  this.opt_len = 0;       /* bit length of current block with optimal trees */\n  this.static_len = 0;    /* bit length of current block with static trees */\n  this.matches = 0;       /* number of string matches in current block */\n  this.insert = 0;        /* bytes at end of window left to insert */\n\n\n  this.bi_buf = 0;\n  /* Output buffer. bits are inserted starting at the bottom (least\n   * significant bits).\n   */\n  this.bi_valid = 0;\n  /* Number of valid bits in bi_buf.  All bits above the last valid bit\n   * are always zero.\n   */\n\n  // Used for window memory init. We safely ignore it for JS. That makes\n  // sense only for pointers and memory check tools.\n  //this.high_water = 0;\n  /* High water mark offset in window for initialized bytes -- bytes above\n   * this are set to zero in order to avoid memory check warnings when\n   * longest match routines access bytes past the input.  This is then\n   * updated to the new high water mark.\n   */\n}\n\n\nfunction deflateResetKeep(strm) {\n  var s;\n\n  if (!strm || !strm.state) {\n    return err(strm, Z_STREAM_ERROR);\n  }\n\n  strm.total_in = strm.total_out = 0;\n  strm.data_type = Z_UNKNOWN;\n\n  s = strm.state;\n  s.pending = 0;\n  s.pending_out = 0;\n\n  if (s.wrap < 0) {\n    s.wrap = -s.wrap;\n    /* was made negative by deflate(..., Z_FINISH); */\n  }\n  s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n  strm.adler = (s.wrap === 2) ?\n    0  // crc32(0, Z_NULL, 0)\n  :\n    1; // adler32(0, Z_NULL, 0)\n  s.last_flush = Z_NO_FLUSH;\n  trees._tr_init(s);\n  return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n  var ret = deflateResetKeep(strm);\n  if (ret === Z_OK) {\n    lm_init(strm.state);\n  }\n  return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n  if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n  strm.state.gzhead = head;\n  return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n  if (!strm) { // === Z_NULL\n    return Z_STREAM_ERROR;\n  }\n  var wrap = 1;\n\n  if (level === Z_DEFAULT_COMPRESSION) {\n    level = 6;\n  }\n\n  if (windowBits < 0) { /* suppress zlib wrapper */\n    wrap = 0;\n    windowBits = -windowBits;\n  }\n\n  else if (windowBits > 15) {\n    wrap = 2;           /* write gzip wrapper instead */\n    windowBits -= 16;\n  }\n\n\n  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n    windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n    strategy < 0 || strategy > Z_FIXED) {\n    return err(strm, Z_STREAM_ERROR);\n  }\n\n\n  if (windowBits === 8) {\n    windowBits = 9;\n  }\n  /* until 256-byte window bug fixed */\n\n  var s = new DeflateState();\n\n  strm.state = s;\n  s.strm = strm;\n\n  s.wrap = wrap;\n  s.gzhead = null;\n  s.w_bits = windowBits;\n  s.w_size = 1 << s.w_bits;\n  s.w_mask = s.w_size - 1;\n\n  s.hash_bits = memLevel + 7;\n  s.hash_size = 1 << s.hash_bits;\n  s.hash_mask = s.hash_size - 1;\n  s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n  s.window = new utils.Buf8(s.w_size * 2);\n  s.head = new utils.Buf16(s.hash_size);\n  s.prev = new utils.Buf16(s.w_size);\n\n  // Don't need mem init magic for JS.\n  //s.high_water = 0;  /* nothing written to s->window yet */\n\n  s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n  s.pending_buf_size = s.lit_bufsize * 4;\n  s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n  s.d_buf = s.lit_bufsize >> 1;\n  s.l_buf = (1 + 2) * s.lit_bufsize;\n\n  s.level = level;\n  s.strategy = strategy;\n  s.method = method;\n\n  return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n  return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n  var old_flush, s;\n  var beg, val; // for gzip header write only\n\n  if (!strm || !strm.state ||\n    flush > Z_BLOCK || flush < 0) {\n    return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n  }\n\n  s = strm.state;\n\n  if (!strm.output ||\n      (!strm.input && strm.avail_in !== 0) ||\n      (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n    return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n  }\n\n  s.strm = strm; /* just in case */\n  old_flush = s.last_flush;\n  s.last_flush = flush;\n\n  /* Write the header */\n  if (s.status === INIT_STATE) {\n\n    if (s.wrap === 2) { // GZIP header\n      strm.adler = 0;  //crc32(0L, Z_NULL, 0);\n      put_byte(s, 31);\n      put_byte(s, 139);\n      put_byte(s, 8);\n      if (!s.gzhead) { // s->gzhead == Z_NULL\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, s.level === 9 ? 2 :\n                    (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n                     4 : 0));\n        put_byte(s, OS_CODE);\n        s.status = BUSY_STATE;\n      }\n      else {\n        put_byte(s, (s.gzhead.text ? 1 : 0) +\n                    (s.gzhead.hcrc ? 2 : 0) +\n                    (!s.gzhead.extra ? 0 : 4) +\n                    (!s.gzhead.name ? 0 : 8) +\n                    (!s.gzhead.comment ? 0 : 16)\n                );\n        put_byte(s, s.gzhead.time & 0xff);\n        put_byte(s, (s.gzhead.time >> 8) & 0xff);\n        put_byte(s, (s.gzhead.time >> 16) & 0xff);\n        put_byte(s, (s.gzhead.time >> 24) & 0xff);\n        put_byte(s, s.level === 9 ? 2 :\n                    (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n                     4 : 0));\n        put_byte(s, s.gzhead.os & 0xff);\n        if (s.gzhead.extra && s.gzhead.extra.length) {\n          put_byte(s, s.gzhead.extra.length & 0xff);\n          put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n        }\n        if (s.gzhead.hcrc) {\n          strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n        }\n        s.gzindex = 0;\n        s.status = EXTRA_STATE;\n      }\n    }\n    else // DEFLATE header\n    {\n      var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n      var level_flags = -1;\n\n      if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n        level_flags = 0;\n      } else if (s.level < 6) {\n        level_flags = 1;\n      } else if (s.level === 6) {\n        level_flags = 2;\n      } else {\n        level_flags = 3;\n      }\n      header |= (level_flags << 6);\n      if (s.strstart !== 0) { header |= PRESET_DICT; }\n      header += 31 - (header % 31);\n\n      s.status = BUSY_STATE;\n      putShortMSB(s, header);\n\n      /* Save the adler32 of the preset dictionary: */\n      if (s.strstart !== 0) {\n        putShortMSB(s, strm.adler >>> 16);\n        putShortMSB(s, strm.adler & 0xffff);\n      }\n      strm.adler = 1; // adler32(0L, Z_NULL, 0);\n    }\n  }\n\n//#ifdef GZIP\n  if (s.status === EXTRA_STATE) {\n    if (s.gzhead.extra/* != Z_NULL*/) {\n      beg = s.pending;  /* start of bytes to update crc */\n\n      while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n        if (s.pending === s.pending_buf_size) {\n          if (s.gzhead.hcrc && s.pending > beg) {\n            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n          }\n          flush_pending(strm);\n          beg = s.pending;\n          if (s.pending === s.pending_buf_size) {\n            break;\n          }\n        }\n        put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n        s.gzindex++;\n      }\n      if (s.gzhead.hcrc && s.pending > beg) {\n        strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n      }\n      if (s.gzindex === s.gzhead.extra.length) {\n        s.gzindex = 0;\n        s.status = NAME_STATE;\n      }\n    }\n    else {\n      s.status = NAME_STATE;\n    }\n  }\n  if (s.status === NAME_STATE) {\n    if (s.gzhead.name/* != Z_NULL*/) {\n      beg = s.pending;  /* start of bytes to update crc */\n      //int val;\n\n      do {\n        if (s.pending === s.pending_buf_size) {\n          if (s.gzhead.hcrc && s.pending > beg) {\n            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n          }\n          flush_pending(strm);\n          beg = s.pending;\n          if (s.pending === s.pending_buf_size) {\n            val = 1;\n            break;\n          }\n        }\n        // JS specific: little magic to add zero terminator to end of string\n        if (s.gzindex < s.gzhead.name.length) {\n          val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n        } else {\n          val = 0;\n        }\n        put_byte(s, val);\n      } while (val !== 0);\n\n      if (s.gzhead.hcrc && s.pending > beg) {\n        strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n      }\n      if (val === 0) {\n        s.gzindex = 0;\n        s.status = COMMENT_STATE;\n      }\n    }\n    else {\n      s.status = COMMENT_STATE;\n    }\n  }\n  if (s.status === COMMENT_STATE) {\n    if (s.gzhead.comment/* != Z_NULL*/) {\n      beg = s.pending;  /* start of bytes to update crc */\n      //int val;\n\n      do {\n        if (s.pending === s.pending_buf_size) {\n          if (s.gzhead.hcrc && s.pending > beg) {\n            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n          }\n          flush_pending(strm);\n          beg = s.pending;\n          if (s.pending === s.pending_buf_size) {\n            val = 1;\n            break;\n          }\n        }\n        // JS specific: little magic to add zero terminator to end of string\n        if (s.gzindex < s.gzhead.comment.length) {\n          val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n        } else {\n          val = 0;\n        }\n        put_byte(s, val);\n      } while (val !== 0);\n\n      if (s.gzhead.hcrc && s.pending > beg) {\n        strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n      }\n      if (val === 0) {\n        s.status = HCRC_STATE;\n      }\n    }\n    else {\n      s.status = HCRC_STATE;\n    }\n  }\n  if (s.status === HCRC_STATE) {\n    if (s.gzhead.hcrc) {\n      if (s.pending + 2 > s.pending_buf_size) {\n        flush_pending(strm);\n      }\n      if (s.pending + 2 <= s.pending_buf_size) {\n        put_byte(s, strm.adler & 0xff);\n        put_byte(s, (strm.adler >> 8) & 0xff);\n        strm.adler = 0; //crc32(0L, Z_NULL, 0);\n        s.status = BUSY_STATE;\n      }\n    }\n    else {\n      s.status = BUSY_STATE;\n    }\n  }\n//#endif\n\n  /* Flush as much pending output as possible */\n  if (s.pending !== 0) {\n    flush_pending(strm);\n    if (strm.avail_out === 0) {\n      /* Since avail_out is 0, deflate will be called again with\n       * more output space, but possibly with both pending and\n       * avail_in equal to zero. There won't be anything to do,\n       * but this is not an error situation so make sure we\n       * return OK instead of BUF_ERROR at next call of deflate:\n       */\n      s.last_flush = -1;\n      return Z_OK;\n    }\n\n    /* Make sure there is something to do and avoid duplicate consecutive\n     * flushes. For repeated and useless calls with Z_FINISH, we keep\n     * returning Z_STREAM_END instead of Z_BUF_ERROR.\n     */\n  } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n    flush !== Z_FINISH) {\n    return err(strm, Z_BUF_ERROR);\n  }\n\n  /* User must not provide more input after the first FINISH: */\n  if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n    return err(strm, Z_BUF_ERROR);\n  }\n\n  /* Start a new block or continue the current one.\n   */\n  if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n    (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n    var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n      (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n        configuration_table[s.level].func(s, flush));\n\n    if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n      s.status = FINISH_STATE;\n    }\n    if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n      if (strm.avail_out === 0) {\n        s.last_flush = -1;\n        /* avoid BUF_ERROR next call, see above */\n      }\n      return Z_OK;\n      /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n       * of deflate should use the same flush parameter to make sure\n       * that the flush is complete. So we don't have to output an\n       * empty block here, this will be done at next call. This also\n       * ensures that for a very small output buffer, we emit at most\n       * one empty block.\n       */\n    }\n    if (bstate === BS_BLOCK_DONE) {\n      if (flush === Z_PARTIAL_FLUSH) {\n        trees._tr_align(s);\n      }\n      else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n        trees._tr_stored_block(s, 0, 0, false);\n        /* For a full flush, this empty block will be recognized\n         * as a special marker by inflate_sync().\n         */\n        if (flush === Z_FULL_FLUSH) {\n          /*** CLEAR_HASH(s); ***/             /* forget history */\n          zero(s.head); // Fill with NIL (= 0);\n\n          if (s.lookahead === 0) {\n            s.strstart = 0;\n            s.block_start = 0;\n            s.insert = 0;\n          }\n        }\n      }\n      flush_pending(strm);\n      if (strm.avail_out === 0) {\n        s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n        return Z_OK;\n      }\n    }\n  }\n  //Assert(strm->avail_out > 0, \"bug2\");\n  //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n  if (flush !== Z_FINISH) { return Z_OK; }\n  if (s.wrap <= 0) { return Z_STREAM_END; }\n\n  /* Write the trailer */\n  if (s.wrap === 2) {\n    put_byte(s, strm.adler & 0xff);\n    put_byte(s, (strm.adler >> 8) & 0xff);\n    put_byte(s, (strm.adler >> 16) & 0xff);\n    put_byte(s, (strm.adler >> 24) & 0xff);\n    put_byte(s, strm.total_in & 0xff);\n    put_byte(s, (strm.total_in >> 8) & 0xff);\n    put_byte(s, (strm.total_in >> 16) & 0xff);\n    put_byte(s, (strm.total_in >> 24) & 0xff);\n  }\n  else\n  {\n    putShortMSB(s, strm.adler >>> 16);\n    putShortMSB(s, strm.adler & 0xffff);\n  }\n\n  flush_pending(strm);\n  /* If avail_out is zero, the application will call deflate again\n   * to flush the rest.\n   */\n  if (s.wrap > 0) { s.wrap = -s.wrap; }\n  /* write the trailer only once! */\n  return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n  var status;\n\n  if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n    return Z_STREAM_ERROR;\n  }\n\n  status = strm.state.status;\n  if (status !== INIT_STATE &&\n    status !== EXTRA_STATE &&\n    status !== NAME_STATE &&\n    status !== COMMENT_STATE &&\n    status !== HCRC_STATE &&\n    status !== BUSY_STATE &&\n    status !== FINISH_STATE\n  ) {\n    return err(strm, Z_STREAM_ERROR);\n  }\n\n  strm.state = null;\n\n  return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n  var dictLength = dictionary.length;\n\n  var s;\n  var str, n;\n  var wrap;\n  var avail;\n  var next;\n  var input;\n  var tmpDict;\n\n  if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n    return Z_STREAM_ERROR;\n  }\n\n  s = strm.state;\n  wrap = s.wrap;\n\n  if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n    return Z_STREAM_ERROR;\n  }\n\n  /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n  if (wrap === 1) {\n    /* adler32(strm->adler, dictionary, dictLength); */\n    strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n  }\n\n  s.wrap = 0;   /* avoid computing Adler-32 in read_buf */\n\n  /* if dictionary would fill window, just replace the history */\n  if (dictLength >= s.w_size) {\n    if (wrap === 0) {            /* already empty otherwise */\n      /*** CLEAR_HASH(s); ***/\n      zero(s.head); // Fill with NIL (= 0);\n      s.strstart = 0;\n      s.block_start = 0;\n      s.insert = 0;\n    }\n    /* use the tail */\n    // dictionary = dictionary.slice(dictLength - s.w_size);\n    tmpDict = new utils.Buf8(s.w_size);\n    utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n    dictionary = tmpDict;\n    dictLength = s.w_size;\n  }\n  /* insert dictionary into window and hash */\n  avail = strm.avail_in;\n  next = strm.next_in;\n  input = strm.input;\n  strm.avail_in = dictLength;\n  strm.next_in = 0;\n  strm.input = dictionary;\n  fill_window(s);\n  while (s.lookahead >= MIN_MATCH) {\n    str = s.strstart;\n    n = s.lookahead - (MIN_MATCH - 1);\n    do {\n      /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n      s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n      s.head[s.ins_h] = str;\n      str++;\n    } while (--n);\n    s.strstart = str;\n    s.lookahead = MIN_MATCH - 1;\n    fill_window(s);\n  }\n  s.strstart += s.lookahead;\n  s.block_start = s.strstart;\n  s.insert = s.lookahead;\n  s.lookahead = 0;\n  s.match_length = s.prev_length = MIN_MATCH - 1;\n  s.match_available = 0;\n  strm.next_in = next;\n  strm.input = input;\n  strm.avail_in = avail;\n  s.wrap = wrap;\n  return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n\n},{\"../utils/common\":39,\"./adler32\":41,\"./crc32\":43,\"./messages\":49,\"./trees\":50}],45:[function(require,module,exports){\n'use strict';\n\n\nfunction GZheader() {\n  /* true if compressed data believed to be text */\n  this.text       = 0;\n  /* modification time */\n  this.time       = 0;\n  /* extra flags (not used when writing a gzip file) */\n  this.xflags     = 0;\n  /* operating system */\n  this.os         = 0;\n  /* pointer to extra field or Z_NULL if none */\n  this.extra      = null;\n  /* extra field length (valid if extra != Z_NULL) */\n  this.extra_len  = 0; // Actually, we don't need it in JS,\n                       // but leave for few code modifications\n\n  //\n  // Setup limits is not necessary because in js we should not preallocate memory\n  // for inflate use constant limit in 65536 bytes\n  //\n\n  /* space at extra (only when reading header) */\n  // this.extra_max  = 0;\n  /* pointer to zero-terminated file name or Z_NULL */\n  this.name       = '';\n  /* space at name (only when reading header) */\n  // this.name_max   = 0;\n  /* pointer to zero-terminated comment or Z_NULL */\n  this.comment    = '';\n  /* space at comment (only when reading header) */\n  // this.comm_max   = 0;\n  /* true if there was or will be a header crc */\n  this.hcrc       = 0;\n  /* true when done reading gzip header (not used when writing a gzip file) */\n  this.done       = false;\n}\n\nmodule.exports = GZheader;\n\n},{}],46:[function(require,module,exports){\n'use strict';\n\n// See state defs from inflate.js\nvar BAD = 30;       /* got a data error -- remain here until reset */\nvar TYPE = 12;      /* i: waiting for type bits, including last-flag bit */\n\n/*\n   Decode literal, length, and distance codes and write out the resulting\n   literal and match bytes until either not enough input or output is\n   available, an end-of-block is encountered, or a data error is encountered.\n   When large enough input and output buffers are supplied to inflate(), for\n   example, a 16K input buffer and a 64K output buffer, more than 95% of the\n   inflate execution time is spent in this routine.\n\n   Entry assumptions:\n\n        state.mode === LEN\n        strm.avail_in >= 6\n        strm.avail_out >= 258\n        start >= strm.avail_out\n        state.bits < 8\n\n   On return, state.mode is one of:\n\n        LEN -- ran out of enough output space or enough available input\n        TYPE -- reached end of block code, inflate() to interpret next block\n        BAD -- error in block data\n\n   Notes:\n\n    - The maximum input bits used by a length/distance pair is 15 bits for the\n      length code, 5 bits for the length extra, 15 bits for the distance code,\n      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.\n      Therefore if strm.avail_in >= 6, then there is enough input to avoid\n      checking for available input while decoding.\n\n    - The maximum bytes that a single length/distance pair can output is 258\n      bytes, which is the maximum length that can be coded.  inflate_fast()\n      requires strm.avail_out >= 258 for each loop to avoid checking for\n      output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n  var state;\n  var _in;                    /* local strm.input */\n  var last;                   /* have enough input while in < last */\n  var _out;                   /* local strm.output */\n  var beg;                    /* inflate()'s initial strm.output */\n  var end;                    /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n  var dmax;                   /* maximum distance from zlib header */\n//#endif\n  var wsize;                  /* window size or zero if not using window */\n  var whave;                  /* valid bytes in the window */\n  var wnext;                  /* window write index */\n  // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n  var s_window;               /* allocated sliding window, if wsize != 0 */\n  var hold;                   /* local strm.hold */\n  var bits;                   /* local strm.bits */\n  var lcode;                  /* local strm.lencode */\n  var dcode;                  /* local strm.distcode */\n  var lmask;                  /* mask for first level of length codes */\n  var dmask;                  /* mask for first level of distance codes */\n  var here;                   /* retrieved table entry */\n  var op;                     /* code bits, operation, extra bits, or */\n                              /*  window position, window bytes to copy */\n  var len;                    /* match length, unused bytes */\n  var dist;                   /* match distance */\n  var from;                   /* where to copy match from */\n  var from_source;\n\n\n  var input, output; // JS specific, because we have no pointers\n\n  /* copy state to local variables */\n  state = strm.state;\n  //here = state.here;\n  _in = strm.next_in;\n  input = strm.input;\n  last = _in + (strm.avail_in - 5);\n  _out = strm.next_out;\n  output = strm.output;\n  beg = _out - (start - strm.avail_out);\n  end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n  dmax = state.dmax;\n//#endif\n  wsize = state.wsize;\n  whave = state.whave;\n  wnext = state.wnext;\n  s_window = state.window;\n  hold = state.hold;\n  bits = state.bits;\n  lcode = state.lencode;\n  dcode = state.distcode;\n  lmask = (1 << state.lenbits) - 1;\n  dmask = (1 << state.distbits) - 1;\n\n\n  /* decode literals and length/distances until end-of-block or not enough\n     input data or output space */\n\n  top:\n  do {\n    if (bits < 15) {\n      hold += input[_in++] << bits;\n      bits += 8;\n      hold += input[_in++] << bits;\n      bits += 8;\n    }\n\n    here = lcode[hold & lmask];\n\n    dolen:\n    for (;;) { // Goto emulation\n      op = here >>> 24/*here.bits*/;\n      hold >>>= op;\n      bits -= op;\n      op = (here >>> 16) & 0xff/*here.op*/;\n      if (op === 0) {                          /* literal */\n        //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n        //        \"inflate:         literal '%c'\\n\" :\n        //        \"inflate:         literal 0x%02x\\n\", here.val));\n        output[_out++] = here & 0xffff/*here.val*/;\n      }\n      else if (op & 16) {                     /* length base */\n        len = here & 0xffff/*here.val*/;\n        op &= 15;                           /* number of extra bits */\n        if (op) {\n          if (bits < op) {\n            hold += input[_in++] << bits;\n            bits += 8;\n          }\n          len += hold & ((1 << op) - 1);\n          hold >>>= op;\n          bits -= op;\n        }\n        //Tracevv((stderr, \"inflate:         length %u\\n\", len));\n        if (bits < 15) {\n          hold += input[_in++] << bits;\n          bits += 8;\n          hold += input[_in++] << bits;\n          bits += 8;\n        }\n        here = dcode[hold & dmask];\n\n        dodist:\n        for (;;) { // goto emulation\n          op = here >>> 24/*here.bits*/;\n          hold >>>= op;\n          bits -= op;\n          op = (here >>> 16) & 0xff/*here.op*/;\n\n          if (op & 16) {                      /* distance base */\n            dist = here & 0xffff/*here.val*/;\n            op &= 15;                       /* number of extra bits */\n            if (bits < op) {\n              hold += input[_in++] << bits;\n              bits += 8;\n              if (bits < op) {\n                hold += input[_in++] << bits;\n                bits += 8;\n              }\n            }\n            dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n            if (dist > dmax) {\n              strm.msg = 'invalid distance too far back';\n              state.mode = BAD;\n              break top;\n            }\n//#endif\n            hold >>>= op;\n            bits -= op;\n            //Tracevv((stderr, \"inflate:         distance %u\\n\", dist));\n            op = _out - beg;                /* max distance in output */\n            if (dist > op) {                /* see if copy from window */\n              op = dist - op;               /* distance back in window */\n              if (op > whave) {\n                if (state.sane) {\n                  strm.msg = 'invalid distance too far back';\n                  state.mode = BAD;\n                  break top;\n                }\n\n// (!) This block is disabled in zlib defailts,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n//                if (len <= op - whave) {\n//                  do {\n//                    output[_out++] = 0;\n//                  } while (--len);\n//                  continue top;\n//                }\n//                len -= op - whave;\n//                do {\n//                  output[_out++] = 0;\n//                } while (--op > whave);\n//                if (op === 0) {\n//                  from = _out - dist;\n//                  do {\n//                    output[_out++] = output[from++];\n//                  } while (--len);\n//                  continue top;\n//                }\n//#endif\n              }\n              from = 0; // window index\n              from_source = s_window;\n              if (wnext === 0) {           /* very common case */\n                from += wsize - op;\n                if (op < len) {         /* some from window */\n                  len -= op;\n                  do {\n                    output[_out++] = s_window[from++];\n                  } while (--op);\n                  from = _out - dist;  /* rest from output */\n                  from_source = output;\n                }\n              }\n              else if (wnext < op) {      /* wrap around window */\n                from += wsize + wnext - op;\n                op -= wnext;\n                if (op < len) {         /* some from end of window */\n                  len -= op;\n                  do {\n                    output[_out++] = s_window[from++];\n                  } while (--op);\n                  from = 0;\n                  if (wnext < len) {  /* some from start of window */\n                    op = wnext;\n                    len -= op;\n                    do {\n                      output[_out++] = s_window[from++];\n                    } while (--op);\n                    from = _out - dist;      /* rest from output */\n                    from_source = output;\n                  }\n                }\n              }\n              else {                      /* contiguous in window */\n                from += wnext - op;\n                if (op < len) {         /* some from window */\n                  len -= op;\n                  do {\n                    output[_out++] = s_window[from++];\n                  } while (--op);\n                  from = _out - dist;  /* rest from output */\n                  from_source = output;\n                }\n              }\n              while (len > 2) {\n                output[_out++] = from_source[from++];\n                output[_out++] = from_source[from++];\n                output[_out++] = from_source[from++];\n                len -= 3;\n              }\n              if (len) {\n                output[_out++] = from_source[from++];\n                if (len > 1) {\n                  output[_out++] = from_source[from++];\n                }\n              }\n            }\n            else {\n              from = _out - dist;          /* copy direct from output */\n              do {                        /* minimum length is three */\n                output[_out++] = output[from++];\n                output[_out++] = output[from++];\n                output[_out++] = output[from++];\n                len -= 3;\n              } while (len > 2);\n              if (len) {\n                output[_out++] = output[from++];\n                if (len > 1) {\n                  output[_out++] = output[from++];\n                }\n              }\n            }\n          }\n          else if ((op & 64) === 0) {          /* 2nd level distance code */\n            here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n            continue dodist;\n          }\n          else {\n            strm.msg = 'invalid distance code';\n            state.mode = BAD;\n            break top;\n          }\n\n          break; // need to emulate goto via \"continue\"\n        }\n      }\n      else if ((op & 64) === 0) {              /* 2nd level length code */\n        here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n        continue dolen;\n      }\n      else if (op & 32) {                     /* end-of-block */\n        //Tracevv((stderr, \"inflate:         end of block\\n\"));\n        state.mode = TYPE;\n        break top;\n      }\n      else {\n        strm.msg = 'invalid literal/length code';\n        state.mode = BAD;\n        break top;\n      }\n\n      break; // need to emulate goto via \"continue\"\n    }\n  } while (_in < last && _out < end);\n\n  /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n  len = bits >> 3;\n  _in -= len;\n  bits -= len << 3;\n  hold &= (1 << bits) - 1;\n\n  /* update state and return */\n  strm.next_in = _in;\n  strm.next_out = _out;\n  strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n  strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n  state.hold = hold;\n  state.bits = bits;\n  return;\n};\n\n},{}],47:[function(require,module,exports){\n'use strict';\n\n\nvar utils         = require('../utils/common');\nvar adler32       = require('./adler32');\nvar crc32         = require('./crc32');\nvar inflate_fast  = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH      = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH    = 2;\n//var Z_FULL_FLUSH    = 3;\nvar Z_FINISH        = 4;\nvar Z_BLOCK         = 5;\nvar Z_TREES         = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK            = 0;\nvar Z_STREAM_END    = 1;\nvar Z_NEED_DICT     = 2;\n//var Z_ERRNO         = -1;\nvar Z_STREAM_ERROR  = -2;\nvar Z_DATA_ERROR    = -3;\nvar Z_MEM_ERROR     = -4;\nvar Z_BUF_ERROR     = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED  = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar    HEAD = 1;       /* i: waiting for magic header */\nvar    FLAGS = 2;      /* i: waiting for method and flags (gzip) */\nvar    TIME = 3;       /* i: waiting for modification time (gzip) */\nvar    OS = 4;         /* i: waiting for extra flags and operating system (gzip) */\nvar    EXLEN = 5;      /* i: waiting for extra length (gzip) */\nvar    EXTRA = 6;      /* i: waiting for extra bytes (gzip) */\nvar    NAME = 7;       /* i: waiting for end of file name (gzip) */\nvar    COMMENT = 8;    /* i: waiting for end of comment (gzip) */\nvar    HCRC = 9;       /* i: waiting for header crc (gzip) */\nvar    DICTID = 10;    /* i: waiting for dictionary check value */\nvar    DICT = 11;      /* waiting for inflateSetDictionary() call */\nvar        TYPE = 12;      /* i: waiting for type bits, including last-flag bit */\nvar        TYPEDO = 13;    /* i: same, but skip check to exit inflate on new block */\nvar        STORED = 14;    /* i: waiting for stored size (length and complement) */\nvar        COPY_ = 15;     /* i/o: same as COPY below, but only first time in */\nvar        COPY = 16;      /* i/o: waiting for input or output to copy stored block */\nvar        TABLE = 17;     /* i: waiting for dynamic block table lengths */\nvar        LENLENS = 18;   /* i: waiting for code length code lengths */\nvar        CODELENS = 19;  /* i: waiting for length/lit and distance code lengths */\nvar            LEN_ = 20;      /* i: same as LEN below, but only first time in */\nvar            LEN = 21;       /* i: waiting for length/lit/eob code */\nvar            LENEXT = 22;    /* i: waiting for length extra bits */\nvar            DIST = 23;      /* i: waiting for distance code */\nvar            DISTEXT = 24;   /* i: waiting for distance extra bits */\nvar            MATCH = 25;     /* o: waiting for output space to copy string */\nvar            LIT = 26;       /* o: waiting for output space to write literal */\nvar    CHECK = 27;     /* i: waiting for 32-bit check value */\nvar    LENGTH = 28;    /* i: waiting for 32-bit length (gzip) */\nvar    DONE = 29;      /* finished check, done -- remain here until reset */\nvar    BAD = 30;       /* got a data error -- remain here until reset */\nvar    MEM = 31;       /* got an inflate() memory error -- remain here until reset */\nvar    SYNC = 32;      /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH =  (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n  return  (((q >>> 24) & 0xff) +\n          ((q >>> 8) & 0xff00) +\n          ((q & 0xff00) << 8) +\n          ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n  this.mode = 0;             /* current inflate mode */\n  this.last = false;          /* true if processing last block */\n  this.wrap = 0;              /* bit 0 true for zlib, bit 1 true for gzip */\n  this.havedict = false;      /* true if dictionary provided */\n  this.flags = 0;             /* gzip header method and flags (0 if zlib) */\n  this.dmax = 0;              /* zlib header max distance (INFLATE_STRICT) */\n  this.check = 0;             /* protected copy of check value */\n  this.total = 0;             /* protected copy of output count */\n  // TODO: may be {}\n  this.head = null;           /* where to save gzip header information */\n\n  /* sliding window */\n  this.wbits = 0;             /* log base 2 of requested window size */\n  this.wsize = 0;             /* window size or zero if not using window */\n  this.whave = 0;             /* valid bytes in the window */\n  this.wnext = 0;             /* window write index */\n  this.window = null;         /* allocated sliding window, if needed */\n\n  /* bit accumulator */\n  this.hold = 0;              /* input bit accumulator */\n  this.bits = 0;              /* number of bits in \"in\" */\n\n  /* for string and stored block copying */\n  this.length = 0;            /* literal or length of data to copy */\n  this.offset = 0;            /* distance back to copy string from */\n\n  /* for table and code decoding */\n  this.extra = 0;             /* extra bits needed */\n\n  /* fixed and dynamic code tables */\n  this.lencode = null;          /* starting table for length/literal codes */\n  this.distcode = null;         /* starting table for distance codes */\n  this.lenbits = 0;           /* index bits for lencode */\n  this.distbits = 0;          /* index bits for distcode */\n\n  /* dynamic table building */\n  this.ncode = 0;             /* number of code length code lengths */\n  this.nlen = 0;              /* number of length code lengths */\n  this.ndist = 0;             /* number of distance code lengths */\n  this.have = 0;              /* number of code lengths in lens[] */\n  this.next = null;              /* next available space in codes[] */\n\n  this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n  this.work = new utils.Buf16(288); /* work area for code table building */\n\n  /*\n   because we don't have pointers in js, we use lencode and distcode directly\n   as buffers so we don't need codes\n  */\n  //this.codes = new utils.Buf32(ENOUGH);       /* space for code tables */\n  this.lendyn = null;              /* dynamic table for length/literal codes (JS specific) */\n  this.distdyn = null;             /* dynamic table for distance codes (JS specific) */\n  this.sane = 0;                   /* if false, allow invalid distance too far */\n  this.back = 0;                   /* bits back of last unprocessed length/lit */\n  this.was = 0;                    /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n  var state;\n\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n  state = strm.state;\n  strm.total_in = strm.total_out = state.total = 0;\n  strm.msg = ''; /*Z_NULL*/\n  if (state.wrap) {       /* to support ill-conceived Java test suite */\n    strm.adler = state.wrap & 1;\n  }\n  state.mode = HEAD;\n  state.last = 0;\n  state.havedict = 0;\n  state.dmax = 32768;\n  state.head = null/*Z_NULL*/;\n  state.hold = 0;\n  state.bits = 0;\n  //state.lencode = state.distcode = state.next = state.codes;\n  state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n  state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n  state.sane = 1;\n  state.back = -1;\n  //Tracev((stderr, \"inflate: reset\\n\"));\n  return Z_OK;\n}\n\nfunction inflateReset(strm) {\n  var state;\n\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n  state = strm.state;\n  state.wsize = 0;\n  state.whave = 0;\n  state.wnext = 0;\n  return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n  var wrap;\n  var state;\n\n  /* get the state */\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n  state = strm.state;\n\n  /* extract wrap request from windowBits parameter */\n  if (windowBits < 0) {\n    wrap = 0;\n    windowBits = -windowBits;\n  }\n  else {\n    wrap = (windowBits >> 4) + 1;\n    if (windowBits < 48) {\n      windowBits &= 15;\n    }\n  }\n\n  /* set number of window bits, free window if different */\n  if (windowBits && (windowBits < 8 || windowBits > 15)) {\n    return Z_STREAM_ERROR;\n  }\n  if (state.window !== null && state.wbits !== windowBits) {\n    state.window = null;\n  }\n\n  /* update state and reset the rest of it */\n  state.wrap = wrap;\n  state.wbits = windowBits;\n  return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n  var ret;\n  var state;\n\n  if (!strm) { return Z_STREAM_ERROR; }\n  //strm.msg = Z_NULL;                 /* in case we return an error */\n\n  state = new InflateState();\n\n  //if (state === Z_NULL) return Z_MEM_ERROR;\n  //Tracev((stderr, \"inflate: allocated\\n\"));\n  strm.state = state;\n  state.window = null/*Z_NULL*/;\n  ret = inflateReset2(strm, windowBits);\n  if (ret !== Z_OK) {\n    strm.state = null/*Z_NULL*/;\n  }\n  return ret;\n}\n\nfunction inflateInit(strm) {\n  return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding.  Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter.  This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time.  However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n  /* build fixed huffman tables if first call (may not be thread safe) */\n  if (virgin) {\n    var sym;\n\n    lenfix = new utils.Buf32(512);\n    distfix = new utils.Buf32(32);\n\n    /* literal/length table */\n    sym = 0;\n    while (sym < 144) { state.lens[sym++] = 8; }\n    while (sym < 256) { state.lens[sym++] = 9; }\n    while (sym < 280) { state.lens[sym++] = 7; }\n    while (sym < 288) { state.lens[sym++] = 8; }\n\n    inflate_table(LENS,  state.lens, 0, 288, lenfix,   0, state.work, { bits: 9 });\n\n    /* distance table */\n    sym = 0;\n    while (sym < 32) { state.lens[sym++] = 5; }\n\n    inflate_table(DISTS, state.lens, 0, 32,   distfix, 0, state.work, { bits: 5 });\n\n    /* do this just once */\n    virgin = false;\n  }\n\n  state.lencode = lenfix;\n  state.lenbits = 9;\n  state.distcode = distfix;\n  state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning.  If window does not exist yet, create it.  This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n  var dist;\n  var state = strm.state;\n\n  /* if it hasn't been done already, allocate space for the window */\n  if (state.window === null) {\n    state.wsize = 1 << state.wbits;\n    state.wnext = 0;\n    state.whave = 0;\n\n    state.window = new utils.Buf8(state.wsize);\n  }\n\n  /* copy state->wsize or less output bytes into the circular window */\n  if (copy >= state.wsize) {\n    utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n    state.wnext = 0;\n    state.whave = state.wsize;\n  }\n  else {\n    dist = state.wsize - state.wnext;\n    if (dist > copy) {\n      dist = copy;\n    }\n    //zmemcpy(state->window + state->wnext, end - copy, dist);\n    utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n    copy -= dist;\n    if (copy) {\n      //zmemcpy(state->window, end - copy, copy);\n      utils.arraySet(state.window, src, end - copy, copy, 0);\n      state.wnext = copy;\n      state.whave = state.wsize;\n    }\n    else {\n      state.wnext += dist;\n      if (state.wnext === state.wsize) { state.wnext = 0; }\n      if (state.whave < state.wsize) { state.whave += dist; }\n    }\n  }\n  return 0;\n}\n\nfunction inflate(strm, flush) {\n  var state;\n  var input, output;          // input/output buffers\n  var next;                   /* next input INDEX */\n  var put;                    /* next output INDEX */\n  var have, left;             /* available input and output */\n  var hold;                   /* bit buffer */\n  var bits;                   /* bits in bit buffer */\n  var _in, _out;              /* save starting available input and output */\n  var copy;                   /* number of stored or match bytes to copy */\n  var from;                   /* where to copy match bytes from */\n  var from_source;\n  var here = 0;               /* current decoding table entry */\n  var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n  //var last;                   /* parent table entry */\n  var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n  var len;                    /* length to copy for repeats, bits to drop */\n  var ret;                    /* return code */\n  var hbuf = new utils.Buf8(4);    /* buffer for gzip header crc calculation */\n  var opts;\n\n  var n; // temporary var for NEED_BITS\n\n  var order = /* permutation of code lengths */\n    [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n  if (!strm || !strm.state || !strm.output ||\n      (!strm.input && strm.avail_in !== 0)) {\n    return Z_STREAM_ERROR;\n  }\n\n  state = strm.state;\n  if (state.mode === TYPE) { state.mode = TYPEDO; }    /* skip check */\n\n\n  //--- LOAD() ---\n  put = strm.next_out;\n  output = strm.output;\n  left = strm.avail_out;\n  next = strm.next_in;\n  input = strm.input;\n  have = strm.avail_in;\n  hold = state.hold;\n  bits = state.bits;\n  //---\n\n  _in = have;\n  _out = left;\n  ret = Z_OK;\n\n  inf_leave: // goto emulation\n  for (;;) {\n    switch (state.mode) {\n    case HEAD:\n      if (state.wrap === 0) {\n        state.mode = TYPEDO;\n        break;\n      }\n      //=== NEEDBITS(16);\n      while (bits < 16) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      if ((state.wrap & 2) && hold === 0x8b1f) {  /* gzip header */\n        state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n        //=== CRC2(state.check, hold);\n        hbuf[0] = hold & 0xff;\n        hbuf[1] = (hold >>> 8) & 0xff;\n        state.check = crc32(state.check, hbuf, 2, 0);\n        //===//\n\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        state.mode = FLAGS;\n        break;\n      }\n      state.flags = 0;           /* expect zlib header */\n      if (state.head) {\n        state.head.done = false;\n      }\n      if (!(state.wrap & 1) ||   /* check if zlib header allowed */\n        (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n        strm.msg = 'incorrect header check';\n        state.mode = BAD;\n        break;\n      }\n      if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n        strm.msg = 'unknown compression method';\n        state.mode = BAD;\n        break;\n      }\n      //--- DROPBITS(4) ---//\n      hold >>>= 4;\n      bits -= 4;\n      //---//\n      len = (hold & 0x0f)/*BITS(4)*/ + 8;\n      if (state.wbits === 0) {\n        state.wbits = len;\n      }\n      else if (len > state.wbits) {\n        strm.msg = 'invalid window size';\n        state.mode = BAD;\n        break;\n      }\n      state.dmax = 1 << len;\n      //Tracev((stderr, \"inflate:   zlib header ok\\n\"));\n      strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n      state.mode = hold & 0x200 ? DICTID : TYPE;\n      //=== INITBITS();\n      hold = 0;\n      bits = 0;\n      //===//\n      break;\n    case FLAGS:\n      //=== NEEDBITS(16); */\n      while (bits < 16) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      state.flags = hold;\n      if ((state.flags & 0xff) !== Z_DEFLATED) {\n        strm.msg = 'unknown compression method';\n        state.mode = BAD;\n        break;\n      }\n      if (state.flags & 0xe000) {\n        strm.msg = 'unknown header flags set';\n        state.mode = BAD;\n        break;\n      }\n      if (state.head) {\n        state.head.text = ((hold >> 8) & 1);\n      }\n      if (state.flags & 0x0200) {\n        //=== CRC2(state.check, hold);\n        hbuf[0] = hold & 0xff;\n        hbuf[1] = (hold >>> 8) & 0xff;\n        state.check = crc32(state.check, hbuf, 2, 0);\n        //===//\n      }\n      //=== INITBITS();\n      hold = 0;\n      bits = 0;\n      //===//\n      state.mode = TIME;\n      /* falls through */\n    case TIME:\n      //=== NEEDBITS(32); */\n      while (bits < 32) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      if (state.head) {\n        state.head.time = hold;\n      }\n      if (state.flags & 0x0200) {\n        //=== CRC4(state.check, hold)\n        hbuf[0] = hold & 0xff;\n        hbuf[1] = (hold >>> 8) & 0xff;\n        hbuf[2] = (hold >>> 16) & 0xff;\n        hbuf[3] = (hold >>> 24) & 0xff;\n        state.check = crc32(state.check, hbuf, 4, 0);\n        //===\n      }\n      //=== INITBITS();\n      hold = 0;\n      bits = 0;\n      //===//\n      state.mode = OS;\n      /* falls through */\n    case OS:\n      //=== NEEDBITS(16); */\n      while (bits < 16) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      if (state.head) {\n        state.head.xflags = (hold & 0xff);\n        state.head.os = (hold >> 8);\n      }\n      if (state.flags & 0x0200) {\n        //=== CRC2(state.check, hold);\n        hbuf[0] = hold & 0xff;\n        hbuf[1] = (hold >>> 8) & 0xff;\n        state.check = crc32(state.check, hbuf, 2, 0);\n        //===//\n      }\n      //=== INITBITS();\n      hold = 0;\n      bits = 0;\n      //===//\n      state.mode = EXLEN;\n      /* falls through */\n    case EXLEN:\n      if (state.flags & 0x0400) {\n        //=== NEEDBITS(16); */\n        while (bits < 16) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        state.length = hold;\n        if (state.head) {\n          state.head.extra_len = hold;\n        }\n        if (state.flags & 0x0200) {\n          //=== CRC2(state.check, hold);\n          hbuf[0] = hold & 0xff;\n          hbuf[1] = (hold >>> 8) & 0xff;\n          state.check = crc32(state.check, hbuf, 2, 0);\n          //===//\n        }\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n      }\n      else if (state.head) {\n        state.head.extra = null/*Z_NULL*/;\n      }\n      state.mode = EXTRA;\n      /* falls through */\n    case EXTRA:\n      if (state.flags & 0x0400) {\n        copy = state.length;\n        if (copy > have) { copy = have; }\n        if (copy) {\n          if (state.head) {\n            len = state.head.extra_len - state.length;\n            if (!state.head.extra) {\n              // Use untyped array for more conveniend processing later\n              state.head.extra = new Array(state.head.extra_len);\n            }\n            utils.arraySet(\n              state.head.extra,\n              input,\n              next,\n              // extra field is limited to 65536 bytes\n              // - no need for additional size check\n              copy,\n              /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n              len\n            );\n            //zmemcpy(state.head.extra + len, next,\n            //        len + copy > state.head.extra_max ?\n            //        state.head.extra_max - len : copy);\n          }\n          if (state.flags & 0x0200) {\n            state.check = crc32(state.check, input, copy, next);\n          }\n          have -= copy;\n          next += copy;\n          state.length -= copy;\n        }\n        if (state.length) { break inf_leave; }\n      }\n      state.length = 0;\n      state.mode = NAME;\n      /* falls through */\n    case NAME:\n      if (state.flags & 0x0800) {\n        if (have === 0) { break inf_leave; }\n        copy = 0;\n        do {\n          // TODO: 2 or 1 bytes?\n          len = input[next + copy++];\n          /* use constant limit because in js we should not preallocate memory */\n          if (state.head && len &&\n              (state.length < 65536 /*state.head.name_max*/)) {\n            state.head.name += String.fromCharCode(len);\n          }\n        } while (len && copy < have);\n\n        if (state.flags & 0x0200) {\n          state.check = crc32(state.check, input, copy, next);\n        }\n        have -= copy;\n        next += copy;\n        if (len) { break inf_leave; }\n      }\n      else if (state.head) {\n        state.head.name = null;\n      }\n      state.length = 0;\n      state.mode = COMMENT;\n      /* falls through */\n    case COMMENT:\n      if (state.flags & 0x1000) {\n        if (have === 0) { break inf_leave; }\n        copy = 0;\n        do {\n          len = input[next + copy++];\n          /* use constant limit because in js we should not preallocate memory */\n          if (state.head && len &&\n              (state.length < 65536 /*state.head.comm_max*/)) {\n            state.head.comment += String.fromCharCode(len);\n          }\n        } while (len && copy < have);\n        if (state.flags & 0x0200) {\n          state.check = crc32(state.check, input, copy, next);\n        }\n        have -= copy;\n        next += copy;\n        if (len) { break inf_leave; }\n      }\n      else if (state.head) {\n        state.head.comment = null;\n      }\n      state.mode = HCRC;\n      /* falls through */\n    case HCRC:\n      if (state.flags & 0x0200) {\n        //=== NEEDBITS(16); */\n        while (bits < 16) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        if (hold !== (state.check & 0xffff)) {\n          strm.msg = 'header crc mismatch';\n          state.mode = BAD;\n          break;\n        }\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n      }\n      if (state.head) {\n        state.head.hcrc = ((state.flags >> 9) & 1);\n        state.head.done = true;\n      }\n      strm.adler = state.check = 0;\n      state.mode = TYPE;\n      break;\n    case DICTID:\n      //=== NEEDBITS(32); */\n      while (bits < 32) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      strm.adler = state.check = zswap32(hold);\n      //=== INITBITS();\n      hold = 0;\n      bits = 0;\n      //===//\n      state.mode = DICT;\n      /* falls through */\n    case DICT:\n      if (state.havedict === 0) {\n        //--- RESTORE() ---\n        strm.next_out = put;\n        strm.avail_out = left;\n        strm.next_in = next;\n        strm.avail_in = have;\n        state.hold = hold;\n        state.bits = bits;\n        //---\n        return Z_NEED_DICT;\n      }\n      strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n      state.mode = TYPE;\n      /* falls through */\n    case TYPE:\n      if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n      /* falls through */\n    case TYPEDO:\n      if (state.last) {\n        //--- BYTEBITS() ---//\n        hold >>>= bits & 7;\n        bits -= bits & 7;\n        //---//\n        state.mode = CHECK;\n        break;\n      }\n      //=== NEEDBITS(3); */\n      while (bits < 3) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      state.last = (hold & 0x01)/*BITS(1)*/;\n      //--- DROPBITS(1) ---//\n      hold >>>= 1;\n      bits -= 1;\n      //---//\n\n      switch ((hold & 0x03)/*BITS(2)*/) {\n      case 0:                             /* stored block */\n        //Tracev((stderr, \"inflate:     stored block%s\\n\",\n        //        state.last ? \" (last)\" : \"\"));\n        state.mode = STORED;\n        break;\n      case 1:                             /* fixed block */\n        fixedtables(state);\n        //Tracev((stderr, \"inflate:     fixed codes block%s\\n\",\n        //        state.last ? \" (last)\" : \"\"));\n        state.mode = LEN_;             /* decode codes */\n        if (flush === Z_TREES) {\n          //--- DROPBITS(2) ---//\n          hold >>>= 2;\n          bits -= 2;\n          //---//\n          break inf_leave;\n        }\n        break;\n      case 2:                             /* dynamic block */\n        //Tracev((stderr, \"inflate:     dynamic codes block%s\\n\",\n        //        state.last ? \" (last)\" : \"\"));\n        state.mode = TABLE;\n        break;\n      case 3:\n        strm.msg = 'invalid block type';\n        state.mode = BAD;\n      }\n      //--- DROPBITS(2) ---//\n      hold >>>= 2;\n      bits -= 2;\n      //---//\n      break;\n    case STORED:\n      //--- BYTEBITS() ---// /* go to byte boundary */\n      hold >>>= bits & 7;\n      bits -= bits & 7;\n      //---//\n      //=== NEEDBITS(32); */\n      while (bits < 32) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n        strm.msg = 'invalid stored block lengths';\n        state.mode = BAD;\n        break;\n      }\n      state.length = hold & 0xffff;\n      //Tracev((stderr, \"inflate:       stored length %u\\n\",\n      //        state.length));\n      //=== INITBITS();\n      hold = 0;\n      bits = 0;\n      //===//\n      state.mode = COPY_;\n      if (flush === Z_TREES) { break inf_leave; }\n      /* falls through */\n    case COPY_:\n      state.mode = COPY;\n      /* falls through */\n    case COPY:\n      copy = state.length;\n      if (copy) {\n        if (copy > have) { copy = have; }\n        if (copy > left) { copy = left; }\n        if (copy === 0) { break inf_leave; }\n        //--- zmemcpy(put, next, copy); ---\n        utils.arraySet(output, input, next, copy, put);\n        //---//\n        have -= copy;\n        next += copy;\n        left -= copy;\n        put += copy;\n        state.length -= copy;\n        break;\n      }\n      //Tracev((stderr, \"inflate:       stored end\\n\"));\n      state.mode = TYPE;\n      break;\n    case TABLE:\n      //=== NEEDBITS(14); */\n      while (bits < 14) {\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n      }\n      //===//\n      state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n      //--- DROPBITS(5) ---//\n      hold >>>= 5;\n      bits -= 5;\n      //---//\n      state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n      //--- DROPBITS(5) ---//\n      hold >>>= 5;\n      bits -= 5;\n      //---//\n      state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n      //--- DROPBITS(4) ---//\n      hold >>>= 4;\n      bits -= 4;\n      //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n      if (state.nlen > 286 || state.ndist > 30) {\n        strm.msg = 'too many length or distance symbols';\n        state.mode = BAD;\n        break;\n      }\n//#endif\n      //Tracev((stderr, \"inflate:       table sizes ok\\n\"));\n      state.have = 0;\n      state.mode = LENLENS;\n      /* falls through */\n    case LENLENS:\n      while (state.have < state.ncode) {\n        //=== NEEDBITS(3);\n        while (bits < 3) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n        //--- DROPBITS(3) ---//\n        hold >>>= 3;\n        bits -= 3;\n        //---//\n      }\n      while (state.have < 19) {\n        state.lens[order[state.have++]] = 0;\n      }\n      // We have separate tables & no pointers. 2 commented lines below not needed.\n      //state.next = state.codes;\n      //state.lencode = state.next;\n      // Switch to use dynamic table\n      state.lencode = state.lendyn;\n      state.lenbits = 7;\n\n      opts = { bits: state.lenbits };\n      ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n      state.lenbits = opts.bits;\n\n      if (ret) {\n        strm.msg = 'invalid code lengths set';\n        state.mode = BAD;\n        break;\n      }\n      //Tracev((stderr, \"inflate:       code lengths ok\\n\"));\n      state.have = 0;\n      state.mode = CODELENS;\n      /* falls through */\n    case CODELENS:\n      while (state.have < state.nlen + state.ndist) {\n        for (;;) {\n          here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n          here_bits = here >>> 24;\n          here_op = (here >>> 16) & 0xff;\n          here_val = here & 0xffff;\n\n          if ((here_bits) <= bits) { break; }\n          //--- PULLBYTE() ---//\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n          //---//\n        }\n        if (here_val < 16) {\n          //--- DROPBITS(here.bits) ---//\n          hold >>>= here_bits;\n          bits -= here_bits;\n          //---//\n          state.lens[state.have++] = here_val;\n        }\n        else {\n          if (here_val === 16) {\n            //=== NEEDBITS(here.bits + 2);\n            n = here_bits + 2;\n            while (bits < n) {\n              if (have === 0) { break inf_leave; }\n              have--;\n              hold += input[next++] << bits;\n              bits += 8;\n            }\n            //===//\n            //--- DROPBITS(here.bits) ---//\n            hold >>>= here_bits;\n            bits -= here_bits;\n            //---//\n            if (state.have === 0) {\n              strm.msg = 'invalid bit length repeat';\n              state.mode = BAD;\n              break;\n            }\n            len = state.lens[state.have - 1];\n            copy = 3 + (hold & 0x03);//BITS(2);\n            //--- DROPBITS(2) ---//\n            hold >>>= 2;\n            bits -= 2;\n            //---//\n          }\n          else if (here_val === 17) {\n            //=== NEEDBITS(here.bits + 3);\n            n = here_bits + 3;\n            while (bits < n) {\n              if (have === 0) { break inf_leave; }\n              have--;\n              hold += input[next++] << bits;\n              bits += 8;\n            }\n            //===//\n            //--- DROPBITS(here.bits) ---//\n            hold >>>= here_bits;\n            bits -= here_bits;\n            //---//\n            len = 0;\n            copy = 3 + (hold & 0x07);//BITS(3);\n            //--- DROPBITS(3) ---//\n            hold >>>= 3;\n            bits -= 3;\n            //---//\n          }\n          else {\n            //=== NEEDBITS(here.bits + 7);\n            n = here_bits + 7;\n            while (bits < n) {\n              if (have === 0) { break inf_leave; }\n              have--;\n              hold += input[next++] << bits;\n              bits += 8;\n            }\n            //===//\n            //--- DROPBITS(here.bits) ---//\n            hold >>>= here_bits;\n            bits -= here_bits;\n            //---//\n            len = 0;\n            copy = 11 + (hold & 0x7f);//BITS(7);\n            //--- DROPBITS(7) ---//\n            hold >>>= 7;\n            bits -= 7;\n            //---//\n          }\n          if (state.have + copy > state.nlen + state.ndist) {\n            strm.msg = 'invalid bit length repeat';\n            state.mode = BAD;\n            break;\n          }\n          while (copy--) {\n            state.lens[state.have++] = len;\n          }\n        }\n      }\n\n      /* handle error breaks in while */\n      if (state.mode === BAD) { break; }\n\n      /* check for end-of-block code (better have one) */\n      if (state.lens[256] === 0) {\n        strm.msg = 'invalid code -- missing end-of-block';\n        state.mode = BAD;\n        break;\n      }\n\n      /* build code tables -- note: do not change the lenbits or distbits\n         values here (9 and 6) without reading the comments in inftrees.h\n         concerning the ENOUGH constants, which depend on those values */\n      state.lenbits = 9;\n\n      opts = { bits: state.lenbits };\n      ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n      // We have separate tables & no pointers. 2 commented lines below not needed.\n      // state.next_index = opts.table_index;\n      state.lenbits = opts.bits;\n      // state.lencode = state.next;\n\n      if (ret) {\n        strm.msg = 'invalid literal/lengths set';\n        state.mode = BAD;\n        break;\n      }\n\n      state.distbits = 6;\n      //state.distcode.copy(state.codes);\n      // Switch to use dynamic table\n      state.distcode = state.distdyn;\n      opts = { bits: state.distbits };\n      ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n      // We have separate tables & no pointers. 2 commented lines below not needed.\n      // state.next_index = opts.table_index;\n      state.distbits = opts.bits;\n      // state.distcode = state.next;\n\n      if (ret) {\n        strm.msg = 'invalid distances set';\n        state.mode = BAD;\n        break;\n      }\n      //Tracev((stderr, 'inflate:       codes ok\\n'));\n      state.mode = LEN_;\n      if (flush === Z_TREES) { break inf_leave; }\n      /* falls through */\n    case LEN_:\n      state.mode = LEN;\n      /* falls through */\n    case LEN:\n      if (have >= 6 && left >= 258) {\n        //--- RESTORE() ---\n        strm.next_out = put;\n        strm.avail_out = left;\n        strm.next_in = next;\n        strm.avail_in = have;\n        state.hold = hold;\n        state.bits = bits;\n        //---\n        inflate_fast(strm, _out);\n        //--- LOAD() ---\n        put = strm.next_out;\n        output = strm.output;\n        left = strm.avail_out;\n        next = strm.next_in;\n        input = strm.input;\n        have = strm.avail_in;\n        hold = state.hold;\n        bits = state.bits;\n        //---\n\n        if (state.mode === TYPE) {\n          state.back = -1;\n        }\n        break;\n      }\n      state.back = 0;\n      for (;;) {\n        here = state.lencode[hold & ((1 << state.lenbits) - 1)];  /*BITS(state.lenbits)*/\n        here_bits = here >>> 24;\n        here_op = (here >>> 16) & 0xff;\n        here_val = here & 0xffff;\n\n        if (here_bits <= bits) { break; }\n        //--- PULLBYTE() ---//\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n        //---//\n      }\n      if (here_op && (here_op & 0xf0) === 0) {\n        last_bits = here_bits;\n        last_op = here_op;\n        last_val = here_val;\n        for (;;) {\n          here = state.lencode[last_val +\n                  ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n          here_bits = here >>> 24;\n          here_op = (here >>> 16) & 0xff;\n          here_val = here & 0xffff;\n\n          if ((last_bits + here_bits) <= bits) { break; }\n          //--- PULLBYTE() ---//\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n          //---//\n        }\n        //--- DROPBITS(last.bits) ---//\n        hold >>>= last_bits;\n        bits -= last_bits;\n        //---//\n        state.back += last_bits;\n      }\n      //--- DROPBITS(here.bits) ---//\n      hold >>>= here_bits;\n      bits -= here_bits;\n      //---//\n      state.back += here_bits;\n      state.length = here_val;\n      if (here_op === 0) {\n        //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n        //        \"inflate:         literal '%c'\\n\" :\n        //        \"inflate:         literal 0x%02x\\n\", here.val));\n        state.mode = LIT;\n        break;\n      }\n      if (here_op & 32) {\n        //Tracevv((stderr, \"inflate:         end of block\\n\"));\n        state.back = -1;\n        state.mode = TYPE;\n        break;\n      }\n      if (here_op & 64) {\n        strm.msg = 'invalid literal/length code';\n        state.mode = BAD;\n        break;\n      }\n      state.extra = here_op & 15;\n      state.mode = LENEXT;\n      /* falls through */\n    case LENEXT:\n      if (state.extra) {\n        //=== NEEDBITS(state.extra);\n        n = state.extra;\n        while (bits < n) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n        //--- DROPBITS(state.extra) ---//\n        hold >>>= state.extra;\n        bits -= state.extra;\n        //---//\n        state.back += state.extra;\n      }\n      //Tracevv((stderr, \"inflate:         length %u\\n\", state.length));\n      state.was = state.length;\n      state.mode = DIST;\n      /* falls through */\n    case DIST:\n      for (;;) {\n        here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n        here_bits = here >>> 24;\n        here_op = (here >>> 16) & 0xff;\n        here_val = here & 0xffff;\n\n        if ((here_bits) <= bits) { break; }\n        //--- PULLBYTE() ---//\n        if (have === 0) { break inf_leave; }\n        have--;\n        hold += input[next++] << bits;\n        bits += 8;\n        //---//\n      }\n      if ((here_op & 0xf0) === 0) {\n        last_bits = here_bits;\n        last_op = here_op;\n        last_val = here_val;\n        for (;;) {\n          here = state.distcode[last_val +\n                  ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n          here_bits = here >>> 24;\n          here_op = (here >>> 16) & 0xff;\n          here_val = here & 0xffff;\n\n          if ((last_bits + here_bits) <= bits) { break; }\n          //--- PULLBYTE() ---//\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n          //---//\n        }\n        //--- DROPBITS(last.bits) ---//\n        hold >>>= last_bits;\n        bits -= last_bits;\n        //---//\n        state.back += last_bits;\n      }\n      //--- DROPBITS(here.bits) ---//\n      hold >>>= here_bits;\n      bits -= here_bits;\n      //---//\n      state.back += here_bits;\n      if (here_op & 64) {\n        strm.msg = 'invalid distance code';\n        state.mode = BAD;\n        break;\n      }\n      state.offset = here_val;\n      state.extra = (here_op) & 15;\n      state.mode = DISTEXT;\n      /* falls through */\n    case DISTEXT:\n      if (state.extra) {\n        //=== NEEDBITS(state.extra);\n        n = state.extra;\n        while (bits < n) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n        //--- DROPBITS(state.extra) ---//\n        hold >>>= state.extra;\n        bits -= state.extra;\n        //---//\n        state.back += state.extra;\n      }\n//#ifdef INFLATE_STRICT\n      if (state.offset > state.dmax) {\n        strm.msg = 'invalid distance too far back';\n        state.mode = BAD;\n        break;\n      }\n//#endif\n      //Tracevv((stderr, \"inflate:         distance %u\\n\", state.offset));\n      state.mode = MATCH;\n      /* falls through */\n    case MATCH:\n      if (left === 0) { break inf_leave; }\n      copy = _out - left;\n      if (state.offset > copy) {         /* copy from window */\n        copy = state.offset - copy;\n        if (copy > state.whave) {\n          if (state.sane) {\n            strm.msg = 'invalid distance too far back';\n            state.mode = BAD;\n            break;\n          }\n// (!) This block is disabled in zlib defailts,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n//          Trace((stderr, \"inflate.c too far\\n\"));\n//          copy -= state.whave;\n//          if (copy > state.length) { copy = state.length; }\n//          if (copy > left) { copy = left; }\n//          left -= copy;\n//          state.length -= copy;\n//          do {\n//            output[put++] = 0;\n//          } while (--copy);\n//          if (state.length === 0) { state.mode = LEN; }\n//          break;\n//#endif\n        }\n        if (copy > state.wnext) {\n          copy -= state.wnext;\n          from = state.wsize - copy;\n        }\n        else {\n          from = state.wnext - copy;\n        }\n        if (copy > state.length) { copy = state.length; }\n        from_source = state.window;\n      }\n      else {                              /* copy from output */\n        from_source = output;\n        from = put - state.offset;\n        copy = state.length;\n      }\n      if (copy > left) { copy = left; }\n      left -= copy;\n      state.length -= copy;\n      do {\n        output[put++] = from_source[from++];\n      } while (--copy);\n      if (state.length === 0) { state.mode = LEN; }\n      break;\n    case LIT:\n      if (left === 0) { break inf_leave; }\n      output[put++] = state.length;\n      left--;\n      state.mode = LEN;\n      break;\n    case CHECK:\n      if (state.wrap) {\n        //=== NEEDBITS(32);\n        while (bits < 32) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          // Use '|' insdead of '+' to make sure that result is signed\n          hold |= input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        _out -= left;\n        strm.total_out += _out;\n        state.total += _out;\n        if (_out) {\n          strm.adler = state.check =\n              /*UPDATE(state.check, put - _out, _out);*/\n              (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n        }\n        _out = left;\n        // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n        if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n          strm.msg = 'incorrect data check';\n          state.mode = BAD;\n          break;\n        }\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        //Tracev((stderr, \"inflate:   check matches trailer\\n\"));\n      }\n      state.mode = LENGTH;\n      /* falls through */\n    case LENGTH:\n      if (state.wrap && state.flags) {\n        //=== NEEDBITS(32);\n        while (bits < 32) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        if (hold !== (state.total & 0xffffffff)) {\n          strm.msg = 'incorrect length check';\n          state.mode = BAD;\n          break;\n        }\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        //Tracev((stderr, \"inflate:   length matches trailer\\n\"));\n      }\n      state.mode = DONE;\n      /* falls through */\n    case DONE:\n      ret = Z_STREAM_END;\n      break inf_leave;\n    case BAD:\n      ret = Z_DATA_ERROR;\n      break inf_leave;\n    case MEM:\n      return Z_MEM_ERROR;\n    case SYNC:\n      /* falls through */\n    default:\n      return Z_STREAM_ERROR;\n    }\n  }\n\n  // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n  /*\n     Return from inflate(), updating the total counts and the check value.\n     If there was no progress during the inflate() call, return a buffer\n     error.  Call updatewindow() to create and/or update the window state.\n     Note: a memory error from inflate() is non-recoverable.\n   */\n\n  //--- RESTORE() ---\n  strm.next_out = put;\n  strm.avail_out = left;\n  strm.next_in = next;\n  strm.avail_in = have;\n  state.hold = hold;\n  state.bits = bits;\n  //---\n\n  if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n                      (state.mode < CHECK || flush !== Z_FINISH))) {\n    if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n      state.mode = MEM;\n      return Z_MEM_ERROR;\n    }\n  }\n  _in -= strm.avail_in;\n  _out -= strm.avail_out;\n  strm.total_in += _in;\n  strm.total_out += _out;\n  state.total += _out;\n  if (state.wrap && _out) {\n    strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n      (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n  }\n  strm.data_type = state.bits + (state.last ? 64 : 0) +\n                    (state.mode === TYPE ? 128 : 0) +\n                    (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n  if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n    ret = Z_BUF_ERROR;\n  }\n  return ret;\n}\n\nfunction inflateEnd(strm) {\n\n  if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n    return Z_STREAM_ERROR;\n  }\n\n  var state = strm.state;\n  if (state.window) {\n    state.window = null;\n  }\n  strm.state = null;\n  return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n  var state;\n\n  /* check state */\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n  state = strm.state;\n  if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n  /* save header structure */\n  state.head = head;\n  head.done = false;\n  return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n  var dictLength = dictionary.length;\n\n  var state;\n  var dictid;\n  var ret;\n\n  /* check state */\n  if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n  state = strm.state;\n\n  if (state.wrap !== 0 && state.mode !== DICT) {\n    return Z_STREAM_ERROR;\n  }\n\n  /* check for correct dictionary identifier */\n  if (state.mode === DICT) {\n    dictid = 1; /* adler32(0, null, 0)*/\n    /* dictid = adler32(dictid, dictionary, dictLength); */\n    dictid = adler32(dictid, dictionary, dictLength, 0);\n    if (dictid !== state.check) {\n      return Z_DATA_ERROR;\n    }\n  }\n  /* copy dictionary to window using updatewindow(), which will amend the\n   existing dictionary if appropriate */\n  ret = updatewindow(strm, dictionary, dictLength, dictLength);\n  if (ret) {\n    state.mode = MEM;\n    return Z_MEM_ERROR;\n  }\n  state.havedict = 1;\n  // Tracev((stderr, \"inflate:   dictionary set\\n\"));\n  return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n\n},{\"../utils/common\":39,\"./adler32\":41,\"./crc32\":43,\"./inffast\":46,\"./inftrees\":48}],48:[function(require,module,exports){\n'use strict';\n\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n  3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n  35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n  16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n  19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n  1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n  257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n  8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n  16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n  23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n  28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n  var bits = opts.bits;\n      //here = opts.here; /* table entry for duplication */\n\n  var len = 0;               /* a code's length in bits */\n  var sym = 0;               /* index of code symbols */\n  var min = 0, max = 0;          /* minimum and maximum code lengths */\n  var root = 0;              /* number of index bits for root table */\n  var curr = 0;              /* number of index bits for current table */\n  var drop = 0;              /* code bits to drop for sub-table */\n  var left = 0;                   /* number of prefix codes available */\n  var used = 0;              /* code entries in table used */\n  var huff = 0;              /* Huffman code */\n  var incr;              /* for incrementing code, index */\n  var fill;              /* index for replicating entries */\n  var low;               /* low bits for current root entry */\n  var mask;              /* mask for low root bits */\n  var next;             /* next available space in table */\n  var base = null;     /* base value table to use */\n  var base_index = 0;\n//  var shoextra;    /* extra bits table to use */\n  var end;                    /* use base and extra for symbol > end */\n  var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];    /* number of codes of each length */\n  var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];     /* offsets in table for each length */\n  var extra = null;\n  var extra_index = 0;\n\n  var here_bits, here_op, here_val;\n\n  /*\n   Process a set of code lengths to create a canonical Huffman code.  The\n   code lengths are lens[0..codes-1].  Each length corresponds to the\n   symbols 0..codes-1.  The Huffman code is generated by first sorting the\n   symbols by length from short to long, and retaining the symbol order\n   for codes with equal lengths.  Then the code starts with all zero bits\n   for the first code of the shortest length, and the codes are integer\n   increments for the same length, and zeros are appended as the length\n   increases.  For the deflate format, these bits are stored backwards\n   from their more natural integer increment ordering, and so when the\n   decoding tables are built in the large loop below, the integer codes\n   are incremented backwards.\n\n   This routine assumes, but does not check, that all of the entries in\n   lens[] are in the range 0..MAXBITS.  The caller must assure this.\n   1..MAXBITS is interpreted as that code length.  zero means that that\n   symbol does not occur in this code.\n\n   The codes are sorted by computing a count of codes for each length,\n   creating from that a table of starting indices for each length in the\n   sorted table, and then entering the symbols in order in the sorted\n   table.  The sorted table is work[], with that space being provided by\n   the caller.\n\n   The length counts are used for other purposes as well, i.e. finding\n   the minimum and maximum length codes, determining if there are any\n   codes at all, checking for a valid set of lengths, and looking ahead\n   at length counts to determine sub-table sizes when building the\n   decoding tables.\n   */\n\n  /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n  for (len = 0; len <= MAXBITS; len++) {\n    count[len] = 0;\n  }\n  for (sym = 0; sym < codes; sym++) {\n    count[lens[lens_index + sym]]++;\n  }\n\n  /* bound code lengths, force root to be within code lengths */\n  root = bits;\n  for (max = MAXBITS; max >= 1; max--) {\n    if (count[max] !== 0) { break; }\n  }\n  if (root > max) {\n    root = max;\n  }\n  if (max === 0) {                     /* no symbols to code at all */\n    //table.op[opts.table_index] = 64;  //here.op = (var char)64;    /* invalid code marker */\n    //table.bits[opts.table_index] = 1;   //here.bits = (var char)1;\n    //table.val[opts.table_index++] = 0;   //here.val = (var short)0;\n    table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n    //table.op[opts.table_index] = 64;\n    //table.bits[opts.table_index] = 1;\n    //table.val[opts.table_index++] = 0;\n    table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n    opts.bits = 1;\n    return 0;     /* no symbols, but wait for decoding to report error */\n  }\n  for (min = 1; min < max; min++) {\n    if (count[min] !== 0) { break; }\n  }\n  if (root < min) {\n    root = min;\n  }\n\n  /* check for an over-subscribed or incomplete set of lengths */\n  left = 1;\n  for (len = 1; len <= MAXBITS; len++) {\n    left <<= 1;\n    left -= count[len];\n    if (left < 0) {\n      return -1;\n    }        /* over-subscribed */\n  }\n  if (left > 0 && (type === CODES || max !== 1)) {\n    return -1;                      /* incomplete set */\n  }\n\n  /* generate offsets into symbol table for each length for sorting */\n  offs[1] = 0;\n  for (len = 1; len < MAXBITS; len++) {\n    offs[len + 1] = offs[len] + count[len];\n  }\n\n  /* sort symbols by length, by symbol order within each length */\n  for (sym = 0; sym < codes; sym++) {\n    if (lens[lens_index + sym] !== 0) {\n      work[offs[lens[lens_index + sym]]++] = sym;\n    }\n  }\n\n  /*\n   Create and fill in decoding tables.  In this loop, the table being\n   filled is at next and has curr index bits.  The code being used is huff\n   with length len.  That code is converted to an index by dropping drop\n   bits off of the bottom.  For codes where len is less than drop + curr,\n   those top drop + curr - len bits are incremented through all values to\n   fill the table with replicated entries.\n\n   root is the number of index bits for the root table.  When len exceeds\n   root, sub-tables are created pointed to by the root entry with an index\n   of the low root bits of huff.  This is saved in low to check for when a\n   new sub-table should be started.  drop is zero when the root table is\n   being filled, and drop is root when sub-tables are being filled.\n\n   When a new sub-table is needed, it is necessary to look ahead in the\n   code lengths to determine what size sub-table is needed.  The length\n   counts are used for this, and so count[] is decremented as codes are\n   entered in the tables.\n\n   used keeps track of how many table entries have been allocated from the\n   provided *table space.  It is checked for LENS and DIST tables against\n   the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n   the initial root table size constants.  See the comments in inftrees.h\n   for more information.\n\n   sym increments through all symbols, and the loop terminates when\n   all codes of length max, i.e. all codes, have been processed.  This\n   routine permits incomplete codes, so another loop after this one fills\n   in the rest of the decoding tables with invalid code markers.\n   */\n\n  /* set up for code type */\n  // poor man optimization - use if-else instead of switch,\n  // to avoid deopts in old v8\n  if (type === CODES) {\n    base = extra = work;    /* dummy value--not used */\n    end = 19;\n\n  } else if (type === LENS) {\n    base = lbase;\n    base_index -= 257;\n    extra = lext;\n    extra_index -= 257;\n    end = 256;\n\n  } else {                    /* DISTS */\n    base = dbase;\n    extra = dext;\n    end = -1;\n  }\n\n  /* initialize opts for loop */\n  huff = 0;                   /* starting code */\n  sym = 0;                    /* starting code symbol */\n  len = min;                  /* starting code length */\n  next = table_index;              /* current table to fill in */\n  curr = root;                /* current table index bits */\n  drop = 0;                   /* current bits to drop from code for index */\n  low = -1;                   /* trigger new sub-table when len > root */\n  used = 1 << root;          /* use root table entries */\n  mask = used - 1;            /* mask for comparing low */\n\n  /* check available table space */\n  if ((type === LENS && used > ENOUGH_LENS) ||\n    (type === DISTS && used > ENOUGH_DISTS)) {\n    return 1;\n  }\n\n  var i = 0;\n  /* process all codes and make table entries */\n  for (;;) {\n    i++;\n    /* create table entry */\n    here_bits = len - drop;\n    if (work[sym] < end) {\n      here_op = 0;\n      here_val = work[sym];\n    }\n    else if (work[sym] > end) {\n      here_op = extra[extra_index + work[sym]];\n      here_val = base[base_index + work[sym]];\n    }\n    else {\n      here_op = 32 + 64;         /* end of block */\n      here_val = 0;\n    }\n\n    /* replicate for those indices with low len bits equal to huff */\n    incr = 1 << (len - drop);\n    fill = 1 << curr;\n    min = fill;                 /* save offset to next table */\n    do {\n      fill -= incr;\n      table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n    } while (fill !== 0);\n\n    /* backwards increment the len-bit code huff */\n    incr = 1 << (len - 1);\n    while (huff & incr) {\n      incr >>= 1;\n    }\n    if (incr !== 0) {\n      huff &= incr - 1;\n      huff += incr;\n    } else {\n      huff = 0;\n    }\n\n    /* go to next symbol, update count, len */\n    sym++;\n    if (--count[len] === 0) {\n      if (len === max) { break; }\n      len = lens[lens_index + work[sym]];\n    }\n\n    /* create new sub-table if needed */\n    if (len > root && (huff & mask) !== low) {\n      /* if first time, transition to sub-tables */\n      if (drop === 0) {\n        drop = root;\n      }\n\n      /* increment past last table */\n      next += min;            /* here min is 1 << curr */\n\n      /* determine length of next table */\n      curr = len - drop;\n      left = 1 << curr;\n      while (curr + drop < max) {\n        left -= count[curr + drop];\n        if (left <= 0) { break; }\n        curr++;\n        left <<= 1;\n      }\n\n      /* check for enough space */\n      used += 1 << curr;\n      if ((type === LENS && used > ENOUGH_LENS) ||\n        (type === DISTS && used > ENOUGH_DISTS)) {\n        return 1;\n      }\n\n      /* point entry in root table to sub-table */\n      low = huff & mask;\n      /*table.op[low] = curr;\n      table.bits[low] = root;\n      table.val[low] = next - opts.table_index;*/\n      table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n    }\n  }\n\n  /* fill in remaining table entry if code is incomplete (guaranteed to have\n   at most one remaining entry, since if the code is incomplete, the\n   maximum code length that was allowed to get this far is one bit) */\n  if (huff !== 0) {\n    //table.op[next + huff] = 64;            /* invalid code marker */\n    //table.bits[next + huff] = len - drop;\n    //table.val[next + huff] = 0;\n    table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n  }\n\n  /* set return parameters */\n  //opts.table_index += used;\n  opts.bits = root;\n  return 0;\n};\n\n},{\"../utils/common\":39}],49:[function(require,module,exports){\n'use strict';\n\nmodule.exports = {\n  2:      'need dictionary',     /* Z_NEED_DICT       2  */\n  1:      'stream end',          /* Z_STREAM_END      1  */\n  0:      '',                    /* Z_OK              0  */\n  '-1':   'file error',          /* Z_ERRNO         (-1) */\n  '-2':   'stream error',        /* Z_STREAM_ERROR  (-2) */\n  '-3':   'data error',          /* Z_DATA_ERROR    (-3) */\n  '-4':   'insufficient memory', /* Z_MEM_ERROR     (-4) */\n  '-5':   'buffer error',        /* Z_BUF_ERROR     (-5) */\n  '-6':   'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n\n},{}],50:[function(require,module,exports){\n'use strict';\n\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED          = 1;\n//var Z_HUFFMAN_ONLY      = 2;\n//var Z_RLE               = 3;\nvar Z_FIXED               = 4;\n//var Z_DEFAULT_STRATEGY  = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY              = 0;\nvar Z_TEXT                = 1;\n//var Z_ASCII             = 1; // = Z_TEXT\nvar Z_UNKNOWN             = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES    = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH    = 3;\nvar MAX_MATCH    = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES  = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS      = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES       = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES       = 30;\n/* number of distance codes */\n\nvar BL_CODES      = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE     = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS      = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size      = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK   = 256;\n/* end of block literal code */\n\nvar REP_3_6     = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10   = 17;\n/* repeat a zero length 3-10 times  (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times  (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits =   /* extra bits for each length code */\n  [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits =   /* extra bits for each distance code */\n  [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits =  /* extra bits for each bit length code */\n  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n  [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree  = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree  = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code    = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code  = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length   = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist     = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n  this.static_tree  = static_tree;  /* static tree or NULL */\n  this.extra_bits   = extra_bits;   /* extra bits for each code or NULL */\n  this.extra_base   = extra_base;   /* base index for extra_bits */\n  this.elems        = elems;        /* max number of elements in the tree */\n  this.max_length   = max_length;   /* max bit length for the codes */\n\n  // show if `static_tree` has data or dummy - needed for monomorphic objects\n  this.has_stree    = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n  this.dyn_tree = dyn_tree;     /* the dynamic tree */\n  this.max_code = 0;            /* largest code with non zero frequency */\n  this.stat_desc = stat_desc;   /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n  return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n//    put_byte(s, (uch)((w) & 0xff));\n//    put_byte(s, (uch)((ush)(w) >> 8));\n  s.pending_buf[s.pending++] = (w) & 0xff;\n  s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n  if (s.bi_valid > (Buf_size - length)) {\n    s.bi_buf |= (value << s.bi_valid) & 0xffff;\n    put_short(s, s.bi_buf);\n    s.bi_buf = value >> (Buf_size - s.bi_valid);\n    s.bi_valid += length - Buf_size;\n  } else {\n    s.bi_buf |= (value << s.bi_valid) & 0xffff;\n    s.bi_valid += length;\n  }\n}\n\n\nfunction send_code(s, c, tree) {\n  send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n  var res = 0;\n  do {\n    res |= code & 1;\n    code >>>= 1;\n    res <<= 1;\n  } while (--len > 0);\n  return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n  if (s.bi_valid === 16) {\n    put_short(s, s.bi_buf);\n    s.bi_buf = 0;\n    s.bi_valid = 0;\n\n  } else if (s.bi_valid >= 8) {\n    s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n    s.bi_buf >>= 8;\n    s.bi_valid -= 8;\n  }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n *    above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n *     array bl_count contains the frequencies for each bit length.\n *     The length opt_len is updated; static_len is also updated if stree is\n *     not null.\n */\nfunction gen_bitlen(s, desc)\n//    deflate_state *s;\n//    tree_desc *desc;    /* the tree descriptor */\n{\n  var tree            = desc.dyn_tree;\n  var max_code        = desc.max_code;\n  var stree           = desc.stat_desc.static_tree;\n  var has_stree       = desc.stat_desc.has_stree;\n  var extra           = desc.stat_desc.extra_bits;\n  var base            = desc.stat_desc.extra_base;\n  var max_length      = desc.stat_desc.max_length;\n  var h;              /* heap index */\n  var n, m;           /* iterate over the tree elements */\n  var bits;           /* bit length */\n  var xbits;          /* extra bits */\n  var f;              /* frequency */\n  var overflow = 0;   /* number of elements with bit length too large */\n\n  for (bits = 0; bits <= MAX_BITS; bits++) {\n    s.bl_count[bits] = 0;\n  }\n\n  /* In a first pass, compute the optimal bit lengths (which may\n   * overflow in the case of the bit length tree).\n   */\n  tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n  for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n    n = s.heap[h];\n    bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n    if (bits > max_length) {\n      bits = max_length;\n      overflow++;\n    }\n    tree[n * 2 + 1]/*.Len*/ = bits;\n    /* We overwrite tree[n].Dad which is no longer needed */\n\n    if (n > max_code) { continue; } /* not a leaf node */\n\n    s.bl_count[bits]++;\n    xbits = 0;\n    if (n >= base) {\n      xbits = extra[n - base];\n    }\n    f = tree[n * 2]/*.Freq*/;\n    s.opt_len += f * (bits + xbits);\n    if (has_stree) {\n      s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n    }\n  }\n  if (overflow === 0) { return; }\n\n  // Trace((stderr,\"\\nbit length overflow\\n\"));\n  /* This happens for example on obj2 and pic of the Calgary corpus */\n\n  /* Find the first bit length which could increase: */\n  do {\n    bits = max_length - 1;\n    while (s.bl_count[bits] === 0) { bits--; }\n    s.bl_count[bits]--;      /* move one leaf down the tree */\n    s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n    s.bl_count[max_length]--;\n    /* The brother of the overflow item also moves one step up,\n     * but this does not affect bl_count[max_length]\n     */\n    overflow -= 2;\n  } while (overflow > 0);\n\n  /* Now recompute all bit lengths, scanning in increasing frequency.\n   * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n   * lengths instead of fixing only the wrong ones. This idea is taken\n   * from 'ar' written by Haruhiko Okumura.)\n   */\n  for (bits = max_length; bits !== 0; bits--) {\n    n = s.bl_count[bits];\n    while (n !== 0) {\n      m = s.heap[--h];\n      if (m > max_code) { continue; }\n      if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n        // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n        s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n        tree[m * 2 + 1]/*.Len*/ = bits;\n      }\n      n--;\n    }\n  }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n *     zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n//    ct_data *tree;             /* the tree to decorate */\n//    int max_code;              /* largest code with non zero frequency */\n//    ushf *bl_count;            /* number of codes at each bit length */\n{\n  var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n  var code = 0;              /* running code value */\n  var bits;                  /* bit index */\n  var n;                     /* code index */\n\n  /* The distribution counts are first used to generate the code values\n   * without bit reversal.\n   */\n  for (bits = 1; bits <= MAX_BITS; bits++) {\n    next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n  }\n  /* Check that the bit counts in bl_count are consistent. The last code\n   * must be all ones.\n   */\n  //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n  //        \"inconsistent bit counts\");\n  //Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n  for (n = 0;  n <= max_code; n++) {\n    var len = tree[n * 2 + 1]/*.Len*/;\n    if (len === 0) { continue; }\n    /* Now reverse the bits */\n    tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);\n\n    //Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n    //     n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n  }\n}\n\n\n/* ===========================================================================\n * Initialize the various 'constant' tables.\n */\nfunction tr_static_init() {\n  var n;        /* iterates over tree elements */\n  var bits;     /* bit counter */\n  var length;   /* length value */\n  var code;     /* code value */\n  var dist;     /* distance index */\n  var bl_count = new Array(MAX_BITS + 1);\n  /* number of codes at each bit length for an optimal tree */\n\n  // do check in _tr_init()\n  //if (static_init_done) return;\n\n  /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n  static_l_desc.static_tree = static_ltree;\n  static_l_desc.extra_bits = extra_lbits;\n  static_d_desc.static_tree = static_dtree;\n  static_d_desc.extra_bits = extra_dbits;\n  static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n  /* Initialize the mapping length (0..255) -> length code (0..28) */\n  length = 0;\n  for (code = 0; code < LENGTH_CODES - 1; code++) {\n    base_length[code] = length;\n    for (n = 0; n < (1 << extra_lbits[code]); n++) {\n      _length_code[length++] = code;\n    }\n  }\n  //Assert (length == 256, \"tr_static_init: length != 256\");\n  /* Note that the length 255 (match length 258) can be represented\n   * in two different ways: code 284 + 5 bits or code 285, so we\n   * overwrite length_code[255] to use the best encoding:\n   */\n  _length_code[length - 1] = code;\n\n  /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n  dist = 0;\n  for (code = 0; code < 16; code++) {\n    base_dist[code] = dist;\n    for (n = 0; n < (1 << extra_dbits[code]); n++) {\n      _dist_code[dist++] = code;\n    }\n  }\n  //Assert (dist == 256, \"tr_static_init: dist != 256\");\n  dist >>= 7; /* from now on, all distances are divided by 128 */\n  for (; code < D_CODES; code++) {\n    base_dist[code] = dist << 7;\n    for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n      _dist_code[256 + dist++] = code;\n    }\n  }\n  //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n  /* Construct the codes of the static literal tree */\n  for (bits = 0; bits <= MAX_BITS; bits++) {\n    bl_count[bits] = 0;\n  }\n\n  n = 0;\n  while (n <= 143) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 8;\n    n++;\n    bl_count[8]++;\n  }\n  while (n <= 255) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 9;\n    n++;\n    bl_count[9]++;\n  }\n  while (n <= 279) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 7;\n    n++;\n    bl_count[7]++;\n  }\n  while (n <= 287) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 8;\n    n++;\n    bl_count[8]++;\n  }\n  /* Codes 286 and 287 do not exist, but we must include them in the\n   * tree construction to get a canonical Huffman tree (longest code\n   * all ones)\n   */\n  gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n  /* The static distance tree is trivial: */\n  for (n = 0; n < D_CODES; n++) {\n    static_dtree[n * 2 + 1]/*.Len*/ = 5;\n    static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n  }\n\n  // Now data ready and we can init static trees\n  static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n  static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS);\n  static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0,         BL_CODES, MAX_BL_BITS);\n\n  //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n  var n; /* iterates over tree elements */\n\n  /* Initialize the trees. */\n  for (n = 0; n < L_CODES;  n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n  for (n = 0; n < D_CODES;  n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n  for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n  s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n  s.opt_len = s.static_len = 0;\n  s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n  if (s.bi_valid > 8) {\n    put_short(s, s.bi_buf);\n  } else if (s.bi_valid > 0) {\n    //put_byte(s, (Byte)s->bi_buf);\n    s.pending_buf[s.pending++] = s.bi_buf;\n  }\n  s.bi_buf = 0;\n  s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf    *buf;    /* the input data */\n//unsigned len;     /* its length */\n//int      header;  /* true if block header must be written */\n{\n  bi_windup(s);        /* align on byte boundary */\n\n  if (header) {\n    put_short(s, len);\n    put_short(s, ~len);\n  }\n//  while (len--) {\n//    put_byte(s, *buf++);\n//  }\n  utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n  s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n  var _n2 = n * 2;\n  var _m2 = m * 2;\n  return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n         (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n//    deflate_state *s;\n//    ct_data *tree;  /* the tree to restore */\n//    int k;               /* node to move down */\n{\n  var v = s.heap[k];\n  var j = k << 1;  /* left son of k */\n  while (j <= s.heap_len) {\n    /* Set j to the smallest of the two sons: */\n    if (j < s.heap_len &&\n      smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n      j++;\n    }\n    /* Exit if v is smaller than both sons */\n    if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n    /* Exchange v with the smallest son */\n    s.heap[k] = s.heap[j];\n    k = j;\n\n    /* And continue down the tree, setting j to the left son of k */\n    j <<= 1;\n  }\n  s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n//    deflate_state *s;\n//    const ct_data *ltree; /* literal tree */\n//    const ct_data *dtree; /* distance tree */\n{\n  var dist;           /* distance of matched string */\n  var lc;             /* match length or unmatched char (if dist == 0) */\n  var lx = 0;         /* running index in l_buf */\n  var code;           /* the code to send */\n  var extra;          /* number of extra bits to send */\n\n  if (s.last_lit !== 0) {\n    do {\n      dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n      lc = s.pending_buf[s.l_buf + lx];\n      lx++;\n\n      if (dist === 0) {\n        send_code(s, lc, ltree); /* send a literal byte */\n        //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n      } else {\n        /* Here, lc is the match length - MIN_MATCH */\n        code = _length_code[lc];\n        send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n        extra = extra_lbits[code];\n        if (extra !== 0) {\n          lc -= base_length[code];\n          send_bits(s, lc, extra);       /* send the extra length bits */\n        }\n        dist--; /* dist is now the match distance - 1 */\n        code = d_code(dist);\n        //Assert (code < D_CODES, \"bad d_code\");\n\n        send_code(s, code, dtree);       /* send the distance code */\n        extra = extra_dbits[code];\n        if (extra !== 0) {\n          dist -= base_dist[code];\n          send_bits(s, dist, extra);   /* send the extra distance bits */\n        }\n      } /* literal or match pair ? */\n\n      /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n      //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n      //       \"pendingBuf overflow\");\n\n    } while (lx < s.last_lit);\n  }\n\n  send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n *     and corresponding code. The length opt_len is updated; static_len is\n *     also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n//    deflate_state *s;\n//    tree_desc *desc; /* the tree descriptor */\n{\n  var tree     = desc.dyn_tree;\n  var stree    = desc.stat_desc.static_tree;\n  var has_stree = desc.stat_desc.has_stree;\n  var elems    = desc.stat_desc.elems;\n  var n, m;          /* iterate over heap elements */\n  var max_code = -1; /* largest code with non zero frequency */\n  var node;          /* new node being created */\n\n  /* Construct the initial heap, with least frequent element in\n   * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n   * heap[0] is not used.\n   */\n  s.heap_len = 0;\n  s.heap_max = HEAP_SIZE;\n\n  for (n = 0; n < elems; n++) {\n    if (tree[n * 2]/*.Freq*/ !== 0) {\n      s.heap[++s.heap_len] = max_code = n;\n      s.depth[n] = 0;\n\n    } else {\n      tree[n * 2 + 1]/*.Len*/ = 0;\n    }\n  }\n\n  /* The pkzip format requires that at least one distance code exists,\n   * and that at least one bit should be sent even if there is only one\n   * possible code. So to avoid special checks later on we force at least\n   * two codes of non zero frequency.\n   */\n  while (s.heap_len < 2) {\n    node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n    tree[node * 2]/*.Freq*/ = 1;\n    s.depth[node] = 0;\n    s.opt_len--;\n\n    if (has_stree) {\n      s.static_len -= stree[node * 2 + 1]/*.Len*/;\n    }\n    /* node is 0 or 1 so it does not have extra bits */\n  }\n  desc.max_code = max_code;\n\n  /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n   * establish sub-heaps of increasing lengths:\n   */\n  for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n  /* Construct the Huffman tree by repeatedly combining the least two\n   * frequent nodes.\n   */\n  node = elems;              /* next internal node of the tree */\n  do {\n    //pqremove(s, tree, n);  /* n = node of least frequency */\n    /*** pqremove ***/\n    n = s.heap[1/*SMALLEST*/];\n    s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n    pqdownheap(s, tree, 1/*SMALLEST*/);\n    /***/\n\n    m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n    s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n    s.heap[--s.heap_max] = m;\n\n    /* Create a new node father of n and m */\n    tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n    s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n    tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n    /* and insert the new node in the heap */\n    s.heap[1/*SMALLEST*/] = node++;\n    pqdownheap(s, tree, 1/*SMALLEST*/);\n\n  } while (s.heap_len >= 2);\n\n  s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n  /* At this point, the fields freq and dad are set. We can now\n   * generate the bit lengths.\n   */\n  gen_bitlen(s, desc);\n\n  /* The field len is now set, we can generate the bit codes */\n  gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n//    deflate_state *s;\n//    ct_data *tree;   /* the tree to be scanned */\n//    int max_code;    /* and its largest code of non zero frequency */\n{\n  var n;                     /* iterates over all tree elements */\n  var prevlen = -1;          /* last emitted length */\n  var curlen;                /* length of current code */\n\n  var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n  var count = 0;             /* repeat count of the current code */\n  var max_count = 7;         /* max repeat count */\n  var min_count = 4;         /* min repeat count */\n\n  if (nextlen === 0) {\n    max_count = 138;\n    min_count = 3;\n  }\n  tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n  for (n = 0; n <= max_code; n++) {\n    curlen = nextlen;\n    nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n    if (++count < max_count && curlen === nextlen) {\n      continue;\n\n    } else if (count < min_count) {\n      s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n    } else if (curlen !== 0) {\n\n      if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n      s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n    } else if (count <= 10) {\n      s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n    } else {\n      s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n    }\n\n    count = 0;\n    prevlen = curlen;\n\n    if (nextlen === 0) {\n      max_count = 138;\n      min_count = 3;\n\n    } else if (curlen === nextlen) {\n      max_count = 6;\n      min_count = 3;\n\n    } else {\n      max_count = 7;\n      min_count = 4;\n    }\n  }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n//    deflate_state *s;\n//    ct_data *tree; /* the tree to be scanned */\n//    int max_code;       /* and its largest code of non zero frequency */\n{\n  var n;                     /* iterates over all tree elements */\n  var prevlen = -1;          /* last emitted length */\n  var curlen;                /* length of current code */\n\n  var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n  var count = 0;             /* repeat count of the current code */\n  var max_count = 7;         /* max repeat count */\n  var min_count = 4;         /* min repeat count */\n\n  /* tree[max_code+1].Len = -1; */  /* guard already set */\n  if (nextlen === 0) {\n    max_count = 138;\n    min_count = 3;\n  }\n\n  for (n = 0; n <= max_code; n++) {\n    curlen = nextlen;\n    nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n    if (++count < max_count && curlen === nextlen) {\n      continue;\n\n    } else if (count < min_count) {\n      do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n    } else if (curlen !== 0) {\n      if (curlen !== prevlen) {\n        send_code(s, curlen, s.bl_tree);\n        count--;\n      }\n      //Assert(count >= 3 && count <= 6, \" 3_6?\");\n      send_code(s, REP_3_6, s.bl_tree);\n      send_bits(s, count - 3, 2);\n\n    } else if (count <= 10) {\n      send_code(s, REPZ_3_10, s.bl_tree);\n      send_bits(s, count - 3, 3);\n\n    } else {\n      send_code(s, REPZ_11_138, s.bl_tree);\n      send_bits(s, count - 11, 7);\n    }\n\n    count = 0;\n    prevlen = curlen;\n    if (nextlen === 0) {\n      max_count = 138;\n      min_count = 3;\n\n    } else if (curlen === nextlen) {\n      max_count = 6;\n      min_count = 3;\n\n    } else {\n      max_count = 7;\n      min_count = 4;\n    }\n  }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n  var max_blindex;  /* index of last bit length code of non zero freq */\n\n  /* Determine the bit length frequencies for literal and distance trees */\n  scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n  scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n  /* Build the bit length tree: */\n  build_tree(s, s.bl_desc);\n  /* opt_len now includes the length of the tree representations, except\n   * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n   */\n\n  /* Determine the number of bit length codes to send. The pkzip format\n   * requires that at least 4 bit length codes be sent. (appnote.txt says\n   * 3 but the actual value used is 4.)\n   */\n  for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n    if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n      break;\n    }\n  }\n  /* Update opt_len to include the bit length tree and counts */\n  s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n  //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n  //        s->opt_len, s->static_len));\n\n  return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n//    deflate_state *s;\n//    int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n  var rank;                    /* index in bl_order */\n\n  //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n  //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n  //        \"too many codes\");\n  //Tracev((stderr, \"\\nbl counts: \"));\n  send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n  send_bits(s, dcodes - 1,   5);\n  send_bits(s, blcodes - 4,  4); /* not -3 as stated in appnote.txt */\n  for (rank = 0; rank < blcodes; rank++) {\n    //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n    send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n  }\n  //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n  send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n  //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n  send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n  //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n *    a) There are no non-portable control characters belonging to the\n *       \"black list\" (0..6, 14..25, 28..31).\n *    b) There is at least one printable character belonging to the\n *       \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n *   \"gray list\" that is ignored in this detection algorithm:\n *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n  /* black_mask is the bit mask of black-listed bytes\n   * set bits 0..6, 14..25, and 28..31\n   * 0xf3ffc07f = binary 11110011111111111100000001111111\n   */\n  var black_mask = 0xf3ffc07f;\n  var n;\n\n  /* Check for non-textual (\"black-listed\") bytes. */\n  for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n    if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n      return Z_BINARY;\n    }\n  }\n\n  /* Check for textual (\"white-listed\") bytes. */\n  if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n      s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n    return Z_TEXT;\n  }\n  for (n = 32; n < LITERALS; n++) {\n    if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n      return Z_TEXT;\n    }\n  }\n\n  /* There are no \"black-listed\" or \"white-listed\" bytes:\n   * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n   */\n  return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n  if (!static_init_done) {\n    tr_static_init();\n    static_init_done = true;\n  }\n\n  s.l_desc  = new TreeDesc(s.dyn_ltree, static_l_desc);\n  s.d_desc  = new TreeDesc(s.dyn_dtree, static_d_desc);\n  s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n  s.bi_buf = 0;\n  s.bi_valid = 0;\n\n  /* Initialize the first block of the first file: */\n  init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf;       /* input block */\n//ulg stored_len;   /* length of input block */\n//int last;         /* one if this is the last block for a file */\n{\n  send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3);    /* send block type */\n  copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n  send_bits(s, STATIC_TREES << 1, 3);\n  send_code(s, END_BLOCK, static_ltree);\n  bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf;       /* input block, or NULL if too old */\n//ulg stored_len;   /* length of input block */\n//int last;         /* one if this is the last block for a file */\n{\n  var opt_lenb, static_lenb;  /* opt_len and static_len in bytes */\n  var max_blindex = 0;        /* index of last bit length code of non zero freq */\n\n  /* Build the Huffman trees unless a stored block is forced */\n  if (s.level > 0) {\n\n    /* Check if the file is binary or text */\n    if (s.strm.data_type === Z_UNKNOWN) {\n      s.strm.data_type = detect_data_type(s);\n    }\n\n    /* Construct the literal and distance trees */\n    build_tree(s, s.l_desc);\n    // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n    //        s->static_len));\n\n    build_tree(s, s.d_desc);\n    // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n    //        s->static_len));\n    /* At this point, opt_len and static_len are the total bit lengths of\n     * the compressed block data, excluding the tree representations.\n     */\n\n    /* Build the bit length tree for the above two trees, and get the index\n     * in bl_order of the last bit length code to send.\n     */\n    max_blindex = build_bl_tree(s);\n\n    /* Determine the best encoding. Compute the block lengths in bytes. */\n    opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n    static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n    // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n    //        opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n    //        s->last_lit));\n\n    if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n  } else {\n    // Assert(buf != (char*)0, \"lost buf\");\n    opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n  }\n\n  if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n    /* 4: two words for the lengths */\n\n    /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n     * Otherwise we can't have processed more than WSIZE input bytes since\n     * the last block flush, because compression would have been\n     * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n     * transform a block into a stored block.\n     */\n    _tr_stored_block(s, buf, stored_len, last);\n\n  } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n    send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n    compress_block(s, static_ltree, static_dtree);\n\n  } else {\n    send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n    send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n    compress_block(s, s.dyn_ltree, s.dyn_dtree);\n  }\n  // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n  /* The above check is made mod 2^32, for files larger than 512 MB\n   * and uLong implemented on 32 bits.\n   */\n  init_block(s);\n\n  if (last) {\n    bi_windup(s);\n  }\n  // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n  //       s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n//    deflate_state *s;\n//    unsigned dist;  /* distance of matched string */\n//    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n  //var out_length, in_length, dcode;\n\n  s.pending_buf[s.d_buf + s.last_lit * 2]     = (dist >>> 8) & 0xff;\n  s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n  s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n  s.last_lit++;\n\n  if (dist === 0) {\n    /* lc is the unmatched char */\n    s.dyn_ltree[lc * 2]/*.Freq*/++;\n  } else {\n    s.matches++;\n    /* Here, lc is the match length - MIN_MATCH */\n    dist--;             /* dist = match distance - 1 */\n    //Assert((ush)dist < (ush)MAX_DIST(s) &&\n    //       (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n    //       (ush)d_code(dist) < (ush)D_CODES,  \"_tr_tally: bad match\");\n\n    s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n    s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n  }\n\n// (!) This block is disabled in zlib defailts,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n//  /* Try to guess if it is profitable to stop the current block here */\n//  if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n//    /* Compute an upper bound for the compressed length */\n//    out_length = s.last_lit*8;\n//    in_length = s.strstart - s.block_start;\n//\n//    for (dcode = 0; dcode < D_CODES; dcode++) {\n//      out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n//    }\n//    out_length >>>= 3;\n//    //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n//    //       s->last_lit, in_length, out_length,\n//    //       100L - out_length*100L/in_length));\n//    if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n//      return true;\n//    }\n//  }\n//#endif\n\n  return (s.last_lit === s.lit_bufsize - 1);\n  /* We avoid equality with lit_bufsize because of wraparound at 64K\n   * on 16 bit machines and because stored blocks are restricted to\n   * 64K-1 bytes.\n   */\n}\n\nexports._tr_init  = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block  = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n\n},{\"../utils/common\":39}],51:[function(require,module,exports){\n'use strict';\n\n\nfunction ZStream() {\n  /* next input byte */\n  this.input = null; // JS specific, because we have no pointers\n  this.next_in = 0;\n  /* number of bytes available at input */\n  this.avail_in = 0;\n  /* total number of input bytes read so far */\n  this.total_in = 0;\n  /* next output byte should be put there */\n  this.output = null; // JS specific, because we have no pointers\n  this.next_out = 0;\n  /* remaining free space at output */\n  this.avail_out = 0;\n  /* total number of bytes output so far */\n  this.total_out = 0;\n  /* last error message, NULL if no error */\n  this.msg = ''/*Z_NULL*/;\n  /* not visible by applications */\n  this.state = null;\n  /* best guess about the data type: binary or text */\n  this.data_type = 2/*Z_UNKNOWN*/;\n  /* adler32 value of the uncompressed data */\n  this.adler = 0;\n}\n\nmodule.exports = ZStream;\n\n},{}],52:[function(require,module,exports){\n(function (process){\n'use strict';\n\nif (!process.version ||\n    process.version.indexOf('v0.') === 0 ||\n    process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n  module.exports = nextTick;\n} else {\n  module.exports = process.nextTick;\n}\n\nfunction nextTick(fn) {\n  var args = new Array(arguments.length - 1);\n  var i = 0;\n  while (i < args.length) {\n    args[i++] = arguments[i];\n  }\n  process.nextTick(function afterTick() {\n    fn.apply(null, args);\n  });\n}\n\n}).call(this,require('_process'))\n},{\"_process\":53}],53:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = setTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],54:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_duplex.js\")\n\n},{\"./lib/_stream_duplex.js\":55}],55:[function(require,module,exports){\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/*<replacement>*/\n\nvar objectKeys = Object.keys || function (obj) {\n  var keys = [];\n  for (var key in obj) {\n    keys.push(key);\n  }return keys;\n};\n/*</replacement>*/\n\nmodule.exports = Duplex;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nvar keys = objectKeys(Writable.prototype);\nfor (var v = 0; v < keys.length; v++) {\n  var method = keys[v];\n  if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n}\n\nfunction Duplex(options) {\n  if (!(this instanceof Duplex)) return new Duplex(options);\n\n  Readable.call(this, options);\n  Writable.call(this, options);\n\n  if (options && options.readable === false) this.readable = false;\n\n  if (options && options.writable === false) this.writable = false;\n\n  this.allowHalfOpen = true;\n  if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n  this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n  // if we allow half-open state, or if the writable side ended,\n  // then we're ok.\n  if (this.allowHalfOpen || this._writableState.ended) return;\n\n  // no more data can be written.\n  // But allow more writes to happen in this tick.\n  processNextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n  self.end();\n}\n\nfunction forEach(xs, f) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    f(xs[i], i);\n  }\n}\n},{\"./_stream_readable\":57,\"./_stream_writable\":59,\"core-util-is\":6,\"inherits\":10,\"process-nextick-args\":52}],56:[function(require,module,exports){\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n  if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n  Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n  cb(null, chunk);\n};\n},{\"./_stream_transform\":58,\"core-util-is\":6,\"inherits\":10}],57:[function(require,module,exports){\n(function (process){\n'use strict';\n\nmodule.exports = Readable;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n/*<replacement>*/\nvar isArray = require('isarray');\n/*</replacement>*/\n\n/*<replacement>*/\nvar Buffer = require('buffer').Buffer;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events');\n\n/*<replacement>*/\nvar EElistenerCount = function (emitter, type) {\n  return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream;\n(function () {\n  try {\n    Stream = require('st' + 'ream');\n  } catch (_) {} finally {\n    if (!Stream) Stream = require('events').EventEmitter;\n  }\n})();\n/*</replacement>*/\n\nvar Buffer = require('buffer').Buffer;\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n/*<replacement>*/\nvar debugUtil = require('util');\nvar debug = undefined;\nif (debugUtil && debugUtil.debuglog) {\n  debug = debugUtil.debuglog('stream');\n} else {\n  debug = function () {};\n}\n/*</replacement>*/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar Duplex;\nfunction ReadableState(options, stream) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  options = options || {};\n\n  // object stream flag. Used to make read(n) ignore n and to\n  // make all the buffer merging and length checks go away\n  this.objectMode = !!options.objectMode;\n\n  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n  // the point at which it stops calling _read() to fill the buffer\n  // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n  var hwm = options.highWaterMark;\n  var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;\n\n  // cast to ints.\n  this.highWaterMark = ~ ~this.highWaterMark;\n\n  this.buffer = [];\n  this.length = 0;\n  this.pipes = null;\n  this.pipesCount = 0;\n  this.flowing = null;\n  this.ended = false;\n  this.endEmitted = false;\n  this.reading = false;\n\n  // a flag to be able to tell if the onwrite cb is called immediately,\n  // or on a later tick.  We set this to true at first, because any\n  // actions that shouldn't happen until \"later\" should generally also\n  // not happen before the first write call.\n  this.sync = true;\n\n  // whenever we return null, then we set a flag to say\n  // that we're awaiting a 'readable' event emission.\n  this.needReadable = false;\n  this.emittedReadable = false;\n  this.readableListening = false;\n  this.resumeScheduled = false;\n\n  // Crypto is kind of old and crusty.  Historically, its default string\n  // encoding is 'binary' so we have to make this configurable.\n  // Everything else in the universe uses 'utf8', though.\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n  // when piping, we only care about 'readable' events that happen\n  // after read()ing all the bytes and not getting any pushback.\n  this.ranOut = false;\n\n  // the number of writers that are awaiting a drain event in .pipe()s\n  this.awaitDrain = 0;\n\n  // if true, a maybeReadMore has been scheduled\n  this.readingMore = false;\n\n  this.decoder = null;\n  this.encoding = null;\n  if (options.encoding) {\n    if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n    this.decoder = new StringDecoder(options.encoding);\n    this.encoding = options.encoding;\n  }\n}\n\nvar Duplex;\nfunction Readable(options) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  if (!(this instanceof Readable)) return new Readable(options);\n\n  this._readableState = new ReadableState(options, this);\n\n  // legacy\n  this.readable = true;\n\n  if (options && typeof options.read === 'function') this._read = options.read;\n\n  Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n  var state = this._readableState;\n\n  if (!state.objectMode && typeof chunk === 'string') {\n    encoding = encoding || state.defaultEncoding;\n    if (encoding !== state.encoding) {\n      chunk = new Buffer(chunk, encoding);\n      encoding = '';\n    }\n  }\n\n  return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n  var state = this._readableState;\n  return readableAddChunk(this, state, chunk, '', true);\n};\n\nReadable.prototype.isPaused = function () {\n  return this._readableState.flowing === false;\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n  var er = chunkInvalid(state, chunk);\n  if (er) {\n    stream.emit('error', er);\n  } else if (chunk === null) {\n    state.reading = false;\n    onEofChunk(stream, state);\n  } else if (state.objectMode || chunk && chunk.length > 0) {\n    if (state.ended && !addToFront) {\n      var e = new Error('stream.push() after EOF');\n      stream.emit('error', e);\n    } else if (state.endEmitted && addToFront) {\n      var e = new Error('stream.unshift() after end event');\n      stream.emit('error', e);\n    } else {\n      var skipAdd;\n      if (state.decoder && !addToFront && !encoding) {\n        chunk = state.decoder.write(chunk);\n        skipAdd = !state.objectMode && chunk.length === 0;\n      }\n\n      if (!addToFront) state.reading = false;\n\n      // Don't add to the buffer if we've decoded to an empty string chunk and\n      // we're not in object mode\n      if (!skipAdd) {\n        // if we want the data now, just emit it.\n        if (state.flowing && state.length === 0 && !state.sync) {\n          stream.emit('data', chunk);\n          stream.read(0);\n        } else {\n          // update the buffer info.\n          state.length += state.objectMode ? 1 : chunk.length;\n          if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n          if (state.needReadable) emitReadable(stream);\n        }\n      }\n\n      maybeReadMore(stream, state);\n    }\n  } else if (!addToFront) {\n    state.reading = false;\n  }\n\n  return needMoreData(state);\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes.  This is to work around cases where hwm=0,\n// such as the repl.  Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n  return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n  if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n  this._readableState.decoder = new StringDecoder(enc);\n  this._readableState.encoding = enc;\n  return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n  if (n >= MAX_HWM) {\n    n = MAX_HWM;\n  } else {\n    // Get the next highest power of 2\n    n--;\n    n |= n >>> 1;\n    n |= n >>> 2;\n    n |= n >>> 4;\n    n |= n >>> 8;\n    n |= n >>> 16;\n    n++;\n  }\n  return n;\n}\n\nfunction howMuchToRead(n, state) {\n  if (state.length === 0 && state.ended) return 0;\n\n  if (state.objectMode) return n === 0 ? 0 : 1;\n\n  if (n === null || isNaN(n)) {\n    // only flow one buffer at a time\n    if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length;\n  }\n\n  if (n <= 0) return 0;\n\n  // If we're asking for more than the target buffer level,\n  // then raise the water mark.  Bump up to the next highest\n  // power of 2, to prevent increasing it excessively in tiny\n  // amounts.\n  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n\n  // don't have that much.  return null, unless we've ended.\n  if (n > state.length) {\n    if (!state.ended) {\n      state.needReadable = true;\n      return 0;\n    } else {\n      return state.length;\n    }\n  }\n\n  return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n  debug('read', n);\n  var state = this._readableState;\n  var nOrig = n;\n\n  if (typeof n !== 'number' || n > 0) state.emittedReadable = false;\n\n  // if we're doing read(0) to trigger a readable event, but we\n  // already have a bunch of data in the buffer, then just trigger\n  // the 'readable' event and move on.\n  if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n    debug('read: emitReadable', state.length, state.ended);\n    if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n    return null;\n  }\n\n  n = howMuchToRead(n, state);\n\n  // if we've ended, and we're now clear, then finish it up.\n  if (n === 0 && state.ended) {\n    if (state.length === 0) endReadable(this);\n    return null;\n  }\n\n  // All the actual chunk generation logic needs to be\n  // *below* the call to _read.  The reason is that in certain\n  // synthetic stream cases, such as passthrough streams, _read\n  // may be a completely synchronous operation which may change\n  // the state of the read buffer, providing enough data when\n  // before there was *not* enough.\n  //\n  // So, the steps are:\n  // 1. Figure out what the state of things will be after we do\n  // a read from the buffer.\n  //\n  // 2. If that resulting state will trigger a _read, then call _read.\n  // Note that this may be asynchronous, or synchronous.  Yes, it is\n  // deeply ugly to write APIs this way, but that still doesn't mean\n  // that the Readable class should behave improperly, as streams are\n  // designed to be sync/async agnostic.\n  // Take note if the _read call is sync or async (ie, if the read call\n  // has returned yet), so that we know whether or not it's safe to emit\n  // 'readable' etc.\n  //\n  // 3. Actually pull the requested chunks out of the buffer and return.\n\n  // if we need a readable event, then we need to do some reading.\n  var doRead = state.needReadable;\n  debug('need readable', doRead);\n\n  // if we currently have less than the highWaterMark, then also read some\n  if (state.length === 0 || state.length - n < state.highWaterMark) {\n    doRead = true;\n    debug('length less than watermark', doRead);\n  }\n\n  // however, if we've ended, then there's no point, and if we're already\n  // reading, then it's unnecessary.\n  if (state.ended || state.reading) {\n    doRead = false;\n    debug('reading or ended', doRead);\n  }\n\n  if (doRead) {\n    debug('do read');\n    state.reading = true;\n    state.sync = true;\n    // if the length is currently zero, then we *need* a readable event.\n    if (state.length === 0) state.needReadable = true;\n    // call internal read method\n    this._read(state.highWaterMark);\n    state.sync = false;\n  }\n\n  // If _read pushed data synchronously, then `reading` will be false,\n  // and we need to re-evaluate how much data we can return to the user.\n  if (doRead && !state.reading) n = howMuchToRead(nOrig, state);\n\n  var ret;\n  if (n > 0) ret = fromList(n, state);else ret = null;\n\n  if (ret === null) {\n    state.needReadable = true;\n    n = 0;\n  }\n\n  state.length -= n;\n\n  // If we have nothing in the buffer, then we want to know\n  // as soon as we *do* get something into the buffer.\n  if (state.length === 0 && !state.ended) state.needReadable = true;\n\n  // If we tried to read() past the EOF, then emit end on the next tick.\n  if (nOrig !== n && state.ended && state.length === 0) endReadable(this);\n\n  if (ret !== null) this.emit('data', ret);\n\n  return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n  var er = null;\n  if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n    er = new TypeError('Invalid non-string/buffer chunk');\n  }\n  return er;\n}\n\nfunction onEofChunk(stream, state) {\n  if (state.ended) return;\n  if (state.decoder) {\n    var chunk = state.decoder.end();\n    if (chunk && chunk.length) {\n      state.buffer.push(chunk);\n      state.length += state.objectMode ? 1 : chunk.length;\n    }\n  }\n  state.ended = true;\n\n  // emit 'readable' now to make sure it gets picked up.\n  emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow.  This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n  var state = stream._readableState;\n  state.needReadable = false;\n  if (!state.emittedReadable) {\n    debug('emitReadable', state.flowing);\n    state.emittedReadable = true;\n    if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n  }\n}\n\nfunction emitReadable_(stream) {\n  debug('emit readable');\n  stream.emit('readable');\n  flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data.  that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n  if (!state.readingMore) {\n    state.readingMore = true;\n    processNextTick(maybeReadMore_, stream, state);\n  }\n}\n\nfunction maybeReadMore_(stream, state) {\n  var len = state.length;\n  while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n    debug('maybeReadMore read 0');\n    stream.read(0);\n    if (len === state.length)\n      // didn't get any data, stop spinning.\n      break;else len = state.length;\n  }\n  state.readingMore = false;\n}\n\n// abstract method.  to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n  this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n  var src = this;\n  var state = this._readableState;\n\n  switch (state.pipesCount) {\n    case 0:\n      state.pipes = dest;\n      break;\n    case 1:\n      state.pipes = [state.pipes, dest];\n      break;\n    default:\n      state.pipes.push(dest);\n      break;\n  }\n  state.pipesCount += 1;\n  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n  var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n  var endFn = doEnd ? onend : cleanup;\n  if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);\n\n  dest.on('unpipe', onunpipe);\n  function onunpipe(readable) {\n    debug('onunpipe');\n    if (readable === src) {\n      cleanup();\n    }\n  }\n\n  function onend() {\n    debug('onend');\n    dest.end();\n  }\n\n  // when the dest drains, it reduces the awaitDrain counter\n  // on the source.  This would be more elegant with a .once()\n  // handler in flow(), but adding and removing repeatedly is\n  // too slow.\n  var ondrain = pipeOnDrain(src);\n  dest.on('drain', ondrain);\n\n  var cleanedUp = false;\n  function cleanup() {\n    debug('cleanup');\n    // cleanup event handlers once the pipe is broken\n    dest.removeListener('close', onclose);\n    dest.removeListener('finish', onfinish);\n    dest.removeListener('drain', ondrain);\n    dest.removeListener('error', onerror);\n    dest.removeListener('unpipe', onunpipe);\n    src.removeListener('end', onend);\n    src.removeListener('end', cleanup);\n    src.removeListener('data', ondata);\n\n    cleanedUp = true;\n\n    // if the reader is waiting for a drain event from this\n    // specific writer, then it would cause it to never start\n    // flowing again.\n    // So, if this is awaiting a drain, then we just call it now.\n    // If we don't know, then assume that we are waiting for one.\n    if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n  }\n\n  src.on('data', ondata);\n  function ondata(chunk) {\n    debug('ondata');\n    var ret = dest.write(chunk);\n    if (false === ret) {\n      // If the user unpiped during `dest.write()`, it is possible\n      // to get stuck in a permanently paused state if that write\n      // also returned false.\n      if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) {\n        debug('false write response, pause', src._readableState.awaitDrain);\n        src._readableState.awaitDrain++;\n      }\n      src.pause();\n    }\n  }\n\n  // if the dest has an error, then stop piping into it.\n  // however, don't suppress the throwing behavior for this.\n  function onerror(er) {\n    debug('onerror', er);\n    unpipe();\n    dest.removeListener('error', onerror);\n    if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n  }\n  // This is a brutally ugly hack to make sure that our error handler\n  // is attached before any userland ones.  NEVER DO THIS.\n  if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error];\n\n  // Both close and finish should trigger unpipe, but only once.\n  function onclose() {\n    dest.removeListener('finish', onfinish);\n    unpipe();\n  }\n  dest.once('close', onclose);\n  function onfinish() {\n    debug('onfinish');\n    dest.removeListener('close', onclose);\n    unpipe();\n  }\n  dest.once('finish', onfinish);\n\n  function unpipe() {\n    debug('unpipe');\n    src.unpipe(dest);\n  }\n\n  // tell the dest that it's being piped to\n  dest.emit('pipe', src);\n\n  // start the flow if it hasn't been started already.\n  if (!state.flowing) {\n    debug('pipe resume');\n    src.resume();\n  }\n\n  return dest;\n};\n\nfunction pipeOnDrain(src) {\n  return function () {\n    var state = src._readableState;\n    debug('pipeOnDrain', state.awaitDrain);\n    if (state.awaitDrain) state.awaitDrain--;\n    if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n      state.flowing = true;\n      flow(src);\n    }\n  };\n}\n\nReadable.prototype.unpipe = function (dest) {\n  var state = this._readableState;\n\n  // if we're not piping anywhere, then do nothing.\n  if (state.pipesCount === 0) return this;\n\n  // just one destination.  most common case.\n  if (state.pipesCount === 1) {\n    // passed in one, but it's not the right one.\n    if (dest && dest !== state.pipes) return this;\n\n    if (!dest) dest = state.pipes;\n\n    // got a match.\n    state.pipes = null;\n    state.pipesCount = 0;\n    state.flowing = false;\n    if (dest) dest.emit('unpipe', this);\n    return this;\n  }\n\n  // slow case. multiple pipe destinations.\n\n  if (!dest) {\n    // remove all.\n    var dests = state.pipes;\n    var len = state.pipesCount;\n    state.pipes = null;\n    state.pipesCount = 0;\n    state.flowing = false;\n\n    for (var _i = 0; _i < len; _i++) {\n      dests[_i].emit('unpipe', this);\n    }return this;\n  }\n\n  // try to find the right one.\n  var i = indexOf(state.pipes, dest);\n  if (i === -1) return this;\n\n  state.pipes.splice(i, 1);\n  state.pipesCount -= 1;\n  if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n  dest.emit('unpipe', this);\n\n  return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n  var res = Stream.prototype.on.call(this, ev, fn);\n\n  // If listening to data, and it has not explicitly been paused,\n  // then call resume to start the flow of data on the next tick.\n  if (ev === 'data' && false !== this._readableState.flowing) {\n    this.resume();\n  }\n\n  if (ev === 'readable' && !this._readableState.endEmitted) {\n    var state = this._readableState;\n    if (!state.readableListening) {\n      state.readableListening = true;\n      state.emittedReadable = false;\n      state.needReadable = true;\n      if (!state.reading) {\n        processNextTick(nReadingNextTick, this);\n      } else if (state.length) {\n        emitReadable(this, state);\n      }\n    }\n  }\n\n  return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n  debug('readable nexttick read 0');\n  self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n  var state = this._readableState;\n  if (!state.flowing) {\n    debug('resume');\n    state.flowing = true;\n    resume(this, state);\n  }\n  return this;\n};\n\nfunction resume(stream, state) {\n  if (!state.resumeScheduled) {\n    state.resumeScheduled = true;\n    processNextTick(resume_, stream, state);\n  }\n}\n\nfunction resume_(stream, state) {\n  if (!state.reading) {\n    debug('resume read 0');\n    stream.read(0);\n  }\n\n  state.resumeScheduled = false;\n  stream.emit('resume');\n  flow(stream);\n  if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n  debug('call pause flowing=%j', this._readableState.flowing);\n  if (false !== this._readableState.flowing) {\n    debug('pause');\n    this._readableState.flowing = false;\n    this.emit('pause');\n  }\n  return this;\n};\n\nfunction flow(stream) {\n  var state = stream._readableState;\n  debug('flow', state.flowing);\n  if (state.flowing) {\n    do {\n      var chunk = stream.read();\n    } while (null !== chunk && state.flowing);\n  }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n  var state = this._readableState;\n  var paused = false;\n\n  var self = this;\n  stream.on('end', function () {\n    debug('wrapped end');\n    if (state.decoder && !state.ended) {\n      var chunk = state.decoder.end();\n      if (chunk && chunk.length) self.push(chunk);\n    }\n\n    self.push(null);\n  });\n\n  stream.on('data', function (chunk) {\n    debug('wrapped data');\n    if (state.decoder) chunk = state.decoder.write(chunk);\n\n    // don't skip over falsy values in objectMode\n    if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n    var ret = self.push(chunk);\n    if (!ret) {\n      paused = true;\n      stream.pause();\n    }\n  });\n\n  // proxy all the other methods.\n  // important when wrapping filters and duplexes.\n  for (var i in stream) {\n    if (this[i] === undefined && typeof stream[i] === 'function') {\n      this[i] = function (method) {\n        return function () {\n          return stream[method].apply(stream, arguments);\n        };\n      }(i);\n    }\n  }\n\n  // proxy certain important events.\n  var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n  forEach(events, function (ev) {\n    stream.on(ev, self.emit.bind(self, ev));\n  });\n\n  // when we try to consume some more bytes, simply unpause the\n  // underlying stream.\n  self._read = function (n) {\n    debug('wrapped _read', n);\n    if (paused) {\n      paused = false;\n      stream.resume();\n    }\n  };\n\n  return self;\n};\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n  var list = state.buffer;\n  var length = state.length;\n  var stringMode = !!state.decoder;\n  var objectMode = !!state.objectMode;\n  var ret;\n\n  // nothing in the list, definitely empty.\n  if (list.length === 0) return null;\n\n  if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) {\n    // read it all, truncate the array.\n    if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length);\n    list.length = 0;\n  } else {\n    // read just some of it.\n    if (n < list[0].length) {\n      // just take a part of the first list item.\n      // slice is the same for buffers and strings.\n      var buf = list[0];\n      ret = buf.slice(0, n);\n      list[0] = buf.slice(n);\n    } else if (n === list[0].length) {\n      // first list is a perfect match\n      ret = list.shift();\n    } else {\n      // complex case.\n      // we have enough to cover it, but it spans past the first buffer.\n      if (stringMode) ret = '';else ret = new Buffer(n);\n\n      var c = 0;\n      for (var i = 0, l = list.length; i < l && c < n; i++) {\n        var buf = list[0];\n        var cpy = Math.min(n - c, buf.length);\n\n        if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy);\n\n        if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift();\n\n        c += cpy;\n      }\n    }\n  }\n\n  return ret;\n}\n\nfunction endReadable(stream) {\n  var state = stream._readableState;\n\n  // If we get here before consuming all the bytes, then that is a\n  // bug in node.  Should never happen.\n  if (state.length > 0) throw new Error('endReadable called on non-empty stream');\n\n  if (!state.endEmitted) {\n    state.ended = true;\n    processNextTick(endReadableNT, state, stream);\n  }\n}\n\nfunction endReadableNT(state, stream) {\n  // Check that we didn't get one last unshift.\n  if (!state.endEmitted && state.length === 0) {\n    state.endEmitted = true;\n    stream.readable = false;\n    stream.emit('end');\n  }\n}\n\nfunction forEach(xs, f) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    f(xs[i], i);\n  }\n}\n\nfunction indexOf(xs, x) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    if (xs[i] === x) return i;\n  }\n  return -1;\n}\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":55,\"_process\":53,\"buffer\":3,\"core-util-is\":6,\"events\":7,\"inherits\":10,\"isarray\":60,\"process-nextick-args\":52,\"string_decoder/\":67,\"util\":2}],58:[function(require,module,exports){\n// a transform stream is a readable/writable stream where you do\n// something with the data.  Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored.  (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation.  For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes.  When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up.  When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer.  When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks.  If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk.  However,\n// a pathological inflate type of transform can cause excessive buffering\n// here.  For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output.  In this case, you could write a very small\n// amount of input, and end up with a very large amount of output.  In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform.  A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(Transform, Duplex);\n\nfunction TransformState(stream) {\n  this.afterTransform = function (er, data) {\n    return afterTransform(stream, er, data);\n  };\n\n  this.needTransform = false;\n  this.transforming = false;\n  this.writecb = null;\n  this.writechunk = null;\n  this.writeencoding = null;\n}\n\nfunction afterTransform(stream, er, data) {\n  var ts = stream._transformState;\n  ts.transforming = false;\n\n  var cb = ts.writecb;\n\n  if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));\n\n  ts.writechunk = null;\n  ts.writecb = null;\n\n  if (data !== null && data !== undefined) stream.push(data);\n\n  cb(er);\n\n  var rs = stream._readableState;\n  rs.reading = false;\n  if (rs.needReadable || rs.length < rs.highWaterMark) {\n    stream._read(rs.highWaterMark);\n  }\n}\n\nfunction Transform(options) {\n  if (!(this instanceof Transform)) return new Transform(options);\n\n  Duplex.call(this, options);\n\n  this._transformState = new TransformState(this);\n\n  // when the writable side finishes, then flush out anything remaining.\n  var stream = this;\n\n  // start out asking for a readable event once data is transformed.\n  this._readableState.needReadable = true;\n\n  // we have implemented the _read method, and done the other things\n  // that Readable wants before the first _read call, so unset the\n  // sync guard flag.\n  this._readableState.sync = false;\n\n  if (options) {\n    if (typeof options.transform === 'function') this._transform = options.transform;\n\n    if (typeof options.flush === 'function') this._flush = options.flush;\n  }\n\n  this.once('prefinish', function () {\n    if (typeof this._flush === 'function') this._flush(function (er) {\n      done(stream, er);\n    });else done(stream);\n  });\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n  this._transformState.needTransform = false;\n  return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side.  You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk.  If you pass\n// an error, then that'll put the hurt on the whole operation.  If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n  throw new Error('not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n  var ts = this._transformState;\n  ts.writecb = cb;\n  ts.writechunk = chunk;\n  ts.writeencoding = encoding;\n  if (!ts.transforming) {\n    var rs = this._readableState;\n    if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n  }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n  var ts = this._transformState;\n\n  if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n    ts.transforming = true;\n    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n  } else {\n    // mark that we need a transform, so that any data that comes in\n    // will get processed, now that we've asked for it.\n    ts.needTransform = true;\n  }\n};\n\nfunction done(stream, er) {\n  if (er) return stream.emit('error', er);\n\n  // if there's nothing in the write buffer, then that means\n  // that nothing more will ever be provided\n  var ws = stream._writableState;\n  var ts = stream._transformState;\n\n  if (ws.length) throw new Error('calling transform done when ws.length != 0');\n\n  if (ts.transforming) throw new Error('calling transform done when still transforming');\n\n  return stream.push(null);\n}\n},{\"./_stream_duplex\":55,\"core-util-is\":6,\"inherits\":10}],59:[function(require,module,exports){\n(function (process){\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n/*<replacement>*/\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;\n/*</replacement>*/\n\n/*<replacement>*/\nvar Buffer = require('buffer').Buffer;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n/*<replacement>*/\nvar internalUtil = {\n  deprecate: require('util-deprecate')\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream;\n(function () {\n  try {\n    Stream = require('st' + 'ream');\n  } catch (_) {} finally {\n    if (!Stream) Stream = require('events').EventEmitter;\n  }\n})();\n/*</replacement>*/\n\nvar Buffer = require('buffer').Buffer;\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WriteReq(chunk, encoding, cb) {\n  this.chunk = chunk;\n  this.encoding = encoding;\n  this.callback = cb;\n  this.next = null;\n}\n\nvar Duplex;\nfunction WritableState(options, stream) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  options = options || {};\n\n  // object stream flag to indicate whether or not this stream\n  // contains buffers or objects.\n  this.objectMode = !!options.objectMode;\n\n  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n  // the point at which write() starts returning false\n  // Note: 0 is a valid value, means that we always return false if\n  // the entire buffer is not flushed immediately on write()\n  var hwm = options.highWaterMark;\n  var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;\n\n  // cast to ints.\n  this.highWaterMark = ~ ~this.highWaterMark;\n\n  this.needDrain = false;\n  // at the start of calling end()\n  this.ending = false;\n  // when end() has been called, and returned\n  this.ended = false;\n  // when 'finish' is emitted\n  this.finished = false;\n\n  // should we decode strings into buffers before passing to _write?\n  // this is here so that some node-core streams can optimize string\n  // handling at a lower level.\n  var noDecode = options.decodeStrings === false;\n  this.decodeStrings = !noDecode;\n\n  // Crypto is kind of old and crusty.  Historically, its default string\n  // encoding is 'binary' so we have to make this configurable.\n  // Everything else in the universe uses 'utf8', though.\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n  // not an actual buffer we keep track of, but a measurement\n  // of how much we're waiting to get pushed to some underlying\n  // socket or file.\n  this.length = 0;\n\n  // a flag to see when we're in the middle of a write.\n  this.writing = false;\n\n  // when true all writes will be buffered until .uncork() call\n  this.corked = 0;\n\n  // a flag to be able to tell if the onwrite cb is called immediately,\n  // or on a later tick.  We set this to true at first, because any\n  // actions that shouldn't happen until \"later\" should generally also\n  // not happen before the first write call.\n  this.sync = true;\n\n  // a flag to know if we're processing previously buffered items, which\n  // may call the _write() callback in the same tick, so that we don't\n  // end up in an overlapped onwrite situation.\n  this.bufferProcessing = false;\n\n  // the callback that's passed to _write(chunk,cb)\n  this.onwrite = function (er) {\n    onwrite(stream, er);\n  };\n\n  // the callback that the user supplies to write(chunk,encoding,cb)\n  this.writecb = null;\n\n  // the amount that is being written when _write is called.\n  this.writelen = 0;\n\n  this.bufferedRequest = null;\n  this.lastBufferedRequest = null;\n\n  // number of pending user-supplied write callbacks\n  // this must be 0 before 'finish' can be emitted\n  this.pendingcb = 0;\n\n  // emit prefinish if the only thing we're waiting for is _write cbs\n  // This is relevant for synchronous Transform streams\n  this.prefinished = false;\n\n  // True if the error was already emitted and should not be thrown again\n  this.errorEmitted = false;\n\n  // count buffered requests\n  this.bufferedRequestCount = 0;\n\n  // create the two objects needed to store the corked requests\n  // they are not a linked list, as no new elements are inserted in there\n  this.corkedRequestsFree = new CorkedRequest(this);\n  this.corkedRequestsFree.next = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function writableStateGetBuffer() {\n  var current = this.bufferedRequest;\n  var out = [];\n  while (current) {\n    out.push(current);\n    current = current.next;\n  }\n  return out;\n};\n\n(function () {\n  try {\n    Object.defineProperty(WritableState.prototype, 'buffer', {\n      get: internalUtil.deprecate(function () {\n        return this.getBuffer();\n      }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')\n    });\n  } catch (_) {}\n})();\n\nvar Duplex;\nfunction Writable(options) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  // Writable ctor is applied to Duplexes, though they're not\n  // instanceof Writable, they're instanceof Readable.\n  if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);\n\n  this._writableState = new WritableState(options, this);\n\n  // legacy.\n  this.writable = true;\n\n  if (options) {\n    if (typeof options.write === 'function') this._write = options.write;\n\n    if (typeof options.writev === 'function') this._writev = options.writev;\n  }\n\n  Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n  this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n  var er = new Error('write after end');\n  // TODO: defer error events consistently everywhere, not just the cb\n  stream.emit('error', er);\n  processNextTick(cb, er);\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n  var valid = true;\n\n  if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n    var er = new TypeError('Invalid non-string/buffer chunk');\n    stream.emit('error', er);\n    processNextTick(cb, er);\n    valid = false;\n  }\n  return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n  var state = this._writableState;\n  var ret = false;\n\n  if (typeof encoding === 'function') {\n    cb = encoding;\n    encoding = null;\n  }\n\n  if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n  if (typeof cb !== 'function') cb = nop;\n\n  if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {\n    state.pendingcb++;\n    ret = writeOrBuffer(this, state, chunk, encoding, cb);\n  }\n\n  return ret;\n};\n\nWritable.prototype.cork = function () {\n  var state = this._writableState;\n\n  state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n  var state = this._writableState;\n\n  if (state.corked) {\n    state.corked--;\n\n    if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n  }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n  // node::ParseEncoding() requires lower case.\n  if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n  if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n  this._writableState.defaultEncoding = encoding;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n    chunk = new Buffer(chunk, encoding);\n  }\n  return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn.  Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n  chunk = decodeChunk(state, chunk, encoding);\n\n  if (Buffer.isBuffer(chunk)) encoding = 'buffer';\n  var len = state.objectMode ? 1 : chunk.length;\n\n  state.length += len;\n\n  var ret = state.length < state.highWaterMark;\n  // we must ensure that previous needDrain will not be reset to false.\n  if (!ret) state.needDrain = true;\n\n  if (state.writing || state.corked) {\n    var last = state.lastBufferedRequest;\n    state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);\n    if (last) {\n      last.next = state.lastBufferedRequest;\n    } else {\n      state.bufferedRequest = state.lastBufferedRequest;\n    }\n    state.bufferedRequestCount += 1;\n  } else {\n    doWrite(stream, state, false, len, chunk, encoding, cb);\n  }\n\n  return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n  state.writelen = len;\n  state.writecb = cb;\n  state.writing = true;\n  state.sync = true;\n  if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n  state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n  --state.pendingcb;\n  if (sync) processNextTick(cb, er);else cb(er);\n\n  stream._writableState.errorEmitted = true;\n  stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n  state.writing = false;\n  state.writecb = null;\n  state.length -= state.writelen;\n  state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n  var state = stream._writableState;\n  var sync = state.sync;\n  var cb = state.writecb;\n\n  onwriteStateUpdate(state);\n\n  if (er) onwriteError(stream, state, sync, er, cb);else {\n    // Check if we're actually ready to finish, but don't emit yet\n    var finished = needFinish(state);\n\n    if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n      clearBuffer(stream, state);\n    }\n\n    if (sync) {\n      /*<replacement>*/\n      asyncWrite(afterWrite, stream, state, finished, cb);\n      /*</replacement>*/\n    } else {\n        afterWrite(stream, state, finished, cb);\n      }\n  }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n  if (!finished) onwriteDrain(stream, state);\n  state.pendingcb--;\n  cb();\n  finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n  if (state.length === 0 && state.needDrain) {\n    state.needDrain = false;\n    stream.emit('drain');\n  }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n  state.bufferProcessing = true;\n  var entry = state.bufferedRequest;\n\n  if (stream._writev && entry && entry.next) {\n    // Fast case, write everything using _writev()\n    var l = state.bufferedRequestCount;\n    var buffer = new Array(l);\n    var holder = state.corkedRequestsFree;\n    holder.entry = entry;\n\n    var count = 0;\n    while (entry) {\n      buffer[count] = entry;\n      entry = entry.next;\n      count += 1;\n    }\n\n    doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n    // doWrite is always async, defer these to save a bit of time\n    // as the hot path ends with doWrite\n    state.pendingcb++;\n    state.lastBufferedRequest = null;\n    state.corkedRequestsFree = holder.next;\n    holder.next = null;\n  } else {\n    // Slow case, write chunks one-by-one\n    while (entry) {\n      var chunk = entry.chunk;\n      var encoding = entry.encoding;\n      var cb = entry.callback;\n      var len = state.objectMode ? 1 : chunk.length;\n\n      doWrite(stream, state, false, len, chunk, encoding, cb);\n      entry = entry.next;\n      // if we didn't call the onwrite immediately, then\n      // it means that we need to wait until it does.\n      // also, that means that the chunk and cb are currently\n      // being processed, so move the buffer counter past them.\n      if (state.writing) {\n        break;\n      }\n    }\n\n    if (entry === null) state.lastBufferedRequest = null;\n  }\n\n  state.bufferedRequestCount = 0;\n  state.bufferedRequest = entry;\n  state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n  cb(new Error('not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n  var state = this._writableState;\n\n  if (typeof chunk === 'function') {\n    cb = chunk;\n    chunk = null;\n    encoding = null;\n  } else if (typeof encoding === 'function') {\n    cb = encoding;\n    encoding = null;\n  }\n\n  if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n  // .end() fully uncorks\n  if (state.corked) {\n    state.corked = 1;\n    this.uncork();\n  }\n\n  // ignore unnecessary end() calls.\n  if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction prefinish(stream, state) {\n  if (!state.prefinished) {\n    state.prefinished = true;\n    stream.emit('prefinish');\n  }\n}\n\nfunction finishMaybe(stream, state) {\n  var need = needFinish(state);\n  if (need) {\n    if (state.pendingcb === 0) {\n      prefinish(stream, state);\n      state.finished = true;\n      stream.emit('finish');\n    } else {\n      prefinish(stream, state);\n    }\n  }\n  return need;\n}\n\nfunction endWritable(stream, state, cb) {\n  state.ending = true;\n  finishMaybe(stream, state);\n  if (cb) {\n    if (state.finished) processNextTick(cb);else stream.once('finish', cb);\n  }\n  state.ended = true;\n  stream.writable = false;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n  var _this = this;\n\n  this.next = null;\n  this.entry = null;\n\n  this.finish = function (err) {\n    var entry = _this.entry;\n    _this.entry = null;\n    while (entry) {\n      var cb = entry.callback;\n      state.pendingcb--;\n      cb(err);\n      entry = entry.next;\n    }\n    if (state.corkedRequestsFree) {\n      state.corkedRequestsFree.next = _this;\n    } else {\n      state.corkedRequestsFree = _this;\n    }\n  };\n}\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":55,\"_process\":53,\"buffer\":3,\"core-util-is\":6,\"events\":7,\"inherits\":10,\"process-nextick-args\":52,\"util-deprecate\":68}],60:[function(require,module,exports){\narguments[4][4][0].apply(exports,arguments)\n},{\"dup\":4}],61:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_passthrough.js\")\n\n},{\"./lib/_stream_passthrough.js\":56}],62:[function(require,module,exports){\nvar Stream = (function (){\n  try {\n    return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify\n  } catch(_){}\n}());\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = Stream || exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n\n},{\"./lib/_stream_duplex.js\":55,\"./lib/_stream_passthrough.js\":56,\"./lib/_stream_readable.js\":57,\"./lib/_stream_transform.js\":58,\"./lib/_stream_writable.js\":59}],63:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_transform.js\")\n\n},{\"./lib/_stream_transform.js\":58}],64:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_writable.js\")\n\n},{\"./lib/_stream_writable.js\":59}],65:[function(require,module,exports){\n(function (Buffer){\n;(function (sax) { // wrapper for non-node envs\n  sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }\n  sax.SAXParser = SAXParser\n  sax.SAXStream = SAXStream\n  sax.createStream = createStream\n\n  // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.\n  // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),\n  // since that's the earliest that a buffer overrun could occur.  This way, checks are\n  // as rare as required, but as often as necessary to ensure never crossing this bound.\n  // Furthermore, buffers are only tested at most once per write(), so passing a very\n  // large string into write() might have undesirable effects, but this is manageable by\n  // the caller, so it is assumed to be safe.  Thus, a call to write() may, in the extreme\n  // edge case, result in creating at most one complete copy of the string passed in.\n  // Set to Infinity to have unlimited buffers.\n  sax.MAX_BUFFER_LENGTH = 64 * 1024\n\n  var buffers = [\n    'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',\n    'procInstName', 'procInstBody', 'entity', 'attribName',\n    'attribValue', 'cdata', 'script'\n  ]\n\n  sax.EVENTS = [\n    'text',\n    'processinginstruction',\n    'sgmldeclaration',\n    'doctype',\n    'comment',\n    'opentagstart',\n    'attribute',\n    'opentag',\n    'closetag',\n    'opencdata',\n    'cdata',\n    'closecdata',\n    'error',\n    'end',\n    'ready',\n    'script',\n    'opennamespace',\n    'closenamespace'\n  ]\n\n  function SAXParser (strict, opt) {\n    if (!(this instanceof SAXParser)) {\n      return new SAXParser(strict, opt)\n    }\n\n    var parser = this\n    clearBuffers(parser)\n    parser.q = parser.c = ''\n    parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH\n    parser.opt = opt || {}\n    parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags\n    parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'\n    parser.tags = []\n    parser.closed = parser.closedRoot = parser.sawRoot = false\n    parser.tag = parser.error = null\n    parser.strict = !!strict\n    parser.noscript = !!(strict || parser.opt.noscript)\n    parser.state = S.BEGIN\n    parser.strictEntities = parser.opt.strictEntities\n    parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)\n    parser.attribList = []\n\n    // namespaces form a prototype chain.\n    // it always points at the current tag,\n    // which protos to its parent tag.\n    if (parser.opt.xmlns) {\n      parser.ns = Object.create(rootNS)\n    }\n\n    // mostly just for error reporting\n    parser.trackPosition = parser.opt.position !== false\n    if (parser.trackPosition) {\n      parser.position = parser.line = parser.column = 0\n    }\n    emit(parser, 'onready')\n  }\n\n  if (!Object.create) {\n    Object.create = function (o) {\n      function F () {}\n      F.prototype = o\n      var newf = new F()\n      return newf\n    }\n  }\n\n  if (!Object.keys) {\n    Object.keys = function (o) {\n      var a = []\n      for (var i in o) if (o.hasOwnProperty(i)) a.push(i)\n      return a\n    }\n  }\n\n  function checkBufferLength (parser) {\n    var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)\n    var maxActual = 0\n    for (var i = 0, l = buffers.length; i < l; i++) {\n      var len = parser[buffers[i]].length\n      if (len > maxAllowed) {\n        // Text/cdata nodes can get big, and since they're buffered,\n        // we can get here under normal conditions.\n        // Avoid issues by emitting the text node now,\n        // so at least it won't get any bigger.\n        switch (buffers[i]) {\n          case 'textNode':\n            closeText(parser)\n            break\n\n          case 'cdata':\n            emitNode(parser, 'oncdata', parser.cdata)\n            parser.cdata = ''\n            break\n\n          case 'script':\n            emitNode(parser, 'onscript', parser.script)\n            parser.script = ''\n            break\n\n          default:\n            error(parser, 'Max buffer length exceeded: ' + buffers[i])\n        }\n      }\n      maxActual = Math.max(maxActual, len)\n    }\n    // schedule the next check for the earliest possible buffer overrun.\n    var m = sax.MAX_BUFFER_LENGTH - maxActual\n    parser.bufferCheckPosition = m + parser.position\n  }\n\n  function clearBuffers (parser) {\n    for (var i = 0, l = buffers.length; i < l; i++) {\n      parser[buffers[i]] = ''\n    }\n  }\n\n  function flushBuffers (parser) {\n    closeText(parser)\n    if (parser.cdata !== '') {\n      emitNode(parser, 'oncdata', parser.cdata)\n      parser.cdata = ''\n    }\n    if (parser.script !== '') {\n      emitNode(parser, 'onscript', parser.script)\n      parser.script = ''\n    }\n  }\n\n  SAXParser.prototype = {\n    end: function () { end(this) },\n    write: write,\n    resume: function () { this.error = null; return this },\n    close: function () { return this.write(null) },\n    flush: function () { flushBuffers(this) }\n  }\n\n  var Stream\n  try {\n    Stream = require('stream').Stream\n  } catch (ex) {\n    Stream = function () {}\n  }\n\n  var streamWraps = sax.EVENTS.filter(function (ev) {\n    return ev !== 'error' && ev !== 'end'\n  })\n\n  function createStream (strict, opt) {\n    return new SAXStream(strict, opt)\n  }\n\n  function SAXStream (strict, opt) {\n    if (!(this instanceof SAXStream)) {\n      return new SAXStream(strict, opt)\n    }\n\n    Stream.apply(this)\n\n    this._parser = new SAXParser(strict, opt)\n    this.writable = true\n    this.readable = true\n\n    var me = this\n\n    this._parser.onend = function () {\n      me.emit('end')\n    }\n\n    this._parser.onerror = function (er) {\n      me.emit('error', er)\n\n      // if didn't throw, then means error was handled.\n      // go ahead and clear error, so we can write again.\n      me._parser.error = null\n    }\n\n    this._decoder = null\n\n    streamWraps.forEach(function (ev) {\n      Object.defineProperty(me, 'on' + ev, {\n        get: function () {\n          return me._parser['on' + ev]\n        },\n        set: function (h) {\n          if (!h) {\n            me.removeAllListeners(ev)\n            me._parser['on' + ev] = h\n            return h\n          }\n          me.on(ev, h)\n        },\n        enumerable: true,\n        configurable: false\n      })\n    })\n  }\n\n  SAXStream.prototype = Object.create(Stream.prototype, {\n    constructor: {\n      value: SAXStream\n    }\n  })\n\n  SAXStream.prototype.write = function (data) {\n    if (typeof Buffer === 'function' &&\n      typeof Buffer.isBuffer === 'function' &&\n      Buffer.isBuffer(data)) {\n      if (!this._decoder) {\n        var SD = require('string_decoder').StringDecoder\n        this._decoder = new SD('utf8')\n      }\n      data = this._decoder.write(data)\n    }\n\n    this._parser.write(data.toString())\n    this.emit('data', data)\n    return true\n  }\n\n  SAXStream.prototype.end = function (chunk) {\n    if (chunk && chunk.length) {\n      this.write(chunk)\n    }\n    this._parser.end()\n    return true\n  }\n\n  SAXStream.prototype.on = function (ev, handler) {\n    var me = this\n    if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {\n      me._parser['on' + ev] = function () {\n        var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)\n        args.splice(0, 0, ev)\n        me.emit.apply(me, args)\n      }\n    }\n\n    return Stream.prototype.on.call(me, ev, handler)\n  }\n\n  // character classes and tokens\n  var whitespace = '\\r\\n\\t '\n\n  // this really needs to be replaced with character classes.\n  // XML allows all manner of ridiculous numbers and digits.\n  var number = '0124356789'\n  var letter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n\n  // (Letter | \"_\" | \":\")\n  var quote = '\\'\"'\n  var attribEnd = whitespace + '>'\n  var CDATA = '[CDATA['\n  var DOCTYPE = 'DOCTYPE'\n  var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'\n  var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'\n  var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }\n\n  // turn all the string character sets into character class objects.\n  whitespace = charClass(whitespace)\n  number = charClass(number)\n  letter = charClass(letter)\n\n  // http://www.w3.org/TR/REC-xml/#NT-NameStartChar\n  // This implementation works on strings, a single character at a time\n  // as such, it cannot ever support astral-plane characters (10000-EFFFF)\n  // without a significant breaking change to either this  parser, or the\n  // JavaScript language.  Implementation of an emoji-capable xml parser\n  // is left as an exercise for the reader.\n  var nameStart = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n\n  var nameBody = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/\n\n  var entityStart = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n  var entityBody = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/\n\n  quote = charClass(quote)\n  attribEnd = charClass(attribEnd)\n\n  function charClass (str) {\n    return str.split('').reduce(function (s, c) {\n      s[c] = true\n      return s\n    }, {})\n  }\n\n  function isRegExp (c) {\n    return Object.prototype.toString.call(c) === '[object RegExp]'\n  }\n\n  function is (charclass, c) {\n    return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]\n  }\n\n  function not (charclass, c) {\n    return !is(charclass, c)\n  }\n\n  var S = 0\n  sax.STATE = {\n    BEGIN: S++, // leading byte order mark or whitespace\n    BEGIN_WHITESPACE: S++, // leading whitespace\n    TEXT: S++, // general stuff\n    TEXT_ENTITY: S++, // &amp and such.\n    OPEN_WAKA: S++, // <\n    SGML_DECL: S++, // <!BLARG\n    SGML_DECL_QUOTED: S++, // <!BLARG foo \"bar\n    DOCTYPE: S++, // <!DOCTYPE\n    DOCTYPE_QUOTED: S++, // <!DOCTYPE \"//blah\n    DOCTYPE_DTD: S++, // <!DOCTYPE \"//blah\" [ ...\n    DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE \"//blah\" [ \"foo\n    COMMENT_STARTING: S++, // <!-\n    COMMENT: S++, // <!--\n    COMMENT_ENDING: S++, // <!-- blah -\n    COMMENT_ENDED: S++, // <!-- blah --\n    CDATA: S++, // <![CDATA[ something\n    CDATA_ENDING: S++, // ]\n    CDATA_ENDING_2: S++, // ]]\n    PROC_INST: S++, // <?hi\n    PROC_INST_BODY: S++, // <?hi there\n    PROC_INST_ENDING: S++, // <?hi \"there\" ?\n    OPEN_TAG: S++, // <strong\n    OPEN_TAG_SLASH: S++, // <strong /\n    ATTRIB: S++, // <a\n    ATTRIB_NAME: S++, // <a foo\n    ATTRIB_NAME_SAW_WHITE: S++, // <a foo _\n    ATTRIB_VALUE: S++, // <a foo=\n    ATTRIB_VALUE_QUOTED: S++, // <a foo=\"bar\n    ATTRIB_VALUE_CLOSED: S++, // <a foo=\"bar\"\n    ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar\n    ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar=\"&quot;\"\n    ATTRIB_VALUE_ENTITY_U: S++, // <foo bar=&quot\n    CLOSE_TAG: S++, // </a\n    CLOSE_TAG_SAW_WHITE: S++, // </a   >\n    SCRIPT: S++, // <script> ...\n    SCRIPT_ENDING: S++ // <script> ... <\n  }\n\n  sax.XML_ENTITIES = {\n    'amp': '&',\n    'gt': '>',\n    'lt': '<',\n    'quot': '\"',\n    'apos': \"'\"\n  }\n\n  sax.ENTITIES = {\n    'amp': '&',\n    'gt': '>',\n    'lt': '<',\n    'quot': '\"',\n    'apos': \"'\",\n    'AElig': 198,\n    'Aacute': 193,\n    'Acirc': 194,\n    'Agrave': 192,\n    'Aring': 197,\n    'Atilde': 195,\n    'Auml': 196,\n    'Ccedil': 199,\n    'ETH': 208,\n    'Eacute': 201,\n    'Ecirc': 202,\n    'Egrave': 200,\n    'Euml': 203,\n    'Iacute': 205,\n    'Icirc': 206,\n    'Igrave': 204,\n    'Iuml': 207,\n    'Ntilde': 209,\n    'Oacute': 211,\n    'Ocirc': 212,\n    'Ograve': 210,\n    'Oslash': 216,\n    'Otilde': 213,\n    'Ouml': 214,\n    'THORN': 222,\n    'Uacute': 218,\n    'Ucirc': 219,\n    'Ugrave': 217,\n    'Uuml': 220,\n    'Yacute': 221,\n    'aacute': 225,\n    'acirc': 226,\n    'aelig': 230,\n    'agrave': 224,\n    'aring': 229,\n    'atilde': 227,\n    'auml': 228,\n    'ccedil': 231,\n    'eacute': 233,\n    'ecirc': 234,\n    'egrave': 232,\n    'eth': 240,\n    'euml': 235,\n    'iacute': 237,\n    'icirc': 238,\n    'igrave': 236,\n    'iuml': 239,\n    'ntilde': 241,\n    'oacute': 243,\n    'ocirc': 244,\n    'ograve': 242,\n    'oslash': 248,\n    'otilde': 245,\n    'ouml': 246,\n    'szlig': 223,\n    'thorn': 254,\n    'uacute': 250,\n    'ucirc': 251,\n    'ugrave': 249,\n    'uuml': 252,\n    'yacute': 253,\n    'yuml': 255,\n    'copy': 169,\n    'reg': 174,\n    'nbsp': 160,\n    'iexcl': 161,\n    'cent': 162,\n    'pound': 163,\n    'curren': 164,\n    'yen': 165,\n    'brvbar': 166,\n    'sect': 167,\n    'uml': 168,\n    'ordf': 170,\n    'laquo': 171,\n    'not': 172,\n    'shy': 173,\n    'macr': 175,\n    'deg': 176,\n    'plusmn': 177,\n    'sup1': 185,\n    'sup2': 178,\n    'sup3': 179,\n    'acute': 180,\n    'micro': 181,\n    'para': 182,\n    'middot': 183,\n    'cedil': 184,\n    'ordm': 186,\n    'raquo': 187,\n    'frac14': 188,\n    'frac12': 189,\n    'frac34': 190,\n    'iquest': 191,\n    'times': 215,\n    'divide': 247,\n    'OElig': 338,\n    'oelig': 339,\n    'Scaron': 352,\n    'scaron': 353,\n    'Yuml': 376,\n    'fnof': 402,\n    'circ': 710,\n    'tilde': 732,\n    'Alpha': 913,\n    'Beta': 914,\n    'Gamma': 915,\n    'Delta': 916,\n    'Epsilon': 917,\n    'Zeta': 918,\n    'Eta': 919,\n    'Theta': 920,\n    'Iota': 921,\n    'Kappa': 922,\n    'Lambda': 923,\n    'Mu': 924,\n    'Nu': 925,\n    'Xi': 926,\n    'Omicron': 927,\n    'Pi': 928,\n    'Rho': 929,\n    'Sigma': 931,\n    'Tau': 932,\n    'Upsilon': 933,\n    'Phi': 934,\n    'Chi': 935,\n    'Psi': 936,\n    'Omega': 937,\n    'alpha': 945,\n    'beta': 946,\n    'gamma': 947,\n    'delta': 948,\n    'epsilon': 949,\n    'zeta': 950,\n    'eta': 951,\n    'theta': 952,\n    'iota': 953,\n    'kappa': 954,\n    'lambda': 955,\n    'mu': 956,\n    'nu': 957,\n    'xi': 958,\n    'omicron': 959,\n    'pi': 960,\n    'rho': 961,\n    'sigmaf': 962,\n    'sigma': 963,\n    'tau': 964,\n    'upsilon': 965,\n    'phi': 966,\n    'chi': 967,\n    'psi': 968,\n    'omega': 969,\n    'thetasym': 977,\n    'upsih': 978,\n    'piv': 982,\n    'ensp': 8194,\n    'emsp': 8195,\n    'thinsp': 8201,\n    'zwnj': 8204,\n    'zwj': 8205,\n    'lrm': 8206,\n    'rlm': 8207,\n    'ndash': 8211,\n    'mdash': 8212,\n    'lsquo': 8216,\n    'rsquo': 8217,\n    'sbquo': 8218,\n    'ldquo': 8220,\n    'rdquo': 8221,\n    'bdquo': 8222,\n    'dagger': 8224,\n    'Dagger': 8225,\n    'bull': 8226,\n    'hellip': 8230,\n    'permil': 8240,\n    'prime': 8242,\n    'Prime': 8243,\n    'lsaquo': 8249,\n    'rsaquo': 8250,\n    'oline': 8254,\n    'frasl': 8260,\n    'euro': 8364,\n    'image': 8465,\n    'weierp': 8472,\n    'real': 8476,\n    'trade': 8482,\n    'alefsym': 8501,\n    'larr': 8592,\n    'uarr': 8593,\n    'rarr': 8594,\n    'darr': 8595,\n    'harr': 8596,\n    'crarr': 8629,\n    'lArr': 8656,\n    'uArr': 8657,\n    'rArr': 8658,\n    'dArr': 8659,\n    'hArr': 8660,\n    'forall': 8704,\n    'part': 8706,\n    'exist': 8707,\n    'empty': 8709,\n    'nabla': 8711,\n    'isin': 8712,\n    'notin': 8713,\n    'ni': 8715,\n    'prod': 8719,\n    'sum': 8721,\n    'minus': 8722,\n    'lowast': 8727,\n    'radic': 8730,\n    'prop': 8733,\n    'infin': 8734,\n    'ang': 8736,\n    'and': 8743,\n    'or': 8744,\n    'cap': 8745,\n    'cup': 8746,\n    'int': 8747,\n    'there4': 8756,\n    'sim': 8764,\n    'cong': 8773,\n    'asymp': 8776,\n    'ne': 8800,\n    'equiv': 8801,\n    'le': 8804,\n    'ge': 8805,\n    'sub': 8834,\n    'sup': 8835,\n    'nsub': 8836,\n    'sube': 8838,\n    'supe': 8839,\n    'oplus': 8853,\n    'otimes': 8855,\n    'perp': 8869,\n    'sdot': 8901,\n    'lceil': 8968,\n    'rceil': 8969,\n    'lfloor': 8970,\n    'rfloor': 8971,\n    'lang': 9001,\n    'rang': 9002,\n    'loz': 9674,\n    'spades': 9824,\n    'clubs': 9827,\n    'hearts': 9829,\n    'diams': 9830\n  }\n\n  Object.keys(sax.ENTITIES).forEach(function (key) {\n    var e = sax.ENTITIES[key]\n    var s = typeof e === 'number' ? String.fromCharCode(e) : e\n    sax.ENTITIES[key] = s\n  })\n\n  for (var s in sax.STATE) {\n    sax.STATE[sax.STATE[s]] = s\n  }\n\n  // shorthand\n  S = sax.STATE\n\n  function emit (parser, event, data) {\n    parser[event] && parser[event](data)\n  }\n\n  function emitNode (parser, nodeType, data) {\n    if (parser.textNode) closeText(parser)\n    emit(parser, nodeType, data)\n  }\n\n  function closeText (parser) {\n    parser.textNode = textopts(parser.opt, parser.textNode)\n    if (parser.textNode) emit(parser, 'ontext', parser.textNode)\n    parser.textNode = ''\n  }\n\n  function textopts (opt, text) {\n    if (opt.trim) text = text.trim()\n    if (opt.normalize) text = text.replace(/\\s+/g, ' ')\n    return text\n  }\n\n  function error (parser, er) {\n    closeText(parser)\n    if (parser.trackPosition) {\n      er += '\\nLine: ' + parser.line +\n        '\\nColumn: ' + parser.column +\n        '\\nChar: ' + parser.c\n    }\n    er = new Error(er)\n    parser.error = er\n    emit(parser, 'onerror', er)\n    return parser\n  }\n\n  function end (parser) {\n    if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')\n    if ((parser.state !== S.BEGIN) &&\n      (parser.state !== S.BEGIN_WHITESPACE) &&\n      (parser.state !== S.TEXT)) {\n      error(parser, 'Unexpected end')\n    }\n    closeText(parser)\n    parser.c = ''\n    parser.closed = true\n    emit(parser, 'onend')\n    SAXParser.call(parser, parser.strict, parser.opt)\n    return parser\n  }\n\n  function strictFail (parser, message) {\n    if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {\n      throw new Error('bad call to strictFail')\n    }\n    if (parser.strict) {\n      error(parser, message)\n    }\n  }\n\n  function newTag (parser) {\n    if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()\n    var parent = parser.tags[parser.tags.length - 1] || parser\n    var tag = parser.tag = { name: parser.tagName, attributes: {} }\n\n    // will be overridden if tag contails an xmlns=\"foo\" or xmlns:foo=\"bar\"\n    if (parser.opt.xmlns) {\n      tag.ns = parent.ns\n    }\n    parser.attribList.length = 0\n    emitNode(parser, 'onopentagstart', tag)\n  }\n\n  function qname (name, attribute) {\n    var i = name.indexOf(':')\n    var qualName = i < 0 ? [ '', name ] : name.split(':')\n    var prefix = qualName[0]\n    var local = qualName[1]\n\n    // <x \"xmlns\"=\"http://foo\">\n    if (attribute && name === 'xmlns') {\n      prefix = 'xmlns'\n      local = ''\n    }\n\n    return { prefix: prefix, local: local }\n  }\n\n  function attrib (parser) {\n    if (!parser.strict) {\n      parser.attribName = parser.attribName[parser.looseCase]()\n    }\n\n    if (parser.attribList.indexOf(parser.attribName) !== -1 ||\n      parser.tag.attributes.hasOwnProperty(parser.attribName)) {\n      parser.attribName = parser.attribValue = ''\n      return\n    }\n\n    if (parser.opt.xmlns) {\n      var qn = qname(parser.attribName, true)\n      var prefix = qn.prefix\n      var local = qn.local\n\n      if (prefix === 'xmlns') {\n        // namespace binding attribute. push the binding into scope\n        if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {\n          strictFail(parser,\n            'xml: prefix must be bound to ' + XML_NAMESPACE + '\\n' +\n            'Actual: ' + parser.attribValue)\n        } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {\n          strictFail(parser,\n            'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\\n' +\n            'Actual: ' + parser.attribValue)\n        } else {\n          var tag = parser.tag\n          var parent = parser.tags[parser.tags.length - 1] || parser\n          if (tag.ns === parent.ns) {\n            tag.ns = Object.create(parent.ns)\n          }\n          tag.ns[local] = parser.attribValue\n        }\n      }\n\n      // defer onattribute events until all attributes have been seen\n      // so any new bindings can take effect. preserve attribute order\n      // so deferred events can be emitted in document order\n      parser.attribList.push([parser.attribName, parser.attribValue])\n    } else {\n      // in non-xmlns mode, we can emit the event right away\n      parser.tag.attributes[parser.attribName] = parser.attribValue\n      emitNode(parser, 'onattribute', {\n        name: parser.attribName,\n        value: parser.attribValue\n      })\n    }\n\n    parser.attribName = parser.attribValue = ''\n  }\n\n  function openTag (parser, selfClosing) {\n    if (parser.opt.xmlns) {\n      // emit namespace binding events\n      var tag = parser.tag\n\n      // add namespace info to tag\n      var qn = qname(parser.tagName)\n      tag.prefix = qn.prefix\n      tag.local = qn.local\n      tag.uri = tag.ns[qn.prefix] || ''\n\n      if (tag.prefix && !tag.uri) {\n        strictFail(parser, 'Unbound namespace prefix: ' +\n          JSON.stringify(parser.tagName))\n        tag.uri = qn.prefix\n      }\n\n      var parent = parser.tags[parser.tags.length - 1] || parser\n      if (tag.ns && parent.ns !== tag.ns) {\n        Object.keys(tag.ns).forEach(function (p) {\n          emitNode(parser, 'onopennamespace', {\n            prefix: p,\n            uri: tag.ns[p]\n          })\n        })\n      }\n\n      // handle deferred onattribute events\n      // Note: do not apply default ns to attributes:\n      //   http://www.w3.org/TR/REC-xml-names/#defaulting\n      for (var i = 0, l = parser.attribList.length; i < l; i++) {\n        var nv = parser.attribList[i]\n        var name = nv[0]\n        var value = nv[1]\n        var qualName = qname(name, true)\n        var prefix = qualName.prefix\n        var local = qualName.local\n        var uri = prefix === '' ? '' : (tag.ns[prefix] || '')\n        var a = {\n          name: name,\n          value: value,\n          prefix: prefix,\n          local: local,\n          uri: uri\n        }\n\n        // if there's any attributes with an undefined namespace,\n        // then fail on them now.\n        if (prefix && prefix !== 'xmlns' && !uri) {\n          strictFail(parser, 'Unbound namespace prefix: ' +\n            JSON.stringify(prefix))\n          a.uri = prefix\n        }\n        parser.tag.attributes[name] = a\n        emitNode(parser, 'onattribute', a)\n      }\n      parser.attribList.length = 0\n    }\n\n    parser.tag.isSelfClosing = !!selfClosing\n\n    // process the tag\n    parser.sawRoot = true\n    parser.tags.push(parser.tag)\n    emitNode(parser, 'onopentag', parser.tag)\n    if (!selfClosing) {\n      // special case for <script> in non-strict mode.\n      if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {\n        parser.state = S.SCRIPT\n      } else {\n        parser.state = S.TEXT\n      }\n      parser.tag = null\n      parser.tagName = ''\n    }\n    parser.attribName = parser.attribValue = ''\n    parser.attribList.length = 0\n  }\n\n  function closeTag (parser) {\n    if (!parser.tagName) {\n      strictFail(parser, 'Weird empty close tag.')\n      parser.textNode += '</>'\n      parser.state = S.TEXT\n      return\n    }\n\n    if (parser.script) {\n      if (parser.tagName !== 'script') {\n        parser.script += '</' + parser.tagName + '>'\n        parser.tagName = ''\n        parser.state = S.SCRIPT\n        return\n      }\n      emitNode(parser, 'onscript', parser.script)\n      parser.script = ''\n    }\n\n    // first make sure that the closing tag actually exists.\n    // <a><b></c></b></a> will close everything, otherwise.\n    var t = parser.tags.length\n    var tagName = parser.tagName\n    if (!parser.strict) {\n      tagName = tagName[parser.looseCase]()\n    }\n    var closeTo = tagName\n    while (t--) {\n      var close = parser.tags[t]\n      if (close.name !== closeTo) {\n        // fail the first time in strict mode\n        strictFail(parser, 'Unexpected close tag')\n      } else {\n        break\n      }\n    }\n\n    // didn't find it.  we already failed for strict, so just abort.\n    if (t < 0) {\n      strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)\n      parser.textNode += '</' + parser.tagName + '>'\n      parser.state = S.TEXT\n      return\n    }\n    parser.tagName = tagName\n    var s = parser.tags.length\n    while (s-- > t) {\n      var tag = parser.tag = parser.tags.pop()\n      parser.tagName = parser.tag.name\n      emitNode(parser, 'onclosetag', parser.tagName)\n\n      var x = {}\n      for (var i in tag.ns) {\n        x[i] = tag.ns[i]\n      }\n\n      var parent = parser.tags[parser.tags.length - 1] || parser\n      if (parser.opt.xmlns && tag.ns !== parent.ns) {\n        // remove namespace bindings introduced by tag\n        Object.keys(tag.ns).forEach(function (p) {\n          var n = tag.ns[p]\n          emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })\n        })\n      }\n    }\n    if (t === 0) parser.closedRoot = true\n    parser.tagName = parser.attribValue = parser.attribName = ''\n    parser.attribList.length = 0\n    parser.state = S.TEXT\n  }\n\n  function parseEntity (parser) {\n    var entity = parser.entity\n    var entityLC = entity.toLowerCase()\n    var num\n    var numStr = ''\n\n    if (parser.ENTITIES[entity]) {\n      return parser.ENTITIES[entity]\n    }\n    if (parser.ENTITIES[entityLC]) {\n      return parser.ENTITIES[entityLC]\n    }\n    entity = entityLC\n    if (entity.charAt(0) === '#') {\n      if (entity.charAt(1) === 'x') {\n        entity = entity.slice(2)\n        num = parseInt(entity, 16)\n        numStr = num.toString(16)\n      } else {\n        entity = entity.slice(1)\n        num = parseInt(entity, 10)\n        numStr = num.toString(10)\n      }\n    }\n    entity = entity.replace(/^0+/, '')\n    if (numStr.toLowerCase() !== entity) {\n      strictFail(parser, 'Invalid character entity')\n      return '&' + parser.entity + ';'\n    }\n\n    return String.fromCodePoint(num)\n  }\n\n  function beginWhiteSpace (parser, c) {\n    if (c === '<') {\n      parser.state = S.OPEN_WAKA\n      parser.startTagPosition = parser.position\n    } else if (not(whitespace, c)) {\n      // have to process this as a text node.\n      // weird, but happens.\n      strictFail(parser, 'Non-whitespace before first tag.')\n      parser.textNode = c\n      parser.state = S.TEXT\n    }\n  }\n\n  function charAt (chunk, i) {\n    var result = ''\n    if (i < chunk.length) {\n      result = chunk.charAt(i)\n    }\n    return result\n  }\n\n  function write (chunk) {\n    var parser = this\n    if (this.error) {\n      throw this.error\n    }\n    if (parser.closed) {\n      return error(parser,\n        'Cannot write after close. Assign an onready handler.')\n    }\n    if (chunk === null) {\n      return end(parser)\n    }\n    if (typeof chunk === 'object') {\n      chunk = chunk.toString()\n    }\n    var i = 0\n    var c = ''\n    while (true) {\n      c = charAt(chunk, i++)\n      parser.c = c\n      if (!c) {\n        break\n      }\n      if (parser.trackPosition) {\n        parser.position++\n        if (c === '\\n') {\n          parser.line++\n          parser.column = 0\n        } else {\n          parser.column++\n        }\n      }\n      switch (parser.state) {\n        case S.BEGIN:\n          parser.state = S.BEGIN_WHITESPACE\n          if (c === '\\uFEFF') {\n            continue\n          }\n          beginWhiteSpace(parser, c)\n          continue\n\n        case S.BEGIN_WHITESPACE:\n          beginWhiteSpace(parser, c)\n          continue\n\n        case S.TEXT:\n          if (parser.sawRoot && !parser.closedRoot) {\n            var starti = i - 1\n            while (c && c !== '<' && c !== '&') {\n              c = charAt(chunk, i++)\n              if (c && parser.trackPosition) {\n                parser.position++\n                if (c === '\\n') {\n                  parser.line++\n                  parser.column = 0\n                } else {\n                  parser.column++\n                }\n              }\n            }\n            parser.textNode += chunk.substring(starti, i - 1)\n          }\n          if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {\n            parser.state = S.OPEN_WAKA\n            parser.startTagPosition = parser.position\n          } else {\n            if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot)) {\n              strictFail(parser, 'Text data outside of root node.')\n            }\n            if (c === '&') {\n              parser.state = S.TEXT_ENTITY\n            } else {\n              parser.textNode += c\n            }\n          }\n          continue\n\n        case S.SCRIPT:\n          // only non-strict\n          if (c === '<') {\n            parser.state = S.SCRIPT_ENDING\n          } else {\n            parser.script += c\n          }\n          continue\n\n        case S.SCRIPT_ENDING:\n          if (c === '/') {\n            parser.state = S.CLOSE_TAG\n          } else {\n            parser.script += '<' + c\n            parser.state = S.SCRIPT\n          }\n          continue\n\n        case S.OPEN_WAKA:\n          // either a /, ?, !, or text is coming next.\n          if (c === '!') {\n            parser.state = S.SGML_DECL\n            parser.sgmlDecl = ''\n          } else if (is(whitespace, c)) {\n            // wait for it...\n          } else if (is(nameStart, c)) {\n            parser.state = S.OPEN_TAG\n            parser.tagName = c\n          } else if (c === '/') {\n            parser.state = S.CLOSE_TAG\n            parser.tagName = ''\n          } else if (c === '?') {\n            parser.state = S.PROC_INST\n            parser.procInstName = parser.procInstBody = ''\n          } else {\n            strictFail(parser, 'Unencoded <')\n            // if there was some whitespace, then add that in.\n            if (parser.startTagPosition + 1 < parser.position) {\n              var pad = parser.position - parser.startTagPosition\n              c = new Array(pad).join(' ') + c\n            }\n            parser.textNode += '<' + c\n            parser.state = S.TEXT\n          }\n          continue\n\n        case S.SGML_DECL:\n          if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {\n            emitNode(parser, 'onopencdata')\n            parser.state = S.CDATA\n            parser.sgmlDecl = ''\n            parser.cdata = ''\n          } else if (parser.sgmlDecl + c === '--') {\n            parser.state = S.COMMENT\n            parser.comment = ''\n            parser.sgmlDecl = ''\n          } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {\n            parser.state = S.DOCTYPE\n            if (parser.doctype || parser.sawRoot) {\n              strictFail(parser,\n                'Inappropriately located doctype declaration')\n            }\n            parser.doctype = ''\n            parser.sgmlDecl = ''\n          } else if (c === '>') {\n            emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)\n            parser.sgmlDecl = ''\n            parser.state = S.TEXT\n          } else if (is(quote, c)) {\n            parser.state = S.SGML_DECL_QUOTED\n            parser.sgmlDecl += c\n          } else {\n            parser.sgmlDecl += c\n          }\n          continue\n\n        case S.SGML_DECL_QUOTED:\n          if (c === parser.q) {\n            parser.state = S.SGML_DECL\n            parser.q = ''\n          }\n          parser.sgmlDecl += c\n          continue\n\n        case S.DOCTYPE:\n          if (c === '>') {\n            parser.state = S.TEXT\n            emitNode(parser, 'ondoctype', parser.doctype)\n            parser.doctype = true // just remember that we saw it.\n          } else {\n            parser.doctype += c\n            if (c === '[') {\n              parser.state = S.DOCTYPE_DTD\n            } else if (is(quote, c)) {\n              parser.state = S.DOCTYPE_QUOTED\n              parser.q = c\n            }\n          }\n          continue\n\n        case S.DOCTYPE_QUOTED:\n          parser.doctype += c\n          if (c === parser.q) {\n            parser.q = ''\n            parser.state = S.DOCTYPE\n          }\n          continue\n\n        case S.DOCTYPE_DTD:\n          parser.doctype += c\n          if (c === ']') {\n            parser.state = S.DOCTYPE\n          } else if (is(quote, c)) {\n            parser.state = S.DOCTYPE_DTD_QUOTED\n            parser.q = c\n          }\n          continue\n\n        case S.DOCTYPE_DTD_QUOTED:\n          parser.doctype += c\n          if (c === parser.q) {\n            parser.state = S.DOCTYPE_DTD\n            parser.q = ''\n          }\n          continue\n\n        case S.COMMENT:\n          if (c === '-') {\n            parser.state = S.COMMENT_ENDING\n          } else {\n            parser.comment += c\n          }\n          continue\n\n        case S.COMMENT_ENDING:\n          if (c === '-') {\n            parser.state = S.COMMENT_ENDED\n            parser.comment = textopts(parser.opt, parser.comment)\n            if (parser.comment) {\n              emitNode(parser, 'oncomment', parser.comment)\n            }\n            parser.comment = ''\n          } else {\n            parser.comment += '-' + c\n            parser.state = S.COMMENT\n          }\n          continue\n\n        case S.COMMENT_ENDED:\n          if (c !== '>') {\n            strictFail(parser, 'Malformed comment')\n            // allow <!-- blah -- bloo --> in non-strict mode,\n            // which is a comment of \" blah -- bloo \"\n            parser.comment += '--' + c\n            parser.state = S.COMMENT\n          } else {\n            parser.state = S.TEXT\n          }\n          continue\n\n        case S.CDATA:\n          if (c === ']') {\n            parser.state = S.CDATA_ENDING\n          } else {\n            parser.cdata += c\n          }\n          continue\n\n        case S.CDATA_ENDING:\n          if (c === ']') {\n            parser.state = S.CDATA_ENDING_2\n          } else {\n            parser.cdata += ']' + c\n            parser.state = S.CDATA\n          }\n          continue\n\n        case S.CDATA_ENDING_2:\n          if (c === '>') {\n            if (parser.cdata) {\n              emitNode(parser, 'oncdata', parser.cdata)\n            }\n            emitNode(parser, 'onclosecdata')\n            parser.cdata = ''\n            parser.state = S.TEXT\n          } else if (c === ']') {\n            parser.cdata += ']'\n          } else {\n            parser.cdata += ']]' + c\n            parser.state = S.CDATA\n          }\n          continue\n\n        case S.PROC_INST:\n          if (c === '?') {\n            parser.state = S.PROC_INST_ENDING\n          } else if (is(whitespace, c)) {\n            parser.state = S.PROC_INST_BODY\n          } else {\n            parser.procInstName += c\n          }\n          continue\n\n        case S.PROC_INST_BODY:\n          if (!parser.procInstBody && is(whitespace, c)) {\n            continue\n          } else if (c === '?') {\n            parser.state = S.PROC_INST_ENDING\n          } else {\n            parser.procInstBody += c\n          }\n          continue\n\n        case S.PROC_INST_ENDING:\n          if (c === '>') {\n            emitNode(parser, 'onprocessinginstruction', {\n              name: parser.procInstName,\n              body: parser.procInstBody\n            })\n            parser.procInstName = parser.procInstBody = ''\n            parser.state = S.TEXT\n          } else {\n            parser.procInstBody += '?' + c\n            parser.state = S.PROC_INST_BODY\n          }\n          continue\n\n        case S.OPEN_TAG:\n          if (is(nameBody, c)) {\n            parser.tagName += c\n          } else {\n            newTag(parser)\n            if (c === '>') {\n              openTag(parser)\n            } else if (c === '/') {\n              parser.state = S.OPEN_TAG_SLASH\n            } else {\n              if (not(whitespace, c)) {\n                strictFail(parser, 'Invalid character in tag name')\n              }\n              parser.state = S.ATTRIB\n            }\n          }\n          continue\n\n        case S.OPEN_TAG_SLASH:\n          if (c === '>') {\n            openTag(parser, true)\n            closeTag(parser)\n          } else {\n            strictFail(parser, 'Forward-slash in opening tag not followed by >')\n            parser.state = S.ATTRIB\n          }\n          continue\n\n        case S.ATTRIB:\n          // haven't read the attribute name yet.\n          if (is(whitespace, c)) {\n            continue\n          } else if (c === '>') {\n            openTag(parser)\n          } else if (c === '/') {\n            parser.state = S.OPEN_TAG_SLASH\n          } else if (is(nameStart, c)) {\n            parser.attribName = c\n            parser.attribValue = ''\n            parser.state = S.ATTRIB_NAME\n          } else {\n            strictFail(parser, 'Invalid attribute name')\n          }\n          continue\n\n        case S.ATTRIB_NAME:\n          if (c === '=') {\n            parser.state = S.ATTRIB_VALUE\n          } else if (c === '>') {\n            strictFail(parser, 'Attribute without value')\n            parser.attribValue = parser.attribName\n            attrib(parser)\n            openTag(parser)\n          } else if (is(whitespace, c)) {\n            parser.state = S.ATTRIB_NAME_SAW_WHITE\n          } else if (is(nameBody, c)) {\n            parser.attribName += c\n          } else {\n            strictFail(parser, 'Invalid attribute name')\n          }\n          continue\n\n        case S.ATTRIB_NAME_SAW_WHITE:\n          if (c === '=') {\n            parser.state = S.ATTRIB_VALUE\n          } else if (is(whitespace, c)) {\n            continue\n          } else {\n            strictFail(parser, 'Attribute without value')\n            parser.tag.attributes[parser.attribName] = ''\n            parser.attribValue = ''\n            emitNode(parser, 'onattribute', {\n              name: parser.attribName,\n              value: ''\n            })\n            parser.attribName = ''\n            if (c === '>') {\n              openTag(parser)\n            } else if (is(nameStart, c)) {\n              parser.attribName = c\n              parser.state = S.ATTRIB_NAME\n            } else {\n              strictFail(parser, 'Invalid attribute name')\n              parser.state = S.ATTRIB\n            }\n          }\n          continue\n\n        case S.ATTRIB_VALUE:\n          if (is(whitespace, c)) {\n            continue\n          } else if (is(quote, c)) {\n            parser.q = c\n            parser.state = S.ATTRIB_VALUE_QUOTED\n          } else {\n            strictFail(parser, 'Unquoted attribute value')\n            parser.state = S.ATTRIB_VALUE_UNQUOTED\n            parser.attribValue = c\n          }\n          continue\n\n        case S.ATTRIB_VALUE_QUOTED:\n          if (c !== parser.q) {\n            if (c === '&') {\n              parser.state = S.ATTRIB_VALUE_ENTITY_Q\n            } else {\n              parser.attribValue += c\n            }\n            continue\n          }\n          attrib(parser)\n          parser.q = ''\n          parser.state = S.ATTRIB_VALUE_CLOSED\n          continue\n\n        case S.ATTRIB_VALUE_CLOSED:\n          if (is(whitespace, c)) {\n            parser.state = S.ATTRIB\n          } else if (c === '>') {\n            openTag(parser)\n          } else if (c === '/') {\n            parser.state = S.OPEN_TAG_SLASH\n          } else if (is(nameStart, c)) {\n            strictFail(parser, 'No whitespace between attributes')\n            parser.attribName = c\n            parser.attribValue = ''\n            parser.state = S.ATTRIB_NAME\n          } else {\n            strictFail(parser, 'Invalid attribute name')\n          }\n          continue\n\n        case S.ATTRIB_VALUE_UNQUOTED:\n          if (not(attribEnd, c)) {\n            if (c === '&') {\n              parser.state = S.ATTRIB_VALUE_ENTITY_U\n            } else {\n              parser.attribValue += c\n            }\n            continue\n          }\n          attrib(parser)\n          if (c === '>') {\n            openTag(parser)\n          } else {\n            parser.state = S.ATTRIB\n          }\n          continue\n\n        case S.CLOSE_TAG:\n          if (!parser.tagName) {\n            if (is(whitespace, c)) {\n              continue\n            } else if (not(nameStart, c)) {\n              if (parser.script) {\n                parser.script += '</' + c\n                parser.state = S.SCRIPT\n              } else {\n                strictFail(parser, 'Invalid tagname in closing tag.')\n              }\n            } else {\n              parser.tagName = c\n            }\n          } else if (c === '>') {\n            closeTag(parser)\n          } else if (is(nameBody, c)) {\n            parser.tagName += c\n          } else if (parser.script) {\n            parser.script += '</' + parser.tagName\n            parser.tagName = ''\n            parser.state = S.SCRIPT\n          } else {\n            if (not(whitespace, c)) {\n              strictFail(parser, 'Invalid tagname in closing tag')\n            }\n            parser.state = S.CLOSE_TAG_SAW_WHITE\n          }\n          continue\n\n        case S.CLOSE_TAG_SAW_WHITE:\n          if (is(whitespace, c)) {\n            continue\n          }\n          if (c === '>') {\n            closeTag(parser)\n          } else {\n            strictFail(parser, 'Invalid characters in closing tag')\n          }\n          continue\n\n        case S.TEXT_ENTITY:\n        case S.ATTRIB_VALUE_ENTITY_Q:\n        case S.ATTRIB_VALUE_ENTITY_U:\n          var returnState\n          var buffer\n          switch (parser.state) {\n            case S.TEXT_ENTITY:\n              returnState = S.TEXT\n              buffer = 'textNode'\n              break\n\n            case S.ATTRIB_VALUE_ENTITY_Q:\n              returnState = S.ATTRIB_VALUE_QUOTED\n              buffer = 'attribValue'\n              break\n\n            case S.ATTRIB_VALUE_ENTITY_U:\n              returnState = S.ATTRIB_VALUE_UNQUOTED\n              buffer = 'attribValue'\n              break\n          }\n\n          if (c === ';') {\n            parser[buffer] += parseEntity(parser)\n            parser.entity = ''\n            parser.state = returnState\n          } else if (is(parser.entity.length ? entityBody : entityStart, c)) {\n            parser.entity += c\n          } else {\n            strictFail(parser, 'Invalid character in entity name')\n            parser[buffer] += '&' + parser.entity + c\n            parser.entity = ''\n            parser.state = returnState\n          }\n\n          continue\n\n        default:\n          throw new Error(parser, 'Unknown state: ' + parser.state)\n      }\n    } // while\n\n    if (parser.position >= parser.bufferCheckPosition) {\n      checkBufferLength(parser)\n    }\n    return parser\n  }\n\n  /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */\n  if (!String.fromCodePoint) {\n    (function () {\n      var stringFromCharCode = String.fromCharCode\n      var floor = Math.floor\n      var fromCodePoint = function () {\n        var MAX_SIZE = 0x4000\n        var codeUnits = []\n        var highSurrogate\n        var lowSurrogate\n        var index = -1\n        var length = arguments.length\n        if (!length) {\n          return ''\n        }\n        var result = ''\n        while (++index < length) {\n          var codePoint = Number(arguments[index])\n          if (\n            !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`\n            codePoint < 0 || // not a valid Unicode code point\n            codePoint > 0x10FFFF || // not a valid Unicode code point\n            floor(codePoint) !== codePoint // not an integer\n          ) {\n            throw RangeError('Invalid code point: ' + codePoint)\n          }\n          if (codePoint <= 0xFFFF) { // BMP code point\n            codeUnits.push(codePoint)\n          } else { // Astral code point; split in surrogate halves\n            // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n            codePoint -= 0x10000\n            highSurrogate = (codePoint >> 10) + 0xD800\n            lowSurrogate = (codePoint % 0x400) + 0xDC00\n            codeUnits.push(highSurrogate, lowSurrogate)\n          }\n          if (index + 1 === length || codeUnits.length > MAX_SIZE) {\n            result += stringFromCharCode.apply(null, codeUnits)\n            codeUnits.length = 0\n          }\n        }\n        return result\n      }\n      if (Object.defineProperty) {\n        Object.defineProperty(String, 'fromCodePoint', {\n          value: fromCodePoint,\n          configurable: true,\n          writable: true\n        })\n      } else {\n        String.fromCodePoint = fromCodePoint\n      }\n    }())\n  }\n})(typeof exports === 'undefined' ? this.sax = {} : exports)\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":3,\"stream\":66,\"string_decoder\":67}],66:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams.  Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n  EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n  var source = this;\n\n  function ondata(chunk) {\n    if (dest.writable) {\n      if (false === dest.write(chunk) && source.pause) {\n        source.pause();\n      }\n    }\n  }\n\n  source.on('data', ondata);\n\n  function ondrain() {\n    if (source.readable && source.resume) {\n      source.resume();\n    }\n  }\n\n  dest.on('drain', ondrain);\n\n  // If the 'end' option is not supplied, dest.end() will be called when\n  // source gets the 'end' or 'close' events.  Only dest.end() once.\n  if (!dest._isStdio && (!options || options.end !== false)) {\n    source.on('end', onend);\n    source.on('close', onclose);\n  }\n\n  var didOnEnd = false;\n  function onend() {\n    if (didOnEnd) return;\n    didOnEnd = true;\n\n    dest.end();\n  }\n\n\n  function onclose() {\n    if (didOnEnd) return;\n    didOnEnd = true;\n\n    if (typeof dest.destroy === 'function') dest.destroy();\n  }\n\n  // don't leave dangling pipes when there are errors.\n  function onerror(er) {\n    cleanup();\n    if (EE.listenerCount(this, 'error') === 0) {\n      throw er; // Unhandled stream error in pipe.\n    }\n  }\n\n  source.on('error', onerror);\n  dest.on('error', onerror);\n\n  // remove all the event listeners that were added.\n  function cleanup() {\n    source.removeListener('data', ondata);\n    dest.removeListener('drain', ondrain);\n\n    source.removeListener('end', onend);\n    source.removeListener('close', onclose);\n\n    source.removeListener('error', onerror);\n    dest.removeListener('error', onerror);\n\n    source.removeListener('end', cleanup);\n    source.removeListener('close', cleanup);\n\n    dest.removeListener('close', cleanup);\n  }\n\n  source.on('end', cleanup);\n  source.on('close', cleanup);\n\n  dest.on('close', cleanup);\n\n  dest.emit('pipe', source);\n\n  // Allow for unix-like usage: A.pipe(B).pipe(C)\n  return dest;\n};\n\n},{\"events\":7,\"inherits\":10,\"readable-stream/duplex.js\":54,\"readable-stream/passthrough.js\":61,\"readable-stream/readable.js\":62,\"readable-stream/transform.js\":63,\"readable-stream/writable.js\":64}],67:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar Buffer = require('buffer').Buffer;\n\nvar isBufferEncoding = Buffer.isEncoding\n  || function(encoding) {\n       switch (encoding && encoding.toLowerCase()) {\n         case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;\n         default: return false;\n       }\n     }\n\n\nfunction assertEncoding(encoding) {\n  if (encoding && !isBufferEncoding(encoding)) {\n    throw new Error('Unknown encoding: ' + encoding);\n  }\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters. CESU-8 is handled as part of the UTF-8 encoding.\n//\n// @TODO Handling all encodings inside a single object makes it very difficult\n// to reason about this code, so it should be split up in the future.\n// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code\n// points as used by CESU-8.\nvar StringDecoder = exports.StringDecoder = function(encoding) {\n  this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');\n  assertEncoding(encoding);\n  switch (this.encoding) {\n    case 'utf8':\n      // CESU-8 represents each of Surrogate Pair by 3-bytes\n      this.surrogateSize = 3;\n      break;\n    case 'ucs2':\n    case 'utf16le':\n      // UTF-16 represents each of Surrogate Pair by 2-bytes\n      this.surrogateSize = 2;\n      this.detectIncompleteChar = utf16DetectIncompleteChar;\n      break;\n    case 'base64':\n      // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\n      this.surrogateSize = 3;\n      this.detectIncompleteChar = base64DetectIncompleteChar;\n      break;\n    default:\n      this.write = passThroughWrite;\n      return;\n  }\n\n  // Enough space to store all bytes of a single character. UTF-8 needs 4\n  // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).\n  this.charBuffer = new Buffer(6);\n  // Number of bytes received for the current incomplete multi-byte character.\n  this.charReceived = 0;\n  // Number of bytes expected for the current incomplete multi-byte character.\n  this.charLength = 0;\n};\n\n\n// write decodes the given buffer and returns it as JS string that is\n// guaranteed to not contain any partial multi-byte characters. Any partial\n// character found at the end of the buffer is buffered up, and will be\n// returned when calling write again with the remaining bytes.\n//\n// Note: Converting a Buffer containing an orphan surrogate to a String\n// currently works, but converting a String to a Buffer (via `new Buffer`, or\n// Buffer#write) will replace incomplete surrogates with the unicode\n// replacement character. See https://codereview.chromium.org/121173009/ .\nStringDecoder.prototype.write = function(buffer) {\n  var charStr = '';\n  // if our last write ended with an incomplete multibyte character\n  while (this.charLength) {\n    // determine how many remaining bytes this buffer has to offer for this char\n    var available = (buffer.length >= this.charLength - this.charReceived) ?\n        this.charLength - this.charReceived :\n        buffer.length;\n\n    // add the new bytes to the char buffer\n    buffer.copy(this.charBuffer, this.charReceived, 0, available);\n    this.charReceived += available;\n\n    if (this.charReceived < this.charLength) {\n      // still not enough chars in this buffer? wait for more ...\n      return '';\n    }\n\n    // remove bytes belonging to the current character from the buffer\n    buffer = buffer.slice(available, buffer.length);\n\n    // get the character that was split\n    charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\n\n    // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n    var charCode = charStr.charCodeAt(charStr.length - 1);\n    if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n      this.charLength += this.surrogateSize;\n      charStr = '';\n      continue;\n    }\n    this.charReceived = this.charLength = 0;\n\n    // if there are no more bytes in this buffer, just emit our char\n    if (buffer.length === 0) {\n      return charStr;\n    }\n    break;\n  }\n\n  // determine and set charLength / charReceived\n  this.detectIncompleteChar(buffer);\n\n  var end = buffer.length;\n  if (this.charLength) {\n    // buffer the incomplete character bytes we got\n    buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);\n    end -= this.charReceived;\n  }\n\n  charStr += buffer.toString(this.encoding, 0, end);\n\n  var end = charStr.length - 1;\n  var charCode = charStr.charCodeAt(end);\n  // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n  if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n    var size = this.surrogateSize;\n    this.charLength += size;\n    this.charReceived += size;\n    this.charBuffer.copy(this.charBuffer, size, 0, size);\n    buffer.copy(this.charBuffer, 0, 0, size);\n    return charStr.substring(0, end);\n  }\n\n  // or just emit the charStr\n  return charStr;\n};\n\n// detectIncompleteChar determines if there is an incomplete UTF-8 character at\n// the end of the given buffer. If so, it sets this.charLength to the byte\n// length that character, and sets this.charReceived to the number of bytes\n// that are available for this character.\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\n  // determine how many bytes we have to check at the end of this buffer\n  var i = (buffer.length >= 3) ? 3 : buffer.length;\n\n  // Figure out if one of the last i bytes of our buffer announces an\n  // incomplete char.\n  for (; i > 0; i--) {\n    var c = buffer[buffer.length - i];\n\n    // See http://en.wikipedia.org/wiki/UTF-8#Description\n\n    // 110XXXXX\n    if (i == 1 && c >> 5 == 0x06) {\n      this.charLength = 2;\n      break;\n    }\n\n    // 1110XXXX\n    if (i <= 2 && c >> 4 == 0x0E) {\n      this.charLength = 3;\n      break;\n    }\n\n    // 11110XXX\n    if (i <= 3 && c >> 3 == 0x1E) {\n      this.charLength = 4;\n      break;\n    }\n  }\n  this.charReceived = i;\n};\n\nStringDecoder.prototype.end = function(buffer) {\n  var res = '';\n  if (buffer && buffer.length)\n    res = this.write(buffer);\n\n  if (this.charReceived) {\n    var cr = this.charReceived;\n    var buf = this.charBuffer;\n    var enc = this.encoding;\n    res += buf.slice(0, cr).toString(enc);\n  }\n\n  return res;\n};\n\nfunction passThroughWrite(buffer) {\n  return buffer.toString(this.encoding);\n}\n\nfunction utf16DetectIncompleteChar(buffer) {\n  this.charReceived = buffer.length % 2;\n  this.charLength = this.charReceived ? 2 : 0;\n}\n\nfunction base64DetectIncompleteChar(buffer) {\n  this.charReceived = buffer.length % 3;\n  this.charLength = this.charReceived ? 3 : 0;\n}\n\n},{\"buffer\":3}],68:[function(require,module,exports){\n(function (global){\n\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n  if (config('noDeprecation')) {\n    return fn;\n  }\n\n  var warned = false;\n  function deprecated() {\n    if (!warned) {\n      if (config('throwDeprecation')) {\n        throw new Error(msg);\n      } else if (config('traceDeprecation')) {\n        console.trace(msg);\n      } else {\n        console.warn(msg);\n      }\n      warned = true;\n    }\n    return fn.apply(this, arguments);\n  }\n\n  return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n  // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n  try {\n    if (!global.localStorage) return false;\n  } catch (_) {\n    return false;\n  }\n  var val = global.localStorage[name];\n  if (null == val) return false;\n  return String(val).toLowerCase() === 'true';\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],69:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = assemble;\n\nvar _assign = require('fast.js/object/assign');\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _unpack = require('./unpack');\n\nvar _unpack2 = _interopRequireDefault(_unpack);\n\nvar _parseRawXml = require('./parseRawXml');\n\nvar _parseRawXml2 = _interopRequireDefault(_parseRawXml);\n\nvar _parseHelpers = require('./parseHelpers');\n\nvar _modelHelpers = require('./modelHelpers');\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\nfunction threeMFInfo(data) {\n  var tag = data.tag;\n  var unit = tag.attributes['unit'];\n  var version = tag.attributes['version'];\n  return { unit: unit, version: version };\n}\n\nfunction extractMetadata(data) {\n  var tag = data.tag;\n  var text = data.text;\n\n  var name = tag.attributes['name'];\n  var value = text;\n  var result = {};\n  result[name] = value;\n  return result;\n}\n\nfunction vertexCoordinate(data) {\n  var tag = data.tag;\n\n  var vertexCoords = (0, _parseHelpers.parseVector3)(tag);\n  return vertexCoords;\n}\n\nfunction vertexIndices(data) {\n  var tag = data.tag;\n\n  var vertexIndices = (0, _parseHelpers.parseIndices)(tag);\n  return vertexIndices;\n}\n\nfunction vertexColors(data) {\n  var tag = data.tag;\n\n  var colorIds = ['pid', 'p1', 'p2', 'p3'].reduce(function (result, key) {\n    if (key in tag.attributes) {\n      var value = tag.attributes[key];\n      result[key] = parseInt(value, 10);\n    }\n    return result;\n  }, {});\n\n  var output = (0, _assign2.default)({}, colorIds, vertexIndices(data));\n  return output;\n}\n\nfunction component(data) {\n  var tag = data.tag;\n\n  return ['objectid', 'transform'].reduce(function (result, key) {\n    if (key in tag.attributes) {\n      result[key] = tag.attributes[key];\n    }\n    return result;\n  }, {});\n}\n\nfunction extractColor(data) {\n  var tag = data.tag;\n\n  var color = tag.attributes['color'];\n  if (color) {\n    color = (0, _parseHelpers.hexToRgba)(color);\n    color = (0, _parseHelpers.normalizeRgba)(color);\n  }\n  return color;\n}\n\nfunction extractColorGroup(data) {\n  var tag = data.tag;\n\n  var colorgroupData = ['id'].reduce(function (result, key) {\n    if (key in tag.attributes) {\n      var value = tag.attributes[key];\n      result[key] = parseInt(value, 10);\n    }\n    return result;\n  }, {});\n\n  return colorgroupData;\n}\n\nfunction makeActions(rawData$) {\n  var metadata$ = rawData$.filter(function (d) {\n    return d.tag.name === 'metadata' && d.text;\n  }).map(extractMetadata);\n\n  var vCoords$ = rawData$.filter(function (d) {\n    return d.tag.name === 'vertex' && d.start;\n  }).map(vertexCoordinate);\n\n  var triangle$ = rawData$.filter(function (d) {\n    return d.tag.name === 'triangle' && d.start;\n  }).share();\n\n  var vIndices$ = triangle$.map(vertexIndices);\n\n  var vColors$ = triangle$.filter(function (data) {\n    return data.tag.attributes.hasOwnProperty('pid') && (data.tag.attributes.hasOwnProperty('p1') || data.tag.attributes.hasOwnProperty('p2') || data.tag.attributes.hasOwnProperty('p3'));\n  }).map(vertexColors);\n\n  var vNormals$ = triangle$.map(vertexIndices);\n\n  var vCoords2$ = triangle$.map(vertexIndices);\n\n  var startObject$ = rawData$.filter(function (d) {\n    return d.tag.name === 'object' && d.start;\n  });\n\n  var finishObject$ = rawData$.filter(function (d) {\n    return d.tag.name === 'object' && d.end;\n  });\n\n  var finishBuild$ = rawData$.filter(function (d) {\n    return d.tag.name === 'build' && d.end;\n  });\n\n  var item$ = rawData$.filter(function (d) {\n    return d.tag.name === 'item' && d.start;\n  });\n\n  // colors & materials\n  var colorGroup$ = rawData$.filter(function (d) {\n    return d.tag.name === 'm:colorgroup' && d.end;\n  }).map(extractColorGroup);\n\n  var color$ = rawData$.filter(function (d) {\n    return d.tag.name === 'm:color' && d.start;\n  }).map(extractColor);\n\n  return {\n    metadata$: metadata$,\n    color$: color$,\n    colorGroup$: colorGroup$,\n    vCoords$: vCoords$,\n    vCoords2$: vCoords2$,\n    vIndices$: vIndices$,\n    vNormals$: vNormals$,\n    vColors$: vColors$,\n    startObject$: startObject$,\n    finishObject$: finishObject$,\n    item$: item$,\n    finishBuild$: finishBuild$\n  };\n}\n\nfunction makeReducers() {\n  var updateFns = {\n    metadata: metadata,\n    color: color,\n    colorGroup: colorGroup,\n    vCoords: vCoords,\n    vCoords2: vCoords2,\n    vIndices: vIndices,\n    vNormals: vNormals,\n    vColors: vColors,\n    startObject: startObject,\n    finishObject: finishObject,\n    item: item,\n    finishBuild: finishBuild\n  };\n  return updateFns;\n}\n\n/*\n  const components$  = rawData$\n  const component$  = rawData$*/\n\nfunction metadata(state, input) {\n  var metadata = (0, _assign2.default)({}, state.metadata, input);\n  state.metadata = metadata;\n  return state;\n}\n\nfunction vCoords(state, input) {\n  state.currentObject.positions = state.currentObject.positions.concat(input);\n  // state = assign(state, )\n  // console.log(\"positions\",input, state.currentObject.positions)\n  return state;\n}\n\nfunction vCoords2(state, input) {\n  var positions = state.currentObject.positions;\n  var A = [positions[input[0] * 3], positions[input[0] * 3 + 1], positions[input[0] * 3 + 2]];\n  var B = [positions[input[1] * 3], positions[input[1] * 3 + 1], positions[input[1] * 3 + 2]];\n  var C = [positions[input[2] * 3], positions[input[2] * 3 + 1], positions[input[2] * 3 + 2]];\n\n  // console.log(\"positions 2\",positions, A, B, C)\n  state.currentObject._attributes.positions = state.currentObject._attributes.positions.concat(A).concat(B).concat(C);\n  return state;\n}\n\nfunction vIndices(state, input) {\n  state.currentObject._attributes.indices = state.currentObject._attributes.indices.concat(input);\n  return state;\n}\n\nfunction vNormals(state, input) {\n  // see specs : A triangle face normal (for triangle ABC, in that order) throughout this specification is defined as\n  // a unit vector in the direction of the vector cross product (B - A) x (C - A).\n  // (B - A) x (C - A).\n  var normalIndices = [input[0], input[1], input[2]];\n  var positions = state.currentObject.positions;\n\n  var A = [positions[input[0] * 3], positions[input[0] * 3 + 1], positions[input[0] * 3 + 2]];\n  var B = [positions[input[1] * 3], positions[input[1] * 3 + 1], positions[input[1] * 3 + 2]];\n  var C = [positions[input[2] * 3], positions[input[2] * 3 + 1], positions[input[2] * 3 + 2]];\n\n  // console.log(\"indices\",normalIndices,input[0], positions, \"A\",A,\"B\",B,\"C\",C)\n\n  function cross(a, b) {\n    var ax = a[0],\n        ay = a[1],\n        az = a[2];\n    var bx = b[0],\n        by = b[1],\n        bz = b[2];\n\n    var x = ay * bz - az * by;\n    var y = az * bx - ax * bz;\n    var z = ax * by - ay * bx;\n    return [x, y, z];\n  }\n  function sub(a, b) {\n    return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];\n  }\n\n  function length(v) {\n    return Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);\n  }\n\n  function multiplyScalar(v, s) {\n    return [v[0] * s, v[1] * s, v[2] * s];\n  }\n  function divideScalar(vector, scalar) {\n    return multiplyScalar(vector, 1 / scalar);\n  }\n\n  function normalize(v) {\n    return divideScalar(v, length(v));\n  }\n\n  var normal = normalize(cross(sub(B, A), sub(C, A)));\n\n  function assignAtIndex(target, startIndex, data) {\n    for (var i = 0; i < 3; i++) {\n      console.log('assign', target, startIndex, data, data[i]);\n      target[startIndex + i] = data[i];\n    }\n  }\n\n  function assignAllAtIndices(target, indices, data) {\n    indices.forEach(function (cindex) {\n      assignAtIndex(target, cindex * 3, data);\n    });\n  }\n\n  state.currentObject._attributes.normals = state.currentObject._attributes.normals.concat(normal).concat(normal).concat(normal);\n\n  return state;\n}\n\nfunction vColors(state, input) {\n  // FIXME: deal with color GROUPS\n  // console.log(\"vColors\",input)\n  var colorGroup = state.colors[input.pid];\n\n  var p1 = 'p1' in input;\n  var p2 = 'p2' in input;\n  var p3 = 'p3' in input;\n\n  var p1Decides = p1 && !p2 && !p3;\n  var allP = p1 && p2 && p3;\n\n  var colors = [];\n\n  function assignAtIndex(target, startIndex, data) {\n    for (var i = 0; i < 4; i++) {\n      target[startIndex + i] = data[i];\n    }\n  }\n\n  function assignAllAtIndices(target, indices, data) {\n    indices.forEach(function (cindex, index) {\n      assignAtIndex(target, cindex * 4, data[index]);\n    });\n  }\n  var colorIndices = [input[0], input[1], input[2]];\n\n  /* if(state.currentObject._attributes.colors.length ===0){\n    state.currentObject._attributes.colors = new Array(7)\n  }*/\n\n  if (allP) {\n    colors = colorGroup[input.p1].concat(colorGroup[input.p2], colorGroup[input.p3]);\n    // const values = [colorGroup[input.p1], colorGroup[input.p2], colorGroup[input.p3]]\n    // assignAllAtIndices(state.currentObject._attributes.colors, colorIndices, values)\n  } else if (p1Decides) {\n      var p1Color = colorGroup[input.p1];\n      colors = p1Color.concat(p1Color, p1Color);\n\n      // const values = [p1Color,p1Color,p1Color]\n      // assignAllAtIndices(state.currentObject._attributes.colors, colorIndices, values)\n    }\n\n  if (colors.length > 0) {\n    state.currentObject._attributes.colors = state.currentObject._attributes.colors.concat(colors);\n  }\n\n  return state;\n}\n\nfunction color(state, input) {\n  // state.colors = state.colors.concat( input )\n  state.currentColorGroup.push(input);\n  return state;\n}\n\nfunction colorGroup(state, input) {\n  state.colors[input.id] = state.currentColorGroup;\n  state.currentColorGroup = [];\n  return state;\n}\n\nfunction startObject(state, input) {\n  var tag = input.tag;\n\n  var object = ['id', 'name', 'type', 'pid'].reduce(function (result, key) {\n    if (key in tag.attributes) {\n      result[key] = tag.attributes[key];\n    }\n    return result;\n  }, {});\n  state.currentObject = (0, _assign2.default)({}, state.currentObject, object);\n  return state;\n}\n\nfunction finishObject(state, input) {\n  state.objects[state.currentObject.id] = (0, _parseHelpers.createModelBuffers)(state.currentObject);\n\n  state.currentObject = {\n    id: undefined,\n    name: undefined,\n    positions: [],\n    _attributes: {\n      positions: [],\n      normals: [],\n      indices: [],\n      colors: []\n    }\n  };\n  return state;\n}\n\nfunction item(state, input) {\n  var tag = input.tag;\n\n  var item = ['objectid', 'transform', 'partnumber'].reduce(function (result, key) {\n    if (key in tag.attributes) {\n      if (key === 'transform') {\n        result['transforms'] = tag.attributes[key].split(' ').map(function (t) {\n          return parseFloat(t);\n        });\n      } else {\n        result[key] = tag.attributes[key];\n      }\n    }\n    return result;\n  }, {});\n\n  state.build = state.build.concat([item]);\n  return state;\n}\n\nfunction finishBuild(state, input) {\n  state._finished = true;\n  return state;\n}\n\nfunction assemble(data) {\n  var rawData$ = (0, _unpack2.default)(data).flatMap(_parseRawXml2.default).share();\n\n  var defaultData = {\n    metadata: {},\n    objects: {},\n    build: [],\n    colors: {},\n    currentObject: {\n      id: undefined,\n      positions: [],\n      _attributes: {\n        positions: [],\n        normals: [],\n        indices: [],\n        colors: []\n      }\n    },\n    currentColorGroup: []\n  };\n\n  var actions = makeActions(rawData$);\n  var updateFns = makeReducers();\n  var data$ = (0, _modelHelpers.makeModel)(defaultData, updateFns, actions);\n  return data$;\n}\n\n},{\"./modelHelpers\":71,\"./parseHelpers\":72,\"./parseRawXml\":73,\"./unpack\":74,\"fast.js/object/assign\":8}],70:[function(require,module,exports){\n(function (global){\n'use strict';Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=parse;var _assign=require('fast.js/object/assign');var _assign2=_interopRequireDefault(_assign);var _rx=typeof window!==\"undefined\"?window['Rx']:typeof global!==\"undefined\"?global['Rx']:null;var _rx2=_interopRequireDefault(_rx);var _assemble=require('./assemble');var _assemble2=_interopRequireDefault(_assemble);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var detectEnv=require('composite-detect'); // TODO: we need to modify the way Jam handles the data , as we do not only return a single geometry/mesh but\n// a full hierarchy etc\nfunction parse(data){var parameters=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var defaults={useWorker:detectEnv.isBrowser===true};parameters=(0,_assign2.default)({},defaults,parameters);var _parameters=parameters;var useWorker=_parameters.useWorker;var obs=new _rx2.default.ReplaySubject(1);if(useWorker){(function(){var worker=new Worker(window.URL.createObjectURL(new Blob(['(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);throw new Error(\"Cannot find module \\'\"+o+\"\\'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\\nvar lookup = \\'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\\';\\n\\n;(function (exports) {\\n\\t\\'use strict\\';\\n\\n  var Arr = (typeof Uint8Array !== \\'undefined\\')\\n    ? Uint8Array\\n    : Array\\n\\n\\tvar PLUS   = \\'+\\'.charCodeAt(0)\\n\\tvar SLASH  = \\'/\\'.charCodeAt(0)\\n\\tvar NUMBER = \\'0\\'.charCodeAt(0)\\n\\tvar LOWER  = \\'a\\'.charCodeAt(0)\\n\\tvar UPPER  = \\'A\\'.charCodeAt(0)\\n\\tvar PLUS_URL_SAFE = \\'-\\'.charCodeAt(0)\\n\\tvar SLASH_URL_SAFE = \\'_\\'.charCodeAt(0)\\n\\n\\tfunction decode (elt) {\\n\\t\\tvar code = elt.charCodeAt(0)\\n\\t\\tif (code === PLUS ||\\n\\t\\t    code === PLUS_URL_SAFE)\\n\\t\\t\\treturn 62 // \\'+\\'\\n\\t\\tif (code === SLASH ||\\n\\t\\t    code === SLASH_URL_SAFE)\\n\\t\\t\\treturn 63 // \\'/\\'\\n\\t\\tif (code < NUMBER)\\n\\t\\t\\treturn -1 //no match\\n\\t\\tif (code < NUMBER + 10)\\n\\t\\t\\treturn code - NUMBER + 26 + 26\\n\\t\\tif (code < UPPER + 26)\\n\\t\\t\\treturn code - UPPER\\n\\t\\tif (code < LOWER + 26)\\n\\t\\t\\treturn code - LOWER + 26\\n\\t}\\n\\n\\tfunction b64ToByteArray (b64) {\\n\\t\\tvar i, j, l, tmp, placeHolders, arr\\n\\n\\t\\tif (b64.length % 4 > 0) {\\n\\t\\t\\tthrow new Error(\\'Invalid string. Length must be a multiple of 4\\')\\n\\t\\t}\\n\\n\\t\\t// the number of equal signs (place holders)\\n\\t\\t// if there are two placeholders, than the two characters before it\\n\\t\\t// represent one byte\\n\\t\\t// if there is only one, then the three characters before it represent 2 bytes\\n\\t\\t// this is just a cheap hack to not do indexOf twice\\n\\t\\tvar len = b64.length\\n\\t\\tplaceHolders = \\'=\\' === b64.charAt(len - 2) ? 2 : \\'=\\' === b64.charAt(len - 1) ? 1 : 0\\n\\n\\t\\t// base64 is 4/3 + up to two characters of the original data\\n\\t\\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\\n\\n\\t\\t// if there are placeholders, only get up to the last complete 4 chars\\n\\t\\tl = placeHolders > 0 ? b64.length - 4 : b64.length\\n\\n\\t\\tvar L = 0\\n\\n\\t\\tfunction push (v) {\\n\\t\\t\\tarr[L++] = v\\n\\t\\t}\\n\\n\\t\\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\\n\\t\\t\\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\\n\\t\\t\\tpush((tmp & 0xFF0000) >> 16)\\n\\t\\t\\tpush((tmp & 0xFF00) >> 8)\\n\\t\\t\\tpush(tmp & 0xFF)\\n\\t\\t}\\n\\n\\t\\tif (placeHolders === 2) {\\n\\t\\t\\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\\n\\t\\t\\tpush(tmp & 0xFF)\\n\\t\\t} else if (placeHolders === 1) {\\n\\t\\t\\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\\n\\t\\t\\tpush((tmp >> 8) & 0xFF)\\n\\t\\t\\tpush(tmp & 0xFF)\\n\\t\\t}\\n\\n\\t\\treturn arr\\n\\t}\\n\\n\\tfunction uint8ToBase64 (uint8) {\\n\\t\\tvar i,\\n\\t\\t\\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\\n\\t\\t\\toutput = \"\",\\n\\t\\t\\ttemp, length\\n\\n\\t\\tfunction encode (num) {\\n\\t\\t\\treturn lookup.charAt(num)\\n\\t\\t}\\n\\n\\t\\tfunction tripletToBase64 (num) {\\n\\t\\t\\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\\n\\t\\t}\\n\\n\\t\\t// go through the array every three bytes, we\\'ll deal with trailing stuff later\\n\\t\\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\\n\\t\\t\\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\\n\\t\\t\\toutput += tripletToBase64(temp)\\n\\t\\t}\\n\\n\\t\\t// pad the end with zeros, but make sure to not forget the extra bytes\\n\\t\\tswitch (extraBytes) {\\n\\t\\t\\tcase 1:\\n\\t\\t\\t\\ttemp = uint8[uint8.length - 1]\\n\\t\\t\\t\\toutput += encode(temp >> 2)\\n\\t\\t\\t\\toutput += encode((temp << 4) & 0x3F)\\n\\t\\t\\t\\toutput += \\'==\\'\\n\\t\\t\\t\\tbreak\\n\\t\\t\\tcase 2:\\n\\t\\t\\t\\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\\n\\t\\t\\t\\toutput += encode(temp >> 10)\\n\\t\\t\\t\\toutput += encode((temp >> 4) & 0x3F)\\n\\t\\t\\t\\toutput += encode((temp << 2) & 0x3F)\\n\\t\\t\\t\\toutput += \\'=\\'\\n\\t\\t\\t\\tbreak\\n\\t\\t}\\n\\n\\t\\treturn output\\n\\t}\\n\\n\\texports.toByteArray = b64ToByteArray\\n\\texports.fromByteArray = uint8ToBase64\\n}(typeof exports === \\'undefined\\' ? (this.base64js = {}) : exports))\\n\\n},{}],2:[function(require,module,exports){\\n\\'use strict\\';\\n\\n/**\\n * Analogue of Object.assign().\\n * Copies properties from one or more source objects to\\n * a target object. Existing keys on the target object will be overwritten.\\n *\\n * > Note: This differs from spec in some important ways:\\n * > 1. Will throw if passed non-objects, including `undefined` or `null` values.\\n * > 2. Does not support the curious Exception handling behavior, exceptions are thrown immediately.\\n * > For more details, see:\\n * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\\n *\\n *\\n *\\n * @param  {Object} target      The target object to copy properties to.\\n * @param  {Object} source, ... The source(s) to copy properties from.\\n * @return {Object}             The updated target object.\\n */\\nmodule.exports = function fastAssign (target) {\\n  var totalArgs = arguments.length,\\n      source, i, totalKeys, keys, key, j;\\n\\n  for (i = 1; i < totalArgs; i++) {\\n    source = arguments[i];\\n    keys = Object.keys(source);\\n    totalKeys = keys.length;\\n    for (j = 0; j < totalKeys; j++) {\\n      key = keys[j];\\n      target[key] = source[key];\\n    }\\n  }\\n  return target;\\n};\\n\\n},{}],3:[function(require,module,exports){\\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\\n  var e, m\\n  var eLen = nBytes * 8 - mLen - 1\\n  var eMax = (1 << eLen) - 1\\n  var eBias = eMax >> 1\\n  var nBits = -7\\n  var i = isLE ? (nBytes - 1) : 0\\n  var d = isLE ? -1 : 1\\n  var s = buffer[offset + i]\\n\\n  i += d\\n\\n  e = s & ((1 << (-nBits)) - 1)\\n  s >>= (-nBits)\\n  nBits += eLen\\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\\n\\n  m = e & ((1 << (-nBits)) - 1)\\n  e >>= (-nBits)\\n  nBits += mLen\\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\\n\\n  if (e === 0) {\\n    e = 1 - eBias\\n  } else if (e === eMax) {\\n    return m ? NaN : ((s ? -1 : 1) * Infinity)\\n  } else {\\n    m = m + Math.pow(2, mLen)\\n    e = e - eBias\\n  }\\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\\n}\\n\\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\\n  var e, m, c\\n  var eLen = nBytes * 8 - mLen - 1\\n  var eMax = (1 << eLen) - 1\\n  var eBias = eMax >> 1\\n  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\\n  var i = isLE ? 0 : (nBytes - 1)\\n  var d = isLE ? 1 : -1\\n  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\\n\\n  value = Math.abs(value)\\n\\n  if (isNaN(value) || value === Infinity) {\\n    m = isNaN(value) ? 1 : 0\\n    e = eMax\\n  } else {\\n    e = Math.floor(Math.log(value) / Math.LN2)\\n    if (value * (c = Math.pow(2, -e)) < 1) {\\n      e--\\n      c *= 2\\n    }\\n    if (e + eBias >= 1) {\\n      value += rt / c\\n    } else {\\n      value += rt * Math.pow(2, 1 - eBias)\\n    }\\n    if (value * c >= 2) {\\n      e++\\n      c /= 2\\n    }\\n\\n    if (e + eBias >= eMax) {\\n      m = 0\\n      e = eMax\\n    } else if (e + eBias >= 1) {\\n      m = (value * c - 1) * Math.pow(2, mLen)\\n      e = e + eBias\\n    } else {\\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\\n      e = 0\\n    }\\n  }\\n\\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\\n\\n  e = (e << mLen) | m\\n  eLen += mLen\\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\\n\\n  buffer[offset + i - d] |= s * 128\\n}\\n\\n},{}],4:[function(require,module,exports){\\nif (typeof Object.create === \\'function\\') {\\n  // implementation from standard node.js \\'util\\' module\\n  module.exports = function inherits(ctor, superCtor) {\\n    ctor.super_ = superCtor\\n    ctor.prototype = Object.create(superCtor.prototype, {\\n      constructor: {\\n        value: ctor,\\n        enumerable: false,\\n        writable: true,\\n        configurable: true\\n      }\\n    });\\n  };\\n} else {\\n  // old school shim for old browsers\\n  module.exports = function inherits(ctor, superCtor) {\\n    ctor.super_ = superCtor\\n    var TempCtor = function () {}\\n    TempCtor.prototype = superCtor.prototype\\n    ctor.prototype = new TempCtor()\\n    ctor.prototype.constructor = ctor\\n  }\\n}\\n\\n},{}],5:[function(require,module,exports){\\n\\'use strict\\';\\nvar DataReader = require(\\'./dataReader\\');\\n\\nfunction ArrayReader(data) {\\n    if (data) {\\n        this.data = data;\\n        this.length = this.data.length;\\n        this.index = 0;\\n        this.zero = 0;\\n\\n        for(var i = 0; i < this.data.length; i++) {\\n            data[i] = data[i] & 0xFF;\\n        }\\n    }\\n}\\nArrayReader.prototype = new DataReader();\\n/**\\n * @see DataReader.byteAt\\n */\\nArrayReader.prototype.byteAt = function(i) {\\n    return this.data[this.zero + i];\\n};\\n/**\\n * @see DataReader.lastIndexOfSignature\\n */\\nArrayReader.prototype.lastIndexOfSignature = function(sig) {\\n    var sig0 = sig.charCodeAt(0),\\n        sig1 = sig.charCodeAt(1),\\n        sig2 = sig.charCodeAt(2),\\n        sig3 = sig.charCodeAt(3);\\n    for (var i = this.length - 4; i >= 0; --i) {\\n        if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {\\n            return i - this.zero;\\n        }\\n    }\\n\\n    return -1;\\n};\\n/**\\n * @see DataReader.readData\\n */\\nArrayReader.prototype.readData = function(size) {\\n    this.checkOffset(size);\\n    if(size === 0) {\\n        return [];\\n    }\\n    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\\n    this.index += size;\\n    return result;\\n};\\nmodule.exports = ArrayReader;\\n\\n},{\"./dataReader\":10}],6:[function(require,module,exports){\\n\\'use strict\\';\\n// private property\\nvar _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\\n\\n\\n// public method for encoding\\nexports.encode = function(input, utf8) {\\n    var output = \"\";\\n    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\\n    var i = 0;\\n\\n    while (i < input.length) {\\n\\n        chr1 = input.charCodeAt(i++);\\n        chr2 = input.charCodeAt(i++);\\n        chr3 = input.charCodeAt(i++);\\n\\n        enc1 = chr1 >> 2;\\n        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\\n        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\\n        enc4 = chr3 & 63;\\n\\n        if (isNaN(chr2)) {\\n            enc3 = enc4 = 64;\\n        }\\n        else if (isNaN(chr3)) {\\n            enc4 = 64;\\n        }\\n\\n        output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);\\n\\n    }\\n\\n    return output;\\n};\\n\\n// public method for decoding\\nexports.decode = function(input, utf8) {\\n    var output = \"\";\\n    var chr1, chr2, chr3;\\n    var enc1, enc2, enc3, enc4;\\n    var i = 0;\\n\\n    input = input.replace(/[^A-Za-z0-9\\\\+\\\\/\\\\=]/g, \"\");\\n\\n    while (i < input.length) {\\n\\n        enc1 = _keyStr.indexOf(input.charAt(i++));\\n        enc2 = _keyStr.indexOf(input.charAt(i++));\\n        enc3 = _keyStr.indexOf(input.charAt(i++));\\n        enc4 = _keyStr.indexOf(input.charAt(i++));\\n\\n        chr1 = (enc1 << 2) | (enc2 >> 4);\\n        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\\n        chr3 = ((enc3 & 3) << 6) | enc4;\\n\\n        output = output + String.fromCharCode(chr1);\\n\\n        if (enc3 != 64) {\\n            output = output + String.fromCharCode(chr2);\\n        }\\n        if (enc4 != 64) {\\n            output = output + String.fromCharCode(chr3);\\n        }\\n\\n    }\\n\\n    return output;\\n\\n};\\n\\n},{}],7:[function(require,module,exports){\\n\\'use strict\\';\\nfunction CompressedObject() {\\n    this.compressedSize = 0;\\n    this.uncompressedSize = 0;\\n    this.crc32 = 0;\\n    this.compressionMethod = null;\\n    this.compressedContent = null;\\n}\\n\\nCompressedObject.prototype = {\\n    /**\\n     * Return the decompressed content in an unspecified format.\\n     * The format will depend on the decompressor.\\n     * @return {Object} the decompressed content.\\n     */\\n    getContent: function() {\\n        return null; // see implementation\\n    },\\n    /**\\n     * Return the compressed content in an unspecified format.\\n     * The format will depend on the compressed conten source.\\n     * @return {Object} the compressed content.\\n     */\\n    getCompressedContent: function() {\\n        return null; // see implementation\\n    }\\n};\\nmodule.exports = CompressedObject;\\n\\n},{}],8:[function(require,module,exports){\\n\\'use strict\\';\\nexports.STORE = {\\n    magic: \"\\\\x00\\\\x00\",\\n    compress: function(content, compressionOptions) {\\n        return content; // no compression\\n    },\\n    uncompress: function(content) {\\n        return content; // no compression\\n    },\\n    compressInputType: null,\\n    uncompressInputType: null\\n};\\nexports.DEFLATE = require(\\'./flate\\');\\n\\n},{\"./flate\":13}],9:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar utils = require(\\'./utils\\');\\n\\nvar table = [\\n    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,\\n    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,\\n    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,\\n    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,\\n    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,\\n    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,\\n    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,\\n    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,\\n    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,\\n    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,\\n    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,\\n    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,\\n    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,\\n    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,\\n    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,\\n    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,\\n    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,\\n    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,\\n    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,\\n    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,\\n    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,\\n    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,\\n    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,\\n    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,\\n    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,\\n    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,\\n    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,\\n    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,\\n    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,\\n    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,\\n    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,\\n    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,\\n    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,\\n    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,\\n    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,\\n    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,\\n    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,\\n    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,\\n    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,\\n    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,\\n    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,\\n    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,\\n    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,\\n    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,\\n    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,\\n    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,\\n    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,\\n    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,\\n    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,\\n    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,\\n    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,\\n    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,\\n    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,\\n    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,\\n    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,\\n    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,\\n    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,\\n    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,\\n    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,\\n    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,\\n    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,\\n    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,\\n    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,\\n    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D\\n];\\n\\n/**\\n *\\n *  Javascript crc32\\n *  http://www.webtoolkit.info/\\n *\\n */\\nmodule.exports = function crc32(input, crc) {\\n    if (typeof input === \"undefined\" || !input.length) {\\n        return 0;\\n    }\\n\\n    var isArray = utils.getTypeOf(input) !== \"string\";\\n\\n    if (typeof(crc) == \"undefined\") {\\n        crc = 0;\\n    }\\n    var x = 0;\\n    var y = 0;\\n    var b = 0;\\n\\n    crc = crc ^ (-1);\\n    for (var i = 0, iTop = input.length; i < iTop; i++) {\\n        b = isArray ? input[i] : input.charCodeAt(i);\\n        y = (crc ^ b) & 0xFF;\\n        x = table[y];\\n        crc = (crc >>> 8) ^ x;\\n    }\\n\\n    return crc ^ (-1);\\n};\\n// vim: set shiftwidth=4 softtabstop=4:\\n\\n},{\"./utils\":26}],10:[function(require,module,exports){\\n\\'use strict\\';\\nvar utils = require(\\'./utils\\');\\n\\nfunction DataReader(data) {\\n    this.data = null; // type : see implementation\\n    this.length = 0;\\n    this.index = 0;\\n    this.zero = 0;\\n}\\nDataReader.prototype = {\\n    /**\\n     * Check that the offset will not go too far.\\n     * @param {string} offset the additional offset to check.\\n     * @throws {Error} an Error if the offset is out of bounds.\\n     */\\n    checkOffset: function(offset) {\\n        this.checkIndex(this.index + offset);\\n    },\\n    /**\\n     * Check that the specifed index will not be too far.\\n     * @param {string} newIndex the index to check.\\n     * @throws {Error} an Error if the index is out of bounds.\\n     */\\n    checkIndex: function(newIndex) {\\n        if (this.length < this.zero + newIndex || newIndex < 0) {\\n            throw new Error(\"End of data reached (data length = \" + this.length + \", asked index = \" + (newIndex) + \"). Corrupted zip ?\");\\n        }\\n    },\\n    /**\\n     * Change the index.\\n     * @param {number} newIndex The new index.\\n     * @throws {Error} if the new index is out of the data.\\n     */\\n    setIndex: function(newIndex) {\\n        this.checkIndex(newIndex);\\n        this.index = newIndex;\\n    },\\n    /**\\n     * Skip the next n bytes.\\n     * @param {number} n the number of bytes to skip.\\n     * @throws {Error} if the new index is out of the data.\\n     */\\n    skip: function(n) {\\n        this.setIndex(this.index + n);\\n    },\\n    /**\\n     * Get the byte at the specified index.\\n     * @param {number} i the index to use.\\n     * @return {number} a byte.\\n     */\\n    byteAt: function(i) {\\n        // see implementations\\n    },\\n    /**\\n     * Get the next number with a given byte size.\\n     * @param {number} size the number of bytes to read.\\n     * @return {number} the corresponding number.\\n     */\\n    readInt: function(size) {\\n        var result = 0,\\n            i;\\n        this.checkOffset(size);\\n        for (i = this.index + size - 1; i >= this.index; i--) {\\n            result = (result << 8) + this.byteAt(i);\\n        }\\n        this.index += size;\\n        return result;\\n    },\\n    /**\\n     * Get the next string with a given byte size.\\n     * @param {number} size the number of bytes to read.\\n     * @return {string} the corresponding string.\\n     */\\n    readString: function(size) {\\n        return utils.transformTo(\"string\", this.readData(size));\\n    },\\n    /**\\n     * Get raw data without conversion, <size> bytes.\\n     * @param {number} size the number of bytes to read.\\n     * @return {Object} the raw data, implementation specific.\\n     */\\n    readData: function(size) {\\n        // see implementations\\n    },\\n    /**\\n     * Find the last occurence of a zip signature (4 bytes).\\n     * @param {string} sig the signature to find.\\n     * @return {number} the index of the last occurence, -1 if not found.\\n     */\\n    lastIndexOfSignature: function(sig) {\\n        // see implementations\\n    },\\n    /**\\n     * Get the next date.\\n     * @return {Date} the date.\\n     */\\n    readDate: function() {\\n        var dostime = this.readInt(4);\\n        return new Date(\\n        ((dostime >> 25) & 0x7f) + 1980, // year\\n        ((dostime >> 21) & 0x0f) - 1, // month\\n        (dostime >> 16) & 0x1f, // day\\n        (dostime >> 11) & 0x1f, // hour\\n        (dostime >> 5) & 0x3f, // minute\\n        (dostime & 0x1f) << 1); // second\\n    }\\n};\\nmodule.exports = DataReader;\\n\\n},{\"./utils\":26}],11:[function(require,module,exports){\\n\\'use strict\\';\\nexports.base64 = false;\\nexports.binary = false;\\nexports.dir = false;\\nexports.createFolders = false;\\nexports.date = null;\\nexports.compression = null;\\nexports.compressionOptions = null;\\nexports.comment = null;\\nexports.unixPermissions = null;\\nexports.dosPermissions = null;\\n\\n},{}],12:[function(require,module,exports){\\n\\'use strict\\';\\nvar utils = require(\\'./utils\\');\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.string2binary = function(str) {\\n    return utils.string2binary(str);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.string2Uint8Array = function(str) {\\n    return utils.transformTo(\"uint8array\", str);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.uint8Array2String = function(array) {\\n    return utils.transformTo(\"string\", array);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.string2Blob = function(str) {\\n    var buffer = utils.transformTo(\"arraybuffer\", str);\\n    return utils.arrayBuffer2Blob(buffer);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.arrayBuffer2Blob = function(buffer) {\\n    return utils.arrayBuffer2Blob(buffer);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.transformTo = function(outputType, input) {\\n    return utils.transformTo(outputType, input);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.getTypeOf = function(input) {\\n    return utils.getTypeOf(input);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.checkSupport = function(type) {\\n    return utils.checkSupport(type);\\n};\\n\\n/**\\n * @deprecated\\n * This value will be removed in a future version without replacement.\\n */\\nexports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS;\\n\\n/**\\n * @deprecated\\n * This value will be removed in a future version without replacement.\\n */\\nexports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS;\\n\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.pretty = function(str) {\\n    return utils.pretty(str);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.findCompression = function(compressionMethod) {\\n    return utils.findCompression(compressionMethod);\\n};\\n\\n/**\\n * @deprecated\\n * This function will be removed in a future version without replacement.\\n */\\nexports.isRegExp = function (object) {\\n    return utils.isRegExp(object);\\n};\\n\\n\\n},{\"./utils\":26}],13:[function(require,module,exports){\\n\\'use strict\\';\\nvar USE_TYPEDARRAY = (typeof Uint8Array !== \\'undefined\\') && (typeof Uint16Array !== \\'undefined\\') && (typeof Uint32Array !== \\'undefined\\');\\n\\nvar pako = require(\"pako\");\\nexports.uncompressInputType = USE_TYPEDARRAY ? \"uint8array\" : \"array\";\\nexports.compressInputType = USE_TYPEDARRAY ? \"uint8array\" : \"array\";\\n\\nexports.magic = \"\\\\x08\\\\x00\";\\nexports.compress = function(input, compressionOptions) {\\n    return pako.deflateRaw(input, {\\n        level : compressionOptions.level || -1 // default compression\\n    });\\n};\\nexports.uncompress =  function(input) {\\n    return pako.inflateRaw(input);\\n};\\n\\n},{\"pako\":29}],14:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar base64 = require(\\'./base64\\');\\n\\n/**\\nUsage:\\n   zip = new JSZip();\\n   zip.file(\"hello.txt\", \"Hello, World!\").file(\"tempfile\", \"nothing\");\\n   zip.folder(\"images\").file(\"smile.gif\", base64Data, {base64: true});\\n   zip.file(\"Xmas.txt\", \"Ho ho ho !\", {date : new Date(\"December 25, 2007 00:00:01\")});\\n   zip.remove(\"tempfile\");\\n\\n   base64zip = zip.generate();\\n\\n**/\\n\\n/**\\n * Representation a of zip file in js\\n * @constructor\\n * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional).\\n * @param {Object=} options the options for creating this objects (optional).\\n */\\nfunction JSZip(data, options) {\\n    // if this constructor is used without `new`, it adds `new` before itself:\\n    if(!(this instanceof JSZip)) return new JSZip(data, options);\\n\\n    // object containing the files :\\n    // {\\n    //   \"folder/\" : {...},\\n    //   \"folder/data.txt\" : {...}\\n    // }\\n    this.files = {};\\n\\n    this.comment = null;\\n\\n    // Where we are in the hierarchy\\n    this.root = \"\";\\n    if (data) {\\n        this.load(data, options);\\n    }\\n    this.clone = function() {\\n        var newObj = new JSZip();\\n        for (var i in this) {\\n            if (typeof this[i] !== \"function\") {\\n                newObj[i] = this[i];\\n            }\\n        }\\n        return newObj;\\n    };\\n}\\nJSZip.prototype = require(\\'./object\\');\\nJSZip.prototype.load = require(\\'./load\\');\\nJSZip.support = require(\\'./support\\');\\nJSZip.defaults = require(\\'./defaults\\');\\n\\n/**\\n * @deprecated\\n * This namespace will be removed in a future version without replacement.\\n */\\nJSZip.utils = require(\\'./deprecatedPublicUtils\\');\\n\\nJSZip.base64 = {\\n    /**\\n     * @deprecated\\n     * This method will be removed in a future version without replacement.\\n     */\\n    encode : function(input) {\\n        return base64.encode(input);\\n    },\\n    /**\\n     * @deprecated\\n     * This method will be removed in a future version without replacement.\\n     */\\n    decode : function(input) {\\n        return base64.decode(input);\\n    }\\n};\\nJSZip.compressions = require(\\'./compressions\\');\\nmodule.exports = JSZip;\\n\\n},{\"./base64\":6,\"./compressions\":8,\"./defaults\":11,\"./deprecatedPublicUtils\":12,\"./load\":15,\"./object\":18,\"./support\":22}],15:[function(require,module,exports){\\n\\'use strict\\';\\nvar base64 = require(\\'./base64\\');\\nvar utf8 = require(\\'./utf8\\');\\nvar utils = require(\\'./utils\\');\\nvar ZipEntries = require(\\'./zipEntries\\');\\nmodule.exports = function(data, options) {\\n    var files, zipEntries, i, input;\\n    options = utils.extend(options || {}, {\\n        base64: false,\\n        checkCRC32: false,\\n        optimizedBinaryString : false,\\n        createFolders: false,\\n        decodeFileName: utf8.utf8decode\\n    });\\n    if (options.base64) {\\n        data = base64.decode(data);\\n    }\\n\\n    zipEntries = new ZipEntries(data, options);\\n    files = zipEntries.files;\\n    for (i = 0; i < files.length; i++) {\\n        input = files[i];\\n        this.file(input.fileNameStr, input.decompressed, {\\n            binary: true,\\n            optimizedBinaryString: true,\\n            date: input.date,\\n            dir: input.dir,\\n            comment : input.fileCommentStr.length ? input.fileCommentStr : null,\\n            unixPermissions : input.unixPermissions,\\n            dosPermissions : input.dosPermissions,\\n            createFolders: options.createFolders\\n        });\\n    }\\n    if (zipEntries.zipComment.length) {\\n        this.comment = zipEntries.zipComment;\\n    }\\n\\n    return this;\\n};\\n\\n},{\"./base64\":6,\"./utf8\":25,\"./utils\":26,\"./zipEntries\":27}],16:[function(require,module,exports){\\n(function (Buffer){\\n\\'use strict\\';\\nmodule.exports = function(data, encoding){\\n    return new Buffer(data, encoding);\\n};\\nmodule.exports.test = function(b){\\n    return Buffer.isBuffer(b);\\n};\\n\\n}).call(this,require(\"buffer\").Buffer)\\n},{\"buffer\":47}],17:[function(require,module,exports){\\n\\'use strict\\';\\nvar Uint8ArrayReader = require(\\'./uint8ArrayReader\\');\\n\\nfunction NodeBufferReader(data) {\\n    this.data = data;\\n    this.length = this.data.length;\\n    this.index = 0;\\n    this.zero = 0;\\n}\\nNodeBufferReader.prototype = new Uint8ArrayReader();\\n\\n/**\\n * @see DataReader.readData\\n */\\nNodeBufferReader.prototype.readData = function(size) {\\n    this.checkOffset(size);\\n    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\\n    this.index += size;\\n    return result;\\n};\\nmodule.exports = NodeBufferReader;\\n\\n},{\"./uint8ArrayReader\":23}],18:[function(require,module,exports){\\n\\'use strict\\';\\nvar support = require(\\'./support\\');\\nvar utils = require(\\'./utils\\');\\nvar crc32 = require(\\'./crc32\\');\\nvar signature = require(\\'./signature\\');\\nvar defaults = require(\\'./defaults\\');\\nvar base64 = require(\\'./base64\\');\\nvar compressions = require(\\'./compressions\\');\\nvar CompressedObject = require(\\'./compressedObject\\');\\nvar nodeBuffer = require(\\'./nodeBuffer\\');\\nvar utf8 = require(\\'./utf8\\');\\nvar StringWriter = require(\\'./stringWriter\\');\\nvar Uint8ArrayWriter = require(\\'./uint8ArrayWriter\\');\\n\\n/**\\n * Returns the raw data of a ZipObject, decompress the content if necessary.\\n * @param {ZipObject} file the file to use.\\n * @return {String|ArrayBuffer|Uint8Array|Buffer} the data.\\n */\\nvar getRawData = function(file) {\\n    if (file._data instanceof CompressedObject) {\\n        file._data = file._data.getContent();\\n        file.options.binary = true;\\n        file.options.base64 = false;\\n\\n        if (utils.getTypeOf(file._data) === \"uint8array\") {\\n            var copy = file._data;\\n            // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array.\\n            // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file).\\n            file._data = new Uint8Array(copy.length);\\n            // with an empty Uint8Array, Opera fails with a \"Offset larger than array size\"\\n            if (copy.length !== 0) {\\n                file._data.set(copy, 0);\\n            }\\n        }\\n    }\\n    return file._data;\\n};\\n\\n/**\\n * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it.\\n * @param {ZipObject} file the file to use.\\n * @return {String|ArrayBuffer|Uint8Array|Buffer} the data.\\n */\\nvar getBinaryData = function(file) {\\n    var result = getRawData(file),\\n        type = utils.getTypeOf(result);\\n    if (type === \"string\") {\\n        if (!file.options.binary) {\\n            // unicode text !\\n            // unicode string => binary string is a painful process, check if we can avoid it.\\n            if (support.nodebuffer) {\\n                return nodeBuffer(result, \"utf-8\");\\n            }\\n        }\\n        return file.asBinary();\\n    }\\n    return result;\\n};\\n\\n/**\\n * Transform this._data into a string.\\n * @param {function} filter a function String -> String, applied if not null on the result.\\n * @return {String} the string representing this._data.\\n */\\nvar dataToString = function(asUTF8) {\\n    var result = getRawData(this);\\n    if (result === null || typeof result === \"undefined\") {\\n        return \"\";\\n    }\\n    // if the data is a base64 string, we decode it before checking the encoding !\\n    if (this.options.base64) {\\n        result = base64.decode(result);\\n    }\\n    if (asUTF8 && this.options.binary) {\\n        // JSZip.prototype.utf8decode supports arrays as input\\n        // skip to array => string step, utf8decode will do it.\\n        result = out.utf8decode(result);\\n    }\\n    else {\\n        // no utf8 transformation, do the array => string step.\\n        result = utils.transformTo(\"string\", result);\\n    }\\n\\n    if (!asUTF8 && !this.options.binary) {\\n        result = utils.transformTo(\"string\", out.utf8encode(result));\\n    }\\n    return result;\\n};\\n/**\\n * A simple object representing a file in the zip file.\\n * @constructor\\n * @param {string} name the name of the file\\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data\\n * @param {Object} options the options of the file\\n */\\nvar ZipObject = function(name, data, options) {\\n    this.name = name;\\n    this.dir = options.dir;\\n    this.date = options.date;\\n    this.comment = options.comment;\\n    this.unixPermissions = options.unixPermissions;\\n    this.dosPermissions = options.dosPermissions;\\n\\n    this._data = data;\\n    this.options = options;\\n\\n    /*\\n     * This object contains initial values for dir and date.\\n     * With them, we can check if the user changed the deprecated metadata in\\n     * `ZipObject#options` or not.\\n     */\\n    this._initialMetadata = {\\n      dir : options.dir,\\n      date : options.date\\n    };\\n};\\n\\nZipObject.prototype = {\\n    /**\\n     * Return the content as UTF8 string.\\n     * @return {string} the UTF8 string.\\n     */\\n    asText: function() {\\n        return dataToString.call(this, true);\\n    },\\n    /**\\n     * Returns the binary content.\\n     * @return {string} the content as binary.\\n     */\\n    asBinary: function() {\\n        return dataToString.call(this, false);\\n    },\\n    /**\\n     * Returns the content as a nodejs Buffer.\\n     * @return {Buffer} the content as a Buffer.\\n     */\\n    asNodeBuffer: function() {\\n        var result = getBinaryData(this);\\n        return utils.transformTo(\"nodebuffer\", result);\\n    },\\n    /**\\n     * Returns the content as an Uint8Array.\\n     * @return {Uint8Array} the content as an Uint8Array.\\n     */\\n    asUint8Array: function() {\\n        var result = getBinaryData(this);\\n        return utils.transformTo(\"uint8array\", result);\\n    },\\n    /**\\n     * Returns the content as an ArrayBuffer.\\n     * @return {ArrayBuffer} the content as an ArrayBufer.\\n     */\\n    asArrayBuffer: function() {\\n        return this.asUint8Array().buffer;\\n    }\\n};\\n\\n/**\\n * Transform an integer into a string in hexadecimal.\\n * @private\\n * @param {number} dec the number to convert.\\n * @param {number} bytes the number of bytes to generate.\\n * @returns {string} the result.\\n */\\nvar decToHex = function(dec, bytes) {\\n    var hex = \"\",\\n        i;\\n    for (i = 0; i < bytes; i++) {\\n        hex += String.fromCharCode(dec & 0xff);\\n        dec = dec >>> 8;\\n    }\\n    return hex;\\n};\\n\\n/**\\n * Transforms the (incomplete) options from the user into the complete\\n * set of options to create a file.\\n * @private\\n * @param {Object} o the options from the user.\\n * @return {Object} the complete set of options.\\n */\\nvar prepareFileAttrs = function(o) {\\n    o = o || {};\\n    if (o.base64 === true && (o.binary === null || o.binary === undefined)) {\\n        o.binary = true;\\n    }\\n    o = utils.extend(o, defaults);\\n    o.date = o.date || new Date();\\n    if (o.compression !== null) o.compression = o.compression.toUpperCase();\\n\\n    return o;\\n};\\n\\n/**\\n * Add a file in the current folder.\\n * @private\\n * @param {string} name the name of the file\\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file\\n * @param {Object} o the options of the file\\n * @return {Object} the new file.\\n */\\nvar fileAdd = function(name, data, o) {\\n    // be sure sub folders exist\\n    var dataType = utils.getTypeOf(data),\\n        parent;\\n\\n    o = prepareFileAttrs(o);\\n\\n    if (typeof o.unixPermissions === \"string\") {\\n        o.unixPermissions = parseInt(o.unixPermissions, 8);\\n    }\\n\\n    // UNX_IFDIR  0040000 see zipinfo.c\\n    if (o.unixPermissions && (o.unixPermissions & 0x4000)) {\\n        o.dir = true;\\n    }\\n    // Bit 4    Directory\\n    if (o.dosPermissions && (o.dosPermissions & 0x0010)) {\\n        o.dir = true;\\n    }\\n\\n    if (o.dir) {\\n        name = forceTrailingSlash(name);\\n    }\\n\\n    if (o.createFolders && (parent = parentFolder(name))) {\\n        folderAdd.call(this, parent, true);\\n    }\\n\\n    if (o.dir || data === null || typeof data === \"undefined\") {\\n        o.base64 = false;\\n        o.binary = false;\\n        data = null;\\n        dataType = null;\\n    }\\n    else if (dataType === \"string\") {\\n        if (o.binary && !o.base64) {\\n            // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask\\n            if (o.optimizedBinaryString !== true) {\\n                // this is a string, not in a base64 format.\\n                // Be sure that this is a correct \"binary string\"\\n                data = utils.string2binary(data);\\n            }\\n        }\\n    }\\n    else { // arraybuffer, uint8array, ...\\n        o.base64 = false;\\n        o.binary = true;\\n\\n        if (!dataType && !(data instanceof CompressedObject)) {\\n            throw new Error(\"The data of \\'\" + name + \"\\' is in an unsupported format !\");\\n        }\\n\\n        // special case : it\\'s way easier to work with Uint8Array than with ArrayBuffer\\n        if (dataType === \"arraybuffer\") {\\n            data = utils.transformTo(\"uint8array\", data);\\n        }\\n    }\\n\\n    var object = new ZipObject(name, data, o);\\n    this.files[name] = object;\\n    return object;\\n};\\n\\n/**\\n * Find the parent folder of the path.\\n * @private\\n * @param {string} path the path to use\\n * @return {string} the parent folder, or \"\"\\n */\\nvar parentFolder = function (path) {\\n    if (path.slice(-1) == \\'/\\') {\\n        path = path.substring(0, path.length - 1);\\n    }\\n    var lastSlash = path.lastIndexOf(\\'/\\');\\n    return (lastSlash > 0) ? path.substring(0, lastSlash) : \"\";\\n};\\n\\n\\n/**\\n * Returns the path with a slash at the end.\\n * @private\\n * @param {String} path the path to check.\\n * @return {String} the path with a trailing slash.\\n */\\nvar forceTrailingSlash = function(path) {\\n    // Check the name ends with a /\\n    if (path.slice(-1) != \"/\") {\\n        path += \"/\"; // IE doesn\\'t like substr(-1)\\n    }\\n    return path;\\n};\\n/**\\n * Add a (sub) folder in the current folder.\\n * @private\\n * @param {string} name the folder\\'s name\\n * @param {boolean=} [createFolders] If true, automatically create sub\\n *  folders. Defaults to false.\\n * @return {Object} the new folder.\\n */\\nvar folderAdd = function(name, createFolders) {\\n    createFolders = (typeof createFolders !== \\'undefined\\') ? createFolders : false;\\n\\n    name = forceTrailingSlash(name);\\n\\n    // Does this folder already exist?\\n    if (!this.files[name]) {\\n        fileAdd.call(this, name, null, {\\n            dir: true,\\n            createFolders: createFolders\\n        });\\n    }\\n    return this.files[name];\\n};\\n\\n/**\\n * Generate a JSZip.CompressedObject for a given zipOject.\\n * @param {ZipObject} file the object to read.\\n * @param {JSZip.compression} compression the compression to use.\\n * @param {Object} compressionOptions the options to use when compressing.\\n * @return {JSZip.CompressedObject} the compressed result.\\n */\\nvar generateCompressedObjectFrom = function(file, compression, compressionOptions) {\\n    var result = new CompressedObject(),\\n        content;\\n\\n    // the data has not been decompressed, we might reuse things !\\n    if (file._data instanceof CompressedObject) {\\n        result.uncompressedSize = file._data.uncompressedSize;\\n        result.crc32 = file._data.crc32;\\n\\n        if (result.uncompressedSize === 0 || file.dir) {\\n            compression = compressions[\\'STORE\\'];\\n            result.compressedContent = \"\";\\n            result.crc32 = 0;\\n        }\\n        else if (file._data.compressionMethod === compression.magic) {\\n            result.compressedContent = file._data.getCompressedContent();\\n        }\\n        else {\\n            content = file._data.getContent();\\n            // need to decompress / recompress\\n            result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions);\\n        }\\n    }\\n    else {\\n        // have uncompressed data\\n        content = getBinaryData(file);\\n        if (!content || content.length === 0 || file.dir) {\\n            compression = compressions[\\'STORE\\'];\\n            content = \"\";\\n        }\\n        result.uncompressedSize = content.length;\\n        result.crc32 = crc32(content);\\n        result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions);\\n    }\\n\\n    result.compressedSize = result.compressedContent.length;\\n    result.compressionMethod = compression.magic;\\n\\n    return result;\\n};\\n\\n\\n\\n\\n/**\\n * Generate the UNIX part of the external file attributes.\\n * @param {Object} unixPermissions the unix permissions or null.\\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\\n * @return {Number} a 32 bit integer.\\n *\\n * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute :\\n *\\n * TTTTsstrwxrwxrwx0000000000ADVSHR\\n * ^^^^____________________________ file type, see zipinfo.c (UNX_*)\\n *     ^^^_________________________ setuid, setgid, sticky\\n *        ^^^^^^^^^________________ permissions\\n *                 ^^^^^^^^^^______ not used ?\\n *                           ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only\\n */\\nvar generateUnixExternalFileAttr = function (unixPermissions, isDir) {\\n\\n    var result = unixPermissions;\\n    if (!unixPermissions) {\\n        // I can\\'t use octal values in strict mode, hence the hexa.\\n        //  040775 => 0x41fd\\n        // 0100664 => 0x81b4\\n        result = isDir ? 0x41fd : 0x81b4;\\n    }\\n\\n    return (result & 0xFFFF) << 16;\\n};\\n\\n/**\\n * Generate the DOS part of the external file attributes.\\n * @param {Object} dosPermissions the dos permissions or null.\\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\\n * @return {Number} a 32 bit integer.\\n *\\n * Bit 0     Read-Only\\n * Bit 1     Hidden\\n * Bit 2     System\\n * Bit 3     Volume Label\\n * Bit 4     Directory\\n * Bit 5     Archive\\n */\\nvar generateDosExternalFileAttr = function (dosPermissions, isDir) {\\n\\n    // the dir flag is already set for compatibility\\n\\n    return (dosPermissions || 0)  & 0x3F;\\n};\\n\\n/**\\n * Generate the various parts used in the construction of the final zip file.\\n * @param {string} name the file name.\\n * @param {ZipObject} file the file content.\\n * @param {JSZip.CompressedObject} compressedObject the compressed object.\\n * @param {number} offset the current offset from the start of the zip file.\\n * @param {String} platform let\\'s pretend we are this platform (change platform dependents fields)\\n * @param {Function} encodeFileName the function to encode the file name / comment.\\n * @return {object} the zip parts.\\n */\\nvar generateZipParts = function(name, file, compressedObject, offset, platform, encodeFileName) {\\n    var data = compressedObject.compressedContent,\\n        useCustomEncoding = encodeFileName !== utf8.utf8encode,\\n        encodedFileName = utils.transformTo(\"string\", encodeFileName(file.name)),\\n        utfEncodedFileName = utils.transformTo(\"string\", utf8.utf8encode(file.name)),\\n        comment = file.comment || \"\",\\n        encodedComment = utils.transformTo(\"string\", encodeFileName(comment)),\\n        utfEncodedComment = utils.transformTo(\"string\", utf8.utf8encode(comment)),\\n        useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,\\n        useUTF8ForComment = utfEncodedComment.length !== comment.length,\\n        o = file.options,\\n        dosTime,\\n        dosDate,\\n        extraFields = \"\",\\n        unicodePathExtraField = \"\",\\n        unicodeCommentExtraField = \"\",\\n        dir, date;\\n\\n\\n    // handle the deprecated options.dir\\n    if (file._initialMetadata.dir !== file.dir) {\\n        dir = file.dir;\\n    } else {\\n        dir = o.dir;\\n    }\\n\\n    // handle the deprecated options.date\\n    if(file._initialMetadata.date !== file.date) {\\n        date = file.date;\\n    } else {\\n        date = o.date;\\n    }\\n\\n    var extFileAttr = 0;\\n    var versionMadeBy = 0;\\n    if (dir) {\\n        // dos or unix, we set the dos dir flag\\n        extFileAttr |= 0x00010;\\n    }\\n    if(platform === \"UNIX\") {\\n        versionMadeBy = 0x031E; // UNIX, version 3.0\\n        extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir);\\n    } else { // DOS or other, fallback to DOS\\n        versionMadeBy = 0x0014; // DOS, version 2.0\\n        extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);\\n    }\\n\\n    // date\\n    // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html\\n    // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html\\n    // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html\\n\\n    dosTime = date.getHours();\\n    dosTime = dosTime << 6;\\n    dosTime = dosTime | date.getMinutes();\\n    dosTime = dosTime << 5;\\n    dosTime = dosTime | date.getSeconds() / 2;\\n\\n    dosDate = date.getFullYear() - 1980;\\n    dosDate = dosDate << 4;\\n    dosDate = dosDate | (date.getMonth() + 1);\\n    dosDate = dosDate << 5;\\n    dosDate = dosDate | date.getDate();\\n\\n    if (useUTF8ForFileName) {\\n        // set the unicode path extra field. unzip needs at least one extra\\n        // field to correctly handle unicode path, so using the path is as good\\n        // as any other information. This could improve the situation with\\n        // other archive managers too.\\n        // This field is usually used without the utf8 flag, with a non\\n        // unicode path in the header (winrar, winzip). This helps (a bit)\\n        // with the messy Windows\\' default compressed folders feature but\\n        // breaks on p7zip which doesn\\'t seek the unicode path extra field.\\n        // So for now, UTF-8 everywhere !\\n        unicodePathExtraField =\\n            // Version\\n            decToHex(1, 1) +\\n            // NameCRC32\\n            decToHex(crc32(encodedFileName), 4) +\\n            // UnicodeName\\n            utfEncodedFileName;\\n\\n        extraFields +=\\n            // Info-ZIP Unicode Path Extra Field\\n            \"\\\\x75\\\\x70\" +\\n            // size\\n            decToHex(unicodePathExtraField.length, 2) +\\n            // content\\n            unicodePathExtraField;\\n    }\\n\\n    if(useUTF8ForComment) {\\n\\n        unicodeCommentExtraField =\\n            // Version\\n            decToHex(1, 1) +\\n            // CommentCRC32\\n            decToHex(this.crc32(encodedComment), 4) +\\n            // UnicodeName\\n            utfEncodedComment;\\n\\n        extraFields +=\\n            // Info-ZIP Unicode Path Extra Field\\n            \"\\\\x75\\\\x63\" +\\n            // size\\n            decToHex(unicodeCommentExtraField.length, 2) +\\n            // content\\n            unicodeCommentExtraField;\\n    }\\n\\n    var header = \"\";\\n\\n    // version needed to extract\\n    header += \"\\\\x0A\\\\x00\";\\n    // general purpose bit flag\\n    // set bit 11 if utf8\\n    header += !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment) ? \"\\\\x00\\\\x08\" : \"\\\\x00\\\\x00\";\\n    // compression method\\n    header += compressedObject.compressionMethod;\\n    // last mod file time\\n    header += decToHex(dosTime, 2);\\n    // last mod file date\\n    header += decToHex(dosDate, 2);\\n    // crc-32\\n    header += decToHex(compressedObject.crc32, 4);\\n    // compressed size\\n    header += decToHex(compressedObject.compressedSize, 4);\\n    // uncompressed size\\n    header += decToHex(compressedObject.uncompressedSize, 4);\\n    // file name length\\n    header += decToHex(encodedFileName.length, 2);\\n    // extra field length\\n    header += decToHex(extraFields.length, 2);\\n\\n\\n    var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;\\n\\n    var dirRecord = signature.CENTRAL_FILE_HEADER +\\n    // version made by (00: DOS)\\n    decToHex(versionMadeBy, 2) +\\n    // file header (common to file and central directory)\\n    header +\\n    // file comment length\\n    decToHex(encodedComment.length, 2) +\\n    // disk number start\\n    \"\\\\x00\\\\x00\" +\\n    // internal file attributes TODO\\n    \"\\\\x00\\\\x00\" +\\n    // external file attributes\\n    decToHex(extFileAttr, 4) +\\n    // relative offset of local header\\n    decToHex(offset, 4) +\\n    // file name\\n    encodedFileName +\\n    // extra field\\n    extraFields +\\n    // file comment\\n    encodedComment;\\n\\n    return {\\n        fileRecord: fileRecord,\\n        dirRecord: dirRecord,\\n        compressedObject: compressedObject\\n    };\\n};\\n\\n\\n// return the actual prototype of JSZip\\nvar out = {\\n    /**\\n     * Read an existing zip and merge the data in the current JSZip object.\\n     * The implementation is in jszip-load.js, don\\'t forget to include it.\\n     * @param {String|ArrayBuffer|Uint8Array|Buffer} stream  The stream to load\\n     * @param {Object} options Options for loading the stream.\\n     *  options.base64 : is the stream in base64 ? default : false\\n     * @return {JSZip} the current JSZip object\\n     */\\n    load: function(stream, options) {\\n        throw new Error(\"Load method is not defined. Is the file jszip-load.js included ?\");\\n    },\\n\\n    /**\\n     * Filter nested files/folders with the specified function.\\n     * @param {Function} search the predicate to use :\\n     * function (relativePath, file) {...}\\n     * It takes 2 arguments : the relative path and the file.\\n     * @return {Array} An array of matching elements.\\n     */\\n    filter: function(search) {\\n        var result = [],\\n            filename, relativePath, file, fileClone;\\n        for (filename in this.files) {\\n            if (!this.files.hasOwnProperty(filename)) {\\n                continue;\\n            }\\n            file = this.files[filename];\\n            // return a new object, don\\'t let the user mess with our internal objects :)\\n            fileClone = new ZipObject(file.name, file._data, utils.extend(file.options));\\n            relativePath = filename.slice(this.root.length, filename.length);\\n            if (filename.slice(0, this.root.length) === this.root && // the file is in the current root\\n            search(relativePath, fileClone)) { // and the file matches the function\\n                result.push(fileClone);\\n            }\\n        }\\n        return result;\\n    },\\n\\n    /**\\n     * Add a file to the zip file, or search a file.\\n     * @param   {string|RegExp} name The name of the file to add (if data is defined),\\n     * the name of the file to find (if no data) or a regex to match files.\\n     * @param   {String|ArrayBuffer|Uint8Array|Buffer} data  The file data, either raw or base64 encoded\\n     * @param   {Object} o     File options\\n     * @return  {JSZip|Object|Array} this JSZip object (when adding a file),\\n     * a file (when searching by string) or an array of files (when searching by regex).\\n     */\\n    file: function(name, data, o) {\\n        if (arguments.length === 1) {\\n            if (utils.isRegExp(name)) {\\n                var regexp = name;\\n                return this.filter(function(relativePath, file) {\\n                    return !file.dir && regexp.test(relativePath);\\n                });\\n            }\\n            else { // text\\n                return this.filter(function(relativePath, file) {\\n                    return !file.dir && relativePath === name;\\n                })[0] || null;\\n            }\\n        }\\n        else { // more than one argument : we have data !\\n            name = this.root + name;\\n            fileAdd.call(this, name, data, o);\\n        }\\n        return this;\\n    },\\n\\n    /**\\n     * Add a directory to the zip file, or search.\\n     * @param   {String|RegExp} arg The name of the directory to add, or a regex to search folders.\\n     * @return  {JSZip} an object with the new directory as the root, or an array containing matching folders.\\n     */\\n    folder: function(arg) {\\n        if (!arg) {\\n            return this;\\n        }\\n\\n        if (utils.isRegExp(arg)) {\\n            return this.filter(function(relativePath, file) {\\n                return file.dir && arg.test(relativePath);\\n            });\\n        }\\n\\n        // else, name is a new folder\\n        var name = this.root + arg;\\n        var newFolder = folderAdd.call(this, name);\\n\\n        // Allow chaining by returning a new object with this folder as the root\\n        var ret = this.clone();\\n        ret.root = newFolder.name;\\n        return ret;\\n    },\\n\\n    /**\\n     * Delete a file, or a directory and all sub-files, from the zip\\n     * @param {string} name the name of the file to delete\\n     * @return {JSZip} this JSZip object\\n     */\\n    remove: function(name) {\\n        name = this.root + name;\\n        var file = this.files[name];\\n        if (!file) {\\n            // Look for any folders\\n            if (name.slice(-1) != \"/\") {\\n                name += \"/\";\\n            }\\n            file = this.files[name];\\n        }\\n\\n        if (file && !file.dir) {\\n            // file\\n            delete this.files[name];\\n        } else {\\n            // maybe a folder, delete recursively\\n            var kids = this.filter(function(relativePath, file) {\\n                return file.name.slice(0, name.length) === name;\\n            });\\n            for (var i = 0; i < kids.length; i++) {\\n                delete this.files[kids[i].name];\\n            }\\n        }\\n\\n        return this;\\n    },\\n\\n    /**\\n     * Generate the complete zip file\\n     * @param {Object} options the options to generate the zip file :\\n     * - base64, (deprecated, use type instead) true to generate base64.\\n     * - compression, \"STORE\" by default.\\n     * - type, \"base64\" by default. Values are : string, base64, uint8array, arraybuffer, blob.\\n     * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file\\n     */\\n    generate: function(options) {\\n        options = utils.extend(options || {}, {\\n            base64: true,\\n            compression: \"STORE\",\\n            compressionOptions : null,\\n            type: \"base64\",\\n            platform: \"DOS\",\\n            comment: null,\\n            mimeType: \\'application/zip\\',\\n            encodeFileName: utf8.utf8encode\\n        });\\n\\n        utils.checkSupport(options.type);\\n\\n        // accept nodejs `process.platform`\\n        if(\\n          options.platform === \\'darwin\\' ||\\n          options.platform === \\'freebsd\\' ||\\n          options.platform === \\'linux\\' ||\\n          options.platform === \\'sunos\\'\\n        ) {\\n          options.platform = \"UNIX\";\\n        }\\n        if (options.platform === \\'win32\\') {\\n          options.platform = \"DOS\";\\n        }\\n\\n        var zipData = [],\\n            localDirLength = 0,\\n            centralDirLength = 0,\\n            writer, i,\\n            encodedComment = utils.transformTo(\"string\", options.encodeFileName(options.comment || this.comment || \"\"));\\n\\n        // first, generate all the zip parts.\\n        for (var name in this.files) {\\n            if (!this.files.hasOwnProperty(name)) {\\n                continue;\\n            }\\n            var file = this.files[name];\\n\\n            var compressionName = file.options.compression || options.compression.toUpperCase();\\n            var compression = compressions[compressionName];\\n            if (!compression) {\\n                throw new Error(compressionName + \" is not a valid compression method !\");\\n            }\\n            var compressionOptions = file.options.compressionOptions || options.compressionOptions || {};\\n\\n            var compressedObject = generateCompressedObjectFrom.call(this, file, compression, compressionOptions);\\n\\n            var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength, options.platform, options.encodeFileName);\\n            localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize;\\n            centralDirLength += zipPart.dirRecord.length;\\n            zipData.push(zipPart);\\n        }\\n\\n        var dirEnd = \"\";\\n\\n        // end of central dir signature\\n        dirEnd = signature.CENTRAL_DIRECTORY_END +\\n        // number of this disk\\n        \"\\\\x00\\\\x00\" +\\n        // number of the disk with the start of the central directory\\n        \"\\\\x00\\\\x00\" +\\n        // total number of entries in the central directory on this disk\\n        decToHex(zipData.length, 2) +\\n        // total number of entries in the central directory\\n        decToHex(zipData.length, 2) +\\n        // size of the central directory   4 bytes\\n        decToHex(centralDirLength, 4) +\\n        // offset of start of central directory with respect to the starting disk number\\n        decToHex(localDirLength, 4) +\\n        // .ZIP file comment length\\n        decToHex(encodedComment.length, 2) +\\n        // .ZIP file comment\\n        encodedComment;\\n\\n\\n        // we have all the parts (and the total length)\\n        // time to create a writer !\\n        var typeName = options.type.toLowerCase();\\n        if(typeName===\"uint8array\"||typeName===\"arraybuffer\"||typeName===\"blob\"||typeName===\"nodebuffer\") {\\n            writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length);\\n        }else{\\n            writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length);\\n        }\\n\\n        for (i = 0; i < zipData.length; i++) {\\n            writer.append(zipData[i].fileRecord);\\n            writer.append(zipData[i].compressedObject.compressedContent);\\n        }\\n        for (i = 0; i < zipData.length; i++) {\\n            writer.append(zipData[i].dirRecord);\\n        }\\n\\n        writer.append(dirEnd);\\n\\n        var zip = writer.finalize();\\n\\n\\n\\n        switch(options.type.toLowerCase()) {\\n            // case \"zip is an Uint8Array\"\\n            case \"uint8array\" :\\n            case \"arraybuffer\" :\\n            case \"nodebuffer\" :\\n               return utils.transformTo(options.type.toLowerCase(), zip);\\n            case \"blob\" :\\n               return utils.arrayBuffer2Blob(utils.transformTo(\"arraybuffer\", zip), options.mimeType);\\n            // case \"zip is a string\"\\n            case \"base64\" :\\n               return (options.base64) ? base64.encode(zip) : zip;\\n            default : // case \"string\" :\\n               return zip;\\n         }\\n\\n    },\\n\\n    /**\\n     * @deprecated\\n     * This method will be removed in a future version without replacement.\\n     */\\n    crc32: function (input, crc) {\\n        return crc32(input, crc);\\n    },\\n\\n    /**\\n     * @deprecated\\n     * This method will be removed in a future version without replacement.\\n     */\\n    utf8encode: function (string) {\\n        return utils.transformTo(\"string\", utf8.utf8encode(string));\\n    },\\n\\n    /**\\n     * @deprecated\\n     * This method will be removed in a future version without replacement.\\n     */\\n    utf8decode: function (input) {\\n        return utf8.utf8decode(input);\\n    }\\n};\\nmodule.exports = out;\\n\\n},{\"./base64\":6,\"./compressedObject\":7,\"./compressions\":8,\"./crc32\":9,\"./defaults\":11,\"./nodeBuffer\":16,\"./signature\":19,\"./stringWriter\":21,\"./support\":22,\"./uint8ArrayWriter\":24,\"./utf8\":25,\"./utils\":26}],19:[function(require,module,exports){\\n\\'use strict\\';\\nexports.LOCAL_FILE_HEADER = \"PK\\\\x03\\\\x04\";\\nexports.CENTRAL_FILE_HEADER = \"PK\\\\x01\\\\x02\";\\nexports.CENTRAL_DIRECTORY_END = \"PK\\\\x05\\\\x06\";\\nexports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = \"PK\\\\x06\\\\x07\";\\nexports.ZIP64_CENTRAL_DIRECTORY_END = \"PK\\\\x06\\\\x06\";\\nexports.DATA_DESCRIPTOR = \"PK\\\\x07\\\\x08\";\\n\\n},{}],20:[function(require,module,exports){\\n\\'use strict\\';\\nvar DataReader = require(\\'./dataReader\\');\\nvar utils = require(\\'./utils\\');\\n\\nfunction StringReader(data, optimizedBinaryString) {\\n    this.data = data;\\n    if (!optimizedBinaryString) {\\n        this.data = utils.string2binary(this.data);\\n    }\\n    this.length = this.data.length;\\n    this.index = 0;\\n    this.zero = 0;\\n}\\nStringReader.prototype = new DataReader();\\n/**\\n * @see DataReader.byteAt\\n */\\nStringReader.prototype.byteAt = function(i) {\\n    return this.data.charCodeAt(this.zero + i);\\n};\\n/**\\n * @see DataReader.lastIndexOfSignature\\n */\\nStringReader.prototype.lastIndexOfSignature = function(sig) {\\n    return this.data.lastIndexOf(sig) - this.zero;\\n};\\n/**\\n * @see DataReader.readData\\n */\\nStringReader.prototype.readData = function(size) {\\n    this.checkOffset(size);\\n    // this will work because the constructor applied the \"& 0xff\" mask.\\n    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\\n    this.index += size;\\n    return result;\\n};\\nmodule.exports = StringReader;\\n\\n},{\"./dataReader\":10,\"./utils\":26}],21:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar utils = require(\\'./utils\\');\\n\\n/**\\n * An object to write any content to a string.\\n * @constructor\\n */\\nvar StringWriter = function() {\\n    this.data = [];\\n};\\nStringWriter.prototype = {\\n    /**\\n     * Append any content to the current string.\\n     * @param {Object} input the content to add.\\n     */\\n    append: function(input) {\\n        input = utils.transformTo(\"string\", input);\\n        this.data.push(input);\\n    },\\n    /**\\n     * Finalize the construction an return the result.\\n     * @return {string} the generated string.\\n     */\\n    finalize: function() {\\n        return this.data.join(\"\");\\n    }\\n};\\n\\nmodule.exports = StringWriter;\\n\\n},{\"./utils\":26}],22:[function(require,module,exports){\\n(function (Buffer){\\n\\'use strict\\';\\nexports.base64 = true;\\nexports.array = true;\\nexports.string = true;\\nexports.arraybuffer = typeof ArrayBuffer !== \"undefined\" && typeof Uint8Array !== \"undefined\";\\n// contains true if JSZip can read/generate nodejs Buffer, false otherwise.\\n// Browserify will provide a Buffer implementation for browsers, which is\\n// an augmented Uint8Array (i.e., can be used as either Buffer or U8).\\nexports.nodebuffer = typeof Buffer !== \"undefined\";\\n// contains true if JSZip can read/generate Uint8Array, false otherwise.\\nexports.uint8array = typeof Uint8Array !== \"undefined\";\\n\\nif (typeof ArrayBuffer === \"undefined\") {\\n    exports.blob = false;\\n}\\nelse {\\n    var buffer = new ArrayBuffer(0);\\n    try {\\n        exports.blob = new Blob([buffer], {\\n            type: \"application/zip\"\\n        }).size === 0;\\n    }\\n    catch (e) {\\n        try {\\n            var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\\n            var builder = new Builder();\\n            builder.append(buffer);\\n            exports.blob = builder.getBlob(\\'application/zip\\').size === 0;\\n        }\\n        catch (e) {\\n            exports.blob = false;\\n        }\\n    }\\n}\\n\\n}).call(this,require(\"buffer\").Buffer)\\n},{\"buffer\":47}],23:[function(require,module,exports){\\n\\'use strict\\';\\nvar ArrayReader = require(\\'./arrayReader\\');\\n\\nfunction Uint8ArrayReader(data) {\\n    if (data) {\\n        this.data = data;\\n        this.length = this.data.length;\\n        this.index = 0;\\n        this.zero = 0;\\n    }\\n}\\nUint8ArrayReader.prototype = new ArrayReader();\\n/**\\n * @see DataReader.readData\\n */\\nUint8ArrayReader.prototype.readData = function(size) {\\n    this.checkOffset(size);\\n    if(size === 0) {\\n        // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].\\n        return new Uint8Array(0);\\n    }\\n    var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);\\n    this.index += size;\\n    return result;\\n};\\nmodule.exports = Uint8ArrayReader;\\n\\n},{\"./arrayReader\":5}],24:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar utils = require(\\'./utils\\');\\n\\n/**\\n * An object to write any content to an Uint8Array.\\n * @constructor\\n * @param {number} length The length of the array.\\n */\\nvar Uint8ArrayWriter = function(length) {\\n    this.data = new Uint8Array(length);\\n    this.index = 0;\\n};\\nUint8ArrayWriter.prototype = {\\n    /**\\n     * Append any content to the current array.\\n     * @param {Object} input the content to add.\\n     */\\n    append: function(input) {\\n        if (input.length !== 0) {\\n            // with an empty Uint8Array, Opera fails with a \"Offset larger than array size\"\\n            input = utils.transformTo(\"uint8array\", input);\\n            this.data.set(input, this.index);\\n            this.index += input.length;\\n        }\\n    },\\n    /**\\n     * Finalize the construction an return the result.\\n     * @return {Uint8Array} the generated array.\\n     */\\n    finalize: function() {\\n        return this.data;\\n    }\\n};\\n\\nmodule.exports = Uint8ArrayWriter;\\n\\n},{\"./utils\":26}],25:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar utils = require(\\'./utils\\');\\nvar support = require(\\'./support\\');\\nvar nodeBuffer = require(\\'./nodeBuffer\\');\\n\\n/**\\n * The following functions come from pako, from pako/lib/utils/strings\\n * released under the MIT license, see pako https://github.com/nodeca/pako/\\n */\\n\\n// Table with utf8 lengths (calculated by first byte of sequence)\\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\\n// because max possible codepoint is 0x10ffff\\nvar _utf8len = new Array(256);\\nfor (var i=0; i<256; i++) {\\n  _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);\\n}\\n_utf8len[254]=_utf8len[254]=1; // Invalid sequence start\\n\\n// convert string to array (typed, when possible)\\nvar string2buf = function (str) {\\n    var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\\n\\n    // count binary size\\n    for (m_pos = 0; m_pos < str_len; m_pos++) {\\n        c = str.charCodeAt(m_pos);\\n        if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {\\n            c2 = str.charCodeAt(m_pos+1);\\n            if ((c2 & 0xfc00) === 0xdc00) {\\n                c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\\n                m_pos++;\\n            }\\n        }\\n        buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\\n    }\\n\\n    // allocate buffer\\n    if (support.uint8array) {\\n        buf = new Uint8Array(buf_len);\\n    } else {\\n        buf = new Array(buf_len);\\n    }\\n\\n    // convert\\n    for (i=0, m_pos = 0; i < buf_len; m_pos++) {\\n        c = str.charCodeAt(m_pos);\\n        if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {\\n            c2 = str.charCodeAt(m_pos+1);\\n            if ((c2 & 0xfc00) === 0xdc00) {\\n                c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\\n                m_pos++;\\n            }\\n        }\\n        if (c < 0x80) {\\n            /* one byte */\\n            buf[i++] = c;\\n        } else if (c < 0x800) {\\n            /* two bytes */\\n            buf[i++] = 0xC0 | (c >>> 6);\\n            buf[i++] = 0x80 | (c & 0x3f);\\n        } else if (c < 0x10000) {\\n            /* three bytes */\\n            buf[i++] = 0xE0 | (c >>> 12);\\n            buf[i++] = 0x80 | (c >>> 6 & 0x3f);\\n            buf[i++] = 0x80 | (c & 0x3f);\\n        } else {\\n            /* four bytes */\\n            buf[i++] = 0xf0 | (c >>> 18);\\n            buf[i++] = 0x80 | (c >>> 12 & 0x3f);\\n            buf[i++] = 0x80 | (c >>> 6 & 0x3f);\\n            buf[i++] = 0x80 | (c & 0x3f);\\n        }\\n    }\\n\\n    return buf;\\n};\\n\\n// Calculate max possible position in utf8 buffer,\\n// that will not break sequence. If that\\'s not possible\\n// - (very small limits) return max size as is.\\n//\\n// buf[] - utf8 bytes array\\n// max   - length limit (mandatory);\\nvar utf8border = function(buf, max) {\\n    var pos;\\n\\n    max = max || buf.length;\\n    if (max > buf.length) { max = buf.length; }\\n\\n    // go back from last position, until start of sequence found\\n    pos = max-1;\\n    while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\\n\\n    // Fuckup - very small and broken sequence,\\n    // return max, because we should return something anyway.\\n    if (pos < 0) { return max; }\\n\\n    // If we came to start of buffer - that means vuffer is too small,\\n    // return max too.\\n    if (pos === 0) { return max; }\\n\\n    return (pos + _utf8len[buf[pos]] > max) ? pos : max;\\n};\\n\\n// convert array to string\\nvar buf2string = function (buf) {\\n    var str, i, out, c, c_len;\\n    var len = buf.length;\\n\\n    // Reserve max possible length (2 words per char)\\n    // NB: by unknown reasons, Array is significantly faster for\\n    //     String.fromCharCode.apply than Uint16Array.\\n    var utf16buf = new Array(len*2);\\n\\n    for (out=0, i=0; i<len;) {\\n        c = buf[i++];\\n        // quick process ascii\\n        if (c < 0x80) { utf16buf[out++] = c; continue; }\\n\\n        c_len = _utf8len[c];\\n        // skip 5 & 6 byte codes\\n        if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; }\\n\\n        // apply mask on first byte\\n        c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\\n        // join the rest\\n        while (c_len > 1 && i < len) {\\n            c = (c << 6) | (buf[i++] & 0x3f);\\n            c_len--;\\n        }\\n\\n        // terminated by end of string?\\n        if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\\n\\n        if (c < 0x10000) {\\n            utf16buf[out++] = c;\\n        } else {\\n            c -= 0x10000;\\n            utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\\n            utf16buf[out++] = 0xdc00 | (c & 0x3ff);\\n        }\\n    }\\n\\n    // shrinkBuf(utf16buf, out)\\n    if (utf16buf.length !== out) {\\n        if(utf16buf.subarray) {\\n            utf16buf = utf16buf.subarray(0, out);\\n        } else {\\n            utf16buf.length = out;\\n        }\\n    }\\n\\n    // return String.fromCharCode.apply(null, utf16buf);\\n    return utils.applyFromCharCode(utf16buf);\\n};\\n\\n\\n// That\\'s all for the pako functions.\\n\\n\\n/**\\n * Transform a javascript string into an array (typed if possible) of bytes,\\n * UTF-8 encoded.\\n * @param {String} str the string to encode\\n * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.\\n */\\nexports.utf8encode = function utf8encode(str) {\\n    if (support.nodebuffer) {\\n        return nodeBuffer(str, \"utf-8\");\\n    }\\n\\n    return string2buf(str);\\n};\\n\\n\\n/**\\n * Transform a bytes array (or a representation) representing an UTF-8 encoded\\n * string into a javascript string.\\n * @param {Array|Uint8Array|Buffer} buf the data de decode\\n * @return {String} the decoded string.\\n */\\nexports.utf8decode = function utf8decode(buf) {\\n    if (support.nodebuffer) {\\n        return utils.transformTo(\"nodebuffer\", buf).toString(\"utf-8\");\\n    }\\n\\n    buf = utils.transformTo(support.uint8array ? \"uint8array\" : \"array\", buf);\\n\\n    // return buf2string(buf);\\n    // Chrome prefers to work with \"small\" chunks of data\\n    // for the method buf2string.\\n    // Firefox and Chrome has their own shortcut, IE doesn\\'t seem to really care.\\n    var result = [], k = 0, len = buf.length, chunk = 65536;\\n    while (k < len) {\\n        var nextBoundary = utf8border(buf, Math.min(k + chunk, len));\\n        if (support.uint8array) {\\n            result.push(buf2string(buf.subarray(k, nextBoundary)));\\n        } else {\\n            result.push(buf2string(buf.slice(k, nextBoundary)));\\n        }\\n        k = nextBoundary;\\n    }\\n    return result.join(\"\");\\n\\n};\\n// vim: set shiftwidth=4 softtabstop=4:\\n\\n},{\"./nodeBuffer\":16,\"./support\":22,\"./utils\":26}],26:[function(require,module,exports){\\n\\'use strict\\';\\nvar support = require(\\'./support\\');\\nvar compressions = require(\\'./compressions\\');\\nvar nodeBuffer = require(\\'./nodeBuffer\\');\\n/**\\n * Convert a string to a \"binary string\" : a string containing only char codes between 0 and 255.\\n * @param {string} str the string to transform.\\n * @return {String} the binary string.\\n */\\nexports.string2binary = function(str) {\\n    var result = \"\";\\n    for (var i = 0; i < str.length; i++) {\\n        result += String.fromCharCode(str.charCodeAt(i) & 0xff);\\n    }\\n    return result;\\n};\\nexports.arrayBuffer2Blob = function(buffer, mimeType) {\\n    exports.checkSupport(\"blob\");\\n\\tmimeType = mimeType || \\'application/zip\\';\\n\\n    try {\\n        // Blob constructor\\n        return new Blob([buffer], {\\n            type: mimeType\\n        });\\n    }\\n    catch (e) {\\n\\n        try {\\n            // deprecated, browser only, old way\\n            var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\\n            var builder = new Builder();\\n            builder.append(buffer);\\n            return builder.getBlob(mimeType);\\n        }\\n        catch (e) {\\n\\n            // well, fuck ?!\\n            throw new Error(\"Bug : can\\'t construct the Blob.\");\\n        }\\n    }\\n\\n\\n};\\n/**\\n * The identity function.\\n * @param {Object} input the input.\\n * @return {Object} the same input.\\n */\\nfunction identity(input) {\\n    return input;\\n}\\n\\n/**\\n * Fill in an array with a string.\\n * @param {String} str the string to use.\\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated).\\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.\\n */\\nfunction stringToArrayLike(str, array) {\\n    for (var i = 0; i < str.length; ++i) {\\n        array[i] = str.charCodeAt(i) & 0xFF;\\n    }\\n    return array;\\n}\\n\\n/**\\n * Transform an array-like object to a string.\\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.\\n * @return {String} the result.\\n */\\nfunction arrayLikeToString(array) {\\n    // Performances notes :\\n    // --------------------\\n    // String.fromCharCode.apply(null, array) is the fastest, see\\n    // see http://jsperf.com/converting-a-uint8array-to-a-string/2\\n    // but the stack is limited (and we can get huge arrays !).\\n    //\\n    // result += String.fromCharCode(array[i]); generate too many strings !\\n    //\\n    // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2\\n    var chunk = 65536;\\n    var result = [],\\n        len = array.length,\\n        type = exports.getTypeOf(array),\\n        k = 0,\\n        canUseApply = true;\\n      try {\\n         switch(type) {\\n            case \"uint8array\":\\n               String.fromCharCode.apply(null, new Uint8Array(0));\\n               break;\\n            case \"nodebuffer\":\\n               String.fromCharCode.apply(null, nodeBuffer(0));\\n               break;\\n         }\\n      } catch(e) {\\n         canUseApply = false;\\n      }\\n\\n      // no apply : slow and painful algorithm\\n      // default browser on android 4.*\\n      if (!canUseApply) {\\n         var resultStr = \"\";\\n         for(var i = 0; i < array.length;i++) {\\n            resultStr += String.fromCharCode(array[i]);\\n         }\\n    return resultStr;\\n    }\\n    while (k < len && chunk > 1) {\\n        try {\\n            if (type === \"array\" || type === \"nodebuffer\") {\\n                result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len))));\\n            }\\n            else {\\n                result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len))));\\n            }\\n            k += chunk;\\n        }\\n        catch (e) {\\n            chunk = Math.floor(chunk / 2);\\n        }\\n    }\\n    return result.join(\"\");\\n}\\n\\nexports.applyFromCharCode = arrayLikeToString;\\n\\n\\n/**\\n * Copy the data from an array-like to an other array-like.\\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array.\\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated.\\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.\\n */\\nfunction arrayLikeToArrayLike(arrayFrom, arrayTo) {\\n    for (var i = 0; i < arrayFrom.length; i++) {\\n        arrayTo[i] = arrayFrom[i];\\n    }\\n    return arrayTo;\\n}\\n\\n// a matrix containing functions to transform everything into everything.\\nvar transform = {};\\n\\n// string to ?\\ntransform[\"string\"] = {\\n    \"string\": identity,\\n    \"array\": function(input) {\\n        return stringToArrayLike(input, new Array(input.length));\\n    },\\n    \"arraybuffer\": function(input) {\\n        return transform[\"string\"][\"uint8array\"](input).buffer;\\n    },\\n    \"uint8array\": function(input) {\\n        return stringToArrayLike(input, new Uint8Array(input.length));\\n    },\\n    \"nodebuffer\": function(input) {\\n        return stringToArrayLike(input, nodeBuffer(input.length));\\n    }\\n};\\n\\n// array to ?\\ntransform[\"array\"] = {\\n    \"string\": arrayLikeToString,\\n    \"array\": identity,\\n    \"arraybuffer\": function(input) {\\n        return (new Uint8Array(input)).buffer;\\n    },\\n    \"uint8array\": function(input) {\\n        return new Uint8Array(input);\\n    },\\n    \"nodebuffer\": function(input) {\\n        return nodeBuffer(input);\\n    }\\n};\\n\\n// arraybuffer to ?\\ntransform[\"arraybuffer\"] = {\\n    \"string\": function(input) {\\n        return arrayLikeToString(new Uint8Array(input));\\n    },\\n    \"array\": function(input) {\\n        return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));\\n    },\\n    \"arraybuffer\": identity,\\n    \"uint8array\": function(input) {\\n        return new Uint8Array(input);\\n    },\\n    \"nodebuffer\": function(input) {\\n        return nodeBuffer(new Uint8Array(input));\\n    }\\n};\\n\\n// uint8array to ?\\ntransform[\"uint8array\"] = {\\n    \"string\": arrayLikeToString,\\n    \"array\": function(input) {\\n        return arrayLikeToArrayLike(input, new Array(input.length));\\n    },\\n    \"arraybuffer\": function(input) {\\n        return input.buffer;\\n    },\\n    \"uint8array\": identity,\\n    \"nodebuffer\": function(input) {\\n        return nodeBuffer(input);\\n    }\\n};\\n\\n// nodebuffer to ?\\ntransform[\"nodebuffer\"] = {\\n    \"string\": arrayLikeToString,\\n    \"array\": function(input) {\\n        return arrayLikeToArrayLike(input, new Array(input.length));\\n    },\\n    \"arraybuffer\": function(input) {\\n        return transform[\"nodebuffer\"][\"uint8array\"](input).buffer;\\n    },\\n    \"uint8array\": function(input) {\\n        return arrayLikeToArrayLike(input, new Uint8Array(input.length));\\n    },\\n    \"nodebuffer\": identity\\n};\\n\\n/**\\n * Transform an input into any type.\\n * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer.\\n * If no output type is specified, the unmodified input will be returned.\\n * @param {String} outputType the output type.\\n * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.\\n * @throws {Error} an Error if the browser doesn\\'t support the requested output type.\\n */\\nexports.transformTo = function(outputType, input) {\\n    if (!input) {\\n        // undefined, null, etc\\n        // an empty string won\\'t harm.\\n        input = \"\";\\n    }\\n    if (!outputType) {\\n        return input;\\n    }\\n    exports.checkSupport(outputType);\\n    var inputType = exports.getTypeOf(input);\\n    var result = transform[inputType][outputType](input);\\n    return result;\\n};\\n\\n/**\\n * Return the type of the input.\\n * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.\\n * @param {Object} input the input to identify.\\n * @return {String} the (lowercase) type of the input.\\n */\\nexports.getTypeOf = function(input) {\\n    if (typeof input === \"string\") {\\n        return \"string\";\\n    }\\n    if (Object.prototype.toString.call(input) === \"[object Array]\") {\\n        return \"array\";\\n    }\\n    if (support.nodebuffer && nodeBuffer.test(input)) {\\n        return \"nodebuffer\";\\n    }\\n    if (support.uint8array && input instanceof Uint8Array) {\\n        return \"uint8array\";\\n    }\\n    if (support.arraybuffer && input instanceof ArrayBuffer) {\\n        return \"arraybuffer\";\\n    }\\n};\\n\\n/**\\n * Throw an exception if the type is not supported.\\n * @param {String} type the type to check.\\n * @throws {Error} an Error if the browser doesn\\'t support the requested type.\\n */\\nexports.checkSupport = function(type) {\\n    var supported = support[type.toLowerCase()];\\n    if (!supported) {\\n        throw new Error(type + \" is not supported by this browser\");\\n    }\\n};\\nexports.MAX_VALUE_16BITS = 65535;\\nexports.MAX_VALUE_32BITS = -1; // well, \"\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\xFF\" is parsed as -1\\n\\n/**\\n * Prettify a string read as binary.\\n * @param {string} str the string to prettify.\\n * @return {string} a pretty string.\\n */\\nexports.pretty = function(str) {\\n    var res = \\'\\',\\n        code, i;\\n    for (i = 0; i < (str || \"\").length; i++) {\\n        code = str.charCodeAt(i);\\n        res += \\'\\\\\\\\x\\' + (code < 16 ? \"0\" : \"\") + code.toString(16).toUpperCase();\\n    }\\n    return res;\\n};\\n\\n/**\\n * Find a compression registered in JSZip.\\n * @param {string} compressionMethod the method magic to find.\\n * @return {Object|null} the JSZip compression object, null if none found.\\n */\\nexports.findCompression = function(compressionMethod) {\\n    for (var method in compressions) {\\n        if (!compressions.hasOwnProperty(method)) {\\n            continue;\\n        }\\n        if (compressions[method].magic === compressionMethod) {\\n            return compressions[method];\\n        }\\n    }\\n    return null;\\n};\\n/**\\n* Cross-window, cross-Node-context regular expression detection\\n* @param  {Object}  object Anything\\n* @return {Boolean}        true if the object is a regular expression,\\n* false otherwise\\n*/\\nexports.isRegExp = function (object) {\\n    return Object.prototype.toString.call(object) === \"[object RegExp]\";\\n};\\n\\n/**\\n * Merge the objects passed as parameters into a new one.\\n * @private\\n * @param {...Object} var_args All objects to merge.\\n * @return {Object} a new object with the data of the others.\\n */\\nexports.extend = function() {\\n    var result = {}, i, attr;\\n    for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers\\n        for (attr in arguments[i]) {\\n            if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === \"undefined\") {\\n                result[attr] = arguments[i][attr];\\n            }\\n        }\\n    }\\n    return result;\\n};\\n\\n\\n},{\"./compressions\":8,\"./nodeBuffer\":16,\"./support\":22}],27:[function(require,module,exports){\\n\\'use strict\\';\\nvar StringReader = require(\\'./stringReader\\');\\nvar NodeBufferReader = require(\\'./nodeBufferReader\\');\\nvar Uint8ArrayReader = require(\\'./uint8ArrayReader\\');\\nvar ArrayReader = require(\\'./arrayReader\\');\\nvar utils = require(\\'./utils\\');\\nvar sig = require(\\'./signature\\');\\nvar ZipEntry = require(\\'./zipEntry\\');\\nvar support = require(\\'./support\\');\\nvar jszipProto = require(\\'./object\\');\\n//  class ZipEntries {{{\\n/**\\n * All the entries in the zip file.\\n * @constructor\\n * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load.\\n * @param {Object} loadOptions Options for loading the stream.\\n */\\nfunction ZipEntries(data, loadOptions) {\\n    this.files = [];\\n    this.loadOptions = loadOptions;\\n    if (data) {\\n        this.load(data);\\n    }\\n}\\nZipEntries.prototype = {\\n    /**\\n     * Check that the reader is on the speficied signature.\\n     * @param {string} expectedSignature the expected signature.\\n     * @throws {Error} if it is an other signature.\\n     */\\n    checkSignature: function(expectedSignature) {\\n        var signature = this.reader.readString(4);\\n        if (signature !== expectedSignature) {\\n            throw new Error(\"Corrupted zip or bug : unexpected signature \" + \"(\" + utils.pretty(signature) + \", expected \" + utils.pretty(expectedSignature) + \")\");\\n        }\\n    },\\n    /**\\n     * Check if the given signature is at the given index.\\n     * @param {number} askedIndex the index to check.\\n     * @param {string} expectedSignature the signature to expect.\\n     * @return {boolean} true if the signature is here, false otherwise.\\n     */\\n    isSignature: function(askedIndex, expectedSignature) {\\n        var currentIndex = this.reader.index;\\n        this.reader.setIndex(askedIndex);\\n        var signature = this.reader.readString(4);\\n        var result = signature === expectedSignature;\\n        this.reader.setIndex(currentIndex);\\n        return result;\\n    },\\n    /**\\n     * Read the end of the central directory.\\n     */\\n    readBlockEndOfCentral: function() {\\n        this.diskNumber = this.reader.readInt(2);\\n        this.diskWithCentralDirStart = this.reader.readInt(2);\\n        this.centralDirRecordsOnThisDisk = this.reader.readInt(2);\\n        this.centralDirRecords = this.reader.readInt(2);\\n        this.centralDirSize = this.reader.readInt(4);\\n        this.centralDirOffset = this.reader.readInt(4);\\n\\n        this.zipCommentLength = this.reader.readInt(2);\\n        // warning : the encoding depends of the system locale\\n        // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded.\\n        // On a windows machine, this field is encoded with the localized windows code page.\\n        var zipComment = this.reader.readData(this.zipCommentLength);\\n        var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\\n        // To get consistent behavior with the generation part, we will assume that\\n        // this is utf8 encoded unless specified otherwise.\\n        var decodeContent = utils.transformTo(decodeParamType, zipComment);\\n        this.zipComment = this.loadOptions.decodeFileName(decodeContent);\\n    },\\n    /**\\n     * Read the end of the Zip 64 central directory.\\n     * Not merged with the method readEndOfCentral :\\n     * The end of central can coexist with its Zip64 brother,\\n     * I don\\'t want to read the wrong number of bytes !\\n     */\\n    readBlockZip64EndOfCentral: function() {\\n        this.zip64EndOfCentralSize = this.reader.readInt(8);\\n        this.versionMadeBy = this.reader.readString(2);\\n        this.versionNeeded = this.reader.readInt(2);\\n        this.diskNumber = this.reader.readInt(4);\\n        this.diskWithCentralDirStart = this.reader.readInt(4);\\n        this.centralDirRecordsOnThisDisk = this.reader.readInt(8);\\n        this.centralDirRecords = this.reader.readInt(8);\\n        this.centralDirSize = this.reader.readInt(8);\\n        this.centralDirOffset = this.reader.readInt(8);\\n\\n        this.zip64ExtensibleData = {};\\n        var extraDataSize = this.zip64EndOfCentralSize - 44,\\n            index = 0,\\n            extraFieldId,\\n            extraFieldLength,\\n            extraFieldValue;\\n        while (index < extraDataSize) {\\n            extraFieldId = this.reader.readInt(2);\\n            extraFieldLength = this.reader.readInt(4);\\n            extraFieldValue = this.reader.readString(extraFieldLength);\\n            this.zip64ExtensibleData[extraFieldId] = {\\n                id: extraFieldId,\\n                length: extraFieldLength,\\n                value: extraFieldValue\\n            };\\n        }\\n    },\\n    /**\\n     * Read the end of the Zip 64 central directory locator.\\n     */\\n    readBlockZip64EndOfCentralLocator: function() {\\n        this.diskWithZip64CentralDirStart = this.reader.readInt(4);\\n        this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8);\\n        this.disksCount = this.reader.readInt(4);\\n        if (this.disksCount > 1) {\\n            throw new Error(\"Multi-volumes zip are not supported\");\\n        }\\n    },\\n    /**\\n     * Read the local files, based on the offset read in the central part.\\n     */\\n    readLocalFiles: function() {\\n        var i, file;\\n        for (i = 0; i < this.files.length; i++) {\\n            file = this.files[i];\\n            this.reader.setIndex(file.localHeaderOffset);\\n            this.checkSignature(sig.LOCAL_FILE_HEADER);\\n            file.readLocalPart(this.reader);\\n            file.handleUTF8();\\n            file.processAttributes();\\n        }\\n    },\\n    /**\\n     * Read the central directory.\\n     */\\n    readCentralDir: function() {\\n        var file;\\n\\n        this.reader.setIndex(this.centralDirOffset);\\n        while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) {\\n            file = new ZipEntry({\\n                zip64: this.zip64\\n            }, this.loadOptions);\\n            file.readCentralPart(this.reader);\\n            this.files.push(file);\\n        }\\n\\n        if (this.centralDirRecords !== this.files.length) {\\n            if (this.centralDirRecords !== 0 && this.files.length === 0) {\\n                // We expected some records but couldn\\'t find ANY.\\n                // This is really suspicious, as if something went wrong.\\n                throw new Error(\"Corrupted zip or bug: expected \" + this.centralDirRecords + \" records in central dir, got \" + this.files.length);\\n            } else {\\n                // We found some records but not all.\\n                // Something is wrong but we got something for the user: no error here.\\n                // console.warn(\"expected\", this.centralDirRecords, \"records in central dir, got\", this.files.length);\\n            }\\n        }\\n    },\\n    /**\\n     * Read the end of central directory.\\n     */\\n    readEndOfCentral: function() {\\n        var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);\\n        if (offset < 0) {\\n            // Check if the content is a truncated zip or complete garbage.\\n            // A \"LOCAL_FILE_HEADER\" is not required at the beginning (auto\\n            // extractible zip for example) but it can give a good hint.\\n            // If an ajax request was used without responseType, we will also\\n            // get unreadable data.\\n            var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);\\n\\n            if (isGarbage) {\\n                throw new Error(\"Can\\'t find end of central directory : is this a zip file ? \" +\\n                                \"If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html\");\\n            } else {\\n                throw new Error(\"Corrupted zip : can\\'t find end of central directory\");\\n            }\\n        }\\n        this.reader.setIndex(offset);\\n        var endOfCentralDirOffset = offset;\\n        this.checkSignature(sig.CENTRAL_DIRECTORY_END);\\n        this.readBlockEndOfCentral();\\n\\n\\n        /* extract from the zip spec :\\n            4)  If one of the fields in the end of central directory\\n                record is too small to hold required data, the field\\n                should be set to -1 (0xFFFF or 0xFFFFFFFF) and the\\n                ZIP64 format record should be created.\\n            5)  The end of central directory record and the\\n                Zip64 end of central directory locator record must\\n                reside on the same disk when splitting or spanning\\n                an archive.\\n         */\\n        if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {\\n            this.zip64 = true;\\n\\n            /*\\n            Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from\\n            the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents\\n            all numbers as 64-bit double precision IEEE 754 floating point numbers.\\n            So, we have 53bits for integers and bitwise operations treat everything as 32bits.\\n            see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators\\n            and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5\\n            */\\n\\n            // should look for a zip64 EOCD locator\\n            offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\\n            if (offset < 0) {\\n                throw new Error(\"Corrupted zip : can\\'t find the ZIP64 end of central directory locator\");\\n            }\\n            this.reader.setIndex(offset);\\n            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\\n            this.readBlockZip64EndOfCentralLocator();\\n\\n            // now the zip64 EOCD record\\n            if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) {\\n                // console.warn(\"ZIP64 end of central directory not where expected.\");\\n                this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\\n                if (this.relativeOffsetEndOfZip64CentralDir < 0) {\\n                    throw new Error(\"Corrupted zip : can\\'t find the ZIP64 end of central directory\");\\n                }\\n            }\\n            this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);\\n            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\\n            this.readBlockZip64EndOfCentral();\\n        }\\n\\n        var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;\\n        if (this.zip64) {\\n            expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator\\n            expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize;\\n        }\\n\\n        var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;\\n\\n        if (extraBytes > 0) {\\n            // console.warn(extraBytes, \"extra bytes at beginning or within zipfile\");\\n            if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) {\\n                // The offsets seem wrong, but we have something at the specified offset.\\n                // So… we keep it.\\n            } else {\\n                // the offset is wrong, update the \"zero\" of the reader\\n                // this happens if data has been prepended (crx files for example)\\n                this.reader.zero = extraBytes;\\n            }\\n        } else if (extraBytes < 0) {\\n            throw new Error(\"Corrupted zip: missing \" + Math.abs(extraBytes) + \" bytes.\");\\n        }\\n    },\\n    prepareReader: function(data) {\\n        var type = utils.getTypeOf(data);\\n        utils.checkSupport(type);\\n        if (type === \"string\" && !support.uint8array) {\\n            this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString);\\n        }\\n        else if (type === \"nodebuffer\") {\\n            this.reader = new NodeBufferReader(data);\\n        }\\n        else if (support.uint8array) {\\n            this.reader = new Uint8ArrayReader(utils.transformTo(\"uint8array\", data));\\n        } else if (support.array) {\\n            this.reader = new ArrayReader(utils.transformTo(\"array\", data));\\n        } else {\\n            throw new Error(\"Unexpected error: unsupported type \\'\" + type + \"\\'\");\\n        }\\n    },\\n    /**\\n     * Read a zip file and create ZipEntries.\\n     * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.\\n     */\\n    load: function(data) {\\n        this.prepareReader(data);\\n        this.readEndOfCentral();\\n        this.readCentralDir();\\n        this.readLocalFiles();\\n    }\\n};\\n// }}} end of ZipEntries\\nmodule.exports = ZipEntries;\\n\\n},{\"./arrayReader\":5,\"./nodeBufferReader\":17,\"./object\":18,\"./signature\":19,\"./stringReader\":20,\"./support\":22,\"./uint8ArrayReader\":23,\"./utils\":26,\"./zipEntry\":28}],28:[function(require,module,exports){\\n\\'use strict\\';\\nvar StringReader = require(\\'./stringReader\\');\\nvar utils = require(\\'./utils\\');\\nvar CompressedObject = require(\\'./compressedObject\\');\\nvar jszipProto = require(\\'./object\\');\\nvar support = require(\\'./support\\');\\n\\nvar MADE_BY_DOS = 0x00;\\nvar MADE_BY_UNIX = 0x03;\\n\\n// class ZipEntry {{{\\n/**\\n * An entry in the zip file.\\n * @constructor\\n * @param {Object} options Options of the current file.\\n * @param {Object} loadOptions Options for loading the stream.\\n */\\nfunction ZipEntry(options, loadOptions) {\\n    this.options = options;\\n    this.loadOptions = loadOptions;\\n}\\nZipEntry.prototype = {\\n    /**\\n     * say if the file is encrypted.\\n     * @return {boolean} true if the file is encrypted, false otherwise.\\n     */\\n    isEncrypted: function() {\\n        // bit 1 is set\\n        return (this.bitFlag & 0x0001) === 0x0001;\\n    },\\n    /**\\n     * say if the file has utf-8 filename/comment.\\n     * @return {boolean} true if the filename/comment is in utf-8, false otherwise.\\n     */\\n    useUTF8: function() {\\n        // bit 11 is set\\n        return (this.bitFlag & 0x0800) === 0x0800;\\n    },\\n    /**\\n     * Prepare the function used to generate the compressed content from this ZipFile.\\n     * @param {DataReader} reader the reader to use.\\n     * @param {number} from the offset from where we should read the data.\\n     * @param {number} length the length of the data to read.\\n     * @return {Function} the callback to get the compressed content (the type depends of the DataReader class).\\n     */\\n    prepareCompressedContent: function(reader, from, length) {\\n        return function() {\\n            var previousIndex = reader.index;\\n            reader.setIndex(from);\\n            var compressedFileData = reader.readData(length);\\n            reader.setIndex(previousIndex);\\n\\n            return compressedFileData;\\n        };\\n    },\\n    /**\\n     * Prepare the function used to generate the uncompressed content from this ZipFile.\\n     * @param {DataReader} reader the reader to use.\\n     * @param {number} from the offset from where we should read the data.\\n     * @param {number} length the length of the data to read.\\n     * @param {JSZip.compression} compression the compression used on this file.\\n     * @param {number} uncompressedSize the uncompressed size to expect.\\n     * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class).\\n     */\\n    prepareContent: function(reader, from, length, compression, uncompressedSize) {\\n        return function() {\\n\\n            var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent());\\n            var uncompressedFileData = compression.uncompress(compressedFileData);\\n\\n            if (uncompressedFileData.length !== uncompressedSize) {\\n                throw new Error(\"Bug : uncompressed data size mismatch\");\\n            }\\n\\n            return uncompressedFileData;\\n        };\\n    },\\n    /**\\n     * Read the local part of a zip file and add the info in this object.\\n     * @param {DataReader} reader the reader to use.\\n     */\\n    readLocalPart: function(reader) {\\n        var compression, localExtraFieldsLength;\\n\\n        // we already know everything from the central dir !\\n        // If the central dir data are false, we are doomed.\\n        // On the bright side, the local part is scary  : zip64, data descriptors, both, etc.\\n        // The less data we get here, the more reliable this should be.\\n        // Let\\'s skip the whole header and dash to the data !\\n        reader.skip(22);\\n        // in some zip created on windows, the filename stored in the central dir contains \\\\ instead of /.\\n        // Strangely, the filename here is OK.\\n        // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes\\n        // or APPNOTE#4.4.17.1, \"All slashes MUST be forward slashes \\'/\\'\") but there are a lot of bad zip generators...\\n        // Search \"unzip mismatching \"local\" filename continuing with \"central\" filename version\" on\\n        // the internet.\\n        //\\n        // I think I see the logic here : the central directory is used to display\\n        // content and the local directory is used to extract the files. Mixing / and \\\\\\n        // may be used to display \\\\ to windows users and use / when extracting the files.\\n        // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394\\n        this.fileNameLength = reader.readInt(2);\\n        localExtraFieldsLength = reader.readInt(2); // can\\'t be sure this will be the same as the central dir\\n        this.fileName = reader.readData(this.fileNameLength);\\n        reader.skip(localExtraFieldsLength);\\n\\n        if (this.compressedSize == -1 || this.uncompressedSize == -1) {\\n            throw new Error(\"Bug or corrupted zip : didn\\'t get enough informations from the central directory \" + \"(compressedSize == -1 || uncompressedSize == -1)\");\\n        }\\n\\n        compression = utils.findCompression(this.compressionMethod);\\n        if (compression === null) { // no compression found\\n            throw new Error(\"Corrupted zip : compression \" + utils.pretty(this.compressionMethod) + \" unknown (inner file : \" +  utils.transformTo(\"string\", this.fileName) + \")\");\\n        }\\n        this.decompressed = new CompressedObject();\\n        this.decompressed.compressedSize = this.compressedSize;\\n        this.decompressed.uncompressedSize = this.uncompressedSize;\\n        this.decompressed.crc32 = this.crc32;\\n        this.decompressed.compressionMethod = this.compressionMethod;\\n        this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression);\\n        this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize);\\n\\n        // we need to compute the crc32...\\n        if (this.loadOptions.checkCRC32) {\\n            this.decompressed = utils.transformTo(\"string\", this.decompressed.getContent());\\n            if (jszipProto.crc32(this.decompressed) !== this.crc32) {\\n                throw new Error(\"Corrupted zip : CRC32 mismatch\");\\n            }\\n        }\\n    },\\n\\n    /**\\n     * Read the central part of a zip file and add the info in this object.\\n     * @param {DataReader} reader the reader to use.\\n     */\\n    readCentralPart: function(reader) {\\n        this.versionMadeBy = reader.readInt(2);\\n        this.versionNeeded = reader.readInt(2);\\n        this.bitFlag = reader.readInt(2);\\n        this.compressionMethod = reader.readString(2);\\n        this.date = reader.readDate();\\n        this.crc32 = reader.readInt(4);\\n        this.compressedSize = reader.readInt(4);\\n        this.uncompressedSize = reader.readInt(4);\\n        this.fileNameLength = reader.readInt(2);\\n        this.extraFieldsLength = reader.readInt(2);\\n        this.fileCommentLength = reader.readInt(2);\\n        this.diskNumberStart = reader.readInt(2);\\n        this.internalFileAttributes = reader.readInt(2);\\n        this.externalFileAttributes = reader.readInt(4);\\n        this.localHeaderOffset = reader.readInt(4);\\n\\n        if (this.isEncrypted()) {\\n            throw new Error(\"Encrypted zip are not supported\");\\n        }\\n\\n        this.fileName = reader.readData(this.fileNameLength);\\n        this.readExtraFields(reader);\\n        this.parseZIP64ExtraField(reader);\\n        this.fileComment = reader.readData(this.fileCommentLength);\\n    },\\n\\n    /**\\n     * Parse the external file attributes and get the unix/dos permissions.\\n     */\\n    processAttributes: function () {\\n        this.unixPermissions = null;\\n        this.dosPermissions = null;\\n        var madeBy = this.versionMadeBy >> 8;\\n\\n        // Check if we have the DOS directory flag set.\\n        // We look for it in the DOS and UNIX permissions\\n        // but some unknown platform could set it as a compatibility flag.\\n        this.dir = this.externalFileAttributes & 0x0010 ? true : false;\\n\\n        if(madeBy === MADE_BY_DOS) {\\n            // first 6 bits (0 to 5)\\n            this.dosPermissions = this.externalFileAttributes & 0x3F;\\n        }\\n\\n        if(madeBy === MADE_BY_UNIX) {\\n            this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF;\\n            // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);\\n        }\\n\\n        // fail safe : if the name ends with a / it probably means a folder\\n        if (!this.dir && this.fileNameStr.slice(-1) === \\'/\\') {\\n            this.dir = true;\\n        }\\n    },\\n\\n    /**\\n     * Parse the ZIP64 extra field and merge the info in the current ZipEntry.\\n     * @param {DataReader} reader the reader to use.\\n     */\\n    parseZIP64ExtraField: function(reader) {\\n\\n        if (!this.extraFields[0x0001]) {\\n            return;\\n        }\\n\\n        // should be something, preparing the extra reader\\n        var extraReader = new StringReader(this.extraFields[0x0001].value);\\n\\n        // I really hope that these 64bits integer can fit in 32 bits integer, because js\\n        // won\\'t let us have more.\\n        if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {\\n            this.uncompressedSize = extraReader.readInt(8);\\n        }\\n        if (this.compressedSize === utils.MAX_VALUE_32BITS) {\\n            this.compressedSize = extraReader.readInt(8);\\n        }\\n        if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {\\n            this.localHeaderOffset = extraReader.readInt(8);\\n        }\\n        if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {\\n            this.diskNumberStart = extraReader.readInt(4);\\n        }\\n    },\\n    /**\\n     * Read the central part of a zip file and add the info in this object.\\n     * @param {DataReader} reader the reader to use.\\n     */\\n    readExtraFields: function(reader) {\\n        var start = reader.index,\\n            extraFieldId,\\n            extraFieldLength,\\n            extraFieldValue;\\n\\n        this.extraFields = this.extraFields || {};\\n\\n        while (reader.index < start + this.extraFieldsLength) {\\n            extraFieldId = reader.readInt(2);\\n            extraFieldLength = reader.readInt(2);\\n            extraFieldValue = reader.readString(extraFieldLength);\\n\\n            this.extraFields[extraFieldId] = {\\n                id: extraFieldId,\\n                length: extraFieldLength,\\n                value: extraFieldValue\\n            };\\n        }\\n    },\\n    /**\\n     * Apply an UTF8 transformation if needed.\\n     */\\n    handleUTF8: function() {\\n        var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\\n        if (this.useUTF8()) {\\n            this.fileNameStr = jszipProto.utf8decode(this.fileName);\\n            this.fileCommentStr = jszipProto.utf8decode(this.fileComment);\\n        } else {\\n            var upath = this.findExtraFieldUnicodePath();\\n            if (upath !== null) {\\n                this.fileNameStr = upath;\\n            } else {\\n                var fileNameByteArray =  utils.transformTo(decodeParamType, this.fileName);\\n                this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray);\\n            }\\n\\n            var ucomment = this.findExtraFieldUnicodeComment();\\n            if (ucomment !== null) {\\n                this.fileCommentStr = ucomment;\\n            } else {\\n                var commentByteArray =  utils.transformTo(decodeParamType, this.fileComment);\\n                this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray);\\n            }\\n        }\\n    },\\n\\n    /**\\n     * Find the unicode path declared in the extra field, if any.\\n     * @return {String} the unicode path, null otherwise.\\n     */\\n    findExtraFieldUnicodePath: function() {\\n        var upathField = this.extraFields[0x7075];\\n        if (upathField) {\\n            var extraReader = new StringReader(upathField.value);\\n\\n            // wrong version\\n            if (extraReader.readInt(1) !== 1) {\\n                return null;\\n            }\\n\\n            // the crc of the filename changed, this field is out of date.\\n            if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) {\\n                return null;\\n            }\\n\\n            return jszipProto.utf8decode(extraReader.readString(upathField.length - 5));\\n        }\\n        return null;\\n    },\\n\\n    /**\\n     * Find the unicode comment declared in the extra field, if any.\\n     * @return {String} the unicode comment, null otherwise.\\n     */\\n    findExtraFieldUnicodeComment: function() {\\n        var ucommentField = this.extraFields[0x6375];\\n        if (ucommentField) {\\n            var extraReader = new StringReader(ucommentField.value);\\n\\n            // wrong version\\n            if (extraReader.readInt(1) !== 1) {\\n                return null;\\n            }\\n\\n            // the crc of the comment changed, this field is out of date.\\n            if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) {\\n                return null;\\n            }\\n\\n            return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5));\\n        }\\n        return null;\\n    }\\n};\\nmodule.exports = ZipEntry;\\n\\n},{\"./compressedObject\":7,\"./object\":18,\"./stringReader\":20,\"./support\":22,\"./utils\":26}],29:[function(require,module,exports){\\n// Top level file is just a mixin of submodules & constants\\n\\'use strict\\';\\n\\nvar assign    = require(\\'./lib/utils/common\\').assign;\\n\\nvar deflate   = require(\\'./lib/deflate\\');\\nvar inflate   = require(\\'./lib/inflate\\');\\nvar constants = require(\\'./lib/zlib/constants\\');\\n\\nvar pako = {};\\n\\nassign(pako, deflate, inflate, constants);\\n\\nmodule.exports = pako;\\n\\n},{\"./lib/deflate\":30,\"./lib/inflate\":31,\"./lib/utils/common\":32,\"./lib/zlib/constants\":35}],30:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nvar zlib_deflate = require(\\'./zlib/deflate\\');\\nvar utils        = require(\\'./utils/common\\');\\nvar strings      = require(\\'./utils/strings\\');\\nvar msg          = require(\\'./zlib/messages\\');\\nvar ZStream      = require(\\'./zlib/zstream\\');\\n\\nvar toString = Object.prototype.toString;\\n\\n/* Public constants ==========================================================*/\\n/* ===========================================================================*/\\n\\nvar Z_NO_FLUSH      = 0;\\nvar Z_FINISH        = 4;\\n\\nvar Z_OK            = 0;\\nvar Z_STREAM_END    = 1;\\nvar Z_SYNC_FLUSH    = 2;\\n\\nvar Z_DEFAULT_COMPRESSION = -1;\\n\\nvar Z_DEFAULT_STRATEGY    = 0;\\n\\nvar Z_DEFLATED  = 8;\\n\\n/* ===========================================================================*/\\n\\n\\n/**\\n * class Deflate\\n *\\n * Generic JS-style wrapper for zlib calls. If you don\\'t need\\n * streaming behaviour - use more simple functions: [[deflate]],\\n * [[deflateRaw]] and [[gzip]].\\n **/\\n\\n/* internal\\n * Deflate.chunks -> Array\\n *\\n * Chunks of output data, if [[Deflate#onData]] not overriden.\\n **/\\n\\n/**\\n * Deflate.result -> Uint8Array|Array\\n *\\n * Compressed result, generated by default [[Deflate#onData]]\\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param)  or if you\\n * push a chunk with explicit flush (call [[Deflate#push]] with\\n * `Z_SYNC_FLUSH` param).\\n **/\\n\\n/**\\n * Deflate.err -> Number\\n *\\n * Error code after deflate finished. 0 (Z_OK) on success.\\n * You will not need it in real life, because deflate errors\\n * are possible only on wrong options or bad `onData` / `onEnd`\\n * custom handlers.\\n **/\\n\\n/**\\n * Deflate.msg -> String\\n *\\n * Error message, if [[Deflate.err]] != 0\\n **/\\n\\n\\n/**\\n * new Deflate(options)\\n * - options (Object): zlib deflate options.\\n *\\n * Creates new deflator instance with specified params. Throws exception\\n * on bad params. Supported options:\\n *\\n * - `level`\\n * - `windowBits`\\n * - `memLevel`\\n * - `strategy`\\n * - `dictionary`\\n *\\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\\n * for more information on these.\\n *\\n * Additional options, for internal needs:\\n *\\n * - `chunkSize` - size of generated data chunks (16K by default)\\n * - `raw` (Boolean) - do raw deflate\\n * - `gzip` (Boolean) - create gzip wrapper\\n * - `to` (String) - if equal to \\'string\\', then result will be \"binary string\"\\n *    (each char code [0..255])\\n * - `header` (Object) - custom header for gzip\\n *   - `text` (Boolean) - true if compressed data believed to be text\\n *   - `time` (Number) - modification time, unix timestamp\\n *   - `os` (Number) - operation system code\\n *   - `extra` (Array) - array of bytes with extra data (max 65536)\\n *   - `name` (String) - file name (binary string)\\n *   - `comment` (String) - comment (binary string)\\n *   - `hcrc` (Boolean) - true if header crc should be added\\n *\\n * ##### Example:\\n *\\n * ```javascript\\n * var pako = require(\\'pako\\')\\n *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\\n *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\\n *\\n * var deflate = new pako.Deflate({ level: 3});\\n *\\n * deflate.push(chunk1, false);\\n * deflate.push(chunk2, true);  // true -> last chunk\\n *\\n * if (deflate.err) { throw new Error(deflate.err); }\\n *\\n * console.log(deflate.result);\\n * ```\\n **/\\nfunction Deflate(options) {\\n  if (!(this instanceof Deflate)) return new Deflate(options);\\n\\n  this.options = utils.assign({\\n    level: Z_DEFAULT_COMPRESSION,\\n    method: Z_DEFLATED,\\n    chunkSize: 16384,\\n    windowBits: 15,\\n    memLevel: 8,\\n    strategy: Z_DEFAULT_STRATEGY,\\n    to: \\'\\'\\n  }, options || {});\\n\\n  var opt = this.options;\\n\\n  if (opt.raw && (opt.windowBits > 0)) {\\n    opt.windowBits = -opt.windowBits;\\n  }\\n\\n  else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\\n    opt.windowBits += 16;\\n  }\\n\\n  this.err    = 0;      // error code, if happens (0 = Z_OK)\\n  this.msg    = \\'\\';     // error message\\n  this.ended  = false;  // used to avoid multiple onEnd() calls\\n  this.chunks = [];     // chunks of compressed data\\n\\n  this.strm = new ZStream();\\n  this.strm.avail_out = 0;\\n\\n  var status = zlib_deflate.deflateInit2(\\n    this.strm,\\n    opt.level,\\n    opt.method,\\n    opt.windowBits,\\n    opt.memLevel,\\n    opt.strategy\\n  );\\n\\n  if (status !== Z_OK) {\\n    throw new Error(msg[status]);\\n  }\\n\\n  if (opt.header) {\\n    zlib_deflate.deflateSetHeader(this.strm, opt.header);\\n  }\\n\\n  if (opt.dictionary) {\\n    var dict;\\n    // Convert data if needed\\n    if (typeof opt.dictionary === \\'string\\') {\\n      // If we need to compress text, change encoding to utf8.\\n      dict = strings.string2buf(opt.dictionary);\\n    } else if (toString.call(opt.dictionary) === \\'[object ArrayBuffer]\\') {\\n      dict = new Uint8Array(opt.dictionary);\\n    } else {\\n      dict = opt.dictionary;\\n    }\\n\\n    status = zlib_deflate.deflateSetDictionary(this.strm, dict);\\n\\n    if (status !== Z_OK) {\\n      throw new Error(msg[status]);\\n    }\\n\\n    this._dict_set = true;\\n  }\\n}\\n\\n/**\\n * Deflate#push(data[, mode]) -> Boolean\\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\\n *   converted to utf8 byte sequence.\\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\\n *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH.\\n *\\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\\n * new compressed chunks. Returns `true` on success. The last data block must have\\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\\n *\\n * On fail call [[Deflate#onEnd]] with error code and return false.\\n *\\n * We strongly recommend to use `Uint8Array` on input for best speed (output\\n * array format is detected automatically). Also, don\\'t skip last param and always\\n * use the same type in your code (boolean or number). That will improve JS speed.\\n *\\n * For regular `Array`-s make sure all elements are [0..255].\\n *\\n * ##### Example\\n *\\n * ```javascript\\n * push(chunk, false); // push one of data chunks\\n * ...\\n * push(chunk, true);  // push last chunk\\n * ```\\n **/\\nDeflate.prototype.push = function (data, mode) {\\n  var strm = this.strm;\\n  var chunkSize = this.options.chunkSize;\\n  var status, _mode;\\n\\n  if (this.ended) { return false; }\\n\\n  _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\\n\\n  // Convert data if needed\\n  if (typeof data === \\'string\\') {\\n    // If we need to compress text, change encoding to utf8.\\n    strm.input = strings.string2buf(data);\\n  } else if (toString.call(data) === \\'[object ArrayBuffer]\\') {\\n    strm.input = new Uint8Array(data);\\n  } else {\\n    strm.input = data;\\n  }\\n\\n  strm.next_in = 0;\\n  strm.avail_in = strm.input.length;\\n\\n  do {\\n    if (strm.avail_out === 0) {\\n      strm.output = new utils.Buf8(chunkSize);\\n      strm.next_out = 0;\\n      strm.avail_out = chunkSize;\\n    }\\n    status = zlib_deflate.deflate(strm, _mode);    /* no bad return value */\\n\\n    if (status !== Z_STREAM_END && status !== Z_OK) {\\n      this.onEnd(status);\\n      this.ended = true;\\n      return false;\\n    }\\n    if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\\n      if (this.options.to === \\'string\\') {\\n        this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\\n      } else {\\n        this.onData(utils.shrinkBuf(strm.output, strm.next_out));\\n      }\\n    }\\n  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\\n\\n  // Finalize on the last chunk.\\n  if (_mode === Z_FINISH) {\\n    status = zlib_deflate.deflateEnd(this.strm);\\n    this.onEnd(status);\\n    this.ended = true;\\n    return status === Z_OK;\\n  }\\n\\n  // callback interim results if Z_SYNC_FLUSH.\\n  if (_mode === Z_SYNC_FLUSH) {\\n    this.onEnd(Z_OK);\\n    strm.avail_out = 0;\\n    return true;\\n  }\\n\\n  return true;\\n};\\n\\n\\n/**\\n * Deflate#onData(chunk) -> Void\\n * - chunk (Uint8Array|Array|String): ouput data. Type of array depends\\n *   on js engine support. When string output requested, each chunk\\n *   will be string.\\n *\\n * By default, stores data blocks in `chunks[]` property and glue\\n * those in `onEnd`. Override this handler, if you need another behaviour.\\n **/\\nDeflate.prototype.onData = function (chunk) {\\n  this.chunks.push(chunk);\\n};\\n\\n\\n/**\\n * Deflate#onEnd(status) -> Void\\n * - status (Number): deflate status. 0 (Z_OK) on success,\\n *   other if not.\\n *\\n * Called once after you tell deflate that the input stream is\\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\\n * or if an error happened. By default - join collected chunks,\\n * free memory and fill `results` / `err` properties.\\n **/\\nDeflate.prototype.onEnd = function (status) {\\n  // On success - join\\n  if (status === Z_OK) {\\n    if (this.options.to === \\'string\\') {\\n      this.result = this.chunks.join(\\'\\');\\n    } else {\\n      this.result = utils.flattenChunks(this.chunks);\\n    }\\n  }\\n  this.chunks = [];\\n  this.err = status;\\n  this.msg = this.strm.msg;\\n};\\n\\n\\n/**\\n * deflate(data[, options]) -> Uint8Array|Array|String\\n * - data (Uint8Array|Array|String): input data to compress.\\n * - options (Object): zlib deflate options.\\n *\\n * Compress `data` with deflate algorithm and `options`.\\n *\\n * Supported options are:\\n *\\n * - level\\n * - windowBits\\n * - memLevel\\n * - strategy\\n * - dictionary\\n *\\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\\n * for more information on these.\\n *\\n * Sugar (options):\\n *\\n * - `raw` (Boolean) - say that we work with raw stream, if you don\\'t wish to specify\\n *   negative windowBits implicitly.\\n * - `to` (String) - if equal to \\'string\\', then result will be \"binary string\"\\n *    (each char code [0..255])\\n *\\n * ##### Example:\\n *\\n * ```javascript\\n * var pako = require(\\'pako\\')\\n *   , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\\n *\\n * console.log(pako.deflate(data));\\n * ```\\n **/\\nfunction deflate(input, options) {\\n  var deflator = new Deflate(options);\\n\\n  deflator.push(input, true);\\n\\n  // That will never happens, if you don\\'t cheat with options :)\\n  if (deflator.err) { throw deflator.msg; }\\n\\n  return deflator.result;\\n}\\n\\n\\n/**\\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\\n * - data (Uint8Array|Array|String): input data to compress.\\n * - options (Object): zlib deflate options.\\n *\\n * The same as [[deflate]], but creates raw data, without wrapper\\n * (header and adler32 crc).\\n **/\\nfunction deflateRaw(input, options) {\\n  options = options || {};\\n  options.raw = true;\\n  return deflate(input, options);\\n}\\n\\n\\n/**\\n * gzip(data[, options]) -> Uint8Array|Array|String\\n * - data (Uint8Array|Array|String): input data to compress.\\n * - options (Object): zlib deflate options.\\n *\\n * The same as [[deflate]], but create gzip wrapper instead of\\n * deflate one.\\n **/\\nfunction gzip(input, options) {\\n  options = options || {};\\n  options.gzip = true;\\n  return deflate(input, options);\\n}\\n\\n\\nexports.Deflate = Deflate;\\nexports.deflate = deflate;\\nexports.deflateRaw = deflateRaw;\\nexports.gzip = gzip;\\n\\n},{\"./utils/common\":32,\"./utils/strings\":33,\"./zlib/deflate\":37,\"./zlib/messages\":42,\"./zlib/zstream\":44}],31:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nvar zlib_inflate = require(\\'./zlib/inflate\\');\\nvar utils        = require(\\'./utils/common\\');\\nvar strings      = require(\\'./utils/strings\\');\\nvar c            = require(\\'./zlib/constants\\');\\nvar msg          = require(\\'./zlib/messages\\');\\nvar ZStream      = require(\\'./zlib/zstream\\');\\nvar GZheader     = require(\\'./zlib/gzheader\\');\\n\\nvar toString = Object.prototype.toString;\\n\\n/**\\n * class Inflate\\n *\\n * Generic JS-style wrapper for zlib calls. If you don\\'t need\\n * streaming behaviour - use more simple functions: [[inflate]]\\n * and [[inflateRaw]].\\n **/\\n\\n/* internal\\n * inflate.chunks -> Array\\n *\\n * Chunks of output data, if [[Inflate#onData]] not overriden.\\n **/\\n\\n/**\\n * Inflate.result -> Uint8Array|Array|String\\n *\\n * Uncompressed result, generated by default [[Inflate#onData]]\\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\\n * push a chunk with explicit flush (call [[Inflate#push]] with\\n * `Z_SYNC_FLUSH` param).\\n **/\\n\\n/**\\n * Inflate.err -> Number\\n *\\n * Error code after inflate finished. 0 (Z_OK) on success.\\n * Should be checked if broken data possible.\\n **/\\n\\n/**\\n * Inflate.msg -> String\\n *\\n * Error message, if [[Inflate.err]] != 0\\n **/\\n\\n\\n/**\\n * new Inflate(options)\\n * - options (Object): zlib inflate options.\\n *\\n * Creates new inflator instance with specified params. Throws exception\\n * on bad params. Supported options:\\n *\\n * - `windowBits`\\n * - `dictionary`\\n *\\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\\n * for more information on these.\\n *\\n * Additional options, for internal needs:\\n *\\n * - `chunkSize` - size of generated data chunks (16K by default)\\n * - `raw` (Boolean) - do raw inflate\\n * - `to` (String) - if equal to \\'string\\', then result will be converted\\n *   from utf8 to utf16 (javascript) string. When string output requested,\\n *   chunk length can differ from `chunkSize`, depending on content.\\n *\\n * By default, when no options set, autodetect deflate/gzip data format via\\n * wrapper header.\\n *\\n * ##### Example:\\n *\\n * ```javascript\\n * var pako = require(\\'pako\\')\\n *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\\n *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\\n *\\n * var inflate = new pako.Inflate({ level: 3});\\n *\\n * inflate.push(chunk1, false);\\n * inflate.push(chunk2, true);  // true -> last chunk\\n *\\n * if (inflate.err) { throw new Error(inflate.err); }\\n *\\n * console.log(inflate.result);\\n * ```\\n **/\\nfunction Inflate(options) {\\n  if (!(this instanceof Inflate)) return new Inflate(options);\\n\\n  this.options = utils.assign({\\n    chunkSize: 16384,\\n    windowBits: 0,\\n    to: \\'\\'\\n  }, options || {});\\n\\n  var opt = this.options;\\n\\n  // Force window size for `raw` data, if not set directly,\\n  // because we have no header for autodetect.\\n  if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\\n    opt.windowBits = -opt.windowBits;\\n    if (opt.windowBits === 0) { opt.windowBits = -15; }\\n  }\\n\\n  // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\\n  if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\\n      !(options && options.windowBits)) {\\n    opt.windowBits += 32;\\n  }\\n\\n  // Gzip header has no info about windows size, we can do autodetect only\\n  // for deflate. So, if window size not set, force it to max when gzip possible\\n  if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\\n    // bit 3 (16) -> gzipped data\\n    // bit 4 (32) -> autodetect gzip/deflate\\n    if ((opt.windowBits & 15) === 0) {\\n      opt.windowBits |= 15;\\n    }\\n  }\\n\\n  this.err    = 0;      // error code, if happens (0 = Z_OK)\\n  this.msg    = \\'\\';     // error message\\n  this.ended  = false;  // used to avoid multiple onEnd() calls\\n  this.chunks = [];     // chunks of compressed data\\n\\n  this.strm   = new ZStream();\\n  this.strm.avail_out = 0;\\n\\n  var status  = zlib_inflate.inflateInit2(\\n    this.strm,\\n    opt.windowBits\\n  );\\n\\n  if (status !== c.Z_OK) {\\n    throw new Error(msg[status]);\\n  }\\n\\n  this.header = new GZheader();\\n\\n  zlib_inflate.inflateGetHeader(this.strm, this.header);\\n}\\n\\n/**\\n * Inflate#push(data[, mode]) -> Boolean\\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\\n *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH.\\n *\\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\\n * new output chunks. Returns `true` on success. The last data block must have\\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\\n *\\n * On fail call [[Inflate#onEnd]] with error code and return false.\\n *\\n * We strongly recommend to use `Uint8Array` on input for best speed (output\\n * format is detected automatically). Also, don\\'t skip last param and always\\n * use the same type in your code (boolean or number). That will improve JS speed.\\n *\\n * For regular `Array`-s make sure all elements are [0..255].\\n *\\n * ##### Example\\n *\\n * ```javascript\\n * push(chunk, false); // push one of data chunks\\n * ...\\n * push(chunk, true);  // push last chunk\\n * ```\\n **/\\nInflate.prototype.push = function (data, mode) {\\n  var strm = this.strm;\\n  var chunkSize = this.options.chunkSize;\\n  var dictionary = this.options.dictionary;\\n  var status, _mode;\\n  var next_out_utf8, tail, utf8str;\\n  var dict;\\n\\n  // Flag to properly process Z_BUF_ERROR on testing inflate call\\n  // when we check that all output data was flushed.\\n  var allowBufError = false;\\n\\n  if (this.ended) { return false; }\\n  _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\\n\\n  // Convert data if needed\\n  if (typeof data === \\'string\\') {\\n    // Only binary strings can be decompressed on practice\\n    strm.input = strings.binstring2buf(data);\\n  } else if (toString.call(data) === \\'[object ArrayBuffer]\\') {\\n    strm.input = new Uint8Array(data);\\n  } else {\\n    strm.input = data;\\n  }\\n\\n  strm.next_in = 0;\\n  strm.avail_in = strm.input.length;\\n\\n  do {\\n    if (strm.avail_out === 0) {\\n      strm.output = new utils.Buf8(chunkSize);\\n      strm.next_out = 0;\\n      strm.avail_out = chunkSize;\\n    }\\n\\n    status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH);    /* no bad return value */\\n\\n    if (status === c.Z_NEED_DICT && dictionary) {\\n      // Convert data if needed\\n      if (typeof dictionary === \\'string\\') {\\n        dict = strings.string2buf(dictionary);\\n      } else if (toString.call(dictionary) === \\'[object ArrayBuffer]\\') {\\n        dict = new Uint8Array(dictionary);\\n      } else {\\n        dict = dictionary;\\n      }\\n\\n      status = zlib_inflate.inflateSetDictionary(this.strm, dict);\\n\\n    }\\n\\n    if (status === c.Z_BUF_ERROR && allowBufError === true) {\\n      status = c.Z_OK;\\n      allowBufError = false;\\n    }\\n\\n    if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\\n      this.onEnd(status);\\n      this.ended = true;\\n      return false;\\n    }\\n\\n    if (strm.next_out) {\\n      if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\\n\\n        if (this.options.to === \\'string\\') {\\n\\n          next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\\n\\n          tail = strm.next_out - next_out_utf8;\\n          utf8str = strings.buf2string(strm.output, next_out_utf8);\\n\\n          // move tail\\n          strm.next_out = tail;\\n          strm.avail_out = chunkSize - tail;\\n          if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\\n\\n          this.onData(utf8str);\\n\\n        } else {\\n          this.onData(utils.shrinkBuf(strm.output, strm.next_out));\\n        }\\n      }\\n    }\\n\\n    // When no more input data, we should check that internal inflate buffers\\n    // are flushed. The only way to do it when avail_out = 0 - run one more\\n    // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\\n    // Here we set flag to process this error properly.\\n    //\\n    // NOTE. Deflate does not return error in this case and does not needs such\\n    // logic.\\n    if (strm.avail_in === 0 && strm.avail_out === 0) {\\n      allowBufError = true;\\n    }\\n\\n  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\\n\\n  if (status === c.Z_STREAM_END) {\\n    _mode = c.Z_FINISH;\\n  }\\n\\n  // Finalize on the last chunk.\\n  if (_mode === c.Z_FINISH) {\\n    status = zlib_inflate.inflateEnd(this.strm);\\n    this.onEnd(status);\\n    this.ended = true;\\n    return status === c.Z_OK;\\n  }\\n\\n  // callback interim results if Z_SYNC_FLUSH.\\n  if (_mode === c.Z_SYNC_FLUSH) {\\n    this.onEnd(c.Z_OK);\\n    strm.avail_out = 0;\\n    return true;\\n  }\\n\\n  return true;\\n};\\n\\n\\n/**\\n * Inflate#onData(chunk) -> Void\\n * - chunk (Uint8Array|Array|String): ouput data. Type of array depends\\n *   on js engine support. When string output requested, each chunk\\n *   will be string.\\n *\\n * By default, stores data blocks in `chunks[]` property and glue\\n * those in `onEnd`. Override this handler, if you need another behaviour.\\n **/\\nInflate.prototype.onData = function (chunk) {\\n  this.chunks.push(chunk);\\n};\\n\\n\\n/**\\n * Inflate#onEnd(status) -> Void\\n * - status (Number): inflate status. 0 (Z_OK) on success,\\n *   other if not.\\n *\\n * Called either after you tell inflate that the input stream is\\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\\n * or if an error happened. By default - join collected chunks,\\n * free memory and fill `results` / `err` properties.\\n **/\\nInflate.prototype.onEnd = function (status) {\\n  // On success - join\\n  if (status === c.Z_OK) {\\n    if (this.options.to === \\'string\\') {\\n      // Glue & convert here, until we teach pako to send\\n      // utf8 alligned strings to onData\\n      this.result = this.chunks.join(\\'\\');\\n    } else {\\n      this.result = utils.flattenChunks(this.chunks);\\n    }\\n  }\\n  this.chunks = [];\\n  this.err = status;\\n  this.msg = this.strm.msg;\\n};\\n\\n\\n/**\\n * inflate(data[, options]) -> Uint8Array|Array|String\\n * - data (Uint8Array|Array|String): input data to decompress.\\n * - options (Object): zlib inflate options.\\n *\\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\\n * format via wrapper header by default. That\\'s why we don\\'t provide\\n * separate `ungzip` method.\\n *\\n * Supported options are:\\n *\\n * - windowBits\\n *\\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\\n * for more information.\\n *\\n * Sugar (options):\\n *\\n * - `raw` (Boolean) - say that we work with raw stream, if you don\\'t wish to specify\\n *   negative windowBits implicitly.\\n * - `to` (String) - if equal to \\'string\\', then result will be converted\\n *   from utf8 to utf16 (javascript) string. When string output requested,\\n *   chunk length can differ from `chunkSize`, depending on content.\\n *\\n *\\n * ##### Example:\\n *\\n * ```javascript\\n * var pako = require(\\'pako\\')\\n *   , input = pako.deflate([1,2,3,4,5,6,7,8,9])\\n *   , output;\\n *\\n * try {\\n *   output = pako.inflate(input);\\n * } catch (err)\\n *   console.log(err);\\n * }\\n * ```\\n **/\\nfunction inflate(input, options) {\\n  var inflator = new Inflate(options);\\n\\n  inflator.push(input, true);\\n\\n  // That will never happens, if you don\\'t cheat with options :)\\n  if (inflator.err) { throw inflator.msg; }\\n\\n  return inflator.result;\\n}\\n\\n\\n/**\\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\\n * - data (Uint8Array|Array|String): input data to decompress.\\n * - options (Object): zlib inflate options.\\n *\\n * The same as [[inflate]], but creates raw data, without wrapper\\n * (header and adler32 crc).\\n **/\\nfunction inflateRaw(input, options) {\\n  options = options || {};\\n  options.raw = true;\\n  return inflate(input, options);\\n}\\n\\n\\n/**\\n * ungzip(data[, options]) -> Uint8Array|Array|String\\n * - data (Uint8Array|Array|String): input data to decompress.\\n * - options (Object): zlib inflate options.\\n *\\n * Just shortcut to [[inflate]], because it autodetects format\\n * by header.content. Done for convenience.\\n **/\\n\\n\\nexports.Inflate = Inflate;\\nexports.inflate = inflate;\\nexports.inflateRaw = inflateRaw;\\nexports.ungzip  = inflate;\\n\\n},{\"./utils/common\":32,\"./utils/strings\":33,\"./zlib/constants\":35,\"./zlib/gzheader\":38,\"./zlib/inflate\":40,\"./zlib/messages\":42,\"./zlib/zstream\":44}],32:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nvar TYPED_OK =  (typeof Uint8Array !== \\'undefined\\') &&\\n                (typeof Uint16Array !== \\'undefined\\') &&\\n                (typeof Int32Array !== \\'undefined\\');\\n\\n\\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\\n  var sources = Array.prototype.slice.call(arguments, 1);\\n  while (sources.length) {\\n    var source = sources.shift();\\n    if (!source) { continue; }\\n\\n    if (typeof source !== \\'object\\') {\\n      throw new TypeError(source + \\'must be non-object\\');\\n    }\\n\\n    for (var p in source) {\\n      if (source.hasOwnProperty(p)) {\\n        obj[p] = source[p];\\n      }\\n    }\\n  }\\n\\n  return obj;\\n};\\n\\n\\n// reduce buffer size, avoiding mem copy\\nexports.shrinkBuf = function (buf, size) {\\n  if (buf.length === size) { return buf; }\\n  if (buf.subarray) { return buf.subarray(0, size); }\\n  buf.length = size;\\n  return buf;\\n};\\n\\n\\nvar fnTyped = {\\n  arraySet: function (dest, src, src_offs, len, dest_offs) {\\n    if (src.subarray && dest.subarray) {\\n      dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\\n      return;\\n    }\\n    // Fallback to ordinary array\\n    for (var i = 0; i < len; i++) {\\n      dest[dest_offs + i] = src[src_offs + i];\\n    }\\n  },\\n  // Join array of chunks to single array.\\n  flattenChunks: function (chunks) {\\n    var i, l, len, pos, chunk, result;\\n\\n    // calculate data length\\n    len = 0;\\n    for (i = 0, l = chunks.length; i < l; i++) {\\n      len += chunks[i].length;\\n    }\\n\\n    // join chunks\\n    result = new Uint8Array(len);\\n    pos = 0;\\n    for (i = 0, l = chunks.length; i < l; i++) {\\n      chunk = chunks[i];\\n      result.set(chunk, pos);\\n      pos += chunk.length;\\n    }\\n\\n    return result;\\n  }\\n};\\n\\nvar fnUntyped = {\\n  arraySet: function (dest, src, src_offs, len, dest_offs) {\\n    for (var i = 0; i < len; i++) {\\n      dest[dest_offs + i] = src[src_offs + i];\\n    }\\n  },\\n  // Join array of chunks to single array.\\n  flattenChunks: function (chunks) {\\n    return [].concat.apply([], chunks);\\n  }\\n};\\n\\n\\n// Enable/Disable typed arrays use, for testing\\n//\\nexports.setTyped = function (on) {\\n  if (on) {\\n    exports.Buf8  = Uint8Array;\\n    exports.Buf16 = Uint16Array;\\n    exports.Buf32 = Int32Array;\\n    exports.assign(exports, fnTyped);\\n  } else {\\n    exports.Buf8  = Array;\\n    exports.Buf16 = Array;\\n    exports.Buf32 = Array;\\n    exports.assign(exports, fnUntyped);\\n  }\\n};\\n\\nexports.setTyped(TYPED_OK);\\n\\n},{}],33:[function(require,module,exports){\\n// String encode/decode helpers\\n\\'use strict\\';\\n\\n\\nvar utils = require(\\'./common\\');\\n\\n\\n// Quick check if we can use fast array to bin string conversion\\n//\\n// - apply(Array) can fail on Android 2.2\\n// - apply(Uint8Array) can fail on iOS 5.1 Safary\\n//\\nvar STR_APPLY_OK = true;\\nvar STR_APPLY_UIA_OK = true;\\n\\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\\n\\n\\n// Table with utf8 lengths (calculated by first byte of sequence)\\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\\n// because max possible codepoint is 0x10ffff\\nvar _utf8len = new utils.Buf8(256);\\nfor (var q = 0; q < 256; q++) {\\n  _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\\n}\\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\\n\\n\\n// convert string to array (typed, when possible)\\nexports.string2buf = function (str) {\\n  var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\\n\\n  // count binary size\\n  for (m_pos = 0; m_pos < str_len; m_pos++) {\\n    c = str.charCodeAt(m_pos);\\n    if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\\n      c2 = str.charCodeAt(m_pos + 1);\\n      if ((c2 & 0xfc00) === 0xdc00) {\\n        c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\\n        m_pos++;\\n      }\\n    }\\n    buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\\n  }\\n\\n  // allocate buffer\\n  buf = new utils.Buf8(buf_len);\\n\\n  // convert\\n  for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\\n    c = str.charCodeAt(m_pos);\\n    if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\\n      c2 = str.charCodeAt(m_pos + 1);\\n      if ((c2 & 0xfc00) === 0xdc00) {\\n        c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\\n        m_pos++;\\n      }\\n    }\\n    if (c < 0x80) {\\n      /* one byte */\\n      buf[i++] = c;\\n    } else if (c < 0x800) {\\n      /* two bytes */\\n      buf[i++] = 0xC0 | (c >>> 6);\\n      buf[i++] = 0x80 | (c & 0x3f);\\n    } else if (c < 0x10000) {\\n      /* three bytes */\\n      buf[i++] = 0xE0 | (c >>> 12);\\n      buf[i++] = 0x80 | (c >>> 6 & 0x3f);\\n      buf[i++] = 0x80 | (c & 0x3f);\\n    } else {\\n      /* four bytes */\\n      buf[i++] = 0xf0 | (c >>> 18);\\n      buf[i++] = 0x80 | (c >>> 12 & 0x3f);\\n      buf[i++] = 0x80 | (c >>> 6 & 0x3f);\\n      buf[i++] = 0x80 | (c & 0x3f);\\n    }\\n  }\\n\\n  return buf;\\n};\\n\\n// Helper (used in 2 places)\\nfunction buf2binstring(buf, len) {\\n  // use fallback for big arrays to avoid stack overflow\\n  if (len < 65537) {\\n    if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\\n      return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\\n    }\\n  }\\n\\n  var result = \\'\\';\\n  for (var i = 0; i < len; i++) {\\n    result += String.fromCharCode(buf[i]);\\n  }\\n  return result;\\n}\\n\\n\\n// Convert byte array to binary string\\nexports.buf2binstring = function (buf) {\\n  return buf2binstring(buf, buf.length);\\n};\\n\\n\\n// Convert binary string (typed, when possible)\\nexports.binstring2buf = function (str) {\\n  var buf = new utils.Buf8(str.length);\\n  for (var i = 0, len = buf.length; i < len; i++) {\\n    buf[i] = str.charCodeAt(i);\\n  }\\n  return buf;\\n};\\n\\n\\n// convert array to string\\nexports.buf2string = function (buf, max) {\\n  var i, out, c, c_len;\\n  var len = max || buf.length;\\n\\n  // Reserve max possible length (2 words per char)\\n  // NB: by unknown reasons, Array is significantly faster for\\n  //     String.fromCharCode.apply than Uint16Array.\\n  var utf16buf = new Array(len * 2);\\n\\n  for (out = 0, i = 0; i < len;) {\\n    c = buf[i++];\\n    // quick process ascii\\n    if (c < 0x80) { utf16buf[out++] = c; continue; }\\n\\n    c_len = _utf8len[c];\\n    // skip 5 & 6 byte codes\\n    if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\\n\\n    // apply mask on first byte\\n    c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\\n    // join the rest\\n    while (c_len > 1 && i < len) {\\n      c = (c << 6) | (buf[i++] & 0x3f);\\n      c_len--;\\n    }\\n\\n    // terminated by end of string?\\n    if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\\n\\n    if (c < 0x10000) {\\n      utf16buf[out++] = c;\\n    } else {\\n      c -= 0x10000;\\n      utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\\n      utf16buf[out++] = 0xdc00 | (c & 0x3ff);\\n    }\\n  }\\n\\n  return buf2binstring(utf16buf, out);\\n};\\n\\n\\n// Calculate max possible position in utf8 buffer,\\n// that will not break sequence. If that\\'s not possible\\n// - (very small limits) return max size as is.\\n//\\n// buf[] - utf8 bytes array\\n// max   - length limit (mandatory);\\nexports.utf8border = function (buf, max) {\\n  var pos;\\n\\n  max = max || buf.length;\\n  if (max > buf.length) { max = buf.length; }\\n\\n  // go back from last position, until start of sequence found\\n  pos = max - 1;\\n  while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\\n\\n  // Fuckup - very small and broken sequence,\\n  // return max, because we should return something anyway.\\n  if (pos < 0) { return max; }\\n\\n  // If we came to start of buffer - that means vuffer is too small,\\n  // return max too.\\n  if (pos === 0) { return max; }\\n\\n  return (pos + _utf8len[buf[pos]] > max) ? pos : max;\\n};\\n\\n},{\"./common\":32}],34:[function(require,module,exports){\\n\\'use strict\\';\\n\\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\\n// It doesn\\'t worth to make additional optimizationa as in original.\\n// Small size is preferable.\\n\\nfunction adler32(adler, buf, len, pos) {\\n  var s1 = (adler & 0xffff) |0,\\n      s2 = ((adler >>> 16) & 0xffff) |0,\\n      n = 0;\\n\\n  while (len !== 0) {\\n    // Set limit ~ twice less than 5552, to keep\\n    // s2 in 31-bits, because we force signed ints.\\n    // in other case %= will fail.\\n    n = len > 2000 ? 2000 : len;\\n    len -= n;\\n\\n    do {\\n      s1 = (s1 + buf[pos++]) |0;\\n      s2 = (s2 + s1) |0;\\n    } while (--n);\\n\\n    s1 %= 65521;\\n    s2 %= 65521;\\n  }\\n\\n  return (s1 | (s2 << 16)) |0;\\n}\\n\\n\\nmodule.exports = adler32;\\n\\n},{}],35:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nmodule.exports = {\\n\\n  /* Allowed flush values; see deflate() and inflate() below for details */\\n  Z_NO_FLUSH:         0,\\n  Z_PARTIAL_FLUSH:    1,\\n  Z_SYNC_FLUSH:       2,\\n  Z_FULL_FLUSH:       3,\\n  Z_FINISH:           4,\\n  Z_BLOCK:            5,\\n  Z_TREES:            6,\\n\\n  /* Return codes for the compression/decompression functions. Negative values\\n  * are errors, positive values are used for special but normal events.\\n  */\\n  Z_OK:               0,\\n  Z_STREAM_END:       1,\\n  Z_NEED_DICT:        2,\\n  Z_ERRNO:           -1,\\n  Z_STREAM_ERROR:    -2,\\n  Z_DATA_ERROR:      -3,\\n  //Z_MEM_ERROR:     -4,\\n  Z_BUF_ERROR:       -5,\\n  //Z_VERSION_ERROR: -6,\\n\\n  /* compression levels */\\n  Z_NO_COMPRESSION:         0,\\n  Z_BEST_SPEED:             1,\\n  Z_BEST_COMPRESSION:       9,\\n  Z_DEFAULT_COMPRESSION:   -1,\\n\\n\\n  Z_FILTERED:               1,\\n  Z_HUFFMAN_ONLY:           2,\\n  Z_RLE:                    3,\\n  Z_FIXED:                  4,\\n  Z_DEFAULT_STRATEGY:       0,\\n\\n  /* Possible values of the data_type field (though see inflate()) */\\n  Z_BINARY:                 0,\\n  Z_TEXT:                   1,\\n  //Z_ASCII:                1, // = Z_TEXT (deprecated)\\n  Z_UNKNOWN:                2,\\n\\n  /* The deflate compression method */\\n  Z_DEFLATED:               8\\n  //Z_NULL:                 null // Use -1 or null inline, depending on var type\\n};\\n\\n},{}],36:[function(require,module,exports){\\n\\'use strict\\';\\n\\n// Note: we can\\'t get significant speed boost here.\\n// So write code to minimize size - no pregenerated tables\\n// and array tools dependencies.\\n\\n\\n// Use ordinary array, since untyped makes no boost here\\nfunction makeTable() {\\n  var c, table = [];\\n\\n  for (var n = 0; n < 256; n++) {\\n    c = n;\\n    for (var k = 0; k < 8; k++) {\\n      c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\\n    }\\n    table[n] = c;\\n  }\\n\\n  return table;\\n}\\n\\n// Create table on load. Just 255 signed longs. Not a problem.\\nvar crcTable = makeTable();\\n\\n\\nfunction crc32(crc, buf, len, pos) {\\n  var t = crcTable,\\n      end = pos + len;\\n\\n  crc ^= -1;\\n\\n  for (var i = pos; i < end; i++) {\\n    crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\\n  }\\n\\n  return (crc ^ (-1)); // >>> 0;\\n}\\n\\n\\nmodule.exports = crc32;\\n\\n},{}],37:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar utils   = require(\\'../utils/common\\');\\nvar trees   = require(\\'./trees\\');\\nvar adler32 = require(\\'./adler32\\');\\nvar crc32   = require(\\'./crc32\\');\\nvar msg     = require(\\'./messages\\');\\n\\n/* Public constants ==========================================================*/\\n/* ===========================================================================*/\\n\\n\\n/* Allowed flush values; see deflate() and inflate() below for details */\\nvar Z_NO_FLUSH      = 0;\\nvar Z_PARTIAL_FLUSH = 1;\\n//var Z_SYNC_FLUSH    = 2;\\nvar Z_FULL_FLUSH    = 3;\\nvar Z_FINISH        = 4;\\nvar Z_BLOCK         = 5;\\n//var Z_TREES         = 6;\\n\\n\\n/* Return codes for the compression/decompression functions. Negative values\\n * are errors, positive values are used for special but normal events.\\n */\\nvar Z_OK            = 0;\\nvar Z_STREAM_END    = 1;\\n//var Z_NEED_DICT     = 2;\\n//var Z_ERRNO         = -1;\\nvar Z_STREAM_ERROR  = -2;\\nvar Z_DATA_ERROR    = -3;\\n//var Z_MEM_ERROR     = -4;\\nvar Z_BUF_ERROR     = -5;\\n//var Z_VERSION_ERROR = -6;\\n\\n\\n/* compression levels */\\n//var Z_NO_COMPRESSION      = 0;\\n//var Z_BEST_SPEED          = 1;\\n//var Z_BEST_COMPRESSION    = 9;\\nvar Z_DEFAULT_COMPRESSION = -1;\\n\\n\\nvar Z_FILTERED            = 1;\\nvar Z_HUFFMAN_ONLY        = 2;\\nvar Z_RLE                 = 3;\\nvar Z_FIXED               = 4;\\nvar Z_DEFAULT_STRATEGY    = 0;\\n\\n/* Possible values of the data_type field (though see inflate()) */\\n//var Z_BINARY              = 0;\\n//var Z_TEXT                = 1;\\n//var Z_ASCII               = 1; // = Z_TEXT\\nvar Z_UNKNOWN             = 2;\\n\\n\\n/* The deflate compression method */\\nvar Z_DEFLATED  = 8;\\n\\n/*============================================================================*/\\n\\n\\nvar MAX_MEM_LEVEL = 9;\\n/* Maximum value for memLevel in deflateInit2 */\\nvar MAX_WBITS = 15;\\n/* 32K LZ77 window */\\nvar DEF_MEM_LEVEL = 8;\\n\\n\\nvar LENGTH_CODES  = 29;\\n/* number of length codes, not counting the special END_BLOCK code */\\nvar LITERALS      = 256;\\n/* number of literal bytes 0..255 */\\nvar L_CODES       = LITERALS + 1 + LENGTH_CODES;\\n/* number of Literal or Length codes, including the END_BLOCK code */\\nvar D_CODES       = 30;\\n/* number of distance codes */\\nvar BL_CODES      = 19;\\n/* number of codes used to transfer the bit lengths */\\nvar HEAP_SIZE     = 2 * L_CODES + 1;\\n/* maximum heap size */\\nvar MAX_BITS  = 15;\\n/* All codes must not exceed MAX_BITS bits */\\n\\nvar MIN_MATCH = 3;\\nvar MAX_MATCH = 258;\\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\\n\\nvar PRESET_DICT = 0x20;\\n\\nvar INIT_STATE = 42;\\nvar EXTRA_STATE = 69;\\nvar NAME_STATE = 73;\\nvar COMMENT_STATE = 91;\\nvar HCRC_STATE = 103;\\nvar BUSY_STATE = 113;\\nvar FINISH_STATE = 666;\\n\\nvar BS_NEED_MORE      = 1; /* block not completed, need more input or more output */\\nvar BS_BLOCK_DONE     = 2; /* block flush performed */\\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\\nvar BS_FINISH_DONE    = 4; /* finish done, accept no more input or output */\\n\\nvar OS_CODE = 0x03; // Unix :) . Don\\'t detect, use this default.\\n\\nfunction err(strm, errorCode) {\\n  strm.msg = msg[errorCode];\\n  return errorCode;\\n}\\n\\nfunction rank(f) {\\n  return ((f) << 1) - ((f) > 4 ? 9 : 0);\\n}\\n\\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\\n\\n\\n/* =========================================================================\\n * Flush as much pending output as possible. All deflate() output goes\\n * through this function so some applications may wish to modify it\\n * to avoid allocating a large strm->output buffer and copying into it.\\n * (See also read_buf()).\\n */\\nfunction flush_pending(strm) {\\n  var s = strm.state;\\n\\n  //_tr_flush_bits(s);\\n  var len = s.pending;\\n  if (len > strm.avail_out) {\\n    len = strm.avail_out;\\n  }\\n  if (len === 0) { return; }\\n\\n  utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\\n  strm.next_out += len;\\n  s.pending_out += len;\\n  strm.total_out += len;\\n  strm.avail_out -= len;\\n  s.pending -= len;\\n  if (s.pending === 0) {\\n    s.pending_out = 0;\\n  }\\n}\\n\\n\\nfunction flush_block_only(s, last) {\\n  trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\\n  s.block_start = s.strstart;\\n  flush_pending(s.strm);\\n}\\n\\n\\nfunction put_byte(s, b) {\\n  s.pending_buf[s.pending++] = b;\\n}\\n\\n\\n/* =========================================================================\\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\\n * IN assertion: the stream state is correct and there is enough room in\\n * pending_buf.\\n */\\nfunction putShortMSB(s, b) {\\n//  put_byte(s, (Byte)(b >> 8));\\n//  put_byte(s, (Byte)(b & 0xff));\\n  s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\\n  s.pending_buf[s.pending++] = b & 0xff;\\n}\\n\\n\\n/* ===========================================================================\\n * Read a new buffer from the current input stream, update the adler32\\n * and total number of bytes read.  All deflate() input goes through\\n * this function so some applications may wish to modify it to avoid\\n * allocating a large strm->input buffer and copying from it.\\n * (See also flush_pending()).\\n */\\nfunction read_buf(strm, buf, start, size) {\\n  var len = strm.avail_in;\\n\\n  if (len > size) { len = size; }\\n  if (len === 0) { return 0; }\\n\\n  strm.avail_in -= len;\\n\\n  // zmemcpy(buf, strm->next_in, len);\\n  utils.arraySet(buf, strm.input, strm.next_in, len, start);\\n  if (strm.state.wrap === 1) {\\n    strm.adler = adler32(strm.adler, buf, len, start);\\n  }\\n\\n  else if (strm.state.wrap === 2) {\\n    strm.adler = crc32(strm.adler, buf, len, start);\\n  }\\n\\n  strm.next_in += len;\\n  strm.total_in += len;\\n\\n  return len;\\n}\\n\\n\\n/* ===========================================================================\\n * Set match_start to the longest match starting at the given string and\\n * return its length. Matches shorter or equal to prev_length are discarded,\\n * in which case the result is equal to prev_length and match_start is\\n * garbage.\\n * IN assertions: cur_match is the head of the hash chain for the current\\n *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\\n * OUT assertion: the match length is not greater than s->lookahead.\\n */\\nfunction longest_match(s, cur_match) {\\n  var chain_length = s.max_chain_length;      /* max hash chain length */\\n  var scan = s.strstart; /* current string */\\n  var match;                       /* matched string */\\n  var len;                           /* length of current match */\\n  var best_len = s.prev_length;              /* best match length so far */\\n  var nice_match = s.nice_match;             /* stop if match long enough */\\n  var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\\n      s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\\n\\n  var _win = s.window; // shortcut\\n\\n  var wmask = s.w_mask;\\n  var prev  = s.prev;\\n\\n  /* Stop when cur_match becomes <= limit. To simplify the code,\\n   * we prevent matches with the string of window index 0.\\n   */\\n\\n  var strend = s.strstart + MAX_MATCH;\\n  var scan_end1  = _win[scan + best_len - 1];\\n  var scan_end   = _win[scan + best_len];\\n\\n  /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\\n   * It is easy to get rid of this optimization if necessary.\\n   */\\n  // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\\n\\n  /* Do not waste too much time if we already have a good match: */\\n  if (s.prev_length >= s.good_match) {\\n    chain_length >>= 2;\\n  }\\n  /* Do not look for matches beyond the end of the input. This is necessary\\n   * to make deflate deterministic.\\n   */\\n  if (nice_match > s.lookahead) { nice_match = s.lookahead; }\\n\\n  // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\\n\\n  do {\\n    // Assert(cur_match < s->strstart, \"no future\");\\n    match = cur_match;\\n\\n    /* Skip to next match if the match length cannot increase\\n     * or if the match length is less than 2.  Note that the checks below\\n     * for insufficient lookahead only occur occasionally for performance\\n     * reasons.  Therefore uninitialized memory will be accessed, and\\n     * conditional jumps will be made that depend on those values.\\n     * However the length of the match is limited to the lookahead, so\\n     * the output of deflate is not affected by the uninitialized values.\\n     */\\n\\n    if (_win[match + best_len]     !== scan_end  ||\\n        _win[match + best_len - 1] !== scan_end1 ||\\n        _win[match]                !== _win[scan] ||\\n        _win[++match]              !== _win[scan + 1]) {\\n      continue;\\n    }\\n\\n    /* The check at best_len-1 can be removed because it will be made\\n     * again later. (This heuristic is not always a win.)\\n     * It is not necessary to compare scan[2] and match[2] since they\\n     * are always equal when the other bytes match, given that\\n     * the hash keys are equal and that HASH_BITS >= 8.\\n     */\\n    scan += 2;\\n    match++;\\n    // Assert(*scan == *match, \"match[2]?\");\\n\\n    /* We check for insufficient lookahead only every 8th comparison;\\n     * the 256th check will be made at strstart+258.\\n     */\\n    do {\\n      /*jshint noempty:false*/\\n    } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\\n             scan < strend);\\n\\n    // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\\n\\n    len = MAX_MATCH - (strend - scan);\\n    scan = strend - MAX_MATCH;\\n\\n    if (len > best_len) {\\n      s.match_start = cur_match;\\n      best_len = len;\\n      if (len >= nice_match) {\\n        break;\\n      }\\n      scan_end1  = _win[scan + best_len - 1];\\n      scan_end   = _win[scan + best_len];\\n    }\\n  } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\\n\\n  if (best_len <= s.lookahead) {\\n    return best_len;\\n  }\\n  return s.lookahead;\\n}\\n\\n\\n/* ===========================================================================\\n * Fill the window when the lookahead becomes insufficient.\\n * Updates strstart and lookahead.\\n *\\n * IN assertion: lookahead < MIN_LOOKAHEAD\\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\\n *    At least one byte has been read, or avail_in == 0; reads are\\n *    performed for at least two bytes (required for the zip translate_eol\\n *    option -- not supported here).\\n */\\nfunction fill_window(s) {\\n  var _w_size = s.w_size;\\n  var p, n, m, more, str;\\n\\n  //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\\n\\n  do {\\n    more = s.window_size - s.lookahead - s.strstart;\\n\\n    // JS ints have 32 bit, block below not needed\\n    /* Deal with !@#$% 64K limit: */\\n    //if (sizeof(int) <= 2) {\\n    //    if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\\n    //        more = wsize;\\n    //\\n    //  } else if (more == (unsigned)(-1)) {\\n    //        /* Very unlikely, but possible on 16 bit machine if\\n    //         * strstart == 0 && lookahead == 1 (input done a byte at time)\\n    //         */\\n    //        more--;\\n    //    }\\n    //}\\n\\n\\n    /* If the window is almost full and there is insufficient lookahead,\\n     * move the upper half to the lower one to make room in the upper half.\\n     */\\n    if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\\n\\n      utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\\n      s.match_start -= _w_size;\\n      s.strstart -= _w_size;\\n      /* we now have strstart >= MAX_DIST */\\n      s.block_start -= _w_size;\\n\\n      /* Slide the hash table (could be avoided with 32 bit values\\n       at the expense of memory usage). We slide even when level == 0\\n       to keep the hash table consistent if we switch back to level > 0\\n       later. (Using level 0 permanently is not an optimal usage of\\n       zlib, so we don\\'t care about this pathological case.)\\n       */\\n\\n      n = s.hash_size;\\n      p = n;\\n      do {\\n        m = s.head[--p];\\n        s.head[p] = (m >= _w_size ? m - _w_size : 0);\\n      } while (--n);\\n\\n      n = _w_size;\\n      p = n;\\n      do {\\n        m = s.prev[--p];\\n        s.prev[p] = (m >= _w_size ? m - _w_size : 0);\\n        /* If n is not on any hash chain, prev[n] is garbage but\\n         * its value will never be used.\\n         */\\n      } while (--n);\\n\\n      more += _w_size;\\n    }\\n    if (s.strm.avail_in === 0) {\\n      break;\\n    }\\n\\n    /* If there was no sliding:\\n     *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\\n     *    more == window_size - lookahead - strstart\\n     * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\\n     * => more >= window_size - 2*WSIZE + 2\\n     * In the BIG_MEM or MMAP case (not yet supported),\\n     *   window_size == input_size + MIN_LOOKAHEAD  &&\\n     *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\\n     * Otherwise, window_size == 2*WSIZE so more >= 2.\\n     * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\\n     */\\n    //Assert(more >= 2, \"more < 2\");\\n    n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\\n    s.lookahead += n;\\n\\n    /* Initialize the hash value now that we have some input: */\\n    if (s.lookahead + s.insert >= MIN_MATCH) {\\n      str = s.strstart - s.insert;\\n      s.ins_h = s.window[str];\\n\\n      /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\\n//#if MIN_MATCH != 3\\n//        Call update_hash() MIN_MATCH-3 more times\\n//#endif\\n      while (s.insert) {\\n        /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\\n        s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\\n\\n        s.prev[str & s.w_mask] = s.head[s.ins_h];\\n        s.head[s.ins_h] = str;\\n        str++;\\n        s.insert--;\\n        if (s.lookahead + s.insert < MIN_MATCH) {\\n          break;\\n        }\\n      }\\n    }\\n    /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\\n     * but this is not important since only literal bytes will be emitted.\\n     */\\n\\n  } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\\n\\n  /* If the WIN_INIT bytes after the end of the current data have never been\\n   * written, then zero those bytes in order to avoid memory check reports of\\n   * the use of uninitialized (or uninitialised as Julian writes) bytes by\\n   * the longest match routines.  Update the high water mark for the next\\n   * time through here.  WIN_INIT is set to MAX_MATCH since the longest match\\n   * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\\n   */\\n//  if (s.high_water < s.window_size) {\\n//    var curr = s.strstart + s.lookahead;\\n//    var init = 0;\\n//\\n//    if (s.high_water < curr) {\\n//      /* Previous high water mark below current data -- zero WIN_INIT\\n//       * bytes or up to end of window, whichever is less.\\n//       */\\n//      init = s.window_size - curr;\\n//      if (init > WIN_INIT)\\n//        init = WIN_INIT;\\n//      zmemzero(s->window + curr, (unsigned)init);\\n//      s->high_water = curr + init;\\n//    }\\n//    else if (s->high_water < (ulg)curr + WIN_INIT) {\\n//      /* High water mark at or above current data, but below current data\\n//       * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\\n//       * to end of window, whichever is less.\\n//       */\\n//      init = (ulg)curr + WIN_INIT - s->high_water;\\n//      if (init > s->window_size - s->high_water)\\n//        init = s->window_size - s->high_water;\\n//      zmemzero(s->window + s->high_water, (unsigned)init);\\n//      s->high_water += init;\\n//    }\\n//  }\\n//\\n//  Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\\n//    \"not enough room for search\");\\n}\\n\\n/* ===========================================================================\\n * Copy without compression as much as possible from the input stream, return\\n * the current block state.\\n * This function does not insert new strings in the dictionary since\\n * uncompressible data is probably not useful. This function is used\\n * only for the level=0 compression option.\\n * NOTE: this function should be optimized to avoid extra copying from\\n * window to pending_buf.\\n */\\nfunction deflate_stored(s, flush) {\\n  /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\\n   * to pending_buf_size, and each stored block has a 5 byte header:\\n   */\\n  var max_block_size = 0xffff;\\n\\n  if (max_block_size > s.pending_buf_size - 5) {\\n    max_block_size = s.pending_buf_size - 5;\\n  }\\n\\n  /* Copy as much as possible from input to output: */\\n  for (;;) {\\n    /* Fill the window as much as possible: */\\n    if (s.lookahead <= 1) {\\n\\n      //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\\n      //  s->block_start >= (long)s->w_size, \"slide too late\");\\n//      if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\\n//        s.block_start >= s.w_size)) {\\n//        throw  new Error(\"slide too late\");\\n//      }\\n\\n      fill_window(s);\\n      if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\\n        return BS_NEED_MORE;\\n      }\\n\\n      if (s.lookahead === 0) {\\n        break;\\n      }\\n      /* flush the current block */\\n    }\\n    //Assert(s->block_start >= 0L, \"block gone\");\\n//    if (s.block_start < 0) throw new Error(\"block gone\");\\n\\n    s.strstart += s.lookahead;\\n    s.lookahead = 0;\\n\\n    /* Emit a stored block if pending_buf will be full: */\\n    var max_start = s.block_start + max_block_size;\\n\\n    if (s.strstart === 0 || s.strstart >= max_start) {\\n      /* strstart == 0 is possible when wraparound on 16-bit machine */\\n      s.lookahead = s.strstart - max_start;\\n      s.strstart = max_start;\\n      /*** FLUSH_BLOCK(s, 0); ***/\\n      flush_block_only(s, false);\\n      if (s.strm.avail_out === 0) {\\n        return BS_NEED_MORE;\\n      }\\n      /***/\\n\\n\\n    }\\n    /* Flush if we may have to slide, otherwise block_start may become\\n     * negative and the data will be gone:\\n     */\\n    if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\\n      /*** FLUSH_BLOCK(s, 0); ***/\\n      flush_block_only(s, false);\\n      if (s.strm.avail_out === 0) {\\n        return BS_NEED_MORE;\\n      }\\n      /***/\\n    }\\n  }\\n\\n  s.insert = 0;\\n\\n  if (flush === Z_FINISH) {\\n    /*** FLUSH_BLOCK(s, 1); ***/\\n    flush_block_only(s, true);\\n    if (s.strm.avail_out === 0) {\\n      return BS_FINISH_STARTED;\\n    }\\n    /***/\\n    return BS_FINISH_DONE;\\n  }\\n\\n  if (s.strstart > s.block_start) {\\n    /*** FLUSH_BLOCK(s, 0); ***/\\n    flush_block_only(s, false);\\n    if (s.strm.avail_out === 0) {\\n      return BS_NEED_MORE;\\n    }\\n    /***/\\n  }\\n\\n  return BS_NEED_MORE;\\n}\\n\\n/* ===========================================================================\\n * Compress as much as possible from the input stream, return the current\\n * block state.\\n * This function does not perform lazy evaluation of matches and inserts\\n * new strings in the dictionary only for unmatched strings or for short\\n * matches. It is used only for the fast compression options.\\n */\\nfunction deflate_fast(s, flush) {\\n  var hash_head;        /* head of the hash chain */\\n  var bflush;           /* set if current block must be flushed */\\n\\n  for (;;) {\\n    /* Make sure that we always have enough lookahead, except\\n     * at the end of the input file. We need MAX_MATCH bytes\\n     * for the next match, plus MIN_MATCH bytes to insert the\\n     * string following the next match.\\n     */\\n    if (s.lookahead < MIN_LOOKAHEAD) {\\n      fill_window(s);\\n      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\\n        return BS_NEED_MORE;\\n      }\\n      if (s.lookahead === 0) {\\n        break; /* flush the current block */\\n      }\\n    }\\n\\n    /* Insert the string window[strstart .. strstart+2] in the\\n     * dictionary, and set hash_head to the head of the hash chain:\\n     */\\n    hash_head = 0/*NIL*/;\\n    if (s.lookahead >= MIN_MATCH) {\\n      /*** INSERT_STRING(s, s.strstart, hash_head); ***/\\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\\n      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\\n      s.head[s.ins_h] = s.strstart;\\n      /***/\\n    }\\n\\n    /* Find the longest match, discarding those <= prev_length.\\n     * At this point we have always match_length < MIN_MATCH\\n     */\\n    if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\\n      /* To simplify the code, we prevent matches with the string\\n       * of window index 0 (in particular we have to avoid a match\\n       * of the string with itself at the start of the input file).\\n       */\\n      s.match_length = longest_match(s, hash_head);\\n      /* longest_match() sets match_start */\\n    }\\n    if (s.match_length >= MIN_MATCH) {\\n      // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\\n\\n      /*** _tr_tally_dist(s, s.strstart - s.match_start,\\n                     s.match_length - MIN_MATCH, bflush); ***/\\n      bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\\n\\n      s.lookahead -= s.match_length;\\n\\n      /* Insert new strings in the hash table only if the match length\\n       * is not too large. This saves time but degrades compression.\\n       */\\n      if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\\n        s.match_length--; /* string at strstart already in table */\\n        do {\\n          s.strstart++;\\n          /*** INSERT_STRING(s, s.strstart, hash_head); ***/\\n          s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\\n          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\\n          s.head[s.ins_h] = s.strstart;\\n          /***/\\n          /* strstart never exceeds WSIZE-MAX_MATCH, so there are\\n           * always MIN_MATCH bytes ahead.\\n           */\\n        } while (--s.match_length !== 0);\\n        s.strstart++;\\n      } else\\n      {\\n        s.strstart += s.match_length;\\n        s.match_length = 0;\\n        s.ins_h = s.window[s.strstart];\\n        /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\\n        s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\\n\\n//#if MIN_MATCH != 3\\n//                Call UPDATE_HASH() MIN_MATCH-3 more times\\n//#endif\\n        /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\\n         * matter since it will be recomputed at next deflate call.\\n         */\\n      }\\n    } else {\\n      /* No match, output a literal byte */\\n      //Tracevv((stderr,\"%c\", s.window[s.strstart]));\\n      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\\n      bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\\n\\n      s.lookahead--;\\n      s.strstart++;\\n    }\\n    if (bflush) {\\n      /*** FLUSH_BLOCK(s, 0); ***/\\n      flush_block_only(s, false);\\n      if (s.strm.avail_out === 0) {\\n        return BS_NEED_MORE;\\n      }\\n      /***/\\n    }\\n  }\\n  s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\\n  if (flush === Z_FINISH) {\\n    /*** FLUSH_BLOCK(s, 1); ***/\\n    flush_block_only(s, true);\\n    if (s.strm.avail_out === 0) {\\n      return BS_FINISH_STARTED;\\n    }\\n    /***/\\n    return BS_FINISH_DONE;\\n  }\\n  if (s.last_lit) {\\n    /*** FLUSH_BLOCK(s, 0); ***/\\n    flush_block_only(s, false);\\n    if (s.strm.avail_out === 0) {\\n      return BS_NEED_MORE;\\n    }\\n    /***/\\n  }\\n  return BS_BLOCK_DONE;\\n}\\n\\n/* ===========================================================================\\n * Same as above, but achieves better compression. We use a lazy\\n * evaluation for matches: a match is finally adopted only if there is\\n * no better match at the next window position.\\n */\\nfunction deflate_slow(s, flush) {\\n  var hash_head;          /* head of hash chain */\\n  var bflush;              /* set if current block must be flushed */\\n\\n  var max_insert;\\n\\n  /* Process the input block. */\\n  for (;;) {\\n    /* Make sure that we always have enough lookahead, except\\n     * at the end of the input file. We need MAX_MATCH bytes\\n     * for the next match, plus MIN_MATCH bytes to insert the\\n     * string following the next match.\\n     */\\n    if (s.lookahead < MIN_LOOKAHEAD) {\\n      fill_window(s);\\n      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\\n        return BS_NEED_MORE;\\n      }\\n      if (s.lookahead === 0) { break; } /* flush the current block */\\n    }\\n\\n    /* Insert the string window[strstart .. strstart+2] in the\\n     * dictionary, and set hash_head to the head of the hash chain:\\n     */\\n    hash_head = 0/*NIL*/;\\n    if (s.lookahead >= MIN_MATCH) {\\n      /*** INSERT_STRING(s, s.strstart, hash_head); ***/\\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\\n      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\\n      s.head[s.ins_h] = s.strstart;\\n      /***/\\n    }\\n\\n    /* Find the longest match, discarding those <= prev_length.\\n     */\\n    s.prev_length = s.match_length;\\n    s.prev_match = s.match_start;\\n    s.match_length = MIN_MATCH - 1;\\n\\n    if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\\n        s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\\n      /* To simplify the code, we prevent matches with the string\\n       * of window index 0 (in particular we have to avoid a match\\n       * of the string with itself at the start of the input file).\\n       */\\n      s.match_length = longest_match(s, hash_head);\\n      /* longest_match() sets match_start */\\n\\n      if (s.match_length <= 5 &&\\n         (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\\n\\n        /* If prev_match is also MIN_MATCH, match_start is garbage\\n         * but we will ignore the current match anyway.\\n         */\\n        s.match_length = MIN_MATCH - 1;\\n      }\\n    }\\n    /* If there was a match at the previous step and the current\\n     * match is not better, output the previous match:\\n     */\\n    if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\\n      max_insert = s.strstart + s.lookahead - MIN_MATCH;\\n      /* Do not insert strings in hash table beyond this. */\\n\\n      //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\\n\\n      /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\\n                     s.prev_length - MIN_MATCH, bflush);***/\\n      bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\\n      /* Insert in hash table all strings up to the end of the match.\\n       * strstart-1 and strstart are already inserted. If there is not\\n       * enough lookahead, the last two strings are not inserted in\\n       * the hash table.\\n       */\\n      s.lookahead -= s.prev_length - 1;\\n      s.prev_length -= 2;\\n      do {\\n        if (++s.strstart <= max_insert) {\\n          /*** INSERT_STRING(s, s.strstart, hash_head); ***/\\n          s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\\n          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\\n          s.head[s.ins_h] = s.strstart;\\n          /***/\\n        }\\n      } while (--s.prev_length !== 0);\\n      s.match_available = 0;\\n      s.match_length = MIN_MATCH - 1;\\n      s.strstart++;\\n\\n      if (bflush) {\\n        /*** FLUSH_BLOCK(s, 0); ***/\\n        flush_block_only(s, false);\\n        if (s.strm.avail_out === 0) {\\n          return BS_NEED_MORE;\\n        }\\n        /***/\\n      }\\n\\n    } else if (s.match_available) {\\n      /* If there was no match at the previous position, output a\\n       * single literal. If there was a match but the current match\\n       * is longer, truncate the previous match to a single literal.\\n       */\\n      //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\\n      /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\\n      bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\\n\\n      if (bflush) {\\n        /*** FLUSH_BLOCK_ONLY(s, 0) ***/\\n        flush_block_only(s, false);\\n        /***/\\n      }\\n      s.strstart++;\\n      s.lookahead--;\\n      if (s.strm.avail_out === 0) {\\n        return BS_NEED_MORE;\\n      }\\n    } else {\\n      /* There is no previous match to compare with, wait for\\n       * the next step to decide.\\n       */\\n      s.match_available = 1;\\n      s.strstart++;\\n      s.lookahead--;\\n    }\\n  }\\n  //Assert (flush != Z_NO_FLUSH, \"no flush?\");\\n  if (s.match_available) {\\n    //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\\n    /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\\n    bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\\n\\n    s.match_available = 0;\\n  }\\n  s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\\n  if (flush === Z_FINISH) {\\n    /*** FLUSH_BLOCK(s, 1); ***/\\n    flush_block_only(s, true);\\n    if (s.strm.avail_out === 0) {\\n      return BS_FINISH_STARTED;\\n    }\\n    /***/\\n    return BS_FINISH_DONE;\\n  }\\n  if (s.last_lit) {\\n    /*** FLUSH_BLOCK(s, 0); ***/\\n    flush_block_only(s, false);\\n    if (s.strm.avail_out === 0) {\\n      return BS_NEED_MORE;\\n    }\\n    /***/\\n  }\\n\\n  return BS_BLOCK_DONE;\\n}\\n\\n\\n/* ===========================================================================\\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\\n * one.  Do not maintain a hash table.  (It will be regenerated if this run of\\n * deflate switches away from Z_RLE.)\\n */\\nfunction deflate_rle(s, flush) {\\n  var bflush;            /* set if current block must be flushed */\\n  var prev;              /* byte at distance one to match */\\n  var scan, strend;      /* scan goes up to strend for length of run */\\n\\n  var _win = s.window;\\n\\n  for (;;) {\\n    /* Make sure that we always have enough lookahead, except\\n     * at the end of the input file. We need MAX_MATCH bytes\\n     * for the longest run, plus one for the unrolled loop.\\n     */\\n    if (s.lookahead <= MAX_MATCH) {\\n      fill_window(s);\\n      if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\\n        return BS_NEED_MORE;\\n      }\\n      if (s.lookahead === 0) { break; } /* flush the current block */\\n    }\\n\\n    /* See how many times the previous byte repeats */\\n    s.match_length = 0;\\n    if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\\n      scan = s.strstart - 1;\\n      prev = _win[scan];\\n      if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\\n        strend = s.strstart + MAX_MATCH;\\n        do {\\n          /*jshint noempty:false*/\\n        } while (prev === _win[++scan] && prev === _win[++scan] &&\\n                 prev === _win[++scan] && prev === _win[++scan] &&\\n                 prev === _win[++scan] && prev === _win[++scan] &&\\n                 prev === _win[++scan] && prev === _win[++scan] &&\\n                 scan < strend);\\n        s.match_length = MAX_MATCH - (strend - scan);\\n        if (s.match_length > s.lookahead) {\\n          s.match_length = s.lookahead;\\n        }\\n      }\\n      //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\\n    }\\n\\n    /* Emit match if have run of MIN_MATCH or longer, else emit literal */\\n    if (s.match_length >= MIN_MATCH) {\\n      //check_match(s, s.strstart, s.strstart - 1, s.match_length);\\n\\n      /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\\n      bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\\n\\n      s.lookahead -= s.match_length;\\n      s.strstart += s.match_length;\\n      s.match_length = 0;\\n    } else {\\n      /* No match, output a literal byte */\\n      //Tracevv((stderr,\"%c\", s->window[s->strstart]));\\n      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\\n      bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\\n\\n      s.lookahead--;\\n      s.strstart++;\\n    }\\n    if (bflush) {\\n      /*** FLUSH_BLOCK(s, 0); ***/\\n      flush_block_only(s, false);\\n      if (s.strm.avail_out === 0) {\\n        return BS_NEED_MORE;\\n      }\\n      /***/\\n    }\\n  }\\n  s.insert = 0;\\n  if (flush === Z_FINISH) {\\n    /*** FLUSH_BLOCK(s, 1); ***/\\n    flush_block_only(s, true);\\n    if (s.strm.avail_out === 0) {\\n      return BS_FINISH_STARTED;\\n    }\\n    /***/\\n    return BS_FINISH_DONE;\\n  }\\n  if (s.last_lit) {\\n    /*** FLUSH_BLOCK(s, 0); ***/\\n    flush_block_only(s, false);\\n    if (s.strm.avail_out === 0) {\\n      return BS_NEED_MORE;\\n    }\\n    /***/\\n  }\\n  return BS_BLOCK_DONE;\\n}\\n\\n/* ===========================================================================\\n * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.\\n * (It will be regenerated if this run of deflate switches away from Huffman.)\\n */\\nfunction deflate_huff(s, flush) {\\n  var bflush;             /* set if current block must be flushed */\\n\\n  for (;;) {\\n    /* Make sure that we have a literal to write. */\\n    if (s.lookahead === 0) {\\n      fill_window(s);\\n      if (s.lookahead === 0) {\\n        if (flush === Z_NO_FLUSH) {\\n          return BS_NEED_MORE;\\n        }\\n        break;      /* flush the current block */\\n      }\\n    }\\n\\n    /* Output a literal byte */\\n    s.match_length = 0;\\n    //Tracevv((stderr,\"%c\", s->window[s->strstart]));\\n    /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\\n    bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\\n    s.lookahead--;\\n    s.strstart++;\\n    if (bflush) {\\n      /*** FLUSH_BLOCK(s, 0); ***/\\n      flush_block_only(s, false);\\n      if (s.strm.avail_out === 0) {\\n        return BS_NEED_MORE;\\n      }\\n      /***/\\n    }\\n  }\\n  s.insert = 0;\\n  if (flush === Z_FINISH) {\\n    /*** FLUSH_BLOCK(s, 1); ***/\\n    flush_block_only(s, true);\\n    if (s.strm.avail_out === 0) {\\n      return BS_FINISH_STARTED;\\n    }\\n    /***/\\n    return BS_FINISH_DONE;\\n  }\\n  if (s.last_lit) {\\n    /*** FLUSH_BLOCK(s, 0); ***/\\n    flush_block_only(s, false);\\n    if (s.strm.avail_out === 0) {\\n      return BS_NEED_MORE;\\n    }\\n    /***/\\n  }\\n  return BS_BLOCK_DONE;\\n}\\n\\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\\n * the desired pack level (0..9). The values given below have been tuned to\\n * exclude worst case performance for pathological files. Better values may be\\n * found for specific files.\\n */\\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\\n  this.good_length = good_length;\\n  this.max_lazy = max_lazy;\\n  this.nice_length = nice_length;\\n  this.max_chain = max_chain;\\n  this.func = func;\\n}\\n\\nvar configuration_table;\\n\\nconfiguration_table = [\\n  /*      good lazy nice chain */\\n  new Config(0, 0, 0, 0, deflate_stored),          /* 0 store only */\\n  new Config(4, 4, 8, 4, deflate_fast),            /* 1 max speed, no lazy matches */\\n  new Config(4, 5, 16, 8, deflate_fast),           /* 2 */\\n  new Config(4, 6, 32, 32, deflate_fast),          /* 3 */\\n\\n  new Config(4, 4, 16, 16, deflate_slow),          /* 4 lazy matches */\\n  new Config(8, 16, 32, 32, deflate_slow),         /* 5 */\\n  new Config(8, 16, 128, 128, deflate_slow),       /* 6 */\\n  new Config(8, 32, 128, 256, deflate_slow),       /* 7 */\\n  new Config(32, 128, 258, 1024, deflate_slow),    /* 8 */\\n  new Config(32, 258, 258, 4096, deflate_slow)     /* 9 max compression */\\n];\\n\\n\\n/* ===========================================================================\\n * Initialize the \"longest match\" routines for a new zlib stream\\n */\\nfunction lm_init(s) {\\n  s.window_size = 2 * s.w_size;\\n\\n  /*** CLEAR_HASH(s); ***/\\n  zero(s.head); // Fill with NIL (= 0);\\n\\n  /* Set the default configuration parameters:\\n   */\\n  s.max_lazy_match = configuration_table[s.level].max_lazy;\\n  s.good_match = configuration_table[s.level].good_length;\\n  s.nice_match = configuration_table[s.level].nice_length;\\n  s.max_chain_length = configuration_table[s.level].max_chain;\\n\\n  s.strstart = 0;\\n  s.block_start = 0;\\n  s.lookahead = 0;\\n  s.insert = 0;\\n  s.match_length = s.prev_length = MIN_MATCH - 1;\\n  s.match_available = 0;\\n  s.ins_h = 0;\\n}\\n\\n\\nfunction DeflateState() {\\n  this.strm = null;            /* pointer back to this zlib stream */\\n  this.status = 0;            /* as the name implies */\\n  this.pending_buf = null;      /* output still pending */\\n  this.pending_buf_size = 0;  /* size of pending_buf */\\n  this.pending_out = 0;       /* next pending byte to output to the stream */\\n  this.pending = 0;           /* nb of bytes in the pending buffer */\\n  this.wrap = 0;              /* bit 0 true for zlib, bit 1 true for gzip */\\n  this.gzhead = null;         /* gzip header information to write */\\n  this.gzindex = 0;           /* where in extra, name, or comment */\\n  this.method = Z_DEFLATED; /* can only be DEFLATED */\\n  this.last_flush = -1;   /* value of flush param for previous deflate call */\\n\\n  this.w_size = 0;  /* LZ77 window size (32K by default) */\\n  this.w_bits = 0;  /* log2(w_size)  (8..16) */\\n  this.w_mask = 0;  /* w_size - 1 */\\n\\n  this.window = null;\\n  /* Sliding window. Input bytes are read into the second half of the window,\\n   * and move to the first half later to keep a dictionary of at least wSize\\n   * bytes. With this organization, matches are limited to a distance of\\n   * wSize-MAX_MATCH bytes, but this ensures that IO is always\\n   * performed with a length multiple of the block size.\\n   */\\n\\n  this.window_size = 0;\\n  /* Actual size of window: 2*wSize, except when the user input buffer\\n   * is directly used as sliding window.\\n   */\\n\\n  this.prev = null;\\n  /* Link to older string with same hash index. To limit the size of this\\n   * array to 64K, this link is maintained only for the last 32K strings.\\n   * An index in this array is thus a window index modulo 32K.\\n   */\\n\\n  this.head = null;   /* Heads of the hash chains or NIL. */\\n\\n  this.ins_h = 0;       /* hash index of string to be inserted */\\n  this.hash_size = 0;   /* number of elements in hash table */\\n  this.hash_bits = 0;   /* log2(hash_size) */\\n  this.hash_mask = 0;   /* hash_size-1 */\\n\\n  this.hash_shift = 0;\\n  /* Number of bits by which ins_h must be shifted at each input\\n   * step. It must be such that after MIN_MATCH steps, the oldest\\n   * byte no longer takes part in the hash key, that is:\\n   *   hash_shift * MIN_MATCH >= hash_bits\\n   */\\n\\n  this.block_start = 0;\\n  /* Window position at the beginning of the current output block. Gets\\n   * negative when the window is moved backwards.\\n   */\\n\\n  this.match_length = 0;      /* length of best match */\\n  this.prev_match = 0;        /* previous match */\\n  this.match_available = 0;   /* set if previous match exists */\\n  this.strstart = 0;          /* start of string to insert */\\n  this.match_start = 0;       /* start of matching string */\\n  this.lookahead = 0;         /* number of valid bytes ahead in window */\\n\\n  this.prev_length = 0;\\n  /* Length of the best match at previous step. Matches not greater than this\\n   * are discarded. This is used in the lazy match evaluation.\\n   */\\n\\n  this.max_chain_length = 0;\\n  /* To speed up deflation, hash chains are never searched beyond this\\n   * length.  A higher limit improves compression ratio but degrades the\\n   * speed.\\n   */\\n\\n  this.max_lazy_match = 0;\\n  /* Attempt to find a better match only when the current match is strictly\\n   * smaller than this value. This mechanism is used only for compression\\n   * levels >= 4.\\n   */\\n  // That\\'s alias to max_lazy_match, don\\'t use directly\\n  //this.max_insert_length = 0;\\n  /* Insert new strings in the hash table only if the match length is not\\n   * greater than this length. This saves time but degrades compression.\\n   * max_insert_length is used only for compression levels <= 3.\\n   */\\n\\n  this.level = 0;     /* compression level (1..9) */\\n  this.strategy = 0;  /* favor or force Huffman coding*/\\n\\n  this.good_match = 0;\\n  /* Use a faster search when the previous match is longer than this */\\n\\n  this.nice_match = 0; /* Stop searching when current match exceeds this */\\n\\n              /* used by trees.c: */\\n\\n  /* Didn\\'t use ct_data typedef below to suppress compiler warning */\\n\\n  // struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */\\n  // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\\n  // struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */\\n\\n  // Use flat array of DOUBLE size, with interleaved fata,\\n  // because JS does not support effective\\n  this.dyn_ltree  = new utils.Buf16(HEAP_SIZE * 2);\\n  this.dyn_dtree  = new utils.Buf16((2 * D_CODES + 1) * 2);\\n  this.bl_tree    = new utils.Buf16((2 * BL_CODES + 1) * 2);\\n  zero(this.dyn_ltree);\\n  zero(this.dyn_dtree);\\n  zero(this.bl_tree);\\n\\n  this.l_desc   = null;         /* desc. for literal tree */\\n  this.d_desc   = null;         /* desc. for distance tree */\\n  this.bl_desc  = null;         /* desc. for bit length tree */\\n\\n  //ush bl_count[MAX_BITS+1];\\n  this.bl_count = new utils.Buf16(MAX_BITS + 1);\\n  /* number of codes at each bit length for an optimal tree */\\n\\n  //int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */\\n  this.heap = new utils.Buf16(2 * L_CODES + 1);  /* heap used to build the Huffman trees */\\n  zero(this.heap);\\n\\n  this.heap_len = 0;               /* number of elements in the heap */\\n  this.heap_max = 0;               /* element of largest frequency */\\n  /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\\n   * The same heap array is used to build all trees.\\n   */\\n\\n  this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\\n  zero(this.depth);\\n  /* Depth of each subtree used as tie breaker for trees of equal frequency\\n   */\\n\\n  this.l_buf = 0;          /* buffer index for literals or lengths */\\n\\n  this.lit_bufsize = 0;\\n  /* Size of match buffer for literals/lengths.  There are 4 reasons for\\n   * limiting lit_bufsize to 64K:\\n   *   - frequencies can be kept in 16 bit counters\\n   *   - if compression is not successful for the first block, all input\\n   *     data is still in the window so we can still emit a stored block even\\n   *     when input comes from standard input.  (This can also be done for\\n   *     all blocks if lit_bufsize is not greater than 32K.)\\n   *   - if compression is not successful for a file smaller than 64K, we can\\n   *     even emit a stored file instead of a stored block (saving 5 bytes).\\n   *     This is applicable only for zip (not gzip or zlib).\\n   *   - creating new Huffman trees less frequently may not provide fast\\n   *     adaptation to changes in the input data statistics. (Take for\\n   *     example a binary file with poorly compressible code followed by\\n   *     a highly compressible string table.) Smaller buffer sizes give\\n   *     fast adaptation but have of course the overhead of transmitting\\n   *     trees more frequently.\\n   *   - I can\\'t count above 4\\n   */\\n\\n  this.last_lit = 0;      /* running index in l_buf */\\n\\n  this.d_buf = 0;\\n  /* Buffer index for distances. To simplify the code, d_buf and l_buf have\\n   * the same number of elements. To use different lengths, an extra flag\\n   * array would be necessary.\\n   */\\n\\n  this.opt_len = 0;       /* bit length of current block with optimal trees */\\n  this.static_len = 0;    /* bit length of current block with static trees */\\n  this.matches = 0;       /* number of string matches in current block */\\n  this.insert = 0;        /* bytes at end of window left to insert */\\n\\n\\n  this.bi_buf = 0;\\n  /* Output buffer. bits are inserted starting at the bottom (least\\n   * significant bits).\\n   */\\n  this.bi_valid = 0;\\n  /* Number of valid bits in bi_buf.  All bits above the last valid bit\\n   * are always zero.\\n   */\\n\\n  // Used for window memory init. We safely ignore it for JS. That makes\\n  // sense only for pointers and memory check tools.\\n  //this.high_water = 0;\\n  /* High water mark offset in window for initialized bytes -- bytes above\\n   * this are set to zero in order to avoid memory check warnings when\\n   * longest match routines access bytes past the input.  This is then\\n   * updated to the new high water mark.\\n   */\\n}\\n\\n\\nfunction deflateResetKeep(strm) {\\n  var s;\\n\\n  if (!strm || !strm.state) {\\n    return err(strm, Z_STREAM_ERROR);\\n  }\\n\\n  strm.total_in = strm.total_out = 0;\\n  strm.data_type = Z_UNKNOWN;\\n\\n  s = strm.state;\\n  s.pending = 0;\\n  s.pending_out = 0;\\n\\n  if (s.wrap < 0) {\\n    s.wrap = -s.wrap;\\n    /* was made negative by deflate(..., Z_FINISH); */\\n  }\\n  s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\\n  strm.adler = (s.wrap === 2) ?\\n    0  // crc32(0, Z_NULL, 0)\\n  :\\n    1; // adler32(0, Z_NULL, 0)\\n  s.last_flush = Z_NO_FLUSH;\\n  trees._tr_init(s);\\n  return Z_OK;\\n}\\n\\n\\nfunction deflateReset(strm) {\\n  var ret = deflateResetKeep(strm);\\n  if (ret === Z_OK) {\\n    lm_init(strm.state);\\n  }\\n  return ret;\\n}\\n\\n\\nfunction deflateSetHeader(strm, head) {\\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\\n  if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\\n  strm.state.gzhead = head;\\n  return Z_OK;\\n}\\n\\n\\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\\n  if (!strm) { // === Z_NULL\\n    return Z_STREAM_ERROR;\\n  }\\n  var wrap = 1;\\n\\n  if (level === Z_DEFAULT_COMPRESSION) {\\n    level = 6;\\n  }\\n\\n  if (windowBits < 0) { /* suppress zlib wrapper */\\n    wrap = 0;\\n    windowBits = -windowBits;\\n  }\\n\\n  else if (windowBits > 15) {\\n    wrap = 2;           /* write gzip wrapper instead */\\n    windowBits -= 16;\\n  }\\n\\n\\n  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\\n    windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\\n    strategy < 0 || strategy > Z_FIXED) {\\n    return err(strm, Z_STREAM_ERROR);\\n  }\\n\\n\\n  if (windowBits === 8) {\\n    windowBits = 9;\\n  }\\n  /* until 256-byte window bug fixed */\\n\\n  var s = new DeflateState();\\n\\n  strm.state = s;\\n  s.strm = strm;\\n\\n  s.wrap = wrap;\\n  s.gzhead = null;\\n  s.w_bits = windowBits;\\n  s.w_size = 1 << s.w_bits;\\n  s.w_mask = s.w_size - 1;\\n\\n  s.hash_bits = memLevel + 7;\\n  s.hash_size = 1 << s.hash_bits;\\n  s.hash_mask = s.hash_size - 1;\\n  s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\\n\\n  s.window = new utils.Buf8(s.w_size * 2);\\n  s.head = new utils.Buf16(s.hash_size);\\n  s.prev = new utils.Buf16(s.w_size);\\n\\n  // Don\\'t need mem init magic for JS.\\n  //s.high_water = 0;  /* nothing written to s->window yet */\\n\\n  s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\\n\\n  s.pending_buf_size = s.lit_bufsize * 4;\\n  s.pending_buf = new utils.Buf8(s.pending_buf_size);\\n\\n  s.d_buf = s.lit_bufsize >> 1;\\n  s.l_buf = (1 + 2) * s.lit_bufsize;\\n\\n  s.level = level;\\n  s.strategy = strategy;\\n  s.method = method;\\n\\n  return deflateReset(strm);\\n}\\n\\nfunction deflateInit(strm, level) {\\n  return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\\n}\\n\\n\\nfunction deflate(strm, flush) {\\n  var old_flush, s;\\n  var beg, val; // for gzip header write only\\n\\n  if (!strm || !strm.state ||\\n    flush > Z_BLOCK || flush < 0) {\\n    return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\\n  }\\n\\n  s = strm.state;\\n\\n  if (!strm.output ||\\n      (!strm.input && strm.avail_in !== 0) ||\\n      (s.status === FINISH_STATE && flush !== Z_FINISH)) {\\n    return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\\n  }\\n\\n  s.strm = strm; /* just in case */\\n  old_flush = s.last_flush;\\n  s.last_flush = flush;\\n\\n  /* Write the header */\\n  if (s.status === INIT_STATE) {\\n\\n    if (s.wrap === 2) { // GZIP header\\n      strm.adler = 0;  //crc32(0L, Z_NULL, 0);\\n      put_byte(s, 31);\\n      put_byte(s, 139);\\n      put_byte(s, 8);\\n      if (!s.gzhead) { // s->gzhead == Z_NULL\\n        put_byte(s, 0);\\n        put_byte(s, 0);\\n        put_byte(s, 0);\\n        put_byte(s, 0);\\n        put_byte(s, 0);\\n        put_byte(s, s.level === 9 ? 2 :\\n                    (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\\n                     4 : 0));\\n        put_byte(s, OS_CODE);\\n        s.status = BUSY_STATE;\\n      }\\n      else {\\n        put_byte(s, (s.gzhead.text ? 1 : 0) +\\n                    (s.gzhead.hcrc ? 2 : 0) +\\n                    (!s.gzhead.extra ? 0 : 4) +\\n                    (!s.gzhead.name ? 0 : 8) +\\n                    (!s.gzhead.comment ? 0 : 16)\\n                );\\n        put_byte(s, s.gzhead.time & 0xff);\\n        put_byte(s, (s.gzhead.time >> 8) & 0xff);\\n        put_byte(s, (s.gzhead.time >> 16) & 0xff);\\n        put_byte(s, (s.gzhead.time >> 24) & 0xff);\\n        put_byte(s, s.level === 9 ? 2 :\\n                    (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\\n                     4 : 0));\\n        put_byte(s, s.gzhead.os & 0xff);\\n        if (s.gzhead.extra && s.gzhead.extra.length) {\\n          put_byte(s, s.gzhead.extra.length & 0xff);\\n          put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\\n        }\\n        if (s.gzhead.hcrc) {\\n          strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\\n        }\\n        s.gzindex = 0;\\n        s.status = EXTRA_STATE;\\n      }\\n    }\\n    else // DEFLATE header\\n    {\\n      var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\\n      var level_flags = -1;\\n\\n      if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\\n        level_flags = 0;\\n      } else if (s.level < 6) {\\n        level_flags = 1;\\n      } else if (s.level === 6) {\\n        level_flags = 2;\\n      } else {\\n        level_flags = 3;\\n      }\\n      header |= (level_flags << 6);\\n      if (s.strstart !== 0) { header |= PRESET_DICT; }\\n      header += 31 - (header % 31);\\n\\n      s.status = BUSY_STATE;\\n      putShortMSB(s, header);\\n\\n      /* Save the adler32 of the preset dictionary: */\\n      if (s.strstart !== 0) {\\n        putShortMSB(s, strm.adler >>> 16);\\n        putShortMSB(s, strm.adler & 0xffff);\\n      }\\n      strm.adler = 1; // adler32(0L, Z_NULL, 0);\\n    }\\n  }\\n\\n//#ifdef GZIP\\n  if (s.status === EXTRA_STATE) {\\n    if (s.gzhead.extra/* != Z_NULL*/) {\\n      beg = s.pending;  /* start of bytes to update crc */\\n\\n      while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\\n        if (s.pending === s.pending_buf_size) {\\n          if (s.gzhead.hcrc && s.pending > beg) {\\n            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\\n          }\\n          flush_pending(strm);\\n          beg = s.pending;\\n          if (s.pending === s.pending_buf_size) {\\n            break;\\n          }\\n        }\\n        put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\\n        s.gzindex++;\\n      }\\n      if (s.gzhead.hcrc && s.pending > beg) {\\n        strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\\n      }\\n      if (s.gzindex === s.gzhead.extra.length) {\\n        s.gzindex = 0;\\n        s.status = NAME_STATE;\\n      }\\n    }\\n    else {\\n      s.status = NAME_STATE;\\n    }\\n  }\\n  if (s.status === NAME_STATE) {\\n    if (s.gzhead.name/* != Z_NULL*/) {\\n      beg = s.pending;  /* start of bytes to update crc */\\n      //int val;\\n\\n      do {\\n        if (s.pending === s.pending_buf_size) {\\n          if (s.gzhead.hcrc && s.pending > beg) {\\n            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\\n          }\\n          flush_pending(strm);\\n          beg = s.pending;\\n          if (s.pending === s.pending_buf_size) {\\n            val = 1;\\n            break;\\n          }\\n        }\\n        // JS specific: little magic to add zero terminator to end of string\\n        if (s.gzindex < s.gzhead.name.length) {\\n          val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\\n        } else {\\n          val = 0;\\n        }\\n        put_byte(s, val);\\n      } while (val !== 0);\\n\\n      if (s.gzhead.hcrc && s.pending > beg) {\\n        strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\\n      }\\n      if (val === 0) {\\n        s.gzindex = 0;\\n        s.status = COMMENT_STATE;\\n      }\\n    }\\n    else {\\n      s.status = COMMENT_STATE;\\n    }\\n  }\\n  if (s.status === COMMENT_STATE) {\\n    if (s.gzhead.comment/* != Z_NULL*/) {\\n      beg = s.pending;  /* start of bytes to update crc */\\n      //int val;\\n\\n      do {\\n        if (s.pending === s.pending_buf_size) {\\n          if (s.gzhead.hcrc && s.pending > beg) {\\n            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\\n          }\\n          flush_pending(strm);\\n          beg = s.pending;\\n          if (s.pending === s.pending_buf_size) {\\n            val = 1;\\n            break;\\n          }\\n        }\\n        // JS specific: little magic to add zero terminator to end of string\\n        if (s.gzindex < s.gzhead.comment.length) {\\n          val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\\n        } else {\\n          val = 0;\\n        }\\n        put_byte(s, val);\\n      } while (val !== 0);\\n\\n      if (s.gzhead.hcrc && s.pending > beg) {\\n        strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\\n      }\\n      if (val === 0) {\\n        s.status = HCRC_STATE;\\n      }\\n    }\\n    else {\\n      s.status = HCRC_STATE;\\n    }\\n  }\\n  if (s.status === HCRC_STATE) {\\n    if (s.gzhead.hcrc) {\\n      if (s.pending + 2 > s.pending_buf_size) {\\n        flush_pending(strm);\\n      }\\n      if (s.pending + 2 <= s.pending_buf_size) {\\n        put_byte(s, strm.adler & 0xff);\\n        put_byte(s, (strm.adler >> 8) & 0xff);\\n        strm.adler = 0; //crc32(0L, Z_NULL, 0);\\n        s.status = BUSY_STATE;\\n      }\\n    }\\n    else {\\n      s.status = BUSY_STATE;\\n    }\\n  }\\n//#endif\\n\\n  /* Flush as much pending output as possible */\\n  if (s.pending !== 0) {\\n    flush_pending(strm);\\n    if (strm.avail_out === 0) {\\n      /* Since avail_out is 0, deflate will be called again with\\n       * more output space, but possibly with both pending and\\n       * avail_in equal to zero. There won\\'t be anything to do,\\n       * but this is not an error situation so make sure we\\n       * return OK instead of BUF_ERROR at next call of deflate:\\n       */\\n      s.last_flush = -1;\\n      return Z_OK;\\n    }\\n\\n    /* Make sure there is something to do and avoid duplicate consecutive\\n     * flushes. For repeated and useless calls with Z_FINISH, we keep\\n     * returning Z_STREAM_END instead of Z_BUF_ERROR.\\n     */\\n  } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\\n    flush !== Z_FINISH) {\\n    return err(strm, Z_BUF_ERROR);\\n  }\\n\\n  /* User must not provide more input after the first FINISH: */\\n  if (s.status === FINISH_STATE && strm.avail_in !== 0) {\\n    return err(strm, Z_BUF_ERROR);\\n  }\\n\\n  /* Start a new block or continue the current one.\\n   */\\n  if (strm.avail_in !== 0 || s.lookahead !== 0 ||\\n    (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\\n    var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\\n      (s.strategy === Z_RLE ? deflate_rle(s, flush) :\\n        configuration_table[s.level].func(s, flush));\\n\\n    if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\\n      s.status = FINISH_STATE;\\n    }\\n    if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\\n      if (strm.avail_out === 0) {\\n        s.last_flush = -1;\\n        /* avoid BUF_ERROR next call, see above */\\n      }\\n      return Z_OK;\\n      /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\\n       * of deflate should use the same flush parameter to make sure\\n       * that the flush is complete. So we don\\'t have to output an\\n       * empty block here, this will be done at next call. This also\\n       * ensures that for a very small output buffer, we emit at most\\n       * one empty block.\\n       */\\n    }\\n    if (bstate === BS_BLOCK_DONE) {\\n      if (flush === Z_PARTIAL_FLUSH) {\\n        trees._tr_align(s);\\n      }\\n      else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\\n\\n        trees._tr_stored_block(s, 0, 0, false);\\n        /* For a full flush, this empty block will be recognized\\n         * as a special marker by inflate_sync().\\n         */\\n        if (flush === Z_FULL_FLUSH) {\\n          /*** CLEAR_HASH(s); ***/             /* forget history */\\n          zero(s.head); // Fill with NIL (= 0);\\n\\n          if (s.lookahead === 0) {\\n            s.strstart = 0;\\n            s.block_start = 0;\\n            s.insert = 0;\\n          }\\n        }\\n      }\\n      flush_pending(strm);\\n      if (strm.avail_out === 0) {\\n        s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\\n        return Z_OK;\\n      }\\n    }\\n  }\\n  //Assert(strm->avail_out > 0, \"bug2\");\\n  //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\\n\\n  if (flush !== Z_FINISH) { return Z_OK; }\\n  if (s.wrap <= 0) { return Z_STREAM_END; }\\n\\n  /* Write the trailer */\\n  if (s.wrap === 2) {\\n    put_byte(s, strm.adler & 0xff);\\n    put_byte(s, (strm.adler >> 8) & 0xff);\\n    put_byte(s, (strm.adler >> 16) & 0xff);\\n    put_byte(s, (strm.adler >> 24) & 0xff);\\n    put_byte(s, strm.total_in & 0xff);\\n    put_byte(s, (strm.total_in >> 8) & 0xff);\\n    put_byte(s, (strm.total_in >> 16) & 0xff);\\n    put_byte(s, (strm.total_in >> 24) & 0xff);\\n  }\\n  else\\n  {\\n    putShortMSB(s, strm.adler >>> 16);\\n    putShortMSB(s, strm.adler & 0xffff);\\n  }\\n\\n  flush_pending(strm);\\n  /* If avail_out is zero, the application will call deflate again\\n   * to flush the rest.\\n   */\\n  if (s.wrap > 0) { s.wrap = -s.wrap; }\\n  /* write the trailer only once! */\\n  return s.pending !== 0 ? Z_OK : Z_STREAM_END;\\n}\\n\\nfunction deflateEnd(strm) {\\n  var status;\\n\\n  if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\\n    return Z_STREAM_ERROR;\\n  }\\n\\n  status = strm.state.status;\\n  if (status !== INIT_STATE &&\\n    status !== EXTRA_STATE &&\\n    status !== NAME_STATE &&\\n    status !== COMMENT_STATE &&\\n    status !== HCRC_STATE &&\\n    status !== BUSY_STATE &&\\n    status !== FINISH_STATE\\n  ) {\\n    return err(strm, Z_STREAM_ERROR);\\n  }\\n\\n  strm.state = null;\\n\\n  return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\\n}\\n\\n\\n/* =========================================================================\\n * Initializes the compression dictionary from the given byte\\n * sequence without producing any compressed output.\\n */\\nfunction deflateSetDictionary(strm, dictionary) {\\n  var dictLength = dictionary.length;\\n\\n  var s;\\n  var str, n;\\n  var wrap;\\n  var avail;\\n  var next;\\n  var input;\\n  var tmpDict;\\n\\n  if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\\n    return Z_STREAM_ERROR;\\n  }\\n\\n  s = strm.state;\\n  wrap = s.wrap;\\n\\n  if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\\n    return Z_STREAM_ERROR;\\n  }\\n\\n  /* when using zlib wrappers, compute Adler-32 for provided dictionary */\\n  if (wrap === 1) {\\n    /* adler32(strm->adler, dictionary, dictLength); */\\n    strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\\n  }\\n\\n  s.wrap = 0;   /* avoid computing Adler-32 in read_buf */\\n\\n  /* if dictionary would fill window, just replace the history */\\n  if (dictLength >= s.w_size) {\\n    if (wrap === 0) {            /* already empty otherwise */\\n      /*** CLEAR_HASH(s); ***/\\n      zero(s.head); // Fill with NIL (= 0);\\n      s.strstart = 0;\\n      s.block_start = 0;\\n      s.insert = 0;\\n    }\\n    /* use the tail */\\n    // dictionary = dictionary.slice(dictLength - s.w_size);\\n    tmpDict = new utils.Buf8(s.w_size);\\n    utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\\n    dictionary = tmpDict;\\n    dictLength = s.w_size;\\n  }\\n  /* insert dictionary into window and hash */\\n  avail = strm.avail_in;\\n  next = strm.next_in;\\n  input = strm.input;\\n  strm.avail_in = dictLength;\\n  strm.next_in = 0;\\n  strm.input = dictionary;\\n  fill_window(s);\\n  while (s.lookahead >= MIN_MATCH) {\\n    str = s.strstart;\\n    n = s.lookahead - (MIN_MATCH - 1);\\n    do {\\n      /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\\n      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\\n\\n      s.prev[str & s.w_mask] = s.head[s.ins_h];\\n\\n      s.head[s.ins_h] = str;\\n      str++;\\n    } while (--n);\\n    s.strstart = str;\\n    s.lookahead = MIN_MATCH - 1;\\n    fill_window(s);\\n  }\\n  s.strstart += s.lookahead;\\n  s.block_start = s.strstart;\\n  s.insert = s.lookahead;\\n  s.lookahead = 0;\\n  s.match_length = s.prev_length = MIN_MATCH - 1;\\n  s.match_available = 0;\\n  strm.next_in = next;\\n  strm.input = input;\\n  strm.avail_in = avail;\\n  s.wrap = wrap;\\n  return Z_OK;\\n}\\n\\n\\nexports.deflateInit = deflateInit;\\nexports.deflateInit2 = deflateInit2;\\nexports.deflateReset = deflateReset;\\nexports.deflateResetKeep = deflateResetKeep;\\nexports.deflateSetHeader = deflateSetHeader;\\nexports.deflate = deflate;\\nexports.deflateEnd = deflateEnd;\\nexports.deflateSetDictionary = deflateSetDictionary;\\nexports.deflateInfo = \\'pako deflate (from Nodeca project)\\';\\n\\n/* Not implemented\\nexports.deflateBound = deflateBound;\\nexports.deflateCopy = deflateCopy;\\nexports.deflateParams = deflateParams;\\nexports.deflatePending = deflatePending;\\nexports.deflatePrime = deflatePrime;\\nexports.deflateTune = deflateTune;\\n*/\\n\\n},{\"../utils/common\":32,\"./adler32\":34,\"./crc32\":36,\"./messages\":42,\"./trees\":43}],38:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nfunction GZheader() {\\n  /* true if compressed data believed to be text */\\n  this.text       = 0;\\n  /* modification time */\\n  this.time       = 0;\\n  /* extra flags (not used when writing a gzip file) */\\n  this.xflags     = 0;\\n  /* operating system */\\n  this.os         = 0;\\n  /* pointer to extra field or Z_NULL if none */\\n  this.extra      = null;\\n  /* extra field length (valid if extra != Z_NULL) */\\n  this.extra_len  = 0; // Actually, we don\\'t need it in JS,\\n                       // but leave for few code modifications\\n\\n  //\\n  // Setup limits is not necessary because in js we should not preallocate memory\\n  // for inflate use constant limit in 65536 bytes\\n  //\\n\\n  /* space at extra (only when reading header) */\\n  // this.extra_max  = 0;\\n  /* pointer to zero-terminated file name or Z_NULL */\\n  this.name       = \\'\\';\\n  /* space at name (only when reading header) */\\n  // this.name_max   = 0;\\n  /* pointer to zero-terminated comment or Z_NULL */\\n  this.comment    = \\'\\';\\n  /* space at comment (only when reading header) */\\n  // this.comm_max   = 0;\\n  /* true if there was or will be a header crc */\\n  this.hcrc       = 0;\\n  /* true when done reading gzip header (not used when writing a gzip file) */\\n  this.done       = false;\\n}\\n\\nmodule.exports = GZheader;\\n\\n},{}],39:[function(require,module,exports){\\n\\'use strict\\';\\n\\n// See state defs from inflate.js\\nvar BAD = 30;       /* got a data error -- remain here until reset */\\nvar TYPE = 12;      /* i: waiting for type bits, including last-flag bit */\\n\\n/*\\n   Decode literal, length, and distance codes and write out the resulting\\n   literal and match bytes until either not enough input or output is\\n   available, an end-of-block is encountered, or a data error is encountered.\\n   When large enough input and output buffers are supplied to inflate(), for\\n   example, a 16K input buffer and a 64K output buffer, more than 95% of the\\n   inflate execution time is spent in this routine.\\n\\n   Entry assumptions:\\n\\n        state.mode === LEN\\n        strm.avail_in >= 6\\n        strm.avail_out >= 258\\n        start >= strm.avail_out\\n        state.bits < 8\\n\\n   On return, state.mode is one of:\\n\\n        LEN -- ran out of enough output space or enough available input\\n        TYPE -- reached end of block code, inflate() to interpret next block\\n        BAD -- error in block data\\n\\n   Notes:\\n\\n    - The maximum input bits used by a length/distance pair is 15 bits for the\\n      length code, 5 bits for the length extra, 15 bits for the distance code,\\n      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.\\n      Therefore if strm.avail_in >= 6, then there is enough input to avoid\\n      checking for available input while decoding.\\n\\n    - The maximum bytes that a single length/distance pair can output is 258\\n      bytes, which is the maximum length that can be coded.  inflate_fast()\\n      requires strm.avail_out >= 258 for each loop to avoid checking for\\n      output space.\\n */\\nmodule.exports = function inflate_fast(strm, start) {\\n  var state;\\n  var _in;                    /* local strm.input */\\n  var last;                   /* have enough input while in < last */\\n  var _out;                   /* local strm.output */\\n  var beg;                    /* inflate()\\'s initial strm.output */\\n  var end;                    /* while out < end, enough space available */\\n//#ifdef INFLATE_STRICT\\n  var dmax;                   /* maximum distance from zlib header */\\n//#endif\\n  var wsize;                  /* window size or zero if not using window */\\n  var whave;                  /* valid bytes in the window */\\n  var wnext;                  /* window write index */\\n  // Use `s_window` instead `window`, avoid conflict with instrumentation tools\\n  var s_window;               /* allocated sliding window, if wsize != 0 */\\n  var hold;                   /* local strm.hold */\\n  var bits;                   /* local strm.bits */\\n  var lcode;                  /* local strm.lencode */\\n  var dcode;                  /* local strm.distcode */\\n  var lmask;                  /* mask for first level of length codes */\\n  var dmask;                  /* mask for first level of distance codes */\\n  var here;                   /* retrieved table entry */\\n  var op;                     /* code bits, operation, extra bits, or */\\n                              /*  window position, window bytes to copy */\\n  var len;                    /* match length, unused bytes */\\n  var dist;                   /* match distance */\\n  var from;                   /* where to copy match from */\\n  var from_source;\\n\\n\\n  var input, output; // JS specific, because we have no pointers\\n\\n  /* copy state to local variables */\\n  state = strm.state;\\n  //here = state.here;\\n  _in = strm.next_in;\\n  input = strm.input;\\n  last = _in + (strm.avail_in - 5);\\n  _out = strm.next_out;\\n  output = strm.output;\\n  beg = _out - (start - strm.avail_out);\\n  end = _out + (strm.avail_out - 257);\\n//#ifdef INFLATE_STRICT\\n  dmax = state.dmax;\\n//#endif\\n  wsize = state.wsize;\\n  whave = state.whave;\\n  wnext = state.wnext;\\n  s_window = state.window;\\n  hold = state.hold;\\n  bits = state.bits;\\n  lcode = state.lencode;\\n  dcode = state.distcode;\\n  lmask = (1 << state.lenbits) - 1;\\n  dmask = (1 << state.distbits) - 1;\\n\\n\\n  /* decode literals and length/distances until end-of-block or not enough\\n     input data or output space */\\n\\n  top:\\n  do {\\n    if (bits < 15) {\\n      hold += input[_in++] << bits;\\n      bits += 8;\\n      hold += input[_in++] << bits;\\n      bits += 8;\\n    }\\n\\n    here = lcode[hold & lmask];\\n\\n    dolen:\\n    for (;;) { // Goto emulation\\n      op = here >>> 24/*here.bits*/;\\n      hold >>>= op;\\n      bits -= op;\\n      op = (here >>> 16) & 0xff/*here.op*/;\\n      if (op === 0) {                          /* literal */\\n        //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\\n        //        \"inflate:         literal \\'%c\\'\\\\n\" :\\n        //        \"inflate:         literal 0x%02x\\\\n\", here.val));\\n        output[_out++] = here & 0xffff/*here.val*/;\\n      }\\n      else if (op & 16) {                     /* length base */\\n        len = here & 0xffff/*here.val*/;\\n        op &= 15;                           /* number of extra bits */\\n        if (op) {\\n          if (bits < op) {\\n            hold += input[_in++] << bits;\\n            bits += 8;\\n          }\\n          len += hold & ((1 << op) - 1);\\n          hold >>>= op;\\n          bits -= op;\\n        }\\n        //Tracevv((stderr, \"inflate:         length %u\\\\n\", len));\\n        if (bits < 15) {\\n          hold += input[_in++] << bits;\\n          bits += 8;\\n          hold += input[_in++] << bits;\\n          bits += 8;\\n        }\\n        here = dcode[hold & dmask];\\n\\n        dodist:\\n        for (;;) { // goto emulation\\n          op = here >>> 24/*here.bits*/;\\n          hold >>>= op;\\n          bits -= op;\\n          op = (here >>> 16) & 0xff/*here.op*/;\\n\\n          if (op & 16) {                      /* distance base */\\n            dist = here & 0xffff/*here.val*/;\\n            op &= 15;                       /* number of extra bits */\\n            if (bits < op) {\\n              hold += input[_in++] << bits;\\n              bits += 8;\\n              if (bits < op) {\\n                hold += input[_in++] << bits;\\n                bits += 8;\\n              }\\n            }\\n            dist += hold & ((1 << op) - 1);\\n//#ifdef INFLATE_STRICT\\n            if (dist > dmax) {\\n              strm.msg = \\'invalid distance too far back\\';\\n              state.mode = BAD;\\n              break top;\\n            }\\n//#endif\\n            hold >>>= op;\\n            bits -= op;\\n            //Tracevv((stderr, \"inflate:         distance %u\\\\n\", dist));\\n            op = _out - beg;                /* max distance in output */\\n            if (dist > op) {                /* see if copy from window */\\n              op = dist - op;               /* distance back in window */\\n              if (op > whave) {\\n                if (state.sane) {\\n                  strm.msg = \\'invalid distance too far back\\';\\n                  state.mode = BAD;\\n                  break top;\\n                }\\n\\n// (!) This block is disabled in zlib defailts,\\n// don\\'t enable it for binary compatibility\\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\\n//                if (len <= op - whave) {\\n//                  do {\\n//                    output[_out++] = 0;\\n//                  } while (--len);\\n//                  continue top;\\n//                }\\n//                len -= op - whave;\\n//                do {\\n//                  output[_out++] = 0;\\n//                } while (--op > whave);\\n//                if (op === 0) {\\n//                  from = _out - dist;\\n//                  do {\\n//                    output[_out++] = output[from++];\\n//                  } while (--len);\\n//                  continue top;\\n//                }\\n//#endif\\n              }\\n              from = 0; // window index\\n              from_source = s_window;\\n              if (wnext === 0) {           /* very common case */\\n                from += wsize - op;\\n                if (op < len) {         /* some from window */\\n                  len -= op;\\n                  do {\\n                    output[_out++] = s_window[from++];\\n                  } while (--op);\\n                  from = _out - dist;  /* rest from output */\\n                  from_source = output;\\n                }\\n              }\\n              else if (wnext < op) {      /* wrap around window */\\n                from += wsize + wnext - op;\\n                op -= wnext;\\n                if (op < len) {         /* some from end of window */\\n                  len -= op;\\n                  do {\\n                    output[_out++] = s_window[from++];\\n                  } while (--op);\\n                  from = 0;\\n                  if (wnext < len) {  /* some from start of window */\\n                    op = wnext;\\n                    len -= op;\\n                    do {\\n                      output[_out++] = s_window[from++];\\n                    } while (--op);\\n                    from = _out - dist;      /* rest from output */\\n                    from_source = output;\\n                  }\\n                }\\n              }\\n              else {                      /* contiguous in window */\\n                from += wnext - op;\\n                if (op < len) {         /* some from window */\\n                  len -= op;\\n                  do {\\n                    output[_out++] = s_window[from++];\\n                  } while (--op);\\n                  from = _out - dist;  /* rest from output */\\n                  from_source = output;\\n                }\\n              }\\n              while (len > 2) {\\n                output[_out++] = from_source[from++];\\n                output[_out++] = from_source[from++];\\n                output[_out++] = from_source[from++];\\n                len -= 3;\\n              }\\n              if (len) {\\n                output[_out++] = from_source[from++];\\n                if (len > 1) {\\n                  output[_out++] = from_source[from++];\\n                }\\n              }\\n            }\\n            else {\\n              from = _out - dist;          /* copy direct from output */\\n              do {                        /* minimum length is three */\\n                output[_out++] = output[from++];\\n                output[_out++] = output[from++];\\n                output[_out++] = output[from++];\\n                len -= 3;\\n              } while (len > 2);\\n              if (len) {\\n                output[_out++] = output[from++];\\n                if (len > 1) {\\n                  output[_out++] = output[from++];\\n                }\\n              }\\n            }\\n          }\\n          else if ((op & 64) === 0) {          /* 2nd level distance code */\\n            here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\\n            continue dodist;\\n          }\\n          else {\\n            strm.msg = \\'invalid distance code\\';\\n            state.mode = BAD;\\n            break top;\\n          }\\n\\n          break; // need to emulate goto via \"continue\"\\n        }\\n      }\\n      else if ((op & 64) === 0) {              /* 2nd level length code */\\n        here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\\n        continue dolen;\\n      }\\n      else if (op & 32) {                     /* end-of-block */\\n        //Tracevv((stderr, \"inflate:         end of block\\\\n\"));\\n        state.mode = TYPE;\\n        break top;\\n      }\\n      else {\\n        strm.msg = \\'invalid literal/length code\\';\\n        state.mode = BAD;\\n        break top;\\n      }\\n\\n      break; // need to emulate goto via \"continue\"\\n    }\\n  } while (_in < last && _out < end);\\n\\n  /* return unused bytes (on entry, bits < 8, so in won\\'t go too far back) */\\n  len = bits >> 3;\\n  _in -= len;\\n  bits -= len << 3;\\n  hold &= (1 << bits) - 1;\\n\\n  /* update state and return */\\n  strm.next_in = _in;\\n  strm.next_out = _out;\\n  strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\\n  strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\\n  state.hold = hold;\\n  state.bits = bits;\\n  return;\\n};\\n\\n},{}],40:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nvar utils         = require(\\'../utils/common\\');\\nvar adler32       = require(\\'./adler32\\');\\nvar crc32         = require(\\'./crc32\\');\\nvar inflate_fast  = require(\\'./inffast\\');\\nvar inflate_table = require(\\'./inftrees\\');\\n\\nvar CODES = 0;\\nvar LENS = 1;\\nvar DISTS = 2;\\n\\n/* Public constants ==========================================================*/\\n/* ===========================================================================*/\\n\\n\\n/* Allowed flush values; see deflate() and inflate() below for details */\\n//var Z_NO_FLUSH      = 0;\\n//var Z_PARTIAL_FLUSH = 1;\\n//var Z_SYNC_FLUSH    = 2;\\n//var Z_FULL_FLUSH    = 3;\\nvar Z_FINISH        = 4;\\nvar Z_BLOCK         = 5;\\nvar Z_TREES         = 6;\\n\\n\\n/* Return codes for the compression/decompression functions. Negative values\\n * are errors, positive values are used for special but normal events.\\n */\\nvar Z_OK            = 0;\\nvar Z_STREAM_END    = 1;\\nvar Z_NEED_DICT     = 2;\\n//var Z_ERRNO         = -1;\\nvar Z_STREAM_ERROR  = -2;\\nvar Z_DATA_ERROR    = -3;\\nvar Z_MEM_ERROR     = -4;\\nvar Z_BUF_ERROR     = -5;\\n//var Z_VERSION_ERROR = -6;\\n\\n/* The deflate compression method */\\nvar Z_DEFLATED  = 8;\\n\\n\\n/* STATES ====================================================================*/\\n/* ===========================================================================*/\\n\\n\\nvar    HEAD = 1;       /* i: waiting for magic header */\\nvar    FLAGS = 2;      /* i: waiting for method and flags (gzip) */\\nvar    TIME = 3;       /* i: waiting for modification time (gzip) */\\nvar    OS = 4;         /* i: waiting for extra flags and operating system (gzip) */\\nvar    EXLEN = 5;      /* i: waiting for extra length (gzip) */\\nvar    EXTRA = 6;      /* i: waiting for extra bytes (gzip) */\\nvar    NAME = 7;       /* i: waiting for end of file name (gzip) */\\nvar    COMMENT = 8;    /* i: waiting for end of comment (gzip) */\\nvar    HCRC = 9;       /* i: waiting for header crc (gzip) */\\nvar    DICTID = 10;    /* i: waiting for dictionary check value */\\nvar    DICT = 11;      /* waiting for inflateSetDictionary() call */\\nvar        TYPE = 12;      /* i: waiting for type bits, including last-flag bit */\\nvar        TYPEDO = 13;    /* i: same, but skip check to exit inflate on new block */\\nvar        STORED = 14;    /* i: waiting for stored size (length and complement) */\\nvar        COPY_ = 15;     /* i/o: same as COPY below, but only first time in */\\nvar        COPY = 16;      /* i/o: waiting for input or output to copy stored block */\\nvar        TABLE = 17;     /* i: waiting for dynamic block table lengths */\\nvar        LENLENS = 18;   /* i: waiting for code length code lengths */\\nvar        CODELENS = 19;  /* i: waiting for length/lit and distance code lengths */\\nvar            LEN_ = 20;      /* i: same as LEN below, but only first time in */\\nvar            LEN = 21;       /* i: waiting for length/lit/eob code */\\nvar            LENEXT = 22;    /* i: waiting for length extra bits */\\nvar            DIST = 23;      /* i: waiting for distance code */\\nvar            DISTEXT = 24;   /* i: waiting for distance extra bits */\\nvar            MATCH = 25;     /* o: waiting for output space to copy string */\\nvar            LIT = 26;       /* o: waiting for output space to write literal */\\nvar    CHECK = 27;     /* i: waiting for 32-bit check value */\\nvar    LENGTH = 28;    /* i: waiting for 32-bit length (gzip) */\\nvar    DONE = 29;      /* finished check, done -- remain here until reset */\\nvar    BAD = 30;       /* got a data error -- remain here until reset */\\nvar    MEM = 31;       /* got an inflate() memory error -- remain here until reset */\\nvar    SYNC = 32;      /* looking for synchronization bytes to restart inflate() */\\n\\n/* ===========================================================================*/\\n\\n\\n\\nvar ENOUGH_LENS = 852;\\nvar ENOUGH_DISTS = 592;\\n//var ENOUGH =  (ENOUGH_LENS+ENOUGH_DISTS);\\n\\nvar MAX_WBITS = 15;\\n/* 32K LZ77 window */\\nvar DEF_WBITS = MAX_WBITS;\\n\\n\\nfunction zswap32(q) {\\n  return  (((q >>> 24) & 0xff) +\\n          ((q >>> 8) & 0xff00) +\\n          ((q & 0xff00) << 8) +\\n          ((q & 0xff) << 24));\\n}\\n\\n\\nfunction InflateState() {\\n  this.mode = 0;             /* current inflate mode */\\n  this.last = false;          /* true if processing last block */\\n  this.wrap = 0;              /* bit 0 true for zlib, bit 1 true for gzip */\\n  this.havedict = false;      /* true if dictionary provided */\\n  this.flags = 0;             /* gzip header method and flags (0 if zlib) */\\n  this.dmax = 0;              /* zlib header max distance (INFLATE_STRICT) */\\n  this.check = 0;             /* protected copy of check value */\\n  this.total = 0;             /* protected copy of output count */\\n  // TODO: may be {}\\n  this.head = null;           /* where to save gzip header information */\\n\\n  /* sliding window */\\n  this.wbits = 0;             /* log base 2 of requested window size */\\n  this.wsize = 0;             /* window size or zero if not using window */\\n  this.whave = 0;             /* valid bytes in the window */\\n  this.wnext = 0;             /* window write index */\\n  this.window = null;         /* allocated sliding window, if needed */\\n\\n  /* bit accumulator */\\n  this.hold = 0;              /* input bit accumulator */\\n  this.bits = 0;              /* number of bits in \"in\" */\\n\\n  /* for string and stored block copying */\\n  this.length = 0;            /* literal or length of data to copy */\\n  this.offset = 0;            /* distance back to copy string from */\\n\\n  /* for table and code decoding */\\n  this.extra = 0;             /* extra bits needed */\\n\\n  /* fixed and dynamic code tables */\\n  this.lencode = null;          /* starting table for length/literal codes */\\n  this.distcode = null;         /* starting table for distance codes */\\n  this.lenbits = 0;           /* index bits for lencode */\\n  this.distbits = 0;          /* index bits for distcode */\\n\\n  /* dynamic table building */\\n  this.ncode = 0;             /* number of code length code lengths */\\n  this.nlen = 0;              /* number of length code lengths */\\n  this.ndist = 0;             /* number of distance code lengths */\\n  this.have = 0;              /* number of code lengths in lens[] */\\n  this.next = null;              /* next available space in codes[] */\\n\\n  this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\\n  this.work = new utils.Buf16(288); /* work area for code table building */\\n\\n  /*\\n   because we don\\'t have pointers in js, we use lencode and distcode directly\\n   as buffers so we don\\'t need codes\\n  */\\n  //this.codes = new utils.Buf32(ENOUGH);       /* space for code tables */\\n  this.lendyn = null;              /* dynamic table for length/literal codes (JS specific) */\\n  this.distdyn = null;             /* dynamic table for distance codes (JS specific) */\\n  this.sane = 0;                   /* if false, allow invalid distance too far */\\n  this.back = 0;                   /* bits back of last unprocessed length/lit */\\n  this.was = 0;                    /* initial length of match */\\n}\\n\\nfunction inflateResetKeep(strm) {\\n  var state;\\n\\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\\n  state = strm.state;\\n  strm.total_in = strm.total_out = state.total = 0;\\n  strm.msg = \\'\\'; /*Z_NULL*/\\n  if (state.wrap) {       /* to support ill-conceived Java test suite */\\n    strm.adler = state.wrap & 1;\\n  }\\n  state.mode = HEAD;\\n  state.last = 0;\\n  state.havedict = 0;\\n  state.dmax = 32768;\\n  state.head = null/*Z_NULL*/;\\n  state.hold = 0;\\n  state.bits = 0;\\n  //state.lencode = state.distcode = state.next = state.codes;\\n  state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\\n  state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\\n\\n  state.sane = 1;\\n  state.back = -1;\\n  //Tracev((stderr, \"inflate: reset\\\\n\"));\\n  return Z_OK;\\n}\\n\\nfunction inflateReset(strm) {\\n  var state;\\n\\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\\n  state = strm.state;\\n  state.wsize = 0;\\n  state.whave = 0;\\n  state.wnext = 0;\\n  return inflateResetKeep(strm);\\n\\n}\\n\\nfunction inflateReset2(strm, windowBits) {\\n  var wrap;\\n  var state;\\n\\n  /* get the state */\\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\\n  state = strm.state;\\n\\n  /* extract wrap request from windowBits parameter */\\n  if (windowBits < 0) {\\n    wrap = 0;\\n    windowBits = -windowBits;\\n  }\\n  else {\\n    wrap = (windowBits >> 4) + 1;\\n    if (windowBits < 48) {\\n      windowBits &= 15;\\n    }\\n  }\\n\\n  /* set number of window bits, free window if different */\\n  if (windowBits && (windowBits < 8 || windowBits > 15)) {\\n    return Z_STREAM_ERROR;\\n  }\\n  if (state.window !== null && state.wbits !== windowBits) {\\n    state.window = null;\\n  }\\n\\n  /* update state and reset the rest of it */\\n  state.wrap = wrap;\\n  state.wbits = windowBits;\\n  return inflateReset(strm);\\n}\\n\\nfunction inflateInit2(strm, windowBits) {\\n  var ret;\\n  var state;\\n\\n  if (!strm) { return Z_STREAM_ERROR; }\\n  //strm.msg = Z_NULL;                 /* in case we return an error */\\n\\n  state = new InflateState();\\n\\n  //if (state === Z_NULL) return Z_MEM_ERROR;\\n  //Tracev((stderr, \"inflate: allocated\\\\n\"));\\n  strm.state = state;\\n  state.window = null/*Z_NULL*/;\\n  ret = inflateReset2(strm, windowBits);\\n  if (ret !== Z_OK) {\\n    strm.state = null/*Z_NULL*/;\\n  }\\n  return ret;\\n}\\n\\nfunction inflateInit(strm) {\\n  return inflateInit2(strm, DEF_WBITS);\\n}\\n\\n\\n/*\\n Return state with length and distance decoding tables and index sizes set to\\n fixed code decoding.  Normally this returns fixed tables from inffixed.h.\\n If BUILDFIXED is defined, then instead this routine builds the tables the\\n first time it\\'s called, and returns those tables the first time and\\n thereafter.  This reduces the size of the code by about 2K bytes, in\\n exchange for a little execution time.  However, BUILDFIXED should not be\\n used for threaded applications, since the rewriting of the tables and virgin\\n may not be thread-safe.\\n */\\nvar virgin = true;\\n\\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\\n\\nfunction fixedtables(state) {\\n  /* build fixed huffman tables if first call (may not be thread safe) */\\n  if (virgin) {\\n    var sym;\\n\\n    lenfix = new utils.Buf32(512);\\n    distfix = new utils.Buf32(32);\\n\\n    /* literal/length table */\\n    sym = 0;\\n    while (sym < 144) { state.lens[sym++] = 8; }\\n    while (sym < 256) { state.lens[sym++] = 9; }\\n    while (sym < 280) { state.lens[sym++] = 7; }\\n    while (sym < 288) { state.lens[sym++] = 8; }\\n\\n    inflate_table(LENS,  state.lens, 0, 288, lenfix,   0, state.work, { bits: 9 });\\n\\n    /* distance table */\\n    sym = 0;\\n    while (sym < 32) { state.lens[sym++] = 5; }\\n\\n    inflate_table(DISTS, state.lens, 0, 32,   distfix, 0, state.work, { bits: 5 });\\n\\n    /* do this just once */\\n    virgin = false;\\n  }\\n\\n  state.lencode = lenfix;\\n  state.lenbits = 9;\\n  state.distcode = distfix;\\n  state.distbits = 5;\\n}\\n\\n\\n/*\\n Update the window with the last wsize (normally 32K) bytes written before\\n returning.  If window does not exist yet, create it.  This is only called\\n when a window is already in use, or when output has been written during this\\n inflate call, but the end of the deflate stream has not been reached yet.\\n It is also called to create a window for dictionary data when a dictionary\\n is loaded.\\n\\n Providing output buffers larger than 32K to inflate() should provide a speed\\n advantage, since only the last 32K of output is copied to the sliding window\\n upon return from inflate(), and since all distances after the first 32K of\\n output will fall in the output data, making match copies simpler and faster.\\n The advantage may be dependent on the size of the processor\\'s data caches.\\n */\\nfunction updatewindow(strm, src, end, copy) {\\n  var dist;\\n  var state = strm.state;\\n\\n  /* if it hasn\\'t been done already, allocate space for the window */\\n  if (state.window === null) {\\n    state.wsize = 1 << state.wbits;\\n    state.wnext = 0;\\n    state.whave = 0;\\n\\n    state.window = new utils.Buf8(state.wsize);\\n  }\\n\\n  /* copy state->wsize or less output bytes into the circular window */\\n  if (copy >= state.wsize) {\\n    utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\\n    state.wnext = 0;\\n    state.whave = state.wsize;\\n  }\\n  else {\\n    dist = state.wsize - state.wnext;\\n    if (dist > copy) {\\n      dist = copy;\\n    }\\n    //zmemcpy(state->window + state->wnext, end - copy, dist);\\n    utils.arraySet(state.window, src, end - copy, dist, state.wnext);\\n    copy -= dist;\\n    if (copy) {\\n      //zmemcpy(state->window, end - copy, copy);\\n      utils.arraySet(state.window, src, end - copy, copy, 0);\\n      state.wnext = copy;\\n      state.whave = state.wsize;\\n    }\\n    else {\\n      state.wnext += dist;\\n      if (state.wnext === state.wsize) { state.wnext = 0; }\\n      if (state.whave < state.wsize) { state.whave += dist; }\\n    }\\n  }\\n  return 0;\\n}\\n\\nfunction inflate(strm, flush) {\\n  var state;\\n  var input, output;          // input/output buffers\\n  var next;                   /* next input INDEX */\\n  var put;                    /* next output INDEX */\\n  var have, left;             /* available input and output */\\n  var hold;                   /* bit buffer */\\n  var bits;                   /* bits in bit buffer */\\n  var _in, _out;              /* save starting available input and output */\\n  var copy;                   /* number of stored or match bytes to copy */\\n  var from;                   /* where to copy match bytes from */\\n  var from_source;\\n  var here = 0;               /* current decoding table entry */\\n  var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\\n  //var last;                   /* parent table entry */\\n  var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\\n  var len;                    /* length to copy for repeats, bits to drop */\\n  var ret;                    /* return code */\\n  var hbuf = new utils.Buf8(4);    /* buffer for gzip header crc calculation */\\n  var opts;\\n\\n  var n; // temporary var for NEED_BITS\\n\\n  var order = /* permutation of code lengths */\\n    [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\\n\\n\\n  if (!strm || !strm.state || !strm.output ||\\n      (!strm.input && strm.avail_in !== 0)) {\\n    return Z_STREAM_ERROR;\\n  }\\n\\n  state = strm.state;\\n  if (state.mode === TYPE) { state.mode = TYPEDO; }    /* skip check */\\n\\n\\n  //--- LOAD() ---\\n  put = strm.next_out;\\n  output = strm.output;\\n  left = strm.avail_out;\\n  next = strm.next_in;\\n  input = strm.input;\\n  have = strm.avail_in;\\n  hold = state.hold;\\n  bits = state.bits;\\n  //---\\n\\n  _in = have;\\n  _out = left;\\n  ret = Z_OK;\\n\\n  inf_leave: // goto emulation\\n  for (;;) {\\n    switch (state.mode) {\\n    case HEAD:\\n      if (state.wrap === 0) {\\n        state.mode = TYPEDO;\\n        break;\\n      }\\n      //=== NEEDBITS(16);\\n      while (bits < 16) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      if ((state.wrap & 2) && hold === 0x8b1f) {  /* gzip header */\\n        state.check = 0/*crc32(0L, Z_NULL, 0)*/;\\n        //=== CRC2(state.check, hold);\\n        hbuf[0] = hold & 0xff;\\n        hbuf[1] = (hold >>> 8) & 0xff;\\n        state.check = crc32(state.check, hbuf, 2, 0);\\n        //===//\\n\\n        //=== INITBITS();\\n        hold = 0;\\n        bits = 0;\\n        //===//\\n        state.mode = FLAGS;\\n        break;\\n      }\\n      state.flags = 0;           /* expect zlib header */\\n      if (state.head) {\\n        state.head.done = false;\\n      }\\n      if (!(state.wrap & 1) ||   /* check if zlib header allowed */\\n        (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\\n        strm.msg = \\'incorrect header check\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\\n        strm.msg = \\'unknown compression method\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      //--- DROPBITS(4) ---//\\n      hold >>>= 4;\\n      bits -= 4;\\n      //---//\\n      len = (hold & 0x0f)/*BITS(4)*/ + 8;\\n      if (state.wbits === 0) {\\n        state.wbits = len;\\n      }\\n      else if (len > state.wbits) {\\n        strm.msg = \\'invalid window size\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      state.dmax = 1 << len;\\n      //Tracev((stderr, \"inflate:   zlib header ok\\\\n\"));\\n      strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\\n      state.mode = hold & 0x200 ? DICTID : TYPE;\\n      //=== INITBITS();\\n      hold = 0;\\n      bits = 0;\\n      //===//\\n      break;\\n    case FLAGS:\\n      //=== NEEDBITS(16); */\\n      while (bits < 16) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      state.flags = hold;\\n      if ((state.flags & 0xff) !== Z_DEFLATED) {\\n        strm.msg = \\'unknown compression method\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      if (state.flags & 0xe000) {\\n        strm.msg = \\'unknown header flags set\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      if (state.head) {\\n        state.head.text = ((hold >> 8) & 1);\\n      }\\n      if (state.flags & 0x0200) {\\n        //=== CRC2(state.check, hold);\\n        hbuf[0] = hold & 0xff;\\n        hbuf[1] = (hold >>> 8) & 0xff;\\n        state.check = crc32(state.check, hbuf, 2, 0);\\n        //===//\\n      }\\n      //=== INITBITS();\\n      hold = 0;\\n      bits = 0;\\n      //===//\\n      state.mode = TIME;\\n      /* falls through */\\n    case TIME:\\n      //=== NEEDBITS(32); */\\n      while (bits < 32) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      if (state.head) {\\n        state.head.time = hold;\\n      }\\n      if (state.flags & 0x0200) {\\n        //=== CRC4(state.check, hold)\\n        hbuf[0] = hold & 0xff;\\n        hbuf[1] = (hold >>> 8) & 0xff;\\n        hbuf[2] = (hold >>> 16) & 0xff;\\n        hbuf[3] = (hold >>> 24) & 0xff;\\n        state.check = crc32(state.check, hbuf, 4, 0);\\n        //===\\n      }\\n      //=== INITBITS();\\n      hold = 0;\\n      bits = 0;\\n      //===//\\n      state.mode = OS;\\n      /* falls through */\\n    case OS:\\n      //=== NEEDBITS(16); */\\n      while (bits < 16) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      if (state.head) {\\n        state.head.xflags = (hold & 0xff);\\n        state.head.os = (hold >> 8);\\n      }\\n      if (state.flags & 0x0200) {\\n        //=== CRC2(state.check, hold);\\n        hbuf[0] = hold & 0xff;\\n        hbuf[1] = (hold >>> 8) & 0xff;\\n        state.check = crc32(state.check, hbuf, 2, 0);\\n        //===//\\n      }\\n      //=== INITBITS();\\n      hold = 0;\\n      bits = 0;\\n      //===//\\n      state.mode = EXLEN;\\n      /* falls through */\\n    case EXLEN:\\n      if (state.flags & 0x0400) {\\n        //=== NEEDBITS(16); */\\n        while (bits < 16) {\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n        }\\n        //===//\\n        state.length = hold;\\n        if (state.head) {\\n          state.head.extra_len = hold;\\n        }\\n        if (state.flags & 0x0200) {\\n          //=== CRC2(state.check, hold);\\n          hbuf[0] = hold & 0xff;\\n          hbuf[1] = (hold >>> 8) & 0xff;\\n          state.check = crc32(state.check, hbuf, 2, 0);\\n          //===//\\n        }\\n        //=== INITBITS();\\n        hold = 0;\\n        bits = 0;\\n        //===//\\n      }\\n      else if (state.head) {\\n        state.head.extra = null/*Z_NULL*/;\\n      }\\n      state.mode = EXTRA;\\n      /* falls through */\\n    case EXTRA:\\n      if (state.flags & 0x0400) {\\n        copy = state.length;\\n        if (copy > have) { copy = have; }\\n        if (copy) {\\n          if (state.head) {\\n            len = state.head.extra_len - state.length;\\n            if (!state.head.extra) {\\n              // Use untyped array for more conveniend processing later\\n              state.head.extra = new Array(state.head.extra_len);\\n            }\\n            utils.arraySet(\\n              state.head.extra,\\n              input,\\n              next,\\n              // extra field is limited to 65536 bytes\\n              // - no need for additional size check\\n              copy,\\n              /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\\n              len\\n            );\\n            //zmemcpy(state.head.extra + len, next,\\n            //        len + copy > state.head.extra_max ?\\n            //        state.head.extra_max - len : copy);\\n          }\\n          if (state.flags & 0x0200) {\\n            state.check = crc32(state.check, input, copy, next);\\n          }\\n          have -= copy;\\n          next += copy;\\n          state.length -= copy;\\n        }\\n        if (state.length) { break inf_leave; }\\n      }\\n      state.length = 0;\\n      state.mode = NAME;\\n      /* falls through */\\n    case NAME:\\n      if (state.flags & 0x0800) {\\n        if (have === 0) { break inf_leave; }\\n        copy = 0;\\n        do {\\n          // TODO: 2 or 1 bytes?\\n          len = input[next + copy++];\\n          /* use constant limit because in js we should not preallocate memory */\\n          if (state.head && len &&\\n              (state.length < 65536 /*state.head.name_max*/)) {\\n            state.head.name += String.fromCharCode(len);\\n          }\\n        } while (len && copy < have);\\n\\n        if (state.flags & 0x0200) {\\n          state.check = crc32(state.check, input, copy, next);\\n        }\\n        have -= copy;\\n        next += copy;\\n        if (len) { break inf_leave; }\\n      }\\n      else if (state.head) {\\n        state.head.name = null;\\n      }\\n      state.length = 0;\\n      state.mode = COMMENT;\\n      /* falls through */\\n    case COMMENT:\\n      if (state.flags & 0x1000) {\\n        if (have === 0) { break inf_leave; }\\n        copy = 0;\\n        do {\\n          len = input[next + copy++];\\n          /* use constant limit because in js we should not preallocate memory */\\n          if (state.head && len &&\\n              (state.length < 65536 /*state.head.comm_max*/)) {\\n            state.head.comment += String.fromCharCode(len);\\n          }\\n        } while (len && copy < have);\\n        if (state.flags & 0x0200) {\\n          state.check = crc32(state.check, input, copy, next);\\n        }\\n        have -= copy;\\n        next += copy;\\n        if (len) { break inf_leave; }\\n      }\\n      else if (state.head) {\\n        state.head.comment = null;\\n      }\\n      state.mode = HCRC;\\n      /* falls through */\\n    case HCRC:\\n      if (state.flags & 0x0200) {\\n        //=== NEEDBITS(16); */\\n        while (bits < 16) {\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n        }\\n        //===//\\n        if (hold !== (state.check & 0xffff)) {\\n          strm.msg = \\'header crc mismatch\\';\\n          state.mode = BAD;\\n          break;\\n        }\\n        //=== INITBITS();\\n        hold = 0;\\n        bits = 0;\\n        //===//\\n      }\\n      if (state.head) {\\n        state.head.hcrc = ((state.flags >> 9) & 1);\\n        state.head.done = true;\\n      }\\n      strm.adler = state.check = 0;\\n      state.mode = TYPE;\\n      break;\\n    case DICTID:\\n      //=== NEEDBITS(32); */\\n      while (bits < 32) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      strm.adler = state.check = zswap32(hold);\\n      //=== INITBITS();\\n      hold = 0;\\n      bits = 0;\\n      //===//\\n      state.mode = DICT;\\n      /* falls through */\\n    case DICT:\\n      if (state.havedict === 0) {\\n        //--- RESTORE() ---\\n        strm.next_out = put;\\n        strm.avail_out = left;\\n        strm.next_in = next;\\n        strm.avail_in = have;\\n        state.hold = hold;\\n        state.bits = bits;\\n        //---\\n        return Z_NEED_DICT;\\n      }\\n      strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\\n      state.mode = TYPE;\\n      /* falls through */\\n    case TYPE:\\n      if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\\n      /* falls through */\\n    case TYPEDO:\\n      if (state.last) {\\n        //--- BYTEBITS() ---//\\n        hold >>>= bits & 7;\\n        bits -= bits & 7;\\n        //---//\\n        state.mode = CHECK;\\n        break;\\n      }\\n      //=== NEEDBITS(3); */\\n      while (bits < 3) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      state.last = (hold & 0x01)/*BITS(1)*/;\\n      //--- DROPBITS(1) ---//\\n      hold >>>= 1;\\n      bits -= 1;\\n      //---//\\n\\n      switch ((hold & 0x03)/*BITS(2)*/) {\\n      case 0:                             /* stored block */\\n        //Tracev((stderr, \"inflate:     stored block%s\\\\n\",\\n        //        state.last ? \" (last)\" : \"\"));\\n        state.mode = STORED;\\n        break;\\n      case 1:                             /* fixed block */\\n        fixedtables(state);\\n        //Tracev((stderr, \"inflate:     fixed codes block%s\\\\n\",\\n        //        state.last ? \" (last)\" : \"\"));\\n        state.mode = LEN_;             /* decode codes */\\n        if (flush === Z_TREES) {\\n          //--- DROPBITS(2) ---//\\n          hold >>>= 2;\\n          bits -= 2;\\n          //---//\\n          break inf_leave;\\n        }\\n        break;\\n      case 2:                             /* dynamic block */\\n        //Tracev((stderr, \"inflate:     dynamic codes block%s\\\\n\",\\n        //        state.last ? \" (last)\" : \"\"));\\n        state.mode = TABLE;\\n        break;\\n      case 3:\\n        strm.msg = \\'invalid block type\\';\\n        state.mode = BAD;\\n      }\\n      //--- DROPBITS(2) ---//\\n      hold >>>= 2;\\n      bits -= 2;\\n      //---//\\n      break;\\n    case STORED:\\n      //--- BYTEBITS() ---// /* go to byte boundary */\\n      hold >>>= bits & 7;\\n      bits -= bits & 7;\\n      //---//\\n      //=== NEEDBITS(32); */\\n      while (bits < 32) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\\n        strm.msg = \\'invalid stored block lengths\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      state.length = hold & 0xffff;\\n      //Tracev((stderr, \"inflate:       stored length %u\\\\n\",\\n      //        state.length));\\n      //=== INITBITS();\\n      hold = 0;\\n      bits = 0;\\n      //===//\\n      state.mode = COPY_;\\n      if (flush === Z_TREES) { break inf_leave; }\\n      /* falls through */\\n    case COPY_:\\n      state.mode = COPY;\\n      /* falls through */\\n    case COPY:\\n      copy = state.length;\\n      if (copy) {\\n        if (copy > have) { copy = have; }\\n        if (copy > left) { copy = left; }\\n        if (copy === 0) { break inf_leave; }\\n        //--- zmemcpy(put, next, copy); ---\\n        utils.arraySet(output, input, next, copy, put);\\n        //---//\\n        have -= copy;\\n        next += copy;\\n        left -= copy;\\n        put += copy;\\n        state.length -= copy;\\n        break;\\n      }\\n      //Tracev((stderr, \"inflate:       stored end\\\\n\"));\\n      state.mode = TYPE;\\n      break;\\n    case TABLE:\\n      //=== NEEDBITS(14); */\\n      while (bits < 14) {\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n      }\\n      //===//\\n      state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\\n      //--- DROPBITS(5) ---//\\n      hold >>>= 5;\\n      bits -= 5;\\n      //---//\\n      state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\\n      //--- DROPBITS(5) ---//\\n      hold >>>= 5;\\n      bits -= 5;\\n      //---//\\n      state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\\n      //--- DROPBITS(4) ---//\\n      hold >>>= 4;\\n      bits -= 4;\\n      //---//\\n//#ifndef PKZIP_BUG_WORKAROUND\\n      if (state.nlen > 286 || state.ndist > 30) {\\n        strm.msg = \\'too many length or distance symbols\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n//#endif\\n      //Tracev((stderr, \"inflate:       table sizes ok\\\\n\"));\\n      state.have = 0;\\n      state.mode = LENLENS;\\n      /* falls through */\\n    case LENLENS:\\n      while (state.have < state.ncode) {\\n        //=== NEEDBITS(3);\\n        while (bits < 3) {\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n        }\\n        //===//\\n        state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\\n        //--- DROPBITS(3) ---//\\n        hold >>>= 3;\\n        bits -= 3;\\n        //---//\\n      }\\n      while (state.have < 19) {\\n        state.lens[order[state.have++]] = 0;\\n      }\\n      // We have separate tables & no pointers. 2 commented lines below not needed.\\n      //state.next = state.codes;\\n      //state.lencode = state.next;\\n      // Switch to use dynamic table\\n      state.lencode = state.lendyn;\\n      state.lenbits = 7;\\n\\n      opts = { bits: state.lenbits };\\n      ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\\n      state.lenbits = opts.bits;\\n\\n      if (ret) {\\n        strm.msg = \\'invalid code lengths set\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      //Tracev((stderr, \"inflate:       code lengths ok\\\\n\"));\\n      state.have = 0;\\n      state.mode = CODELENS;\\n      /* falls through */\\n    case CODELENS:\\n      while (state.have < state.nlen + state.ndist) {\\n        for (;;) {\\n          here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\\n          here_bits = here >>> 24;\\n          here_op = (here >>> 16) & 0xff;\\n          here_val = here & 0xffff;\\n\\n          if ((here_bits) <= bits) { break; }\\n          //--- PULLBYTE() ---//\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n          //---//\\n        }\\n        if (here_val < 16) {\\n          //--- DROPBITS(here.bits) ---//\\n          hold >>>= here_bits;\\n          bits -= here_bits;\\n          //---//\\n          state.lens[state.have++] = here_val;\\n        }\\n        else {\\n          if (here_val === 16) {\\n            //=== NEEDBITS(here.bits + 2);\\n            n = here_bits + 2;\\n            while (bits < n) {\\n              if (have === 0) { break inf_leave; }\\n              have--;\\n              hold += input[next++] << bits;\\n              bits += 8;\\n            }\\n            //===//\\n            //--- DROPBITS(here.bits) ---//\\n            hold >>>= here_bits;\\n            bits -= here_bits;\\n            //---//\\n            if (state.have === 0) {\\n              strm.msg = \\'invalid bit length repeat\\';\\n              state.mode = BAD;\\n              break;\\n            }\\n            len = state.lens[state.have - 1];\\n            copy = 3 + (hold & 0x03);//BITS(2);\\n            //--- DROPBITS(2) ---//\\n            hold >>>= 2;\\n            bits -= 2;\\n            //---//\\n          }\\n          else if (here_val === 17) {\\n            //=== NEEDBITS(here.bits + 3);\\n            n = here_bits + 3;\\n            while (bits < n) {\\n              if (have === 0) { break inf_leave; }\\n              have--;\\n              hold += input[next++] << bits;\\n              bits += 8;\\n            }\\n            //===//\\n            //--- DROPBITS(here.bits) ---//\\n            hold >>>= here_bits;\\n            bits -= here_bits;\\n            //---//\\n            len = 0;\\n            copy = 3 + (hold & 0x07);//BITS(3);\\n            //--- DROPBITS(3) ---//\\n            hold >>>= 3;\\n            bits -= 3;\\n            //---//\\n          }\\n          else {\\n            //=== NEEDBITS(here.bits + 7);\\n            n = here_bits + 7;\\n            while (bits < n) {\\n              if (have === 0) { break inf_leave; }\\n              have--;\\n              hold += input[next++] << bits;\\n              bits += 8;\\n            }\\n            //===//\\n            //--- DROPBITS(here.bits) ---//\\n            hold >>>= here_bits;\\n            bits -= here_bits;\\n            //---//\\n            len = 0;\\n            copy = 11 + (hold & 0x7f);//BITS(7);\\n            //--- DROPBITS(7) ---//\\n            hold >>>= 7;\\n            bits -= 7;\\n            //---//\\n          }\\n          if (state.have + copy > state.nlen + state.ndist) {\\n            strm.msg = \\'invalid bit length repeat\\';\\n            state.mode = BAD;\\n            break;\\n          }\\n          while (copy--) {\\n            state.lens[state.have++] = len;\\n          }\\n        }\\n      }\\n\\n      /* handle error breaks in while */\\n      if (state.mode === BAD) { break; }\\n\\n      /* check for end-of-block code (better have one) */\\n      if (state.lens[256] === 0) {\\n        strm.msg = \\'invalid code -- missing end-of-block\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n\\n      /* build code tables -- note: do not change the lenbits or distbits\\n         values here (9 and 6) without reading the comments in inftrees.h\\n         concerning the ENOUGH constants, which depend on those values */\\n      state.lenbits = 9;\\n\\n      opts = { bits: state.lenbits };\\n      ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\\n      // We have separate tables & no pointers. 2 commented lines below not needed.\\n      // state.next_index = opts.table_index;\\n      state.lenbits = opts.bits;\\n      // state.lencode = state.next;\\n\\n      if (ret) {\\n        strm.msg = \\'invalid literal/lengths set\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n\\n      state.distbits = 6;\\n      //state.distcode.copy(state.codes);\\n      // Switch to use dynamic table\\n      state.distcode = state.distdyn;\\n      opts = { bits: state.distbits };\\n      ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\\n      // We have separate tables & no pointers. 2 commented lines below not needed.\\n      // state.next_index = opts.table_index;\\n      state.distbits = opts.bits;\\n      // state.distcode = state.next;\\n\\n      if (ret) {\\n        strm.msg = \\'invalid distances set\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      //Tracev((stderr, \\'inflate:       codes ok\\\\n\\'));\\n      state.mode = LEN_;\\n      if (flush === Z_TREES) { break inf_leave; }\\n      /* falls through */\\n    case LEN_:\\n      state.mode = LEN;\\n      /* falls through */\\n    case LEN:\\n      if (have >= 6 && left >= 258) {\\n        //--- RESTORE() ---\\n        strm.next_out = put;\\n        strm.avail_out = left;\\n        strm.next_in = next;\\n        strm.avail_in = have;\\n        state.hold = hold;\\n        state.bits = bits;\\n        //---\\n        inflate_fast(strm, _out);\\n        //--- LOAD() ---\\n        put = strm.next_out;\\n        output = strm.output;\\n        left = strm.avail_out;\\n        next = strm.next_in;\\n        input = strm.input;\\n        have = strm.avail_in;\\n        hold = state.hold;\\n        bits = state.bits;\\n        //---\\n\\n        if (state.mode === TYPE) {\\n          state.back = -1;\\n        }\\n        break;\\n      }\\n      state.back = 0;\\n      for (;;) {\\n        here = state.lencode[hold & ((1 << state.lenbits) - 1)];  /*BITS(state.lenbits)*/\\n        here_bits = here >>> 24;\\n        here_op = (here >>> 16) & 0xff;\\n        here_val = here & 0xffff;\\n\\n        if (here_bits <= bits) { break; }\\n        //--- PULLBYTE() ---//\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n        //---//\\n      }\\n      if (here_op && (here_op & 0xf0) === 0) {\\n        last_bits = here_bits;\\n        last_op = here_op;\\n        last_val = here_val;\\n        for (;;) {\\n          here = state.lencode[last_val +\\n                  ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\\n          here_bits = here >>> 24;\\n          here_op = (here >>> 16) & 0xff;\\n          here_val = here & 0xffff;\\n\\n          if ((last_bits + here_bits) <= bits) { break; }\\n          //--- PULLBYTE() ---//\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n          //---//\\n        }\\n        //--- DROPBITS(last.bits) ---//\\n        hold >>>= last_bits;\\n        bits -= last_bits;\\n        //---//\\n        state.back += last_bits;\\n      }\\n      //--- DROPBITS(here.bits) ---//\\n      hold >>>= here_bits;\\n      bits -= here_bits;\\n      //---//\\n      state.back += here_bits;\\n      state.length = here_val;\\n      if (here_op === 0) {\\n        //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\\n        //        \"inflate:         literal \\'%c\\'\\\\n\" :\\n        //        \"inflate:         literal 0x%02x\\\\n\", here.val));\\n        state.mode = LIT;\\n        break;\\n      }\\n      if (here_op & 32) {\\n        //Tracevv((stderr, \"inflate:         end of block\\\\n\"));\\n        state.back = -1;\\n        state.mode = TYPE;\\n        break;\\n      }\\n      if (here_op & 64) {\\n        strm.msg = \\'invalid literal/length code\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      state.extra = here_op & 15;\\n      state.mode = LENEXT;\\n      /* falls through */\\n    case LENEXT:\\n      if (state.extra) {\\n        //=== NEEDBITS(state.extra);\\n        n = state.extra;\\n        while (bits < n) {\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n        }\\n        //===//\\n        state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\\n        //--- DROPBITS(state.extra) ---//\\n        hold >>>= state.extra;\\n        bits -= state.extra;\\n        //---//\\n        state.back += state.extra;\\n      }\\n      //Tracevv((stderr, \"inflate:         length %u\\\\n\", state.length));\\n      state.was = state.length;\\n      state.mode = DIST;\\n      /* falls through */\\n    case DIST:\\n      for (;;) {\\n        here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\\n        here_bits = here >>> 24;\\n        here_op = (here >>> 16) & 0xff;\\n        here_val = here & 0xffff;\\n\\n        if ((here_bits) <= bits) { break; }\\n        //--- PULLBYTE() ---//\\n        if (have === 0) { break inf_leave; }\\n        have--;\\n        hold += input[next++] << bits;\\n        bits += 8;\\n        //---//\\n      }\\n      if ((here_op & 0xf0) === 0) {\\n        last_bits = here_bits;\\n        last_op = here_op;\\n        last_val = here_val;\\n        for (;;) {\\n          here = state.distcode[last_val +\\n                  ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\\n          here_bits = here >>> 24;\\n          here_op = (here >>> 16) & 0xff;\\n          here_val = here & 0xffff;\\n\\n          if ((last_bits + here_bits) <= bits) { break; }\\n          //--- PULLBYTE() ---//\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n          //---//\\n        }\\n        //--- DROPBITS(last.bits) ---//\\n        hold >>>= last_bits;\\n        bits -= last_bits;\\n        //---//\\n        state.back += last_bits;\\n      }\\n      //--- DROPBITS(here.bits) ---//\\n      hold >>>= here_bits;\\n      bits -= here_bits;\\n      //---//\\n      state.back += here_bits;\\n      if (here_op & 64) {\\n        strm.msg = \\'invalid distance code\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n      state.offset = here_val;\\n      state.extra = (here_op) & 15;\\n      state.mode = DISTEXT;\\n      /* falls through */\\n    case DISTEXT:\\n      if (state.extra) {\\n        //=== NEEDBITS(state.extra);\\n        n = state.extra;\\n        while (bits < n) {\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n        }\\n        //===//\\n        state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\\n        //--- DROPBITS(state.extra) ---//\\n        hold >>>= state.extra;\\n        bits -= state.extra;\\n        //---//\\n        state.back += state.extra;\\n      }\\n//#ifdef INFLATE_STRICT\\n      if (state.offset > state.dmax) {\\n        strm.msg = \\'invalid distance too far back\\';\\n        state.mode = BAD;\\n        break;\\n      }\\n//#endif\\n      //Tracevv((stderr, \"inflate:         distance %u\\\\n\", state.offset));\\n      state.mode = MATCH;\\n      /* falls through */\\n    case MATCH:\\n      if (left === 0) { break inf_leave; }\\n      copy = _out - left;\\n      if (state.offset > copy) {         /* copy from window */\\n        copy = state.offset - copy;\\n        if (copy > state.whave) {\\n          if (state.sane) {\\n            strm.msg = \\'invalid distance too far back\\';\\n            state.mode = BAD;\\n            break;\\n          }\\n// (!) This block is disabled in zlib defailts,\\n// don\\'t enable it for binary compatibility\\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\\n//          Trace((stderr, \"inflate.c too far\\\\n\"));\\n//          copy -= state.whave;\\n//          if (copy > state.length) { copy = state.length; }\\n//          if (copy > left) { copy = left; }\\n//          left -= copy;\\n//          state.length -= copy;\\n//          do {\\n//            output[put++] = 0;\\n//          } while (--copy);\\n//          if (state.length === 0) { state.mode = LEN; }\\n//          break;\\n//#endif\\n        }\\n        if (copy > state.wnext) {\\n          copy -= state.wnext;\\n          from = state.wsize - copy;\\n        }\\n        else {\\n          from = state.wnext - copy;\\n        }\\n        if (copy > state.length) { copy = state.length; }\\n        from_source = state.window;\\n      }\\n      else {                              /* copy from output */\\n        from_source = output;\\n        from = put - state.offset;\\n        copy = state.length;\\n      }\\n      if (copy > left) { copy = left; }\\n      left -= copy;\\n      state.length -= copy;\\n      do {\\n        output[put++] = from_source[from++];\\n      } while (--copy);\\n      if (state.length === 0) { state.mode = LEN; }\\n      break;\\n    case LIT:\\n      if (left === 0) { break inf_leave; }\\n      output[put++] = state.length;\\n      left--;\\n      state.mode = LEN;\\n      break;\\n    case CHECK:\\n      if (state.wrap) {\\n        //=== NEEDBITS(32);\\n        while (bits < 32) {\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          // Use \\'|\\' insdead of \\'+\\' to make sure that result is signed\\n          hold |= input[next++] << bits;\\n          bits += 8;\\n        }\\n        //===//\\n        _out -= left;\\n        strm.total_out += _out;\\n        state.total += _out;\\n        if (_out) {\\n          strm.adler = state.check =\\n              /*UPDATE(state.check, put - _out, _out);*/\\n              (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\\n\\n        }\\n        _out = left;\\n        // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\\n        if ((state.flags ? hold : zswap32(hold)) !== state.check) {\\n          strm.msg = \\'incorrect data check\\';\\n          state.mode = BAD;\\n          break;\\n        }\\n        //=== INITBITS();\\n        hold = 0;\\n        bits = 0;\\n        //===//\\n        //Tracev((stderr, \"inflate:   check matches trailer\\\\n\"));\\n      }\\n      state.mode = LENGTH;\\n      /* falls through */\\n    case LENGTH:\\n      if (state.wrap && state.flags) {\\n        //=== NEEDBITS(32);\\n        while (bits < 32) {\\n          if (have === 0) { break inf_leave; }\\n          have--;\\n          hold += input[next++] << bits;\\n          bits += 8;\\n        }\\n        //===//\\n        if (hold !== (state.total & 0xffffffff)) {\\n          strm.msg = \\'incorrect length check\\';\\n          state.mode = BAD;\\n          break;\\n        }\\n        //=== INITBITS();\\n        hold = 0;\\n        bits = 0;\\n        //===//\\n        //Tracev((stderr, \"inflate:   length matches trailer\\\\n\"));\\n      }\\n      state.mode = DONE;\\n      /* falls through */\\n    case DONE:\\n      ret = Z_STREAM_END;\\n      break inf_leave;\\n    case BAD:\\n      ret = Z_DATA_ERROR;\\n      break inf_leave;\\n    case MEM:\\n      return Z_MEM_ERROR;\\n    case SYNC:\\n      /* falls through */\\n    default:\\n      return Z_STREAM_ERROR;\\n    }\\n  }\\n\\n  // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\\n\\n  /*\\n     Return from inflate(), updating the total counts and the check value.\\n     If there was no progress during the inflate() call, return a buffer\\n     error.  Call updatewindow() to create and/or update the window state.\\n     Note: a memory error from inflate() is non-recoverable.\\n   */\\n\\n  //--- RESTORE() ---\\n  strm.next_out = put;\\n  strm.avail_out = left;\\n  strm.next_in = next;\\n  strm.avail_in = have;\\n  state.hold = hold;\\n  state.bits = bits;\\n  //---\\n\\n  if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\\n                      (state.mode < CHECK || flush !== Z_FINISH))) {\\n    if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\\n      state.mode = MEM;\\n      return Z_MEM_ERROR;\\n    }\\n  }\\n  _in -= strm.avail_in;\\n  _out -= strm.avail_out;\\n  strm.total_in += _in;\\n  strm.total_out += _out;\\n  state.total += _out;\\n  if (state.wrap && _out) {\\n    strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\\n      (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\\n  }\\n  strm.data_type = state.bits + (state.last ? 64 : 0) +\\n                    (state.mode === TYPE ? 128 : 0) +\\n                    (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\\n  if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\\n    ret = Z_BUF_ERROR;\\n  }\\n  return ret;\\n}\\n\\nfunction inflateEnd(strm) {\\n\\n  if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\\n    return Z_STREAM_ERROR;\\n  }\\n\\n  var state = strm.state;\\n  if (state.window) {\\n    state.window = null;\\n  }\\n  strm.state = null;\\n  return Z_OK;\\n}\\n\\nfunction inflateGetHeader(strm, head) {\\n  var state;\\n\\n  /* check state */\\n  if (!strm || !strm.state) { return Z_STREAM_ERROR; }\\n  state = strm.state;\\n  if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\\n\\n  /* save header structure */\\n  state.head = head;\\n  head.done = false;\\n  return Z_OK;\\n}\\n\\nfunction inflateSetDictionary(strm, dictionary) {\\n  var dictLength = dictionary.length;\\n\\n  var state;\\n  var dictid;\\n  var ret;\\n\\n  /* check state */\\n  if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\\n  state = strm.state;\\n\\n  if (state.wrap !== 0 && state.mode !== DICT) {\\n    return Z_STREAM_ERROR;\\n  }\\n\\n  /* check for correct dictionary identifier */\\n  if (state.mode === DICT) {\\n    dictid = 1; /* adler32(0, null, 0)*/\\n    /* dictid = adler32(dictid, dictionary, dictLength); */\\n    dictid = adler32(dictid, dictionary, dictLength, 0);\\n    if (dictid !== state.check) {\\n      return Z_DATA_ERROR;\\n    }\\n  }\\n  /* copy dictionary to window using updatewindow(), which will amend the\\n   existing dictionary if appropriate */\\n  ret = updatewindow(strm, dictionary, dictLength, dictLength);\\n  if (ret) {\\n    state.mode = MEM;\\n    return Z_MEM_ERROR;\\n  }\\n  state.havedict = 1;\\n  // Tracev((stderr, \"inflate:   dictionary set\\\\n\"));\\n  return Z_OK;\\n}\\n\\nexports.inflateReset = inflateReset;\\nexports.inflateReset2 = inflateReset2;\\nexports.inflateResetKeep = inflateResetKeep;\\nexports.inflateInit = inflateInit;\\nexports.inflateInit2 = inflateInit2;\\nexports.inflate = inflate;\\nexports.inflateEnd = inflateEnd;\\nexports.inflateGetHeader = inflateGetHeader;\\nexports.inflateSetDictionary = inflateSetDictionary;\\nexports.inflateInfo = \\'pako inflate (from Nodeca project)\\';\\n\\n/* Not implemented\\nexports.inflateCopy = inflateCopy;\\nexports.inflateGetDictionary = inflateGetDictionary;\\nexports.inflateMark = inflateMark;\\nexports.inflatePrime = inflatePrime;\\nexports.inflateSync = inflateSync;\\nexports.inflateSyncPoint = inflateSyncPoint;\\nexports.inflateUndermine = inflateUndermine;\\n*/\\n\\n},{\"../utils/common\":32,\"./adler32\":34,\"./crc32\":36,\"./inffast\":39,\"./inftrees\":41}],41:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nvar utils = require(\\'../utils/common\\');\\n\\nvar MAXBITS = 15;\\nvar ENOUGH_LENS = 852;\\nvar ENOUGH_DISTS = 592;\\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\\n\\nvar CODES = 0;\\nvar LENS = 1;\\nvar DISTS = 2;\\n\\nvar lbase = [ /* Length codes 257..285 base */\\n  3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\\n  35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\\n];\\n\\nvar lext = [ /* Length codes 257..285 extra */\\n  16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\\n  19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\\n];\\n\\nvar dbase = [ /* Distance codes 0..29 base */\\n  1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\\n  257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\\n  8193, 12289, 16385, 24577, 0, 0\\n];\\n\\nvar dext = [ /* Distance codes 0..29 extra */\\n  16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\\n  23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\\n  28, 28, 29, 29, 64, 64\\n];\\n\\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\\n{\\n  var bits = opts.bits;\\n      //here = opts.here; /* table entry for duplication */\\n\\n  var len = 0;               /* a code\\'s length in bits */\\n  var sym = 0;               /* index of code symbols */\\n  var min = 0, max = 0;          /* minimum and maximum code lengths */\\n  var root = 0;              /* number of index bits for root table */\\n  var curr = 0;              /* number of index bits for current table */\\n  var drop = 0;              /* code bits to drop for sub-table */\\n  var left = 0;                   /* number of prefix codes available */\\n  var used = 0;              /* code entries in table used */\\n  var huff = 0;              /* Huffman code */\\n  var incr;              /* for incrementing code, index */\\n  var fill;              /* index for replicating entries */\\n  var low;               /* low bits for current root entry */\\n  var mask;              /* mask for low root bits */\\n  var next;             /* next available space in table */\\n  var base = null;     /* base value table to use */\\n  var base_index = 0;\\n//  var shoextra;    /* extra bits table to use */\\n  var end;                    /* use base and extra for symbol > end */\\n  var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];    /* number of codes of each length */\\n  var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];     /* offsets in table for each length */\\n  var extra = null;\\n  var extra_index = 0;\\n\\n  var here_bits, here_op, here_val;\\n\\n  /*\\n   Process a set of code lengths to create a canonical Huffman code.  The\\n   code lengths are lens[0..codes-1].  Each length corresponds to the\\n   symbols 0..codes-1.  The Huffman code is generated by first sorting the\\n   symbols by length from short to long, and retaining the symbol order\\n   for codes with equal lengths.  Then the code starts with all zero bits\\n   for the first code of the shortest length, and the codes are integer\\n   increments for the same length, and zeros are appended as the length\\n   increases.  For the deflate format, these bits are stored backwards\\n   from their more natural integer increment ordering, and so when the\\n   decoding tables are built in the large loop below, the integer codes\\n   are incremented backwards.\\n\\n   This routine assumes, but does not check, that all of the entries in\\n   lens[] are in the range 0..MAXBITS.  The caller must assure this.\\n   1..MAXBITS is interpreted as that code length.  zero means that that\\n   symbol does not occur in this code.\\n\\n   The codes are sorted by computing a count of codes for each length,\\n   creating from that a table of starting indices for each length in the\\n   sorted table, and then entering the symbols in order in the sorted\\n   table.  The sorted table is work[], with that space being provided by\\n   the caller.\\n\\n   The length counts are used for other purposes as well, i.e. finding\\n   the minimum and maximum length codes, determining if there are any\\n   codes at all, checking for a valid set of lengths, and looking ahead\\n   at length counts to determine sub-table sizes when building the\\n   decoding tables.\\n   */\\n\\n  /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\\n  for (len = 0; len <= MAXBITS; len++) {\\n    count[len] = 0;\\n  }\\n  for (sym = 0; sym < codes; sym++) {\\n    count[lens[lens_index + sym]]++;\\n  }\\n\\n  /* bound code lengths, force root to be within code lengths */\\n  root = bits;\\n  for (max = MAXBITS; max >= 1; max--) {\\n    if (count[max] !== 0) { break; }\\n  }\\n  if (root > max) {\\n    root = max;\\n  }\\n  if (max === 0) {                     /* no symbols to code at all */\\n    //table.op[opts.table_index] = 64;  //here.op = (var char)64;    /* invalid code marker */\\n    //table.bits[opts.table_index] = 1;   //here.bits = (var char)1;\\n    //table.val[opts.table_index++] = 0;   //here.val = (var short)0;\\n    table[table_index++] = (1 << 24) | (64 << 16) | 0;\\n\\n\\n    //table.op[opts.table_index] = 64;\\n    //table.bits[opts.table_index] = 1;\\n    //table.val[opts.table_index++] = 0;\\n    table[table_index++] = (1 << 24) | (64 << 16) | 0;\\n\\n    opts.bits = 1;\\n    return 0;     /* no symbols, but wait for decoding to report error */\\n  }\\n  for (min = 1; min < max; min++) {\\n    if (count[min] !== 0) { break; }\\n  }\\n  if (root < min) {\\n    root = min;\\n  }\\n\\n  /* check for an over-subscribed or incomplete set of lengths */\\n  left = 1;\\n  for (len = 1; len <= MAXBITS; len++) {\\n    left <<= 1;\\n    left -= count[len];\\n    if (left < 0) {\\n      return -1;\\n    }        /* over-subscribed */\\n  }\\n  if (left > 0 && (type === CODES || max !== 1)) {\\n    return -1;                      /* incomplete set */\\n  }\\n\\n  /* generate offsets into symbol table for each length for sorting */\\n  offs[1] = 0;\\n  for (len = 1; len < MAXBITS; len++) {\\n    offs[len + 1] = offs[len] + count[len];\\n  }\\n\\n  /* sort symbols by length, by symbol order within each length */\\n  for (sym = 0; sym < codes; sym++) {\\n    if (lens[lens_index + sym] !== 0) {\\n      work[offs[lens[lens_index + sym]]++] = sym;\\n    }\\n  }\\n\\n  /*\\n   Create and fill in decoding tables.  In this loop, the table being\\n   filled is at next and has curr index bits.  The code being used is huff\\n   with length len.  That code is converted to an index by dropping drop\\n   bits off of the bottom.  For codes where len is less than drop + curr,\\n   those top drop + curr - len bits are incremented through all values to\\n   fill the table with replicated entries.\\n\\n   root is the number of index bits for the root table.  When len exceeds\\n   root, sub-tables are created pointed to by the root entry with an index\\n   of the low root bits of huff.  This is saved in low to check for when a\\n   new sub-table should be started.  drop is zero when the root table is\\n   being filled, and drop is root when sub-tables are being filled.\\n\\n   When a new sub-table is needed, it is necessary to look ahead in the\\n   code lengths to determine what size sub-table is needed.  The length\\n   counts are used for this, and so count[] is decremented as codes are\\n   entered in the tables.\\n\\n   used keeps track of how many table entries have been allocated from the\\n   provided *table space.  It is checked for LENS and DIST tables against\\n   the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\\n   the initial root table size constants.  See the comments in inftrees.h\\n   for more information.\\n\\n   sym increments through all symbols, and the loop terminates when\\n   all codes of length max, i.e. all codes, have been processed.  This\\n   routine permits incomplete codes, so another loop after this one fills\\n   in the rest of the decoding tables with invalid code markers.\\n   */\\n\\n  /* set up for code type */\\n  // poor man optimization - use if-else instead of switch,\\n  // to avoid deopts in old v8\\n  if (type === CODES) {\\n    base = extra = work;    /* dummy value--not used */\\n    end = 19;\\n\\n  } else if (type === LENS) {\\n    base = lbase;\\n    base_index -= 257;\\n    extra = lext;\\n    extra_index -= 257;\\n    end = 256;\\n\\n  } else {                    /* DISTS */\\n    base = dbase;\\n    extra = dext;\\n    end = -1;\\n  }\\n\\n  /* initialize opts for loop */\\n  huff = 0;                   /* starting code */\\n  sym = 0;                    /* starting code symbol */\\n  len = min;                  /* starting code length */\\n  next = table_index;              /* current table to fill in */\\n  curr = root;                /* current table index bits */\\n  drop = 0;                   /* current bits to drop from code for index */\\n  low = -1;                   /* trigger new sub-table when len > root */\\n  used = 1 << root;          /* use root table entries */\\n  mask = used - 1;            /* mask for comparing low */\\n\\n  /* check available table space */\\n  if ((type === LENS && used > ENOUGH_LENS) ||\\n    (type === DISTS && used > ENOUGH_DISTS)) {\\n    return 1;\\n  }\\n\\n  var i = 0;\\n  /* process all codes and make table entries */\\n  for (;;) {\\n    i++;\\n    /* create table entry */\\n    here_bits = len - drop;\\n    if (work[sym] < end) {\\n      here_op = 0;\\n      here_val = work[sym];\\n    }\\n    else if (work[sym] > end) {\\n      here_op = extra[extra_index + work[sym]];\\n      here_val = base[base_index + work[sym]];\\n    }\\n    else {\\n      here_op = 32 + 64;         /* end of block */\\n      here_val = 0;\\n    }\\n\\n    /* replicate for those indices with low len bits equal to huff */\\n    incr = 1 << (len - drop);\\n    fill = 1 << curr;\\n    min = fill;                 /* save offset to next table */\\n    do {\\n      fill -= incr;\\n      table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\\n    } while (fill !== 0);\\n\\n    /* backwards increment the len-bit code huff */\\n    incr = 1 << (len - 1);\\n    while (huff & incr) {\\n      incr >>= 1;\\n    }\\n    if (incr !== 0) {\\n      huff &= incr - 1;\\n      huff += incr;\\n    } else {\\n      huff = 0;\\n    }\\n\\n    /* go to next symbol, update count, len */\\n    sym++;\\n    if (--count[len] === 0) {\\n      if (len === max) { break; }\\n      len = lens[lens_index + work[sym]];\\n    }\\n\\n    /* create new sub-table if needed */\\n    if (len > root && (huff & mask) !== low) {\\n      /* if first time, transition to sub-tables */\\n      if (drop === 0) {\\n        drop = root;\\n      }\\n\\n      /* increment past last table */\\n      next += min;            /* here min is 1 << curr */\\n\\n      /* determine length of next table */\\n      curr = len - drop;\\n      left = 1 << curr;\\n      while (curr + drop < max) {\\n        left -= count[curr + drop];\\n        if (left <= 0) { break; }\\n        curr++;\\n        left <<= 1;\\n      }\\n\\n      /* check for enough space */\\n      used += 1 << curr;\\n      if ((type === LENS && used > ENOUGH_LENS) ||\\n        (type === DISTS && used > ENOUGH_DISTS)) {\\n        return 1;\\n      }\\n\\n      /* point entry in root table to sub-table */\\n      low = huff & mask;\\n      /*table.op[low] = curr;\\n      table.bits[low] = root;\\n      table.val[low] = next - opts.table_index;*/\\n      table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\\n    }\\n  }\\n\\n  /* fill in remaining table entry if code is incomplete (guaranteed to have\\n   at most one remaining entry, since if the code is incomplete, the\\n   maximum code length that was allowed to get this far is one bit) */\\n  if (huff !== 0) {\\n    //table.op[next + huff] = 64;            /* invalid code marker */\\n    //table.bits[next + huff] = len - drop;\\n    //table.val[next + huff] = 0;\\n    table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\\n  }\\n\\n  /* set return parameters */\\n  //opts.table_index += used;\\n  opts.bits = root;\\n  return 0;\\n};\\n\\n},{\"../utils/common\":32}],42:[function(require,module,exports){\\n\\'use strict\\';\\n\\nmodule.exports = {\\n  2:      \\'need dictionary\\',     /* Z_NEED_DICT       2  */\\n  1:      \\'stream end\\',          /* Z_STREAM_END      1  */\\n  0:      \\'\\',                    /* Z_OK              0  */\\n  \\'-1\\':   \\'file error\\',          /* Z_ERRNO         (-1) */\\n  \\'-2\\':   \\'stream error\\',        /* Z_STREAM_ERROR  (-2) */\\n  \\'-3\\':   \\'data error\\',          /* Z_DATA_ERROR    (-3) */\\n  \\'-4\\':   \\'insufficient memory\\', /* Z_MEM_ERROR     (-4) */\\n  \\'-5\\':   \\'buffer error\\',        /* Z_BUF_ERROR     (-5) */\\n  \\'-6\\':   \\'incompatible version\\' /* Z_VERSION_ERROR (-6) */\\n};\\n\\n},{}],43:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nvar utils = require(\\'../utils/common\\');\\n\\n/* Public constants ==========================================================*/\\n/* ===========================================================================*/\\n\\n\\n//var Z_FILTERED          = 1;\\n//var Z_HUFFMAN_ONLY      = 2;\\n//var Z_RLE               = 3;\\nvar Z_FIXED               = 4;\\n//var Z_DEFAULT_STRATEGY  = 0;\\n\\n/* Possible values of the data_type field (though see inflate()) */\\nvar Z_BINARY              = 0;\\nvar Z_TEXT                = 1;\\n//var Z_ASCII             = 1; // = Z_TEXT\\nvar Z_UNKNOWN             = 2;\\n\\n/*============================================================================*/\\n\\n\\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\\n\\n// From zutil.h\\n\\nvar STORED_BLOCK = 0;\\nvar STATIC_TREES = 1;\\nvar DYN_TREES    = 2;\\n/* The three kinds of block type */\\n\\nvar MIN_MATCH    = 3;\\nvar MAX_MATCH    = 258;\\n/* The minimum and maximum match lengths */\\n\\n// From deflate.h\\n/* ===========================================================================\\n * Internal compression state.\\n */\\n\\nvar LENGTH_CODES  = 29;\\n/* number of length codes, not counting the special END_BLOCK code */\\n\\nvar LITERALS      = 256;\\n/* number of literal bytes 0..255 */\\n\\nvar L_CODES       = LITERALS + 1 + LENGTH_CODES;\\n/* number of Literal or Length codes, including the END_BLOCK code */\\n\\nvar D_CODES       = 30;\\n/* number of distance codes */\\n\\nvar BL_CODES      = 19;\\n/* number of codes used to transfer the bit lengths */\\n\\nvar HEAP_SIZE     = 2 * L_CODES + 1;\\n/* maximum heap size */\\n\\nvar MAX_BITS      = 15;\\n/* All codes must not exceed MAX_BITS bits */\\n\\nvar Buf_size      = 16;\\n/* size of bit buffer in bi_buf */\\n\\n\\n/* ===========================================================================\\n * Constants\\n */\\n\\nvar MAX_BL_BITS = 7;\\n/* Bit length codes must not exceed MAX_BL_BITS bits */\\n\\nvar END_BLOCK   = 256;\\n/* end of block literal code */\\n\\nvar REP_3_6     = 16;\\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\\n\\nvar REPZ_3_10   = 17;\\n/* repeat a zero length 3-10 times  (3 bits of repeat count) */\\n\\nvar REPZ_11_138 = 18;\\n/* repeat a zero length 11-138 times  (7 bits of repeat count) */\\n\\n/* eslint-disable comma-spacing,array-bracket-spacing */\\nvar extra_lbits =   /* extra bits for each length code */\\n  [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\\n\\nvar extra_dbits =   /* extra bits for each distance code */\\n  [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\\n\\nvar extra_blbits =  /* extra bits for each bit length code */\\n  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\\n\\nvar bl_order =\\n  [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\\n/* eslint-enable comma-spacing,array-bracket-spacing */\\n\\n/* The lengths of the bit length codes are sent in order of decreasing\\n * probability, to avoid transmitting the lengths for unused bit length codes.\\n */\\n\\n/* ===========================================================================\\n * Local data. These are initialized only once.\\n */\\n\\n// We pre-fill arrays with 0 to avoid uninitialized gaps\\n\\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\\n\\n// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1\\nvar static_ltree  = new Array((L_CODES + 2) * 2);\\nzero(static_ltree);\\n/* The static literal tree. Since the bit lengths are imposed, there is no\\n * need for the L_CODES extra codes used during heap construction. However\\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\\n * below).\\n */\\n\\nvar static_dtree  = new Array(D_CODES * 2);\\nzero(static_dtree);\\n/* The static distance tree. (Actually a trivial tree since all codes use\\n * 5 bits.)\\n */\\n\\nvar _dist_code    = new Array(DIST_CODE_LEN);\\nzero(_dist_code);\\n/* Distance codes. The first 256 values correspond to the distances\\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\\n * the 15 bit distances.\\n */\\n\\nvar _length_code  = new Array(MAX_MATCH - MIN_MATCH + 1);\\nzero(_length_code);\\n/* length code for each normalized match length (0 == MIN_MATCH) */\\n\\nvar base_length   = new Array(LENGTH_CODES);\\nzero(base_length);\\n/* First normalized length for each code (0 = MIN_MATCH) */\\n\\nvar base_dist     = new Array(D_CODES);\\nzero(base_dist);\\n/* First normalized distance for each code (0 = distance of 1) */\\n\\n\\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\\n\\n  this.static_tree  = static_tree;  /* static tree or NULL */\\n  this.extra_bits   = extra_bits;   /* extra bits for each code or NULL */\\n  this.extra_base   = extra_base;   /* base index for extra_bits */\\n  this.elems        = elems;        /* max number of elements in the tree */\\n  this.max_length   = max_length;   /* max bit length for the codes */\\n\\n  // show if `static_tree` has data or dummy - needed for monomorphic objects\\n  this.has_stree    = static_tree && static_tree.length;\\n}\\n\\n\\nvar static_l_desc;\\nvar static_d_desc;\\nvar static_bl_desc;\\n\\n\\nfunction TreeDesc(dyn_tree, stat_desc) {\\n  this.dyn_tree = dyn_tree;     /* the dynamic tree */\\n  this.max_code = 0;            /* largest code with non zero frequency */\\n  this.stat_desc = stat_desc;   /* the corresponding static tree */\\n}\\n\\n\\n\\nfunction d_code(dist) {\\n  return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\\n}\\n\\n\\n/* ===========================================================================\\n * Output a short LSB first on the stream.\\n * IN assertion: there is enough room in pendingBuf.\\n */\\nfunction put_short(s, w) {\\n//    put_byte(s, (uch)((w) & 0xff));\\n//    put_byte(s, (uch)((ush)(w) >> 8));\\n  s.pending_buf[s.pending++] = (w) & 0xff;\\n  s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\\n}\\n\\n\\n/* ===========================================================================\\n * Send a value on a given number of bits.\\n * IN assertion: length <= 16 and value fits in length bits.\\n */\\nfunction send_bits(s, value, length) {\\n  if (s.bi_valid > (Buf_size - length)) {\\n    s.bi_buf |= (value << s.bi_valid) & 0xffff;\\n    put_short(s, s.bi_buf);\\n    s.bi_buf = value >> (Buf_size - s.bi_valid);\\n    s.bi_valid += length - Buf_size;\\n  } else {\\n    s.bi_buf |= (value << s.bi_valid) & 0xffff;\\n    s.bi_valid += length;\\n  }\\n}\\n\\n\\nfunction send_code(s, c, tree) {\\n  send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\\n}\\n\\n\\n/* ===========================================================================\\n * Reverse the first len bits of a code, using straightforward code (a faster\\n * method would use a table)\\n * IN assertion: 1 <= len <= 15\\n */\\nfunction bi_reverse(code, len) {\\n  var res = 0;\\n  do {\\n    res |= code & 1;\\n    code >>>= 1;\\n    res <<= 1;\\n  } while (--len > 0);\\n  return res >>> 1;\\n}\\n\\n\\n/* ===========================================================================\\n * Flush the bit buffer, keeping at most 7 bits in it.\\n */\\nfunction bi_flush(s) {\\n  if (s.bi_valid === 16) {\\n    put_short(s, s.bi_buf);\\n    s.bi_buf = 0;\\n    s.bi_valid = 0;\\n\\n  } else if (s.bi_valid >= 8) {\\n    s.pending_buf[s.pending++] = s.bi_buf & 0xff;\\n    s.bi_buf >>= 8;\\n    s.bi_valid -= 8;\\n  }\\n}\\n\\n\\n/* ===========================================================================\\n * Compute the optimal bit lengths for a tree and update the total bit length\\n * for the current block.\\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\\n *    above are the tree nodes sorted by increasing frequency.\\n * OUT assertions: the field len is set to the optimal bit length, the\\n *     array bl_count contains the frequencies for each bit length.\\n *     The length opt_len is updated; static_len is also updated if stree is\\n *     not null.\\n */\\nfunction gen_bitlen(s, desc)\\n//    deflate_state *s;\\n//    tree_desc *desc;    /* the tree descriptor */\\n{\\n  var tree            = desc.dyn_tree;\\n  var max_code        = desc.max_code;\\n  var stree           = desc.stat_desc.static_tree;\\n  var has_stree       = desc.stat_desc.has_stree;\\n  var extra           = desc.stat_desc.extra_bits;\\n  var base            = desc.stat_desc.extra_base;\\n  var max_length      = desc.stat_desc.max_length;\\n  var h;              /* heap index */\\n  var n, m;           /* iterate over the tree elements */\\n  var bits;           /* bit length */\\n  var xbits;          /* extra bits */\\n  var f;              /* frequency */\\n  var overflow = 0;   /* number of elements with bit length too large */\\n\\n  for (bits = 0; bits <= MAX_BITS; bits++) {\\n    s.bl_count[bits] = 0;\\n  }\\n\\n  /* In a first pass, compute the optimal bit lengths (which may\\n   * overflow in the case of the bit length tree).\\n   */\\n  tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\\n\\n  for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\\n    n = s.heap[h];\\n    bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\\n    if (bits > max_length) {\\n      bits = max_length;\\n      overflow++;\\n    }\\n    tree[n * 2 + 1]/*.Len*/ = bits;\\n    /* We overwrite tree[n].Dad which is no longer needed */\\n\\n    if (n > max_code) { continue; } /* not a leaf node */\\n\\n    s.bl_count[bits]++;\\n    xbits = 0;\\n    if (n >= base) {\\n      xbits = extra[n - base];\\n    }\\n    f = tree[n * 2]/*.Freq*/;\\n    s.opt_len += f * (bits + xbits);\\n    if (has_stree) {\\n      s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\\n    }\\n  }\\n  if (overflow === 0) { return; }\\n\\n  // Trace((stderr,\"\\\\nbit length overflow\\\\n\"));\\n  /* This happens for example on obj2 and pic of the Calgary corpus */\\n\\n  /* Find the first bit length which could increase: */\\n  do {\\n    bits = max_length - 1;\\n    while (s.bl_count[bits] === 0) { bits--; }\\n    s.bl_count[bits]--;      /* move one leaf down the tree */\\n    s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\\n    s.bl_count[max_length]--;\\n    /* The brother of the overflow item also moves one step up,\\n     * but this does not affect bl_count[max_length]\\n     */\\n    overflow -= 2;\\n  } while (overflow > 0);\\n\\n  /* Now recompute all bit lengths, scanning in increasing frequency.\\n   * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\\n   * lengths instead of fixing only the wrong ones. This idea is taken\\n   * from \\'ar\\' written by Haruhiko Okumura.)\\n   */\\n  for (bits = max_length; bits !== 0; bits--) {\\n    n = s.bl_count[bits];\\n    while (n !== 0) {\\n      m = s.heap[--h];\\n      if (m > max_code) { continue; }\\n      if (tree[m * 2 + 1]/*.Len*/ !== bits) {\\n        // Trace((stderr,\"code %d bits %d->%d\\\\n\", m, tree[m].Len, bits));\\n        s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\\n        tree[m * 2 + 1]/*.Len*/ = bits;\\n      }\\n      n--;\\n    }\\n  }\\n}\\n\\n\\n/* ===========================================================================\\n * Generate the codes for a given tree and bit counts (which need not be\\n * optimal).\\n * IN assertion: the array bl_count contains the bit length statistics for\\n * the given tree and the field len is set for all tree elements.\\n * OUT assertion: the field code is set for all tree elements of non\\n *     zero code length.\\n */\\nfunction gen_codes(tree, max_code, bl_count)\\n//    ct_data *tree;             /* the tree to decorate */\\n//    int max_code;              /* largest code with non zero frequency */\\n//    ushf *bl_count;            /* number of codes at each bit length */\\n{\\n  var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\\n  var code = 0;              /* running code value */\\n  var bits;                  /* bit index */\\n  var n;                     /* code index */\\n\\n  /* The distribution counts are first used to generate the code values\\n   * without bit reversal.\\n   */\\n  for (bits = 1; bits <= MAX_BITS; bits++) {\\n    next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\\n  }\\n  /* Check that the bit counts in bl_count are consistent. The last code\\n   * must be all ones.\\n   */\\n  //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\\n  //        \"inconsistent bit counts\");\\n  //Tracev((stderr,\"\\\\ngen_codes: max_code %d \", max_code));\\n\\n  for (n = 0;  n <= max_code; n++) {\\n    var len = tree[n * 2 + 1]/*.Len*/;\\n    if (len === 0) { continue; }\\n    /* Now reverse the bits */\\n    tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);\\n\\n    //Tracecv(tree != static_ltree, (stderr,\"\\\\nn %3d %c l %2d c %4x (%x) \",\\n    //     n, (isgraph(n) ? n : \\' \\'), len, tree[n].Code, next_code[len]-1));\\n  }\\n}\\n\\n\\n/* ===========================================================================\\n * Initialize the various \\'constant\\' tables.\\n */\\nfunction tr_static_init() {\\n  var n;        /* iterates over tree elements */\\n  var bits;     /* bit counter */\\n  var length;   /* length value */\\n  var code;     /* code value */\\n  var dist;     /* distance index */\\n  var bl_count = new Array(MAX_BITS + 1);\\n  /* number of codes at each bit length for an optimal tree */\\n\\n  // do check in _tr_init()\\n  //if (static_init_done) return;\\n\\n  /* For some embedded targets, global variables are not initialized: */\\n/*#ifdef NO_INIT_GLOBAL_POINTERS\\n  static_l_desc.static_tree = static_ltree;\\n  static_l_desc.extra_bits = extra_lbits;\\n  static_d_desc.static_tree = static_dtree;\\n  static_d_desc.extra_bits = extra_dbits;\\n  static_bl_desc.extra_bits = extra_blbits;\\n#endif*/\\n\\n  /* Initialize the mapping length (0..255) -> length code (0..28) */\\n  length = 0;\\n  for (code = 0; code < LENGTH_CODES - 1; code++) {\\n    base_length[code] = length;\\n    for (n = 0; n < (1 << extra_lbits[code]); n++) {\\n      _length_code[length++] = code;\\n    }\\n  }\\n  //Assert (length == 256, \"tr_static_init: length != 256\");\\n  /* Note that the length 255 (match length 258) can be represented\\n   * in two different ways: code 284 + 5 bits or code 285, so we\\n   * overwrite length_code[255] to use the best encoding:\\n   */\\n  _length_code[length - 1] = code;\\n\\n  /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\\n  dist = 0;\\n  for (code = 0; code < 16; code++) {\\n    base_dist[code] = dist;\\n    for (n = 0; n < (1 << extra_dbits[code]); n++) {\\n      _dist_code[dist++] = code;\\n    }\\n  }\\n  //Assert (dist == 256, \"tr_static_init: dist != 256\");\\n  dist >>= 7; /* from now on, all distances are divided by 128 */\\n  for (; code < D_CODES; code++) {\\n    base_dist[code] = dist << 7;\\n    for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\\n      _dist_code[256 + dist++] = code;\\n    }\\n  }\\n  //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\\n\\n  /* Construct the codes of the static literal tree */\\n  for (bits = 0; bits <= MAX_BITS; bits++) {\\n    bl_count[bits] = 0;\\n  }\\n\\n  n = 0;\\n  while (n <= 143) {\\n    static_ltree[n * 2 + 1]/*.Len*/ = 8;\\n    n++;\\n    bl_count[8]++;\\n  }\\n  while (n <= 255) {\\n    static_ltree[n * 2 + 1]/*.Len*/ = 9;\\n    n++;\\n    bl_count[9]++;\\n  }\\n  while (n <= 279) {\\n    static_ltree[n * 2 + 1]/*.Len*/ = 7;\\n    n++;\\n    bl_count[7]++;\\n  }\\n  while (n <= 287) {\\n    static_ltree[n * 2 + 1]/*.Len*/ = 8;\\n    n++;\\n    bl_count[8]++;\\n  }\\n  /* Codes 286 and 287 do not exist, but we must include them in the\\n   * tree construction to get a canonical Huffman tree (longest code\\n   * all ones)\\n   */\\n  gen_codes(static_ltree, L_CODES + 1, bl_count);\\n\\n  /* The static distance tree is trivial: */\\n  for (n = 0; n < D_CODES; n++) {\\n    static_dtree[n * 2 + 1]/*.Len*/ = 5;\\n    static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\\n  }\\n\\n  // Now data ready and we can init static trees\\n  static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\\n  static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS);\\n  static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0,         BL_CODES, MAX_BL_BITS);\\n\\n  //static_init_done = true;\\n}\\n\\n\\n/* ===========================================================================\\n * Initialize a new block.\\n */\\nfunction init_block(s) {\\n  var n; /* iterates over tree elements */\\n\\n  /* Initialize the trees. */\\n  for (n = 0; n < L_CODES;  n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\\n  for (n = 0; n < D_CODES;  n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\\n  for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\\n\\n  s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\\n  s.opt_len = s.static_len = 0;\\n  s.last_lit = s.matches = 0;\\n}\\n\\n\\n/* ===========================================================================\\n * Flush the bit buffer and align the output on a byte boundary\\n */\\nfunction bi_windup(s)\\n{\\n  if (s.bi_valid > 8) {\\n    put_short(s, s.bi_buf);\\n  } else if (s.bi_valid > 0) {\\n    //put_byte(s, (Byte)s->bi_buf);\\n    s.pending_buf[s.pending++] = s.bi_buf;\\n  }\\n  s.bi_buf = 0;\\n  s.bi_valid = 0;\\n}\\n\\n/* ===========================================================================\\n * Copy a stored block, storing first the length and its\\n * one\\'s complement if requested.\\n */\\nfunction copy_block(s, buf, len, header)\\n//DeflateState *s;\\n//charf    *buf;    /* the input data */\\n//unsigned len;     /* its length */\\n//int      header;  /* true if block header must be written */\\n{\\n  bi_windup(s);        /* align on byte boundary */\\n\\n  if (header) {\\n    put_short(s, len);\\n    put_short(s, ~len);\\n  }\\n//  while (len--) {\\n//    put_byte(s, *buf++);\\n//  }\\n  utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\\n  s.pending += len;\\n}\\n\\n/* ===========================================================================\\n * Compares to subtrees, using the tree depth as tie breaker when\\n * the subtrees have equal frequency. This minimizes the worst case length.\\n */\\nfunction smaller(tree, n, m, depth) {\\n  var _n2 = n * 2;\\n  var _m2 = m * 2;\\n  return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\\n         (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\\n}\\n\\n/* ===========================================================================\\n * Restore the heap property by moving down the tree starting at node k,\\n * exchanging a node with the smallest of its two sons if necessary, stopping\\n * when the heap property is re-established (each father smaller than its\\n * two sons).\\n */\\nfunction pqdownheap(s, tree, k)\\n//    deflate_state *s;\\n//    ct_data *tree;  /* the tree to restore */\\n//    int k;               /* node to move down */\\n{\\n  var v = s.heap[k];\\n  var j = k << 1;  /* left son of k */\\n  while (j <= s.heap_len) {\\n    /* Set j to the smallest of the two sons: */\\n    if (j < s.heap_len &&\\n      smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\\n      j++;\\n    }\\n    /* Exit if v is smaller than both sons */\\n    if (smaller(tree, v, s.heap[j], s.depth)) { break; }\\n\\n    /* Exchange v with the smallest son */\\n    s.heap[k] = s.heap[j];\\n    k = j;\\n\\n    /* And continue down the tree, setting j to the left son of k */\\n    j <<= 1;\\n  }\\n  s.heap[k] = v;\\n}\\n\\n\\n// inlined manually\\n// var SMALLEST = 1;\\n\\n/* ===========================================================================\\n * Send the block data compressed using the given Huffman trees\\n */\\nfunction compress_block(s, ltree, dtree)\\n//    deflate_state *s;\\n//    const ct_data *ltree; /* literal tree */\\n//    const ct_data *dtree; /* distance tree */\\n{\\n  var dist;           /* distance of matched string */\\n  var lc;             /* match length or unmatched char (if dist == 0) */\\n  var lx = 0;         /* running index in l_buf */\\n  var code;           /* the code to send */\\n  var extra;          /* number of extra bits to send */\\n\\n  if (s.last_lit !== 0) {\\n    do {\\n      dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\\n      lc = s.pending_buf[s.l_buf + lx];\\n      lx++;\\n\\n      if (dist === 0) {\\n        send_code(s, lc, ltree); /* send a literal byte */\\n        //Tracecv(isgraph(lc), (stderr,\" \\'%c\\' \", lc));\\n      } else {\\n        /* Here, lc is the match length - MIN_MATCH */\\n        code = _length_code[lc];\\n        send_code(s, code + LITERALS + 1, ltree); /* send the length code */\\n        extra = extra_lbits[code];\\n        if (extra !== 0) {\\n          lc -= base_length[code];\\n          send_bits(s, lc, extra);       /* send the extra length bits */\\n        }\\n        dist--; /* dist is now the match distance - 1 */\\n        code = d_code(dist);\\n        //Assert (code < D_CODES, \"bad d_code\");\\n\\n        send_code(s, code, dtree);       /* send the distance code */\\n        extra = extra_dbits[code];\\n        if (extra !== 0) {\\n          dist -= base_dist[code];\\n          send_bits(s, dist, extra);   /* send the extra distance bits */\\n        }\\n      } /* literal or match pair ? */\\n\\n      /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\\n      //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\\n      //       \"pendingBuf overflow\");\\n\\n    } while (lx < s.last_lit);\\n  }\\n\\n  send_code(s, END_BLOCK, ltree);\\n}\\n\\n\\n/* ===========================================================================\\n * Construct one Huffman tree and assigns the code bit strings and lengths.\\n * Update the total bit length for the current block.\\n * IN assertion: the field freq is set for all tree elements.\\n * OUT assertions: the fields len and code are set to the optimal bit length\\n *     and corresponding code. The length opt_len is updated; static_len is\\n *     also updated if stree is not null. The field max_code is set.\\n */\\nfunction build_tree(s, desc)\\n//    deflate_state *s;\\n//    tree_desc *desc; /* the tree descriptor */\\n{\\n  var tree     = desc.dyn_tree;\\n  var stree    = desc.stat_desc.static_tree;\\n  var has_stree = desc.stat_desc.has_stree;\\n  var elems    = desc.stat_desc.elems;\\n  var n, m;          /* iterate over heap elements */\\n  var max_code = -1; /* largest code with non zero frequency */\\n  var node;          /* new node being created */\\n\\n  /* Construct the initial heap, with least frequent element in\\n   * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\\n   * heap[0] is not used.\\n   */\\n  s.heap_len = 0;\\n  s.heap_max = HEAP_SIZE;\\n\\n  for (n = 0; n < elems; n++) {\\n    if (tree[n * 2]/*.Freq*/ !== 0) {\\n      s.heap[++s.heap_len] = max_code = n;\\n      s.depth[n] = 0;\\n\\n    } else {\\n      tree[n * 2 + 1]/*.Len*/ = 0;\\n    }\\n  }\\n\\n  /* The pkzip format requires that at least one distance code exists,\\n   * and that at least one bit should be sent even if there is only one\\n   * possible code. So to avoid special checks later on we force at least\\n   * two codes of non zero frequency.\\n   */\\n  while (s.heap_len < 2) {\\n    node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\\n    tree[node * 2]/*.Freq*/ = 1;\\n    s.depth[node] = 0;\\n    s.opt_len--;\\n\\n    if (has_stree) {\\n      s.static_len -= stree[node * 2 + 1]/*.Len*/;\\n    }\\n    /* node is 0 or 1 so it does not have extra bits */\\n  }\\n  desc.max_code = max_code;\\n\\n  /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\\n   * establish sub-heaps of increasing lengths:\\n   */\\n  for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\\n\\n  /* Construct the Huffman tree by repeatedly combining the least two\\n   * frequent nodes.\\n   */\\n  node = elems;              /* next internal node of the tree */\\n  do {\\n    //pqremove(s, tree, n);  /* n = node of least frequency */\\n    /*** pqremove ***/\\n    n = s.heap[1/*SMALLEST*/];\\n    s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\\n    pqdownheap(s, tree, 1/*SMALLEST*/);\\n    /***/\\n\\n    m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\\n\\n    s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\\n    s.heap[--s.heap_max] = m;\\n\\n    /* Create a new node father of n and m */\\n    tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\\n    s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\\n    tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\\n\\n    /* and insert the new node in the heap */\\n    s.heap[1/*SMALLEST*/] = node++;\\n    pqdownheap(s, tree, 1/*SMALLEST*/);\\n\\n  } while (s.heap_len >= 2);\\n\\n  s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\\n\\n  /* At this point, the fields freq and dad are set. We can now\\n   * generate the bit lengths.\\n   */\\n  gen_bitlen(s, desc);\\n\\n  /* The field len is now set, we can generate the bit codes */\\n  gen_codes(tree, max_code, s.bl_count);\\n}\\n\\n\\n/* ===========================================================================\\n * Scan a literal or distance tree to determine the frequencies of the codes\\n * in the bit length tree.\\n */\\nfunction scan_tree(s, tree, max_code)\\n//    deflate_state *s;\\n//    ct_data *tree;   /* the tree to be scanned */\\n//    int max_code;    /* and its largest code of non zero frequency */\\n{\\n  var n;                     /* iterates over all tree elements */\\n  var prevlen = -1;          /* last emitted length */\\n  var curlen;                /* length of current code */\\n\\n  var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\\n\\n  var count = 0;             /* repeat count of the current code */\\n  var max_count = 7;         /* max repeat count */\\n  var min_count = 4;         /* min repeat count */\\n\\n  if (nextlen === 0) {\\n    max_count = 138;\\n    min_count = 3;\\n  }\\n  tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\\n\\n  for (n = 0; n <= max_code; n++) {\\n    curlen = nextlen;\\n    nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\\n\\n    if (++count < max_count && curlen === nextlen) {\\n      continue;\\n\\n    } else if (count < min_count) {\\n      s.bl_tree[curlen * 2]/*.Freq*/ += count;\\n\\n    } else if (curlen !== 0) {\\n\\n      if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\\n      s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\\n\\n    } else if (count <= 10) {\\n      s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\\n\\n    } else {\\n      s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\\n    }\\n\\n    count = 0;\\n    prevlen = curlen;\\n\\n    if (nextlen === 0) {\\n      max_count = 138;\\n      min_count = 3;\\n\\n    } else if (curlen === nextlen) {\\n      max_count = 6;\\n      min_count = 3;\\n\\n    } else {\\n      max_count = 7;\\n      min_count = 4;\\n    }\\n  }\\n}\\n\\n\\n/* ===========================================================================\\n * Send a literal or distance tree in compressed form, using the codes in\\n * bl_tree.\\n */\\nfunction send_tree(s, tree, max_code)\\n//    deflate_state *s;\\n//    ct_data *tree; /* the tree to be scanned */\\n//    int max_code;       /* and its largest code of non zero frequency */\\n{\\n  var n;                     /* iterates over all tree elements */\\n  var prevlen = -1;          /* last emitted length */\\n  var curlen;                /* length of current code */\\n\\n  var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\\n\\n  var count = 0;             /* repeat count of the current code */\\n  var max_count = 7;         /* max repeat count */\\n  var min_count = 4;         /* min repeat count */\\n\\n  /* tree[max_code+1].Len = -1; */  /* guard already set */\\n  if (nextlen === 0) {\\n    max_count = 138;\\n    min_count = 3;\\n  }\\n\\n  for (n = 0; n <= max_code; n++) {\\n    curlen = nextlen;\\n    nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\\n\\n    if (++count < max_count && curlen === nextlen) {\\n      continue;\\n\\n    } else if (count < min_count) {\\n      do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\\n\\n    } else if (curlen !== 0) {\\n      if (curlen !== prevlen) {\\n        send_code(s, curlen, s.bl_tree);\\n        count--;\\n      }\\n      //Assert(count >= 3 && count <= 6, \" 3_6?\");\\n      send_code(s, REP_3_6, s.bl_tree);\\n      send_bits(s, count - 3, 2);\\n\\n    } else if (count <= 10) {\\n      send_code(s, REPZ_3_10, s.bl_tree);\\n      send_bits(s, count - 3, 3);\\n\\n    } else {\\n      send_code(s, REPZ_11_138, s.bl_tree);\\n      send_bits(s, count - 11, 7);\\n    }\\n\\n    count = 0;\\n    prevlen = curlen;\\n    if (nextlen === 0) {\\n      max_count = 138;\\n      min_count = 3;\\n\\n    } else if (curlen === nextlen) {\\n      max_count = 6;\\n      min_count = 3;\\n\\n    } else {\\n      max_count = 7;\\n      min_count = 4;\\n    }\\n  }\\n}\\n\\n\\n/* ===========================================================================\\n * Construct the Huffman tree for the bit lengths and return the index in\\n * bl_order of the last bit length code to send.\\n */\\nfunction build_bl_tree(s) {\\n  var max_blindex;  /* index of last bit length code of non zero freq */\\n\\n  /* Determine the bit length frequencies for literal and distance trees */\\n  scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\\n  scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\\n\\n  /* Build the bit length tree: */\\n  build_tree(s, s.bl_desc);\\n  /* opt_len now includes the length of the tree representations, except\\n   * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\\n   */\\n\\n  /* Determine the number of bit length codes to send. The pkzip format\\n   * requires that at least 4 bit length codes be sent. (appnote.txt says\\n   * 3 but the actual value used is 4.)\\n   */\\n  for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\\n    if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\\n      break;\\n    }\\n  }\\n  /* Update opt_len to include the bit length tree and counts */\\n  s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\\n  //Tracev((stderr, \"\\\\ndyn trees: dyn %ld, stat %ld\",\\n  //        s->opt_len, s->static_len));\\n\\n  return max_blindex;\\n}\\n\\n\\n/* ===========================================================================\\n * Send the header for a block using dynamic Huffman trees: the counts, the\\n * lengths of the bit length codes, the literal tree and the distance tree.\\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\\n */\\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\\n//    deflate_state *s;\\n//    int lcodes, dcodes, blcodes; /* number of codes for each tree */\\n{\\n  var rank;                    /* index in bl_order */\\n\\n  //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\\n  //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\\n  //        \"too many codes\");\\n  //Tracev((stderr, \"\\\\nbl counts: \"));\\n  send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\\n  send_bits(s, dcodes - 1,   5);\\n  send_bits(s, blcodes - 4,  4); /* not -3 as stated in appnote.txt */\\n  for (rank = 0; rank < blcodes; rank++) {\\n    //Tracev((stderr, \"\\\\nbl code %2d \", bl_order[rank]));\\n    send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\\n  }\\n  //Tracev((stderr, \"\\\\nbl tree: sent %ld\", s->bits_sent));\\n\\n  send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\\n  //Tracev((stderr, \"\\\\nlit tree: sent %ld\", s->bits_sent));\\n\\n  send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\\n  //Tracev((stderr, \"\\\\ndist tree: sent %ld\", s->bits_sent));\\n}\\n\\n\\n/* ===========================================================================\\n * Check if the data type is TEXT or BINARY, using the following algorithm:\\n * - TEXT if the two conditions below are satisfied:\\n *    a) There are no non-portable control characters belonging to the\\n *       \"black list\" (0..6, 14..25, 28..31).\\n *    b) There is at least one printable character belonging to the\\n *       \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\\n * - BINARY otherwise.\\n * - The following partially-portable control characters form a\\n *   \"gray list\" that is ignored in this detection algorithm:\\n *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\\n * IN assertion: the fields Freq of dyn_ltree are set.\\n */\\nfunction detect_data_type(s) {\\n  /* black_mask is the bit mask of black-listed bytes\\n   * set bits 0..6, 14..25, and 28..31\\n   * 0xf3ffc07f = binary 11110011111111111100000001111111\\n   */\\n  var black_mask = 0xf3ffc07f;\\n  var n;\\n\\n  /* Check for non-textual (\"black-listed\") bytes. */\\n  for (n = 0; n <= 31; n++, black_mask >>>= 1) {\\n    if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\\n      return Z_BINARY;\\n    }\\n  }\\n\\n  /* Check for textual (\"white-listed\") bytes. */\\n  if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\\n      s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\\n    return Z_TEXT;\\n  }\\n  for (n = 32; n < LITERALS; n++) {\\n    if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\\n      return Z_TEXT;\\n    }\\n  }\\n\\n  /* There are no \"black-listed\" or \"white-listed\" bytes:\\n   * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\\n   */\\n  return Z_BINARY;\\n}\\n\\n\\nvar static_init_done = false;\\n\\n/* ===========================================================================\\n * Initialize the tree data structures for a new zlib stream.\\n */\\nfunction _tr_init(s)\\n{\\n\\n  if (!static_init_done) {\\n    tr_static_init();\\n    static_init_done = true;\\n  }\\n\\n  s.l_desc  = new TreeDesc(s.dyn_ltree, static_l_desc);\\n  s.d_desc  = new TreeDesc(s.dyn_dtree, static_d_desc);\\n  s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\\n\\n  s.bi_buf = 0;\\n  s.bi_valid = 0;\\n\\n  /* Initialize the first block of the first file: */\\n  init_block(s);\\n}\\n\\n\\n/* ===========================================================================\\n * Send a stored block\\n */\\nfunction _tr_stored_block(s, buf, stored_len, last)\\n//DeflateState *s;\\n//charf *buf;       /* input block */\\n//ulg stored_len;   /* length of input block */\\n//int last;         /* one if this is the last block for a file */\\n{\\n  send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3);    /* send block type */\\n  copy_block(s, buf, stored_len, true); /* with header */\\n}\\n\\n\\n/* ===========================================================================\\n * Send one empty static block to give enough lookahead for inflate.\\n * This takes 10 bits, of which 7 may remain in the bit buffer.\\n */\\nfunction _tr_align(s) {\\n  send_bits(s, STATIC_TREES << 1, 3);\\n  send_code(s, END_BLOCK, static_ltree);\\n  bi_flush(s);\\n}\\n\\n\\n/* ===========================================================================\\n * Determine the best encoding for the current block: dynamic trees, static\\n * trees or store, and output the encoded block to the zip file.\\n */\\nfunction _tr_flush_block(s, buf, stored_len, last)\\n//DeflateState *s;\\n//charf *buf;       /* input block, or NULL if too old */\\n//ulg stored_len;   /* length of input block */\\n//int last;         /* one if this is the last block for a file */\\n{\\n  var opt_lenb, static_lenb;  /* opt_len and static_len in bytes */\\n  var max_blindex = 0;        /* index of last bit length code of non zero freq */\\n\\n  /* Build the Huffman trees unless a stored block is forced */\\n  if (s.level > 0) {\\n\\n    /* Check if the file is binary or text */\\n    if (s.strm.data_type === Z_UNKNOWN) {\\n      s.strm.data_type = detect_data_type(s);\\n    }\\n\\n    /* Construct the literal and distance trees */\\n    build_tree(s, s.l_desc);\\n    // Tracev((stderr, \"\\\\nlit data: dyn %ld, stat %ld\", s->opt_len,\\n    //        s->static_len));\\n\\n    build_tree(s, s.d_desc);\\n    // Tracev((stderr, \"\\\\ndist data: dyn %ld, stat %ld\", s->opt_len,\\n    //        s->static_len));\\n    /* At this point, opt_len and static_len are the total bit lengths of\\n     * the compressed block data, excluding the tree representations.\\n     */\\n\\n    /* Build the bit length tree for the above two trees, and get the index\\n     * in bl_order of the last bit length code to send.\\n     */\\n    max_blindex = build_bl_tree(s);\\n\\n    /* Determine the best encoding. Compute the block lengths in bytes. */\\n    opt_lenb = (s.opt_len + 3 + 7) >>> 3;\\n    static_lenb = (s.static_len + 3 + 7) >>> 3;\\n\\n    // Tracev((stderr, \"\\\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\\n    //        opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\\n    //        s->last_lit));\\n\\n    if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\\n\\n  } else {\\n    // Assert(buf != (char*)0, \"lost buf\");\\n    opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\\n  }\\n\\n  if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\\n    /* 4: two words for the lengths */\\n\\n    /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\\n     * Otherwise we can\\'t have processed more than WSIZE input bytes since\\n     * the last block flush, because compression would have been\\n     * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\\n     * transform a block into a stored block.\\n     */\\n    _tr_stored_block(s, buf, stored_len, last);\\n\\n  } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\\n\\n    send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\\n    compress_block(s, static_ltree, static_dtree);\\n\\n  } else {\\n    send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\\n    send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\\n    compress_block(s, s.dyn_ltree, s.dyn_dtree);\\n  }\\n  // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\\n  /* The above check is made mod 2^32, for files larger than 512 MB\\n   * and uLong implemented on 32 bits.\\n   */\\n  init_block(s);\\n\\n  if (last) {\\n    bi_windup(s);\\n  }\\n  // Tracev((stderr,\"\\\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\\n  //       s->compressed_len-7*last));\\n}\\n\\n/* ===========================================================================\\n * Save the match info and tally the frequency counts. Return true if\\n * the current block must be flushed.\\n */\\nfunction _tr_tally(s, dist, lc)\\n//    deflate_state *s;\\n//    unsigned dist;  /* distance of matched string */\\n//    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */\\n{\\n  //var out_length, in_length, dcode;\\n\\n  s.pending_buf[s.d_buf + s.last_lit * 2]     = (dist >>> 8) & 0xff;\\n  s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\\n\\n  s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\\n  s.last_lit++;\\n\\n  if (dist === 0) {\\n    /* lc is the unmatched char */\\n    s.dyn_ltree[lc * 2]/*.Freq*/++;\\n  } else {\\n    s.matches++;\\n    /* Here, lc is the match length - MIN_MATCH */\\n    dist--;             /* dist = match distance - 1 */\\n    //Assert((ush)dist < (ush)MAX_DIST(s) &&\\n    //       (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\\n    //       (ush)d_code(dist) < (ush)D_CODES,  \"_tr_tally: bad match\");\\n\\n    s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\\n    s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\\n  }\\n\\n// (!) This block is disabled in zlib defailts,\\n// don\\'t enable it for binary compatibility\\n\\n//#ifdef TRUNCATE_BLOCK\\n//  /* Try to guess if it is profitable to stop the current block here */\\n//  if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\\n//    /* Compute an upper bound for the compressed length */\\n//    out_length = s.last_lit*8;\\n//    in_length = s.strstart - s.block_start;\\n//\\n//    for (dcode = 0; dcode < D_CODES; dcode++) {\\n//      out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\\n//    }\\n//    out_length >>>= 3;\\n//    //Tracev((stderr,\"\\\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\\n//    //       s->last_lit, in_length, out_length,\\n//    //       100L - out_length*100L/in_length));\\n//    if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\\n//      return true;\\n//    }\\n//  }\\n//#endif\\n\\n  return (s.last_lit === s.lit_bufsize - 1);\\n  /* We avoid equality with lit_bufsize because of wraparound at 64K\\n   * on 16 bit machines and because stored blocks are restricted to\\n   * 64K-1 bytes.\\n   */\\n}\\n\\nexports._tr_init  = _tr_init;\\nexports._tr_stored_block = _tr_stored_block;\\nexports._tr_flush_block  = _tr_flush_block;\\nexports._tr_tally = _tr_tally;\\nexports._tr_align = _tr_align;\\n\\n},{\"../utils/common\":32}],44:[function(require,module,exports){\\n\\'use strict\\';\\n\\n\\nfunction ZStream() {\\n  /* next input byte */\\n  this.input = null; // JS specific, because we have no pointers\\n  this.next_in = 0;\\n  /* number of bytes available at input */\\n  this.avail_in = 0;\\n  /* total number of input bytes read so far */\\n  this.total_in = 0;\\n  /* next output byte should be put there */\\n  this.output = null; // JS specific, because we have no pointers\\n  this.next_out = 0;\\n  /* remaining free space at output */\\n  this.avail_out = 0;\\n  /* total number of bytes output so far */\\n  this.total_out = 0;\\n  /* last error message, NULL if no error */\\n  this.msg = \\'\\'/*Z_NULL*/;\\n  /* not visible by applications */\\n  this.state = null;\\n  /* best guess about the data type: binary or text */\\n  this.data_type = 2/*Z_UNKNOWN*/;\\n  /* adler32 value of the uncompressed data */\\n  this.adler = 0;\\n}\\n\\nmodule.exports = ZStream;\\n\\n},{}],45:[function(require,module,exports){\\n(function (process,global){\\n// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information.\\n\\n;(function (undefined) {\\n\\n  var objectTypes = {\\n    \\'function\\': true,\\n    \\'object\\': true\\n  };\\n\\n  function checkGlobal(value) {\\n    return (value && value.Object === Object) ? value : null;\\n  }\\n\\n  var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;\\n  var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;\\n  var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === \\'object\\' && global);\\n  var freeSelf = checkGlobal(objectTypes[typeof self] && self);\\n  var freeWindow = checkGlobal(objectTypes[typeof window] && window);\\n  var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null;\\n  var thisGlobal = checkGlobal(objectTypes[typeof this] && this);\\n  var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function(\\'return this\\')();\\n\\n  var Rx = {\\n    internals: {},\\n    config: {\\n      Promise: root.Promise\\n    },\\n    helpers: { }\\n  };\\n\\n  // Defaults\\n  var noop = Rx.helpers.noop = function () { },\\n    identity = Rx.helpers.identity = function (x) { return x; },\\n    defaultNow = Rx.helpers.defaultNow = Date.now,\\n    defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },\\n    defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },\\n    defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },\\n    defaultError = Rx.helpers.defaultError = function (err) { throw err; },\\n    isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== \\'function\\' && typeof p.then === \\'function\\'; },\\n    isFunction = Rx.helpers.isFunction = (function () {\\n\\n      var isFn = function (value) {\\n        return typeof value == \\'function\\' || false;\\n      };\\n\\n      // fallback for older versions of Chrome and Safari\\n      if (isFn(/x/)) {\\n        isFn = function(value) {\\n          return typeof value == \\'function\\' && toString.call(value) == \\'[object Function]\\';\\n        };\\n      }\\n\\n      return isFn;\\n    }());\\n\\n  function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;}\\n\\n  var errorObj = {e: {}};\\n  \\n  function tryCatcherGen(tryCatchTarget) {\\n    return function tryCatcher() {\\n      try {\\n        return tryCatchTarget.apply(this, arguments);\\n      } catch (e) {\\n        errorObj.e = e;\\n        return errorObj;\\n      }\\n    };\\n  }\\n\\n  var tryCatch = Rx.internals.tryCatch = function tryCatch(fn) {\\n    if (!isFunction(fn)) { throw new TypeError(\\'fn must be a function\\'); }\\n    return tryCatcherGen(fn);\\n  };\\n\\n  function thrower(e) {\\n    throw e;\\n  }\\n\\n  Rx.config.longStackSupport = false;\\n  var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })();\\n  hasStacks = !!stacks.e && !!stacks.e.stack;\\n\\n  // All code after this point will be filtered from stack traces reported by RxJS\\n  var rStartingLine = captureLine(), rFileName;\\n\\n  var STACK_JUMP_SEPARATOR = \\'From previous event:\\';\\n\\n  function makeStackTraceLong(error, observable) {\\n    // If possible, transform the error stack trace by removing Node and RxJS\\n    // cruft, then concatenating with the stack trace of `observable`.\\n    if (hasStacks &&\\n        observable.stack &&\\n        typeof error === \\'object\\' &&\\n        error !== null &&\\n        error.stack &&\\n        error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1\\n    ) {\\n      var stacks = [];\\n      for (var o = observable; !!o; o = o.source) {\\n        if (o.stack) {\\n          stacks.unshift(o.stack);\\n        }\\n      }\\n      stacks.unshift(error.stack);\\n\\n      var concatedStacks = stacks.join(\\'\\\\n\\' + STACK_JUMP_SEPARATOR + \\'\\\\n\\');\\n      error.stack = filterStackString(concatedStacks);\\n    }\\n  }\\n\\n  function filterStackString(stackString) {\\n    var lines = stackString.split(\\'\\\\n\\'), desiredLines = [];\\n    for (var i = 0, len = lines.length; i < len; i++) {\\n      var line = lines[i];\\n\\n      if (!isInternalFrame(line) && !isNodeFrame(line) && line) {\\n        desiredLines.push(line);\\n      }\\n    }\\n    return desiredLines.join(\\'\\\\n\\');\\n  }\\n\\n  function isInternalFrame(stackLine) {\\n    var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);\\n    if (!fileNameAndLineNumber) {\\n      return false;\\n    }\\n    var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];\\n\\n    return fileName === rFileName &&\\n      lineNumber >= rStartingLine &&\\n      lineNumber <= rEndingLine;\\n  }\\n\\n  function isNodeFrame(stackLine) {\\n    return stackLine.indexOf(\\'(module.js:\\') !== -1 ||\\n      stackLine.indexOf(\\'(node.js:\\') !== -1;\\n  }\\n\\n  function captureLine() {\\n    if (!hasStacks) { return; }\\n\\n    try {\\n      throw new Error();\\n    } catch (e) {\\n      var lines = e.stack.split(\\'\\\\n\\');\\n      var firstLine = lines[0].indexOf(\\'@\\') > 0 ? lines[1] : lines[2];\\n      var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);\\n      if (!fileNameAndLineNumber) { return; }\\n\\n      rFileName = fileNameAndLineNumber[0];\\n      return fileNameAndLineNumber[1];\\n    }\\n  }\\n\\n  function getFileNameAndLineNumber(stackLine) {\\n    // Named functions: \\'at functionName (filename:lineNumber:columnNumber)\\'\\n    var attempt1 = /at .+ \\\\((.+):(\\\\d+):(?:\\\\d+)\\\\)$/.exec(stackLine);\\n    if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }\\n\\n    // Anonymous functions: \\'at filename:lineNumber:columnNumber\\'\\n    var attempt2 = /at ([^ ]+):(\\\\d+):(?:\\\\d+)$/.exec(stackLine);\\n    if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }\\n\\n    // Firefox style: \\'function@filename:lineNumber or @filename:lineNumber\\'\\n    var attempt3 = /.*@(.+):(\\\\d+)$/.exec(stackLine);\\n    if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }\\n  }\\n\\n  var EmptyError = Rx.EmptyError = function() {\\n    this.message = \\'Sequence contains no elements.\\';\\n    Error.call(this);\\n  };\\n  EmptyError.prototype = Object.create(Error.prototype);\\n  EmptyError.prototype.name = \\'EmptyError\\';\\n\\n  var ObjectDisposedError = Rx.ObjectDisposedError = function() {\\n    this.message = \\'Object has been disposed\\';\\n    Error.call(this);\\n  };\\n  ObjectDisposedError.prototype = Object.create(Error.prototype);\\n  ObjectDisposedError.prototype.name = \\'ObjectDisposedError\\';\\n\\n  var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {\\n    this.message = \\'Argument out of range\\';\\n    Error.call(this);\\n  };\\n  ArgumentOutOfRangeError.prototype = Object.create(Error.prototype);\\n  ArgumentOutOfRangeError.prototype.name = \\'ArgumentOutOfRangeError\\';\\n\\n  var NotSupportedError = Rx.NotSupportedError = function (message) {\\n    this.message = message || \\'This operation is not supported\\';\\n    Error.call(this);\\n  };\\n  NotSupportedError.prototype = Object.create(Error.prototype);\\n  NotSupportedError.prototype.name = \\'NotSupportedError\\';\\n\\n  var NotImplementedError = Rx.NotImplementedError = function (message) {\\n    this.message = message || \\'This operation is not implemented\\';\\n    Error.call(this);\\n  };\\n  NotImplementedError.prototype = Object.create(Error.prototype);\\n  NotImplementedError.prototype.name = \\'NotImplementedError\\';\\n\\n  var notImplemented = Rx.helpers.notImplemented = function () {\\n    throw new NotImplementedError();\\n  };\\n\\n  var notSupported = Rx.helpers.notSupported = function () {\\n    throw new NotSupportedError();\\n  };\\n\\n  // Shim in iterator support\\n  var $iterator$ = (typeof Symbol === \\'function\\' && Symbol.iterator) ||\\n    \\'_es6shim_iterator_\\';\\n  // Bug for mozilla version\\n  if (root.Set && typeof new root.Set()[\\'@@iterator\\'] === \\'function\\') {\\n    $iterator$ = \\'@@iterator\\';\\n  }\\n\\n  var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };\\n\\n  var isIterable = Rx.helpers.isIterable = function (o) {\\n    return o && o[$iterator$] !== undefined;\\n  };\\n\\n  var isArrayLike = Rx.helpers.isArrayLike = function (o) {\\n    return o && o.length !== undefined;\\n  };\\n\\n  Rx.helpers.iterator = $iterator$;\\n\\n  var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {\\n    if (typeof thisArg === \\'undefined\\') { return func; }\\n    switch(argCount) {\\n      case 0:\\n        return function() {\\n          return func.call(thisArg)\\n        };\\n      case 1:\\n        return function(arg) {\\n          return func.call(thisArg, arg);\\n        };\\n      case 2:\\n        return function(value, index) {\\n          return func.call(thisArg, value, index);\\n        };\\n      case 3:\\n        return function(value, index, collection) {\\n          return func.call(thisArg, value, index, collection);\\n        };\\n    }\\n\\n    return function() {\\n      return func.apply(thisArg, arguments);\\n    };\\n  };\\n\\n  /** Used to determine if values are of the language type Object */\\n  var dontEnums = [\\'toString\\',\\n    \\'toLocaleString\\',\\n    \\'valueOf\\',\\n    \\'hasOwnProperty\\',\\n    \\'isPrototypeOf\\',\\n    \\'propertyIsEnumerable\\',\\n    \\'constructor\\'],\\n  dontEnumsLength = dontEnums.length;\\n\\nvar argsTag = \\'[object Arguments]\\',\\n    arrayTag = \\'[object Array]\\',\\n    boolTag = \\'[object Boolean]\\',\\n    dateTag = \\'[object Date]\\',\\n    errorTag = \\'[object Error]\\',\\n    funcTag = \\'[object Function]\\',\\n    mapTag = \\'[object Map]\\',\\n    numberTag = \\'[object Number]\\',\\n    objectTag = \\'[object Object]\\',\\n    regexpTag = \\'[object RegExp]\\',\\n    setTag = \\'[object Set]\\',\\n    stringTag = \\'[object String]\\',\\n    weakMapTag = \\'[object WeakMap]\\';\\n\\nvar arrayBufferTag = \\'[object ArrayBuffer]\\',\\n    float32Tag = \\'[object Float32Array]\\',\\n    float64Tag = \\'[object Float64Array]\\',\\n    int8Tag = \\'[object Int8Array]\\',\\n    int16Tag = \\'[object Int16Array]\\',\\n    int32Tag = \\'[object Int32Array]\\',\\n    uint8Tag = \\'[object Uint8Array]\\',\\n    uint8ClampedTag = \\'[object Uint8ClampedArray]\\',\\n    uint16Tag = \\'[object Uint16Array]\\',\\n    uint32Tag = \\'[object Uint32Array]\\';\\n\\nvar typedArrayTags = {};\\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\\ntypedArrayTags[uint32Tag] = true;\\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\\n\\nvar objectProto = Object.prototype,\\n    hasOwnProperty = objectProto.hasOwnProperty,\\n    objToString = objectProto.toString,\\n    MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;\\n\\nvar keys = Object.keys || (function() {\\n    var hasOwnProperty = Object.prototype.hasOwnProperty,\\n        hasDontEnumBug = !({ toString: null }).propertyIsEnumerable(\\'toString\\'),\\n        dontEnums = [\\n          \\'toString\\',\\n          \\'toLocaleString\\',\\n          \\'valueOf\\',\\n          \\'hasOwnProperty\\',\\n          \\'isPrototypeOf\\',\\n          \\'propertyIsEnumerable\\',\\n          \\'constructor\\'\\n        ],\\n        dontEnumsLength = dontEnums.length;\\n\\n    return function(obj) {\\n      if (typeof obj !== \\'object\\' && (typeof obj !== \\'function\\' || obj === null)) {\\n        throw new TypeError(\\'Object.keys called on non-object\\');\\n      }\\n\\n      var result = [], prop, i;\\n\\n      for (prop in obj) {\\n        if (hasOwnProperty.call(obj, prop)) {\\n          result.push(prop);\\n        }\\n      }\\n\\n      if (hasDontEnumBug) {\\n        for (i = 0; i < dontEnumsLength; i++) {\\n          if (hasOwnProperty.call(obj, dontEnums[i])) {\\n            result.push(dontEnums[i]);\\n          }\\n        }\\n      }\\n      return result;\\n    };\\n  }());\\n\\nfunction equalObjects(object, other, equalFunc, isLoose, stackA, stackB) {\\n  var objProps = keys(object),\\n      objLength = objProps.length,\\n      othProps = keys(other),\\n      othLength = othProps.length;\\n\\n  if (objLength !== othLength && !isLoose) {\\n    return false;\\n  }\\n  var index = objLength, key;\\n  while (index--) {\\n    key = objProps[index];\\n    if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {\\n      return false;\\n    }\\n  }\\n  var skipCtor = isLoose;\\n  while (++index < objLength) {\\n    key = objProps[index];\\n    var objValue = object[key],\\n        othValue = other[key],\\n        result;\\n\\n    if (!(result === undefined ? equalFunc(objValue, othValue, isLoose, stackA, stackB) : result)) {\\n      return false;\\n    }\\n    skipCtor || (skipCtor = key === \\'constructor\\');\\n  }\\n  if (!skipCtor) {\\n    var objCtor = object.constructor,\\n        othCtor = other.constructor;\\n\\n    if (objCtor !== othCtor &&\\n        (\\'constructor\\' in object && \\'constructor\\' in other) &&\\n        !(typeof objCtor === \\'function\\' && objCtor instanceof objCtor &&\\n          typeof othCtor === \\'function\\' && othCtor instanceof othCtor)) {\\n      return false;\\n    }\\n  }\\n  return true;\\n}\\n\\nfunction equalByTag(object, other, tag) {\\n  switch (tag) {\\n    case boolTag:\\n    case dateTag:\\n      return +object === +other;\\n\\n    case errorTag:\\n      return object.name === other.name && object.message === other.message;\\n\\n    case numberTag:\\n      return (object !== +object) ?\\n        other !== +other :\\n        object === +other;\\n\\n    case regexpTag:\\n    case stringTag:\\n      return object === (other + \\'\\');\\n  }\\n  return false;\\n}\\n\\nvar isObject = Rx.internals.isObject = function(value) {\\n  var type = typeof value;\\n  return !!value && (type === \\'object\\' || type === \\'function\\');\\n};\\n\\nfunction isObjectLike(value) {\\n  return !!value && typeof value === \\'object\\';\\n}\\n\\nfunction isLength(value) {\\n  return typeof value === \\'number\\' && value > -1 && value % 1 === 0 && value <= MAX_SAFE_INTEGER;\\n}\\n\\nvar isHostObject = (function() {\\n  try {\\n    Object({ \\'toString\\': 0 } + \\'\\');\\n  } catch(e) {\\n    return function() { return false; };\\n  }\\n  return function(value) {\\n    return typeof value.toString !== \\'function\\' && typeof (value + \\'\\') === \\'string\\';\\n  };\\n}());\\n\\nfunction isTypedArray(value) {\\n  return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\\n}\\n\\nvar isArray = Array.isArray || function(value) {\\n  return isObjectLike(value) && isLength(value.length) && objToString.call(value) === arrayTag;\\n};\\n\\nfunction arraySome (array, predicate) {\\n  var index = -1,\\n      length = array.length;\\n\\n  while (++index < length) {\\n    if (predicate(array[index], index, array)) {\\n      return true;\\n    }\\n  }\\n  return false;\\n}\\n\\nfunction equalArrays(array, other, equalFunc, isLoose, stackA, stackB) {\\n  var index = -1,\\n      arrLength = array.length,\\n      othLength = other.length;\\n\\n  if (arrLength !== othLength && !(isLoose && othLength > arrLength)) {\\n    return false;\\n  }\\n  // Ignore non-index properties.\\n  while (++index < arrLength) {\\n    var arrValue = array[index],\\n        othValue = other[index],\\n        result;\\n\\n    if (result !== undefined) {\\n      if (result) {\\n        continue;\\n      }\\n      return false;\\n    }\\n    // Recursively compare arrays (susceptible to call stack limits).\\n    if (isLoose) {\\n      if (!arraySome(other, function(othValue) {\\n            return arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB);\\n          })) {\\n        return false;\\n      }\\n    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB))) {\\n      return false;\\n    }\\n  }\\n  return true;\\n}\\n\\nfunction baseIsEqualDeep(object, other, equalFunc, isLoose, stackA, stackB) {\\n  var objIsArr = isArray(object),\\n      othIsArr = isArray(other),\\n      objTag = arrayTag,\\n      othTag = arrayTag;\\n\\n  if (!objIsArr) {\\n    objTag = objToString.call(object);\\n    if (objTag === argsTag) {\\n      objTag = objectTag;\\n    } else if (objTag !== objectTag) {\\n      objIsArr = isTypedArray(object);\\n    }\\n  }\\n  if (!othIsArr) {\\n    othTag = objToString.call(other);\\n    if (othTag === argsTag) {\\n      othTag = objectTag;\\n    }\\n  }\\n  var objIsObj = objTag === objectTag && !isHostObject(object),\\n      othIsObj = othTag === objectTag && !isHostObject(other),\\n      isSameTag = objTag === othTag;\\n\\n  if (isSameTag && !(objIsArr || objIsObj)) {\\n    return equalByTag(object, other, objTag);\\n  }\\n  if (!isLoose) {\\n    var objIsWrapped = objIsObj && hasOwnProperty.call(object, \\'__wrapped__\\'),\\n        othIsWrapped = othIsObj && hasOwnProperty.call(other, \\'__wrapped__\\');\\n\\n    if (objIsWrapped || othIsWrapped) {\\n      return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, isLoose, stackA, stackB);\\n    }\\n  }\\n  if (!isSameTag) {\\n    return false;\\n  }\\n  // Assume cyclic values are equal.\\n  // For more information on detecting circular references see https://es5.github.io/#JO.\\n  stackA || (stackA = []);\\n  stackB || (stackB = []);\\n\\n  var length = stackA.length;\\n  while (length--) {\\n    if (stackA[length] === object) {\\n      return stackB[length] === other;\\n    }\\n  }\\n  // Add `object` and `other` to the stack of traversed objects.\\n  stackA.push(object);\\n  stackB.push(other);\\n\\n  var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, isLoose, stackA, stackB);\\n\\n  stackA.pop();\\n  stackB.pop();\\n\\n  return result;\\n}\\n\\nfunction baseIsEqual(value, other, isLoose, stackA, stackB) {\\n  if (value === other) {\\n    return true;\\n  }\\n  if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\\n    return value !== value && other !== other;\\n  }\\n  return baseIsEqualDeep(value, other, baseIsEqual, isLoose, stackA, stackB);\\n}\\n\\nvar isEqual = Rx.internals.isEqual = function (value, other) {\\n  return baseIsEqual(value, other);\\n};\\n\\n  var hasProp = {}.hasOwnProperty,\\n      slice = Array.prototype.slice;\\n\\n  var inherits = Rx.internals.inherits = function (child, parent) {\\n    function __() { this.constructor = child; }\\n    __.prototype = parent.prototype;\\n    child.prototype = new __();\\n  };\\n\\n  var addProperties = Rx.internals.addProperties = function (obj) {\\n    for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }\\n    for (var idx = 0, ln = sources.length; idx < ln; idx++) {\\n      var source = sources[idx];\\n      for (var prop in source) {\\n        obj[prop] = source[prop];\\n      }\\n    }\\n  };\\n\\n  // Rx Utils\\n  var addRef = Rx.internals.addRef = function (xs, r) {\\n    return new AnonymousObservable(function (observer) {\\n      return new BinaryDisposable(r.getDisposable(), xs.subscribe(observer));\\n    });\\n  };\\n\\n  function arrayInitialize(count, factory) {\\n    var a = new Array(count);\\n    for (var i = 0; i < count; i++) {\\n      a[i] = factory();\\n    }\\n    return a;\\n  }\\n\\n  function IndexedItem(id, value) {\\n    this.id = id;\\n    this.value = value;\\n  }\\n\\n  IndexedItem.prototype.compareTo = function (other) {\\n    var c = this.value.compareTo(other.value);\\n    c === 0 && (c = this.id - other.id);\\n    return c;\\n  };\\n\\n  var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {\\n    this.items = new Array(capacity);\\n    this.length = 0;\\n  };\\n\\n  var priorityProto = PriorityQueue.prototype;\\n  priorityProto.isHigherPriority = function (left, right) {\\n    return this.items[left].compareTo(this.items[right]) < 0;\\n  };\\n\\n  priorityProto.percolate = function (index) {\\n    if (index >= this.length || index < 0) { return; }\\n    var parent = index - 1 >> 1;\\n    if (parent < 0 || parent === index) { return; }\\n    if (this.isHigherPriority(index, parent)) {\\n      var temp = this.items[index];\\n      this.items[index] = this.items[parent];\\n      this.items[parent] = temp;\\n      this.percolate(parent);\\n    }\\n  };\\n\\n  priorityProto.heapify = function (index) {\\n    +index || (index = 0);\\n    if (index >= this.length || index < 0) { return; }\\n    var left = 2 * index + 1,\\n        right = 2 * index + 2,\\n        first = index;\\n    if (left < this.length && this.isHigherPriority(left, first)) {\\n      first = left;\\n    }\\n    if (right < this.length && this.isHigherPriority(right, first)) {\\n      first = right;\\n    }\\n    if (first !== index) {\\n      var temp = this.items[index];\\n      this.items[index] = this.items[first];\\n      this.items[first] = temp;\\n      this.heapify(first);\\n    }\\n  };\\n\\n  priorityProto.peek = function () { return this.items[0].value; };\\n\\n  priorityProto.removeAt = function (index) {\\n    this.items[index] = this.items[--this.length];\\n    this.items[this.length] = undefined;\\n    this.heapify();\\n  };\\n\\n  priorityProto.dequeue = function () {\\n    var result = this.peek();\\n    this.removeAt(0);\\n    return result;\\n  };\\n\\n  priorityProto.enqueue = function (item) {\\n    var index = this.length++;\\n    this.items[index] = new IndexedItem(PriorityQueue.count++, item);\\n    this.percolate(index);\\n  };\\n\\n  priorityProto.remove = function (item) {\\n    for (var i = 0; i < this.length; i++) {\\n      if (this.items[i].value === item) {\\n        this.removeAt(i);\\n        return true;\\n      }\\n    }\\n    return false;\\n  };\\n  PriorityQueue.count = 0;\\n\\n  /**\\n   * Represents a group of disposable resources that are disposed together.\\n   * @constructor\\n   */\\n  var CompositeDisposable = Rx.CompositeDisposable = function () {\\n    var args = [], i, len;\\n    if (Array.isArray(arguments[0])) {\\n      args = arguments[0];\\n    } else {\\n      len = arguments.length;\\n      args = new Array(len);\\n      for(i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    }\\n    this.disposables = args;\\n    this.isDisposed = false;\\n    this.length = args.length;\\n  };\\n\\n  var CompositeDisposablePrototype = CompositeDisposable.prototype;\\n\\n  /**\\n   * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.\\n   * @param {Mixed} item Disposable to add.\\n   */\\n  CompositeDisposablePrototype.add = function (item) {\\n    if (this.isDisposed) {\\n      item.dispose();\\n    } else {\\n      this.disposables.push(item);\\n      this.length++;\\n    }\\n  };\\n\\n  /**\\n   * Removes and disposes the first occurrence of a disposable from the CompositeDisposable.\\n   * @param {Mixed} item Disposable to remove.\\n   * @returns {Boolean} true if found; false otherwise.\\n   */\\n  CompositeDisposablePrototype.remove = function (item) {\\n    var shouldDispose = false;\\n    if (!this.isDisposed) {\\n      var idx = this.disposables.indexOf(item);\\n      if (idx !== -1) {\\n        shouldDispose = true;\\n        this.disposables.splice(idx, 1);\\n        this.length--;\\n        item.dispose();\\n      }\\n    }\\n    return shouldDispose;\\n  };\\n\\n  /**\\n   *  Disposes all disposables in the group and removes them from the group.\\n   */\\n  CompositeDisposablePrototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this.isDisposed = true;\\n      var len = this.disposables.length, currentDisposables = new Array(len);\\n      for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }\\n      this.disposables = [];\\n      this.length = 0;\\n\\n      for (i = 0; i < len; i++) {\\n        currentDisposables[i].dispose();\\n      }\\n    }\\n  };\\n\\n  /**\\n   * Provides a set of static methods for creating Disposables.\\n   * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.\\n   */\\n  var Disposable = Rx.Disposable = function (action) {\\n    this.isDisposed = false;\\n    this.action = action || noop;\\n  };\\n\\n  /** Performs the task of cleaning up resources. */\\n  Disposable.prototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this.action();\\n      this.isDisposed = true;\\n    }\\n  };\\n\\n  /**\\n   * Creates a disposable object that invokes the specified action when disposed.\\n   * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.\\n   * @return {Disposable} The disposable object that runs the given action upon disposal.\\n   */\\n  var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };\\n\\n  /**\\n   * Gets the disposable that does nothing when disposed.\\n   */\\n  var disposableEmpty = Disposable.empty = { dispose: noop };\\n\\n  /**\\n   * Validates whether the given object is a disposable\\n   * @param {Object} Object to test whether it has a dispose method\\n   * @returns {Boolean} true if a disposable object, else false.\\n   */\\n  var isDisposable = Disposable.isDisposable = function (d) {\\n    return d && isFunction(d.dispose);\\n  };\\n\\n  var checkDisposed = Disposable.checkDisposed = function (disposable) {\\n    if (disposable.isDisposed) { throw new ObjectDisposedError(); }\\n  };\\n\\n  var disposableFixup = Disposable._fixup = function (result) {\\n    return isDisposable(result) ? result : disposableEmpty;\\n  };\\n\\n  // Single assignment\\n  var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {\\n    this.isDisposed = false;\\n    this.current = null;\\n  };\\n  SingleAssignmentDisposable.prototype.getDisposable = function () {\\n    return this.current;\\n  };\\n  SingleAssignmentDisposable.prototype.setDisposable = function (value) {\\n    if (this.current) { throw new Error(\\'Disposable has already been assigned\\'); }\\n    var shouldDispose = this.isDisposed;\\n    !shouldDispose && (this.current = value);\\n    shouldDispose && value && value.dispose();\\n  };\\n  SingleAssignmentDisposable.prototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this.isDisposed = true;\\n      var old = this.current;\\n      this.current = null;\\n      old && old.dispose();\\n    }\\n  };\\n\\n  // Multiple assignment disposable\\n  var SerialDisposable = Rx.SerialDisposable = function () {\\n    this.isDisposed = false;\\n    this.current = null;\\n  };\\n  SerialDisposable.prototype.getDisposable = function () {\\n    return this.current;\\n  };\\n  SerialDisposable.prototype.setDisposable = function (value) {\\n    var shouldDispose = this.isDisposed;\\n    if (!shouldDispose) {\\n      var old = this.current;\\n      this.current = value;\\n    }\\n    old && old.dispose();\\n    shouldDispose && value && value.dispose();\\n  };\\n  SerialDisposable.prototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this.isDisposed = true;\\n      var old = this.current;\\n      this.current = null;\\n    }\\n    old && old.dispose();\\n  };\\n\\n  var BinaryDisposable = Rx.BinaryDisposable = function (first, second) {\\n    this._first = first;\\n    this._second = second;\\n    this.isDisposed = false;\\n  };\\n\\n  BinaryDisposable.prototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this.isDisposed = true;\\n      var old1 = this._first;\\n      this._first = null;\\n      old1 && old1.dispose();\\n      var old2 = this._second;\\n      this._second = null;\\n      old2 && old2.dispose();\\n    }\\n  };\\n\\n  var NAryDisposable = Rx.NAryDisposable = function (disposables) {\\n    this._disposables = disposables;\\n    this.isDisposed = false;\\n  };\\n\\n  NAryDisposable.prototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this.isDisposed = true;\\n      for (var i = 0, len = this._disposables.length; i < len; i++) {\\n        this._disposables[i].dispose();\\n      }\\n      this._disposables.length = 0;\\n    }\\n  };\\n\\n  /**\\n   * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.\\n   */\\n  var RefCountDisposable = Rx.RefCountDisposable = (function () {\\n\\n    function InnerDisposable(disposable) {\\n      this.disposable = disposable;\\n      this.disposable.count++;\\n      this.isInnerDisposed = false;\\n    }\\n\\n    InnerDisposable.prototype.dispose = function () {\\n      if (!this.disposable.isDisposed && !this.isInnerDisposed) {\\n        this.isInnerDisposed = true;\\n        this.disposable.count--;\\n        if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {\\n          this.disposable.isDisposed = true;\\n          this.disposable.underlyingDisposable.dispose();\\n        }\\n      }\\n    };\\n\\n    /**\\n     * Initializes a new instance of the RefCountDisposable with the specified disposable.\\n     * @constructor\\n     * @param {Disposable} disposable Underlying disposable.\\n      */\\n    function RefCountDisposable(disposable) {\\n      this.underlyingDisposable = disposable;\\n      this.isDisposed = false;\\n      this.isPrimaryDisposed = false;\\n      this.count = 0;\\n    }\\n\\n    /**\\n     * Disposes the underlying disposable only when all dependent disposables have been disposed\\n     */\\n    RefCountDisposable.prototype.dispose = function () {\\n      if (!this.isDisposed && !this.isPrimaryDisposed) {\\n        this.isPrimaryDisposed = true;\\n        if (this.count === 0) {\\n          this.isDisposed = true;\\n          this.underlyingDisposable.dispose();\\n        }\\n      }\\n    };\\n\\n    /**\\n     * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.\\n     * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable\\'s lifetime.\\n     */\\n    RefCountDisposable.prototype.getDisposable = function () {\\n      return this.isDisposed ? disposableEmpty : new InnerDisposable(this);\\n    };\\n\\n    return RefCountDisposable;\\n  })();\\n\\n  function ScheduledDisposable(scheduler, disposable) {\\n    this.scheduler = scheduler;\\n    this.disposable = disposable;\\n    this.isDisposed = false;\\n  }\\n\\n  function scheduleItem(s, self) {\\n    if (!self.isDisposed) {\\n      self.isDisposed = true;\\n      self.disposable.dispose();\\n    }\\n  }\\n\\n  ScheduledDisposable.prototype.dispose = function () {\\n    this.scheduler.schedule(this, scheduleItem);\\n  };\\n\\n  var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {\\n    this.scheduler = scheduler;\\n    this.state = state;\\n    this.action = action;\\n    this.dueTime = dueTime;\\n    this.comparer = comparer || defaultSubComparer;\\n    this.disposable = new SingleAssignmentDisposable();\\n  };\\n\\n  ScheduledItem.prototype.invoke = function () {\\n    this.disposable.setDisposable(this.invokeCore());\\n  };\\n\\n  ScheduledItem.prototype.compareTo = function (other) {\\n    return this.comparer(this.dueTime, other.dueTime);\\n  };\\n\\n  ScheduledItem.prototype.isCancelled = function () {\\n    return this.disposable.isDisposed;\\n  };\\n\\n  ScheduledItem.prototype.invokeCore = function () {\\n    return disposableFixup(this.action(this.scheduler, this.state));\\n  };\\n\\n  /** Provides a set of static properties to access commonly used schedulers. */\\n  var Scheduler = Rx.Scheduler = (function () {\\n\\n    function Scheduler() { }\\n\\n    /** Determines whether the given object is a scheduler */\\n    Scheduler.isScheduler = function (s) {\\n      return s instanceof Scheduler;\\n    };\\n\\n    var schedulerProto = Scheduler.prototype;\\n\\n    /**\\n   * Schedules an action to be executed.\\n   * @param state State passed to the action to be executed.\\n   * @param {Function} action Action to be executed.\\n   * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\\n   */\\n    schedulerProto.schedule = function (state, action) {\\n      throw new NotImplementedError();\\n    };\\n\\n  /**\\n   * Schedules an action to be executed after dueTime.\\n   * @param state State passed to the action to be executed.\\n   * @param {Function} action Action to be executed.\\n   * @param {Number} dueTime Relative time after which to execute the action.\\n   * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\\n   */\\n    schedulerProto.scheduleFuture = function (state, dueTime, action) {\\n      var dt = dueTime;\\n      dt instanceof Date && (dt = dt - this.now());\\n      dt = Scheduler.normalize(dt);\\n\\n      if (dt === 0) { return this.schedule(state, action); }\\n\\n      return this._scheduleFuture(state, dt, action);\\n    };\\n\\n    schedulerProto._scheduleFuture = function (state, dueTime, action) {\\n      throw new NotImplementedError();\\n    };\\n\\n    /** Gets the current time according to the local machine\\'s system clock. */\\n    Scheduler.now = defaultNow;\\n\\n    /** Gets the current time according to the local machine\\'s system clock. */\\n    Scheduler.prototype.now = defaultNow;\\n\\n    /**\\n     * Normalizes the specified TimeSpan value to a positive value.\\n     * @param {Number} timeSpan The time span value to normalize.\\n     * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0\\n     */\\n    Scheduler.normalize = function (timeSpan) {\\n      timeSpan < 0 && (timeSpan = 0);\\n      return timeSpan;\\n    };\\n\\n    return Scheduler;\\n  }());\\n\\n  var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler;\\n\\n  (function (schedulerProto) {\\n\\n    function invokeRecImmediate(scheduler, pair) {\\n      var state = pair[0], action = pair[1], group = new CompositeDisposable();\\n      action(state, innerAction);\\n      return group;\\n\\n      function innerAction(state2) {\\n        var isAdded = false, isDone = false;\\n\\n        var d = scheduler.schedule(state2, scheduleWork);\\n        if (!isDone) {\\n          group.add(d);\\n          isAdded = true;\\n        }\\n\\n        function scheduleWork(_, state3) {\\n          if (isAdded) {\\n            group.remove(d);\\n          } else {\\n            isDone = true;\\n          }\\n          action(state3, innerAction);\\n          return disposableEmpty;\\n        }\\n      }\\n    }\\n\\n    function invokeRecDate(scheduler, pair) {\\n      var state = pair[0], action = pair[1], group = new CompositeDisposable();\\n      action(state, innerAction);\\n      return group;\\n\\n      function innerAction(state2, dueTime1) {\\n        var isAdded = false, isDone = false;\\n\\n        var d = scheduler.scheduleFuture(state2, dueTime1, scheduleWork);\\n        if (!isDone) {\\n          group.add(d);\\n          isAdded = true;\\n        }\\n\\n        function scheduleWork(_, state3) {\\n          if (isAdded) {\\n            group.remove(d);\\n          } else {\\n            isDone = true;\\n          }\\n          action(state3, innerAction);\\n          return disposableEmpty;\\n        }\\n      }\\n    }\\n\\n    /**\\n     * Schedules an action to be executed recursively.\\n     * @param {Mixed} state State passed to the action to be executed.\\n     * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.\\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\\n     */\\n    schedulerProto.scheduleRecursive = function (state, action) {\\n      return this.schedule([state, action], invokeRecImmediate);\\n    };\\n\\n    /**\\n     * Schedules an action to be executed recursively after a specified relative or absolute due time.\\n     * @param {Mixed} state State passed to the action to be executed.\\n     * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.\\n     * @param {Number | Date} dueTime Relative or absolute time after which to execute the action for the first time.\\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\\n     */\\n    schedulerProto.scheduleRecursiveFuture = function (state, dueTime, action) {\\n      return this.scheduleFuture([state, action], dueTime, invokeRecDate);\\n    };\\n\\n  }(Scheduler.prototype));\\n\\n  (function (schedulerProto) {\\n\\n    /**\\n     * Schedules a periodic piece of work by dynamically discovering the scheduler\\'s capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.\\n     * @param {Mixed} state Initial state passed to the action upon the first iteration.\\n     * @param {Number} period Period for running the work periodically.\\n     * @param {Function} action Action to be executed, potentially updating the state.\\n     * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).\\n     */\\n    schedulerProto.schedulePeriodic = function(state, period, action) {\\n      if (typeof root.setInterval === \\'undefined\\') { throw new NotSupportedError(); }\\n      period = normalizeTime(period);\\n      var s = state, id = root.setInterval(function () { s = action(s); }, period);\\n      return disposableCreate(function () { root.clearInterval(id); });\\n    };\\n\\n  }(Scheduler.prototype));\\n\\n  (function (schedulerProto) {\\n    /**\\n     * Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.\\n     * @param {Function} handler Handler that\\'s run if an exception is caught. The exception will be rethrown if the handler returns false.\\n     * @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.\\n     */\\n    schedulerProto.catchError = schedulerProto[\\'catch\\'] = function (handler) {\\n      return new CatchScheduler(this, handler);\\n    };\\n  }(Scheduler.prototype));\\n\\n  var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {\\n    function createTick(self) {\\n      return function tick(command, recurse) {\\n        recurse(0, self._period);\\n        var state = tryCatch(self._action)(self._state);\\n        if (state === errorObj) {\\n          self._cancel.dispose();\\n          thrower(state.e);\\n        }\\n        self._state = state;\\n      };\\n    }\\n\\n    function SchedulePeriodicRecursive(scheduler, state, period, action) {\\n      this._scheduler = scheduler;\\n      this._state = state;\\n      this._period = period;\\n      this._action = action;\\n    }\\n\\n    SchedulePeriodicRecursive.prototype.start = function () {\\n      var d = new SingleAssignmentDisposable();\\n      this._cancel = d;\\n      d.setDisposable(this._scheduler.scheduleRecursiveFuture(0, this._period, createTick(this)));\\n\\n      return d;\\n    };\\n\\n    return SchedulePeriodicRecursive;\\n  }());\\n\\n  /** Gets a scheduler that schedules work immediately on the current thread. */\\n   var ImmediateScheduler = (function (__super__) {\\n    inherits(ImmediateScheduler, __super__);\\n    function ImmediateScheduler() {\\n      __super__.call(this);\\n    }\\n\\n    ImmediateScheduler.prototype.schedule = function (state, action) {\\n      return disposableFixup(action(this, state));\\n    };\\n\\n    return ImmediateScheduler;\\n  }(Scheduler));\\n\\n  var immediateScheduler = Scheduler.immediate = new ImmediateScheduler();\\n\\n  /**\\n   * Gets a scheduler that schedules work as soon as possible on the current thread.\\n   */\\n  var CurrentThreadScheduler = (function (__super__) {\\n    var queue;\\n\\n    function runTrampoline () {\\n      while (queue.length > 0) {\\n        var item = queue.dequeue();\\n        !item.isCancelled() && item.invoke();\\n      }\\n    }\\n\\n    inherits(CurrentThreadScheduler, __super__);\\n    function CurrentThreadScheduler() {\\n      __super__.call(this);\\n    }\\n\\n    CurrentThreadScheduler.prototype.schedule = function (state, action) {\\n      var si = new ScheduledItem(this, state, action, this.now());\\n\\n      if (!queue) {\\n        queue = new PriorityQueue(4);\\n        queue.enqueue(si);\\n\\n        var result = tryCatch(runTrampoline)();\\n        queue = null;\\n        if (result === errorObj) { thrower(result.e); }\\n      } else {\\n        queue.enqueue(si);\\n      }\\n      return si.disposable;\\n    };\\n\\n    CurrentThreadScheduler.prototype.scheduleRequired = function () { return !queue; };\\n\\n    return CurrentThreadScheduler;\\n  }(Scheduler));\\n\\n  var currentThreadScheduler = Scheduler.currentThread = new CurrentThreadScheduler();\\n\\n  var scheduleMethod, clearMethod;\\n\\n  var localTimer = (function () {\\n    var localSetTimeout, localClearTimeout = noop;\\n    if (!!root.setTimeout) {\\n      localSetTimeout = root.setTimeout;\\n      localClearTimeout = root.clearTimeout;\\n    } else if (!!root.WScript) {\\n      localSetTimeout = function (fn, time) {\\n        root.WScript.Sleep(time);\\n        fn();\\n      };\\n    } else {\\n      throw new NotSupportedError();\\n    }\\n\\n    return {\\n      setTimeout: localSetTimeout,\\n      clearTimeout: localClearTimeout\\n    };\\n  }());\\n  var localSetTimeout = localTimer.setTimeout,\\n    localClearTimeout = localTimer.clearTimeout;\\n\\n  (function () {\\n\\n    var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;\\n\\n    clearMethod = function (handle) {\\n      delete tasksByHandle[handle];\\n    };\\n\\n    function runTask(handle) {\\n      if (currentlyRunning) {\\n        localSetTimeout(function () { runTask(handle); }, 0);\\n      } else {\\n        var task = tasksByHandle[handle];\\n        if (task) {\\n          currentlyRunning = true;\\n          var result = tryCatch(task)();\\n          clearMethod(handle);\\n          currentlyRunning = false;\\n          if (result === errorObj) { thrower(result.e); }\\n        }\\n      }\\n    }\\n\\n    var reNative = new RegExp(\\'^\\' +\\n      String(toString)\\n        .replace(/[.*+?^${}()|[\\\\]\\\\\\\\]/g, \\'\\\\\\\\$&\\')\\n        .replace(/toString| for [^\\\\]]+/g, \\'.*?\\') + \\'$\\'\\n    );\\n\\n    var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == \\'function\\' &&\\n      !reNative.test(setImmediate) && setImmediate;\\n\\n    function postMessageSupported () {\\n      // Ensure not in a worker\\n      if (!root.postMessage || root.importScripts) { return false; }\\n      var isAsync = false, oldHandler = root.onmessage;\\n      // Test for async\\n      root.onmessage = function () { isAsync = true; };\\n      root.postMessage(\\'\\', \\'*\\');\\n      root.onmessage = oldHandler;\\n\\n      return isAsync;\\n    }\\n\\n    // Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout\\n    if (isFunction(setImmediate)) {\\n      scheduleMethod = function (action) {\\n        var id = nextHandle++;\\n        tasksByHandle[id] = action;\\n        setImmediate(function () { runTask(id); });\\n\\n        return id;\\n      };\\n    } else if (typeof process !== \\'undefined\\' && {}.toString.call(process) === \\'[object process]\\') {\\n      scheduleMethod = function (action) {\\n        var id = nextHandle++;\\n        tasksByHandle[id] = action;\\n        process.nextTick(function () { runTask(id); });\\n\\n        return id;\\n      };\\n    } else if (postMessageSupported()) {\\n      var MSG_PREFIX = \\'ms.rx.schedule\\' + Math.random();\\n\\n      var onGlobalPostMessage = function (event) {\\n        // Only if we\\'re a match to avoid any other global events\\n        if (typeof event.data === \\'string\\' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {\\n          runTask(event.data.substring(MSG_PREFIX.length));\\n        }\\n      };\\n\\n      root.addEventListener(\\'message\\', onGlobalPostMessage, false);\\n\\n      scheduleMethod = function (action) {\\n        var id = nextHandle++;\\n        tasksByHandle[id] = action;\\n        root.postMessage(MSG_PREFIX + id, \\'*\\');\\n        return id;\\n      };\\n    } else if (!!root.MessageChannel) {\\n      var channel = new root.MessageChannel();\\n\\n      channel.port1.onmessage = function (e) { runTask(e.data); };\\n\\n      scheduleMethod = function (action) {\\n        var id = nextHandle++;\\n        tasksByHandle[id] = action;\\n        channel.port2.postMessage(id);\\n        return id;\\n      };\\n    } else if (\\'document\\' in root && \\'onreadystatechange\\' in root.document.createElement(\\'script\\')) {\\n\\n      scheduleMethod = function (action) {\\n        var scriptElement = root.document.createElement(\\'script\\');\\n        var id = nextHandle++;\\n        tasksByHandle[id] = action;\\n\\n        scriptElement.onreadystatechange = function () {\\n          runTask(id);\\n          scriptElement.onreadystatechange = null;\\n          scriptElement.parentNode.removeChild(scriptElement);\\n          scriptElement = null;\\n        };\\n        root.document.documentElement.appendChild(scriptElement);\\n        return id;\\n      };\\n\\n    } else {\\n      scheduleMethod = function (action) {\\n        var id = nextHandle++;\\n        tasksByHandle[id] = action;\\n        localSetTimeout(function () {\\n          runTask(id);\\n        }, 0);\\n\\n        return id;\\n      };\\n    }\\n  }());\\n\\n  /**\\n   * Gets a scheduler that schedules work via a timed callback based upon platform.\\n   */\\n   var DefaultScheduler = (function (__super__) {\\n     inherits(DefaultScheduler, __super__);\\n     function DefaultScheduler() {\\n       __super__.call(this);\\n     }\\n\\n     function scheduleAction(disposable, action, scheduler, state) {\\n       return function schedule() {\\n         disposable.setDisposable(Disposable._fixup(action(scheduler, state)));\\n       };\\n     }\\n\\n     function ClearDisposable(id) {\\n       this._id = id;\\n       this.isDisposed = false;\\n     }\\n\\n     ClearDisposable.prototype.dispose = function () {\\n       if (!this.isDisposed) {\\n         this.isDisposed = true;\\n         clearMethod(this._id);\\n       }\\n     };\\n\\n     function LocalClearDisposable(id) {\\n       this._id = id;\\n       this.isDisposed = false;\\n     }\\n\\n     LocalClearDisposable.prototype.dispose = function () {\\n       if (!this.isDisposed) {\\n         this.isDisposed = true;\\n         localClearTimeout(this._id);\\n       }\\n     };\\n\\n    DefaultScheduler.prototype.schedule = function (state, action) {\\n      var disposable = new SingleAssignmentDisposable(),\\n          id = scheduleMethod(scheduleAction(disposable, action, this, state));\\n      return new BinaryDisposable(disposable, new ClearDisposable(id));\\n    };\\n\\n    DefaultScheduler.prototype._scheduleFuture = function (state, dueTime, action) {\\n      if (dueTime === 0) { return this.schedule(state, action); }\\n      var disposable = new SingleAssignmentDisposable(),\\n          id = localSetTimeout(scheduleAction(disposable, action, this, state), dueTime);\\n      return new BinaryDisposable(disposable, new LocalClearDisposable(id));\\n    };\\n\\n    function scheduleLongRunning(state, action, disposable) {\\n      return function () { action(state, disposable); };\\n    }\\n\\n    DefaultScheduler.prototype.scheduleLongRunning = function (state, action) {\\n      var disposable = disposableCreate(noop);\\n      scheduleMethod(scheduleLongRunning(state, action, disposable));\\n      return disposable;\\n    };\\n\\n    return DefaultScheduler;\\n  }(Scheduler));\\n\\n  var defaultScheduler = Scheduler[\\'default\\'] = Scheduler.async = new DefaultScheduler();\\n\\n  var CatchScheduler = (function (__super__) {\\n    inherits(CatchScheduler, __super__);\\n\\n    function CatchScheduler(scheduler, handler) {\\n      this._scheduler = scheduler;\\n      this._handler = handler;\\n      this._recursiveOriginal = null;\\n      this._recursiveWrapper = null;\\n      __super__.call(this);\\n    }\\n\\n    CatchScheduler.prototype.schedule = function (state, action) {\\n      return this._scheduler.schedule(state, this._wrap(action));\\n    };\\n\\n    CatchScheduler.prototype._scheduleFuture = function (state, dueTime, action) {\\n      return this._scheduler.schedule(state, dueTime, this._wrap(action));\\n    };\\n\\n    CatchScheduler.prototype.now = function () { return this._scheduler.now(); };\\n\\n    CatchScheduler.prototype._clone = function (scheduler) {\\n        return new CatchScheduler(scheduler, this._handler);\\n    };\\n\\n    CatchScheduler.prototype._wrap = function (action) {\\n      var parent = this;\\n      return function (self, state) {\\n        var res = tryCatch(action)(parent._getRecursiveWrapper(self), state);\\n        if (res === errorObj) {\\n          if (!parent._handler(res.e)) { thrower(res.e); }\\n          return disposableEmpty;\\n        }\\n        return disposableFixup(res);\\n      };\\n    };\\n\\n    CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {\\n      if (this._recursiveOriginal !== scheduler) {\\n        this._recursiveOriginal = scheduler;\\n        var wrapper = this._clone(scheduler);\\n        wrapper._recursiveOriginal = scheduler;\\n        wrapper._recursiveWrapper = wrapper;\\n        this._recursiveWrapper = wrapper;\\n      }\\n      return this._recursiveWrapper;\\n    };\\n\\n    CatchScheduler.prototype.schedulePeriodic = function (state, period, action) {\\n      var self = this, failed = false, d = new SingleAssignmentDisposable();\\n\\n      d.setDisposable(this._scheduler.schedulePeriodic(state, period, function (state1) {\\n        if (failed) { return null; }\\n        var res = tryCatch(action)(state1);\\n        if (res === errorObj) {\\n          failed = true;\\n          if (!self._handler(res.e)) { thrower(res.e); }\\n          d.dispose();\\n          return null;\\n        }\\n        return res;\\n      }));\\n\\n      return d;\\n    };\\n\\n    return CatchScheduler;\\n  }(Scheduler));\\n\\n  /**\\n   *  Represents a notification to an observer.\\n   */\\n  var Notification = Rx.Notification = (function () {\\n    function Notification() {\\n\\n    }\\n\\n    Notification.prototype._accept = function (onNext, onError, onCompleted) {\\n      throw new NotImplementedError();\\n    };\\n\\n    Notification.prototype._acceptObserver = function (onNext, onError, onCompleted) {\\n      throw new NotImplementedError();\\n    };\\n\\n    /**\\n     * Invokes the delegate corresponding to the notification or the observer\\'s method corresponding to the notification and returns the produced result.\\n     * @param {Function | Observer} observerOrOnNext Function to invoke for an OnNext notification or Observer to invoke the notification on..\\n     * @param {Function} onError Function to invoke for an OnError notification.\\n     * @param {Function} onCompleted Function to invoke for an OnCompleted notification.\\n     * @returns {Any} Result produced by the observation.\\n     */\\n    Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {\\n      return observerOrOnNext && typeof observerOrOnNext === \\'object\\' ?\\n        this._acceptObserver(observerOrOnNext) :\\n        this._accept(observerOrOnNext, onError, onCompleted);\\n    };\\n\\n    /**\\n     * Returns an observable sequence with a single notification.\\n     *\\n     * @memberOf Notifications\\n     * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.\\n     * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.\\n     */\\n    Notification.prototype.toObservable = function (scheduler) {\\n      var self = this;\\n      isScheduler(scheduler) || (scheduler = immediateScheduler);\\n      return new AnonymousObservable(function (o) {\\n        return scheduler.schedule(self, function (_, notification) {\\n          notification._acceptObserver(o);\\n          notification.kind === \\'N\\' && o.onCompleted();\\n        });\\n      });\\n    };\\n\\n    return Notification;\\n  })();\\n\\n  var OnNextNotification = (function (__super__) {\\n    inherits(OnNextNotification, __super__);\\n    function OnNextNotification(value) {\\n      this.value = value;\\n      this.kind = \\'N\\';\\n    }\\n\\n    OnNextNotification.prototype._accept = function (onNext) {\\n      return onNext(this.value);\\n    };\\n\\n    OnNextNotification.prototype._acceptObserver = function (o) {\\n      return o.onNext(this.value);\\n    };\\n\\n    OnNextNotification.prototype.toString = function () {\\n      return \\'OnNext(\\' + this.value + \\')\\';\\n    };\\n\\n    return OnNextNotification;\\n  }(Notification));\\n\\n  var OnErrorNotification = (function (__super__) {\\n    inherits(OnErrorNotification, __super__);\\n    function OnErrorNotification(error) {\\n      this.error = error;\\n      this.kind = \\'E\\';\\n    }\\n\\n    OnErrorNotification.prototype._accept = function (onNext, onError) {\\n      return onError(this.error);\\n    };\\n\\n    OnErrorNotification.prototype._acceptObserver = function (o) {\\n      return o.onError(this.error);\\n    };\\n\\n    OnErrorNotification.prototype.toString = function () {\\n      return \\'OnError(\\' + this.error + \\')\\';\\n    };\\n\\n    return OnErrorNotification;\\n  }(Notification));\\n\\n  var OnCompletedNotification = (function (__super__) {\\n    inherits(OnCompletedNotification, __super__);\\n    function OnCompletedNotification() {\\n      this.kind = \\'C\\';\\n    }\\n\\n    OnCompletedNotification.prototype._accept = function (onNext, onError, onCompleted) {\\n      return onCompleted();\\n    };\\n\\n    OnCompletedNotification.prototype._acceptObserver = function (o) {\\n      return o.onCompleted();\\n    };\\n\\n    OnCompletedNotification.prototype.toString = function () {\\n      return \\'OnCompleted()\\';\\n    };\\n\\n    return OnCompletedNotification;\\n  }(Notification));\\n\\n  /**\\n   * Creates an object that represents an OnNext notification to an observer.\\n   * @param {Any} value The value contained in the notification.\\n   * @returns {Notification} The OnNext notification containing the value.\\n   */\\n  var notificationCreateOnNext = Notification.createOnNext = function (value) {\\n    return new OnNextNotification(value);\\n  };\\n\\n  /**\\n   * Creates an object that represents an OnError notification to an observer.\\n   * @param {Any} error The exception contained in the notification.\\n   * @returns {Notification} The OnError notification containing the exception.\\n   */\\n  var notificationCreateOnError = Notification.createOnError = function (error) {\\n    return new OnErrorNotification(error);\\n  };\\n\\n  /**\\n   * Creates an object that represents an OnCompleted notification to an observer.\\n   * @returns {Notification} The OnCompleted notification.\\n   */\\n  var notificationCreateOnCompleted = Notification.createOnCompleted = function () {\\n    return new OnCompletedNotification();\\n  };\\n\\n  /**\\n   * Supports push-style iteration over an observable sequence.\\n   */\\n  var Observer = Rx.Observer = function () { };\\n\\n  /**\\n   *  Creates a notification callback from an observer.\\n   * @returns The action that forwards its input notification to the underlying observer.\\n   */\\n  Observer.prototype.toNotifier = function () {\\n    var observer = this;\\n    return function (n) { return n.accept(observer); };\\n  };\\n\\n  /**\\n   *  Hides the identity of an observer.\\n   * @returns An observer that hides the identity of the specified observer.\\n   */\\n  Observer.prototype.asObserver = function () {\\n    var self = this;\\n    return new AnonymousObserver(\\n      function (x) { self.onNext(x); },\\n      function (err) { self.onError(err); },\\n      function () { self.onCompleted(); });\\n  };\\n\\n  /**\\n   *  Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.\\n   *  If a violation is detected, an Error is thrown from the offending observer method call.\\n   * @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.\\n   */\\n  Observer.prototype.checked = function () { return new CheckedObserver(this); };\\n\\n  /**\\n   *  Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.\\n   * @param {Function} [onNext] Observer\\'s OnNext action implementation.\\n   * @param {Function} [onError] Observer\\'s OnError action implementation.\\n   * @param {Function} [onCompleted] Observer\\'s OnCompleted action implementation.\\n   * @returns {Observer} The observer object implemented using the given actions.\\n   */\\n  var observerCreate = Observer.create = function (onNext, onError, onCompleted) {\\n    onNext || (onNext = noop);\\n    onError || (onError = defaultError);\\n    onCompleted || (onCompleted = noop);\\n    return new AnonymousObserver(onNext, onError, onCompleted);\\n  };\\n\\n  /**\\n   *  Creates an observer from a notification callback.\\n   * @param {Function} handler Action that handles a notification.\\n   * @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.\\n   */\\n  Observer.fromNotifier = function (handler, thisArg) {\\n    var cb = bindCallback(handler, thisArg, 1);\\n    return new AnonymousObserver(function (x) {\\n      return cb(notificationCreateOnNext(x));\\n    }, function (e) {\\n      return cb(notificationCreateOnError(e));\\n    }, function () {\\n      return cb(notificationCreateOnCompleted());\\n    });\\n  };\\n\\n  /**\\n   * Schedules the invocation of observer methods on the given scheduler.\\n   * @param {Scheduler} scheduler Scheduler to schedule observer messages on.\\n   * @returns {Observer} Observer whose messages are scheduled on the given scheduler.\\n   */\\n  Observer.prototype.notifyOn = function (scheduler) {\\n    return new ObserveOnObserver(scheduler, this);\\n  };\\n\\n  Observer.prototype.makeSafe = function(disposable) {\\n    return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable);\\n  };\\n\\n  /**\\n   * Abstract base class for implementations of the Observer class.\\n   * This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.\\n   */\\n  var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {\\n    inherits(AbstractObserver, __super__);\\n\\n    /**\\n     * Creates a new observer in a non-stopped state.\\n     */\\n    function AbstractObserver() {\\n      this.isStopped = false;\\n    }\\n\\n    // Must be implemented by other observers\\n    AbstractObserver.prototype.next = notImplemented;\\n    AbstractObserver.prototype.error = notImplemented;\\n    AbstractObserver.prototype.completed = notImplemented;\\n\\n    /**\\n     * Notifies the observer of a new element in the sequence.\\n     * @param {Any} value Next element in the sequence.\\n     */\\n    AbstractObserver.prototype.onNext = function (value) {\\n      !this.isStopped && this.next(value);\\n    };\\n\\n    /**\\n     * Notifies the observer that an exception has occurred.\\n     * @param {Any} error The error that has occurred.\\n     */\\n    AbstractObserver.prototype.onError = function (error) {\\n      if (!this.isStopped) {\\n        this.isStopped = true;\\n        this.error(error);\\n      }\\n    };\\n\\n    /**\\n     * Notifies the observer of the end of the sequence.\\n     */\\n    AbstractObserver.prototype.onCompleted = function () {\\n      if (!this.isStopped) {\\n        this.isStopped = true;\\n        this.completed();\\n      }\\n    };\\n\\n    /**\\n     * Disposes the observer, causing it to transition to the stopped state.\\n     */\\n    AbstractObserver.prototype.dispose = function () { this.isStopped = true; };\\n\\n    AbstractObserver.prototype.fail = function (e) {\\n      if (!this.isStopped) {\\n        this.isStopped = true;\\n        this.error(e);\\n        return true;\\n      }\\n\\n      return false;\\n    };\\n\\n    return AbstractObserver;\\n  }(Observer));\\n\\n  /**\\n   * Class to create an Observer instance from delegate-based implementations of the on* methods.\\n   */\\n  var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {\\n    inherits(AnonymousObserver, __super__);\\n\\n    /**\\n     * Creates an observer from the specified OnNext, OnError, and OnCompleted actions.\\n     * @param {Any} onNext Observer\\'s OnNext action implementation.\\n     * @param {Any} onError Observer\\'s OnError action implementation.\\n     * @param {Any} onCompleted Observer\\'s OnCompleted action implementation.\\n     */\\n    function AnonymousObserver(onNext, onError, onCompleted) {\\n      __super__.call(this);\\n      this._onNext = onNext;\\n      this._onError = onError;\\n      this._onCompleted = onCompleted;\\n    }\\n\\n    /**\\n     * Calls the onNext action.\\n     * @param {Any} value Next element in the sequence.\\n     */\\n    AnonymousObserver.prototype.next = function (value) {\\n      this._onNext(value);\\n    };\\n\\n    /**\\n     * Calls the onError action.\\n     * @param {Any} error The error that has occurred.\\n     */\\n    AnonymousObserver.prototype.error = function (error) {\\n      this._onError(error);\\n    };\\n\\n    /**\\n     *  Calls the onCompleted action.\\n     */\\n    AnonymousObserver.prototype.completed = function () {\\n      this._onCompleted();\\n    };\\n\\n    return AnonymousObserver;\\n  }(AbstractObserver));\\n\\n  var CheckedObserver = (function (__super__) {\\n    inherits(CheckedObserver, __super__);\\n\\n    function CheckedObserver(observer) {\\n      __super__.call(this);\\n      this._observer = observer;\\n      this._state = 0; // 0 - idle, 1 - busy, 2 - done\\n    }\\n\\n    var CheckedObserverPrototype = CheckedObserver.prototype;\\n\\n    CheckedObserverPrototype.onNext = function (value) {\\n      this.checkAccess();\\n      var res = tryCatch(this._observer.onNext).call(this._observer, value);\\n      this._state = 0;\\n      res === errorObj && thrower(res.e);\\n    };\\n\\n    CheckedObserverPrototype.onError = function (err) {\\n      this.checkAccess();\\n      var res = tryCatch(this._observer.onError).call(this._observer, err);\\n      this._state = 2;\\n      res === errorObj && thrower(res.e);\\n    };\\n\\n    CheckedObserverPrototype.onCompleted = function () {\\n      this.checkAccess();\\n      var res = tryCatch(this._observer.onCompleted).call(this._observer);\\n      this._state = 2;\\n      res === errorObj && thrower(res.e);\\n    };\\n\\n    CheckedObserverPrototype.checkAccess = function () {\\n      if (this._state === 1) { throw new Error(\\'Re-entrancy detected\\'); }\\n      if (this._state === 2) { throw new Error(\\'Observer completed\\'); }\\n      if (this._state === 0) { this._state = 1; }\\n    };\\n\\n    return CheckedObserver;\\n  }(Observer));\\n\\n  var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {\\n    inherits(ScheduledObserver, __super__);\\n\\n    function ScheduledObserver(scheduler, observer) {\\n      __super__.call(this);\\n      this.scheduler = scheduler;\\n      this.observer = observer;\\n      this.isAcquired = false;\\n      this.hasFaulted = false;\\n      this.queue = [];\\n      this.disposable = new SerialDisposable();\\n    }\\n\\n    function enqueueNext(observer, x) { return function () { observer.onNext(x); }; }\\n    function enqueueError(observer, e) { return function () { observer.onError(e); }; }\\n    function enqueueCompleted(observer) { return function () { observer.onCompleted(); }; }\\n\\n    ScheduledObserver.prototype.next = function (x) {\\n      this.queue.push(enqueueNext(this.observer, x));\\n    };\\n\\n    ScheduledObserver.prototype.error = function (e) {\\n      this.queue.push(enqueueError(this.observer, e));\\n    };\\n\\n    ScheduledObserver.prototype.completed = function () {\\n      this.queue.push(enqueueCompleted(this.observer));\\n    };\\n\\n\\n    function scheduleMethod(state, recurse) {\\n      var work;\\n      if (state.queue.length > 0) {\\n        work = state.queue.shift();\\n      } else {\\n        state.isAcquired = false;\\n        return;\\n      }\\n      var res = tryCatch(work)();\\n      if (res === errorObj) {\\n        state.queue = [];\\n        state.hasFaulted = true;\\n        return thrower(res.e);\\n      }\\n      recurse(state);\\n    }\\n\\n    ScheduledObserver.prototype.ensureActive = function () {\\n      var isOwner = false;\\n      if (!this.hasFaulted && this.queue.length > 0) {\\n        isOwner = !this.isAcquired;\\n        this.isAcquired = true;\\n      }\\n      isOwner &&\\n        this.disposable.setDisposable(this.scheduler.scheduleRecursive(this, scheduleMethod));\\n    };\\n\\n    ScheduledObserver.prototype.dispose = function () {\\n      __super__.prototype.dispose.call(this);\\n      this.disposable.dispose();\\n    };\\n\\n    return ScheduledObserver;\\n  }(AbstractObserver));\\n\\n  var ObserveOnObserver = (function (__super__) {\\n    inherits(ObserveOnObserver, __super__);\\n\\n    function ObserveOnObserver(scheduler, observer, cancel) {\\n      __super__.call(this, scheduler, observer);\\n      this._cancel = cancel;\\n    }\\n\\n    ObserveOnObserver.prototype.next = function (value) {\\n      __super__.prototype.next.call(this, value);\\n      this.ensureActive();\\n    };\\n\\n    ObserveOnObserver.prototype.error = function (e) {\\n      __super__.prototype.error.call(this, e);\\n      this.ensureActive();\\n    };\\n\\n    ObserveOnObserver.prototype.completed = function () {\\n      __super__.prototype.completed.call(this);\\n      this.ensureActive();\\n    };\\n\\n    ObserveOnObserver.prototype.dispose = function () {\\n      __super__.prototype.dispose.call(this);\\n      this._cancel && this._cancel.dispose();\\n      this._cancel = null;\\n    };\\n\\n    return ObserveOnObserver;\\n  })(ScheduledObserver);\\n\\n  var observableProto;\\n\\n  /**\\n   * Represents a push-style collection.\\n   */\\n  var Observable = Rx.Observable = (function () {\\n\\n    function makeSubscribe(self, subscribe) {\\n      return function (o) {\\n        var oldOnError = o.onError;\\n        o.onError = function (e) {\\n          makeStackTraceLong(e, self);\\n          oldOnError.call(o, e);\\n        };\\n\\n        return subscribe.call(self, o);\\n      };\\n    }\\n\\n    function Observable() {\\n      if (Rx.config.longStackSupport && hasStacks) {\\n        var oldSubscribe = this._subscribe;\\n        var e = tryCatch(thrower)(new Error()).e;\\n        this.stack = e.stack.substring(e.stack.indexOf(\\'\\\\n\\') + 1);\\n        this._subscribe = makeSubscribe(this, oldSubscribe);\\n      }\\n    }\\n\\n    observableProto = Observable.prototype;\\n\\n    /**\\n    * Determines whether the given object is an Observable\\n    * @param {Any} An object to determine whether it is an Observable\\n    * @returns {Boolean} true if an Observable, else false.\\n    */\\n    Observable.isObservable = function (o) {\\n      return o && isFunction(o.subscribe);\\n    };\\n\\n    /**\\n     *  Subscribes an o to the observable sequence.\\n     *  @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.\\n     *  @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.\\n     *  @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.\\n     *  @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.\\n     */\\n    observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) {\\n      return this._subscribe(typeof oOrOnNext === \\'object\\' ?\\n        oOrOnNext :\\n        observerCreate(oOrOnNext, onError, onCompleted));\\n    };\\n\\n    /**\\n     * Subscribes to the next value in the sequence with an optional \"this\" argument.\\n     * @param {Function} onNext The function to invoke on each element in the observable sequence.\\n     * @param {Any} [thisArg] Object to use as this when executing callback.\\n     * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.\\n     */\\n    observableProto.subscribeOnNext = function (onNext, thisArg) {\\n      return this._subscribe(observerCreate(typeof thisArg !== \\'undefined\\' ? function(x) { onNext.call(thisArg, x); } : onNext));\\n    };\\n\\n    /**\\n     * Subscribes to an exceptional condition in the sequence with an optional \"this\" argument.\\n     * @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.\\n     * @param {Any} [thisArg] Object to use as this when executing callback.\\n     * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.\\n     */\\n    observableProto.subscribeOnError = function (onError, thisArg) {\\n      return this._subscribe(observerCreate(null, typeof thisArg !== \\'undefined\\' ? function(e) { onError.call(thisArg, e); } : onError));\\n    };\\n\\n    /**\\n     * Subscribes to the next value in the sequence with an optional \"this\" argument.\\n     * @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.\\n     * @param {Any} [thisArg] Object to use as this when executing callback.\\n     * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.\\n     */\\n    observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {\\n      return this._subscribe(observerCreate(null, null, typeof thisArg !== \\'undefined\\' ? function() { onCompleted.call(thisArg); } : onCompleted));\\n    };\\n\\n    return Observable;\\n  })();\\n\\n  var ObservableBase = Rx.ObservableBase = (function (__super__) {\\n    inherits(ObservableBase, __super__);\\n\\n    function fixSubscriber(subscriber) {\\n      return subscriber && isFunction(subscriber.dispose) ? subscriber :\\n        isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;\\n    }\\n\\n    function setDisposable(s, state) {\\n      var ado = state[0], self = state[1];\\n      var sub = tryCatch(self.subscribeCore).call(self, ado);\\n      if (sub === errorObj && !ado.fail(errorObj.e)) { thrower(errorObj.e); }\\n      ado.setDisposable(fixSubscriber(sub));\\n    }\\n\\n    function ObservableBase() {\\n      __super__.call(this);\\n    }\\n\\n    ObservableBase.prototype._subscribe = function (o) {\\n      var ado = new AutoDetachObserver(o), state = [ado, this];\\n\\n      if (currentThreadScheduler.scheduleRequired()) {\\n        currentThreadScheduler.schedule(state, setDisposable);\\n      } else {\\n        setDisposable(null, state);\\n      }\\n      return ado;\\n    };\\n\\n    ObservableBase.prototype.subscribeCore = notImplemented;\\n\\n    return ObservableBase;\\n  }(Observable));\\n\\nvar FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {\\n\\n    inherits(FlatMapObservable, __super__);\\n\\n    function FlatMapObservable(source, selector, resultSelector, thisArg) {\\n      this.resultSelector = isFunction(resultSelector) ? resultSelector : null;\\n      this.selector = bindCallback(isFunction(selector) ? selector : function() { return selector; }, thisArg, 3);\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    FlatMapObservable.prototype.subscribeCore = function(o) {\\n      return this.source.subscribe(new InnerObserver(o, this.selector, this.resultSelector, this));\\n    };\\n\\n    inherits(InnerObserver, AbstractObserver);\\n    function InnerObserver(observer, selector, resultSelector, source) {\\n      this.i = 0;\\n      this.selector = selector;\\n      this.resultSelector = resultSelector;\\n      this.source = source;\\n      this.o = observer;\\n      AbstractObserver.call(this);\\n    }\\n\\n    InnerObserver.prototype._wrapResult = function(result, x, i) {\\n      return this.resultSelector ?\\n        result.map(function(y, i2) { return this.resultSelector(x, y, i, i2); }, this) :\\n        result;\\n    };\\n\\n    InnerObserver.prototype.next = function(x) {\\n      var i = this.i++;\\n      var result = tryCatch(this.selector)(x, i, this.source);\\n      if (result === errorObj) { return this.o.onError(result.e); }\\n\\n      isPromise(result) && (result = observableFromPromise(result));\\n      (isArrayLike(result) || isIterable(result)) && (result = Observable.from(result));\\n      this.o.onNext(this._wrapResult(result, x, i));\\n    };\\n\\n    InnerObserver.prototype.error = function(e) { this.o.onError(e); };\\n\\n    InnerObserver.prototype.completed = function() { this.o.onCompleted(); };\\n\\n    return FlatMapObservable;\\n\\n}(ObservableBase));\\n\\n  var Enumerable = Rx.internals.Enumerable = function () { };\\n\\n  function IsDisposedDisposable(state) {\\n    this._s = state;\\n    this.isDisposed = false;\\n  }\\n\\n  IsDisposedDisposable.prototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this.isDisposed = true;\\n      this._s.isDisposed = true;\\n    }\\n  };\\n\\n  var ConcatEnumerableObservable = (function(__super__) {\\n    inherits(ConcatEnumerableObservable, __super__);\\n    function ConcatEnumerableObservable(sources) {\\n      this.sources = sources;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(state, recurse) {\\n      if (state.isDisposed) { return; }\\n      var currentItem = tryCatch(state.e.next).call(state.e);\\n      if (currentItem === errorObj) { return state.o.onError(currentItem.e); }\\n      if (currentItem.done) { return state.o.onCompleted(); }\\n\\n      // Check if promise\\n      var currentValue = currentItem.value;\\n      isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\\n\\n      var d = new SingleAssignmentDisposable();\\n      state.subscription.setDisposable(d);\\n      d.setDisposable(currentValue.subscribe(new InnerObserver(state, recurse)));\\n    }\\n\\n    ConcatEnumerableObservable.prototype.subscribeCore = function (o) {\\n      var subscription = new SerialDisposable();\\n      var state = {\\n        isDisposed: false,\\n        o: o,\\n        subscription: subscription,\\n        e: this.sources[$iterator$]()\\n      };\\n\\n      var cancelable = currentThreadScheduler.scheduleRecursive(state, scheduleMethod);\\n      return new NAryDisposable([subscription, cancelable, new IsDisposedDisposable(state)]);\\n    };\\n\\n    function InnerObserver(state, recurse) {\\n      this._state = state;\\n      this._recurse = recurse;\\n      AbstractObserver.call(this);\\n    }\\n\\n    inherits(InnerObserver, AbstractObserver);\\n\\n    InnerObserver.prototype.next = function (x) { this._state.o.onNext(x); };\\n    InnerObserver.prototype.error = function (e) { this._state.o.onError(e); };\\n    InnerObserver.prototype.completed = function () { this._recurse(this._state); };\\n\\n    return ConcatEnumerableObservable;\\n  }(ObservableBase));\\n\\n  Enumerable.prototype.concat = function () {\\n    return new ConcatEnumerableObservable(this);\\n  };\\n\\n  var CatchErrorObservable = (function(__super__) {\\n    function CatchErrorObservable(sources) {\\n      this.sources = sources;\\n      __super__.call(this);\\n    }\\n\\n    inherits(CatchErrorObservable, __super__);\\n\\n    function scheduleMethod(state, recurse) {\\n      if (state.isDisposed) { return; }\\n      var currentItem = tryCatch(state.e.next).call(state.e);\\n      if (currentItem === errorObj) { return state.o.onError(currentItem.e); }\\n      if (currentItem.done) { return state.lastError !== null ? state.o.onError(state.lastError) : state.o.onCompleted(); }\\n\\n      var currentValue = currentItem.value;\\n      isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\\n\\n      var d = new SingleAssignmentDisposable();\\n      state.subscription.setDisposable(d);\\n      d.setDisposable(currentValue.subscribe(new InnerObserver(state, recurse)));\\n    }\\n\\n    CatchErrorObservable.prototype.subscribeCore = function (o) {\\n      var subscription = new SerialDisposable();\\n      var state = {\\n        isDisposed: false,\\n        e: this.sources[$iterator$](),\\n        subscription: subscription,\\n        lastError: null,\\n        o: o\\n      };\\n\\n      var cancelable = currentThreadScheduler.scheduleRecursive(state, scheduleMethod);\\n      return new NAryDisposable([subscription, cancelable, new IsDisposedDisposable(state)]);\\n    };\\n\\n    function InnerObserver(state, recurse) {\\n      this._state = state;\\n      this._recurse = recurse;\\n      AbstractObserver.call(this);\\n    }\\n\\n    inherits(InnerObserver, AbstractObserver);\\n\\n    InnerObserver.prototype.next = function (x) { this._state.o.onNext(x); };\\n    InnerObserver.prototype.error = function (e) { this._state.lastError = e; this._recurse(this._state); };\\n    InnerObserver.prototype.completed = function () { this._state.o.onCompleted(); };\\n\\n    return CatchErrorObservable;\\n  }(ObservableBase));\\n\\n  Enumerable.prototype.catchError = function () {\\n    return new CatchErrorObservable(this);\\n  };\\n\\n  var RepeatEnumerable = (function (__super__) {\\n    inherits(RepeatEnumerable, __super__);\\n    function RepeatEnumerable(v, c) {\\n      this.v = v;\\n      this.c = c == null ? -1 : c;\\n    }\\n\\n    RepeatEnumerable.prototype[$iterator$] = function () {\\n      return new RepeatEnumerator(this);\\n    };\\n\\n    function RepeatEnumerator(p) {\\n      this.v = p.v;\\n      this.l = p.c;\\n    }\\n\\n    RepeatEnumerator.prototype.next = function () {\\n      if (this.l === 0) { return doneEnumerator; }\\n      if (this.l > 0) { this.l--; }\\n      return { done: false, value: this.v };\\n    };\\n\\n    return RepeatEnumerable;\\n  }(Enumerable));\\n\\n  var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {\\n    return new RepeatEnumerable(value, repeatCount);\\n  };\\n\\n  var OfEnumerable = (function(__super__) {\\n    inherits(OfEnumerable, __super__);\\n    function OfEnumerable(s, fn, thisArg) {\\n      this.s = s;\\n      this.fn = fn ? bindCallback(fn, thisArg, 3) : null;\\n    }\\n    OfEnumerable.prototype[$iterator$] = function () {\\n      return new OfEnumerator(this);\\n    };\\n\\n    function OfEnumerator(p) {\\n      this.i = -1;\\n      this.s = p.s;\\n      this.l = this.s.length;\\n      this.fn = p.fn;\\n    }\\n\\n    OfEnumerator.prototype.next = function () {\\n     return ++this.i < this.l ?\\n       { done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } :\\n       doneEnumerator;\\n    };\\n\\n    return OfEnumerable;\\n  }(Enumerable));\\n\\n  var enumerableOf = Enumerable.of = function (source, selector, thisArg) {\\n    return new OfEnumerable(source, selector, thisArg);\\n  };\\n\\nvar ObserveOnObservable = (function (__super__) {\\n  inherits(ObserveOnObservable, __super__);\\n  function ObserveOnObservable(source, s) {\\n    this.source = source;\\n    this._s = s;\\n    __super__.call(this);\\n  }\\n\\n  ObserveOnObservable.prototype.subscribeCore = function (o) {\\n    return this.source.subscribe(new ObserveOnObserver(this._s, o));\\n  };\\n\\n  return ObserveOnObservable;\\n}(ObservableBase));\\n\\n   /**\\n   *  Wraps the source sequence in order to run its observer callbacks on the specified scheduler.\\n   *\\n   *  This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects\\n   *  that require to be run on a scheduler, use subscribeOn.\\n   *\\n   *  @param {Scheduler} scheduler Scheduler to notify observers on.\\n   *  @returns {Observable} The source sequence whose observations happen on the specified scheduler.\\n   */\\n  observableProto.observeOn = function (scheduler) {\\n    return new ObserveOnObservable(this, scheduler);\\n  };\\n\\n  var SubscribeOnObservable = (function (__super__) {\\n    inherits(SubscribeOnObservable, __super__);\\n    function SubscribeOnObservable(source, s) {\\n      this.source = source;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(scheduler, state) {\\n      var source = state[0], d = state[1], o = state[2];\\n      d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(o)));\\n    }\\n\\n    SubscribeOnObservable.prototype.subscribeCore = function (o) {\\n      var m = new SingleAssignmentDisposable(), d = new SerialDisposable();\\n      d.setDisposable(m);\\n      m.setDisposable(this._s.schedule([this.source, d, o], scheduleMethod));\\n      return d;\\n    };\\n\\n    return SubscribeOnObservable;\\n  }(ObservableBase));\\n\\n   /**\\n   *  Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;\\n   *  see the remarks section for more information on the distinction between subscribeOn and observeOn.\\n\\n   *  This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer\\n   *  callbacks on a scheduler, use observeOn.\\n\\n   *  @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.\\n   *  @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.\\n   */\\n  observableProto.subscribeOn = function (scheduler) {\\n    return new SubscribeOnObservable(this, scheduler);\\n  };\\n\\n  var FromPromiseObservable = (function(__super__) {\\n    inherits(FromPromiseObservable, __super__);\\n    function FromPromiseObservable(p, s) {\\n      this._p = p;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleNext(s, state) {\\n      var o = state[0], data = state[1];\\n      o.onNext(data);\\n      o.onCompleted();\\n    }\\n\\n    function scheduleError(s, state) {\\n      var o = state[0], err = state[1];\\n      o.onError(err);\\n    }\\n\\n    FromPromiseObservable.prototype.subscribeCore = function(o) {\\n      var sad = new SingleAssignmentDisposable(), self = this, p = this._p;\\n\\n      if (isFunction(p)) {\\n        p = tryCatch(p)();\\n        if (p === errorObj) {\\n          o.onError(p.e);\\n          return sad;\\n        }\\n      }\\n\\n      p\\n        .then(function (data) {\\n          sad.setDisposable(self._s.schedule([o, data], scheduleNext));\\n        }, function (err) {\\n          sad.setDisposable(self._s.schedule([o, err], scheduleError));\\n        });\\n\\n      return sad;\\n    };\\n\\n    return FromPromiseObservable;\\n  }(ObservableBase));\\n\\n  /**\\n  * Converts a Promise to an Observable sequence\\n  * @param {Promise} An ES6 Compliant promise.\\n  * @returns {Observable} An Observable sequence which wraps the existing promise success and failure.\\n  */\\n  var observableFromPromise = Observable.fromPromise = function (promise, scheduler) {\\n    scheduler || (scheduler = defaultScheduler);\\n    return new FromPromiseObservable(promise, scheduler);\\n  };\\n\\n  /*\\n   * Converts an existing observable sequence to an ES6 Compatible Promise\\n   * @example\\n   * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);\\n   *\\n   * // With config\\n   * Rx.config.Promise = RSVP.Promise;\\n   * var promise = Rx.Observable.return(42).toPromise();\\n   * @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.\\n   * @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.\\n   */\\n  observableProto.toPromise = function (promiseCtor) {\\n    promiseCtor || (promiseCtor = Rx.config.Promise);\\n    if (!promiseCtor) { throw new NotSupportedError(\\'Promise type not provided nor in Rx.config.Promise\\'); }\\n    var source = this;\\n    return new promiseCtor(function (resolve, reject) {\\n      // No cancellation can be done\\n      var value;\\n      source.subscribe(function (v) {\\n        value = v;\\n      }, reject, function () {\\n        resolve(value);\\n      });\\n    });\\n  };\\n\\n  var ToArrayObservable = (function(__super__) {\\n    inherits(ToArrayObservable, __super__);\\n    function ToArrayObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    ToArrayObservable.prototype.subscribeCore = function(o) {\\n      return this.source.subscribe(new InnerObserver(o));\\n    };\\n\\n    inherits(InnerObserver, AbstractObserver);\\n    function InnerObserver(o) {\\n      this.o = o;\\n      this.a = [];\\n      AbstractObserver.call(this);\\n    }\\n    \\n    InnerObserver.prototype.next = function (x) { this.a.push(x); };\\n    InnerObserver.prototype.error = function (e) { this.o.onError(e);  };\\n    InnerObserver.prototype.completed = function () { this.o.onNext(this.a); this.o.onCompleted(); };\\n\\n    return ToArrayObservable;\\n  }(ObservableBase));\\n\\n  /**\\n  * Creates an array from an observable sequence.\\n  * @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.\\n  */\\n  observableProto.toArray = function () {\\n    return new ToArrayObservable(this);\\n  };\\n\\n  /**\\n   *  Creates an observable sequence from a specified subscribe method implementation.\\n   * @example\\n   *  var res = Rx.Observable.create(function (observer) { return function () { } );\\n   *  var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );\\n   *  var res = Rx.Observable.create(function (observer) { } );\\n   * @param {Function} subscribe Implementation of the resulting observable sequence\\'s subscribe method, returning a function that will be wrapped in a Disposable.\\n   * @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.\\n   */\\n  Observable.create = function (subscribe, parent) {\\n    return new AnonymousObservable(subscribe, parent);\\n  };\\n\\n  var Defer = (function(__super__) {\\n    inherits(Defer, __super__);\\n    function Defer(factory) {\\n      this._f = factory;\\n      __super__.call(this);\\n    }\\n\\n    Defer.prototype.subscribeCore = function (o) {\\n      var result = tryCatch(this._f)();\\n      if (result === errorObj) { return observableThrow(result.e).subscribe(o);}\\n      isPromise(result) && (result = observableFromPromise(result));\\n      return result.subscribe(o);\\n    };\\n\\n    return Defer;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.\\n   *\\n   * @example\\n   *  var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });\\n   * @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.\\n   * @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.\\n   */\\n  var observableDefer = Observable.defer = function (observableFactory) {\\n    return new Defer(observableFactory);\\n  };\\n\\n  var EmptyObservable = (function(__super__) {\\n    inherits(EmptyObservable, __super__);\\n    function EmptyObservable(scheduler) {\\n      this.scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    EmptyObservable.prototype.subscribeCore = function (observer) {\\n      var sink = new EmptySink(observer, this.scheduler);\\n      return sink.run();\\n    };\\n\\n    function EmptySink(observer, scheduler) {\\n      this.observer = observer;\\n      this.scheduler = scheduler;\\n    }\\n\\n    function scheduleItem(s, state) {\\n      state.onCompleted();\\n      return disposableEmpty;\\n    }\\n\\n    EmptySink.prototype.run = function () {\\n      var state = this.observer;\\n      return this.scheduler === immediateScheduler ?\\n        scheduleItem(null, state) :\\n        this.scheduler.schedule(state, scheduleItem);\\n    };\\n\\n    return EmptyObservable;\\n  }(ObservableBase));\\n\\n  var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler);\\n\\n  /**\\n   *  Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.\\n   *\\n   * @example\\n   *  var res = Rx.Observable.empty();\\n   *  var res = Rx.Observable.empty(Rx.Scheduler.timeout);\\n   * @param {Scheduler} [scheduler] Scheduler to send the termination call on.\\n   * @returns {Observable} An observable sequence with no elements.\\n   */\\n  var observableEmpty = Observable.empty = function (scheduler) {\\n    isScheduler(scheduler) || (scheduler = immediateScheduler);\\n    return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler);\\n  };\\n\\n  var FromObservable = (function(__super__) {\\n    inherits(FromObservable, __super__);\\n    function FromObservable(iterable, fn, scheduler) {\\n      this._iterable = iterable;\\n      this._fn = fn;\\n      this._scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    function createScheduleMethod(o, it, fn) {\\n      return function loopRecursive(i, recurse) {\\n        var next = tryCatch(it.next).call(it);\\n        if (next === errorObj) { return o.onError(next.e); }\\n        if (next.done) { return o.onCompleted(); }\\n\\n        var result = next.value;\\n\\n        if (isFunction(fn)) {\\n          result = tryCatch(fn)(result, i);\\n          if (result === errorObj) { return o.onError(result.e); }\\n        }\\n\\n        o.onNext(result);\\n        recurse(i + 1);\\n      };\\n    }\\n\\n    FromObservable.prototype.subscribeCore = function (o) {\\n      var list = Object(this._iterable),\\n          it = getIterable(list);\\n\\n      return this._scheduler.scheduleRecursive(0, createScheduleMethod(o, it, this._fn));\\n    };\\n\\n    return FromObservable;\\n  }(ObservableBase));\\n\\n  var maxSafeInteger = Math.pow(2, 53) - 1;\\n\\n  function StringIterable(s) {\\n    this._s = s;\\n  }\\n\\n  StringIterable.prototype[$iterator$] = function () {\\n    return new StringIterator(this._s);\\n  };\\n\\n  function StringIterator(s) {\\n    this._s = s;\\n    this._l = s.length;\\n    this._i = 0;\\n  }\\n\\n  StringIterator.prototype[$iterator$] = function () {\\n    return this;\\n  };\\n\\n  StringIterator.prototype.next = function () {\\n    return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;\\n  };\\n\\n  function ArrayIterable(a) {\\n    this._a = a;\\n  }\\n\\n  ArrayIterable.prototype[$iterator$] = function () {\\n    return new ArrayIterator(this._a);\\n  };\\n\\n  function ArrayIterator(a) {\\n    this._a = a;\\n    this._l = toLength(a);\\n    this._i = 0;\\n  }\\n\\n  ArrayIterator.prototype[$iterator$] = function () {\\n    return this;\\n  };\\n\\n  ArrayIterator.prototype.next = function () {\\n    return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;\\n  };\\n\\n  function numberIsFinite(value) {\\n    return typeof value === \\'number\\' && root.isFinite(value);\\n  }\\n\\n  function isNan(n) {\\n    return n !== n;\\n  }\\n\\n  function getIterable(o) {\\n    var i = o[$iterator$], it;\\n    if (!i && typeof o === \\'string\\') {\\n      it = new StringIterable(o);\\n      return it[$iterator$]();\\n    }\\n    if (!i && o.length !== undefined) {\\n      it = new ArrayIterable(o);\\n      return it[$iterator$]();\\n    }\\n    if (!i) { throw new TypeError(\\'Object is not iterable\\'); }\\n    return o[$iterator$]();\\n  }\\n\\n  function sign(value) {\\n    var number = +value;\\n    if (number === 0) { return number; }\\n    if (isNaN(number)) { return number; }\\n    return number < 0 ? -1 : 1;\\n  }\\n\\n  function toLength(o) {\\n    var len = +o.length;\\n    if (isNaN(len)) { return 0; }\\n    if (len === 0 || !numberIsFinite(len)) { return len; }\\n    len = sign(len) * Math.floor(Math.abs(len));\\n    if (len <= 0) { return 0; }\\n    if (len > maxSafeInteger) { return maxSafeInteger; }\\n    return len;\\n  }\\n\\n  /**\\n  * This method creates a new Observable sequence from an array-like or iterable object.\\n  * @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.\\n  * @param {Function} [mapFn] Map function to call on every element of the array.\\n  * @param {Any} [thisArg] The context to use calling the mapFn if provided.\\n  * @param {Scheduler} [scheduler] Optional scheduler to use for scheduling.  If not provided, defaults to Scheduler.currentThread.\\n  */\\n  var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {\\n    if (iterable == null) {\\n      throw new Error(\\'iterable cannot be null.\\')\\n    }\\n    if (mapFn && !isFunction(mapFn)) {\\n      throw new Error(\\'mapFn when provided must be a function\\');\\n    }\\n    if (mapFn) {\\n      var mapper = bindCallback(mapFn, thisArg, 2);\\n    }\\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\\n    return new FromObservable(iterable, mapper, scheduler);\\n  }\\n\\n  var FromArrayObservable = (function(__super__) {\\n    inherits(FromArrayObservable, __super__);\\n    function FromArrayObservable(args, scheduler) {\\n      this._args = args;\\n      this._scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(o, args) {\\n      var len = args.length;\\n      return function loopRecursive (i, recurse) {\\n        if (i < len) {\\n          o.onNext(args[i]);\\n          recurse(i + 1);\\n        } else {\\n          o.onCompleted();\\n        }\\n      };\\n    }\\n\\n    FromArrayObservable.prototype.subscribeCore = function (o) {\\n      return this._scheduler.scheduleRecursive(0, scheduleMethod(o, this._args));\\n    };\\n\\n    return FromArrayObservable;\\n  }(ObservableBase));\\n\\n  /**\\n  *  Converts an array to an observable sequence, using an optional scheduler to enumerate the array.\\n  * @deprecated use Observable.from or Observable.of\\n  * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.\\n  * @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.\\n  */\\n  var observableFromArray = Observable.fromArray = function (array, scheduler) {\\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\\n    return new FromArrayObservable(array, scheduler)\\n  };\\n\\n  var GenerateObservable = (function (__super__) {\\n    inherits(GenerateObservable, __super__);\\n    function GenerateObservable(state, cndFn, itrFn, resFn, s) {\\n      this._initialState = state;\\n      this._cndFn = cndFn;\\n      this._itrFn = itrFn;\\n      this._resFn = resFn;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleRecursive(state, recurse) {\\n      if (state.first) {\\n        state.first = false;\\n      } else {\\n        state.newState = tryCatch(state.self._itrFn)(state.newState);\\n        if (state.newState === errorObj) { return state.o.onError(state.newState.e); }\\n      }\\n      var hasResult = tryCatch(state.self._cndFn)(state.newState);\\n      if (hasResult === errorObj) { return state.o.onError(hasResult.e); }\\n      if (hasResult) {\\n        var result = tryCatch(state.self._resFn)(state.newState);\\n        if (result === errorObj) { return state.o.onError(result.e); }\\n        state.o.onNext(result);\\n        recurse(state);\\n      } else {\\n        state.o.onCompleted();\\n      }\\n    }\\n\\n    GenerateObservable.prototype.subscribeCore = function (o) {\\n      var state = {\\n        o: o,\\n        self: this,\\n        first: true,\\n        newState: this._initialState\\n      };\\n      return this._s.scheduleRecursive(state, scheduleRecursive);\\n    };\\n\\n    return GenerateObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Generates an observable sequence by running a state-driven loop producing the sequence\\'s elements, using the specified scheduler to send out observer messages.\\n   *\\n   * @example\\n   *  var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });\\n   *  var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);\\n   * @param {Mixed} initialState Initial state.\\n   * @param {Function} condition Condition to terminate generation (upon returning false).\\n   * @param {Function} iterate Iteration step function.\\n   * @param {Function} resultSelector Selector function for results produced in the sequence.\\n   * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.\\n   * @returns {Observable} The generated sequence.\\n   */\\n  Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {\\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\\n    return new GenerateObservable(initialState, condition, iterate, resultSelector, scheduler);\\n  };\\n\\n  function observableOf (scheduler, array) {\\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\\n    return new FromArrayObservable(array, scheduler);\\n  }\\n\\n  /**\\n  *  This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.\\n  * @returns {Observable} The observable sequence whose elements are pulled from the given arguments.\\n  */\\n  Observable.of = function () {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    return new FromArrayObservable(args, currentThreadScheduler);\\n  };\\n\\n  /**\\n  *  This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.\\n  * @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.\\n  * @returns {Observable} The observable sequence whose elements are pulled from the given arguments.\\n  */\\n  Observable.ofWithScheduler = function (scheduler) {\\n    var len = arguments.length, args = new Array(len - 1);\\n    for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }\\n    return new FromArrayObservable(args, scheduler);\\n  };\\n\\n  /**\\n   * Creates an Observable sequence from changes to an array using Array.observe.\\n   * @param {Array} array An array to observe changes.\\n   * @returns {Observable} An observable sequence containing changes to an array from Array.observe.\\n   */\\n  Observable.ofArrayChanges = function(array) {\\n    if (!Array.isArray(array)) { throw new TypeError(\\'Array.observe only accepts arrays.\\'); }\\n    if (typeof Array.observe !== \\'function\\' && typeof Array.unobserve !== \\'function\\') { throw new TypeError(\\'Array.observe is not supported on your platform\\') }\\n    return new AnonymousObservable(function(observer) {\\n      function observerFn(changes) {\\n        for(var i = 0, len = changes.length; i < len; i++) {\\n          observer.onNext(changes[i]);\\n        }\\n      }\\n      \\n      Array.observe(array, observerFn);\\n\\n      return function () {\\n        Array.unobserve(array, observerFn);\\n      };\\n    });\\n  };\\n\\n  /**\\n   * Creates an Observable sequence from changes to an object using Object.observe.\\n   * @param {Object} obj An object to observe changes.\\n   * @returns {Observable} An observable sequence containing changes to an object from Object.observe.\\n   */\\n  Observable.ofObjectChanges = function(obj) {\\n    if (obj == null) { throw new TypeError(\\'object must not be null or undefined.\\'); }\\n    if (typeof Object.observe !== \\'function\\' && typeof Object.unobserve !== \\'function\\') { throw new TypeError(\\'Object.observe is not supported on your platform\\') }\\n    return new AnonymousObservable(function(observer) {\\n      function observerFn(changes) {\\n        for(var i = 0, len = changes.length; i < len; i++) {\\n          observer.onNext(changes[i]);\\n        }\\n      }\\n\\n      Object.observe(obj, observerFn);\\n\\n      return function () {\\n        Object.unobserve(obj, observerFn);\\n      };\\n    });\\n  };\\n\\n  var NeverObservable = (function(__super__) {\\n    inherits(NeverObservable, __super__);\\n    function NeverObservable() {\\n      __super__.call(this);\\n    }\\n\\n    NeverObservable.prototype.subscribeCore = function (observer) {\\n      return disposableEmpty;\\n    };\\n\\n    return NeverObservable;\\n  }(ObservableBase));\\n\\n  var NEVER_OBSERVABLE = new NeverObservable();\\n\\n  /**\\n   * Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).\\n   * @returns {Observable} An observable sequence whose observers will never get called.\\n   */\\n  var observableNever = Observable.never = function () {\\n    return NEVER_OBSERVABLE;\\n  };\\n\\n  var PairsObservable = (function(__super__) {\\n    inherits(PairsObservable, __super__);\\n    function PairsObservable(o, scheduler) {\\n      this._o = o;\\n      this._keys = Object.keys(o);\\n      this._scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(o, obj, keys) {\\n      return function loopRecursive(i, recurse) {\\n        if (i < keys.length) {\\n          var key = keys[i];\\n          o.onNext([key, obj[key]]);\\n          recurse(i + 1);\\n        } else {\\n          o.onCompleted();\\n        }\\n      };\\n    }\\n\\n    PairsObservable.prototype.subscribeCore = function (o) {\\n      return this._scheduler.scheduleRecursive(0, scheduleMethod(o, this._o, this._keys));\\n    };\\n\\n    return PairsObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   * Convert an object into an observable sequence of [key, value] pairs.\\n   * @param {Object} obj The object to inspect.\\n   * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.\\n   * @returns {Observable} An observable sequence of [key, value] pairs from the object.\\n   */\\n  Observable.pairs = function (obj, scheduler) {\\n    scheduler || (scheduler = currentThreadScheduler);\\n    return new PairsObservable(obj, scheduler);\\n  };\\n\\n    var RangeObservable = (function(__super__) {\\n    inherits(RangeObservable, __super__);\\n    function RangeObservable(start, count, scheduler) {\\n      this.start = start;\\n      this.rangeCount = count;\\n      this.scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    function loopRecursive(start, count, o) {\\n      return function loop (i, recurse) {\\n        if (i < count) {\\n          o.onNext(start + i);\\n          recurse(i + 1);\\n        } else {\\n          o.onCompleted();\\n        }\\n      };\\n    }\\n\\n    RangeObservable.prototype.subscribeCore = function (o) {\\n      return this.scheduler.scheduleRecursive(\\n        0,\\n        loopRecursive(this.start, this.rangeCount, o)\\n      );\\n    };\\n\\n    return RangeObservable;\\n  }(ObservableBase));\\n\\n  /**\\n  *  Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.\\n  * @param {Number} start The value of the first integer in the sequence.\\n  * @param {Number} count The number of sequential integers to generate.\\n  * @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.\\n  * @returns {Observable} An observable sequence that contains a range of sequential integral numbers.\\n  */\\n  Observable.range = function (start, count, scheduler) {\\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\\n    return new RangeObservable(start, count, scheduler);\\n  };\\n\\n  var RepeatObservable = (function(__super__) {\\n    inherits(RepeatObservable, __super__);\\n    function RepeatObservable(value, repeatCount, scheduler) {\\n      this.value = value;\\n      this.repeatCount = repeatCount == null ? -1 : repeatCount;\\n      this.scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    RepeatObservable.prototype.subscribeCore = function (observer) {\\n      var sink = new RepeatSink(observer, this);\\n      return sink.run();\\n    };\\n\\n    return RepeatObservable;\\n  }(ObservableBase));\\n\\n  function RepeatSink(observer, parent) {\\n    this.observer = observer;\\n    this.parent = parent;\\n  }\\n\\n  RepeatSink.prototype.run = function () {\\n    var observer = this.observer, value = this.parent.value;\\n    function loopRecursive(i, recurse) {\\n      if (i === -1 || i > 0) {\\n        observer.onNext(value);\\n        i > 0 && i--;\\n      }\\n      if (i === 0) { return observer.onCompleted(); }\\n      recurse(i);\\n    }\\n\\n    return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount, loopRecursive);\\n  };\\n\\n  /**\\n   *  Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.\\n   * @param {Mixed} value Element to repeat.\\n   * @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.\\n   * @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.\\n   * @returns {Observable} An observable sequence that repeats the given element the specified number of times.\\n   */\\n  Observable.repeat = function (value, repeatCount, scheduler) {\\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\\n    return new RepeatObservable(value, repeatCount, scheduler);\\n  };\\n\\n  var JustObservable = (function(__super__) {\\n    inherits(JustObservable, __super__);\\n    function JustObservable(value, scheduler) {\\n      this._value = value;\\n      this._scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    JustObservable.prototype.subscribeCore = function (o) {\\n      var state = [this._value, o];\\n      return this._scheduler === immediateScheduler ?\\n        scheduleItem(null, state) :\\n        this._scheduler.schedule(state, scheduleItem);\\n    };\\n\\n    function scheduleItem(s, state) {\\n      var value = state[0], observer = state[1];\\n      observer.onNext(value);\\n      observer.onCompleted();\\n      return disposableEmpty;\\n    }\\n\\n    return JustObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.\\n   *  There is an alias called \\'just\\' or browsers <IE9.\\n   * @param {Mixed} value Single element in the resulting observable sequence.\\n   * @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.\\n   * @returns {Observable} An observable sequence containing the single specified element.\\n   */\\n  var observableReturn = Observable[\\'return\\'] = Observable.just = function (value, scheduler) {\\n    isScheduler(scheduler) || (scheduler = immediateScheduler);\\n    return new JustObservable(value, scheduler);\\n  };\\n\\n  var ThrowObservable = (function(__super__) {\\n    inherits(ThrowObservable, __super__);\\n    function ThrowObservable(error, scheduler) {\\n      this._error = error;\\n      this._scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    ThrowObservable.prototype.subscribeCore = function (o) {\\n      var state = [this._error, o];\\n      return this._scheduler === immediateScheduler ?\\n        scheduleItem(null, state) :\\n        this._scheduler.schedule(state, scheduleItem);\\n    };\\n\\n    function scheduleItem(s, state) {\\n      var e = state[0], o = state[1];\\n      o.onError(e);\\n      return disposableEmpty;\\n    }\\n\\n    return ThrowObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.\\n   *  There is an alias to this method called \\'throwError\\' for browsers <IE9.\\n   * @param {Mixed} error An object used for the sequence\\'s termination.\\n   * @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.\\n   * @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.\\n   */\\n  var observableThrow = Observable[\\'throw\\'] = function (error, scheduler) {\\n    isScheduler(scheduler) || (scheduler = immediateScheduler);\\n    return new ThrowObservable(error, scheduler);\\n  };\\n\\n  var UsingObservable = (function (__super__) {\\n    inherits(UsingObservable, __super__);\\n    function UsingObservable(resFn, obsFn) {\\n      this._resFn = resFn;\\n      this._obsFn = obsFn;\\n      __super__.call(this);\\n    }\\n\\n    UsingObservable.prototype.subscribeCore = function (o) {\\n      var disposable = disposableEmpty;\\n      var resource = tryCatch(this._resFn)();\\n      if (resource === errorObj) {\\n        return new BinaryDisposable(observableThrow(resource.e).subscribe(o), disposable);\\n      }\\n      resource && (disposable = resource);\\n      var source = tryCatch(this._obsFn)(resource);\\n      if (source === errorObj) {\\n        return new BinaryDisposable(observableThrow(source.e).subscribe(o), disposable);\\n      }\\n      return new BinaryDisposable(source.subscribe(o), disposable);\\n    };\\n\\n    return UsingObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   * Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence\\'s lifetime.\\n   * @param {Function} resourceFactory Factory function to obtain a resource object.\\n   * @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.\\n   * @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.\\n   */\\n  Observable.using = function (resourceFactory, observableFactory) {\\n    return new UsingObservable(resourceFactory, observableFactory);\\n  };\\n\\n  /**\\n   * Propagates the observable sequence or Promise that reacts first.\\n   * @param {Observable} rightSource Second observable sequence or Promise.\\n   * @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.\\n   */\\n  observableProto.amb = function (rightSource) {\\n    var leftSource = this;\\n    return new AnonymousObservable(function (observer) {\\n      var choice,\\n        leftChoice = \\'L\\', rightChoice = \\'R\\',\\n        leftSubscription = new SingleAssignmentDisposable(),\\n        rightSubscription = new SingleAssignmentDisposable();\\n\\n      isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));\\n\\n      function choiceL() {\\n        if (!choice) {\\n          choice = leftChoice;\\n          rightSubscription.dispose();\\n        }\\n      }\\n\\n      function choiceR() {\\n        if (!choice) {\\n          choice = rightChoice;\\n          leftSubscription.dispose();\\n        }\\n      }\\n\\n      var leftSubscribe = observerCreate(\\n        function (left) {\\n          choiceL();\\n          choice === leftChoice && observer.onNext(left);\\n        },\\n        function (e) {\\n          choiceL();\\n          choice === leftChoice && observer.onError(e);\\n        },\\n        function () {\\n          choiceL();\\n          choice === leftChoice && observer.onCompleted();\\n        }\\n      );\\n      var rightSubscribe = observerCreate(\\n        function (right) {\\n          choiceR();\\n          choice === rightChoice && observer.onNext(right);\\n        },\\n        function (e) {\\n          choiceR();\\n          choice === rightChoice && observer.onError(e);\\n        },\\n        function () {\\n          choiceR();\\n          choice === rightChoice && observer.onCompleted();\\n        }\\n      );\\n\\n      leftSubscription.setDisposable(leftSource.subscribe(leftSubscribe));\\n      rightSubscription.setDisposable(rightSource.subscribe(rightSubscribe));\\n\\n      return new BinaryDisposable(leftSubscription, rightSubscription);\\n    });\\n  };\\n\\n  function amb(p, c) { return p.amb(c); }\\n\\n  /**\\n   * Propagates the observable sequence or Promise that reacts first.\\n   * @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.\\n   */\\n  Observable.amb = function () {\\n    var acc = observableNever(), items;\\n    if (Array.isArray(arguments[0])) {\\n      items = arguments[0];\\n    } else {\\n      var len = arguments.length;\\n      items = new Array(items);\\n      for(var i = 0; i < len; i++) { items[i] = arguments[i]; }\\n    }\\n    for (var i = 0, len = items.length; i < len; i++) {\\n      acc = amb(acc, items[i]);\\n    }\\n    return acc;\\n  };\\n\\n  var CatchObservable = (function (__super__) {\\n    inherits(CatchObservable, __super__);\\n    function CatchObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    CatchObservable.prototype.subscribeCore = function (o) {\\n      var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();\\n      subscription.setDisposable(d1);\\n      d1.setDisposable(this.source.subscribe(new CatchObserver(o, subscription, this._fn)));\\n      return subscription;\\n    };\\n\\n    return CatchObservable;\\n  }(ObservableBase));\\n\\n  var CatchObserver = (function(__super__) {\\n    inherits(CatchObserver, __super__);\\n    function CatchObserver(o, s, fn) {\\n      this._o = o;\\n      this._s = s;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    CatchObserver.prototype.next = function (x) { this._o.onNext(x); };\\n    CatchObserver.prototype.completed = function () { return this._o.onCompleted(); };\\n    CatchObserver.prototype.error = function (e) {\\n      var result = tryCatch(this._fn)(e);\\n      if (result === errorObj) { return this._o.onError(result.e); }\\n      isPromise(result) && (result = observableFromPromise(result));\\n\\n      var d = new SingleAssignmentDisposable();\\n      this._s.setDisposable(d);\\n      d.setDisposable(result.subscribe(this._o));\\n    };\\n\\n    return CatchObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Continues an observable sequence that is terminated by an exception with the next observable sequence.\\n   * @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.\\n   * @returns {Observable} An observable sequence containing the first sequence\\'s elements, followed by the elements of the handler sequence in case an exception occurred.\\n   */\\n  observableProto[\\'catch\\'] = function (handlerOrSecond) {\\n    return isFunction(handlerOrSecond) ? new CatchObservable(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]);\\n  };\\n\\n  /**\\n   * Continues an observable sequence that is terminated by an exception with the next observable sequence.\\n   * @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.\\n   * @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.\\n   */\\n  var observableCatch = Observable[\\'catch\\'] = function () {\\n    var items;\\n    if (Array.isArray(arguments[0])) {\\n      items = arguments[0];\\n    } else {\\n      var len = arguments.length;\\n      items = new Array(len);\\n      for(var i = 0; i < len; i++) { items[i] = arguments[i]; }\\n    }\\n    return enumerableOf(items).catchError();\\n  };\\n\\n  /**\\n   * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.\\n   * This can be in the form of an argument list of observables or an array.\\n   *\\n   * @example\\n   * 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });\\n   * 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });\\n   * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\\n   */\\n  observableProto.combineLatest = function () {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    if (Array.isArray(args[0])) {\\n      args[0].unshift(this);\\n    } else {\\n      args.unshift(this);\\n    }\\n    return combineLatest.apply(this, args);\\n  };\\n\\n  function falseFactory() { return false; }\\n  function argumentsToArray() {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    return args;\\n  }\\n\\n  var CombineLatestObservable = (function(__super__) {\\n    inherits(CombineLatestObservable, __super__);\\n    function CombineLatestObservable(params, cb) {\\n      this._params = params;\\n      this._cb = cb;\\n      __super__.call(this);\\n    }\\n\\n    CombineLatestObservable.prototype.subscribeCore = function(observer) {\\n      var len = this._params.length,\\n          subscriptions = new Array(len);\\n\\n      var state = {\\n        hasValue: arrayInitialize(len, falseFactory),\\n        hasValueAll: false,\\n        isDone: arrayInitialize(len, falseFactory),\\n        values: new Array(len)\\n      };\\n\\n      for (var i = 0; i < len; i++) {\\n        var source = this._params[i], sad = new SingleAssignmentDisposable();\\n        subscriptions[i] = sad;\\n        isPromise(source) && (source = observableFromPromise(source));\\n        sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this._cb, state)));\\n      }\\n\\n      return new NAryDisposable(subscriptions);\\n    };\\n\\n    return CombineLatestObservable;\\n  }(ObservableBase));\\n\\n  var CombineLatestObserver = (function (__super__) {\\n    inherits(CombineLatestObserver, __super__);\\n    function CombineLatestObserver(o, i, cb, state) {\\n      this._o = o;\\n      this._i = i;\\n      this._cb = cb;\\n      this._state = state;\\n      __super__.call(this);\\n    }\\n\\n    function notTheSame(i) {\\n      return function (x, j) {\\n        return j !== i;\\n      };\\n    }\\n\\n    CombineLatestObserver.prototype.next = function (x) {\\n      this._state.values[this._i] = x;\\n      this._state.hasValue[this._i] = true;\\n      if (this._state.hasValueAll || (this._state.hasValueAll = this._state.hasValue.every(identity))) {\\n        var res = tryCatch(this._cb).apply(null, this._state.values);\\n        if (res === errorObj) { return this._o.onError(res.e); }\\n        this._o.onNext(res);\\n      } else if (this._state.isDone.filter(notTheSame(this._i)).every(identity)) {\\n        this._o.onCompleted();\\n      }\\n    };\\n\\n    CombineLatestObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    CombineLatestObserver.prototype.completed = function () {\\n      this._state.isDone[this._i] = true;\\n      this._state.isDone.every(identity) && this._o.onCompleted();\\n    };\\n\\n    return CombineLatestObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.\\n  *\\n  * @example\\n  * 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });\\n  * 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });\\n  * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\\n  */\\n  var combineLatest = Observable.combineLatest = function () {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\\n    Array.isArray(args[0]) && (args = args[0]);\\n    return new CombineLatestObservable(args, resultSelector);\\n  };\\n\\n  /**\\n   * Concatenates all the observable sequences.  This takes in either an array or variable arguments to concatenate.\\n   * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.\\n   */\\n  observableProto.concat = function () {\\n    for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\\n    args.unshift(this);\\n    return observableConcat.apply(null, args);\\n  };\\n\\n  var ConcatObserver = (function(__super__) {\\n    inherits(ConcatObserver, __super__);\\n    function ConcatObserver(s, fn) {\\n      this._s = s;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    ConcatObserver.prototype.next = function (x) { this._s.o.onNext(x); };\\n    ConcatObserver.prototype.error = function (e) { this._s.o.onError(e); };\\n    ConcatObserver.prototype.completed = function () { this._s.i++; this._fn(this._s); };\\n\\n    return ConcatObserver;\\n  }(AbstractObserver));\\n\\n  var ConcatObservable = (function(__super__) {\\n    inherits(ConcatObservable, __super__);\\n    function ConcatObservable(sources) {\\n      this._sources = sources;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleRecursive (state, recurse) {\\n      if (state.disposable.isDisposed) { return; }\\n      if (state.i === state.sources.length) { return state.o.onCompleted(); }\\n\\n      // Check if promise\\n      var currentValue = state.sources[state.i];\\n      isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\\n\\n      var d = new SingleAssignmentDisposable();\\n      state.subscription.setDisposable(d);\\n      d.setDisposable(currentValue.subscribe(new ConcatObserver(state, recurse)));\\n    }\\n\\n    ConcatObservable.prototype.subscribeCore = function(o) {\\n      var subscription = new SerialDisposable();\\n      var disposable = disposableCreate(noop);\\n      var state = {\\n        o: o,\\n        i: 0,\\n        subscription: subscription,\\n        disposable: disposable,\\n        sources: this._sources\\n      };\\n\\n      var cancelable = immediateScheduler.scheduleRecursive(state, scheduleRecursive);\\n      return new NAryDisposable([subscription, disposable, cancelable]);\\n    };\\n\\n    return ConcatObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   * Concatenates all the observable sequences.\\n   * @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.\\n   * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.\\n   */\\n  var observableConcat = Observable.concat = function () {\\n    var args;\\n    if (Array.isArray(arguments[0])) {\\n      args = arguments[0];\\n    } else {\\n      args = new Array(arguments.length);\\n      for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }\\n    }\\n    return new ConcatObservable(args);\\n  };\\n\\n  /**\\n   * Concatenates an observable sequence of observable sequences.\\n   * @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.\\n   */\\n  observableProto.concatAll = function () {\\n    return this.merge(1);\\n  };\\n\\n  var MergeObservable = (function (__super__) {\\n    inherits(MergeObservable, __super__);\\n\\n    function MergeObservable(source, maxConcurrent) {\\n      this.source = source;\\n      this.maxConcurrent = maxConcurrent;\\n      __super__.call(this);\\n    }\\n\\n    MergeObservable.prototype.subscribeCore = function(observer) {\\n      var g = new CompositeDisposable();\\n      g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));\\n      return g;\\n    };\\n\\n    return MergeObservable;\\n\\n  }(ObservableBase));\\n\\n  var MergeObserver = (function (__super__) {\\n    function MergeObserver(o, max, g) {\\n      this.o = o;\\n      this.max = max;\\n      this.g = g;\\n      this.done = false;\\n      this.q = [];\\n      this.activeCount = 0;\\n      __super__.call(this);\\n    }\\n\\n    inherits(MergeObserver, __super__);\\n\\n    MergeObserver.prototype.handleSubscribe = function (xs) {\\n      var sad = new SingleAssignmentDisposable();\\n      this.g.add(sad);\\n      isPromise(xs) && (xs = observableFromPromise(xs));\\n      sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));\\n    };\\n\\n    MergeObserver.prototype.next = function (innerSource) {\\n      if(this.activeCount < this.max) {\\n        this.activeCount++;\\n        this.handleSubscribe(innerSource);\\n      } else {\\n        this.q.push(innerSource);\\n      }\\n    };\\n    MergeObserver.prototype.error = function (e) { this.o.onError(e); };\\n    MergeObserver.prototype.completed = function () { this.done = true; this.activeCount === 0 && this.o.onCompleted(); };\\n\\n    function InnerObserver(parent, sad) {\\n      this.parent = parent;\\n      this.sad = sad;\\n      __super__.call(this);\\n    }\\n\\n    inherits(InnerObserver, __super__);\\n\\n    InnerObserver.prototype.next = function (x) { this.parent.o.onNext(x); };\\n    InnerObserver.prototype.error = function (e) { this.parent.o.onError(e); };\\n    InnerObserver.prototype.completed = function () {\\n      this.parent.g.remove(this.sad);\\n      if (this.parent.q.length > 0) {\\n        this.parent.handleSubscribe(this.parent.q.shift());\\n      } else {\\n        this.parent.activeCount--;\\n        this.parent.done && this.parent.activeCount === 0 && this.parent.o.onCompleted();\\n      }\\n    };\\n\\n    return MergeObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  * Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.\\n  * Or merges two observable sequences into a single observable sequence.\\n  * @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.\\n  * @returns {Observable} The observable sequence that merges the elements of the inner sequences.\\n  */\\n  observableProto.merge = function (maxConcurrentOrOther) {\\n    return typeof maxConcurrentOrOther !== \\'number\\' ?\\n      observableMerge(this, maxConcurrentOrOther) :\\n      new MergeObservable(this, maxConcurrentOrOther);\\n  };\\n\\n  /**\\n   * Merges all the observable sequences into a single observable sequence.\\n   * The scheduler is optional and if not specified, the immediate scheduler is used.\\n   * @returns {Observable} The observable sequence that merges the elements of the observable sequences.\\n   */\\n  var observableMerge = Observable.merge = function () {\\n    var scheduler, sources = [], i, len = arguments.length;\\n    if (!arguments[0]) {\\n      scheduler = immediateScheduler;\\n      for(i = 1; i < len; i++) { sources.push(arguments[i]); }\\n    } else if (isScheduler(arguments[0])) {\\n      scheduler = arguments[0];\\n      for(i = 1; i < len; i++) { sources.push(arguments[i]); }\\n    } else {\\n      scheduler = immediateScheduler;\\n      for(i = 0; i < len; i++) { sources.push(arguments[i]); }\\n    }\\n    if (Array.isArray(sources[0])) {\\n      sources = sources[0];\\n    }\\n    return observableOf(scheduler, sources).mergeAll();\\n  };\\n\\n  var MergeAllObservable = (function (__super__) {\\n    inherits(MergeAllObservable, __super__);\\n\\n    function MergeAllObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    MergeAllObservable.prototype.subscribeCore = function (o) {\\n      var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();\\n      g.add(m);\\n      m.setDisposable(this.source.subscribe(new MergeAllObserver(o, g)));\\n      return g;\\n    };\\n\\n    return MergeAllObservable;\\n  }(ObservableBase));\\n\\n  var MergeAllObserver = (function (__super__) {\\n    function MergeAllObserver(o, g) {\\n      this.o = o;\\n      this.g = g;\\n      this.done = false;\\n      __super__.call(this);\\n    }\\n\\n    inherits(MergeAllObserver, __super__);\\n\\n    MergeAllObserver.prototype.next = function(innerSource) {\\n      var sad = new SingleAssignmentDisposable();\\n      this.g.add(sad);\\n      isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));\\n      sad.setDisposable(innerSource.subscribe(new InnerObserver(this, sad)));\\n    };\\n\\n    MergeAllObserver.prototype.error = function (e) {\\n      this.o.onError(e);\\n    };\\n\\n    MergeAllObserver.prototype.completed = function () {\\n      this.done = true;\\n      this.g.length === 1 && this.o.onCompleted();\\n    };\\n\\n    function InnerObserver(parent, sad) {\\n      this.parent = parent;\\n      this.sad = sad;\\n      __super__.call(this);\\n    }\\n\\n    inherits(InnerObserver, __super__);\\n\\n    InnerObserver.prototype.next = function (x) {\\n      this.parent.o.onNext(x);\\n    };\\n    InnerObserver.prototype.error = function (e) {\\n      this.parent.o.onError(e);\\n    };\\n    InnerObserver.prototype.completed = function () {\\n      this.parent.g.remove(this.sad);\\n      this.parent.done && this.parent.g.length === 1 && this.parent.o.onCompleted();\\n    };\\n\\n    return MergeAllObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  * Merges an observable sequence of observable sequences into an observable sequence.\\n  * @returns {Observable} The observable sequence that merges the elements of the inner sequences.\\n  */\\n  observableProto.mergeAll = function () {\\n    return new MergeAllObservable(this);\\n  };\\n\\n  var CompositeError = Rx.CompositeError = function(errors) {\\n    this.innerErrors = errors;\\n    this.message = \\'This contains multiple errors. Check the innerErrors\\';\\n    Error.call(this);\\n  };\\n  CompositeError.prototype = Object.create(Error.prototype);\\n  CompositeError.prototype.name = \\'CompositeError\\';\\n\\n  var MergeDelayErrorObservable = (function(__super__) {\\n    inherits(MergeDelayErrorObservable, __super__);\\n    function MergeDelayErrorObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    MergeDelayErrorObservable.prototype.subscribeCore = function (o) {\\n      var group = new CompositeDisposable(),\\n        m = new SingleAssignmentDisposable(),\\n        state = { isStopped: false, errors: [], o: o };\\n\\n      group.add(m);\\n      m.setDisposable(this.source.subscribe(new MergeDelayErrorObserver(group, state)));\\n\\n      return group;\\n    };\\n\\n    return MergeDelayErrorObservable;\\n  }(ObservableBase));\\n\\n  var MergeDelayErrorObserver = (function(__super__) {\\n    inherits(MergeDelayErrorObserver, __super__);\\n    function MergeDelayErrorObserver(group, state) {\\n      this._group = group;\\n      this._state = state;\\n      __super__.call(this);\\n    }\\n\\n    function setCompletion(o, errors) {\\n      if (errors.length === 0) {\\n        o.onCompleted();\\n      } else if (errors.length === 1) {\\n        o.onError(errors[0]);\\n      } else {\\n        o.onError(new CompositeError(errors));\\n      }\\n    }\\n\\n    MergeDelayErrorObserver.prototype.next = function (x) {\\n      var inner = new SingleAssignmentDisposable();\\n      this._group.add(inner);\\n\\n      // Check for promises support\\n      isPromise(x) && (x = observableFromPromise(x));\\n      inner.setDisposable(x.subscribe(new InnerObserver(inner, this._group, this._state)));\\n    };\\n\\n    MergeDelayErrorObserver.prototype.error = function (e) {\\n      this._state.errors.push(e);\\n      this._state.isStopped = true;\\n      this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\\n    };\\n\\n    MergeDelayErrorObserver.prototype.completed = function () {\\n      this._state.isStopped = true;\\n      this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\\n    };\\n\\n    inherits(InnerObserver, __super__);\\n    function InnerObserver(inner, group, state) {\\n      this._inner = inner;\\n      this._group = group;\\n      this._state = state;\\n      __super__.call(this);\\n    }\\n\\n    InnerObserver.prototype.next = function (x) { this._state.o.onNext(x); };\\n    InnerObserver.prototype.error = function (e) {\\n      this._state.errors.push(e);\\n      this._group.remove(this._inner);\\n      this._state.isStopped && this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\\n    };\\n    InnerObserver.prototype.completed = function () {\\n      this._group.remove(this._inner);\\n      this._state.isStopped && this._group.length === 1 && setCompletion(this._state.o, this._state.errors);\\n    };\\n\\n    return MergeDelayErrorObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  * Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to\\n  * receive all successfully emitted items from all of the source Observables without being interrupted by\\n  * an error notification from one of them.\\n  *\\n  * This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an\\n  * error via the Observer\\'s onError, mergeDelayError will refrain from propagating that\\n  * error notification until all of the merged Observables have finished emitting items.\\n  * @param {Array | Arguments} args Arguments or an array to merge.\\n  * @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable\\n  */\\n  Observable.mergeDelayError = function() {\\n    var args;\\n    if (Array.isArray(arguments[0])) {\\n      args = arguments[0];\\n    } else {\\n      var len = arguments.length;\\n      args = new Array(len);\\n      for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    }\\n    var source = observableOf(null, args);\\n    return new MergeDelayErrorObservable(source);\\n  };\\n\\n  /**\\n   * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.\\n   * @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.\\n   * @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.\\n   */\\n  observableProto.onErrorResumeNext = function (second) {\\n    if (!second) { throw new Error(\\'Second observable is required\\'); }\\n    return onErrorResumeNext([this, second]);\\n  };\\n\\n  var OnErrorResumeNextObservable = (function(__super__) {\\n    inherits(OnErrorResumeNextObservable, __super__);\\n    function OnErrorResumeNextObservable(sources) {\\n      this.sources = sources;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(state, recurse) {\\n      if (state.pos < state.sources.length) {\\n        var current = state.sources[state.pos++];\\n        isPromise(current) && (current = observableFromPromise(current));\\n        var d = new SingleAssignmentDisposable();\\n        state.subscription.setDisposable(d);\\n        d.setDisposable(current.subscribe(new OnErrorResumeNextObserver(state, recurse)));\\n      } else {\\n        state.o.onCompleted();\\n      }\\n    }\\n\\n    OnErrorResumeNextObservable.prototype.subscribeCore = function (o) {\\n      var subscription = new SerialDisposable(),\\n          state = {pos: 0, subscription: subscription, o: o, sources: this.sources },\\n          cancellable = immediateScheduler.scheduleRecursive(state, scheduleMethod);\\n\\n      return new BinaryDisposable(subscription, cancellable);\\n    };\\n\\n    return OnErrorResumeNextObservable;\\n  }(ObservableBase));\\n\\n  var OnErrorResumeNextObserver = (function(__super__) {\\n    inherits(OnErrorResumeNextObserver, __super__);\\n    function OnErrorResumeNextObserver(state, recurse) {\\n      this._state = state;\\n      this._recurse = recurse;\\n      __super__.call(this);\\n    }\\n\\n    OnErrorResumeNextObserver.prototype.next = function (x) { this._state.o.onNext(x); };\\n    OnErrorResumeNextObserver.prototype.error = function () { this._recurse(this._state); };\\n    OnErrorResumeNextObserver.prototype.completed = function () { this._recurse(this._state); };\\n\\n    return OnErrorResumeNextObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.\\n   * @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.\\n   */\\n  var onErrorResumeNext = Observable.onErrorResumeNext = function () {\\n    var sources = [];\\n    if (Array.isArray(arguments[0])) {\\n      sources = arguments[0];\\n    } else {\\n      var len = arguments.length;\\n      sources = new Array(len);\\n      for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }\\n    }\\n    return new OnErrorResumeNextObservable(sources);\\n  };\\n\\n  var SkipUntilObservable = (function(__super__) {\\n    inherits(SkipUntilObservable, __super__);\\n\\n    function SkipUntilObservable(source, other) {\\n      this._s = source;\\n      this._o = isPromise(other) ? observableFromPromise(other) : other;\\n      this._open = false;\\n      __super__.call(this);\\n    }\\n\\n    SkipUntilObservable.prototype.subscribeCore = function(o) {\\n      var leftSubscription = new SingleAssignmentDisposable();\\n      leftSubscription.setDisposable(this._s.subscribe(new SkipUntilSourceObserver(o, this)));\\n\\n      isPromise(this._o) && (this._o = observableFromPromise(this._o));\\n\\n      var rightSubscription = new SingleAssignmentDisposable();\\n      rightSubscription.setDisposable(this._o.subscribe(new SkipUntilOtherObserver(o, this, rightSubscription)));\\n\\n      return new BinaryDisposable(leftSubscription, rightSubscription);\\n    };\\n\\n    return SkipUntilObservable;\\n  }(ObservableBase));\\n\\n  var SkipUntilSourceObserver = (function(__super__) {\\n    inherits(SkipUntilSourceObserver, __super__);\\n    function SkipUntilSourceObserver(o, p) {\\n      this._o = o;\\n      this._p = p;\\n      __super__.call(this);\\n    }\\n\\n    SkipUntilSourceObserver.prototype.next = function (x) {\\n      this._p._open && this._o.onNext(x);\\n    };\\n\\n    SkipUntilSourceObserver.prototype.error = function (err) {\\n      this._o.onError(err);\\n    };\\n\\n    SkipUntilSourceObserver.prototype.onCompleted = function () {\\n      this._p._open && this._o.onCompleted();\\n    };\\n\\n    return SkipUntilSourceObserver;\\n  }(AbstractObserver));\\n\\n  var SkipUntilOtherObserver = (function(__super__) {\\n    inherits(SkipUntilOtherObserver, __super__);\\n    function SkipUntilOtherObserver(o, p, r) {\\n      this._o = o;\\n      this._p = p;\\n      this._r = r;\\n      __super__.call(this);\\n    }\\n\\n    SkipUntilOtherObserver.prototype.next = function () {\\n      this._p._open = true;\\n      this._r.dispose();\\n    };\\n\\n    SkipUntilOtherObserver.prototype.error = function (err) {\\n      this._o.onError(err);\\n    };\\n\\n    SkipUntilOtherObserver.prototype.onCompleted = function () {\\n      this._r.dispose();\\n    };\\n\\n    return SkipUntilOtherObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns the values from the source observable sequence only after the other observable sequence produces a value.\\n   * @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.\\n   * @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.\\n   */\\n  observableProto.skipUntil = function (other) {\\n    return new SkipUntilObservable(this, other);\\n  };\\n\\n  var SwitchObservable = (function(__super__) {\\n    inherits(SwitchObservable, __super__);\\n    function SwitchObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    SwitchObservable.prototype.subscribeCore = function (o) {\\n      var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner));\\n      return new BinaryDisposable(s, inner);\\n    };\\n\\n    inherits(SwitchObserver, AbstractObserver);\\n    function SwitchObserver(o, inner) {\\n      this.o = o;\\n      this.inner = inner;\\n      this.stopped = false;\\n      this.latest = 0;\\n      this.hasLatest = false;\\n      AbstractObserver.call(this);\\n    }\\n\\n    SwitchObserver.prototype.next = function (innerSource) {\\n      var d = new SingleAssignmentDisposable(), id = ++this.latest;\\n      this.hasLatest = true;\\n      this.inner.setDisposable(d);\\n      isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));\\n      d.setDisposable(innerSource.subscribe(new InnerObserver(this, id)));\\n    };\\n\\n    SwitchObserver.prototype.error = function (e) {\\n      this.o.onError(e);\\n    };\\n\\n    SwitchObserver.prototype.completed = function () {\\n      this.stopped = true;\\n      !this.hasLatest && this.o.onCompleted();\\n    };\\n\\n    inherits(InnerObserver, AbstractObserver);\\n    function InnerObserver(parent, id) {\\n      this.parent = parent;\\n      this.id = id;\\n      AbstractObserver.call(this);\\n    }\\n    InnerObserver.prototype.next = function (x) {\\n      this.parent.latest === this.id && this.parent.o.onNext(x);\\n    };\\n\\n    InnerObserver.prototype.error = function (e) {\\n      this.parent.latest === this.id && this.parent.o.onError(e);\\n    };\\n\\n    InnerObserver.prototype.completed = function () {\\n      if (this.parent.latest === this.id) {\\n        this.parent.hasLatest = false;\\n        this.parent.stopped && this.parent.o.onCompleted();\\n      }\\n    };\\n\\n    return SwitchObservable;\\n  }(ObservableBase));\\n\\n  /**\\n  * Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.\\n  * @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.\\n  */\\n  observableProto[\\'switch\\'] = observableProto.switchLatest = function () {\\n    return new SwitchObservable(this);\\n  };\\n\\n  var TakeUntilObservable = (function(__super__) {\\n    inherits(TakeUntilObservable, __super__);\\n\\n    function TakeUntilObservable(source, other) {\\n      this.source = source;\\n      this.other = isPromise(other) ? observableFromPromise(other) : other;\\n      __super__.call(this);\\n    }\\n\\n    TakeUntilObservable.prototype.subscribeCore = function(o) {\\n      return new BinaryDisposable(\\n        this.source.subscribe(o),\\n        this.other.subscribe(new TakeUntilObserver(o))\\n      );\\n    };\\n\\n    return TakeUntilObservable;\\n  }(ObservableBase));\\n\\n  var TakeUntilObserver = (function(__super__) {\\n    inherits(TakeUntilObserver, __super__);\\n    function TakeUntilObserver(o) {\\n      this._o = o;\\n      __super__.call(this);\\n    }\\n\\n    TakeUntilObserver.prototype.next = function () {\\n      this._o.onCompleted();\\n    };\\n\\n    TakeUntilObserver.prototype.error = function (err) {\\n      this._o.onError(err);\\n    };\\n\\n    TakeUntilObserver.prototype.onCompleted = noop;\\n\\n    return TakeUntilObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns the values from the source observable sequence until the other observable sequence produces a value.\\n   * @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.\\n   * @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.\\n   */\\n  observableProto.takeUntil = function (other) {\\n    return new TakeUntilObservable(this, other);\\n  };\\n\\n  function falseFactory() { return false; }\\n  function argumentsToArray() {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    return args;\\n  }\\n\\n  var WithLatestFromObservable = (function(__super__) {\\n    inherits(WithLatestFromObservable, __super__);\\n    function WithLatestFromObservable(source, sources, resultSelector) {\\n      this._s = source;\\n      this._ss = sources;\\n      this._cb = resultSelector;\\n      __super__.call(this);\\n    }\\n\\n    WithLatestFromObservable.prototype.subscribeCore = function (o) {\\n      var len = this._ss.length;\\n      var state = {\\n        hasValue: arrayInitialize(len, falseFactory),\\n        hasValueAll: false,\\n        values: new Array(len)\\n      };\\n\\n      var n = this._ss.length, subscriptions = new Array(n + 1);\\n      for (var i = 0; i < n; i++) {\\n        var other = this._ss[i], sad = new SingleAssignmentDisposable();\\n        isPromise(other) && (other = observableFromPromise(other));\\n        sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, state)));\\n        subscriptions[i] = sad;\\n      }\\n\\n      var outerSad = new SingleAssignmentDisposable();\\n      outerSad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this._cb, state)));\\n      subscriptions[n] = outerSad;\\n\\n      return new NAryDisposable(subscriptions);\\n    };\\n\\n    return WithLatestFromObservable;\\n  }(ObservableBase));\\n\\n  var WithLatestFromOtherObserver = (function (__super__) {\\n    inherits(WithLatestFromOtherObserver, __super__);\\n    function WithLatestFromOtherObserver(o, i, state) {\\n      this._o = o;\\n      this._i = i;\\n      this._state = state;\\n      __super__.call(this);\\n    }\\n\\n    WithLatestFromOtherObserver.prototype.next = function (x) {\\n      this._state.values[this._i] = x;\\n      this._state.hasValue[this._i] = true;\\n      this._state.hasValueAll = this._state.hasValue.every(identity);\\n    };\\n\\n    WithLatestFromOtherObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    WithLatestFromOtherObserver.prototype.completed = noop;\\n\\n    return WithLatestFromOtherObserver;\\n  }(AbstractObserver));\\n\\n  var WithLatestFromSourceObserver = (function (__super__) {\\n    inherits(WithLatestFromSourceObserver, __super__);\\n    function WithLatestFromSourceObserver(o, cb, state) {\\n      this._o = o;\\n      this._cb = cb;\\n      this._state = state;\\n      __super__.call(this);\\n    }\\n\\n    WithLatestFromSourceObserver.prototype.next = function (x) {\\n      var allValues = [x].concat(this._state.values);\\n      if (!this._state.hasValueAll) { return; }\\n      var res = tryCatch(this._cb).apply(null, allValues);\\n      if (res === errorObj) { return this._o.onError(res.e); }\\n      this._o.onNext(res);\\n    };\\n\\n    WithLatestFromSourceObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    WithLatestFromSourceObserver.prototype.completed = function () {\\n      this._o.onCompleted();\\n    };\\n\\n    return WithLatestFromSourceObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.\\n   * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\\n   */\\n  observableProto.withLatestFrom = function () {\\n    if (arguments.length === 0) { throw new Error(\\'invalid arguments\\'); }\\n\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\\n    Array.isArray(args[0]) && (args = args[0]);\\n\\n    return new WithLatestFromObservable(this, args, resultSelector);\\n  };\\n\\n  function falseFactory() { return false; }\\n  function emptyArrayFactory() { return []; }\\n\\n  var ZipObservable = (function(__super__) {\\n    inherits(ZipObservable, __super__);\\n    function ZipObservable(sources, resultSelector) {\\n      this._s = sources;\\n      this._cb = resultSelector;\\n      __super__.call(this);\\n    }\\n\\n    ZipObservable.prototype.subscribeCore = function(observer) {\\n      var n = this._s.length,\\n          subscriptions = new Array(n),\\n          done = arrayInitialize(n, falseFactory),\\n          q = arrayInitialize(n, emptyArrayFactory);\\n\\n      for (var i = 0; i < n; i++) {\\n        var source = this._s[i], sad = new SingleAssignmentDisposable();\\n        subscriptions[i] = sad;\\n        isPromise(source) && (source = observableFromPromise(source));\\n        sad.setDisposable(source.subscribe(new ZipObserver(observer, i, this, q, done)));\\n      }\\n\\n      return new NAryDisposable(subscriptions);\\n    };\\n\\n    return ZipObservable;\\n  }(ObservableBase));\\n\\n  var ZipObserver = (function (__super__) {\\n    inherits(ZipObserver, __super__);\\n    function ZipObserver(o, i, p, q, d) {\\n      this._o = o;\\n      this._i = i;\\n      this._p = p;\\n      this._q = q;\\n      this._d = d;\\n      __super__.call(this);\\n    }\\n\\n    function notEmpty(x) { return x.length > 0; }\\n    function shiftEach(x) { return x.shift(); }\\n    function notTheSame(i) {\\n      return function (x, j) {\\n        return j !== i;\\n      };\\n    }\\n\\n    ZipObserver.prototype.next = function (x) {\\n      this._q[this._i].push(x);\\n      if (this._q.every(notEmpty)) {\\n        var queuedValues = this._q.map(shiftEach);\\n        var res = tryCatch(this._p._cb).apply(null, queuedValues);\\n        if (res === errorObj) { return this._o.onError(res.e); }\\n        this._o.onNext(res);\\n      } else if (this._d.filter(notTheSame(this._i)).every(identity)) {\\n        this._o.onCompleted();\\n      }\\n    };\\n\\n    ZipObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    ZipObserver.prototype.completed = function () {\\n      this._d[this._i] = true;\\n      this._d.every(identity) && this._o.onCompleted();\\n    };\\n\\n    return ZipObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.\\n   * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.\\n   * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.\\n   */\\n  observableProto.zip = function () {\\n    if (arguments.length === 0) { throw new Error(\\'invalid arguments\\'); }\\n\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\\n    Array.isArray(args[0]) && (args = args[0]);\\n\\n    var parent = this;\\n    args.unshift(parent);\\n\\n    return new ZipObservable(args, resultSelector);\\n  };\\n\\n  /**\\n   * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\\n   * @param arguments Observable sources.\\n   * @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.\\n   * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.\\n   */\\n  Observable.zip = function () {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    if (Array.isArray(args[0])) {\\n      args = isFunction(args[1]) ? args[0].concat(args[1]) : args[0];\\n    }\\n    var first = args.shift();\\n    return first.zip.apply(first, args);\\n  };\\n\\nfunction falseFactory() { return false; }\\nfunction emptyArrayFactory() { return []; }\\nfunction argumentsToArray() {\\n  var len = arguments.length, args = new Array(len);\\n  for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n  return args;\\n}\\n\\nvar ZipIterableObservable = (function(__super__) {\\n  inherits(ZipIterableObservable, __super__);\\n  function ZipIterableObservable(sources, cb) {\\n    this.sources = sources;\\n    this._cb = cb;\\n    __super__.call(this);\\n  }\\n\\n  ZipIterableObservable.prototype.subscribeCore = function (o) {\\n    var sources = this.sources, len = sources.length, subscriptions = new Array(len);\\n\\n    var state = {\\n      q: arrayInitialize(len, emptyArrayFactory),\\n      done: arrayInitialize(len, falseFactory),\\n      cb: this._cb,\\n      o: o\\n    };\\n\\n    for (var i = 0; i < len; i++) {\\n      (function (i) {\\n        var source = sources[i], sad = new SingleAssignmentDisposable();\\n        (isArrayLike(source) || isIterable(source)) && (source = observableFrom(source));\\n\\n        subscriptions[i] = sad;\\n        sad.setDisposable(source.subscribe(new ZipIterableObserver(state, i)));\\n      }(i));\\n    }\\n\\n    return new NAryDisposable(subscriptions);\\n  };\\n\\n  return ZipIterableObservable;\\n}(ObservableBase));\\n\\nvar ZipIterableObserver = (function (__super__) {\\n  inherits(ZipIterableObserver, __super__);\\n  function ZipIterableObserver(s, i) {\\n    this._s = s;\\n    this._i = i;\\n    __super__.call(this);\\n  }\\n\\n  function notEmpty(x) { return x.length > 0; }\\n  function shiftEach(x) { return x.shift(); }\\n  function notTheSame(i) {\\n    return function (x, j) {\\n      return j !== i;\\n    };\\n  }\\n\\n  ZipIterableObserver.prototype.next = function (x) {\\n    this._s.q[this._i].push(x);\\n    if (this._s.q.every(notEmpty)) {\\n      var queuedValues = this._s.q.map(shiftEach),\\n          res = tryCatch(this._s.cb).apply(null, queuedValues);\\n      if (res === errorObj) { return this._s.o.onError(res.e); }\\n      this._s.o.onNext(res);\\n    } else if (this._s.done.filter(notTheSame(this._i)).every(identity)) {\\n      this._s.o.onCompleted();\\n    }\\n  };\\n\\n  ZipIterableObserver.prototype.error = function (e) { this._s.o.onError(e); };\\n\\n  ZipIterableObserver.prototype.completed = function () {\\n    this._s.done[this._i] = true;\\n    this._s.done.every(identity) && this._s.o.onCompleted();\\n  };\\n\\n  return ZipIterableObserver;\\n}(AbstractObserver));\\n\\n/**\\n * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.\\n * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.\\n * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.\\n */\\nobservableProto.zipIterable = function () {\\n  if (arguments.length === 0) { throw new Error(\\'invalid arguments\\'); }\\n\\n  var len = arguments.length, args = new Array(len);\\n  for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n  var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\\n\\n  var parent = this;\\n  args.unshift(parent);\\n  return new ZipIterableObservable(args, resultSelector);\\n};\\n\\n  function asObservable(source) {\\n    return function subscribe(o) { return source.subscribe(o); };\\n  }\\n\\n  /**\\n   *  Hides the identity of an observable sequence.\\n   * @returns {Observable} An observable sequence that hides the identity of the source sequence.\\n   */\\n  observableProto.asObservable = function () {\\n    return new AnonymousObservable(asObservable(this), this);\\n  };\\n\\n  function toArray(x) { return x.toArray(); }\\n  function notEmpty(x) { return x.length > 0; }\\n\\n  /**\\n   *  Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.\\n   * @param {Number} count Length of each buffer.\\n   * @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.\\n   * @returns {Observable} An observable sequence of buffers.\\n   */\\n  observableProto.bufferWithCount = observableProto.bufferCount = function (count, skip) {\\n    typeof skip !== \\'number\\' && (skip = count);\\n    return this.windowWithCount(count, skip)\\n      .flatMap(toArray)\\n      .filter(notEmpty);\\n  };\\n\\n  var DematerializeObservable = (function (__super__) {\\n    inherits(DematerializeObservable, __super__);\\n    function DematerializeObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    DematerializeObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new DematerializeObserver(o));\\n    };\\n\\n    return DematerializeObservable;\\n  }(ObservableBase));\\n\\n  var DematerializeObserver = (function (__super__) {\\n    inherits(DematerializeObserver, __super__);\\n\\n    function DematerializeObserver(o) {\\n      this._o = o;\\n      __super__.call(this);\\n    }\\n\\n    DematerializeObserver.prototype.next = function (x) { x.accept(this._o); };\\n    DematerializeObserver.prototype.error = function (e) { this._o.onError(e); };\\n    DematerializeObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return DematerializeObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Dematerializes the explicit notification values of an observable sequence as implicit notifications.\\n   * @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence\\'s notification values.\\n   */\\n  observableProto.dematerialize = function () {\\n    return new DematerializeObservable(this);\\n  };\\n\\n  var DistinctUntilChangedObservable = (function(__super__) {\\n    inherits(DistinctUntilChangedObservable, __super__);\\n    function DistinctUntilChangedObservable(source, keyFn, comparer) {\\n      this.source = source;\\n      this.keyFn = keyFn;\\n      this.comparer = comparer;\\n      __super__.call(this);\\n    }\\n\\n    DistinctUntilChangedObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new DistinctUntilChangedObserver(o, this.keyFn, this.comparer));\\n    };\\n\\n    return DistinctUntilChangedObservable;\\n  }(ObservableBase));\\n\\n  var DistinctUntilChangedObserver = (function(__super__) {\\n    inherits(DistinctUntilChangedObserver, __super__);\\n    function DistinctUntilChangedObserver(o, keyFn, comparer) {\\n      this.o = o;\\n      this.keyFn = keyFn;\\n      this.comparer = comparer;\\n      this.hasCurrentKey = false;\\n      this.currentKey = null;\\n      __super__.call(this);\\n    }\\n\\n    DistinctUntilChangedObserver.prototype.next = function (x) {\\n      var key = x, comparerEquals;\\n      if (isFunction(this.keyFn)) {\\n        key = tryCatch(this.keyFn)(x);\\n        if (key === errorObj) { return this.o.onError(key.e); }\\n      }\\n      if (this.hasCurrentKey) {\\n        comparerEquals = tryCatch(this.comparer)(this.currentKey, key);\\n        if (comparerEquals === errorObj) { return this.o.onError(comparerEquals.e); }\\n      }\\n      if (!this.hasCurrentKey || !comparerEquals) {\\n        this.hasCurrentKey = true;\\n        this.currentKey = key;\\n        this.o.onNext(x);\\n      }\\n    };\\n    DistinctUntilChangedObserver.prototype.error = function(e) {\\n      this.o.onError(e);\\n    };\\n    DistinctUntilChangedObserver.prototype.completed = function () {\\n      this.o.onCompleted();\\n    };\\n\\n    return DistinctUntilChangedObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  *  Returns an observable sequence that contains only distinct contiguous elements according to the keyFn and the comparer.\\n  * @param {Function} [keyFn] A function to compute the comparison key for each element. If not provided, it projects the value.\\n  * @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.\\n  * @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.\\n  */\\n  observableProto.distinctUntilChanged = function (keyFn, comparer) {\\n    comparer || (comparer = defaultComparer);\\n    return new DistinctUntilChangedObservable(this, keyFn, comparer);\\n  };\\n\\n  var TapObservable = (function(__super__) {\\n    inherits(TapObservable,__super__);\\n    function TapObservable(source, observerOrOnNext, onError, onCompleted) {\\n      this.source = source;\\n      this._oN = observerOrOnNext;\\n      this._oE = onError;\\n      this._oC = onCompleted;\\n      __super__.call(this);\\n    }\\n\\n    TapObservable.prototype.subscribeCore = function(o) {\\n      return this.source.subscribe(new InnerObserver(o, this));\\n    };\\n\\n    inherits(InnerObserver, AbstractObserver);\\n    function InnerObserver(o, p) {\\n      this.o = o;\\n      this.t = !p._oN || isFunction(p._oN) ?\\n        observerCreate(p._oN || noop, p._oE || noop, p._oC || noop) :\\n        p._oN;\\n      this.isStopped = false;\\n      AbstractObserver.call(this);\\n    }\\n    InnerObserver.prototype.next = function(x) {\\n      var res = tryCatch(this.t.onNext).call(this.t, x);\\n      if (res === errorObj) { this.o.onError(res.e); }\\n      this.o.onNext(x);\\n    };\\n    InnerObserver.prototype.error = function(err) {\\n      var res = tryCatch(this.t.onError).call(this.t, err);\\n      if (res === errorObj) { return this.o.onError(res.e); }\\n      this.o.onError(err);\\n    };\\n    InnerObserver.prototype.completed = function() {\\n      var res = tryCatch(this.t.onCompleted).call(this.t);\\n      if (res === errorObj) { return this.o.onError(res.e); }\\n      this.o.onCompleted();\\n    };\\n\\n    return TapObservable;\\n  }(ObservableBase));\\n\\n  /**\\n  *  Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.\\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\\n  * @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.\\n  * @param {Function} [onError]  Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.\\n  * @param {Function} [onCompleted]  Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.\\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\\n  */\\n  observableProto[\\'do\\'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {\\n    return new TapObservable(this, observerOrOnNext, onError, onCompleted);\\n  };\\n\\n  /**\\n  *  Invokes an action for each element in the observable sequence.\\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\\n  * @param {Function} onNext Action to invoke for each element in the observable sequence.\\n  * @param {Any} [thisArg] Object to use as this when executing callback.\\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\\n  */\\n  observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {\\n    return this.tap(typeof thisArg !== \\'undefined\\' ? function (x) { onNext.call(thisArg, x); } : onNext);\\n  };\\n\\n  /**\\n  *  Invokes an action upon exceptional termination of the observable sequence.\\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\\n  * @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.\\n  * @param {Any} [thisArg] Object to use as this when executing callback.\\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\\n  */\\n  observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {\\n    return this.tap(noop, typeof thisArg !== \\'undefined\\' ? function (e) { onError.call(thisArg, e); } : onError);\\n  };\\n\\n  /**\\n  *  Invokes an action upon graceful termination of the observable sequence.\\n  *  This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.\\n  * @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.\\n  * @param {Any} [thisArg] Object to use as this when executing callback.\\n  * @returns {Observable} The source sequence with the side-effecting behavior applied.\\n  */\\n  observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {\\n    return this.tap(noop, null, typeof thisArg !== \\'undefined\\' ? function () { onCompleted.call(thisArg); } : onCompleted);\\n  };\\n\\n  var FinallyObservable = (function (__super__) {\\n    inherits(FinallyObservable, __super__);\\n    function FinallyObservable(source, fn, thisArg) {\\n      this.source = source;\\n      this._fn = bindCallback(fn, thisArg, 0);\\n      __super__.call(this);\\n    }\\n\\n    FinallyObservable.prototype.subscribeCore = function (o) {\\n      var d = tryCatch(this.source.subscribe).call(this.source, o);\\n      if (d === errorObj) {\\n        this._fn();\\n        thrower(d.e);\\n      }\\n\\n      return new FinallyDisposable(d, this._fn);\\n    };\\n\\n    function FinallyDisposable(s, fn) {\\n      this.isDisposed = false;\\n      this._s = s;\\n      this._fn = fn;\\n    }\\n    FinallyDisposable.prototype.dispose = function () {\\n      if (!this.isDisposed) {\\n        var res = tryCatch(this._s.dispose).call(this._s);\\n        this._fn();\\n        res === errorObj && thrower(res.e);\\n      }\\n    };\\n\\n    return FinallyObservable;\\n\\n  }(ObservableBase));\\n\\n  /**\\n   *  Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.\\n   * @param {Function} finallyAction Action to invoke after the source observable sequence terminates.\\n   * @returns {Observable} Source sequence with the action-invoking termination behavior applied.\\n   */\\n  observableProto[\\'finally\\'] = function (action, thisArg) {\\n    return new FinallyObservable(this, action, thisArg);\\n  };\\n\\n  var IgnoreElementsObservable = (function(__super__) {\\n    inherits(IgnoreElementsObservable, __super__);\\n\\n    function IgnoreElementsObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    IgnoreElementsObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new InnerObserver(o));\\n    };\\n\\n    function InnerObserver(o) {\\n      this.o = o;\\n      this.isStopped = false;\\n    }\\n    InnerObserver.prototype.onNext = noop;\\n    InnerObserver.prototype.onError = function (err) {\\n      if(!this.isStopped) {\\n        this.isStopped = true;\\n        this.o.onError(err);\\n      }\\n    };\\n    InnerObserver.prototype.onCompleted = function () {\\n      if(!this.isStopped) {\\n        this.isStopped = true;\\n        this.o.onCompleted();\\n      }\\n    };\\n    InnerObserver.prototype.dispose = function() { this.isStopped = true; };\\n    InnerObserver.prototype.fail = function (e) {\\n      if (!this.isStopped) {\\n        this.isStopped = true;\\n        this.observer.onError(e);\\n        return true;\\n      }\\n\\n      return false;\\n    };\\n\\n    return IgnoreElementsObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Ignores all elements in an observable sequence leaving only the termination messages.\\n   * @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.\\n   */\\n  observableProto.ignoreElements = function () {\\n    return new IgnoreElementsObservable(this);\\n  };\\n\\n  var MaterializeObservable = (function (__super__) {\\n    inherits(MaterializeObservable, __super__);\\n    function MaterializeObservable(source, fn) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    MaterializeObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new MaterializeObserver(o));\\n    };\\n\\n    return MaterializeObservable;\\n  }(ObservableBase));\\n\\n  var MaterializeObserver = (function (__super__) {\\n    inherits(MaterializeObserver, __super__);\\n\\n    function MaterializeObserver(o) {\\n      this._o = o;\\n      __super__.call(this);\\n    }\\n\\n    MaterializeObserver.prototype.next = function (x) { this._o.onNext(notificationCreateOnNext(x)) };\\n    MaterializeObserver.prototype.error = function (e) { this._o.onNext(notificationCreateOnError(e)); this._o.onCompleted(); };\\n    MaterializeObserver.prototype.completed = function () { this._o.onNext(notificationCreateOnCompleted()); this._o.onCompleted(); };\\n\\n    return MaterializeObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Materializes the implicit notifications of an observable sequence as explicit notification values.\\n   * @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.\\n   */\\n  observableProto.materialize = function () {\\n    return new MaterializeObservable(this);\\n  };\\n\\n  /**\\n   *  Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.\\n   * @param {Number} [repeatCount]  Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.\\n   * @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.\\n   */\\n  observableProto.repeat = function (repeatCount) {\\n    return enumerableRepeat(this, repeatCount).concat();\\n  };\\n\\n  /**\\n   *  Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.\\n   *  Note if you encounter an error and want it to retry once, then you must use .retry(2);\\n   *\\n   * @example\\n   *  var res = retried = retry.repeat();\\n   *  var res = retried = retry.repeat(2);\\n   * @param {Number} [retryCount]  Number of times to retry the sequence. If not provided, retry the sequence indefinitely.\\n   * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.\\n   */\\n  observableProto.retry = function (retryCount) {\\n    return enumerableRepeat(this, retryCount).catchError();\\n  };\\n\\n  function repeat(value) {\\n    return {\\n      \\'@@iterator\\': function () {\\n        return {\\n          next: function () {\\n            return { done: false, value: value };\\n          }\\n        };\\n      }\\n    };\\n  }\\n\\n  var RetryWhenObservable = (function(__super__) {\\n    function createDisposable(state) {\\n      return {\\n        isDisposed: false,\\n        dispose: function () {\\n          if (!this.isDisposed) {\\n            this.isDisposed = true;\\n            state.isDisposed = true;\\n          }\\n        }\\n      };\\n    }\\n\\n    function RetryWhenObservable(source, notifier) {\\n      this.source = source;\\n      this._notifier = notifier;\\n      __super__.call(this);\\n    }\\n\\n    inherits(RetryWhenObservable, __super__);\\n\\n    RetryWhenObservable.prototype.subscribeCore = function (o) {\\n      var exceptions = new Subject(),\\n        notifier = new Subject(),\\n        handled = this._notifier(exceptions),\\n        notificationDisposable = handled.subscribe(notifier);\\n\\n      var e = this.source[\\'@@iterator\\']();\\n\\n      var state = { isDisposed: false },\\n        lastError,\\n        subscription = new SerialDisposable();\\n      var cancelable = currentThreadScheduler.scheduleRecursive(null, function (_, recurse) {\\n        if (state.isDisposed) { return; }\\n        var currentItem = e.next();\\n\\n        if (currentItem.done) {\\n          if (lastError) {\\n            o.onError(lastError);\\n          } else {\\n            o.onCompleted();\\n          }\\n          return;\\n        }\\n\\n        // Check if promise\\n        var currentValue = currentItem.value;\\n        isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\\n\\n        var outer = new SingleAssignmentDisposable();\\n        var inner = new SingleAssignmentDisposable();\\n        subscription.setDisposable(new BinaryDisposable(inner, outer));\\n        outer.setDisposable(currentValue.subscribe(\\n          function(x) { o.onNext(x); },\\n          function (exn) {\\n            inner.setDisposable(notifier.subscribe(recurse, function(ex) {\\n              o.onError(ex);\\n            }, function() {\\n              o.onCompleted();\\n            }));\\n\\n            exceptions.onNext(exn);\\n            outer.dispose();\\n          },\\n          function() { o.onCompleted(); }));\\n      });\\n\\n      return new NAryDisposable([notificationDisposable, subscription, cancelable, createDisposable(state)]);\\n    };\\n\\n    return RetryWhenObservable;\\n  }(ObservableBase));\\n\\n  observableProto.retryWhen = function (notifier) {\\n    return new RetryWhenObservable(repeat(this), notifier);\\n  };\\n\\n  function repeat(value) {\\n    return {\\n      \\'@@iterator\\': function () {\\n        return {\\n          next: function () {\\n            return { done: false, value: value };\\n          }\\n        };\\n      }\\n    };\\n  }\\n\\n  var RepeatWhenObservable = (function(__super__) {\\n    function createDisposable(state) {\\n      return {\\n        isDisposed: false,\\n        dispose: function () {\\n          if (!this.isDisposed) {\\n            this.isDisposed = true;\\n            state.isDisposed = true;\\n          }\\n        }\\n      };\\n    }\\n\\n    function RepeatWhenObservable(source, notifier) {\\n      this.source = source;\\n      this._notifier = notifier;\\n      __super__.call(this);\\n    }\\n\\n    inherits(RepeatWhenObservable, __super__);\\n\\n    RepeatWhenObservable.prototype.subscribeCore = function (o) {\\n      var completions = new Subject(),\\n        notifier = new Subject(),\\n        handled = this._notifier(completions),\\n        notificationDisposable = handled.subscribe(notifier);\\n\\n      var e = this.source[\\'@@iterator\\']();\\n\\n      var state = { isDisposed: false },\\n        lastError,\\n        subscription = new SerialDisposable();\\n      var cancelable = currentThreadScheduler.scheduleRecursive(null, function (_, recurse) {\\n        if (state.isDisposed) { return; }\\n        var currentItem = e.next();\\n\\n        if (currentItem.done) {\\n          if (lastError) {\\n            o.onError(lastError);\\n          } else {\\n            o.onCompleted();\\n          }\\n          return;\\n        }\\n\\n        // Check if promise\\n        var currentValue = currentItem.value;\\n        isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));\\n\\n        var outer = new SingleAssignmentDisposable();\\n        var inner = new SingleAssignmentDisposable();\\n        subscription.setDisposable(new BinaryDisposable(inner, outer));\\n        outer.setDisposable(currentValue.subscribe(\\n          function(x) { o.onNext(x); },\\n          function (exn) { o.onError(exn); },\\n          function() {\\n            inner.setDisposable(notifier.subscribe(recurse, function(ex) {\\n              o.onError(ex);\\n            }, function() {\\n              o.onCompleted();\\n            }));\\n\\n            completions.onNext(null);\\n            outer.dispose();\\n          }));\\n      });\\n\\n      return new NAryDisposable([notificationDisposable, subscription, cancelable, createDisposable(state)]);\\n    };\\n\\n    return RepeatWhenObservable;\\n  }(ObservableBase));\\n\\n  observableProto.repeatWhen = function (notifier) {\\n    return new RepeatWhenObservable(repeat(this), notifier);\\n  };\\n\\n  var ScanObservable = (function(__super__) {\\n    inherits(ScanObservable, __super__);\\n    function ScanObservable(source, accumulator, hasSeed, seed) {\\n      this.source = source;\\n      this.accumulator = accumulator;\\n      this.hasSeed = hasSeed;\\n      this.seed = seed;\\n      __super__.call(this);\\n    }\\n\\n    ScanObservable.prototype.subscribeCore = function(o) {\\n      return this.source.subscribe(new ScanObserver(o,this));\\n    };\\n\\n    return ScanObservable;\\n  }(ObservableBase));\\n\\n  var ScanObserver = (function (__super__) {\\n    inherits(ScanObserver, __super__);\\n    function ScanObserver(o, parent) {\\n      this._o = o;\\n      this._p = parent;\\n      this._fn = parent.accumulator;\\n      this._hs = parent.hasSeed;\\n      this._s = parent.seed;\\n      this._ha = false;\\n      this._a = null;\\n      this._hv = false;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    ScanObserver.prototype.next = function (x) {\\n      !this._hv && (this._hv = true);\\n      if (this._ha) {\\n        this._a = tryCatch(this._fn)(this._a, x, this._i, this._p);\\n      } else {\\n        this._a = this._hs ? tryCatch(this._fn)(this._s, x, this._i, this._p) : x;\\n        this._ha = true;\\n      }\\n      if (this._a === errorObj) { return this._o.onError(this._a.e); }\\n      this._o.onNext(this._a);\\n      this._i++;\\n    };\\n\\n    ScanObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    ScanObserver.prototype.completed = function () {\\n      !this._hv && this._hs && this._o.onNext(this._s);\\n      this._o.onCompleted();\\n    };\\n\\n    return ScanObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  *  Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.\\n  *  For aggregation behavior with no intermediate results, see Observable.aggregate.\\n  * @param {Mixed} [seed] The initial accumulator value.\\n  * @param {Function} accumulator An accumulator function to be invoked on each element.\\n  * @returns {Observable} An observable sequence containing the accumulated values.\\n  */\\n  observableProto.scan = function () {\\n    var hasSeed = false, seed, accumulator = arguments[0];\\n    if (arguments.length === 2) {\\n      hasSeed = true;\\n      seed = arguments[1];\\n    }\\n    return new ScanObservable(this, accumulator, hasSeed, seed);\\n  };\\n\\n  var SkipLastObservable = (function (__super__) {\\n    inherits(SkipLastObservable, __super__);\\n    function SkipLastObservable(source, c) {\\n      this.source = source;\\n      this._c = c;\\n      __super__.call(this);\\n    }\\n\\n    SkipLastObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new SkipLastObserver(o, this._c));\\n    };\\n\\n    return SkipLastObservable;\\n  }(ObservableBase));\\n\\n  var SkipLastObserver = (function (__super__) {\\n    inherits(SkipLastObserver, __super__);\\n    function SkipLastObserver(o, c) {\\n      this._o = o;\\n      this._c = c;\\n      this._q = [];\\n      __super__.call(this);\\n    }\\n\\n    SkipLastObserver.prototype.next = function (x) {\\n      this._q.push(x);\\n      this._q.length > this._c && this._o.onNext(this._q.shift());\\n    };\\n\\n    SkipLastObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    SkipLastObserver.prototype.completed = function () {\\n      this._o.onCompleted();\\n    };\\n\\n    return SkipLastObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Bypasses a specified number of elements at the end of an observable sequence.\\n   * @description\\n   *  This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are\\n   *  received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.\\n   * @param count Number of elements to bypass at the end of the source sequence.\\n   * @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.\\n   */\\n  observableProto.skipLast = function (count) {\\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\\n    return new SkipLastObservable(this, count);\\n  };\\n\\n  /**\\n   *  Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.\\n   *  @example\\n   *  var res = source.startWith(1, 2, 3);\\n   *  var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);\\n   * @param {Arguments} args The specified values to prepend to the observable sequence\\n   * @returns {Observable} The source sequence prepended with the specified values.\\n   */\\n  observableProto.startWith = function () {\\n    var values, scheduler, start = 0;\\n    if (!!arguments.length && isScheduler(arguments[0])) {\\n      scheduler = arguments[0];\\n      start = 1;\\n    } else {\\n      scheduler = immediateScheduler;\\n    }\\n    for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\\n    return observableConcat.apply(null, [observableFromArray(args, scheduler), this]);\\n  };\\n\\n  var TakeLastObserver = (function (__super__) {\\n    inherits(TakeLastObserver, __super__);\\n    function TakeLastObserver(o, c) {\\n      this._o = o;\\n      this._c = c;\\n      this._q = [];\\n      __super__.call(this);\\n    }\\n\\n    TakeLastObserver.prototype.next = function (x) {\\n      this._q.push(x);\\n      this._q.length > this._c && this._q.shift();\\n    };\\n\\n    TakeLastObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    TakeLastObserver.prototype.completed = function () {\\n      while (this._q.length > 0) { this._o.onNext(this._q.shift()); }\\n      this._o.onCompleted();\\n    };\\n\\n    return TakeLastObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Returns a specified number of contiguous elements from the end of an observable sequence.\\n   * @description\\n   *  This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of\\n   *  the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.\\n   * @param {Number} count Number of elements to take from the end of the source sequence.\\n   * @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.\\n   */\\n  observableProto.takeLast = function (count) {\\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\\n    var source = this;\\n    return new AnonymousObservable(function (o) {\\n      return source.subscribe(new TakeLastObserver(o, count));\\n    }, source);\\n  };\\n\\n  var TakeLastBufferObserver = (function (__super__) {\\n    inherits(TakeLastBufferObserver, __super__);\\n    function TakeLastBufferObserver(o, c) {\\n      this._o = o;\\n      this._c = c;\\n      this._q = [];\\n      __super__.call(this);\\n    }\\n\\n    TakeLastBufferObserver.prototype.next = function (x) {\\n      this._q.push(x);\\n      this._q.length > this._c && this._q.shift();\\n    };\\n\\n    TakeLastBufferObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    TakeLastBufferObserver.prototype.completed = function () {\\n      this._o.onNext(this._q);\\n      this._o.onCompleted();\\n    };\\n\\n    return TakeLastBufferObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Returns an array with the specified number of contiguous elements from the end of an observable sequence.\\n   *\\n   * @description\\n   *  This operator accumulates a buffer with a length enough to store count elements. Upon completion of the\\n   *  source sequence, this buffer is produced on the result sequence.\\n   * @param {Number} count Number of elements to take from the end of the source sequence.\\n   * @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.\\n   */\\n  observableProto.takeLastBuffer = function (count) {\\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\\n    var source = this;\\n    return new AnonymousObservable(function (o) {\\n      return source.subscribe(new TakeLastBufferObserver(o, count));\\n    }, source);\\n  };\\n\\n  /**\\n   *  Projects each element of an observable sequence into zero or more windows which are produced based on element count information.\\n   * @param {Number} count Length of each window.\\n   * @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.\\n   * @returns {Observable} An observable sequence of windows.\\n   */\\n  observableProto.windowWithCount = observableProto.windowCount = function (count, skip) {\\n    var source = this;\\n    +count || (count = 0);\\n    Math.abs(count) === Infinity && (count = 0);\\n    if (count <= 0) { throw new ArgumentOutOfRangeError(); }\\n    skip == null && (skip = count);\\n    +skip || (skip = 0);\\n    Math.abs(skip) === Infinity && (skip = 0);\\n\\n    if (skip <= 0) { throw new ArgumentOutOfRangeError(); }\\n    return new AnonymousObservable(function (observer) {\\n      var m = new SingleAssignmentDisposable(),\\n        refCountDisposable = new RefCountDisposable(m),\\n        n = 0,\\n        q = [];\\n\\n      function createWindow () {\\n        var s = new Subject();\\n        q.push(s);\\n        observer.onNext(addRef(s, refCountDisposable));\\n      }\\n\\n      createWindow();\\n\\n      m.setDisposable(source.subscribe(\\n        function (x) {\\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }\\n          var c = n - count + 1;\\n          c >= 0 && c % skip === 0 && q.shift().onCompleted();\\n          ++n % skip === 0 && createWindow();\\n        },\\n        function (e) {\\n          while (q.length > 0) { q.shift().onError(e); }\\n          observer.onError(e);\\n        },\\n        function () {\\n          while (q.length > 0) { q.shift().onCompleted(); }\\n          observer.onCompleted();\\n        }\\n      ));\\n      return refCountDisposable;\\n    }, source);\\n  };\\n\\n  function concatMap(source, selector, thisArg) {\\n    var selectorFunc = bindCallback(selector, thisArg, 3);\\n    return source.map(function (x, i) {\\n      var result = selectorFunc(x, i, source);\\n      isPromise(result) && (result = observableFromPromise(result));\\n      (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));\\n      return result;\\n    }).concatAll();\\n  }\\n\\n  /**\\n   *  One of the Following:\\n   *  Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\\n   *\\n   * @example\\n   *  var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });\\n   *  Or:\\n   *  Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence\\'s elements, and merges the results into one observable sequence.\\n   *\\n   *  var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });\\n   *  Or:\\n   *  Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.\\n   *\\n   *  var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));\\n   * @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the\\n   * source sequence onto which could be either an observable or Promise.\\n   * @param {Function} [resultSelector]  A transform function to apply to each element of the intermediate sequence.\\n   * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.\\n   */\\n  observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {\\n    if (isFunction(selector) && isFunction(resultSelector)) {\\n      return this.concatMap(function (x, i) {\\n        var selectorResult = selector(x, i);\\n        isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));\\n        (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));\\n\\n        return selectorResult.map(function (y, i2) {\\n          return resultSelector(x, y, i, i2);\\n        });\\n      });\\n    }\\n    return isFunction(selector) ?\\n      concatMap(this, selector, thisArg) :\\n      concatMap(this, function () { return selector; });\\n  };\\n\\n  /**\\n   * Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.\\n   * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.\\n   * @param {Function} onError A transform function to apply when an error occurs in the source sequence.\\n   * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.\\n   * @param {Any} [thisArg] An optional \"this\" to use to invoke each transform.\\n   * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.\\n   */\\n  observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {\\n    var source = this,\\n        onNextFunc = bindCallback(onNext, thisArg, 2),\\n        onErrorFunc = bindCallback(onError, thisArg, 1),\\n        onCompletedFunc = bindCallback(onCompleted, thisArg, 0);\\n    return new AnonymousObservable(function (observer) {\\n      var index = 0;\\n      return source.subscribe(\\n        function (x) {\\n          var result;\\n          try {\\n            result = onNextFunc(x, index++);\\n          } catch (e) {\\n            observer.onError(e);\\n            return;\\n          }\\n          isPromise(result) && (result = observableFromPromise(result));\\n          observer.onNext(result);\\n        },\\n        function (err) {\\n          var result;\\n          try {\\n            result = onErrorFunc(err);\\n          } catch (e) {\\n            observer.onError(e);\\n            return;\\n          }\\n          isPromise(result) && (result = observableFromPromise(result));\\n          observer.onNext(result);\\n          observer.onCompleted();\\n        },\\n        function () {\\n          var result;\\n          try {\\n            result = onCompletedFunc();\\n          } catch (e) {\\n            observer.onError(e);\\n            return;\\n          }\\n          isPromise(result) && (result = observableFromPromise(result));\\n          observer.onNext(result);\\n          observer.onCompleted();\\n        });\\n    }, this).concatAll();\\n  };\\n\\n  var DefaultIfEmptyObserver = (function (__super__) {\\n    inherits(DefaultIfEmptyObserver, __super__);\\n    function DefaultIfEmptyObserver(o, d) {\\n      this._o = o;\\n      this._d = d;\\n      this._f = false;\\n      __super__.call(this);\\n    }\\n\\n    DefaultIfEmptyObserver.prototype.next = function (x) {\\n      this._f = true;\\n      this._o.onNext(x);\\n    };\\n\\n    DefaultIfEmptyObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    DefaultIfEmptyObserver.prototype.completed = function () {\\n      !this._f && this._o.onNext(this._d);\\n      this._o.onCompleted();\\n    };\\n\\n    return DefaultIfEmptyObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.\\n   *\\n   *  var res = obs = xs.defaultIfEmpty();\\n   *  2 - obs = xs.defaultIfEmpty(false);\\n   *\\n   * @memberOf Observable#\\n   * @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.\\n   * @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.\\n   */\\n    observableProto.defaultIfEmpty = function (defaultValue) {\\n      var source = this;\\n      defaultValue === undefined && (defaultValue = null);\\n      return new AnonymousObservable(function (o) {\\n        return source.subscribe(new DefaultIfEmptyObserver(o, defaultValue));\\n      }, source);\\n    };\\n\\n  // Swap out for Array.findIndex\\n  function arrayIndexOfComparer(array, item, comparer) {\\n    for (var i = 0, len = array.length; i < len; i++) {\\n      if (comparer(array[i], item)) { return i; }\\n    }\\n    return -1;\\n  }\\n\\n  function HashSet(comparer) {\\n    this.comparer = comparer;\\n    this.set = [];\\n  }\\n  HashSet.prototype.push = function(value) {\\n    var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;\\n    retValue && this.set.push(value);\\n    return retValue;\\n  };\\n\\n  var DistinctObservable = (function (__super__) {\\n    inherits(DistinctObservable, __super__);\\n    function DistinctObservable(source, keyFn, cmpFn) {\\n      this.source = source;\\n      this._keyFn = keyFn;\\n      this._cmpFn = cmpFn;\\n      __super__.call(this);\\n    }\\n\\n    DistinctObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new DistinctObserver(o, this._keyFn, this._cmpFn));\\n    };\\n\\n    return DistinctObservable;\\n  }(ObservableBase));\\n\\n  var DistinctObserver = (function (__super__) {\\n    inherits(DistinctObserver, __super__);\\n    function DistinctObserver(o, keyFn, cmpFn) {\\n      this._o = o;\\n      this._keyFn = keyFn;\\n      this._h = new HashSet(cmpFn);\\n      __super__.call(this);\\n    }\\n\\n    DistinctObserver.prototype.next = function (x) {\\n      var key = x;\\n      if (isFunction(this._keyFn)) {\\n        key = tryCatch(this._keyFn)(x);\\n        if (key === errorObj) { return this._o.onError(key.e); }\\n      }\\n      this._h.push(key) && this._o.onNext(x);\\n    };\\n\\n    DistinctObserver.prototype.error = function (e) { this._o.onError(e); };\\n    DistinctObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return DistinctObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.\\n   *  Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.\\n   *\\n   * @example\\n   *  var res = obs = xs.distinct();\\n   *  2 - obs = xs.distinct(function (x) { return x.id; });\\n   *  2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });\\n   * @param {Function} [keySelector]  A function to compute the comparison key for each element.\\n   * @param {Function} [comparer]  Used to compare items in the collection.\\n   * @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.\\n   */\\n  observableProto.distinct = function (keySelector, comparer) {\\n    comparer || (comparer = defaultComparer);\\n    return new DistinctObservable(this, keySelector, comparer);\\n  };\\n\\n  /**\\n   *  Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.\\n   *\\n   * @example\\n   *  var res = observable.groupBy(function (x) { return x.id; });\\n   *  2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });\\n   *  3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });\\n   * @param {Function} keySelector A function to extract the key for each element.\\n   * @param {Function} [elementSelector]  A function to map each source element to an element in an observable group.\\n   * @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.\\n   */\\n  observableProto.groupBy = function (keySelector, elementSelector) {\\n    return this.groupByUntil(keySelector, elementSelector, observableNever);\\n  };\\n\\n    /**\\n     *  Groups the elements of an observable sequence according to a specified key selector function.\\n     *  A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same\\n     *  key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.\\n     *\\n     * @example\\n     *  var res = observable.groupByUntil(function (x) { return x.id; }, null,  function () { return Rx.Observable.never(); });\\n     *  2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; },  function () { return Rx.Observable.never(); });\\n     *  3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; },  function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });\\n     * @param {Function} keySelector A function to extract the key for each element.\\n     * @param {Function} durationSelector A function to signal the expiration of a group.\\n     * @returns {Observable}\\n     *  A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.\\n     *  If a group\\'s lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.\\n     *\\n     */\\n    observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector) {\\n      var source = this;\\n      return new AnonymousObservable(function (o) {\\n        var map = new Map(),\\n          groupDisposable = new CompositeDisposable(),\\n          refCountDisposable = new RefCountDisposable(groupDisposable),\\n          handleError = function (e) { return function (item) { item.onError(e); }; };\\n\\n        groupDisposable.add(\\n          source.subscribe(function (x) {\\n            var key = tryCatch(keySelector)(x);\\n            if (key === errorObj) {\\n              map.forEach(handleError(key.e));\\n              return o.onError(key.e);\\n            }\\n\\n            var fireNewMapEntry = false, writer = map.get(key);\\n            if (writer === undefined) {\\n              writer = new Subject();\\n              map.set(key, writer);\\n              fireNewMapEntry = true;\\n            }\\n\\n            if (fireNewMapEntry) {\\n              var group = new GroupedObservable(key, writer, refCountDisposable),\\n                durationGroup = new GroupedObservable(key, writer);\\n              var duration = tryCatch(durationSelector)(durationGroup);\\n              if (duration === errorObj) {\\n                map.forEach(handleError(duration.e));\\n                return o.onError(duration.e);\\n              }\\n\\n              o.onNext(group);\\n\\n              var md = new SingleAssignmentDisposable();\\n              groupDisposable.add(md);\\n\\n              md.setDisposable(duration.take(1).subscribe(\\n                noop,\\n                function (e) {\\n                  map.forEach(handleError(e));\\n                  o.onError(e);\\n                },\\n                function () {\\n                  if (map[\\'delete\\'](key)) { writer.onCompleted(); }\\n                  groupDisposable.remove(md);\\n                }));\\n            }\\n\\n            var element = x;\\n            if (isFunction(elementSelector)) {\\n              element = tryCatch(elementSelector)(x);\\n              if (element === errorObj) {\\n                map.forEach(handleError(element.e));\\n                return o.onError(element.e);\\n              }\\n            }\\n\\n            writer.onNext(element);\\n        }, function (e) {\\n          map.forEach(handleError(e));\\n          o.onError(e);\\n        }, function () {\\n          map.forEach(function (item) { item.onCompleted(); });\\n          o.onCompleted();\\n        }));\\n\\n      return refCountDisposable;\\n    }, source);\\n  };\\n\\n  var MapObservable = (function (__super__) {\\n    inherits(MapObservable, __super__);\\n\\n    function MapObservable(source, selector, thisArg) {\\n      this.source = source;\\n      this.selector = bindCallback(selector, thisArg, 3);\\n      __super__.call(this);\\n    }\\n\\n    function innerMap(selector, self) {\\n      return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); };\\n    }\\n\\n    MapObservable.prototype.internalMap = function (selector, thisArg) {\\n      return new MapObservable(this.source, innerMap(selector, this), thisArg);\\n    };\\n\\n    MapObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new InnerObserver(o, this.selector, this));\\n    };\\n\\n    inherits(InnerObserver, AbstractObserver);\\n    function InnerObserver(o, selector, source) {\\n      this.o = o;\\n      this.selector = selector;\\n      this.source = source;\\n      this.i = 0;\\n      AbstractObserver.call(this);\\n    }\\n\\n    InnerObserver.prototype.next = function(x) {\\n      var result = tryCatch(this.selector)(x, this.i++, this.source);\\n      if (result === errorObj) { return this.o.onError(result.e); }\\n      this.o.onNext(result);\\n    };\\n\\n    InnerObserver.prototype.error = function (e) {\\n      this.o.onError(e);\\n    };\\n\\n    InnerObserver.prototype.completed = function () {\\n      this.o.onCompleted();\\n    };\\n\\n    return MapObservable;\\n\\n  }(ObservableBase));\\n\\n  /**\\n  * Projects each element of an observable sequence into a new form by incorporating the element\\'s index.\\n  * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.\\n  * @param {Any} [thisArg] Object to use as this when executing callback.\\n  * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.\\n  */\\n  observableProto.map = observableProto.select = function (selector, thisArg) {\\n    var selectorFn = typeof selector === \\'function\\' ? selector : function () { return selector; };\\n    return this instanceof MapObservable ?\\n      this.internalMap(selectorFn, thisArg) :\\n      new MapObservable(this, selectorFn, thisArg);\\n  };\\n\\n  function plucker(args, len) {\\n    return function mapper(x) {\\n      var currentProp = x;\\n      for (var i = 0; i < len; i++) {\\n        var p = currentProp[args[i]];\\n        if (typeof p !== \\'undefined\\') {\\n          currentProp = p;\\n        } else {\\n          return undefined;\\n        }\\n      }\\n      return currentProp;\\n    };\\n  }\\n\\n  /**\\n   * Retrieves the value of a specified nested property from all elements in\\n   * the Observable sequence.\\n   * @param {Arguments} arguments The nested properties to pluck.\\n   * @returns {Observable} Returns a new Observable sequence of property values.\\n   */\\n  observableProto.pluck = function () {\\n    var len = arguments.length, args = new Array(len);\\n    if (len === 0) { throw new Error(\\'List of properties cannot be empty.\\'); }\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    return this.map(plucker(args, len));\\n  };\\n\\nobservableProto.flatMap = observableProto.selectMany = observableProto.mergeMap = function(selector, resultSelector, thisArg) {\\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll();\\n};\\n\\n  /**\\n   * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\\n   * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.\\n   * @param {Function} onError A transform function to apply when an error occurs in the source sequence.\\n   * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.\\n   * @param {Any} [thisArg] An optional \"this\" to use to invoke each transform.\\n   * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.\\n   */\\n  observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {\\n    var source = this;\\n    return new AnonymousObservable(function (observer) {\\n      var index = 0;\\n\\n      return source.subscribe(\\n        function (x) {\\n          var result;\\n          try {\\n            result = onNext.call(thisArg, x, index++);\\n          } catch (e) {\\n            observer.onError(e);\\n            return;\\n          }\\n          isPromise(result) && (result = observableFromPromise(result));\\n          observer.onNext(result);\\n        },\\n        function (err) {\\n          var result;\\n          try {\\n            result = onError.call(thisArg, err);\\n          } catch (e) {\\n            observer.onError(e);\\n            return;\\n          }\\n          isPromise(result) && (result = observableFromPromise(result));\\n          observer.onNext(result);\\n          observer.onCompleted();\\n        },\\n        function () {\\n          var result;\\n          try {\\n            result = onCompleted.call(thisArg);\\n          } catch (e) {\\n            observer.onError(e);\\n            return;\\n          }\\n          isPromise(result) && (result = observableFromPromise(result));\\n          observer.onNext(result);\\n          observer.onCompleted();\\n        });\\n    }, source).mergeAll();\\n  };\\n\\nobservableProto.flatMapLatest = observableProto.switchMap = function(selector, resultSelector, thisArg) {\\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).switchLatest();\\n};\\n\\n  var SkipObservable = (function(__super__) {\\n    inherits(SkipObservable, __super__);\\n    function SkipObservable(source, count) {\\n      this.source = source;\\n      this._count = count;\\n      __super__.call(this);\\n    }\\n\\n    SkipObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new SkipObserver(o, this._count));\\n    };\\n\\n    function SkipObserver(o, c) {\\n      this._o = o;\\n      this._r = c;\\n      AbstractObserver.call(this);\\n    }\\n\\n    inherits(SkipObserver, AbstractObserver);\\n\\n    SkipObserver.prototype.next = function (x) {\\n      if (this._r <= 0) {\\n        this._o.onNext(x);\\n      } else {\\n        this._r--;\\n      }\\n    };\\n    SkipObserver.prototype.error = function(e) { this._o.onError(e); };\\n    SkipObserver.prototype.completed = function() { this._o.onCompleted(); };\\n\\n    return SkipObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   * Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.\\n   * @param {Number} count The number of elements to skip before returning the remaining elements.\\n   * @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.\\n   */\\n  observableProto.skip = function (count) {\\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\\n    return new SkipObservable(this, count);\\n  };\\n\\n  var SkipWhileObservable = (function (__super__) {\\n    inherits(SkipWhileObservable, __super__);\\n    function SkipWhileObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    SkipWhileObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new SkipWhileObserver(o, this));\\n    };\\n\\n    return SkipWhileObservable;\\n  }(ObservableBase));\\n\\n  var SkipWhileObserver = (function (__super__) {\\n    inherits(SkipWhileObserver, __super__);\\n\\n    function SkipWhileObserver(o, p) {\\n      this._o = o;\\n      this._p = p;\\n      this._i = 0;\\n      this._r = false;\\n      __super__.call(this);\\n    }\\n\\n    SkipWhileObserver.prototype.next = function (x) {\\n      if (!this._r) {\\n        var res = tryCatch(this._p._fn)(x, this._i++, this._p);\\n        if (res === errorObj) { return this._o.onError(res.e); }\\n        this._r = !res;\\n      }\\n      this._r && this._o.onNext(x);\\n    };\\n    SkipWhileObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SkipWhileObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return SkipWhileObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.\\n   *  The element\\'s index is used in the logic of the predicate function.\\n   *\\n   *  var res = source.skipWhile(function (value) { return value < 10; });\\n   *  var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });\\n   * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.\\n   * @param {Any} [thisArg] Object to use as this when executing callback.\\n   * @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.\\n   */\\n  observableProto.skipWhile = function (predicate, thisArg) {\\n    var fn = bindCallback(predicate, thisArg, 3);\\n    return new SkipWhileObservable(this, fn);\\n  };\\n\\n  var TakeObservable = (function(__super__) {\\n    inherits(TakeObservable, __super__);\\n    function TakeObservable(source, count) {\\n      this.source = source;\\n      this._count = count;\\n      __super__.call(this);\\n    }\\n\\n    TakeObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new TakeObserver(o, this._count));\\n    };\\n\\n    function TakeObserver(o, c) {\\n      this._o = o;\\n      this._c = c;\\n      this._r = c;\\n      AbstractObserver.call(this);\\n    }\\n\\n    inherits(TakeObserver, AbstractObserver);\\n\\n    TakeObserver.prototype.next = function (x) {\\n      if (this._r-- > 0) {\\n        this._o.onNext(x);\\n        this._r <= 0 && this._o.onCompleted();\\n      }\\n    };\\n\\n    TakeObserver.prototype.error = function (e) { this._o.onError(e); };\\n    TakeObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return TakeObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).\\n   * @param {Number} count The number of elements to return.\\n   * @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name=\"count count</paramref> is set to 0.\\n   * @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.\\n   */\\n  observableProto.take = function (count, scheduler) {\\n    if (count < 0) { throw new ArgumentOutOfRangeError(); }\\n    if (count === 0) { return observableEmpty(scheduler); }\\n    return new TakeObservable(this, count);\\n  };\\n\\n  var TakeWhileObservable = (function (__super__) {\\n    inherits(TakeWhileObservable, __super__);\\n    function TakeWhileObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    TakeWhileObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new TakeWhileObserver(o, this));\\n    };\\n\\n    return TakeWhileObservable;\\n  }(ObservableBase));\\n\\n  var TakeWhileObserver = (function (__super__) {\\n    inherits(TakeWhileObserver, __super__);\\n\\n    function TakeWhileObserver(o, p) {\\n      this._o = o;\\n      this._p = p;\\n      this._i = 0;\\n      this._r = true;\\n      __super__.call(this);\\n    }\\n\\n    TakeWhileObserver.prototype.next = function (x) {\\n      if (this._r) {\\n        this._r = tryCatch(this._p._fn)(x, this._i++, this._p);\\n        if (this._r === errorObj) { return this._o.onError(this._r.e); }\\n      }\\n      if (this._r) {\\n        this._o.onNext(x);\\n      } else {\\n        this._o.onCompleted();\\n      }\\n    };\\n    TakeWhileObserver.prototype.error = function (e) { this._o.onError(e); };\\n    TakeWhileObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return TakeWhileObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Returns elements from an observable sequence as long as a specified condition is true.\\n   *  The element\\'s index is used in the logic of the predicate function.\\n   * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.\\n   * @param {Any} [thisArg] Object to use as this when executing callback.\\n   * @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.\\n   */\\n  observableProto.takeWhile = function (predicate, thisArg) {\\n    var fn = bindCallback(predicate, thisArg, 3);\\n    return new TakeWhileObservable(this, fn);\\n  };\\n\\n  var FilterObservable = (function (__super__) {\\n    inherits(FilterObservable, __super__);\\n\\n    function FilterObservable(source, predicate, thisArg) {\\n      this.source = source;\\n      this.predicate = bindCallback(predicate, thisArg, 3);\\n      __super__.call(this);\\n    }\\n\\n    FilterObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new InnerObserver(o, this.predicate, this));\\n    };\\n\\n    function innerPredicate(predicate, self) {\\n      return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }\\n    }\\n\\n    FilterObservable.prototype.internalFilter = function(predicate, thisArg) {\\n      return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);\\n    };\\n\\n    inherits(InnerObserver, AbstractObserver);\\n    function InnerObserver(o, predicate, source) {\\n      this.o = o;\\n      this.predicate = predicate;\\n      this.source = source;\\n      this.i = 0;\\n      AbstractObserver.call(this);\\n    }\\n\\n    InnerObserver.prototype.next = function(x) {\\n      var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);\\n      if (shouldYield === errorObj) {\\n        return this.o.onError(shouldYield.e);\\n      }\\n      shouldYield && this.o.onNext(x);\\n    };\\n\\n    InnerObserver.prototype.error = function (e) {\\n      this.o.onError(e);\\n    };\\n\\n    InnerObserver.prototype.completed = function () {\\n      this.o.onCompleted();\\n    };\\n\\n    return FilterObservable;\\n\\n  }(ObservableBase));\\n\\n  /**\\n  *  Filters the elements of an observable sequence based on a predicate by incorporating the element\\'s index.\\n  * @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.\\n  * @param {Any} [thisArg] Object to use as this when executing callback.\\n  * @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.\\n  */\\n  observableProto.filter = observableProto.where = function (predicate, thisArg) {\\n    return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :\\n      new FilterObservable(this, predicate, thisArg);\\n  };\\n\\n  var ExtremaByObservable = (function (__super__) {\\n    inherits(ExtremaByObservable, __super__);\\n    function ExtremaByObservable(source, k, c) {\\n      this.source = source;\\n      this._k = k;\\n      this._c = c;\\n      __super__.call(this);\\n    }\\n\\n    ExtremaByObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new ExtremaByObserver(o, this._k, this._c));\\n    };\\n\\n    return ExtremaByObservable;\\n  }(ObservableBase));\\n\\n  var ExtremaByObserver = (function (__super__) {\\n    inherits(ExtremaByObserver, __super__);\\n    function ExtremaByObserver(o, k, c) {\\n      this._o = o;\\n      this._k = k;\\n      this._c = c;\\n      this._v = null;\\n      this._hv = false;\\n      this._l = [];\\n      __super__.call(this);\\n    }\\n\\n    ExtremaByObserver.prototype.next = function (x) {\\n      var key = tryCatch(this._k)(x);\\n      if (key === errorObj) { return this._o.onError(key.e); }\\n      var comparison = 0;\\n      if (!this._hv) {\\n        this._hv = true;\\n        this._v = key;\\n      } else {\\n        comparison = tryCatch(this._c)(key, this._v);\\n        if (comparison === errorObj) { return this._o.onError(comparison.e); }\\n      }\\n      if (comparison > 0) {\\n        this._v = key;\\n        this._l = [];\\n      }\\n      if (comparison >= 0) { this._l.push(x); }\\n    };\\n\\n    ExtremaByObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    ExtremaByObserver.prototype.completed = function () {\\n      this._o.onNext(this._l);\\n      this._o.onCompleted();\\n    };\\n\\n    return ExtremaByObserver;\\n  }(AbstractObserver));\\n\\n  function firstOnly(x) {\\n    if (x.length === 0) { throw new EmptyError(); }\\n    return x[0];\\n  }\\n\\n  var ReduceObservable = (function(__super__) {\\n    inherits(ReduceObservable, __super__);\\n    function ReduceObservable(source, accumulator, hasSeed, seed) {\\n      this.source = source;\\n      this.accumulator = accumulator;\\n      this.hasSeed = hasSeed;\\n      this.seed = seed;\\n      __super__.call(this);\\n    }\\n\\n    ReduceObservable.prototype.subscribeCore = function(observer) {\\n      return this.source.subscribe(new ReduceObserver(observer,this));\\n    };\\n\\n    return ReduceObservable;\\n  }(ObservableBase));\\n\\n  var ReduceObserver = (function (__super__) {\\n    inherits(ReduceObserver, __super__);\\n    function ReduceObserver(o, parent) {\\n      this._o = o;\\n      this._p = parent;\\n      this._fn = parent.accumulator;\\n      this._hs = parent.hasSeed;\\n      this._s = parent.seed;\\n      this._ha = false;\\n      this._a = null;\\n      this._hv = false;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    ReduceObserver.prototype.next = function (x) {\\n      !this._hv && (this._hv = true);\\n      if (this._ha) {\\n        this._a = tryCatch(this._fn)(this._a, x, this._i, this._p);\\n      } else {\\n        this._a = this._hs ? tryCatch(this._fn)(this._s, x, this._i, this._p) : x;\\n        this._ha = true;\\n      }\\n      if (this._a === errorObj) { return this._o.onError(this._a.e); }\\n      this._i++;\\n    };\\n\\n    ReduceObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    ReduceObserver.prototype.completed = function () {\\n      this._hv && this._o.onNext(this._a);\\n      !this._hv && this._hs && this._o.onNext(this._s);\\n      !this._hv && !this._hs && this._o.onError(new EmptyError());\\n      this._o.onCompleted();\\n    };\\n\\n    return ReduceObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.\\n  * For aggregation behavior with incremental intermediate results, see Observable.scan.\\n  * @param {Function} accumulator An accumulator function to be invoked on each element.\\n  * @param {Any} [seed] The initial accumulator value.\\n  * @returns {Observable} An observable sequence containing a single element with the final accumulator value.\\n  */\\n  observableProto.reduce = function () {\\n    var hasSeed = false, seed, accumulator = arguments[0];\\n    if (arguments.length === 2) {\\n      hasSeed = true;\\n      seed = arguments[1];\\n    }\\n    return new ReduceObservable(this, accumulator, hasSeed, seed);\\n  };\\n\\n  var SomeObservable = (function (__super__) {\\n    inherits(SomeObservable, __super__);\\n    function SomeObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    SomeObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new SomeObserver(o, this._fn, this.source));\\n    };\\n\\n    return SomeObservable;\\n  }(ObservableBase));\\n\\n  var SomeObserver = (function (__super__) {\\n    inherits(SomeObserver, __super__);\\n\\n    function SomeObserver(o, fn, s) {\\n      this._o = o;\\n      this._fn = fn;\\n      this._s = s;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    SomeObserver.prototype.next = function (x) {\\n      var result = tryCatch(this._fn)(x, this._i++, this._s);\\n      if (result === errorObj) { return this._o.onError(result.e); }\\n      if (Boolean(result)) {\\n        this._o.onNext(true);\\n        this._o.onCompleted();\\n      }\\n    };\\n    SomeObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SomeObserver.prototype.completed = function () {\\n      this._o.onNext(false);\\n      this._o.onCompleted();\\n    };\\n\\n    return SomeObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.\\n   * @param {Function} [predicate] A function to test each element for a condition.\\n   * @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.\\n   */\\n  observableProto.some = function (predicate, thisArg) {\\n    var fn = bindCallback(predicate, thisArg, 3);\\n    return new SomeObservable(this, fn);\\n  };\\n\\n  var IsEmptyObservable = (function (__super__) {\\n    inherits(IsEmptyObservable, __super__);\\n    function IsEmptyObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    IsEmptyObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new IsEmptyObserver(o));\\n    };\\n\\n    return IsEmptyObservable;\\n  }(ObservableBase));\\n\\n  var IsEmptyObserver = (function(__super__) {\\n    inherits(IsEmptyObserver, __super__);\\n    function IsEmptyObserver(o) {\\n      this._o = o;\\n      __super__.call(this);\\n    }\\n\\n    IsEmptyObserver.prototype.next = function () {\\n      this._o.onNext(false);\\n      this._o.onCompleted();\\n    };\\n    IsEmptyObserver.prototype.error = function (e) { this._o.onError(e); };\\n    IsEmptyObserver.prototype.completed = function () {\\n      this._o.onNext(true);\\n      this._o.onCompleted();\\n    };\\n\\n    return IsEmptyObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Determines whether an observable sequence is empty.\\n   * @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.\\n   */\\n  observableProto.isEmpty = function () {\\n    return new IsEmptyObservable(this);\\n  };\\n\\n  var EveryObservable = (function (__super__) {\\n    inherits(EveryObservable, __super__);\\n    function EveryObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    EveryObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new EveryObserver(o, this._fn, this.source));\\n    };\\n\\n    return EveryObservable;\\n  }(ObservableBase));\\n\\n  var EveryObserver = (function (__super__) {\\n    inherits(EveryObserver, __super__);\\n\\n    function EveryObserver(o, fn, s) {\\n      this._o = o;\\n      this._fn = fn;\\n      this._s = s;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    EveryObserver.prototype.next = function (x) {\\n      var result = tryCatch(this._fn)(x, this._i++, this._s);\\n      if (result === errorObj) { return this._o.onError(result.e); }\\n      if (!Boolean(result)) {\\n        this._o.onNext(false);\\n        this._o.onCompleted();\\n      }\\n    };\\n    EveryObserver.prototype.error = function (e) { this._o.onError(e); };\\n    EveryObserver.prototype.completed = function () {\\n      this._o.onNext(true);\\n      this._o.onCompleted();\\n    };\\n\\n    return EveryObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Determines whether all elements of an observable sequence satisfy a condition.\\n   * @param {Function} [predicate] A function to test each element for a condition.\\n   * @param {Any} [thisArg] Object to use as this when executing callback.\\n   * @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.\\n   */\\n  observableProto.every = function (predicate, thisArg) {\\n    var fn = bindCallback(predicate, thisArg, 3);\\n    return new EveryObservable(this, fn);\\n  };\\n\\n  var IncludesObservable = (function (__super__) {\\n    inherits(IncludesObservable, __super__);\\n    function IncludesObservable(source, elem, idx) {\\n      var n = +idx || 0;\\n      Math.abs(n) === Infinity && (n = 0);\\n\\n      this.source = source;\\n      this._elem = elem;\\n      this._n = n;\\n      __super__.call(this);\\n    }\\n\\n    IncludesObservable.prototype.subscribeCore = function (o) {\\n      if (this._n < 0) {\\n        o.onNext(false);\\n        o.onCompleted();\\n        return disposableEmpty;\\n      }\\n\\n      return this.source.subscribe(new IncludesObserver(o, this._elem, this._n));\\n    };\\n\\n    return IncludesObservable;\\n  }(ObservableBase));\\n\\n  var IncludesObserver = (function (__super__) {\\n    inherits(IncludesObserver, __super__);\\n    function IncludesObserver(o, elem, n) {\\n      this._o = o;\\n      this._elem = elem;\\n      this._n = n;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    function comparer(a, b) {\\n      return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));\\n    }\\n\\n    IncludesObserver.prototype.next = function (x) {\\n      if (this._i++ >= this._n && comparer(x, this._elem)) {\\n        this._o.onNext(true);\\n        this._o.onCompleted();\\n      }\\n    };\\n    IncludesObserver.prototype.error = function (e) { this._o.onError(e); };\\n    IncludesObserver.prototype.completed = function () { this._o.onNext(false); this._o.onCompleted(); };\\n\\n    return IncludesObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Determines whether an observable sequence includes a specified element with an optional equality comparer.\\n   * @param searchElement The value to locate in the source sequence.\\n   * @param {Number} [fromIndex] An equality comparer to compare elements.\\n   * @returns {Observable} An observable sequence containing a single element determining whether the source sequence includes an element that has the specified value from the given index.\\n   */\\n  observableProto.includes = function (searchElement, fromIndex) {\\n    return new IncludesObservable(this, searchElement, fromIndex);\\n  };\\n\\n  var CountObservable = (function (__super__) {\\n    inherits(CountObservable, __super__);\\n    function CountObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    CountObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new CountObserver(o, this._fn, this.source));\\n    };\\n\\n    return CountObservable;\\n  }(ObservableBase));\\n\\n  var CountObserver = (function (__super__) {\\n    inherits(CountObserver, __super__);\\n\\n    function CountObserver(o, fn, s) {\\n      this._o = o;\\n      this._fn = fn;\\n      this._s = s;\\n      this._i = 0;\\n      this._c = 0;\\n      __super__.call(this);\\n    }\\n\\n    CountObserver.prototype.next = function (x) {\\n      if (this._fn) {\\n        var result = tryCatch(this._fn)(x, this._i++, this._s);\\n        if (result === errorObj) { return this._o.onError(result.e); }\\n        Boolean(result) && (this._c++);\\n      } else {\\n        this._c++;\\n      }\\n    };\\n    CountObserver.prototype.error = function (e) { this._o.onError(e); };\\n    CountObserver.prototype.completed = function () {\\n      this._o.onNext(this._c);\\n      this._o.onCompleted();\\n    };\\n\\n    return CountObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.\\n   * @example\\n   * res = source.count();\\n   * res = source.count(function (x) { return x > 3; });\\n   * @param {Function} [predicate]A function to test each element for a condition.\\n   * @param {Any} [thisArg] Object to use as this when executing callback.\\n   * @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.\\n   */\\n  observableProto.count = function (predicate, thisArg) {\\n    var fn = bindCallback(predicate, thisArg, 3);\\n    return new CountObservable(this, fn);\\n  };\\n\\n  var IndexOfObservable = (function (__super__) {\\n    inherits(IndexOfObservable, __super__);\\n    function IndexOfObservable(source, e, n) {\\n      this.source = source;\\n      this._e = e;\\n      this._n = n;\\n      __super__.call(this);\\n    }\\n\\n    IndexOfObservable.prototype.subscribeCore = function (o) {\\n      if (this._n < 0) {\\n        o.onNext(-1);\\n        o.onCompleted();\\n        return disposableEmpty;\\n      }\\n\\n      return this.source.subscribe(new IndexOfObserver(o, this._e, this._n));\\n    };\\n\\n    return IndexOfObservable;\\n  }(ObservableBase));\\n\\n  var IndexOfObserver = (function (__super__) {\\n    inherits(IndexOfObserver, __super__);\\n    function IndexOfObserver(o, e, n) {\\n      this._o = o;\\n      this._e = e;\\n      this._n = n;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    IndexOfObserver.prototype.next = function (x) {\\n      if (this._i >= this._n && x === this._e) {\\n        this._o.onNext(this._i);\\n        this._o.onCompleted();\\n      }\\n      this._i++;\\n    };\\n    IndexOfObserver.prototype.error = function (e) { this._o.onError(e); };\\n    IndexOfObserver.prototype.completed = function () { this._o.onNext(-1); this._o.onCompleted(); };\\n\\n    return IndexOfObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.\\n   * @param {Any} searchElement Element to locate in the array.\\n   * @param {Number} [fromIndex] The index to start the search.  If not specified, defaults to 0.\\n   * @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.\\n   */\\n  observableProto.indexOf = function(searchElement, fromIndex) {\\n    var n = +fromIndex || 0;\\n    Math.abs(n) === Infinity && (n = 0);\\n    return new IndexOfObservable(this, searchElement, n);\\n  };\\n\\n  var SumObservable = (function (__super__) {\\n    inherits(SumObservable, __super__);\\n    function SumObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    SumObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new SumObserver(o, this._fn, this.source));\\n    };\\n\\n    return SumObservable;\\n  }(ObservableBase));\\n\\n  var SumObserver = (function (__super__) {\\n    inherits(SumObserver, __super__);\\n\\n    function SumObserver(o, fn, s) {\\n      this._o = o;\\n      this._fn = fn;\\n      this._s = s;\\n      this._i = 0;\\n      this._c = 0;\\n      __super__.call(this);\\n    }\\n\\n    SumObserver.prototype.next = function (x) {\\n      if (this._fn) {\\n        var result = tryCatch(this._fn)(x, this._i++, this._s);\\n        if (result === errorObj) { return this._o.onError(result.e); }\\n        this._c += result;\\n      } else {\\n        this._c += x;\\n      }\\n    };\\n    SumObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SumObserver.prototype.completed = function () {\\n      this._o.onNext(this._c);\\n      this._o.onCompleted();\\n    };\\n\\n    return SumObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.\\n   * @param {Function} [selector] A transform function to apply to each element.\\n   * @param {Any} [thisArg] Object to use as this when executing callback.\\n   * @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.\\n   */\\n  observableProto.sum = function (keySelector, thisArg) {\\n    var fn = bindCallback(keySelector, thisArg, 3);\\n    return new SumObservable(this, fn);\\n  };\\n\\n  /**\\n   * Returns the elements in an observable sequence with the minimum key value according to the specified comparer.\\n   * @example\\n   * var res = source.minBy(function (x) { return x.value; });\\n   * var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });\\n   * @param {Function} keySelector Key selector function.\\n   * @param {Function} [comparer] Comparer used to compare key values.\\n   * @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.\\n   */\\n  observableProto.minBy = function (keySelector, comparer) {\\n    comparer || (comparer = defaultSubComparer);\\n    return new ExtremaByObservable(this, keySelector, function (x, y) { return comparer(x, y) * -1; });\\n  };\\n\\n  /**\\n   * Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.\\n   * @example\\n   * var res = source.min();\\n   * var res = source.min(function (x, y) { return x.value - y.value; });\\n   * @param {Function} [comparer] Comparer used to compare elements.\\n   * @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.\\n   */\\n  observableProto.min = function (comparer) {\\n    return this.minBy(identity, comparer).map(firstOnly);\\n  };\\n\\n  /**\\n   * Returns the elements in an observable sequence with the maximum  key value according to the specified comparer.\\n   * @example\\n   * var res = source.maxBy(function (x) { return x.value; });\\n   * var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });\\n   * @param {Function} keySelector Key selector function.\\n   * @param {Function} [comparer]  Comparer used to compare key values.\\n   * @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.\\n   */\\n  observableProto.maxBy = function (keySelector, comparer) {\\n    comparer || (comparer = defaultSubComparer);\\n    return new ExtremaByObservable(this, keySelector, comparer);\\n  };\\n\\n  /**\\n   * Returns the maximum value in an observable sequence according to the specified comparer.\\n   * @example\\n   * var res = source.max();\\n   * var res = source.max(function (x, y) { return x.value - y.value; });\\n   * @param {Function} [comparer] Comparer used to compare elements.\\n   * @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.\\n   */\\n  observableProto.max = function (comparer) {\\n    return this.maxBy(identity, comparer).map(firstOnly);\\n  };\\n\\n  var AverageObservable = (function (__super__) {\\n    inherits(AverageObservable, __super__);\\n    function AverageObservable(source, fn) {\\n      this.source = source;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    AverageObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new AverageObserver(o, this._fn, this.source));\\n    };\\n\\n    return AverageObservable;\\n  }(ObservableBase));\\n\\n  var AverageObserver = (function(__super__) {\\n    inherits(AverageObserver, __super__);\\n    function AverageObserver(o, fn, s) {\\n      this._o = o;\\n      this._fn = fn;\\n      this._s = s;\\n      this._c = 0;\\n      this._t = 0;\\n      __super__.call(this);\\n    }\\n\\n    AverageObserver.prototype.next = function (x) {\\n      if(this._fn) {\\n        var r = tryCatch(this._fn)(x, this._c++, this._s);\\n        if (r === errorObj) { return this._o.onError(r.e); }\\n        this._t += r;\\n      } else {\\n        this._c++;\\n        this._t += x;\\n      }\\n    };\\n    AverageObserver.prototype.error = function (e) { this._o.onError(e); };\\n    AverageObserver.prototype.completed = function () {\\n      if (this._c === 0) { return this._o.onError(new EmptyError()); }\\n      this._o.onNext(this._t / this._c);\\n      this._o.onCompleted();\\n    };\\n\\n    return AverageObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.\\n   * @param {Function} [selector] A transform function to apply to each element.\\n   * @param {Any} [thisArg] Object to use as this when executing callback.\\n   * @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.\\n   */\\n  observableProto.average = function (keySelector, thisArg) {\\n    var source = this, fn;\\n    if (isFunction(keySelector)) {\\n      fn = bindCallback(keySelector, thisArg, 3);\\n    }\\n    return new AverageObservable(source, fn);\\n  };\\n\\n  /**\\n   *  Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.\\n   *\\n   * @example\\n   * var res = res = source.sequenceEqual([1,2,3]);\\n   * var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });\\n   * 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));\\n   * 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });\\n   * @param {Observable} second Second observable sequence or array to compare.\\n   * @param {Function} [comparer] Comparer used to compare elements of both sequences.\\n   * @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.\\n   */\\n  observableProto.sequenceEqual = function (second, comparer) {\\n    var first = this;\\n    comparer || (comparer = defaultComparer);\\n    return new AnonymousObservable(function (o) {\\n      var donel = false, doner = false, ql = [], qr = [];\\n      var subscription1 = first.subscribe(function (x) {\\n        if (qr.length > 0) {\\n          var v = qr.shift();\\n          var equal = tryCatch(comparer)(v, x);\\n          if (equal === errorObj) { return o.onError(equal.e); }\\n          if (!equal) {\\n            o.onNext(false);\\n            o.onCompleted();\\n          }\\n        } else if (doner) {\\n          o.onNext(false);\\n          o.onCompleted();\\n        } else {\\n          ql.push(x);\\n        }\\n      }, function(e) { o.onError(e); }, function () {\\n        donel = true;\\n        if (ql.length === 0) {\\n          if (qr.length > 0) {\\n            o.onNext(false);\\n            o.onCompleted();\\n          } else if (doner) {\\n            o.onNext(true);\\n            o.onCompleted();\\n          }\\n        }\\n      });\\n\\n      (isArrayLike(second) || isIterable(second)) && (second = observableFrom(second));\\n      isPromise(second) && (second = observableFromPromise(second));\\n      var subscription2 = second.subscribe(function (x) {\\n        if (ql.length > 0) {\\n          var v = ql.shift();\\n          var equal = tryCatch(comparer)(v, x);\\n          if (equal === errorObj) { return o.onError(equal.e); }\\n          if (!equal) {\\n            o.onNext(false);\\n            o.onCompleted();\\n          }\\n        } else if (donel) {\\n          o.onNext(false);\\n          o.onCompleted();\\n        } else {\\n          qr.push(x);\\n        }\\n      }, function(e) { o.onError(e); }, function () {\\n        doner = true;\\n        if (qr.length === 0) {\\n          if (ql.length > 0) {\\n            o.onNext(false);\\n            o.onCompleted();\\n          } else if (donel) {\\n            o.onNext(true);\\n            o.onCompleted();\\n          }\\n        }\\n      });\\n      return new BinaryDisposable(subscription1, subscription2);\\n    }, first);\\n  };\\n\\n  var ElementAtObservable = (function (__super__) {\\n    inherits(ElementAtObservable, __super__);\\n    function ElementAtObservable(source, i, d) {\\n      this.source = source;\\n      this._i = i;\\n      this._d = d;\\n      __super__.call(this);\\n    }\\n\\n    ElementAtObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new ElementAtObserver(o, this._i, this._d));\\n    };\\n\\n    return ElementAtObservable;\\n  }(ObservableBase));\\n\\n  var ElementAtObserver = (function (__super__) {\\n    inherits(ElementAtObserver, __super__);\\n\\n    function ElementAtObserver(o, i, d) {\\n      this._o = o;\\n      this._i = i;\\n      this._d = d;\\n      __super__.call(this);\\n    }\\n\\n    ElementAtObserver.prototype.next = function (x) {\\n      if (this._i-- === 0) {\\n        this._o.onNext(x);\\n        this._o.onCompleted();\\n      }\\n    };\\n    ElementAtObserver.prototype.error = function (e) { this._o.onError(e); };\\n    ElementAtObserver.prototype.completed = function () {\\n      if (this._d === undefined) {\\n        this._o.onError(new ArgumentOutOfRangeError());\\n      } else {\\n        this._o.onNext(this._d);\\n        this._o.onCompleted();\\n      }\\n    };\\n\\n    return ElementAtObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns the element at a specified index in a sequence or default value if not found.\\n   * @param {Number} index The zero-based index of the element to retrieve.\\n   * @param {Any} [defaultValue] The default value to use if elementAt does not find a value.\\n   * @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.\\n   */\\n  observableProto.elementAt =  function (index, defaultValue) {\\n    if (index < 0) { throw new ArgumentOutOfRangeError(); }\\n    return new ElementAtObservable(this, index, defaultValue);\\n  };\\n\\n  var SingleObserver = (function(__super__) {\\n    inherits(SingleObserver, __super__);\\n    function SingleObserver(o, obj, s) {\\n      this._o = o;\\n      this._obj = obj;\\n      this._s = s;\\n      this._i = 0;\\n      this._hv = false;\\n      this._v = null;\\n      __super__.call(this);\\n    }\\n\\n    SingleObserver.prototype.next = function (x) {\\n      var shouldYield = false;\\n      if (this._obj.predicate) {\\n        var res = tryCatch(this._obj.predicate)(x, this._i++, this._s);\\n        if (res === errorObj) { return this._o.onError(res.e); }\\n        Boolean(res) && (shouldYield = true);\\n      } else if (!this._obj.predicate) {\\n        shouldYield = true;\\n      }\\n      if (shouldYield) {\\n        if (this._hv) {\\n          return this._o.onError(new Error(\\'Sequence contains more than one matching element\\'));\\n        }\\n        this._hv = true;\\n        this._v = x;\\n      }\\n    };\\n    SingleObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SingleObserver.prototype.completed = function () {\\n      if (this._hv) {\\n        this._o.onNext(this._v);\\n        this._o.onCompleted();\\n      }\\n      else if (this._obj.defaultValue === undefined) {\\n        this._o.onError(new EmptyError());\\n      } else {\\n        this._o.onNext(this._obj.defaultValue);\\n        this._o.onCompleted();\\n      }\\n    };\\n\\n    return SingleObserver;\\n  }(AbstractObserver));\\n\\n\\n    /**\\n     * Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.\\n     * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.\\n     */\\n    observableProto.single = function (predicate, thisArg) {\\n      var obj = {}, source = this;\\n      if (typeof arguments[0] === \\'object\\') {\\n        obj = arguments[0];\\n      } else {\\n        obj = {\\n          predicate: arguments[0],\\n          thisArg: arguments[1],\\n          defaultValue: arguments[2]\\n        };\\n      }\\n      if (isFunction (obj.predicate)) {\\n        var fn = obj.predicate;\\n        obj.predicate = bindCallback(fn, obj.thisArg, 3);\\n      }\\n      return new AnonymousObservable(function (o) {\\n        return source.subscribe(new SingleObserver(o, obj, source));\\n      }, source);\\n    };\\n\\n  var FirstObservable = (function (__super__) {\\n    inherits(FirstObservable, __super__);\\n    function FirstObservable(source, obj) {\\n      this.source = source;\\n      this._obj = obj;\\n      __super__.call(this);\\n    }\\n\\n    FirstObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new FirstObserver(o, this._obj, this.source));\\n    };\\n\\n    return FirstObservable;\\n  }(ObservableBase));\\n\\n  var FirstObserver = (function(__super__) {\\n    inherits(FirstObserver, __super__);\\n    function FirstObserver(o, obj, s) {\\n      this._o = o;\\n      this._obj = obj;\\n      this._s = s;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    FirstObserver.prototype.next = function (x) {\\n      if (this._obj.predicate) {\\n        var res = tryCatch(this._obj.predicate)(x, this._i++, this._s);\\n        if (res === errorObj) { return this._o.onError(res.e); }\\n        if (Boolean(res)) {\\n          this._o.onNext(x);\\n          this._o.onCompleted();\\n        }\\n      } else if (!this._obj.predicate) {\\n        this._o.onNext(x);\\n        this._o.onCompleted();\\n      }\\n    };\\n    FirstObserver.prototype.error = function (e) { this._o.onError(e); };\\n    FirstObserver.prototype.completed = function () {\\n      if (this._obj.defaultValue === undefined) {\\n        this._o.onError(new EmptyError());\\n      } else {\\n        this._o.onNext(this._obj.defaultValue);\\n        this._o.onCompleted();\\n      }\\n    };\\n\\n    return FirstObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.\\n   * @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.\\n   */\\n  observableProto.first = function () {\\n    var obj = {}, source = this;\\n    if (typeof arguments[0] === \\'object\\') {\\n      obj = arguments[0];\\n    } else {\\n      obj = {\\n        predicate: arguments[0],\\n        thisArg: arguments[1],\\n        defaultValue: arguments[2]\\n      };\\n    }\\n    if (isFunction (obj.predicate)) {\\n      var fn = obj.predicate;\\n      obj.predicate = bindCallback(fn, obj.thisArg, 3);\\n    }\\n    return new FirstObservable(this, obj);\\n  };\\n\\n  var LastObservable = (function (__super__) {\\n    inherits(LastObservable, __super__);\\n    function LastObservable(source, obj) {\\n      this.source = source;\\n      this._obj = obj;\\n      __super__.call(this);\\n    }\\n\\n    LastObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new LastObserver(o, this._obj, this.source));\\n    };\\n\\n    return LastObservable;\\n  }(ObservableBase));\\n\\n  var LastObserver = (function(__super__) {\\n    inherits(LastObserver, __super__);\\n    function LastObserver(o, obj, s) {\\n      this._o = o;\\n      this._obj = obj;\\n      this._s = s;\\n      this._i = 0;\\n      this._hv = false;\\n      this._v = null;\\n      __super__.call(this);\\n    }\\n\\n    LastObserver.prototype.next = function (x) {\\n      var shouldYield = false;\\n      if (this._obj.predicate) {\\n        var res = tryCatch(this._obj.predicate)(x, this._i++, this._s);\\n        if (res === errorObj) { return this._o.onError(res.e); }\\n        Boolean(res) && (shouldYield = true);\\n      } else if (!this._obj.predicate) {\\n        shouldYield = true;\\n      }\\n      if (shouldYield) {\\n        this._hv = true;\\n        this._v = x;\\n      }\\n    };\\n    LastObserver.prototype.error = function (e) { this._o.onError(e); };\\n    LastObserver.prototype.completed = function () {\\n      if (this._hv) {\\n        this._o.onNext(this._v);\\n        this._o.onCompleted();\\n      }\\n      else if (this._obj.defaultValue === undefined) {\\n        this._o.onError(new EmptyError());\\n      } else {\\n        this._o.onNext(this._obj.defaultValue);\\n        this._o.onCompleted();\\n      }\\n    };\\n\\n    return LastObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.\\n   * @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.\\n   */\\n  observableProto.last = function () {\\n    var obj = {}, source = this;\\n    if (typeof arguments[0] === \\'object\\') {\\n      obj = arguments[0];\\n    } else {\\n      obj = {\\n        predicate: arguments[0],\\n        thisArg: arguments[1],\\n        defaultValue: arguments[2]\\n      };\\n    }\\n    if (isFunction (obj.predicate)) {\\n      var fn = obj.predicate;\\n      obj.predicate = bindCallback(fn, obj.thisArg, 3);\\n    }\\n    return new LastObservable(this, obj);\\n  };\\n\\n  var FindValueObserver = (function(__super__) {\\n    inherits(FindValueObserver, __super__);\\n    function FindValueObserver(observer, source, callback, yieldIndex) {\\n      this._o = observer;\\n      this._s = source;\\n      this._cb = callback;\\n      this._y = yieldIndex;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    FindValueObserver.prototype.next = function (x) {\\n      var shouldRun = tryCatch(this._cb)(x, this._i, this._s);\\n      if (shouldRun === errorObj) { return this._o.onError(shouldRun.e); }\\n      if (shouldRun) {\\n        this._o.onNext(this._y ? this._i : x);\\n        this._o.onCompleted();\\n      } else {\\n        this._i++;\\n      }\\n    };\\n\\n    FindValueObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    FindValueObserver.prototype.completed = function () {\\n      this._y && this._o.onNext(-1);\\n      this._o.onCompleted();\\n    };\\n\\n    return FindValueObserver;\\n  }(AbstractObserver));\\n\\n  function findValue (source, predicate, thisArg, yieldIndex) {\\n    var callback = bindCallback(predicate, thisArg, 3);\\n    return new AnonymousObservable(function (o) {\\n      return source.subscribe(new FindValueObserver(o, source, callback, yieldIndex));\\n    }, source);\\n  }\\n\\n  /**\\n   * Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.\\n   * @param {Function} predicate The predicate that defines the conditions of the element to search for.\\n   * @param {Any} [thisArg] Object to use as `this` when executing the predicate.\\n   * @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.\\n   */\\n  observableProto.find = function (predicate, thisArg) {\\n    return findValue(this, predicate, thisArg, false);\\n  };\\n\\n  /**\\n   * Searches for an element that matches the conditions defined by the specified predicate, and returns\\n   * an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.\\n   * @param {Function} predicate The predicate that defines the conditions of the element to search for.\\n   * @param {Any} [thisArg] Object to use as `this` when executing the predicate.\\n   * @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.\\n  */\\n  observableProto.findIndex = function (predicate, thisArg) {\\n    return findValue(this, predicate, thisArg, true);\\n  };\\n\\n  var ToSetObservable = (function (__super__) {\\n    inherits(ToSetObservable, __super__);\\n    function ToSetObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    ToSetObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new ToSetObserver(o));\\n    };\\n\\n    return ToSetObservable;\\n  }(ObservableBase));\\n\\n  var ToSetObserver = (function (__super__) {\\n    inherits(ToSetObserver, __super__);\\n    function ToSetObserver(o) {\\n      this._o = o;\\n      this._s = new root.Set();\\n      __super__.call(this);\\n    }\\n\\n    ToSetObserver.prototype.next = function (x) {\\n      this._s.add(x);\\n    };\\n\\n    ToSetObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    ToSetObserver.prototype.completed = function () {\\n      this._o.onNext(this._s);\\n      this._o.onCompleted();\\n    };\\n\\n    return ToSetObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Converts the observable sequence to a Set if it exists.\\n   * @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.\\n   */\\n  observableProto.toSet = function () {\\n    if (typeof root.Set === \\'undefined\\') { throw new TypeError(); }\\n    return new ToSetObservable(this);\\n  };\\n\\n  var ToMapObservable = (function (__super__) {\\n    inherits(ToMapObservable, __super__);\\n    function ToMapObservable(source, k, e) {\\n      this.source = source;\\n      this._k = k;\\n      this._e = e;\\n      __super__.call(this);\\n    }\\n\\n    ToMapObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new ToMapObserver(o, this._k, this._e));\\n    };\\n\\n    return ToMapObservable;\\n  }(ObservableBase));\\n\\n  var ToMapObserver = (function (__super__) {\\n    inherits(ToMapObserver, __super__);\\n    function ToMapObserver(o, k, e) {\\n      this._o = o;\\n      this._k = k;\\n      this._e = e;\\n      this._m = new root.Map();\\n      __super__.call(this);\\n    }\\n\\n    ToMapObserver.prototype.next = function (x) {\\n      var key = tryCatch(this._k)(x);\\n      if (key === errorObj) { return this._o.onError(key.e); }\\n      var elem = x;\\n      if (this._e) {\\n        elem = tryCatch(this._e)(x);\\n        if (elem === errorObj) { return this._o.onError(elem.e); }\\n      }\\n\\n      this._m.set(key, elem);\\n    };\\n\\n    ToMapObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    ToMapObserver.prototype.completed = function () {\\n      this._o.onNext(this._m);\\n      this._o.onCompleted();\\n    };\\n\\n    return ToMapObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n  * Converts the observable sequence to a Map if it exists.\\n  * @param {Function} keySelector A function which produces the key for the Map.\\n  * @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence.\\n  * @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.\\n  */\\n  observableProto.toMap = function (keySelector, elementSelector) {\\n    if (typeof root.Map === \\'undefined\\') { throw new TypeError(); }\\n    return new ToMapObservable(this, keySelector, elementSelector);\\n  };\\n\\n  var SliceObservable = (function (__super__) {\\n    inherits(SliceObservable, __super__);\\n    function SliceObservable(source, b, e) {\\n      this.source = source;\\n      this._b = b;\\n      this._e = e;\\n      __super__.call(this);\\n    }\\n\\n    SliceObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new SliceObserver(o, this._b, this._e));\\n    };\\n\\n    return SliceObservable;\\n  }(ObservableBase));\\n\\n  var SliceObserver = (function (__super__) {\\n    inherits(SliceObserver, __super__);\\n\\n    function SliceObserver(o, b, e) {\\n      this._o = o;\\n      this._b = b;\\n      this._e = e;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    SliceObserver.prototype.next = function (x) {\\n      if (this._i >= this._b) {\\n        if (this._e === this._i) {\\n          this._o.onCompleted();\\n        } else {\\n          this._o.onNext(x);\\n        }\\n      }\\n      this._i++;\\n    };\\n    SliceObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SliceObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return SliceObserver;\\n  }(AbstractObserver));\\n\\n  /*\\n  * The slice() method returns a shallow copy of a portion of an Observable into a new Observable object.\\n  * Unlike the array version, this does not support negative numbers for being or end.\\n  * @param {Number} [begin] Zero-based index at which to begin extraction. If omitted, this will default to zero.\\n  * @param {Number} [end] Zero-based index at which to end extraction. slice extracts up to but not including end.\\n  * If omitted, this will emit the rest of the Observable object.\\n  * @returns {Observable} A shallow copy of a portion of an Observable into a new Observable object.\\n  */\\n  observableProto.slice = function (begin, end) {\\n    var start = begin || 0;\\n    if (start < 0) { throw new Rx.ArgumentOutOfRangeError(); }\\n    if (typeof end === \\'number\\' && end < start) {\\n      throw new Rx.ArgumentOutOfRangeError();\\n    }\\n    return new SliceObservable(this, start, end);\\n  };\\n\\n  var LastIndexOfObservable = (function (__super__) {\\n    inherits(LastIndexOfObservable, __super__);\\n    function LastIndexOfObservable(source, e, n) {\\n      this.source = source;\\n      this._e = e;\\n      this._n = n;\\n      __super__.call(this);\\n    }\\n\\n    LastIndexOfObservable.prototype.subscribeCore = function (o) {\\n      if (this._n < 0) {\\n        o.onNext(-1);\\n        o.onCompleted();\\n        return disposableEmpty;\\n      }\\n\\n      return this.source.subscribe(new LastIndexOfObserver(o, this._e, this._n));\\n    };\\n\\n    return LastIndexOfObservable;\\n  }(ObservableBase));\\n\\n  var LastIndexOfObserver = (function (__super__) {\\n    inherits(LastIndexOfObserver, __super__);\\n    function LastIndexOfObserver(o, e, n) {\\n      this._o = o;\\n      this._e = e;\\n      this._n = n;\\n      this._v = 0;\\n      this._hv = false;\\n      this._i = 0;\\n      __super__.call(this);\\n    }\\n\\n    LastIndexOfObserver.prototype.next = function (x) {\\n      if (this._i >= this._n && x === this._e) {\\n        this._hv = true;\\n        this._v = this._i;\\n      }\\n      this._i++;\\n    };\\n    LastIndexOfObserver.prototype.error = function (e) { this._o.onError(e); };\\n    LastIndexOfObserver.prototype.completed = function () {\\n      if (this._hv) {\\n        this._o.onNext(this._v);\\n      } else {\\n        this._o.onNext(-1);\\n      }\\n      this._o.onCompleted();\\n    };\\n\\n    return LastIndexOfObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns the last index at which a given element can be found in the observable sequence, or -1 if it is not present.\\n   * @param {Any} searchElement Element to locate in the array.\\n   * @param {Number} [fromIndex] The index to start the search.  If not specified, defaults to 0.\\n   * @returns {Observable} And observable sequence containing the last index at which a given element can be found in the observable sequence, or -1 if it is not present.\\n   */\\n  observableProto.lastIndexOf = function(searchElement, fromIndex) {\\n    var n = +fromIndex || 0;\\n    Math.abs(n) === Infinity && (n = 0);\\n    return new LastIndexOfObservable(this, searchElement, n);\\n  };\\n\\n  Observable.wrap = function (fn) {\\n    function createObservable() {\\n      return Observable.spawn.call(this, fn.apply(this, arguments));\\n    }\\n\\n    createObservable.__generatorFunction__ = fn;\\n    return createObservable;\\n  };\\n\\n  var spawn = Observable.spawn = function () {\\n    var gen = arguments[0], self = this, args = [];\\n    for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\\n\\n    return new AnonymousObservable(function (o) {\\n      var g = new CompositeDisposable();\\n\\n      if (isFunction(gen)) { gen = gen.apply(self, args); }\\n      if (!gen || !isFunction(gen.next)) {\\n        o.onNext(gen);\\n        return o.onCompleted();\\n      }\\n\\n      function processGenerator(res) {\\n        var ret = tryCatch(gen.next).call(gen, res);\\n        if (ret === errorObj) { return o.onError(ret.e); }\\n        next(ret);\\n      }\\n\\n      processGenerator();\\n\\n      function onError(err) {\\n        var ret = tryCatch(gen.next).call(gen, err);\\n        if (ret === errorObj) { return o.onError(ret.e); }\\n        next(ret);\\n      }\\n\\n      function next(ret) {\\n        if (ret.done) {\\n          o.onNext(ret.value);\\n          o.onCompleted();\\n          return;\\n        }\\n        var obs = toObservable.call(self, ret.value);\\n        var value = null;\\n        var hasValue = false;\\n        if (Observable.isObservable(obs)) {\\n          g.add(obs.subscribe(function(val) {\\n            hasValue = true;\\n            value = val;\\n          }, onError, function() {\\n            hasValue && processGenerator(value);\\n          }));\\n        } else {\\n          onError(new TypeError(\\'type not supported\\'));\\n        }\\n      }\\n\\n      return g;\\n    });\\n  };\\n\\n  function toObservable(obj) {\\n    if (!obj) { return obj; }\\n    if (Observable.isObservable(obj)) { return obj; }\\n    if (isPromise(obj)) { return Observable.fromPromise(obj); }\\n    if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }\\n    if (isFunction(obj)) { return thunkToObservable.call(this, obj); }\\n    if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }\\n    if (isObject(obj)) {return objectToObservable.call(this, obj);}\\n    return obj;\\n  }\\n\\n  function arrayToObservable (obj) {\\n    return Observable.from(obj).concatMap(function(o) {\\n      if(Observable.isObservable(o) || isObject(o)) {\\n        return toObservable.call(null, o);\\n      } else {\\n        return Rx.Observable.just(o);\\n      }\\n    }).toArray();\\n  }\\n\\n  function objectToObservable (obj) {\\n    var results = new obj.constructor(), keys = Object.keys(obj), observables = [];\\n    for (var i = 0, len = keys.length; i < len; i++) {\\n      var key = keys[i];\\n      var observable = toObservable.call(this, obj[key]);\\n\\n      if(observable && Observable.isObservable(observable)) {\\n        defer(observable, key);\\n      } else {\\n        results[key] = obj[key];\\n      }\\n    }\\n\\n    return Observable.forkJoin.apply(Observable, observables).map(function() {\\n      return results;\\n    });\\n\\n\\n    function defer (observable, key) {\\n      results[key] = undefined;\\n      observables.push(observable.map(function (next) {\\n        results[key] = next;\\n      }));\\n    }\\n  }\\n\\n  function thunkToObservable(fn) {\\n    var self = this;\\n    return new AnonymousObservable(function (o) {\\n      fn.call(self, function () {\\n        var err = arguments[0], res = arguments[1];\\n        if (err) { return o.onError(err); }\\n        if (arguments.length > 2) {\\n          var args = [];\\n          for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }\\n          res = args;\\n        }\\n        o.onNext(res);\\n        o.onCompleted();\\n      });\\n    });\\n  }\\n\\n  function isGenerator(obj) {\\n    return isFunction (obj.next) && isFunction (obj[\\'throw\\']);\\n  }\\n\\n  function isGeneratorFunction(obj) {\\n    var ctor = obj.constructor;\\n    if (!ctor) { return false; }\\n    if (ctor.name === \\'GeneratorFunction\\' || ctor.displayName === \\'GeneratorFunction\\') { return true; }\\n    return isGenerator(ctor.prototype);\\n  }\\n\\n  function isObject(val) {\\n    return Object == val.constructor;\\n  }\\n\\n  /**\\n   * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.\\n   *\\n   * @example\\n   * var res = Rx.Observable.start(function () { console.log(\\'hello\\'); });\\n   * var res = Rx.Observable.start(function () { console.log(\\'hello\\'); }, Rx.Scheduler.timeout);\\n   * var res = Rx.Observable.start(function () { this.log(\\'hello\\'); }, Rx.Scheduler.timeout, console);\\n   *\\n   * @param {Function} func Function to run asynchronously.\\n   * @param {Scheduler} [scheduler]  Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.\\n   * @param [context]  The context for the func parameter to be executed.  If not specified, defaults to undefined.\\n   * @returns {Observable} An observable sequence exposing the function\\'s result value, or an exception.\\n   *\\n   * Remarks\\n   * * The function is called immediately, not during the subscription of the resulting sequence.\\n   * * Multiple subscriptions to the resulting sequence can observe the function\\'s result.\\n   */\\n  Observable.start = function (func, context, scheduler) {\\n    return observableToAsync(func, context, scheduler)();\\n  };\\n\\n  /**\\n   * Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.\\n   * @param {Function} function Function to convert to an asynchronous function.\\n   * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.\\n   * @param {Mixed} [context] The context for the func parameter to be executed.  If not specified, defaults to undefined.\\n   * @returns {Function} Asynchronous function.\\n   */\\n  var observableToAsync = Observable.toAsync = function (func, context, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return function () {\\n      var args = arguments,\\n        subject = new AsyncSubject();\\n\\n      scheduler.schedule(null, function () {\\n        var result;\\n        try {\\n          result = func.apply(context, args);\\n        } catch (e) {\\n          subject.onError(e);\\n          return;\\n        }\\n        subject.onNext(result);\\n        subject.onCompleted();\\n      });\\n      return subject.asObservable();\\n    };\\n  };\\n\\nfunction createCbObservable(fn, ctx, selector, args) {\\n  var o = new AsyncSubject();\\n\\n  args.push(createCbHandler(o, ctx, selector));\\n  fn.apply(ctx, args);\\n\\n  return o.asObservable();\\n}\\n\\nfunction createCbHandler(o, ctx, selector) {\\n  return function handler () {\\n    var len = arguments.length, results = new Array(len);\\n    for(var i = 0; i < len; i++) { results[i] = arguments[i]; }\\n\\n    if (isFunction(selector)) {\\n      results = tryCatch(selector).apply(ctx, results);\\n      if (results === errorObj) { return o.onError(results.e); }\\n      o.onNext(results);\\n    } else {\\n      if (results.length <= 1) {\\n        o.onNext(results[0]);\\n      } else {\\n        o.onNext(results);\\n      }\\n    }\\n\\n    o.onCompleted();\\n  };\\n}\\n\\n/**\\n * Converts a callback function to an observable sequence.\\n *\\n * @param {Function} fn Function with a callback as the last parameter to convert to an Observable sequence.\\n * @param {Mixed} [ctx] The context for the func parameter to be executed.  If not specified, defaults to undefined.\\n * @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.\\n * @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.\\n */\\nObservable.fromCallback = function (fn, ctx, selector) {\\n  return function () {\\n    typeof ctx === \\'undefined\\' && (ctx = this); \\n\\n    var len = arguments.length, args = new Array(len)\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    return createCbObservable(fn, ctx, selector, args);\\n  };\\n};\\n\\nfunction createNodeObservable(fn, ctx, selector, args) {\\n  var o = new AsyncSubject();\\n\\n  args.push(createNodeHandler(o, ctx, selector));\\n  fn.apply(ctx, args);\\n\\n  return o.asObservable();\\n}\\n\\nfunction createNodeHandler(o, ctx, selector) {\\n  return function handler () {\\n    var err = arguments[0];\\n    if (err) { return o.onError(err); }\\n\\n    var len = arguments.length, results = [];\\n    for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }\\n\\n    if (isFunction(selector)) {\\n      var results = tryCatch(selector).apply(ctx, results);\\n      if (results === errorObj) { return o.onError(results.e); }\\n      o.onNext(results);\\n    } else {\\n      if (results.length <= 1) {\\n        o.onNext(results[0]);\\n      } else {\\n        o.onNext(results);\\n      }\\n    }\\n\\n    o.onCompleted();\\n  };\\n}\\n\\n/**\\n * Converts a Node.js callback style function to an observable sequence.  This must be in function (err, ...) format.\\n * @param {Function} fn The function to call\\n * @param {Mixed} [ctx] The context for the func parameter to be executed.  If not specified, defaults to undefined.\\n * @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.\\n * @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.\\n */\\nObservable.fromNodeCallback = function (fn, ctx, selector) {\\n  return function () {\\n    typeof ctx === \\'undefined\\' && (ctx = this); \\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    return createNodeObservable(fn, ctx, selector, args);\\n  };\\n};\\n\\n  function isNodeList(el) {\\n    if (root.StaticNodeList) {\\n      // IE8 Specific\\n      // instanceof is slower than Object#toString, but Object#toString will not work as intended in IE8\\n      return el instanceof root.StaticNodeList || el instanceof root.NodeList;\\n    } else {\\n      return Object.prototype.toString.call(el) === \\'[object NodeList]\\';\\n    }\\n  }\\n\\n  function ListenDisposable(e, n, fn) {\\n    this._e = e;\\n    this._n = n;\\n    this._fn = fn;\\n    this._e.addEventListener(this._n, this._fn, false);\\n    this.isDisposed = false;\\n  }\\n  ListenDisposable.prototype.dispose = function () {\\n    if (!this.isDisposed) {\\n      this._e.removeEventListener(this._n, this._fn, false);\\n      this.isDisposed = true;\\n    }\\n  };\\n\\n  function createEventListener (el, eventName, handler) {\\n    var disposables = new CompositeDisposable();\\n\\n    // Asume NodeList or HTMLCollection\\n    var elemToString = Object.prototype.toString.call(el);\\n    if (isNodeList(el) || elemToString === \\'[object HTMLCollection]\\') {\\n      for (var i = 0, len = el.length; i < len; i++) {\\n        disposables.add(createEventListener(el.item(i), eventName, handler));\\n      }\\n    } else if (el) {\\n      disposables.add(new ListenDisposable(el, eventName, handler));\\n    }\\n\\n    return disposables;\\n  }\\n\\n  /**\\n   * Configuration option to determine whether to use native events only\\n   */\\n  Rx.config.useNativeEvents = false;\\n\\n  var EventObservable = (function(__super__) {\\n    inherits(EventObservable, __super__);\\n    function EventObservable(el, name, fn) {\\n      this._el = el;\\n      this._n = name;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    function createHandler(o, fn) {\\n      return function handler () {\\n        var results = arguments[0];\\n        if (isFunction(fn)) {\\n          results = tryCatch(fn).apply(null, arguments);\\n          if (results === errorObj) { return o.onError(results.e); }\\n        }\\n        o.onNext(results);\\n      };\\n    }\\n\\n    EventObservable.prototype.subscribeCore = function (o) {\\n      return createEventListener(\\n        this._el,\\n        this._n,\\n        createHandler(o, this._fn));\\n    };\\n\\n    return EventObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.\\n   * @param {Object} element The DOMElement or NodeList to attach a listener.\\n   * @param {String} eventName The event name to attach the observable sequence.\\n   * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.\\n   * @returns {Observable} An observable sequence of events from the specified element and the specified event.\\n   */\\n  Observable.fromEvent = function (element, eventName, selector) {\\n    // Node.js specific\\n    if (element.addListener) {\\n      return fromEventPattern(\\n        function (h) { element.addListener(eventName, h); },\\n        function (h) { element.removeListener(eventName, h); },\\n        selector);\\n    }\\n\\n    // Use only if non-native events are allowed\\n    if (!Rx.config.useNativeEvents) {\\n      // Handles jq, Angular.js, Zepto, Marionette, Ember.js\\n      if (typeof element.on === \\'function\\' && typeof element.off === \\'function\\') {\\n        return fromEventPattern(\\n          function (h) { element.on(eventName, h); },\\n          function (h) { element.off(eventName, h); },\\n          selector);\\n      }\\n    }\\n\\n    return new EventObservable(element, eventName, selector).publish().refCount();\\n  };\\n\\n  var EventPatternObservable = (function(__super__) {\\n    inherits(EventPatternObservable, __super__);\\n    function EventPatternObservable(add, del, fn) {\\n      this._add = add;\\n      this._del = del;\\n      this._fn = fn;\\n      __super__.call(this);\\n    }\\n\\n    function createHandler(o, fn) {\\n      return function handler () {\\n        var results = arguments[0];\\n        if (isFunction(fn)) {\\n          results = tryCatch(fn).apply(null, arguments);\\n          if (results === errorObj) { return o.onError(results.e); }\\n        }\\n        o.onNext(results);\\n      };\\n    }\\n\\n    EventPatternObservable.prototype.subscribeCore = function (o) {\\n      var fn = createHandler(o, this._fn);\\n      var returnValue = this._add(fn);\\n      return new EventPatternDisposable(this._del, fn, returnValue);\\n    };\\n\\n    function EventPatternDisposable(del, fn, ret) {\\n      this._del = del;\\n      this._fn = fn;\\n      this._ret = ret;\\n      this.isDisposed = false;\\n    }\\n\\n    EventPatternDisposable.prototype.dispose = function () {\\n      if(!this.isDisposed) {\\n        isFunction(this._del) && this._del(this._fn, this._ret);\\n        this.isDisposed = true;\\n      }\\n    };\\n\\n    return EventPatternObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   * Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.\\n   * @param {Function} addHandler The function to add a handler to the emitter.\\n   * @param {Function} [removeHandler] The optional function to remove a handler from an emitter.\\n   * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.\\n   * @returns {Observable} An observable sequence which wraps an event from an event emitter\\n   */\\n  var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {\\n    return new EventPatternObservable(addHandler, removeHandler, selector).publish().refCount();\\n  };\\n\\n  /**\\n   * Invokes the asynchronous function, surfacing the result through an observable sequence.\\n   * @param {Function} functionAsync Asynchronous function which returns a Promise to run.\\n   * @returns {Observable} An observable sequence exposing the function\\'s result value, or an exception.\\n   */\\n  Observable.startAsync = function (functionAsync) {\\n    var promise = tryCatch(functionAsync)();\\n    if (promise === errorObj) { return observableThrow(promise.e); }\\n    return observableFromPromise(promise);\\n  };\\n\\n  var PausableObservable = (function (__super__) {\\n    inherits(PausableObservable, __super__);\\n    function PausableObservable(source, pauser) {\\n      this.source = source;\\n      this.controller = new Subject();\\n      this.paused = true;\\n\\n      if (pauser && pauser.subscribe) {\\n        this.pauser = this.controller.merge(pauser);\\n      } else {\\n        this.pauser = this.controller;\\n      }\\n\\n      __super__.call(this);\\n    }\\n\\n    PausableObservable.prototype._subscribe = function (o) {\\n      var conn = this.source.publish(),\\n        subscription = conn.subscribe(o),\\n        connection = disposableEmpty;\\n\\n      var pausable = this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function (b) {\\n        if (b) {\\n          connection = conn.connect();\\n        } else {\\n          connection.dispose();\\n          connection = disposableEmpty;\\n        }\\n      });\\n\\n      return new NAryDisposable([subscription, connection, pausable]);\\n    };\\n\\n    PausableObservable.prototype.pause = function () {\\n      this.paused = true;\\n      this.controller.onNext(false);\\n    };\\n\\n    PausableObservable.prototype.resume = function () {\\n      this.paused = false;\\n      this.controller.onNext(true);\\n    };\\n\\n    return PausableObservable;\\n\\n  }(Observable));\\n\\n  /**\\n   * Pauses the underlying observable sequence based upon the observable sequence which yields true/false.\\n   * @example\\n   * var pauser = new Rx.Subject();\\n   * var source = Rx.Observable.interval(100).pausable(pauser);\\n   * @param {Observable} pauser The observable sequence used to pause the underlying sequence.\\n   * @returns {Observable} The observable sequence which is paused based upon the pauser.\\n   */\\n  observableProto.pausable = function (pauser) {\\n    return new PausableObservable(this, pauser);\\n  };\\n\\n  function combineLatestSource(source, subject, resultSelector) {\\n    return new AnonymousObservable(function (o) {\\n      var hasValue = [false, false],\\n        hasValueAll = false,\\n        isDone = false,\\n        values = new Array(2),\\n        err;\\n\\n      function next(x, i) {\\n        values[i] = x;\\n        hasValue[i] = true;\\n        if (hasValueAll || (hasValueAll = hasValue.every(identity))) {\\n          if (err) { return o.onError(err); }\\n          var res = tryCatch(resultSelector).apply(null, values);\\n          if (res === errorObj) { return o.onError(res.e); }\\n          o.onNext(res);\\n        }\\n        isDone && values[1] && o.onCompleted();\\n      }\\n\\n      return new BinaryDisposable(\\n        source.subscribe(\\n          function (x) {\\n            next(x, 0);\\n          },\\n          function (e) {\\n            if (values[1]) {\\n              o.onError(e);\\n            } else {\\n              err = e;\\n            }\\n          },\\n          function () {\\n            isDone = true;\\n            values[1] && o.onCompleted();\\n          }),\\n        subject.subscribe(\\n          function (x) {\\n            next(x, 1);\\n          },\\n          function (e) { o.onError(e); },\\n          function () {\\n            isDone = true;\\n            next(true, 1);\\n          })\\n        );\\n    }, source);\\n  }\\n\\n  var PausableBufferedObservable = (function (__super__) {\\n    inherits(PausableBufferedObservable, __super__);\\n    function PausableBufferedObservable(source, pauser) {\\n      this.source = source;\\n      this.controller = new Subject();\\n      this.paused = true;\\n\\n      if (pauser && pauser.subscribe) {\\n        this.pauser = this.controller.merge(pauser);\\n      } else {\\n        this.pauser = this.controller;\\n      }\\n\\n      __super__.call(this);\\n    }\\n\\n    PausableBufferedObservable.prototype._subscribe = function (o) {\\n      var q = [], previousShouldFire;\\n\\n      function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }\\n\\n      var subscription =\\n        combineLatestSource(\\n          this.source,\\n          this.pauser.startWith(!this.paused).distinctUntilChanged(),\\n          function (data, shouldFire) {\\n            return { data: data, shouldFire: shouldFire };\\n          })\\n          .subscribe(\\n            function (results) {\\n              if (previousShouldFire !== undefined && results.shouldFire !== previousShouldFire) {\\n                previousShouldFire = results.shouldFire;\\n                // change in shouldFire\\n                if (results.shouldFire) { drainQueue(); }\\n              } else {\\n                previousShouldFire = results.shouldFire;\\n                // new data\\n                if (results.shouldFire) {\\n                  o.onNext(results.data);\\n                } else {\\n                  q.push(results.data);\\n                }\\n              }\\n            },\\n            function (err) {\\n              drainQueue();\\n              o.onError(err);\\n            },\\n            function () {\\n              drainQueue();\\n              o.onCompleted();\\n            }\\n          );\\n      return subscription;      \\n    };\\n\\n    PausableBufferedObservable.prototype.pause = function () {\\n      this.paused = true;\\n      this.controller.onNext(false);\\n    };\\n\\n    PausableBufferedObservable.prototype.resume = function () {\\n      this.paused = false;\\n      this.controller.onNext(true);\\n    };\\n\\n    return PausableBufferedObservable;\\n\\n  }(Observable));\\n\\n  /**\\n   * Pauses the underlying observable sequence based upon the observable sequence which yields true/false,\\n   * and yields the values that were buffered while paused.\\n   * @example\\n   * var pauser = new Rx.Subject();\\n   * var source = Rx.Observable.interval(100).pausableBuffered(pauser);\\n   * @param {Observable} pauser The observable sequence used to pause the underlying sequence.\\n   * @returns {Observable} The observable sequence which is paused based upon the pauser.\\n   */\\n  observableProto.pausableBuffered = function (pauser) {\\n    return new PausableBufferedObservable(this, pauser);\\n  };\\n\\n  var ControlledObservable = (function (__super__) {\\n    inherits(ControlledObservable, __super__);\\n    function ControlledObservable (source, enableQueue, scheduler) {\\n      __super__.call(this);\\n      this.subject = new ControlledSubject(enableQueue, scheduler);\\n      this.source = source.multicast(this.subject).refCount();\\n    }\\n\\n    ControlledObservable.prototype._subscribe = function (o) {\\n      return this.source.subscribe(o);\\n    };\\n\\n    ControlledObservable.prototype.request = function (numberOfItems) {\\n      return this.subject.request(numberOfItems == null ? -1 : numberOfItems);\\n    };\\n\\n    return ControlledObservable;\\n\\n  }(Observable));\\n\\n  var ControlledSubject = (function (__super__) {\\n    inherits(ControlledSubject, __super__);\\n    function ControlledSubject(enableQueue, scheduler) {\\n      enableQueue == null && (enableQueue = true);\\n\\n      __super__.call(this);\\n      this.subject = new Subject();\\n      this.enableQueue = enableQueue;\\n      this.queue = enableQueue ? [] : null;\\n      this.requestedCount = 0;\\n      this.requestedDisposable = null;\\n      this.error = null;\\n      this.hasFailed = false;\\n      this.hasCompleted = false;\\n      this.scheduler = scheduler || currentThreadScheduler;\\n    }\\n\\n    addProperties(ControlledSubject.prototype, Observer, {\\n      _subscribe: function (o) {\\n        return this.subject.subscribe(o);\\n      },\\n      onCompleted: function () {\\n        this.hasCompleted = true;\\n        if (!this.enableQueue || this.queue.length === 0) {\\n          this.subject.onCompleted();\\n          this.disposeCurrentRequest();\\n        } else {\\n          this.queue.push(Notification.createOnCompleted());\\n        }\\n      },\\n      onError: function (error) {\\n        this.hasFailed = true;\\n        this.error = error;\\n        if (!this.enableQueue || this.queue.length === 0) {\\n          this.subject.onError(error);\\n          this.disposeCurrentRequest();\\n        } else {\\n          this.queue.push(Notification.createOnError(error));\\n        }\\n      },\\n      onNext: function (value) {\\n        if (this.requestedCount <= 0) {\\n          this.enableQueue && this.queue.push(Notification.createOnNext(value));\\n        } else {\\n          (this.requestedCount-- === 0) && this.disposeCurrentRequest();\\n          this.subject.onNext(value);\\n        }\\n      },\\n      _processRequest: function (numberOfItems) {\\n        if (this.enableQueue) {\\n          while (this.queue.length > 0 && (numberOfItems > 0 || this.queue[0].kind !== \\'N\\')) {\\n            var first = this.queue.shift();\\n            first.accept(this.subject);\\n            if (first.kind === \\'N\\') {\\n              numberOfItems--;\\n            } else {\\n              this.disposeCurrentRequest();\\n              this.queue = [];\\n            }\\n          }\\n        }\\n\\n        return numberOfItems;\\n      },\\n      request: function (number) {\\n        this.disposeCurrentRequest();\\n        var self = this;\\n\\n        this.requestedDisposable = this.scheduler.schedule(number,\\n        function(s, i) {\\n          var remaining = self._processRequest(i);\\n          var stopped = self.hasCompleted || self.hasFailed;\\n          if (!stopped && remaining > 0) {\\n            self.requestedCount = remaining;\\n\\n            return disposableCreate(function () {\\n              self.requestedCount = 0;\\n            });\\n              // Scheduled item is still in progress. Return a new\\n              // disposable to allow the request to be interrupted\\n              // via dispose.\\n          }\\n        });\\n\\n        return this.requestedDisposable;\\n      },\\n      disposeCurrentRequest: function () {\\n        if (this.requestedDisposable) {\\n          this.requestedDisposable.dispose();\\n          this.requestedDisposable = null;\\n        }\\n      }\\n    });\\n\\n    return ControlledSubject;\\n  }(Observable));\\n\\n  /**\\n   * Attaches a controller to the observable sequence with the ability to queue.\\n   * @example\\n   * var source = Rx.Observable.interval(100).controlled();\\n   * source.request(3); // Reads 3 values\\n   * @param {bool} enableQueue truthy value to determine if values should be queued pending the next request\\n   * @param {Scheduler} scheduler determines how the requests will be scheduled\\n   * @returns {Observable} The observable sequence which only propagates values on request.\\n   */\\n  observableProto.controlled = function (enableQueue, scheduler) {\\n\\n    if (enableQueue && isScheduler(enableQueue)) {\\n      scheduler = enableQueue;\\n      enableQueue = true;\\n    }\\n\\n    if (enableQueue == null) {  enableQueue = true; }\\n    return new ControlledObservable(this, enableQueue, scheduler);\\n  };\\n\\n  var StopAndWaitObservable = (function (__super__) {\\n    inherits(StopAndWaitObservable, __super__);\\n    function StopAndWaitObservable (source) {\\n      __super__.call(this);\\n      this.source = source;\\n    }\\n\\n    function scheduleMethod(s, self) {\\n      return self.source.request(1);\\n    }\\n\\n    StopAndWaitObservable.prototype._subscribe = function (o) {\\n      this.subscription = this.source.subscribe(new StopAndWaitObserver(o, this, this.subscription));\\n      return new BinaryDisposable(\\n        this.subscription,\\n        defaultScheduler.schedule(this, scheduleMethod)\\n      );\\n    };\\n\\n    var StopAndWaitObserver = (function (__sub__) {\\n      inherits(StopAndWaitObserver, __sub__);\\n      function StopAndWaitObserver (observer, observable, cancel) {\\n        __sub__.call(this);\\n        this.observer = observer;\\n        this.observable = observable;\\n        this.cancel = cancel;\\n        this.scheduleDisposable = null;\\n      }\\n\\n      StopAndWaitObserver.prototype.completed = function () {\\n        this.observer.onCompleted();\\n        this.dispose();\\n      };\\n\\n      StopAndWaitObserver.prototype.error = function (error) {\\n        this.observer.onError(error);\\n        this.dispose();\\n      };\\n\\n      function innerScheduleMethod(s, self) {\\n        return self.observable.source.request(1);\\n      }\\n\\n      StopAndWaitObserver.prototype.next = function (value) {\\n        this.observer.onNext(value);\\n        this.scheduleDisposable = defaultScheduler.schedule(this, innerScheduleMethod);\\n      };\\n\\n      StopAndWaitObserver.dispose = function () {\\n        this.observer = null;\\n        if (this.cancel) {\\n          this.cancel.dispose();\\n          this.cancel = null;\\n        }\\n        if (this.scheduleDisposable) {\\n          this.scheduleDisposable.dispose();\\n          this.scheduleDisposable = null;\\n        }\\n        __sub__.prototype.dispose.call(this);\\n      };\\n\\n      return StopAndWaitObserver;\\n    }(AbstractObserver));\\n\\n    return StopAndWaitObservable;\\n  }(Observable));\\n\\n\\n  /**\\n   * Attaches a stop and wait observable to the current observable.\\n   * @returns {Observable} A stop and wait observable.\\n   */\\n  ControlledObservable.prototype.stopAndWait = function () {\\n    return new StopAndWaitObservable(this);\\n  };\\n\\n  var WindowedObservable = (function (__super__) {\\n    inherits(WindowedObservable, __super__);\\n    function WindowedObservable(source, windowSize) {\\n      __super__.call(this);\\n      this.source = source;\\n      this.windowSize = windowSize;\\n    }\\n\\n    function scheduleMethod(s, self) {\\n      return self.source.request(self.windowSize);\\n    }\\n\\n    WindowedObservable.prototype._subscribe = function (o) {\\n      this.subscription = this.source.subscribe(new WindowedObserver(o, this, this.subscription));\\n      return new BinaryDisposable(\\n        this.subscription,\\n        defaultScheduler.schedule(this, scheduleMethod)\\n      );\\n    };\\n\\n    var WindowedObserver = (function (__sub__) {\\n      inherits(WindowedObserver, __sub__);\\n      function WindowedObserver(observer, observable, cancel) {\\n        this.observer = observer;\\n        this.observable = observable;\\n        this.cancel = cancel;\\n        this.received = 0;\\n        this.scheduleDisposable = null;\\n        __sub__.call(this);\\n      }\\n\\n      WindowedObserver.prototype.completed = function () {\\n        this.observer.onCompleted();\\n        this.dispose();\\n      };\\n\\n      WindowedObserver.prototype.error = function (error) {\\n        this.observer.onError(error);\\n        this.dispose();\\n      };\\n\\n      function innerScheduleMethod(s, self) {\\n        return self.observable.source.request(self.observable.windowSize);\\n      }\\n\\n      WindowedObserver.prototype.next = function (value) {\\n        this.observer.onNext(value);\\n        this.received = ++this.received % this.observable.windowSize;\\n        this.received === 0 && (this.scheduleDisposable = defaultScheduler.schedule(this, innerScheduleMethod));\\n      };\\n\\n      WindowedObserver.prototype.dispose = function () {\\n        this.observer = null;\\n        if (this.cancel) {\\n          this.cancel.dispose();\\n          this.cancel = null;\\n        }\\n        if (this.scheduleDisposable) {\\n          this.scheduleDisposable.dispose();\\n          this.scheduleDisposable = null;\\n        }\\n        __sub__.prototype.dispose.call(this);\\n      };\\n\\n      return WindowedObserver;\\n    }(AbstractObserver));\\n\\n    return WindowedObservable;\\n  }(Observable));\\n\\n  /**\\n   * Creates a sliding windowed observable based upon the window size.\\n   * @param {Number} windowSize The number of items in the window\\n   * @returns {Observable} A windowed observable based upon the window size.\\n   */\\n  ControlledObservable.prototype.windowed = function (windowSize) {\\n    return new WindowedObservable(this, windowSize);\\n  };\\n\\n  /**\\n   * Pipes the existing Observable sequence into a Node.js Stream.\\n   * @param {Stream} dest The destination Node.js stream.\\n   * @returns {Stream} The destination stream.\\n   */\\n  observableProto.pipe = function (dest) {\\n    var source = this.pausableBuffered();\\n\\n    function onDrain() {\\n      source.resume();\\n    }\\n\\n    dest.addListener(\\'drain\\', onDrain);\\n\\n    source.subscribe(\\n      function (x) {\\n        !dest.write(x) && source.pause();\\n      },\\n      function (err) {\\n        dest.emit(\\'error\\', err);\\n      },\\n      function () {\\n        // Hack check because STDIO is not closable\\n        !dest._isStdio && dest.end();\\n        dest.removeListener(\\'drain\\', onDrain);\\n      });\\n\\n    source.resume();\\n\\n    return dest;\\n  };\\n\\n  var MulticastObservable = (function (__super__) {\\n    inherits(MulticastObservable, __super__);\\n    function MulticastObservable(source, fn1, fn2) {\\n      this.source = source;\\n      this._fn1 = fn1;\\n      this._fn2 = fn2;\\n      __super__.call(this);\\n    }\\n\\n    MulticastObservable.prototype.subscribeCore = function (o) {\\n      var connectable = this.source.multicast(this._fn1());\\n      return new BinaryDisposable(this._fn2(connectable).subscribe(o), connectable.connect());\\n    };\\n\\n    return MulticastObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   * Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each\\n   * subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function\\'s\\n   * invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.\\n   *\\n   * @example\\n   * 1 - res = source.multicast(observable);\\n   * 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });\\n   *\\n   * @param {Function|Subject} subjectOrSubjectSelector\\n   * Factory function to create an intermediate subject through which the source sequence\\'s elements will be multicast to the selector function.\\n   * Or:\\n   * Subject to push source elements into.\\n   *\\n   * @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name=\"subjectOrSubjectSelector\" is a factory function.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\\n   */\\n  observableProto.multicast = function (subjectOrSubjectSelector, selector) {\\n    return isFunction(subjectOrSubjectSelector) ?\\n      new MulticastObservable(this, subjectOrSubjectSelector, selector) :\\n      new ConnectableObservable(this, subjectOrSubjectSelector);\\n  };\\n\\n  /**\\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.\\n   * This operator is a specialization of Multicast using a regular Subject.\\n   *\\n   * @example\\n   * var resres = source.publish();\\n   * var res = source.publish(function (x) { return x; });\\n   *\\n   * @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\\n   */\\n  observableProto.publish = function (selector) {\\n    return selector && isFunction(selector) ?\\n      this.multicast(function () { return new Subject(); }, selector) :\\n      this.multicast(new Subject());\\n  };\\n\\n  /**\\n   * Returns an observable sequence that shares a single subscription to the underlying sequence.\\n   * This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\\n   */\\n  observableProto.share = function () {\\n    return this.publish().refCount();\\n  };\\n\\n  /**\\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.\\n   * This operator is a specialization of Multicast using a AsyncSubject.\\n   *\\n   * @example\\n   * var res = source.publishLast();\\n   * var res = source.publishLast(function (x) { return x; });\\n   *\\n   * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\\n   */\\n  observableProto.publishLast = function (selector) {\\n    return selector && isFunction(selector) ?\\n      this.multicast(function () { return new AsyncSubject(); }, selector) :\\n      this.multicast(new AsyncSubject());\\n  };\\n\\n  /**\\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.\\n   * This operator is a specialization of Multicast using a BehaviorSubject.\\n   *\\n   * @example\\n   * var res = source.publishValue(42);\\n   * var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);\\n   *\\n   * @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.\\n   * @param {Mixed} initialValue Initial value received by observers upon subscription.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\\n   */\\n  observableProto.publishValue = function (initialValueOrSelector, initialValue) {\\n    return arguments.length === 2 ?\\n      this.multicast(function () {\\n        return new BehaviorSubject(initialValue);\\n      }, initialValueOrSelector) :\\n      this.multicast(new BehaviorSubject(initialValueOrSelector));\\n  };\\n\\n  /**\\n   * Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.\\n   * This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.\\n   * @param {Mixed} initialValue Initial value received by observers upon subscription.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\\n   */\\n  observableProto.shareValue = function (initialValue) {\\n    return this.publishValue(initialValue).refCount();\\n  };\\n\\n  /**\\n   * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.\\n   * This operator is a specialization of Multicast using a ReplaySubject.\\n   *\\n   * @example\\n   * var res = source.replay(null, 3);\\n   * var res = source.replay(null, 3, 500);\\n   * var res = source.replay(null, 3, 500, scheduler);\\n   * var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);\\n   *\\n   * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.\\n   * @param bufferSize [Optional] Maximum element count of the replay buffer.\\n   * @param windowSize [Optional] Maximum time length of the replay buffer.\\n   * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\\n   */\\n  observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {\\n    return selector && isFunction(selector) ?\\n      this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :\\n      this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));\\n  };\\n\\n  /**\\n   * Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.\\n   * This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.\\n   *\\n   * @example\\n   * var res = source.shareReplay(3);\\n   * var res = source.shareReplay(3, 500);\\n   * var res = source.shareReplay(3, 500, scheduler);\\n   *\\n\\n   * @param bufferSize [Optional] Maximum element count of the replay buffer.\\n   * @param window [Optional] Maximum time length of the replay buffer.\\n   * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\\n   */\\n  observableProto.shareReplay = function (bufferSize, windowSize, scheduler) {\\n    return this.replay(null, bufferSize, windowSize, scheduler).refCount();\\n  };\\n\\n  var InnerSubscription = function (s, o) {\\n    this._s = s;\\n    this._o = o;\\n  };\\n\\n  InnerSubscription.prototype.dispose = function () {\\n    if (!this._s.isDisposed && this._o !== null) {\\n      var idx = this._s.observers.indexOf(this._o);\\n      this._s.observers.splice(idx, 1);\\n      this._o = null;\\n    }\\n  };\\n\\n  var RefCountObservable = (function (__super__) {\\n    inherits(RefCountObservable, __super__);\\n    function RefCountObservable(source) {\\n      this.source = source;\\n      this._count = 0;\\n      this._connectableSubscription = null;\\n      __super__.call(this);\\n    }\\n\\n    RefCountObservable.prototype.subscribeCore = function (o) {\\n      var subscription = this.source.subscribe(o);\\n      ++this._count === 1 && (this._connectableSubscription = this.source.connect());\\n      return new RefCountDisposable(this, subscription);\\n    };\\n\\n    function RefCountDisposable(p, s) {\\n      this._p = p;\\n      this._s = s;\\n      this.isDisposed = false;\\n    }\\n\\n    RefCountDisposable.prototype.dispose = function () {\\n      if (!this.isDisposed) {\\n        this.isDisposed = true;\\n        this._s.dispose();\\n        --this._p._count === 0 && this._p._connectableSubscription.dispose();\\n      }\\n    };\\n\\n    return RefCountObservable;\\n  }(ObservableBase));\\n\\n  var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {\\n    inherits(ConnectableObservable, __super__);\\n    function ConnectableObservable(source, subject) {\\n      this.source = source;\\n      this._connection = null;\\n      this._source = source.asObservable();\\n      this._subject = subject;\\n      __super__.call(this);\\n    }\\n\\n    function ConnectDisposable(parent, subscription) {\\n      this._p = parent;\\n      this._s = subscription;\\n    }\\n\\n    ConnectDisposable.prototype.dispose = function () {\\n      if (this._s) {\\n        this._s.dispose();\\n        this._s = null;\\n        this._p._connection = null;\\n      }\\n    };\\n\\n    ConnectableObservable.prototype.connect = function () {\\n      if (!this._connection) {\\n        if (this._subject.isStopped) {\\n          return disposableEmpty;\\n        }\\n        var subscription = this._source.subscribe(this._subject);\\n        this._connection = new ConnectDisposable(this, subscription);\\n      }\\n      return this._connection;\\n    };\\n\\n    ConnectableObservable.prototype._subscribe = function (o) {\\n      return this._subject.subscribe(o);\\n    };\\n\\n    ConnectableObservable.prototype.refCount = function () {\\n      return new RefCountObservable(this);\\n    };\\n\\n    return ConnectableObservable;\\n  }(Observable));\\n\\n  /**\\n   * Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence\\n   * can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.\\n   */\\n  observableProto.singleInstance = function() {\\n    var source = this, hasObservable = false, observable;\\n\\n    function getObservable() {\\n      if (!hasObservable) {\\n        hasObservable = true;\\n        observable = source[\\'finally\\'](function() { hasObservable = false; }).publish().refCount();\\n      }\\n      return observable;\\n    }\\n\\n    return new AnonymousObservable(function(o) {\\n      return getObservable().subscribe(o);\\n    });\\n  };\\n\\n  /**\\n   *  Correlates the elements of two sequences based on overlapping durations.\\n   *\\n   *  @param {Observable} right The right observable sequence to join elements for.\\n   *  @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.\\n   *  @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.\\n   *  @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.\\n   *  @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.\\n   */\\n  observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {\\n    var left = this;\\n    return new AnonymousObservable(function (o) {\\n      var group = new CompositeDisposable();\\n      var leftDone = false, rightDone = false;\\n      var leftId = 0, rightId = 0;\\n      var leftMap = new Map(), rightMap = new Map();\\n      var handleError = function (e) { o.onError(e); };\\n\\n      group.add(left.subscribe(\\n        function (value) {\\n          var id = leftId++, md = new SingleAssignmentDisposable();\\n\\n          leftMap.set(id, value);\\n          group.add(md);\\n\\n          var duration = tryCatch(leftDurationSelector)(value);\\n          if (duration === errorObj) { return o.onError(duration.e); }\\n\\n          md.setDisposable(duration.take(1).subscribe(\\n            noop,\\n            handleError,\\n            function () {\\n              leftMap[\\'delete\\'](id) && leftMap.size === 0 && leftDone && o.onCompleted();\\n              group.remove(md);\\n            }));\\n\\n          rightMap.forEach(function (v) {\\n            var result = tryCatch(resultSelector)(value, v);\\n            if (result === errorObj) { return o.onError(result.e); }\\n            o.onNext(result);\\n          });\\n        },\\n        handleError,\\n        function () {\\n          leftDone = true;\\n          (rightDone || leftMap.size === 0) && o.onCompleted();\\n        })\\n      );\\n\\n      group.add(right.subscribe(\\n        function (value) {\\n          var id = rightId++, md = new SingleAssignmentDisposable();\\n\\n          rightMap.set(id, value);\\n          group.add(md);\\n\\n          var duration = tryCatch(rightDurationSelector)(value);\\n          if (duration === errorObj) { return o.onError(duration.e); }\\n\\n          md.setDisposable(duration.take(1).subscribe(\\n            noop,\\n            handleError,\\n            function () {\\n              rightMap[\\'delete\\'](id) && rightMap.size === 0 && rightDone && o.onCompleted();\\n              group.remove(md);\\n            }));\\n\\n          leftMap.forEach(function (v) {\\n            var result = tryCatch(resultSelector)(v, value);\\n            if (result === errorObj) { return o.onError(result.e); }\\n            o.onNext(result);\\n          });\\n        },\\n        handleError,\\n        function () {\\n          rightDone = true;\\n          (leftDone || rightMap.size === 0) && o.onCompleted();\\n        })\\n      );\\n      return group;\\n    }, left);\\n  };\\n\\n  /**\\n   *  Correlates the elements of two sequences based on overlapping durations, and groups the results.\\n   *\\n   *  @param {Observable} right The right observable sequence to join elements for.\\n   *  @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.\\n   *  @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.\\n   *  @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence\\'s element.\\n   *  @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.\\n   */\\n  observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {\\n    var left = this;\\n    return new AnonymousObservable(function (o) {\\n      var group = new CompositeDisposable();\\n      var r = new RefCountDisposable(group);\\n      var leftMap = new Map(), rightMap = new Map();\\n      var leftId = 0, rightId = 0;\\n      var handleError = function (e) { return function (v) { v.onError(e); }; };\\n\\n      function handleError(e) { };\\n\\n      group.add(left.subscribe(\\n        function (value) {\\n          var s = new Subject();\\n          var id = leftId++;\\n          leftMap.set(id, s);\\n\\n          var result = tryCatch(resultSelector)(value, addRef(s, r));\\n          if (result === errorObj) {\\n            leftMap.forEach(handleError(result.e));\\n            return o.onError(result.e);\\n          }\\n          o.onNext(result);\\n\\n          rightMap.forEach(function (v) { s.onNext(v); });\\n\\n          var md = new SingleAssignmentDisposable();\\n          group.add(md);\\n\\n          var duration = tryCatch(leftDurationSelector)(value);\\n          if (duration === errorObj) {\\n            leftMap.forEach(handleError(duration.e));\\n            return o.onError(duration.e);\\n          }\\n\\n          md.setDisposable(duration.take(1).subscribe(\\n            noop,\\n            function (e) {\\n              leftMap.forEach(handleError(e));\\n              o.onError(e);\\n            },\\n            function () {\\n              leftMap[\\'delete\\'](id) && s.onCompleted();\\n              group.remove(md);\\n            }));\\n        },\\n        function (e) {\\n          leftMap.forEach(handleError(e));\\n          o.onError(e);\\n        },\\n        function () { o.onCompleted(); })\\n      );\\n\\n      group.add(right.subscribe(\\n        function (value) {\\n          var id = rightId++;\\n          rightMap.set(id, value);\\n\\n          var md = new SingleAssignmentDisposable();\\n          group.add(md);\\n\\n          var duration = tryCatch(rightDurationSelector)(value);\\n          if (duration === errorObj) {\\n            leftMap.forEach(handleError(duration.e));\\n            return o.onError(duration.e);\\n          }\\n\\n          md.setDisposable(duration.take(1).subscribe(\\n            noop,\\n            function (e) {\\n              leftMap.forEach(handleError(e));\\n              o.onError(e);\\n            },\\n            function () {\\n              rightMap[\\'delete\\'](id);\\n              group.remove(md);\\n            }));\\n\\n          leftMap.forEach(function (v) { v.onNext(value); });\\n        },\\n        function (e) {\\n          leftMap.forEach(handleError(e));\\n          o.onError(e);\\n        })\\n      );\\n\\n      return r;\\n    }, left);\\n  };\\n\\n  function toArray(x) { return x.toArray(); }\\n\\n  /**\\n   *  Projects each element of an observable sequence into zero or more buffers.\\n   *  @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).\\n   *  @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.\\n   *  @returns {Observable} An observable sequence of windows.\\n   */\\n  observableProto.buffer = function () {\\n    return this.window.apply(this, arguments)\\n      .flatMap(toArray);\\n  };\\n\\n  /**\\n   *  Projects each element of an observable sequence into zero or more windows.\\n   *\\n   *  @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).\\n   *  @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.\\n   *  @returns {Observable} An observable sequence of windows.\\n   */\\n  observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {\\n    if (arguments.length === 1 && typeof arguments[0] !== \\'function\\') {\\n      return observableWindowWithBoundaries.call(this, windowOpeningsOrClosingSelector);\\n    }\\n    return typeof windowOpeningsOrClosingSelector === \\'function\\' ?\\n      observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :\\n      observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);\\n  };\\n\\n  function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {\\n    return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) {\\n      return win;\\n    });\\n  }\\n\\n  function observableWindowWithBoundaries(windowBoundaries) {\\n    var source = this;\\n    return new AnonymousObservable(function (observer) {\\n      var win = new Subject(),\\n        d = new CompositeDisposable(),\\n        r = new RefCountDisposable(d);\\n\\n      observer.onNext(addRef(win, r));\\n\\n      d.add(source.subscribe(function (x) {\\n        win.onNext(x);\\n      }, function (err) {\\n        win.onError(err);\\n        observer.onError(err);\\n      }, function () {\\n        win.onCompleted();\\n        observer.onCompleted();\\n      }));\\n\\n      isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries));\\n\\n      d.add(windowBoundaries.subscribe(function (w) {\\n        win.onCompleted();\\n        win = new Subject();\\n        observer.onNext(addRef(win, r));\\n      }, function (err) {\\n        win.onError(err);\\n        observer.onError(err);\\n      }, function () {\\n        win.onCompleted();\\n        observer.onCompleted();\\n      }));\\n\\n      return r;\\n    }, source);\\n  }\\n\\n  function observableWindowWithClosingSelector(windowClosingSelector) {\\n    var source = this;\\n    return new AnonymousObservable(function (observer) {\\n      var m = new SerialDisposable(),\\n        d = new CompositeDisposable(m),\\n        r = new RefCountDisposable(d),\\n        win = new Subject();\\n      observer.onNext(addRef(win, r));\\n      d.add(source.subscribe(function (x) {\\n          win.onNext(x);\\n      }, function (err) {\\n          win.onError(err);\\n          observer.onError(err);\\n      }, function () {\\n          win.onCompleted();\\n          observer.onCompleted();\\n      }));\\n\\n      function createWindowClose () {\\n        var windowClose;\\n        try {\\n          windowClose = windowClosingSelector();\\n        } catch (e) {\\n          observer.onError(e);\\n          return;\\n        }\\n\\n        isPromise(windowClose) && (windowClose = observableFromPromise(windowClose));\\n\\n        var m1 = new SingleAssignmentDisposable();\\n        m.setDisposable(m1);\\n        m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) {\\n          win.onError(err);\\n          observer.onError(err);\\n        }, function () {\\n          win.onCompleted();\\n          win = new Subject();\\n          observer.onNext(addRef(win, r));\\n          createWindowClose();\\n        }));\\n      }\\n\\n      createWindowClose();\\n      return r;\\n    }, source);\\n  }\\n\\n  var PairwiseObservable = (function (__super__) {\\n    inherits(PairwiseObservable, __super__);\\n    function PairwiseObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    PairwiseObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new PairwiseObserver(o));\\n    };\\n\\n    return PairwiseObservable;\\n  }(ObservableBase));\\n\\n  var PairwiseObserver = (function(__super__) {\\n    inherits(PairwiseObserver, __super__);\\n    function PairwiseObserver(o) {\\n      this._o = o;\\n      this._p = null;\\n      this._hp = false;\\n      __super__.call(this);\\n    }\\n\\n    PairwiseObserver.prototype.next = function (x) {\\n      if (this._hp) {\\n        this._o.onNext([this._p, x]);\\n      } else {\\n        this._hp = true;\\n      }\\n      this._p = x;\\n    };\\n    PairwiseObserver.prototype.error = function (err) { this._o.onError(err); };\\n    PairwiseObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return PairwiseObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Returns a new observable that triggers on the second and subsequent triggerings of the input observable.\\n   * The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.\\n   * The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.\\n   * @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.\\n   */\\n  observableProto.pairwise = function () {\\n    return new PairwiseObservable(this);\\n  };\\n\\n  /**\\n   * Returns two observables which partition the observations of the source by the given function.\\n   * The first will trigger observations for those values for which the predicate returns true.\\n   * The second will trigger observations for those values where the predicate returns false.\\n   * The predicate is executed once for each subscribed observer.\\n   * Both also propagate all error observations arising from the source and each completes\\n   * when the source completes.\\n   * @param {Function} predicate\\n   *    The function to determine which output Observable will trigger a particular observation.\\n   * @returns {Array}\\n   *    An array of observables. The first triggers when the predicate returns true,\\n   *    and the second triggers when the predicate returns false.\\n  */\\n  observableProto.partition = function(predicate, thisArg) {\\n    var fn = bindCallback(predicate, thisArg, 3);\\n    return [\\n      this.filter(predicate, thisArg),\\n      this.filter(function (x, i, o) { return !fn(x, i, o); })\\n    ];\\n  };\\n\\n  var WhileEnumerable = (function(__super__) {\\n    inherits(WhileEnumerable, __super__);\\n    function WhileEnumerable(c, s) {\\n      this.c = c;\\n      this.s = s;\\n    }\\n    WhileEnumerable.prototype[$iterator$] = function () {\\n      var self = this;\\n      return {\\n        next: function () {\\n          return self.c() ?\\n           { done: false, value: self.s } :\\n           { done: true, value: void 0 };\\n        }\\n      };\\n    };\\n    return WhileEnumerable;\\n  }(Enumerable));\\n  \\n  function enumerableWhile(condition, source) {\\n    return new WhileEnumerable(condition, source);\\n  }  \\n\\n   /**\\n   *  Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.\\n   *  This operator allows for a fluent style of writing queries that use the same sequence multiple times.\\n   *\\n   * @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.\\n   * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\\n   */\\n  observableProto.letBind = observableProto[\\'let\\'] = function (func) {\\n    return func(this);\\n  };\\n\\n   /**\\n   *  Determines whether an observable collection contains values. \\n   *\\n   * @example\\n   *  1 - res = Rx.Observable.if(condition, obs1);\\n   *  2 - res = Rx.Observable.if(condition, obs1, obs2);\\n   *  3 - res = Rx.Observable.if(condition, obs1, scheduler);\\n   * @param {Function} condition The condition which determines if the thenSource or elseSource will be run.\\n   * @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.\\n   * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.\\n   * @returns {Observable} An observable sequence which is either the thenSource or elseSource.\\n   */\\n  Observable[\\'if\\'] = function (condition, thenSource, elseSourceOrScheduler) {\\n    return observableDefer(function () {\\n      elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());\\n\\n      isPromise(thenSource) && (thenSource = observableFromPromise(thenSource));\\n      isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler));\\n\\n      // Assume a scheduler for empty only\\n      typeof elseSourceOrScheduler.now === \\'function\\' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler));\\n      return condition() ? thenSource : elseSourceOrScheduler;\\n    });\\n  };\\n\\n   /**\\n   *  Concatenates the observable sequences obtained by running the specified result selector for each element in source.\\n   * There is an alias for this method called \\'forIn\\' for browsers <IE9\\n   * @param {Array} sources An array of values to turn into an observable sequence.\\n   * @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.\\n   * @returns {Observable} An observable sequence from the concatenated observable sequences.\\n   */\\n  Observable[\\'for\\'] = Observable.forIn = function (sources, resultSelector, thisArg) {\\n    return enumerableOf(sources, resultSelector, thisArg).concat();\\n  };\\n\\n   /**\\n   *  Repeats source as long as condition holds emulating a while loop.\\n   * There is an alias for this method called \\'whileDo\\' for browsers <IE9\\n   *\\n   * @param {Function} condition The condition which determines if the source will be repeated.\\n   * @param {Observable} source The observable sequence that will be run if the condition function returns true.\\n   * @returns {Observable} An observable sequence which is repeated as long as the condition holds.\\n   */\\n  var observableWhileDo = Observable[\\'while\\'] = Observable.whileDo = function (condition, source) {\\n    isPromise(source) && (source = observableFromPromise(source));\\n    return enumerableWhile(condition, source).concat();\\n  };\\n\\n   /**\\n   *  Repeats source as long as condition holds emulating a do while loop.\\n   *\\n   * @param {Function} condition The condition which determines if the source will be repeated.\\n   * @param {Observable} source The observable sequence that will be run if the condition function returns true.\\n   * @returns {Observable} An observable sequence which is repeated as long as the condition holds.\\n   */\\n  observableProto.doWhile = function (condition) {\\n    return observableConcat([this, observableWhileDo(condition, this)]);\\n  };\\n\\n   /**\\n   *  Uses selector to determine which source in sources to use.\\n   * @param {Function} selector The function which extracts the value for to test in a case statement.\\n   * @param {Array} sources A object which has keys which correspond to the case statement labels.\\n   * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.\\n   *\\n   * @returns {Observable} An observable sequence which is determined by a case statement.\\n   */\\n  Observable[\\'case\\'] = function (selector, sources, defaultSourceOrScheduler) {\\n    return observableDefer(function () {\\n      isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));\\n      defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());\\n\\n      isScheduler(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));\\n\\n      var result = sources[selector()];\\n      isPromise(result) && (result = observableFromPromise(result));\\n\\n      return result || defaultSourceOrScheduler;\\n    });\\n  };\\n\\n  var ExpandObservable = (function(__super__) {\\n    inherits(ExpandObservable, __super__);\\n    function ExpandObservable(source, fn, scheduler) {\\n      this.source = source;\\n      this._fn = fn;\\n      this._scheduler = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleRecursive(args, recurse) {\\n      var state = args[0], self = args[1];\\n      var work;\\n      if (state.q.length > 0) {\\n        work = state.q.shift();\\n      } else {\\n        state.isAcquired = false;\\n        return;\\n      }\\n      var m1 = new SingleAssignmentDisposable();\\n      state.d.add(m1);\\n      m1.setDisposable(work.subscribe(new ExpandObserver(state, self, m1)));\\n      recurse([state, self]);\\n    }\\n\\n    ExpandObservable.prototype._ensureActive = function (state) {\\n      var isOwner = false;\\n      if (state.q.length > 0) {\\n        isOwner = !state.isAcquired;\\n        state.isAcquired = true;\\n      }\\n      isOwner && state.m.setDisposable(this._scheduler.scheduleRecursive([state, this], scheduleRecursive));\\n    };\\n\\n    ExpandObservable.prototype.subscribeCore = function (o) {\\n      var m = new SerialDisposable(),\\n        d = new CompositeDisposable(m),\\n        state = {\\n          q: [],\\n          m: m,\\n          d: d,\\n          activeCount: 0,\\n          isAcquired: false,\\n          o: o\\n        };\\n\\n      state.q.push(this.source);\\n      state.activeCount++;\\n      this._ensureActive(state);\\n      return d;\\n    };\\n\\n    return ExpandObservable;\\n  }(ObservableBase));\\n\\n  var ExpandObserver = (function(__super__) {\\n    inherits(ExpandObserver, __super__);\\n    function ExpandObserver(state, parent, m1) {\\n      this._s = state;\\n      this._p = parent;\\n      this._m1 = m1;\\n      __super__.call(this);\\n    }\\n\\n    ExpandObserver.prototype.next = function (x) {\\n      this._s.o.onNext(x);\\n      var result = tryCatch(this._p._fn)(x);\\n      if (result === errorObj) { return this._s.o.onError(result.e); }\\n      this._s.q.push(result);\\n      this._s.activeCount++;\\n      this._p._ensureActive(this._s);\\n    };\\n\\n    ExpandObserver.prototype.error = function (e) {\\n      this._s.o.onError(e);\\n    };\\n\\n    ExpandObserver.prototype.completed = function () {\\n      this._s.d.remove(this._m1);\\n      this._s.activeCount--;\\n      this._s.activeCount === 0 && this._s.o.onCompleted();\\n    };\\n\\n    return ExpandObserver;\\n  }(AbstractObserver));\\n\\n   /**\\n   *  Expands an observable sequence by recursively invoking selector.\\n   *\\n   * @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.\\n   * @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.\\n   * @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.\\n   */\\n  observableProto.expand = function (selector, scheduler) {\\n    isScheduler(scheduler) || (scheduler = currentThreadScheduler);\\n    return new ExpandObservable(this, selector, scheduler);\\n  };\\n\\n  function argumentsToArray() {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    return args;\\n  }\\n\\n  var ForkJoinObservable = (function (__super__) {\\n    inherits(ForkJoinObservable, __super__);\\n    function ForkJoinObservable(sources, cb) {\\n      this._sources = sources;\\n      this._cb = cb;\\n      __super__.call(this);\\n    }\\n\\n    ForkJoinObservable.prototype.subscribeCore = function (o) {\\n      if (this._sources.length === 0) {\\n        o.onCompleted();\\n        return disposableEmpty;\\n      }\\n\\n      var count = this._sources.length;\\n      var state = {\\n        finished: false,\\n        hasResults: new Array(count),\\n        hasCompleted: new Array(count),\\n        results: new Array(count)\\n      };\\n\\n      var subscriptions = new CompositeDisposable();\\n      for (var i = 0, len = this._sources.length; i < len; i++) {\\n        var source = this._sources[i];\\n        isPromise(source) && (source = observableFromPromise(source));\\n        subscriptions.add(source.subscribe(new ForkJoinObserver(o, state, i, this._cb, subscriptions)));\\n      }\\n\\n      return subscriptions;\\n    };\\n\\n    return ForkJoinObservable;\\n  }(ObservableBase));\\n\\n  var ForkJoinObserver = (function(__super__) {\\n    inherits(ForkJoinObserver, __super__);\\n    function ForkJoinObserver(o, s, i, cb, subs) {\\n      this._o = o;\\n      this._s = s;\\n      this._i = i;\\n      this._cb = cb;\\n      this._subs = subs;\\n      __super__.call(this);\\n    }\\n\\n    ForkJoinObserver.prototype.next = function (x) {\\n      if (!this._s.finished) {\\n        this._s.hasResults[this._i] = true;\\n        this._s.results[this._i] = x;\\n      }\\n    };\\n\\n    ForkJoinObserver.prototype.error = function (e) {\\n      this._s.finished = true;\\n      this._o.onError(e);\\n      this._subs.dispose();\\n    };\\n\\n    ForkJoinObserver.prototype.completed = function () {\\n      if (!this._s.finished) {\\n        if (!this._s.hasResults[this._i]) {\\n          return this._o.onCompleted();\\n        }\\n        this._s.hasCompleted[this._i] = true;\\n        for (var i = 0; i < this._s.results.length; i++) {\\n          if (!this._s.hasCompleted[i]) { return; }\\n        }\\n        this._s.finished = true;\\n\\n        var res = tryCatch(this._cb).apply(null, this._s.results);\\n        if (res === errorObj) { return this._o.onError(res.e); }\\n\\n        this._o.onNext(res);\\n        this._o.onCompleted();\\n      }\\n    };\\n\\n    return ForkJoinObserver;\\n  }(AbstractObserver));\\n\\n   /**\\n   *  Runs all observable sequences in parallel and collect their last elements.\\n   *\\n   * @example\\n   *  1 - res = Rx.Observable.forkJoin([obs1, obs2]);\\n   *  1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);\\n   * @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.\\n   */\\n  Observable.forkJoin = function () {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;\\n    Array.isArray(args[0]) && (args = args[0]);\\n    return new ForkJoinObservable(args, resultSelector);\\n  };\\n\\n   /**\\n   *  Runs two observable sequences in parallel and combines their last elemenets.\\n   * @param {Observable} second Second observable sequence.\\n   * @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.\\n   * @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.\\n   */\\n  observableProto.forkJoin = function () {\\n    var len = arguments.length, args = new Array(len);\\n    for(var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n    if (Array.isArray(args[0])) {\\n      args[0].unshift(this);\\n    } else {\\n      args.unshift(this);\\n    }\\n    return Observable.forkJoin.apply(null, args);\\n  };\\n\\n  /**\\n   * Comonadic bind operator.\\n   * @param {Function} selector A transform function to apply to each element.\\n   * @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.\\n   * @returns {Observable} An observable sequence which results from the comonadic bind operation.\\n   */\\n  observableProto.manySelect = observableProto.extend = function (selector, scheduler) {\\n    isScheduler(scheduler) || (scheduler = Rx.Scheduler.immediate);\\n    var source = this;\\n    return observableDefer(function () {\\n      var chain;\\n\\n      return source\\n        .map(function (x) {\\n          var curr = new ChainObservable(x);\\n\\n          chain && chain.onNext(x);\\n          chain = curr;\\n\\n          return curr;\\n        })\\n        .tap(\\n          noop,\\n          function (e) { chain && chain.onError(e); },\\n          function () { chain && chain.onCompleted(); }\\n        )\\n        .observeOn(scheduler)\\n        .map(selector);\\n    }, source);\\n  };\\n\\n  var ChainObservable = (function (__super__) {\\n    inherits(ChainObservable, __super__);\\n    function ChainObservable(head) {\\n      __super__.call(this);\\n      this.head = head;\\n      this.tail = new AsyncSubject();\\n    }\\n\\n    addProperties(ChainObservable.prototype, Observer, {\\n      _subscribe: function (o) {\\n        var g = new CompositeDisposable();\\n        g.add(currentThreadScheduler.schedule(this, function (_, self) {\\n          o.onNext(self.head);\\n          g.add(self.tail.mergeAll().subscribe(o));\\n        }));\\n\\n        return g;\\n      },\\n      onCompleted: function () {\\n        this.onNext(Observable.empty());\\n      },\\n      onError: function (e) {\\n        this.onNext(Observable[\\'throw\\'](e));\\n      },\\n      onNext: function (v) {\\n        this.tail.onNext(v);\\n        this.tail.onCompleted();\\n      }\\n    });\\n\\n    return ChainObservable;\\n\\n  }(Observable));\\n\\n  var Map = root.Map || (function () {\\n    function Map() {\\n      this.size = 0;\\n      this._values = [];\\n      this._keys = [];\\n    }\\n\\n    Map.prototype[\\'delete\\'] = function (key) {\\n      var i = this._keys.indexOf(key);\\n      if (i === -1) { return false; }\\n      this._values.splice(i, 1);\\n      this._keys.splice(i, 1);\\n      this.size--;\\n      return true;\\n    };\\n\\n    Map.prototype.get = function (key) {\\n      var i = this._keys.indexOf(key);\\n      return i === -1 ? undefined : this._values[i];\\n    };\\n\\n    Map.prototype.set = function (key, value) {\\n      var i = this._keys.indexOf(key);\\n      if (i === -1) {\\n        this._keys.push(key);\\n        this._values.push(value);\\n        this.size++;\\n      } else {\\n        this._values[i] = value;\\n      }\\n      return this;\\n    };\\n\\n    Map.prototype.forEach = function (cb, thisArg) {\\n      for (var i = 0; i < this.size; i++) {\\n        cb.call(thisArg, this._values[i], this._keys[i]);\\n      }\\n    };\\n\\n    return Map;\\n  }());\\n\\n  /**\\n   * @constructor\\n   * Represents a join pattern over observable sequences.\\n   */\\n  function Pattern(patterns) {\\n    this.patterns = patterns;\\n  }\\n\\n  /**\\n   *  Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.\\n   *  @param other Observable sequence to match in addition to the current pattern.\\n   *  @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.\\n   */\\n  Pattern.prototype.and = function (other) {\\n    return new Pattern(this.patterns.concat(other));\\n  };\\n\\n  /**\\n   *  Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.\\n   *  @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.\\n   *  @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.\\n   */\\n  Pattern.prototype.thenDo = function (selector) {\\n    return new Plan(this, selector);\\n  };\\n\\n  function Plan(expression, selector) {\\n    this.expression = expression;\\n    this.selector = selector;\\n  }\\n\\n  function handleOnError(o) { return function (e) { o.onError(e); }; }\\n  function handleOnNext(self, observer) {\\n    return function onNext () {\\n      var result = tryCatch(self.selector).apply(self, arguments);\\n      if (result === errorObj) { return observer.onError(result.e); }\\n      observer.onNext(result);\\n    };\\n  }\\n\\n  Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {\\n    var joinObservers = [], errHandler = handleOnError(observer);\\n    for (var i = 0, len = this.expression.patterns.length; i < len; i++) {\\n      joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], errHandler));\\n    }\\n    var activePlan = new ActivePlan(joinObservers, handleOnNext(this, observer), function () {\\n      for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {\\n        joinObservers[j].removeActivePlan(activePlan);\\n      }\\n      deactivate(activePlan);\\n    });\\n    for (i = 0, len = joinObservers.length; i < len; i++) {\\n      joinObservers[i].addActivePlan(activePlan);\\n    }\\n    return activePlan;\\n  };\\n\\n  function planCreateObserver(externalSubscriptions, observable, onError) {\\n    var entry = externalSubscriptions.get(observable);\\n    if (!entry) {\\n      var observer = new JoinObserver(observable, onError);\\n      externalSubscriptions.set(observable, observer);\\n      return observer;\\n    }\\n    return entry;\\n  }\\n\\n  function ActivePlan(joinObserverArray, onNext, onCompleted) {\\n    this.joinObserverArray = joinObserverArray;\\n    this.onNext = onNext;\\n    this.onCompleted = onCompleted;\\n    this.joinObservers = new Map();\\n    for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {\\n      var joinObserver = this.joinObserverArray[i];\\n      this.joinObservers.set(joinObserver, joinObserver);\\n    }\\n  }\\n\\n  ActivePlan.prototype.dequeue = function () {\\n    this.joinObservers.forEach(function (v) { v.queue.shift(); });\\n  };\\n\\n  ActivePlan.prototype.match = function () {\\n    var i, len, hasValues = true;\\n    for (i = 0, len = this.joinObserverArray.length; i < len; i++) {\\n      if (this.joinObserverArray[i].queue.length === 0) {\\n        hasValues = false;\\n        break;\\n      }\\n    }\\n    if (hasValues) {\\n      var firstValues = [],\\n          isCompleted = false;\\n      for (i = 0, len = this.joinObserverArray.length; i < len; i++) {\\n        firstValues.push(this.joinObserverArray[i].queue[0]);\\n        this.joinObserverArray[i].queue[0].kind === \\'C\\' && (isCompleted = true);\\n      }\\n      if (isCompleted) {\\n        this.onCompleted();\\n      } else {\\n        this.dequeue();\\n        var values = [];\\n        for (i = 0, len = firstValues.length; i < firstValues.length; i++) {\\n          values.push(firstValues[i].value);\\n        }\\n        this.onNext.apply(this, values);\\n      }\\n    }\\n  };\\n\\n  var JoinObserver = (function (__super__) {\\n    inherits(JoinObserver, __super__);\\n\\n    function JoinObserver(source, onError) {\\n      __super__.call(this);\\n      this.source = source;\\n      this.onError = onError;\\n      this.queue = [];\\n      this.activePlans = [];\\n      this.subscription = new SingleAssignmentDisposable();\\n      this.isDisposed = false;\\n    }\\n\\n    var JoinObserverPrototype = JoinObserver.prototype;\\n\\n    JoinObserverPrototype.next = function (notification) {\\n      if (!this.isDisposed) {\\n        if (notification.kind === \\'E\\') {\\n          return this.onError(notification.error);\\n        }\\n        this.queue.push(notification);\\n        var activePlans = this.activePlans.slice(0);\\n        for (var i = 0, len = activePlans.length; i < len; i++) {\\n          activePlans[i].match();\\n        }\\n      }\\n    };\\n\\n    JoinObserverPrototype.error = noop;\\n    JoinObserverPrototype.completed = noop;\\n\\n    JoinObserverPrototype.addActivePlan = function (activePlan) {\\n      this.activePlans.push(activePlan);\\n    };\\n\\n    JoinObserverPrototype.subscribe = function () {\\n      this.subscription.setDisposable(this.source.materialize().subscribe(this));\\n    };\\n\\n    JoinObserverPrototype.removeActivePlan = function (activePlan) {\\n      this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);\\n      this.activePlans.length === 0 && this.dispose();\\n    };\\n\\n    JoinObserverPrototype.dispose = function () {\\n      __super__.prototype.dispose.call(this);\\n      if (!this.isDisposed) {\\n        this.isDisposed = true;\\n        this.subscription.dispose();\\n      }\\n    };\\n\\n    return JoinObserver;\\n  } (AbstractObserver));\\n\\n  /**\\n   *  Creates a pattern that matches when both observable sequences have an available value.\\n   *\\n   *  @param right Observable sequence to match with the current sequence.\\n   *  @return {Pattern} Pattern object that matches when both observable sequences have an available value.\\n   */\\n  observableProto.and = function (right) {\\n    return new Pattern([this, right]);\\n  };\\n\\n  /**\\n   *  Matches when the observable sequence has an available value and projects the value.\\n   *\\n   *  @param {Function} selector Selector that will be invoked for values in the source sequence.\\n   *  @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.\\n   */\\n  observableProto.thenDo = function (selector) {\\n    return new Pattern([this]).thenDo(selector);\\n  };\\n\\n  /**\\n   *  Joins together the results from several patterns.\\n   *\\n   *  @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.\\n   *  @returns {Observable} Observable sequence with the results form matching several patterns.\\n   */\\n  Observable.when = function () {\\n    var len = arguments.length, plans;\\n    if (Array.isArray(arguments[0])) {\\n      plans = arguments[0];\\n    } else {\\n      plans = new Array(len);\\n      for(var i = 0; i < len; i++) { plans[i] = arguments[i]; }\\n    }\\n    return new AnonymousObservable(function (o) {\\n      var activePlans = [],\\n          externalSubscriptions = new Map();\\n      var outObserver = observerCreate(\\n        function (x) { o.onNext(x); },\\n        function (err) {\\n          externalSubscriptions.forEach(function (v) { v.onError(err); });\\n          o.onError(err);\\n        },\\n        function (x) { o.onCompleted(); }\\n      );\\n      try {\\n        for (var i = 0, len = plans.length; i < len; i++) {\\n          activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {\\n            var idx = activePlans.indexOf(activePlan);\\n            activePlans.splice(idx, 1);\\n            activePlans.length === 0 && o.onCompleted();\\n          }));\\n        }\\n      } catch (e) {\\n        return observableThrow(e).subscribe(o);\\n      }\\n      var group = new CompositeDisposable();\\n      externalSubscriptions.forEach(function (joinObserver) {\\n        joinObserver.subscribe();\\n        group.add(joinObserver);\\n      });\\n\\n      return group;\\n    });\\n  };\\n\\n  var TimerObservable = (function(__super__) {\\n    inherits(TimerObservable, __super__);\\n    function TimerObservable(dt, s) {\\n      this._dt = dt;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    TimerObservable.prototype.subscribeCore = function (o) {\\n      return this._s.scheduleFuture(o, this._dt, scheduleMethod);\\n    };\\n\\n    function scheduleMethod(s, o) {\\n      o.onNext(0);\\n      o.onCompleted();\\n    }\\n\\n    return TimerObservable;\\n  }(ObservableBase));\\n\\n  function _observableTimer(dueTime, scheduler) {\\n    return new TimerObservable(dueTime, scheduler);\\n  }\\n\\n  function observableTimerDateAndPeriod(dueTime, period, scheduler) {\\n    return new AnonymousObservable(function (observer) {\\n      var d = dueTime, p = normalizeTime(period);\\n      return scheduler.scheduleRecursiveFuture(0, d, function (count, self) {\\n        if (p > 0) {\\n          var now = scheduler.now();\\n          d = new Date(d.getTime() + p);\\n          d.getTime() <= now && (d = new Date(now + p));\\n        }\\n        observer.onNext(count);\\n        self(count + 1, new Date(d));\\n      });\\n    });\\n  }\\n\\n  function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {\\n    return dueTime === period ?\\n      new AnonymousObservable(function (observer) {\\n        return scheduler.schedulePeriodic(0, period, function (count) {\\n          observer.onNext(count);\\n          return count + 1;\\n        });\\n      }) :\\n      observableDefer(function () {\\n        return observableTimerDateAndPeriod(new Date(scheduler.now() + dueTime), period, scheduler);\\n      });\\n  }\\n\\n  /**\\n   *  Returns an observable sequence that produces a value after each period.\\n   *\\n   * @example\\n   *  1 - res = Rx.Observable.interval(1000);\\n   *  2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);\\n   *\\n   * @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).\\n   * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.\\n   * @returns {Observable} An observable sequence that produces a value after each period.\\n   */\\n  var observableinterval = Observable.interval = function (period, scheduler) {\\n    return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : defaultScheduler);\\n  };\\n\\n  /**\\n   *  Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.\\n   * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.\\n   * @param {Mixed} [periodOrScheduler]  Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.\\n   * @param {Scheduler} [scheduler]  Scheduler to run the timer on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.\\n   */\\n  var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {\\n    var period;\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    if (periodOrScheduler != null && typeof periodOrScheduler === \\'number\\') {\\n      period = periodOrScheduler;\\n    } else if (isScheduler(periodOrScheduler)) {\\n      scheduler = periodOrScheduler;\\n    }\\n    if ((dueTime instanceof Date || typeof dueTime === \\'number\\') && period === undefined) {\\n      return _observableTimer(dueTime, scheduler);\\n    }\\n    if (dueTime instanceof Date && period !== undefined) {\\n      return observableTimerDateAndPeriod(dueTime, periodOrScheduler, scheduler);\\n    }\\n    return observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);\\n  };\\n\\n  function observableDelayRelative(source, dueTime, scheduler) {\\n    return new AnonymousObservable(function (o) {\\n      var active = false,\\n        cancelable = new SerialDisposable(),\\n        exception = null,\\n        q = [],\\n        running = false,\\n        subscription;\\n      subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {\\n        var d, shouldRun;\\n        if (notification.value.kind === \\'E\\') {\\n          q = [];\\n          q.push(notification);\\n          exception = notification.value.error;\\n          shouldRun = !running;\\n        } else {\\n          q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });\\n          shouldRun = !active;\\n          active = true;\\n        }\\n        if (shouldRun) {\\n          if (exception !== null) {\\n            o.onError(exception);\\n          } else {\\n            d = new SingleAssignmentDisposable();\\n            cancelable.setDisposable(d);\\n            d.setDisposable(scheduler.scheduleRecursiveFuture(null, dueTime, function (_, self) {\\n              var e, recurseDueTime, result, shouldRecurse;\\n              if (exception !== null) {\\n                return;\\n              }\\n              running = true;\\n              do {\\n                result = null;\\n                if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {\\n                  result = q.shift().value;\\n                }\\n                if (result !== null) {\\n                  result.accept(o);\\n                }\\n              } while (result !== null);\\n              shouldRecurse = false;\\n              recurseDueTime = 0;\\n              if (q.length > 0) {\\n                shouldRecurse = true;\\n                recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());\\n              } else {\\n                active = false;\\n              }\\n              e = exception;\\n              running = false;\\n              if (e !== null) {\\n                o.onError(e);\\n              } else if (shouldRecurse) {\\n                self(null, recurseDueTime);\\n              }\\n            }));\\n          }\\n        }\\n      });\\n      return new BinaryDisposable(subscription, cancelable);\\n    }, source);\\n  }\\n\\n  function observableDelayAbsolute(source, dueTime, scheduler) {\\n    return observableDefer(function () {\\n      return observableDelayRelative(source, dueTime - scheduler.now(), scheduler);\\n    });\\n  }\\n\\n  function delayWithSelector(source, subscriptionDelay, delayDurationSelector) {\\n    var subDelay, selector;\\n    if (isFunction(subscriptionDelay)) {\\n      selector = subscriptionDelay;\\n    } else {\\n      subDelay = subscriptionDelay;\\n      selector = delayDurationSelector;\\n    }\\n    return new AnonymousObservable(function (o) {\\n      var delays = new CompositeDisposable(), atEnd = false, subscription = new SerialDisposable();\\n\\n      function start() {\\n        subscription.setDisposable(source.subscribe(\\n          function (x) {\\n            var delay = tryCatch(selector)(x);\\n            if (delay === errorObj) { return o.onError(delay.e); }\\n            var d = new SingleAssignmentDisposable();\\n            delays.add(d);\\n            d.setDisposable(delay.subscribe(\\n              function () {\\n                o.onNext(x);\\n                delays.remove(d);\\n                done();\\n              },\\n              function (e) { o.onError(e); },\\n              function () {\\n                o.onNext(x);\\n                delays.remove(d);\\n                done();\\n              }\\n            ));\\n          },\\n          function (e) { o.onError(e); },\\n          function () {\\n            atEnd = true;\\n            subscription.dispose();\\n            done();\\n          }\\n        ));\\n      }\\n\\n      function done () {\\n        atEnd && delays.length === 0 && o.onCompleted();\\n      }\\n\\n      if (!subDelay) {\\n        start();\\n      } else {\\n        subscription.setDisposable(subDelay.subscribe(start, function (e) { o.onError(e); }, start));\\n      }\\n\\n      return new BinaryDisposable(subscription, delays);\\n    }, source);\\n  }\\n\\n  /**\\n   *  Time shifts the observable sequence by dueTime.\\n   *  The relative time intervals between the values are preserved.\\n   *\\n   * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.\\n   * @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} Time-shifted sequence.\\n   */\\n  observableProto.delay = function () {\\n    var firstArg = arguments[0];\\n    if (typeof firstArg === \\'number\\' || firstArg instanceof Date) {\\n      var dueTime = firstArg, scheduler = arguments[1];\\n      isScheduler(scheduler) || (scheduler = defaultScheduler);\\n      return dueTime instanceof Date ?\\n        observableDelayAbsolute(this, dueTime, scheduler) :\\n        observableDelayRelative(this, dueTime, scheduler);\\n    } else if (Observable.isObservable(firstArg) || isFunction(firstArg)) {\\n      return delayWithSelector(this, firstArg, arguments[1]);\\n    } else {\\n      throw new Error(\\'Invalid arguments\\');\\n    }\\n  };\\n\\n  var DebounceObservable = (function (__super__) {\\n    inherits(DebounceObservable, __super__);\\n    function DebounceObservable(source, dt, s) {\\n      isScheduler(s) || (s = defaultScheduler);\\n      this.source = source;\\n      this._dt = dt;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    DebounceObservable.prototype.subscribeCore = function (o) {\\n      var cancelable = new SerialDisposable();\\n      return new BinaryDisposable(\\n        this.source.subscribe(new DebounceObserver(o, this._dt, this._s, cancelable)),\\n        cancelable);\\n    };\\n\\n    return DebounceObservable;\\n  }(ObservableBase));\\n\\n  var DebounceObserver = (function (__super__) {\\n    inherits(DebounceObserver, __super__);\\n    function DebounceObserver(observer, dueTime, scheduler, cancelable) {\\n      this._o = observer;\\n      this._d = dueTime;\\n      this._scheduler = scheduler;\\n      this._c = cancelable;\\n      this._v = null;\\n      this._hv = false;\\n      this._id = 0;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleFuture(s, state) {\\n      state.self._hv && state.self._id === state.currentId && state.self._o.onNext(state.x);\\n      state.self._hv = false;\\n    }\\n\\n    DebounceObserver.prototype.next = function (x) {\\n      this._hv = true;\\n      this._v = x;\\n      var currentId = ++this._id, d = new SingleAssignmentDisposable();\\n      this._c.setDisposable(d);\\n      d.setDisposable(this._scheduler.scheduleFuture(this, this._d, function (_, self) {\\n        self._hv && self._id === currentId && self._o.onNext(x);\\n        self._hv = false;\\n      }));\\n    };\\n\\n    DebounceObserver.prototype.error = function (e) {\\n      this._c.dispose();\\n      this._o.onError(e);\\n      this._hv = false;\\n      this._id++;\\n    };\\n\\n    DebounceObserver.prototype.completed = function () {\\n      this._c.dispose();\\n      this._hv && this._o.onNext(this._v);\\n      this._o.onCompleted();\\n      this._hv = false;\\n      this._id++;\\n    };\\n\\n    return DebounceObserver;\\n  }(AbstractObserver));\\n\\n  function debounceWithSelector(source, durationSelector) {\\n    return new AnonymousObservable(function (o) {\\n      var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;\\n      var subscription = source.subscribe(\\n        function (x) {\\n          var throttle = tryCatch(durationSelector)(x);\\n          if (throttle === errorObj) { return o.onError(throttle.e); }\\n\\n          isPromise(throttle) && (throttle = observableFromPromise(throttle));\\n\\n          hasValue = true;\\n          value = x;\\n          id++;\\n          var currentid = id, d = new SingleAssignmentDisposable();\\n          cancelable.setDisposable(d);\\n          d.setDisposable(throttle.subscribe(\\n            function () {\\n              hasValue && id === currentid && o.onNext(value);\\n              hasValue = false;\\n              d.dispose();\\n            },\\n            function (e) { o.onError(e); },\\n            function () {\\n              hasValue && id === currentid && o.onNext(value);\\n              hasValue = false;\\n              d.dispose();\\n            }\\n          ));\\n        },\\n        function (e) {\\n          cancelable.dispose();\\n          o.onError(e);\\n          hasValue = false;\\n          id++;\\n        },\\n        function () {\\n          cancelable.dispose();\\n          hasValue && o.onNext(value);\\n          o.onCompleted();\\n          hasValue = false;\\n          id++;\\n        }\\n      );\\n      return new BinaryDisposable(subscription, cancelable);\\n    }, source);\\n  }\\n\\n  observableProto.debounce = function () {\\n    if (isFunction (arguments[0])) {\\n      return debounceWithSelector(this, arguments[0]);\\n    } else if (typeof arguments[0] === \\'number\\') {\\n      return new DebounceObservable(this, arguments[0], arguments[1]);\\n    } else {\\n      throw new Error(\\'Invalid arguments\\');\\n    }\\n  };\\n\\n  /**\\n   *  Projects each element of an observable sequence into zero or more windows which are produced based on timing information.\\n   * @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).\\n   * @param {Mixed} [timeShiftOrScheduler]  Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.\\n   * @param {Scheduler} [scheduler]  Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} An observable sequence of windows.\\n   */\\n  observableProto.windowWithTime = observableProto.windowTime = function (timeSpan, timeShiftOrScheduler, scheduler) {\\n    var source = this, timeShift;\\n    timeShiftOrScheduler == null && (timeShift = timeSpan);\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    if (typeof timeShiftOrScheduler === \\'number\\') {\\n      timeShift = timeShiftOrScheduler;\\n    } else if (isScheduler(timeShiftOrScheduler)) {\\n      timeShift = timeSpan;\\n      scheduler = timeShiftOrScheduler;\\n    }\\n    return new AnonymousObservable(function (observer) {\\n      var groupDisposable,\\n        nextShift = timeShift,\\n        nextSpan = timeSpan,\\n        q = [],\\n        refCountDisposable,\\n        timerD = new SerialDisposable(),\\n        totalTime = 0;\\n        groupDisposable = new CompositeDisposable(timerD),\\n        refCountDisposable = new RefCountDisposable(groupDisposable);\\n\\n       function createTimer () {\\n        var m = new SingleAssignmentDisposable(),\\n          isSpan = false,\\n          isShift = false;\\n        timerD.setDisposable(m);\\n        if (nextSpan === nextShift) {\\n          isSpan = true;\\n          isShift = true;\\n        } else if (nextSpan < nextShift) {\\n            isSpan = true;\\n        } else {\\n          isShift = true;\\n        }\\n        var newTotalTime = isSpan ? nextSpan : nextShift,\\n          ts = newTotalTime - totalTime;\\n        totalTime = newTotalTime;\\n        if (isSpan) {\\n          nextSpan += timeShift;\\n        }\\n        if (isShift) {\\n          nextShift += timeShift;\\n        }\\n        m.setDisposable(scheduler.scheduleFuture(null, ts, function () {\\n          if (isShift) {\\n            var s = new Subject();\\n            q.push(s);\\n            observer.onNext(addRef(s, refCountDisposable));\\n          }\\n          isSpan && q.shift().onCompleted();\\n          createTimer();\\n        }));\\n      };\\n      q.push(new Subject());\\n      observer.onNext(addRef(q[0], refCountDisposable));\\n      createTimer();\\n      groupDisposable.add(source.subscribe(\\n        function (x) {\\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }\\n        },\\n        function (e) {\\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }\\n          observer.onError(e);\\n        },\\n        function () {\\n          for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }\\n          observer.onCompleted();\\n        }\\n      ));\\n      return refCountDisposable;\\n    }, source);\\n  };\\n\\n  /**\\n   *  Projects each element of an observable sequence into a window that is completed when either it\\'s full or a given amount of time has elapsed.\\n   * @param {Number} timeSpan Maximum time length of a window.\\n   * @param {Number} count Maximum element count of a window.\\n   * @param {Scheduler} [scheduler]  Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} An observable sequence of windows.\\n   */\\n  observableProto.windowWithTimeOrCount = observableProto.windowTimeOrCount = function (timeSpan, count, scheduler) {\\n    var source = this;\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new AnonymousObservable(function (observer) {\\n      var timerD = new SerialDisposable(),\\n          groupDisposable = new CompositeDisposable(timerD),\\n          refCountDisposable = new RefCountDisposable(groupDisposable),\\n          n = 0,\\n          windowId = 0,\\n          s = new Subject();\\n\\n      function createTimer(id) {\\n        var m = new SingleAssignmentDisposable();\\n        timerD.setDisposable(m);\\n        m.setDisposable(scheduler.scheduleFuture(null, timeSpan, function () {\\n          if (id !== windowId) { return; }\\n          n = 0;\\n          var newId = ++windowId;\\n          s.onCompleted();\\n          s = new Subject();\\n          observer.onNext(addRef(s, refCountDisposable));\\n          createTimer(newId);\\n        }));\\n      }\\n\\n      observer.onNext(addRef(s, refCountDisposable));\\n      createTimer(0);\\n\\n      groupDisposable.add(source.subscribe(\\n        function (x) {\\n          var newId = 0, newWindow = false;\\n          s.onNext(x);\\n          if (++n === count) {\\n            newWindow = true;\\n            n = 0;\\n            newId = ++windowId;\\n            s.onCompleted();\\n            s = new Subject();\\n            observer.onNext(addRef(s, refCountDisposable));\\n          }\\n          newWindow && createTimer(newId);\\n        },\\n        function (e) {\\n          s.onError(e);\\n          observer.onError(e);\\n        }, function () {\\n          s.onCompleted();\\n          observer.onCompleted();\\n        }\\n      ));\\n      return refCountDisposable;\\n    }, source);\\n  };\\n\\n  function toArray(x) { return x.toArray(); }\\n\\n  /**\\n   *  Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.\\n   * @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).\\n   * @param {Mixed} [timeShiftOrScheduler]  Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.\\n   * @param {Scheduler} [scheduler]  Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} An observable sequence of buffers.\\n   */\\n  observableProto.bufferWithTime = observableProto.bufferTime = function (timeSpan, timeShiftOrScheduler, scheduler) {\\n    return this.windowWithTime(timeSpan, timeShiftOrScheduler, scheduler).flatMap(toArray);\\n  };\\n\\n  function toArray(x) { return x.toArray(); }\\n\\n  /**\\n   *  Projects each element of an observable sequence into a buffer that is completed when either it\\'s full or a given amount of time has elapsed.\\n   * @param {Number} timeSpan Maximum time length of a buffer.\\n   * @param {Number} count Maximum element count of a buffer.\\n   * @param {Scheduler} [scheduler]  Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} An observable sequence of buffers.\\n   */\\n  observableProto.bufferWithTimeOrCount = observableProto.bufferTimeOrCount = function (timeSpan, count, scheduler) {\\n    return this.windowWithTimeOrCount(timeSpan, count, scheduler).flatMap(toArray);\\n  };\\n\\n  var TimeIntervalObservable = (function (__super__) {\\n    inherits(TimeIntervalObservable, __super__);\\n    function TimeIntervalObservable(source, s) {\\n      this.source = source;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    TimeIntervalObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new TimeIntervalObserver(o, this._s));\\n    };\\n\\n    return TimeIntervalObservable;\\n  }(ObservableBase));\\n\\n  var TimeIntervalObserver = (function (__super__) {\\n    inherits(TimeIntervalObserver, __super__);\\n\\n    function TimeIntervalObserver(o, s) {\\n      this._o = o;\\n      this._s = s;\\n      this._l = s.now();\\n      __super__.call(this);\\n    }\\n\\n    TimeIntervalObserver.prototype.next = function (x) {\\n      var now = this._s.now(), span = now - this._l;\\n      this._l = now;\\n      this._o.onNext({ value: x, interval: span });\\n    };\\n    TimeIntervalObserver.prototype.error = function (e) { this._o.onError(e); };\\n    TimeIntervalObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return TimeIntervalObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Records the time interval between consecutive values in an observable sequence.\\n   *\\n   * @example\\n   *  1 - res = source.timeInterval();\\n   *  2 - res = source.timeInterval(Rx.Scheduler.timeout);\\n   *\\n   * @param [scheduler]  Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} An observable sequence with time interval information on values.\\n   */\\n  observableProto.timeInterval = function (scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new TimeIntervalObservable(this, scheduler);\\n  };\\n\\n  var TimestampObservable = (function (__super__) {\\n    inherits(TimestampObservable, __super__);\\n    function TimestampObservable(source, s) {\\n      this.source = source;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    TimestampObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new TimestampObserver(o, this._s));\\n    };\\n\\n    return TimestampObservable;\\n  }(ObservableBase));\\n\\n  var TimestampObserver = (function (__super__) {\\n    inherits(TimestampObserver, __super__);\\n    function TimestampObserver(o, s) {\\n      this._o = o;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    TimestampObserver.prototype.next = function (x) {\\n      this._o.onNext({ value: x, timestamp: this._s.now() });\\n    };\\n\\n    TimestampObserver.prototype.error = function (e) {\\n      this._o.onError(e);\\n    };\\n\\n    TimestampObserver.prototype.completed = function () {\\n      this._o.onCompleted();\\n    };\\n\\n    return TimestampObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Records the timestamp for each value in an observable sequence.\\n   *\\n   * @example\\n   *  1 - res = source.timestamp(); // produces { value: x, timestamp: ts }\\n   *  2 - res = source.timestamp(Rx.Scheduler.default);\\n   *\\n   * @param {Scheduler} [scheduler]  Scheduler used to compute timestamps. If not specified, the default scheduler is used.\\n   * @returns {Observable} An observable sequence with timestamp information on values.\\n   */\\n  observableProto.timestamp = function (scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new TimestampObservable(this, scheduler);\\n  };\\n\\n  var SampleObservable = (function(__super__) {\\n    inherits(SampleObservable, __super__);\\n    function SampleObservable(source, sampler) {\\n      this.source = source;\\n      this._sampler = sampler;\\n      __super__.call(this);\\n    }\\n\\n    SampleObservable.prototype.subscribeCore = function (o) {\\n      var state = {\\n        o: o,\\n        atEnd: false,\\n        value: null,\\n        hasValue: false,\\n        sourceSubscription: new SingleAssignmentDisposable()\\n      };\\n\\n      state.sourceSubscription.setDisposable(this.source.subscribe(new SampleSourceObserver(state)));\\n      return new BinaryDisposable(\\n        state.sourceSubscription,\\n        this._sampler.subscribe(new SamplerObserver(state))\\n      );\\n    };\\n\\n    return SampleObservable;\\n  }(ObservableBase));\\n\\n  var SamplerObserver = (function(__super__) {\\n    inherits(SamplerObserver, __super__);\\n    function SamplerObserver(s) {\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    SamplerObserver.prototype._handleMessage = function () {\\n      if (this._s.hasValue) {\\n        this._s.hasValue = false;\\n        this._s.o.onNext(this._s.value);\\n      }\\n      this._s.atEnd && this._s.o.onCompleted();\\n    };\\n\\n    SamplerObserver.prototype.next = function () { this._handleMessage(); };\\n    SamplerObserver.prototype.error = function (e) { this._s.onError(e); };\\n    SamplerObserver.prototype.completed = function () { this._handleMessage(); };\\n\\n    return SamplerObserver;\\n  }(AbstractObserver));\\n\\n  var SampleSourceObserver = (function(__super__) {\\n    inherits(SampleSourceObserver, __super__);\\n    function SampleSourceObserver(s) {\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    SampleSourceObserver.prototype.next = function (x) {\\n      this._s.hasValue = true;\\n      this._s.value = x;\\n    };\\n    SampleSourceObserver.prototype.error = function (e) { this._s.o.onError(e); };\\n    SampleSourceObserver.prototype.completed = function () {\\n      this._s.atEnd = true;\\n      this._s.sourceSubscription.dispose();\\n    };\\n\\n    return SampleSourceObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Samples the observable sequence at each interval.\\n   *\\n   * @example\\n   *  1 - res = source.sample(sampleObservable); // Sampler tick sequence\\n   *  2 - res = source.sample(5000); // 5 seconds\\n   *  2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds\\n   *\\n   * @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.\\n   * @param {Scheduler} [scheduler]  Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} Sampled observable sequence.\\n   */\\n  observableProto.sample = function (intervalOrSampler, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return typeof intervalOrSampler === \\'number\\' ?\\n      new SampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :\\n      new SampleObservable(this, intervalOrSampler);\\n  };\\n\\n  var TimeoutError = Rx.TimeoutError = function(message) {\\n    this.message = message || \\'Timeout has occurred\\';\\n    this.name = \\'TimeoutError\\';\\n    Error.call(this);\\n  };\\n  TimeoutError.prototype = Object.create(Error.prototype);\\n\\n  function timeoutWithSelector(source, firstTimeout, timeoutDurationSelector, other) {\\n    if (isFunction(firstTimeout)) {\\n      other = timeoutDurationSelector;\\n      timeoutDurationSelector = firstTimeout;\\n      firstTimeout = observableNever();\\n    }\\n    Observable.isObservable(other) || (other = observableThrow(new TimeoutError()));\\n    return new AnonymousObservable(function (o) {\\n      var subscription = new SerialDisposable(),\\n        timer = new SerialDisposable(),\\n        original = new SingleAssignmentDisposable();\\n\\n      subscription.setDisposable(original);\\n\\n      var id = 0, switched = false;\\n\\n      function setTimer(timeout) {\\n        var myId = id, d = new SingleAssignmentDisposable();\\n\\n        function timerWins() {\\n          switched = (myId === id);\\n          return switched;\\n        }\\n\\n        timer.setDisposable(d);\\n        d.setDisposable(timeout.subscribe(function () {\\n          timerWins() && subscription.setDisposable(other.subscribe(o));\\n          d.dispose();\\n        }, function (e) {\\n          timerWins() && o.onError(e);\\n        }, function () {\\n          timerWins() && subscription.setDisposable(other.subscribe(o));\\n        }));\\n      };\\n\\n      setTimer(firstTimeout);\\n\\n      function oWins() {\\n        var res = !switched;\\n        if (res) { id++; }\\n        return res;\\n      }\\n\\n      original.setDisposable(source.subscribe(function (x) {\\n        if (oWins()) {\\n          o.onNext(x);\\n          var timeout = tryCatch(timeoutDurationSelector)(x);\\n          if (timeout === errorObj) { return o.onError(timeout.e); }\\n          setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout);\\n        }\\n      }, function (e) {\\n        oWins() && o.onError(e);\\n      }, function () {\\n        oWins() && o.onCompleted();\\n      }));\\n      return new BinaryDisposable(subscription, timer);\\n    }, source);\\n  }\\n\\n  function timeout(source, dueTime, other, scheduler) {\\n    if (isScheduler(other)) {\\n      scheduler = other;\\n      other = observableThrow(new TimeoutError());\\n    }\\n    if (other instanceof Error) { other = observableThrow(other); }\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    Observable.isObservable(other) || (other = observableThrow(new TimeoutError()));\\n    return new AnonymousObservable(function (o) {\\n      var id = 0,\\n        original = new SingleAssignmentDisposable(),\\n        subscription = new SerialDisposable(),\\n        switched = false,\\n        timer = new SerialDisposable();\\n\\n      subscription.setDisposable(original);\\n\\n      function createTimer() {\\n        var myId = id;\\n        timer.setDisposable(scheduler.scheduleFuture(null, dueTime, function () {\\n          switched = id === myId;\\n          if (switched) {\\n            isPromise(other) && (other = observableFromPromise(other));\\n            subscription.setDisposable(other.subscribe(o));\\n          }\\n        }));\\n      }\\n\\n      createTimer();\\n\\n      original.setDisposable(source.subscribe(function (x) {\\n        if (!switched) {\\n          id++;\\n          o.onNext(x);\\n          createTimer();\\n        }\\n      }, function (e) {\\n        if (!switched) {\\n          id++;\\n          o.onError(e);\\n        }\\n      }, function () {\\n        if (!switched) {\\n          id++;\\n          o.onCompleted();\\n        }\\n      }));\\n      return new BinaryDisposable(subscription, timer);\\n    }, source);\\n  }\\n\\n  observableProto.timeout = function () {\\n    var firstArg = arguments[0];\\n    if (firstArg instanceof Date || typeof firstArg === \\'number\\') {\\n      return timeout(this, firstArg, arguments[1], arguments[2]);\\n    } else if (Observable.isObservable(firstArg) || isFunction(firstArg)) {\\n      return timeoutWithSelector(this, firstArg, arguments[1], arguments[2]);\\n    } else {\\n      throw new Error(\\'Invalid arguments\\');\\n    }\\n  };\\n\\n  var GenerateAbsoluteObservable = (function (__super__) {\\n    inherits(GenerateAbsoluteObservable, __super__);\\n    function GenerateAbsoluteObservable(state, cndFn, itrFn, resFn, timeFn, s) {\\n      this._state = state;\\n      this._cndFn = cndFn;\\n      this._itrFn = itrFn;\\n      this._resFn = resFn;\\n      this._timeFn = timeFn;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleRecursive(state, recurse) {\\n      state.hasResult && state.o.onNext(state.result);\\n\\n      if (state.first) {\\n        state.first = false;\\n      } else {\\n        state.newState = tryCatch(state.self._itrFn)(state.newState);\\n        if (state.newState === errorObj) { return state.o.onError(state.newState.e); }\\n      }\\n      state.hasResult = tryCatch(state.self._cndFn)(state.newState);\\n      if (state.hasResult === errorObj) { return state.o.onError(state.hasResult.e); }\\n      if (state.hasResult) {\\n        state.result = tryCatch(state.self._resFn)(state.newState);\\n        if (state.result === errorObj) { return state.o.onError(state.result.e); }\\n        var time = tryCatch(state.self._timeFn)(state.newState);\\n        if (time === errorObj) { return state.o.onError(time.e); }\\n        recurse(state, time);\\n      } else {\\n        state.o.onCompleted();\\n      }\\n    }\\n\\n    GenerateAbsoluteObservable.prototype.subscribeCore = function (o) {\\n      var state = {\\n        o: o,\\n        self: this,\\n        newState: this._state,\\n        first: true,\\n        hasResult: false\\n      };\\n      return this._s.scheduleRecursiveFuture(state, new Date(this._s.now()), scheduleRecursive);\\n    };\\n\\n    return GenerateAbsoluteObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  GenerateAbsolutes an observable sequence by iterating a state from an initial state until the condition fails.\\n   *\\n   * @example\\n   *  res = source.generateWithAbsoluteTime(0,\\n   *      function (x) { return return true; },\\n   *      function (x) { return x + 1; },\\n   *      function (x) { return x; },\\n   *      function (x) { return new Date(); }\\n   *  });\\n   *\\n   * @param {Mixed} initialState Initial state.\\n   * @param {Function} condition Condition to terminate generation (upon returning false).\\n   * @param {Function} iterate Iteration step function.\\n   * @param {Function} resultSelector Selector function for results produced in the sequence.\\n   * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.\\n   * @param {Scheduler} [scheduler]  Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} The generated sequence.\\n   */\\n  Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new GenerateAbsoluteObservable(initialState, condition, iterate, resultSelector, timeSelector, scheduler);\\n  };\\n\\n  var GenerateRelativeObservable = (function (__super__) {\\n    inherits(GenerateRelativeObservable, __super__);\\n    function GenerateRelativeObservable(state, cndFn, itrFn, resFn, timeFn, s) {\\n      this._state = state;\\n      this._cndFn = cndFn;\\n      this._itrFn = itrFn;\\n      this._resFn = resFn;\\n      this._timeFn = timeFn;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleRecursive(state, recurse) {\\n      state.hasResult && state.o.onNext(state.result);\\n\\n      if (state.first) {\\n        state.first = false;\\n      } else {\\n        state.newState = tryCatch(state.self._itrFn)(state.newState);\\n        if (state.newState === errorObj) { return state.o.onError(state.newState.e); }\\n      }\\n\\n      state.hasResult = tryCatch(state.self._cndFn)(state.newState);\\n      if (state.hasResult === errorObj) { return state.o.onError(state.hasResult.e); }\\n      if (state.hasResult) {\\n        state.result = tryCatch(state.self._resFn)(state.newState);\\n        if (state.result === errorObj) { return state.o.onError(state.result.e); }\\n        var time = tryCatch(state.self._timeFn)(state.newState);\\n        if (time === errorObj) { return state.o.onError(time.e); }\\n        recurse(state, time);\\n      } else {\\n        state.o.onCompleted();\\n      }\\n    }\\n\\n    GenerateRelativeObservable.prototype.subscribeCore = function (o) {\\n      var state = {\\n        o: o,\\n        self: this,\\n        newState: this._state,\\n        first: true,\\n        hasResult: false\\n      };\\n      return this._s.scheduleRecursiveFuture(state, 0, scheduleRecursive);\\n    };\\n\\n    return GenerateRelativeObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Generates an observable sequence by iterating a state from an initial state until the condition fails.\\n   *\\n   * @example\\n   *  res = source.generateWithRelativeTime(0,\\n   *      function (x) { return return true; },\\n   *      function (x) { return x + 1; },\\n   *      function (x) { return x; },\\n   *      function (x) { return 500; }\\n   *  );\\n   *\\n   * @param {Mixed} initialState Initial state.\\n   * @param {Function} condition Condition to terminate generation (upon returning false).\\n   * @param {Function} iterate Iteration step function.\\n   * @param {Function} resultSelector Selector function for results produced in the sequence.\\n   * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.\\n   * @param {Scheduler} [scheduler]  Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} The generated sequence.\\n   */\\n  Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new GenerateRelativeObservable(initialState, condition, iterate, resultSelector, timeSelector, scheduler);\\n  };\\n\\n  var DelaySubscription = (function(__super__) {\\n    inherits(DelaySubscription, __super__);\\n    function DelaySubscription(source, dt, s) {\\n      this.source = source;\\n      this._dt = dt;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    DelaySubscription.prototype.subscribeCore = function (o) {\\n      var d = new SerialDisposable();\\n\\n      d.setDisposable(this._s.scheduleFuture([this.source, o, d], this._dt, scheduleMethod));\\n\\n      return d;\\n    };\\n\\n    function scheduleMethod(s, state) {\\n      var source = state[0], o = state[1], d = state[2];\\n      d.setDisposable(source.subscribe(o));\\n    }\\n\\n    return DelaySubscription;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.\\n   *\\n   * @example\\n   *  1 - res = source.delaySubscription(5000); // 5s\\n   *  2 - res = source.delaySubscription(5000, Rx.Scheduler.default); // 5 seconds\\n   *\\n   * @param {Number} dueTime Relative or absolute time shift of the subscription.\\n   * @param {Scheduler} [scheduler]  Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.\\n   * @returns {Observable} Time-shifted sequence.\\n   */\\n  observableProto.delaySubscription = function (dueTime, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new DelaySubscription(this, dueTime, scheduler);\\n  };\\n\\n  var SkipLastWithTimeObservable = (function (__super__) {\\n    inherits(SkipLastWithTimeObservable, __super__);\\n    function SkipLastWithTimeObservable(source, d, s) {\\n      this.source = source;\\n      this._d = d;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    SkipLastWithTimeObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new SkipLastWithTimeObserver(o, this));\\n    };\\n\\n    return SkipLastWithTimeObservable;\\n  }(ObservableBase));\\n\\n  var SkipLastWithTimeObserver = (function (__super__) {\\n    inherits(SkipLastWithTimeObserver, __super__);\\n\\n    function SkipLastWithTimeObserver(o, p) {\\n      this._o = o;\\n      this._s = p._s;\\n      this._d = p._d;\\n      this._q = [];\\n      __super__.call(this);\\n    }\\n\\n    SkipLastWithTimeObserver.prototype.next = function (x) {\\n      var now = this._s.now();\\n      this._q.push({ interval: now, value: x });\\n      while (this._q.length > 0 && now - this._q[0].interval >= this._d) {\\n        this._o.onNext(this._q.shift().value);\\n      }\\n    };\\n    SkipLastWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SkipLastWithTimeObserver.prototype.completed = function () {\\n      var now = this._s.now();\\n      while (this._q.length > 0 && now - this._q[0].interval >= this._d) {\\n        this._o.onNext(this._q.shift().value);\\n      }\\n      this._o.onCompleted();\\n    };\\n\\n    return SkipLastWithTimeObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.\\n   * @description\\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\\n   *  result sequence. This causes elements to be delayed with duration.\\n   * @param {Number} duration Duration for skipping elements from the end of the sequence.\\n   * @param {Scheduler} [scheduler]  Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout\\n   * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.\\n   */\\n  observableProto.skipLastWithTime = function (duration, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new SkipLastWithTimeObservable(this, duration, scheduler);\\n  };\\n\\n  var TakeLastWithTimeObservable = (function (__super__) {\\n    inherits(TakeLastWithTimeObservable, __super__);\\n    function TakeLastWithTimeObservable(source, d, s) {\\n      this.source = source;\\n      this._d = d;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    TakeLastWithTimeObservable.prototype.subscribeCore = function (o) {\\n      return this.source.subscribe(new TakeLastWithTimeObserver(o, this._d, this._s));\\n    };\\n\\n    return TakeLastWithTimeObservable;\\n  }(ObservableBase));\\n\\n  var TakeLastWithTimeObserver = (function (__super__) {\\n    inherits(TakeLastWithTimeObserver, __super__);\\n\\n    function TakeLastWithTimeObserver(o, d, s) {\\n      this._o = o;\\n      this._d = d;\\n      this._s = s;\\n      this._q = [];\\n      __super__.call(this);\\n    }\\n\\n    TakeLastWithTimeObserver.prototype.next = function (x) {\\n      var now = this._s.now();\\n      this._q.push({ interval: now, value: x });\\n      while (this._q.length > 0 && now - this._q[0].interval >= this._d) {\\n        this._q.shift();\\n      }\\n    };\\n    TakeLastWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\\n    TakeLastWithTimeObserver.prototype.completed = function () {\\n      var now = this._s.now();\\n      while (this._q.length > 0) {\\n        var next = this._q.shift();\\n        if (now - next.interval <= this._d) { this._o.onNext(next.value); }\\n      }\\n      this._o.onCompleted();\\n    };\\n\\n    return TakeLastWithTimeObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.\\n   * @description\\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\\n   *  result sequence. This causes elements to be delayed with duration.\\n   * @param {Number} duration Duration for taking elements from the end of the sequence.\\n   * @param {Scheduler} [scheduler]  Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\\n   * @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.\\n   */\\n  observableProto.takeLastWithTime = function (duration, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new TakeLastWithTimeObservable(this, duration, scheduler);\\n  };\\n\\n  /**\\n   *  Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.\\n   * @description\\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\\n   *  result sequence. This causes elements to be delayed with duration.\\n   * @param {Number} duration Duration for taking elements from the end of the sequence.\\n   * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\\n   * @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.\\n   */\\n  observableProto.takeLastBufferWithTime = function (duration, scheduler) {\\n    var source = this;\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new AnonymousObservable(function (o) {\\n      var q = [];\\n      return source.subscribe(function (x) {\\n        var now = scheduler.now();\\n        q.push({ interval: now, value: x });\\n        while (q.length > 0 && now - q[0].interval >= duration) {\\n          q.shift();\\n        }\\n      }, function (e) { o.onError(e); }, function () {\\n        var now = scheduler.now(), res = [];\\n        while (q.length > 0) {\\n          var next = q.shift();\\n          now - next.interval <= duration && res.push(next.value);\\n        }\\n        o.onNext(res);\\n        o.onCompleted();\\n      });\\n    }, source);\\n  };\\n\\n  var TakeWithTimeObservable = (function (__super__) {\\n    inherits(TakeWithTimeObservable, __super__);\\n    function TakeWithTimeObservable(source, d, s) {\\n      this.source = source;\\n      this._d = d;\\n      this._s = s;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(s, o) {\\n      o.onCompleted();\\n    }\\n\\n    TakeWithTimeObservable.prototype.subscribeCore = function (o) {\\n      return new BinaryDisposable(\\n        this._s.scheduleFuture(o, this._d, scheduleMethod),\\n        this.source.subscribe(o)\\n      );\\n    };\\n\\n    return TakeWithTimeObservable;\\n  }(ObservableBase));\\n\\n  /**\\n   *  Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.\\n   *\\n   * @example\\n   *  1 - res = source.takeWithTime(5000,  [optional scheduler]);\\n   * @description\\n   *  This operator accumulates a queue with a length enough to store elements received during the initial duration window.\\n   *  As more elements are received, elements older than the specified duration are taken from the queue and produced on the\\n   *  result sequence. This causes elements to be delayed with duration.\\n   * @param {Number} duration Duration for taking elements from the start of the sequence.\\n   * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\\n   * @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.\\n   */\\n  observableProto.takeWithTime = function (duration, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new TakeWithTimeObservable(this, duration, scheduler);\\n  };\\n\\n  var SkipWithTimeObservable = (function (__super__) {\\n    inherits(SkipWithTimeObservable, __super__);\\n    function SkipWithTimeObservable(source, d, s) {\\n      this.source = source;\\n      this._d = d;\\n      this._s = s;\\n      this._open = false;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(s, self) {\\n      self._open = true;\\n    }\\n\\n    SkipWithTimeObservable.prototype.subscribeCore = function (o) {\\n      return new BinaryDisposable(\\n        this._s.scheduleFuture(this, this._d, scheduleMethod),\\n        this.source.subscribe(new SkipWithTimeObserver(o, this))\\n      );\\n    };\\n\\n    return SkipWithTimeObservable;\\n  }(ObservableBase));\\n\\n  var SkipWithTimeObserver = (function (__super__) {\\n    inherits(SkipWithTimeObserver, __super__);\\n\\n    function SkipWithTimeObserver(o, p) {\\n      this._o = o;\\n      this._p = p;\\n      __super__.call(this);\\n    }\\n\\n    SkipWithTimeObserver.prototype.next = function (x) { this._p._open && this._o.onNext(x); };\\n    SkipWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SkipWithTimeObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return SkipWithTimeObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   *  Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.\\n   * @description\\n   *  Specifying a zero value for duration doesn\\'t guarantee no elements will be dropped from the start of the source sequence.\\n   *  This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded\\n   *  may not execute immediately, despite the zero due time.\\n   *\\n   *  Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.\\n   * @param {Number} duration Duration for skipping elements from the start of the sequence.\\n   * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\\n   * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.\\n   */\\n  observableProto.skipWithTime = function (duration, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new SkipWithTimeObservable(this, duration, scheduler);\\n  };\\n\\n  var SkipUntilWithTimeObservable = (function (__super__) {\\n    inherits(SkipUntilWithTimeObservable, __super__);\\n    function SkipUntilWithTimeObservable(source, startTime, scheduler) {\\n      this.source = source;\\n      this._st = startTime;\\n      this._s = scheduler;\\n      __super__.call(this);\\n    }\\n\\n    function scheduleMethod(s, state) {\\n      state._open = true;\\n    }\\n\\n    SkipUntilWithTimeObservable.prototype.subscribeCore = function (o) {\\n      this._open = false;\\n      return new BinaryDisposable(\\n        this._s.scheduleFuture(this, this._st, scheduleMethod),\\n        this.source.subscribe(new SkipUntilWithTimeObserver(o, this))\\n      );\\n    };\\n\\n    return SkipUntilWithTimeObservable;\\n  }(ObservableBase));\\n\\n  var SkipUntilWithTimeObserver = (function (__super__) {\\n    inherits(SkipUntilWithTimeObserver, __super__);\\n\\n    function SkipUntilWithTimeObserver(o, p) {\\n      this._o = o;\\n      this._p = p;\\n      __super__.call(this);\\n    }\\n\\n    SkipUntilWithTimeObserver.prototype.next = function (x) { this._p._open && this._o.onNext(x); };\\n    SkipUntilWithTimeObserver.prototype.error = function (e) { this._o.onError(e); };\\n    SkipUntilWithTimeObserver.prototype.completed = function () { this._o.onCompleted(); };\\n\\n    return SkipUntilWithTimeObserver;\\n  }(AbstractObserver));\\n\\n\\n  /**\\n   *  Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.\\n   *  Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.\\n   *\\n   * @examples\\n   *  1 - res = source.skipUntilWithTime(new Date(), [scheduler]);\\n   *  2 - res = source.skipUntilWithTime(5000, [scheduler]);\\n   * @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.\\n   * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.\\n   * @returns {Observable} An observable sequence with the elements skipped until the specified start time.\\n   */\\n  observableProto.skipUntilWithTime = function (startTime, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    return new SkipUntilWithTimeObservable(this, startTime, scheduler);\\n  };\\n\\n  /**\\n   *  Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.\\n   * @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.\\n   * @param {Scheduler} [scheduler] Scheduler to run the timer on.\\n   * @returns {Observable} An observable sequence with the elements taken until the specified end time.\\n   */\\n  observableProto.takeUntilWithTime = function (endTime, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    var source = this;\\n    return new AnonymousObservable(function (o) {\\n      return new BinaryDisposable(\\n        scheduler.scheduleFuture(o, endTime, function (_, o) { o.onCompleted(); }),\\n        source.subscribe(o));\\n    }, source);\\n  };\\n\\n  /**\\n   * Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.\\n   * @param {Number} windowDuration time to wait before emitting another item after emitting the last item\\n   * @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.\\n   * @returns {Observable} An Observable that performs the throttle operation.\\n   */\\n  observableProto.throttle = function (windowDuration, scheduler) {\\n    isScheduler(scheduler) || (scheduler = defaultScheduler);\\n    var duration = +windowDuration || 0;\\n    if (duration <= 0) { throw new RangeError(\\'windowDuration cannot be less or equal zero.\\'); }\\n    var source = this;\\n    return new AnonymousObservable(function (o) {\\n      var lastOnNext = 0;\\n      return source.subscribe(\\n        function (x) {\\n          var now = scheduler.now();\\n          if (lastOnNext === 0 || now - lastOnNext >= duration) {\\n            lastOnNext = now;\\n            o.onNext(x);\\n          }\\n        },function (e) { o.onError(e); }, function () { o.onCompleted(); }\\n      );\\n    }, source);\\n  };\\n\\n  var TransduceObserver = (function (__super__) {\\n    inherits(TransduceObserver, __super__);\\n    function TransduceObserver(o, xform) {\\n      this._o = o;\\n      this._xform = xform;\\n      __super__.call(this);\\n    }\\n\\n    TransduceObserver.prototype.next = function (x) {\\n      var res = tryCatch(this._xform[\\'@@transducer/step\\']).call(this._xform, this._o, x);\\n      if (res === errorObj) { this._o.onError(res.e); }\\n    };\\n\\n    TransduceObserver.prototype.error = function (e) { this._o.onError(e); };\\n\\n    TransduceObserver.prototype.completed = function () {\\n      this._xform[\\'@@transducer/result\\'](this._o);\\n    };\\n\\n    return TransduceObserver;\\n  }(AbstractObserver));\\n\\n  function transformForObserver(o) {\\n    return {\\n      \\'@@transducer/init\\': function() {\\n        return o;\\n      },\\n      \\'@@transducer/step\\': function(obs, input) {\\n        return obs.onNext(input);\\n      },\\n      \\'@@transducer/result\\': function(obs) {\\n        return obs.onCompleted();\\n      }\\n    };\\n  }\\n\\n  /**\\n   * Executes a transducer to transform the observable sequence\\n   * @param {Transducer} transducer A transducer to execute\\n   * @returns {Observable} An Observable sequence containing the results from the transducer.\\n   */\\n  observableProto.transduce = function(transducer) {\\n    var source = this;\\n    return new AnonymousObservable(function(o) {\\n      var xform = transducer(transformForObserver(o));\\n      return source.subscribe(new TransduceObserver(o, xform));\\n    }, source);\\n  };\\n\\n  var SwitchFirstObservable = (function (__super__) {\\n    inherits(SwitchFirstObservable, __super__);\\n    function SwitchFirstObservable(source) {\\n      this.source = source;\\n      __super__.call(this);\\n    }\\n\\n    SwitchFirstObservable.prototype.subscribeCore = function (o) {\\n      var m = new SingleAssignmentDisposable(),\\n        g = new CompositeDisposable(),\\n        state = {\\n          hasCurrent: false,\\n          isStopped: false,\\n          o: o,\\n          g: g\\n        };\\n\\n      g.add(m);\\n      m.setDisposable(this.source.subscribe(new SwitchFirstObserver(state)));\\n      return g;\\n    };\\n\\n    return SwitchFirstObservable;\\n  }(ObservableBase));\\n\\n  var SwitchFirstObserver = (function(__super__) {\\n    inherits(SwitchFirstObserver, __super__);\\n    function SwitchFirstObserver(state) {\\n      this._s = state;\\n      __super__.call(this);\\n    }\\n\\n    SwitchFirstObserver.prototype.next = function (x) {\\n      if (!this._s.hasCurrent) {\\n        this._s.hasCurrent = true;\\n        isPromise(x) && (x = observableFromPromise(x));\\n        var inner = new SingleAssignmentDisposable();\\n        this._s.g.add(inner);\\n        inner.setDisposable(x.subscribe(new InnerObserver(this._s, inner)));\\n      }\\n    };\\n\\n    SwitchFirstObserver.prototype.error = function (e) {\\n      this._s.o.onError(e);\\n    };\\n\\n    SwitchFirstObserver.prototype.completed = function () {\\n      this._s.isStopped = true;\\n      !this._s.hasCurrent && this._s.g.length === 1 && this._s.o.onCompleted();\\n    };\\n\\n    inherits(InnerObserver, __super__);\\n    function InnerObserver(state, inner) {\\n      this._s = state;\\n      this._i = inner;\\n      __super__.call(this);\\n    }\\n\\n    InnerObserver.prototype.next = function (x) { this._s.o.onNext(x); };\\n    InnerObserver.prototype.error = function (e) { this._s.o.onError(e); };\\n    InnerObserver.prototype.completed = function () {\\n      this._s.g.remove(this._i);\\n      this._s.hasCurrent = false;\\n      this._s.isStopped && this._s.g.length === 1 && this._s.o.onCompleted();\\n    };\\n\\n    return SwitchFirstObserver;\\n  }(AbstractObserver));\\n\\n  /**\\n   * Performs a exclusive waiting for the first to finish before subscribing to another observable.\\n   * Observables that come in between subscriptions will be dropped on the floor.\\n   * @returns {Observable} A exclusive observable with only the results that happen when subscribed.\\n   */\\n  observableProto.switchFirst = function () {\\n    return new SwitchFirstObservable(this);\\n  };\\n\\nobservableProto.flatMapFirst = observableProto.exhaustMap = function(selector, resultSelector, thisArg) {\\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).switchFirst();\\n};\\n\\nobservableProto.flatMapWithMaxConcurrent = observableProto.flatMapMaxConcurrent = function(limit, selector, resultSelector, thisArg) {\\n    return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit);\\n};\\n\\n  /** Provides a set of extension methods for virtual time scheduling. */\\n  var VirtualTimeScheduler = Rx.VirtualTimeScheduler = (function (__super__) {\\n    inherits(VirtualTimeScheduler, __super__);\\n\\n    /**\\n     * Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.\\n     *\\n     * @constructor\\n     * @param {Number} initialClock Initial value for the clock.\\n     * @param {Function} comparer Comparer to determine causality of events based on absolute time.\\n     */\\n    function VirtualTimeScheduler(initialClock, comparer) {\\n      this.clock = initialClock;\\n      this.comparer = comparer;\\n      this.isEnabled = false;\\n      this.queue = new PriorityQueue(1024);\\n      __super__.call(this);\\n    }\\n\\n    var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;\\n\\n    VirtualTimeSchedulerPrototype.now = function () {\\n      return this.toAbsoluteTime(this.clock);\\n    };\\n\\n    VirtualTimeSchedulerPrototype.schedule = function (state, action) {\\n      return this.scheduleAbsolute(state, this.clock, action);\\n    };\\n\\n    VirtualTimeSchedulerPrototype.scheduleFuture = function (state, dueTime, action) {\\n      var dt = dueTime instanceof Date ?\\n        this.toRelativeTime(dueTime - this.now()) :\\n        this.toRelativeTime(dueTime);\\n\\n      return this.scheduleRelative(state, dt, action);\\n    };\\n\\n    /**\\n     * Adds a relative time value to an absolute time value.\\n     * @param {Number} absolute Absolute virtual time value.\\n     * @param {Number} relative Relative virtual time value to add.\\n     * @return {Number} Resulting absolute virtual time sum value.\\n     */\\n    VirtualTimeSchedulerPrototype.add = notImplemented;\\n\\n    /**\\n     * Converts an absolute time to a number\\n     * @param {Any} The absolute time.\\n     * @returns {Number} The absolute time in ms\\n     */\\n    VirtualTimeSchedulerPrototype.toAbsoluteTime = notImplemented;\\n\\n    /**\\n     * Converts the TimeSpan value to a relative virtual time value.\\n     * @param {Number} timeSpan TimeSpan value to convert.\\n     * @return {Number} Corresponding relative virtual time value.\\n     */\\n    VirtualTimeSchedulerPrototype.toRelativeTime = notImplemented;\\n\\n    /**\\n     * Schedules a periodic piece of work by dynamically discovering the scheduler\\'s capabilities. The periodic task will be emulated using recursive scheduling.\\n     * @param {Mixed} state Initial state passed to the action upon the first iteration.\\n     * @param {Number} period Period for running the work periodically.\\n     * @param {Function} action Action to be executed, potentially updating the state.\\n     * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).\\n     */\\n    VirtualTimeSchedulerPrototype.schedulePeriodic = function (state, period, action) {\\n      var s = new SchedulePeriodicRecursive(this, state, period, action);\\n      return s.start();\\n    };\\n\\n    /**\\n     * Schedules an action to be executed after dueTime.\\n     * @param {Mixed} state State passed to the action to be executed.\\n     * @param {Number} dueTime Relative time after which to execute the action.\\n     * @param {Function} action Action to be executed.\\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\\n     */\\n    VirtualTimeSchedulerPrototype.scheduleRelative = function (state, dueTime, action) {\\n      var runAt = this.add(this.clock, dueTime);\\n      return this.scheduleAbsolute(state, runAt, action);\\n    };\\n\\n    /**\\n     * Starts the virtual time scheduler.\\n     */\\n    VirtualTimeSchedulerPrototype.start = function () {\\n      if (!this.isEnabled) {\\n        this.isEnabled = true;\\n        do {\\n          var next = this.getNext();\\n          if (next !== null) {\\n            this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);\\n            next.invoke();\\n          } else {\\n            this.isEnabled = false;\\n          }\\n        } while (this.isEnabled);\\n      }\\n    };\\n\\n    /**\\n     * Stops the virtual time scheduler.\\n     */\\n    VirtualTimeSchedulerPrototype.stop = function () {\\n      this.isEnabled = false;\\n    };\\n\\n    /**\\n     * Advances the scheduler\\'s clock to the specified time, running all work till that point.\\n     * @param {Number} time Absolute time to advance the scheduler\\'s clock to.\\n     */\\n    VirtualTimeSchedulerPrototype.advanceTo = function (time) {\\n      var dueToClock = this.comparer(this.clock, time);\\n      if (this.comparer(this.clock, time) > 0) { throw new ArgumentOutOfRangeError(); }\\n      if (dueToClock === 0) { return; }\\n      if (!this.isEnabled) {\\n        this.isEnabled = true;\\n        do {\\n          var next = this.getNext();\\n          if (next !== null && this.comparer(next.dueTime, time) <= 0) {\\n            this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);\\n            next.invoke();\\n          } else {\\n            this.isEnabled = false;\\n          }\\n        } while (this.isEnabled);\\n        this.clock = time;\\n      }\\n    };\\n\\n    /**\\n     * Advances the scheduler\\'s clock by the specified relative time, running all work scheduled for that timespan.\\n     * @param {Number} time Relative time to advance the scheduler\\'s clock by.\\n     */\\n    VirtualTimeSchedulerPrototype.advanceBy = function (time) {\\n      var dt = this.add(this.clock, time),\\n          dueToClock = this.comparer(this.clock, dt);\\n      if (dueToClock > 0) { throw new ArgumentOutOfRangeError(); }\\n      if (dueToClock === 0) {  return; }\\n\\n      this.advanceTo(dt);\\n    };\\n\\n    /**\\n     * Advances the scheduler\\'s clock by the specified relative time.\\n     * @param {Number} time Relative time to advance the scheduler\\'s clock by.\\n     */\\n    VirtualTimeSchedulerPrototype.sleep = function (time) {\\n      var dt = this.add(this.clock, time);\\n      if (this.comparer(this.clock, dt) >= 0) { throw new ArgumentOutOfRangeError(); }\\n\\n      this.clock = dt;\\n    };\\n\\n    /**\\n     * Gets the next scheduled item to be executed.\\n     * @returns {ScheduledItem} The next scheduled item.\\n     */\\n    VirtualTimeSchedulerPrototype.getNext = function () {\\n      while (this.queue.length > 0) {\\n        var next = this.queue.peek();\\n        if (next.isCancelled()) {\\n          this.queue.dequeue();\\n        } else {\\n          return next;\\n        }\\n      }\\n      return null;\\n    };\\n\\n    /**\\n     * Schedules an action to be executed at dueTime.\\n     * @param {Mixed} state State passed to the action to be executed.\\n     * @param {Number} dueTime Absolute time at which to execute the action.\\n     * @param {Function} action Action to be executed.\\n     * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).\\n     */\\n    VirtualTimeSchedulerPrototype.scheduleAbsolute = function (state, dueTime, action) {\\n      var self = this;\\n\\n      function run(scheduler, state1) {\\n        self.queue.remove(si);\\n        return action(scheduler, state1);\\n      }\\n\\n      var si = new ScheduledItem(this, state, run, dueTime, this.comparer);\\n      this.queue.enqueue(si);\\n\\n      return si.disposable;\\n    };\\n\\n    return VirtualTimeScheduler;\\n  }(Scheduler));\\n\\n  /** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */\\n  Rx.HistoricalScheduler = (function (__super__) {\\n    inherits(HistoricalScheduler, __super__);\\n\\n    /**\\n     * Creates a new historical scheduler with the specified initial clock value.\\n     * @constructor\\n     * @param {Number} initialClock Initial value for the clock.\\n     * @param {Function} comparer Comparer to determine causality of events based on absolute time.\\n     */\\n    function HistoricalScheduler(initialClock, comparer) {\\n      var clock = initialClock == null ? 0 : initialClock;\\n      var cmp = comparer || defaultSubComparer;\\n      __super__.call(this, clock, cmp);\\n    }\\n\\n    var HistoricalSchedulerProto = HistoricalScheduler.prototype;\\n\\n    /**\\n     * Adds a relative time value to an absolute time value.\\n     * @param {Number} absolute Absolute virtual time value.\\n     * @param {Number} relative Relative virtual time value to add.\\n     * @return {Number} Resulting absolute virtual time sum value.\\n     */\\n    HistoricalSchedulerProto.add = function (absolute, relative) {\\n      return absolute + relative;\\n    };\\n\\n    HistoricalSchedulerProto.toAbsoluteTime = function (absolute) {\\n      return new Date(absolute).getTime();\\n    };\\n\\n    /**\\n     * Converts the TimeSpan value to a relative virtual time value.\\n     * @memberOf HistoricalScheduler\\n     * @param {Number} timeSpan TimeSpan value to convert.\\n     * @return {Number} Corresponding relative virtual time value.\\n     */\\n    HistoricalSchedulerProto.toRelativeTime = function (timeSpan) {\\n      return timeSpan;\\n    };\\n\\n    return HistoricalScheduler;\\n  }(Rx.VirtualTimeScheduler));\\n\\nfunction OnNextPredicate(predicate) {\\n    this.predicate = predicate;\\n}\\n\\nOnNextPredicate.prototype.equals = function (other) {\\n  if (other === this) { return true; }\\n  if (other == null) { return false; }\\n  if (other.kind !== \\'N\\') { return false; }\\n  return this.predicate(other.value);\\n};\\n\\nfunction OnErrorPredicate(predicate) {\\n  this.predicate = predicate;\\n}\\n\\nOnErrorPredicate.prototype.equals = function (other) {\\n  if (other === this) { return true; }\\n  if (other == null) { return false; }\\n  if (other.kind !== \\'E\\') { return false; }\\n  return this.predicate(other.error);\\n};\\n\\nvar ReactiveTest = Rx.ReactiveTest = {\\n  /** Default virtual time used for creation of observable sequences in unit tests. */\\n  created: 100,\\n  /** Default virtual time used to subscribe to observable sequences in unit tests. */\\n  subscribed: 200,\\n  /** Default virtual time used to dispose subscriptions in unit tests. */\\n  disposed: 1000,\\n\\n  /**\\n   * Factory method for an OnNext notification record at a given time with a given value or a predicate function.\\n   *\\n   * 1 - ReactiveTest.onNext(200, 42);\\n   * 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });\\n   *\\n   * @param ticks Recorded virtual time the OnNext notification occurs.\\n   * @param value Recorded value stored in the OnNext notification or a predicate.\\n   * @return Recorded OnNext notification.\\n   */\\n  onNext: function (ticks, value) {\\n    return typeof value === \\'function\\' ?\\n      new Recorded(ticks, new OnNextPredicate(value)) :\\n      new Recorded(ticks, Notification.createOnNext(value));\\n  },\\n  /**\\n   * Factory method for an OnError notification record at a given time with a given error.\\n   *\\n   * 1 - ReactiveTest.onNext(200, new Error(\\'error\\'));\\n   * 2 - ReactiveTest.onNext(200, function (e) { return e.message === \\'error\\'; });\\n   *\\n   * @param ticks Recorded virtual time the OnError notification occurs.\\n   * @param exception Recorded exception stored in the OnError notification.\\n   * @return Recorded OnError notification.\\n   */\\n  onError: function (ticks, error) {\\n    return typeof error === \\'function\\' ?\\n      new Recorded(ticks, new OnErrorPredicate(error)) :\\n      new Recorded(ticks, Notification.createOnError(error));\\n  },\\n  /**\\n   * Factory method for an OnCompleted notification record at a given time.\\n   *\\n   * @param ticks Recorded virtual time the OnCompleted notification occurs.\\n   * @return Recorded OnCompleted notification.\\n   */\\n  onCompleted: function (ticks) {\\n    return new Recorded(ticks, Notification.createOnCompleted());\\n  },\\n  /**\\n   * Factory method for a subscription record based on a given subscription and disposal time.\\n   *\\n   * @param start Virtual time indicating when the subscription was created.\\n   * @param end Virtual time indicating when the subscription was disposed.\\n   * @return Subscription object.\\n   */\\n  subscribe: function (start, end) {\\n    return new Subscription(start, end);\\n  }\\n};\\n\\n  /**\\n   * Creates a new object recording the production of the specified value at the given virtual time.\\n   *\\n   * @constructor\\n   * @param {Number} time Virtual time the value was produced on.\\n   * @param {Mixed} value Value that was produced.\\n   * @param {Function} comparer An optional comparer.\\n   */\\n  var Recorded = Rx.Recorded = function (time, value, comparer) {\\n    this.time = time;\\n    this.value = value;\\n    this.comparer = comparer || defaultComparer;\\n  };\\n\\n  /**\\n   * Checks whether the given recorded object is equal to the current instance.\\n   *\\n   * @param {Recorded} other Recorded object to check for equality.\\n   * @returns {Boolean} true if both objects are equal; false otherwise.\\n   */\\n  Recorded.prototype.equals = function (other) {\\n    return this.time === other.time && this.comparer(this.value, other.value);\\n  };\\n\\n  /**\\n   * Returns a string representation of the current Recorded value.\\n   *\\n   * @returns {String} String representation of the current Recorded value.\\n   */\\n  Recorded.prototype.toString = function () {\\n    return this.value.toString() + \\'@\\' + this.time;\\n  };\\n\\n  /**\\n   * Creates a new subscription object with the given virtual subscription and unsubscription time.\\n   *\\n   * @constructor\\n   * @param {Number} subscribe Virtual time at which the subscription occurred.\\n   * @param {Number} unsubscribe Virtual time at which the unsubscription occurred.\\n   */\\n  var Subscription = Rx.Subscription = function (start, end) {\\n    this.subscribe = start;\\n    this.unsubscribe = end || Number.MAX_VALUE;\\n  };\\n\\n  /**\\n   * Checks whether the given subscription is equal to the current instance.\\n   * @param other Subscription object to check for equality.\\n   * @returns {Boolean} true if both objects are equal; false otherwise.\\n   */\\n  Subscription.prototype.equals = function (other) {\\n    return this.subscribe === other.subscribe && this.unsubscribe === other.unsubscribe;\\n  };\\n\\n  /**\\n   * Returns a string representation of the current Subscription value.\\n   * @returns {String} String representation of the current Subscription value.\\n   */\\n  Subscription.prototype.toString = function () {\\n    return \\'(\\' + this.subscribe + \\', \\' + (this.unsubscribe === Number.MAX_VALUE ? \\'Infinite\\' : this.unsubscribe) + \\')\\';\\n  };\\n\\n  var MockDisposable = Rx.MockDisposable = function (scheduler) {\\n    this.scheduler = scheduler;\\n    this.disposes = [];\\n    this.disposes.push(this.scheduler.clock);\\n  };\\n\\n  MockDisposable.prototype.dispose = function () {\\n    this.disposes.push(this.scheduler.clock);\\n  };\\n\\n  var MockObserver = (function (__super__) {\\n    inherits(MockObserver, __super__);\\n\\n    function MockObserver(scheduler) {\\n      __super__.call(this);\\n      this.scheduler = scheduler;\\n      this.messages = [];\\n    }\\n\\n    var MockObserverPrototype = MockObserver.prototype;\\n\\n    MockObserverPrototype.onNext = function (value) {\\n      this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));\\n    };\\n\\n    MockObserverPrototype.onError = function (e) {\\n      this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(e)));\\n    };\\n\\n    MockObserverPrototype.onCompleted = function () {\\n      this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));\\n    };\\n\\n    return MockObserver;\\n  })(Observer);\\n\\n  function MockPromise(scheduler, messages) {\\n    var self = this;\\n    this.scheduler = scheduler;\\n    this.messages = messages;\\n    this.subscriptions = [];\\n    this.observers = [];\\n    for (var i = 0, len = this.messages.length; i < len; i++) {\\n      var message = this.messages[i],\\n          notification = message.value;\\n      (function (innerNotification) {\\n        scheduler.scheduleAbsolute(null, message.time, function () {\\n          var obs = self.observers.slice(0);\\n\\n          for (var j = 0, jLen = obs.length; j < jLen; j++) {\\n            innerNotification.accept(obs[j]);\\n          }\\n          return disposableEmpty;\\n        });\\n      })(notification);\\n    }\\n  }\\n\\n  MockPromise.prototype.then = function (onResolved, onRejected) {\\n    var self = this;\\n\\n    this.subscriptions.push(new Subscription(this.scheduler.clock));\\n    var index = this.subscriptions.length - 1;\\n\\n    var newPromise;\\n\\n    var observer = Rx.Observer.create(\\n      function (x) {\\n        var retValue = onResolved(x);\\n        if (retValue && typeof retValue.then === \\'function\\') {\\n          newPromise = retValue;\\n        } else {\\n          var ticks = self.scheduler.clock;\\n          newPromise = new MockPromise(self.scheduler, [Rx.ReactiveTest.onNext(ticks, undefined), Rx.ReactiveTest.onCompleted(ticks)]);\\n        }\\n        var idx = self.observers.indexOf(observer);\\n        self.observers.splice(idx, 1);\\n        self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);\\n      },\\n      function (err) {\\n        onRejected(err);\\n        var idx = self.observers.indexOf(observer);\\n        self.observers.splice(idx, 1);\\n        self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);\\n      }\\n    );\\n    this.observers.push(observer);\\n\\n    return newPromise || new MockPromise(this.scheduler, this.messages);\\n  };\\n\\n  var HotObservable = (function (__super__) {\\n    inherits(HotObservable, __super__);\\n\\n    function HotObservable(scheduler, messages) {\\n      __super__.call(this);\\n      var message, notification, observable = this;\\n      this.scheduler = scheduler;\\n      this.messages = messages;\\n      this.subscriptions = [];\\n      this.observers = [];\\n      for (var i = 0, len = this.messages.length; i < len; i++) {\\n        message = this.messages[i];\\n        notification = message.value;\\n        (function (innerNotification) {\\n          scheduler.scheduleAbsolute(null, message.time, function () {\\n            var obs = observable.observers.slice(0);\\n\\n            for (var j = 0, jLen = obs.length; j < jLen; j++) {\\n              innerNotification.accept(obs[j]);\\n            }\\n            return disposableEmpty;\\n          });\\n        })(notification);\\n      }\\n    }\\n\\n    HotObservable.prototype._subscribe = function (o) {\\n      var observable = this;\\n      this.observers.push(o);\\n      this.subscriptions.push(new Subscription(this.scheduler.clock));\\n      var index = this.subscriptions.length - 1;\\n      return disposableCreate(function () {\\n        var idx = observable.observers.indexOf(o);\\n        observable.observers.splice(idx, 1);\\n        observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);\\n      });\\n    };\\n\\n    return HotObservable;\\n  })(Observable);\\n\\n  var ColdObservable = (function (__super__) {\\n    inherits(ColdObservable, __super__);\\n\\n    function ColdObservable(scheduler, messages) {\\n      __super__.call(this);\\n      this.scheduler = scheduler;\\n      this.messages = messages;\\n      this.subscriptions = [];\\n    }\\n\\n    ColdObservable.prototype._subscribe = function (o) {\\n      var message, notification, observable = this;\\n      this.subscriptions.push(new Subscription(this.scheduler.clock));\\n      var index = this.subscriptions.length - 1;\\n      var d = new CompositeDisposable();\\n      for (var i = 0, len = this.messages.length; i < len; i++) {\\n        message = this.messages[i];\\n        notification = message.value;\\n        (function (innerNotification) {\\n          d.add(observable.scheduler.scheduleRelative(null, message.time, function () {\\n            innerNotification.accept(o);\\n            return disposableEmpty;\\n          }));\\n        })(notification);\\n      }\\n      return disposableCreate(function () {\\n        observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);\\n        d.dispose();\\n      });\\n    };\\n\\n    return ColdObservable;\\n  })(Observable);\\n\\n  /** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */\\n  Rx.TestScheduler = (function (__super__) {\\n    inherits(TestScheduler, __super__);\\n\\n    function baseComparer(x, y) {\\n      return x > y ? 1 : (x < y ? -1 : 0);\\n    }\\n\\n    function TestScheduler() {\\n      __super__.call(this, 0, baseComparer);\\n    }\\n\\n    /**\\n     * Schedules an action to be executed at the specified virtual time.\\n     *\\n     * @param state State passed to the action to be executed.\\n     * @param dueTime Absolute virtual time at which to execute the action.\\n     * @param action Action to be executed.\\n     * @return Disposable object used to cancel the scheduled action (best effort).\\n     */\\n    TestScheduler.prototype.scheduleAbsolute = function (state, dueTime, action) {\\n      dueTime <= this.clock && (dueTime = this.clock + 1);\\n      return __super__.prototype.scheduleAbsolute.call(this, state, dueTime, action);\\n    };\\n    /**\\n     * Adds a relative virtual time to an absolute virtual time value.\\n     *\\n     * @param absolute Absolute virtual time value.\\n     * @param relative Relative virtual time value to add.\\n     * @return Resulting absolute virtual time sum value.\\n     */\\n    TestScheduler.prototype.add = function (absolute, relative) {\\n      return absolute + relative;\\n    };\\n    /**\\n     * Converts the absolute virtual time value to a DateTimeOffset value.\\n     *\\n     * @param absolute Absolute virtual time value to convert.\\n     * @return Corresponding DateTimeOffset value.\\n     */\\n    TestScheduler.prototype.toAbsoluteTime = function (absolute) {\\n      return new Date(absolute).getTime();\\n    };\\n    /**\\n     * Converts the TimeSpan value to a relative virtual time value.\\n     *\\n     * @param timeSpan TimeSpan value to convert.\\n     * @return Corresponding relative virtual time value.\\n     */\\n    TestScheduler.prototype.toRelativeTime = function (timeSpan) {\\n      return timeSpan;\\n    };\\n    /**\\n     * Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.\\n     *\\n     * @param create Factory method to create an observable sequence.\\n     * @param created Virtual time at which to invoke the factory to create an observable sequence.\\n     * @param subscribed Virtual time at which to subscribe to the created observable sequence.\\n     * @param disposed Virtual time at which to dispose the subscription.\\n     * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.\\n     */\\n    TestScheduler.prototype.startScheduler = function (createFn, settings) {\\n      settings || (settings = {});\\n      settings.created == null && (settings.created = ReactiveTest.created);\\n      settings.subscribed == null && (settings.subscribed = ReactiveTest.subscribed);\\n      settings.disposed == null && (settings.disposed = ReactiveTest.disposed);\\n\\n      var observer = this.createObserver(), source, subscription;\\n\\n      this.scheduleAbsolute(null, settings.created, function () {\\n        source = createFn();\\n        return disposableEmpty;\\n      });\\n\\n      this.scheduleAbsolute(null, settings.subscribed, function () {\\n        subscription = source.subscribe(observer);\\n        return disposableEmpty;\\n      });\\n\\n      this.scheduleAbsolute(null, settings.disposed, function () {\\n        subscription.dispose();\\n        return disposableEmpty;\\n      });\\n\\n      this.start();\\n\\n      return observer;\\n    };\\n\\n    /**\\n     * Creates a hot observable using the specified timestamped notification messages either as an array or arguments.\\n     * @param messages Notifications to surface through the created sequence at their specified absolute virtual times.\\n     * @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.\\n     */\\n    TestScheduler.prototype.createHotObservable = function () {\\n      var len = arguments.length, args;\\n      if (Array.isArray(arguments[0])) {\\n        args = arguments[0];\\n      } else {\\n        args = new Array(len);\\n        for (var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n      }\\n      return new HotObservable(this, args);\\n    };\\n\\n    /**\\n     * Creates a cold observable using the specified timestamped notification messages either as an array or arguments.\\n     * @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.\\n     * @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.\\n     */\\n    TestScheduler.prototype.createColdObservable = function () {\\n      var len = arguments.length, args;\\n      if (Array.isArray(arguments[0])) {\\n        args = arguments[0];\\n      } else {\\n        args = new Array(len);\\n        for (var i = 0; i < len; i++) { args[i] = arguments[i]; }\\n      }\\n      return new ColdObservable(this, args);\\n    };\\n\\n    /**\\n     * Creates a resolved promise with the given value and ticks\\n     * @param {Number} ticks The absolute time of the resolution.\\n     * @param {Any} value The value to yield at the given tick.\\n     * @returns {MockPromise} A mock Promise which fulfills with the given value.\\n     */\\n    TestScheduler.prototype.createResolvedPromise = function (ticks, value) {\\n      return new MockPromise(this, [Rx.ReactiveTest.onNext(ticks, value), Rx.ReactiveTest.onCompleted(ticks)]);\\n    };\\n\\n    /**\\n     * Creates a rejected promise with the given reason and ticks\\n     * @param {Number} ticks The absolute time of the resolution.\\n     * @param {Any} reason The reason for rejection to yield at the given tick.\\n     * @returns {MockPromise} A mock Promise which rejects with the given reason.\\n     */\\n    TestScheduler.prototype.createRejectedPromise = function (ticks, reason) {\\n      return new MockPromise(this, [Rx.ReactiveTest.onError(ticks, reason)]);\\n    };\\n\\n    /**\\n     * Creates an observer that records received notification messages and timestamps those.\\n     * @return Observer that can be used to assert the timing of received notifications.\\n     */\\n    TestScheduler.prototype.createObserver = function () {\\n      return new MockObserver(this);\\n    };\\n\\n    return TestScheduler;\\n  })(VirtualTimeScheduler);\\n\\n  var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {\\n    inherits(AnonymousObservable, __super__);\\n\\n    // Fix subscriber to check for undefined or function returned to decorate as Disposable\\n    function fixSubscriber(subscriber) {\\n      return subscriber && isFunction(subscriber.dispose) ? subscriber :\\n        isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;\\n    }\\n\\n    function setDisposable(s, state) {\\n      var ado = state[0], self = state[1];\\n      var sub = tryCatch(self.__subscribe).call(self, ado);\\n      if (sub === errorObj && !ado.fail(errorObj.e)) { thrower(errorObj.e); }\\n      ado.setDisposable(fixSubscriber(sub));\\n    }\\n\\n    function AnonymousObservable(subscribe, parent) {\\n      this.source = parent;\\n      this.__subscribe = subscribe;\\n      __super__.call(this);\\n    }\\n\\n    AnonymousObservable.prototype._subscribe = function (o) {\\n      var ado = new AutoDetachObserver(o), state = [ado, this];\\n\\n      if (currentThreadScheduler.scheduleRequired()) {\\n        currentThreadScheduler.schedule(state, setDisposable);\\n      } else {\\n        setDisposable(null, state);\\n      }\\n      return ado;\\n    };\\n\\n    return AnonymousObservable;\\n\\n  }(Observable));\\n\\n  var AutoDetachObserver = (function (__super__) {\\n    inherits(AutoDetachObserver, __super__);\\n\\n    function AutoDetachObserver(observer) {\\n      __super__.call(this);\\n      this.observer = observer;\\n      this.m = new SingleAssignmentDisposable();\\n    }\\n\\n    var AutoDetachObserverPrototype = AutoDetachObserver.prototype;\\n\\n    AutoDetachObserverPrototype.next = function (value) {\\n      var result = tryCatch(this.observer.onNext).call(this.observer, value);\\n      if (result === errorObj) {\\n        this.dispose();\\n        thrower(result.e);\\n      }\\n    };\\n\\n    AutoDetachObserverPrototype.error = function (err) {\\n      var result = tryCatch(this.observer.onError).call(this.observer, err);\\n      this.dispose();\\n      result === errorObj && thrower(result.e);\\n    };\\n\\n    AutoDetachObserverPrototype.completed = function () {\\n      var result = tryCatch(this.observer.onCompleted).call(this.observer);\\n      this.dispose();\\n      result === errorObj && thrower(result.e);\\n    };\\n\\n    AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };\\n    AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };\\n\\n    AutoDetachObserverPrototype.dispose = function () {\\n      __super__.prototype.dispose.call(this);\\n      this.m.dispose();\\n    };\\n\\n    return AutoDetachObserver;\\n  }(AbstractObserver));\\n\\n  var UnderlyingObservable = (function (__super__) {\\n    inherits(UnderlyingObservable, __super__);\\n    function UnderlyingObservable(m, u) {\\n      this._m = m;\\n      this._u = u;\\n      __super__.call(this);\\n    }\\n\\n    UnderlyingObservable.prototype.subscribeCore = function (o) {\\n      return new BinaryDisposable(this._m.getDisposable(), this._u.subscribe(o));\\n    };\\n\\n    return UnderlyingObservable;\\n  }(ObservableBase));\\n\\n  var GroupedObservable = (function (__super__) {\\n    inherits(GroupedObservable, __super__);\\n    function GroupedObservable(key, underlyingObservable, mergedDisposable) {\\n      __super__.call(this);\\n      this.key = key;\\n      this.underlyingObservable = !mergedDisposable ?\\n        underlyingObservable :\\n        new UnderlyingObservable(mergedDisposable, underlyingObservable);\\n    }\\n\\n    GroupedObservable.prototype._subscribe = function (o) {\\n      return this.underlyingObservable.subscribe(o);\\n    };\\n\\n    return GroupedObservable;\\n  }(Observable));\\n\\n  /**\\n   *  Represents an object that is both an observable sequence as well as an observer.\\n   *  Each notification is broadcasted to all subscribed observers.\\n   */\\n  var Subject = Rx.Subject = (function (__super__) {\\n    inherits(Subject, __super__);\\n    function Subject() {\\n      __super__.call(this);\\n      this.isDisposed = false;\\n      this.isStopped = false;\\n      this.observers = [];\\n      this.hasError = false;\\n    }\\n\\n    addProperties(Subject.prototype, Observer.prototype, {\\n      _subscribe: function (o) {\\n        checkDisposed(this);\\n        if (!this.isStopped) {\\n          this.observers.push(o);\\n          return new InnerSubscription(this, o);\\n        }\\n        if (this.hasError) {\\n          o.onError(this.error);\\n          return disposableEmpty;\\n        }\\n        o.onCompleted();\\n        return disposableEmpty;\\n      },\\n      /**\\n       * Indicates whether the subject has observers subscribed to it.\\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\\n       */\\n      hasObservers: function () { checkDisposed(this); return this.observers.length > 0; },\\n      /**\\n       * Notifies all subscribed observers about the end of the sequence.\\n       */\\n      onCompleted: function () {\\n        checkDisposed(this);\\n        if (!this.isStopped) {\\n          this.isStopped = true;\\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n            os[i].onCompleted();\\n          }\\n\\n          this.observers.length = 0;\\n        }\\n      },\\n      /**\\n       * Notifies all subscribed observers about the exception.\\n       * @param {Mixed} error The exception to send to all observers.\\n       */\\n      onError: function (error) {\\n        checkDisposed(this);\\n        if (!this.isStopped) {\\n          this.isStopped = true;\\n          this.error = error;\\n          this.hasError = true;\\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n            os[i].onError(error);\\n          }\\n\\n          this.observers.length = 0;\\n        }\\n      },\\n      /**\\n       * Notifies all subscribed observers about the arrival of the specified element in the sequence.\\n       * @param {Mixed} value The value to send to all observers.\\n       */\\n      onNext: function (value) {\\n        checkDisposed(this);\\n        if (!this.isStopped) {\\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n            os[i].onNext(value);\\n          }\\n        }\\n      },\\n      /**\\n       * Unsubscribe all observers and release resources.\\n       */\\n      dispose: function () {\\n        this.isDisposed = true;\\n        this.observers = null;\\n      }\\n    });\\n\\n    /**\\n     * Creates a subject from the specified observer and observable.\\n     * @param {Observer} observer The observer used to send messages to the subject.\\n     * @param {Observable} observable The observable used to subscribe to messages sent from the subject.\\n     * @returns {Subject} Subject implemented using the given observer and observable.\\n     */\\n    Subject.create = function (observer, observable) {\\n      return new AnonymousSubject(observer, observable);\\n    };\\n\\n    return Subject;\\n  }(Observable));\\n\\n  /**\\n   *  Represents the result of an asynchronous operation.\\n   *  The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.\\n   */\\n  var AsyncSubject = Rx.AsyncSubject = (function (__super__) {\\n    inherits(AsyncSubject, __super__);\\n\\n    /**\\n     * Creates a subject that can only receive one value and that value is cached for all future observations.\\n     * @constructor\\n     */\\n    function AsyncSubject() {\\n      __super__.call(this);\\n      this.isDisposed = false;\\n      this.isStopped = false;\\n      this.hasValue = false;\\n      this.observers = [];\\n      this.hasError = false;\\n    }\\n\\n    addProperties(AsyncSubject.prototype, Observer.prototype, {\\n      _subscribe: function (o) {\\n        checkDisposed(this);\\n\\n        if (!this.isStopped) {\\n          this.observers.push(o);\\n          return new InnerSubscription(this, o);\\n        }\\n\\n        if (this.hasError) {\\n          o.onError(this.error);\\n        } else if (this.hasValue) {\\n          o.onNext(this.value);\\n          o.onCompleted();\\n        } else {\\n          o.onCompleted();\\n        }\\n\\n        return disposableEmpty;\\n      },\\n      /**\\n       * Indicates whether the subject has observers subscribed to it.\\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\\n       */\\n      hasObservers: function () { checkDisposed(this); return this.observers.length > 0; },\\n      /**\\n       * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).\\n       */\\n      onCompleted: function () {\\n        var i, len;\\n        checkDisposed(this);\\n        if (!this.isStopped) {\\n          this.isStopped = true;\\n          var os = cloneArray(this.observers), len = os.length;\\n\\n          if (this.hasValue) {\\n            for (i = 0; i < len; i++) {\\n              var o = os[i];\\n              o.onNext(this.value);\\n              o.onCompleted();\\n            }\\n          } else {\\n            for (i = 0; i < len; i++) {\\n              os[i].onCompleted();\\n            }\\n          }\\n\\n          this.observers.length = 0;\\n        }\\n      },\\n      /**\\n       * Notifies all subscribed observers about the error.\\n       * @param {Mixed} error The Error to send to all observers.\\n       */\\n      onError: function (error) {\\n        checkDisposed(this);\\n        if (!this.isStopped) {\\n          this.isStopped = true;\\n          this.hasError = true;\\n          this.error = error;\\n\\n          for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n            os[i].onError(error);\\n          }\\n\\n          this.observers.length = 0;\\n        }\\n      },\\n      /**\\n       * Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.\\n       * @param {Mixed} value The value to store in the subject.\\n       */\\n      onNext: function (value) {\\n        checkDisposed(this);\\n        if (this.isStopped) { return; }\\n        this.value = value;\\n        this.hasValue = true;\\n      },\\n      /**\\n       * Unsubscribe all observers and release resources.\\n       */\\n      dispose: function () {\\n        this.isDisposed = true;\\n        this.observers = null;\\n        this.error = null;\\n        this.value = null;\\n      }\\n    });\\n\\n    return AsyncSubject;\\n  }(Observable));\\n\\n  /**\\n   *  Represents a value that changes over time.\\n   *  Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.\\n   */\\n  var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {\\n    inherits(BehaviorSubject, __super__);\\n    function BehaviorSubject(value) {\\n      __super__.call(this);\\n      this.value = value;\\n      this.observers = [];\\n      this.isDisposed = false;\\n      this.isStopped = false;\\n      this.hasError = false;\\n    }\\n\\n    addProperties(BehaviorSubject.prototype, Observer.prototype, {\\n      _subscribe: function (o) {\\n        checkDisposed(this);\\n        if (!this.isStopped) {\\n          this.observers.push(o);\\n          o.onNext(this.value);\\n          return new InnerSubscription(this, o);\\n        }\\n        if (this.hasError) {\\n          o.onError(this.error);\\n        } else {\\n          o.onCompleted();\\n        }\\n        return disposableEmpty;\\n      },\\n      /**\\n       * Gets the current value or throws an exception.\\n       * Value is frozen after onCompleted is called.\\n       * After onError is called always throws the specified exception.\\n       * An exception is always thrown after dispose is called.\\n       * @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.\\n       */\\n      getValue: function () {\\n        checkDisposed(this);\\n        if (this.hasError) { thrower(this.error); }\\n        return this.value;\\n      },\\n      /**\\n       * Indicates whether the subject has observers subscribed to it.\\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\\n       */\\n      hasObservers: function () { checkDisposed(this); return this.observers.length > 0; },\\n      /**\\n       * Notifies all subscribed observers about the end of the sequence.\\n       */\\n      onCompleted: function () {\\n        checkDisposed(this);\\n        if (this.isStopped) { return; }\\n        this.isStopped = true;\\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n          os[i].onCompleted();\\n        }\\n\\n        this.observers.length = 0;\\n      },\\n      /**\\n       * Notifies all subscribed observers about the exception.\\n       * @param {Mixed} error The exception to send to all observers.\\n       */\\n      onError: function (error) {\\n        checkDisposed(this);\\n        if (this.isStopped) { return; }\\n        this.isStopped = true;\\n        this.hasError = true;\\n        this.error = error;\\n\\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n          os[i].onError(error);\\n        }\\n\\n        this.observers.length = 0;\\n      },\\n      /**\\n       * Notifies all subscribed observers about the arrival of the specified element in the sequence.\\n       * @param {Mixed} value The value to send to all observers.\\n       */\\n      onNext: function (value) {\\n        checkDisposed(this);\\n        if (this.isStopped) { return; }\\n        this.value = value;\\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n          os[i].onNext(value);\\n        }\\n      },\\n      /**\\n       * Unsubscribe all observers and release resources.\\n       */\\n      dispose: function () {\\n        this.isDisposed = true;\\n        this.observers = null;\\n        this.value = null;\\n        this.error = null;\\n      }\\n    });\\n\\n    return BehaviorSubject;\\n  }(Observable));\\n\\n  /**\\n   * Represents an object that is both an observable sequence as well as an observer.\\n   * Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.\\n   */\\n  var ReplaySubject = Rx.ReplaySubject = (function (__super__) {\\n\\n    var maxSafeInteger = Math.pow(2, 53) - 1;\\n\\n    function createRemovableDisposable(subject, observer) {\\n      return disposableCreate(function () {\\n        observer.dispose();\\n        !subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);\\n      });\\n    }\\n\\n    inherits(ReplaySubject, __super__);\\n\\n    /**\\n     *  Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.\\n     *  @param {Number} [bufferSize] Maximum element count of the replay buffer.\\n     *  @param {Number} [windowSize] Maximum time length of the replay buffer.\\n     *  @param {Scheduler} [scheduler] Scheduler the observers are invoked on.\\n     */\\n    function ReplaySubject(bufferSize, windowSize, scheduler) {\\n      this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize;\\n      this.windowSize = windowSize == null ? maxSafeInteger : windowSize;\\n      this.scheduler = scheduler || currentThreadScheduler;\\n      this.q = [];\\n      this.observers = [];\\n      this.isStopped = false;\\n      this.isDisposed = false;\\n      this.hasError = false;\\n      this.error = null;\\n      __super__.call(this);\\n    }\\n\\n    addProperties(ReplaySubject.prototype, Observer.prototype, {\\n      _subscribe: function (o) {\\n        checkDisposed(this);\\n        var so = new ScheduledObserver(this.scheduler, o), subscription = createRemovableDisposable(this, so);\\n\\n        this._trim(this.scheduler.now());\\n        this.observers.push(so);\\n\\n        for (var i = 0, len = this.q.length; i < len; i++) {\\n          so.onNext(this.q[i].value);\\n        }\\n\\n        if (this.hasError) {\\n          so.onError(this.error);\\n        } else if (this.isStopped) {\\n          so.onCompleted();\\n        }\\n\\n        so.ensureActive();\\n        return subscription;\\n      },\\n      /**\\n       * Indicates whether the subject has observers subscribed to it.\\n       * @returns {Boolean} Indicates whether the subject has observers subscribed to it.\\n       */\\n      hasObservers: function () { checkDisposed(this); return this.observers.length > 0; },\\n      _trim: function (now) {\\n        while (this.q.length > this.bufferSize) {\\n          this.q.shift();\\n        }\\n        while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {\\n          this.q.shift();\\n        }\\n      },\\n      /**\\n       * Notifies all subscribed observers about the arrival of the specified element in the sequence.\\n       * @param {Mixed} value The value to send to all observers.\\n       */\\n      onNext: function (value) {\\n        checkDisposed(this);\\n        if (this.isStopped) { return; }\\n        var now = this.scheduler.now();\\n        this.q.push({ interval: now, value: value });\\n        this._trim(now);\\n\\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n          var observer = os[i];\\n          observer.onNext(value);\\n          observer.ensureActive();\\n        }\\n      },\\n      /**\\n       * Notifies all subscribed observers about the exception.\\n       * @param {Mixed} error The exception to send to all observers.\\n       */\\n      onError: function (error) {\\n        checkDisposed(this);\\n        if (this.isStopped) { return; }\\n        this.isStopped = true;\\n        this.error = error;\\n        this.hasError = true;\\n        var now = this.scheduler.now();\\n        this._trim(now);\\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n          var observer = os[i];\\n          observer.onError(error);\\n          observer.ensureActive();\\n        }\\n        this.observers.length = 0;\\n      },\\n      /**\\n       * Notifies all subscribed observers about the end of the sequence.\\n       */\\n      onCompleted: function () {\\n        checkDisposed(this);\\n        if (this.isStopped) { return; }\\n        this.isStopped = true;\\n        var now = this.scheduler.now();\\n        this._trim(now);\\n        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {\\n          var observer = os[i];\\n          observer.onCompleted();\\n          observer.ensureActive();\\n        }\\n        this.observers.length = 0;\\n      },\\n      /**\\n       * Unsubscribe all observers and release resources.\\n       */\\n      dispose: function () {\\n        this.isDisposed = true;\\n        this.observers = null;\\n      }\\n    });\\n\\n    return ReplaySubject;\\n  }(Observable));\\n\\n  var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {\\n    inherits(AnonymousSubject, __super__);\\n    function AnonymousSubject(observer, observable) {\\n      this.observer = observer;\\n      this.observable = observable;\\n      __super__.call(this);\\n    }\\n\\n    addProperties(AnonymousSubject.prototype, Observer.prototype, {\\n      _subscribe: function (o) {\\n        return this.observable.subscribe(o);\\n      },\\n      onCompleted: function () {\\n        this.observer.onCompleted();\\n      },\\n      onError: function (error) {\\n        this.observer.onError(error);\\n      },\\n      onNext: function (value) {\\n        this.observer.onNext(value);\\n      }\\n    });\\n\\n    return AnonymousSubject;\\n  }(Observable));\\n\\n  /**\\n  * Used to pause and resume streams.\\n  */\\n  Rx.Pauser = (function (__super__) {\\n    inherits(Pauser, __super__);\\n    function Pauser() {\\n      __super__.call(this);\\n    }\\n\\n    /**\\n     * Pauses the underlying sequence.\\n     */\\n    Pauser.prototype.pause = function () { this.onNext(false); };\\n\\n    /**\\n    * Resumes the underlying sequence.\\n    */\\n    Pauser.prototype.resume = function () { this.onNext(true); };\\n\\n    return Pauser;\\n  }(Subject));\\n\\n  if (typeof define == \\'function\\' && typeof define.amd == \\'object\\' && define.amd) {\\n    root.Rx = Rx;\\n\\n    define(function() {\\n      return Rx;\\n    });\\n  } else if (freeExports && freeModule) {\\n    // in Node.js or RingoJS\\n    if (moduleExports) {\\n      (freeModule.exports = Rx).Rx = Rx;\\n    } else {\\n      freeExports.Rx = Rx;\\n    }\\n  } else {\\n    // in a browser or Rhino\\n    root.Rx = Rx;\\n  }\\n\\n  // All code before this point will be filtered from stack traces.\\n  var rEndingLine = captureLine();\\n\\n}.call(this));\\n\\n}).call(this,require(\"/Users/kraftwerk-mb/dev/projects/usco/usco-3mf-parser/node_modules/workerify/node_modules/process/browser.js\"),typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\\n},{\"/Users/kraftwerk-mb/dev/projects/usco/usco-3mf-parser/node_modules/workerify/node_modules/process/browser.js\":49}],46:[function(require,module,exports){\\n(function (Buffer){\\n;(function (sax) { // wrapper for non-node envs\\n  sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }\\n  sax.SAXParser = SAXParser\\n  sax.SAXStream = SAXStream\\n  sax.createStream = createStream\\n\\n  // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.\\n  // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),\\n  // since that\\'s the earliest that a buffer overrun could occur.  This way, checks are\\n  // as rare as required, but as often as necessary to ensure never crossing this bound.\\n  // Furthermore, buffers are only tested at most once per write(), so passing a very\\n  // large string into write() might have undesirable effects, but this is manageable by\\n  // the caller, so it is assumed to be safe.  Thus, a call to write() may, in the extreme\\n  // edge case, result in creating at most one complete copy of the string passed in.\\n  // Set to Infinity to have unlimited buffers.\\n  sax.MAX_BUFFER_LENGTH = 64 * 1024\\n\\n  var buffers = [\\n    \\'comment\\', \\'sgmlDecl\\', \\'textNode\\', \\'tagName\\', \\'doctype\\',\\n    \\'procInstName\\', \\'procInstBody\\', \\'entity\\', \\'attribName\\',\\n    \\'attribValue\\', \\'cdata\\', \\'script\\'\\n  ]\\n\\n  sax.EVENTS = [\\n    \\'text\\',\\n    \\'processinginstruction\\',\\n    \\'sgmldeclaration\\',\\n    \\'doctype\\',\\n    \\'comment\\',\\n    \\'opentagstart\\',\\n    \\'attribute\\',\\n    \\'opentag\\',\\n    \\'closetag\\',\\n    \\'opencdata\\',\\n    \\'cdata\\',\\n    \\'closecdata\\',\\n    \\'error\\',\\n    \\'end\\',\\n    \\'ready\\',\\n    \\'script\\',\\n    \\'opennamespace\\',\\n    \\'closenamespace\\'\\n  ]\\n\\n  function SAXParser (strict, opt) {\\n    if (!(this instanceof SAXParser)) {\\n      return new SAXParser(strict, opt)\\n    }\\n\\n    var parser = this\\n    clearBuffers(parser)\\n    parser.q = parser.c = \\'\\'\\n    parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH\\n    parser.opt = opt || {}\\n    parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags\\n    parser.looseCase = parser.opt.lowercase ? \\'toLowerCase\\' : \\'toUpperCase\\'\\n    parser.tags = []\\n    parser.closed = parser.closedRoot = parser.sawRoot = false\\n    parser.tag = parser.error = null\\n    parser.strict = !!strict\\n    parser.noscript = !!(strict || parser.opt.noscript)\\n    parser.state = S.BEGIN\\n    parser.strictEntities = parser.opt.strictEntities\\n    parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)\\n    parser.attribList = []\\n\\n    // namespaces form a prototype chain.\\n    // it always points at the current tag,\\n    // which protos to its parent tag.\\n    if (parser.opt.xmlns) {\\n      parser.ns = Object.create(rootNS)\\n    }\\n\\n    // mostly just for error reporting\\n    parser.trackPosition = parser.opt.position !== false\\n    if (parser.trackPosition) {\\n      parser.position = parser.line = parser.column = 0\\n    }\\n    emit(parser, \\'onready\\')\\n  }\\n\\n  if (!Object.create) {\\n    Object.create = function (o) {\\n      function F () {}\\n      F.prototype = o\\n      var newf = new F()\\n      return newf\\n    }\\n  }\\n\\n  if (!Object.keys) {\\n    Object.keys = function (o) {\\n      var a = []\\n      for (var i in o) if (o.hasOwnProperty(i)) a.push(i)\\n      return a\\n    }\\n  }\\n\\n  function checkBufferLength (parser) {\\n    var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)\\n    var maxActual = 0\\n    for (var i = 0, l = buffers.length; i < l; i++) {\\n      var len = parser[buffers[i]].length\\n      if (len > maxAllowed) {\\n        // Text/cdata nodes can get big, and since they\\'re buffered,\\n        // we can get here under normal conditions.\\n        // Avoid issues by emitting the text node now,\\n        // so at least it won\\'t get any bigger.\\n        switch (buffers[i]) {\\n          case \\'textNode\\':\\n            closeText(parser)\\n            break\\n\\n          case \\'cdata\\':\\n            emitNode(parser, \\'oncdata\\', parser.cdata)\\n            parser.cdata = \\'\\'\\n            break\\n\\n          case \\'script\\':\\n            emitNode(parser, \\'onscript\\', parser.script)\\n            parser.script = \\'\\'\\n            break\\n\\n          default:\\n            error(parser, \\'Max buffer length exceeded: \\' + buffers[i])\\n        }\\n      }\\n      maxActual = Math.max(maxActual, len)\\n    }\\n    // schedule the next check for the earliest possible buffer overrun.\\n    var m = sax.MAX_BUFFER_LENGTH - maxActual\\n    parser.bufferCheckPosition = m + parser.position\\n  }\\n\\n  function clearBuffers (parser) {\\n    for (var i = 0, l = buffers.length; i < l; i++) {\\n      parser[buffers[i]] = \\'\\'\\n    }\\n  }\\n\\n  function flushBuffers (parser) {\\n    closeText(parser)\\n    if (parser.cdata !== \\'\\') {\\n      emitNode(parser, \\'oncdata\\', parser.cdata)\\n      parser.cdata = \\'\\'\\n    }\\n    if (parser.script !== \\'\\') {\\n      emitNode(parser, \\'onscript\\', parser.script)\\n      parser.script = \\'\\'\\n    }\\n  }\\n\\n  SAXParser.prototype = {\\n    end: function () { end(this) },\\n    write: write,\\n    resume: function () { this.error = null; return this },\\n    close: function () { return this.write(null) },\\n    flush: function () { flushBuffers(this) }\\n  }\\n\\n  var Stream\\n  try {\\n    Stream = require(\\'stream\\').Stream\\n  } catch (ex) {\\n    Stream = function () {}\\n  }\\n\\n  var streamWraps = sax.EVENTS.filter(function (ev) {\\n    return ev !== \\'error\\' && ev !== \\'end\\'\\n  })\\n\\n  function createStream (strict, opt) {\\n    return new SAXStream(strict, opt)\\n  }\\n\\n  function SAXStream (strict, opt) {\\n    if (!(this instanceof SAXStream)) {\\n      return new SAXStream(strict, opt)\\n    }\\n\\n    Stream.apply(this)\\n\\n    this._parser = new SAXParser(strict, opt)\\n    this.writable = true\\n    this.readable = true\\n\\n    var me = this\\n\\n    this._parser.onend = function () {\\n      me.emit(\\'end\\')\\n    }\\n\\n    this._parser.onerror = function (er) {\\n      me.emit(\\'error\\', er)\\n\\n      // if didn\\'t throw, then means error was handled.\\n      // go ahead and clear error, so we can write again.\\n      me._parser.error = null\\n    }\\n\\n    this._decoder = null\\n\\n    streamWraps.forEach(function (ev) {\\n      Object.defineProperty(me, \\'on\\' + ev, {\\n        get: function () {\\n          return me._parser[\\'on\\' + ev]\\n        },\\n        set: function (h) {\\n          if (!h) {\\n            me.removeAllListeners(ev)\\n            me._parser[\\'on\\' + ev] = h\\n            return h\\n          }\\n          me.on(ev, h)\\n        },\\n        enumerable: true,\\n        configurable: false\\n      })\\n    })\\n  }\\n\\n  SAXStream.prototype = Object.create(Stream.prototype, {\\n    constructor: {\\n      value: SAXStream\\n    }\\n  })\\n\\n  SAXStream.prototype.write = function (data) {\\n    if (typeof Buffer === \\'function\\' &&\\n      typeof Buffer.isBuffer === \\'function\\' &&\\n      Buffer.isBuffer(data)) {\\n      if (!this._decoder) {\\n        var SD = require(\\'string_decoder\\').StringDecoder\\n        this._decoder = new SD(\\'utf8\\')\\n      }\\n      data = this._decoder.write(data)\\n    }\\n\\n    this._parser.write(data.toString())\\n    this.emit(\\'data\\', data)\\n    return true\\n  }\\n\\n  SAXStream.prototype.end = function (chunk) {\\n    if (chunk && chunk.length) {\\n      this.write(chunk)\\n    }\\n    this._parser.end()\\n    return true\\n  }\\n\\n  SAXStream.prototype.on = function (ev, handler) {\\n    var me = this\\n    if (!me._parser[\\'on\\' + ev] && streamWraps.indexOf(ev) !== -1) {\\n      me._parser[\\'on\\' + ev] = function () {\\n        var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)\\n        args.splice(0, 0, ev)\\n        me.emit.apply(me, args)\\n      }\\n    }\\n\\n    return Stream.prototype.on.call(me, ev, handler)\\n  }\\n\\n  // character classes and tokens\\n  var whitespace = \\'\\\\r\\\\n\\\\t \\'\\n\\n  // this really needs to be replaced with character classes.\\n  // XML allows all manner of ridiculous numbers and digits.\\n  var number = \\'0124356789\\'\\n  var letter = \\'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\'\\n\\n  // (Letter | \"_\" | \":\")\\n  var quote = \\'\\\\\\'\"\\'\\n  var attribEnd = whitespace + \\'>\\'\\n  var CDATA = \\'[CDATA[\\'\\n  var DOCTYPE = \\'DOCTYPE\\'\\n  var XML_NAMESPACE = \\'http://www.w3.org/XML/1998/namespace\\'\\n  var XMLNS_NAMESPACE = \\'http://www.w3.org/2000/xmlns/\\'\\n  var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }\\n\\n  // turn all the string character sets into character class objects.\\n  whitespace = charClass(whitespace)\\n  number = charClass(number)\\n  letter = charClass(letter)\\n\\n  // http://www.w3.org/TR/REC-xml/#NT-NameStartChar\\n  // This implementation works on strings, a single character at a time\\n  // as such, it cannot ever support astral-plane characters (10000-EFFFF)\\n  // without a significant breaking change to either this  parser, or the\\n  // JavaScript language.  Implementation of an emoji-capable xml parser\\n  // is left as an exercise for the reader.\\n  var nameStart = /[:_A-Za-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD]/\\n\\n  var nameBody = /[:_A-Za-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040\\\\.\\\\d-]/\\n\\n  var entityStart = /[#:_A-Za-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD]/\\n  var entityBody = /[#:_A-Za-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040\\\\.\\\\d-]/\\n\\n  quote = charClass(quote)\\n  attribEnd = charClass(attribEnd)\\n\\n  function charClass (str) {\\n    return str.split(\\'\\').reduce(function (s, c) {\\n      s[c] = true\\n      return s\\n    }, {})\\n  }\\n\\n  function isRegExp (c) {\\n    return Object.prototype.toString.call(c) === \\'[object RegExp]\\'\\n  }\\n\\n  function is (charclass, c) {\\n    return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]\\n  }\\n\\n  function not (charclass, c) {\\n    return !is(charclass, c)\\n  }\\n\\n  var S = 0\\n  sax.STATE = {\\n    BEGIN: S++, // leading byte order mark or whitespace\\n    BEGIN_WHITESPACE: S++, // leading whitespace\\n    TEXT: S++, // general stuff\\n    TEXT_ENTITY: S++, // &amp and such.\\n    OPEN_WAKA: S++, // <\\n    SGML_DECL: S++, // <!BLARG\\n    SGML_DECL_QUOTED: S++, // <!BLARG foo \"bar\\n    DOCTYPE: S++, // <!DOCTYPE\\n    DOCTYPE_QUOTED: S++, // <!DOCTYPE \"//blah\\n    DOCTYPE_DTD: S++, // <!DOCTYPE \"//blah\" [ ...\\n    DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE \"//blah\" [ \"foo\\n    COMMENT_STARTING: S++, // <!-\\n    COMMENT: S++, // <!--\\n    COMMENT_ENDING: S++, // <!-- blah -\\n    COMMENT_ENDED: S++, // <!-- blah --\\n    CDATA: S++, // <![CDATA[ something\\n    CDATA_ENDING: S++, // ]\\n    CDATA_ENDING_2: S++, // ]]\\n    PROC_INST: S++, // <?hi\\n    PROC_INST_BODY: S++, // <?hi there\\n    PROC_INST_ENDING: S++, // <?hi \"there\" ?\\n    OPEN_TAG: S++, // <strong\\n    OPEN_TAG_SLASH: S++, // <strong /\\n    ATTRIB: S++, // <a\\n    ATTRIB_NAME: S++, // <a foo\\n    ATTRIB_NAME_SAW_WHITE: S++, // <a foo _\\n    ATTRIB_VALUE: S++, // <a foo=\\n    ATTRIB_VALUE_QUOTED: S++, // <a foo=\"bar\\n    ATTRIB_VALUE_CLOSED: S++, // <a foo=\"bar\"\\n    ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar\\n    ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar=\"&quot;\"\\n    ATTRIB_VALUE_ENTITY_U: S++, // <foo bar=&quot\\n    CLOSE_TAG: S++, // </a\\n    CLOSE_TAG_SAW_WHITE: S++, // </a   >\\n    SCRIPT: S++, // <script> ...\\n    SCRIPT_ENDING: S++ // <script> ... <\\n  }\\n\\n  sax.XML_ENTITIES = {\\n    \\'amp\\': \\'&\\',\\n    \\'gt\\': \\'>\\',\\n    \\'lt\\': \\'<\\',\\n    \\'quot\\': \\'\"\\',\\n    \\'apos\\': \"\\'\"\\n  }\\n\\n  sax.ENTITIES = {\\n    \\'amp\\': \\'&\\',\\n    \\'gt\\': \\'>\\',\\n    \\'lt\\': \\'<\\',\\n    \\'quot\\': \\'\"\\',\\n    \\'apos\\': \"\\'\",\\n    \\'AElig\\': 198,\\n    \\'Aacute\\': 193,\\n    \\'Acirc\\': 194,\\n    \\'Agrave\\': 192,\\n    \\'Aring\\': 197,\\n    \\'Atilde\\': 195,\\n    \\'Auml\\': 196,\\n    \\'Ccedil\\': 199,\\n    \\'ETH\\': 208,\\n    \\'Eacute\\': 201,\\n    \\'Ecirc\\': 202,\\n    \\'Egrave\\': 200,\\n    \\'Euml\\': 203,\\n    \\'Iacute\\': 205,\\n    \\'Icirc\\': 206,\\n    \\'Igrave\\': 204,\\n    \\'Iuml\\': 207,\\n    \\'Ntilde\\': 209,\\n    \\'Oacute\\': 211,\\n    \\'Ocirc\\': 212,\\n    \\'Ograve\\': 210,\\n    \\'Oslash\\': 216,\\n    \\'Otilde\\': 213,\\n    \\'Ouml\\': 214,\\n    \\'THORN\\': 222,\\n    \\'Uacute\\': 218,\\n    \\'Ucirc\\': 219,\\n    \\'Ugrave\\': 217,\\n    \\'Uuml\\': 220,\\n    \\'Yacute\\': 221,\\n    \\'aacute\\': 225,\\n    \\'acirc\\': 226,\\n    \\'aelig\\': 230,\\n    \\'agrave\\': 224,\\n    \\'aring\\': 229,\\n    \\'atilde\\': 227,\\n    \\'auml\\': 228,\\n    \\'ccedil\\': 231,\\n    \\'eacute\\': 233,\\n    \\'ecirc\\': 234,\\n    \\'egrave\\': 232,\\n    \\'eth\\': 240,\\n    \\'euml\\': 235,\\n    \\'iacute\\': 237,\\n    \\'icirc\\': 238,\\n    \\'igrave\\': 236,\\n    \\'iuml\\': 239,\\n    \\'ntilde\\': 241,\\n    \\'oacute\\': 243,\\n    \\'ocirc\\': 244,\\n    \\'ograve\\': 242,\\n    \\'oslash\\': 248,\\n    \\'otilde\\': 245,\\n    \\'ouml\\': 246,\\n    \\'szlig\\': 223,\\n    \\'thorn\\': 254,\\n    \\'uacute\\': 250,\\n    \\'ucirc\\': 251,\\n    \\'ugrave\\': 249,\\n    \\'uuml\\': 252,\\n    \\'yacute\\': 253,\\n    \\'yuml\\': 255,\\n    \\'copy\\': 169,\\n    \\'reg\\': 174,\\n    \\'nbsp\\': 160,\\n    \\'iexcl\\': 161,\\n    \\'cent\\': 162,\\n    \\'pound\\': 163,\\n    \\'curren\\': 164,\\n    \\'yen\\': 165,\\n    \\'brvbar\\': 166,\\n    \\'sect\\': 167,\\n    \\'uml\\': 168,\\n    \\'ordf\\': 170,\\n    \\'laquo\\': 171,\\n    \\'not\\': 172,\\n    \\'shy\\': 173,\\n    \\'macr\\': 175,\\n    \\'deg\\': 176,\\n    \\'plusmn\\': 177,\\n    \\'sup1\\': 185,\\n    \\'sup2\\': 178,\\n    \\'sup3\\': 179,\\n    \\'acute\\': 180,\\n    \\'micro\\': 181,\\n    \\'para\\': 182,\\n    \\'middot\\': 183,\\n    \\'cedil\\': 184,\\n    \\'ordm\\': 186,\\n    \\'raquo\\': 187,\\n    \\'frac14\\': 188,\\n    \\'frac12\\': 189,\\n    \\'frac34\\': 190,\\n    \\'iquest\\': 191,\\n    \\'times\\': 215,\\n    \\'divide\\': 247,\\n    \\'OElig\\': 338,\\n    \\'oelig\\': 339,\\n    \\'Scaron\\': 352,\\n    \\'scaron\\': 353,\\n    \\'Yuml\\': 376,\\n    \\'fnof\\': 402,\\n    \\'circ\\': 710,\\n    \\'tilde\\': 732,\\n    \\'Alpha\\': 913,\\n    \\'Beta\\': 914,\\n    \\'Gamma\\': 915,\\n    \\'Delta\\': 916,\\n    \\'Epsilon\\': 917,\\n    \\'Zeta\\': 918,\\n    \\'Eta\\': 919,\\n    \\'Theta\\': 920,\\n    \\'Iota\\': 921,\\n    \\'Kappa\\': 922,\\n    \\'Lambda\\': 923,\\n    \\'Mu\\': 924,\\n    \\'Nu\\': 925,\\n    \\'Xi\\': 926,\\n    \\'Omicron\\': 927,\\n    \\'Pi\\': 928,\\n    \\'Rho\\': 929,\\n    \\'Sigma\\': 931,\\n    \\'Tau\\': 932,\\n    \\'Upsilon\\': 933,\\n    \\'Phi\\': 934,\\n    \\'Chi\\': 935,\\n    \\'Psi\\': 936,\\n    \\'Omega\\': 937,\\n    \\'alpha\\': 945,\\n    \\'beta\\': 946,\\n    \\'gamma\\': 947,\\n    \\'delta\\': 948,\\n    \\'epsilon\\': 949,\\n    \\'zeta\\': 950,\\n    \\'eta\\': 951,\\n    \\'theta\\': 952,\\n    \\'iota\\': 953,\\n    \\'kappa\\': 954,\\n    \\'lambda\\': 955,\\n    \\'mu\\': 956,\\n    \\'nu\\': 957,\\n    \\'xi\\': 958,\\n    \\'omicron\\': 959,\\n    \\'pi\\': 960,\\n    \\'rho\\': 961,\\n    \\'sigmaf\\': 962,\\n    \\'sigma\\': 963,\\n    \\'tau\\': 964,\\n    \\'upsilon\\': 965,\\n    \\'phi\\': 966,\\n    \\'chi\\': 967,\\n    \\'psi\\': 968,\\n    \\'omega\\': 969,\\n    \\'thetasym\\': 977,\\n    \\'upsih\\': 978,\\n    \\'piv\\': 982,\\n    \\'ensp\\': 8194,\\n    \\'emsp\\': 8195,\\n    \\'thinsp\\': 8201,\\n    \\'zwnj\\': 8204,\\n    \\'zwj\\': 8205,\\n    \\'lrm\\': 8206,\\n    \\'rlm\\': 8207,\\n    \\'ndash\\': 8211,\\n    \\'mdash\\': 8212,\\n    \\'lsquo\\': 8216,\\n    \\'rsquo\\': 8217,\\n    \\'sbquo\\': 8218,\\n    \\'ldquo\\': 8220,\\n    \\'rdquo\\': 8221,\\n    \\'bdquo\\': 8222,\\n    \\'dagger\\': 8224,\\n    \\'Dagger\\': 8225,\\n    \\'bull\\': 8226,\\n    \\'hellip\\': 8230,\\n    \\'permil\\': 8240,\\n    \\'prime\\': 8242,\\n    \\'Prime\\': 8243,\\n    \\'lsaquo\\': 8249,\\n    \\'rsaquo\\': 8250,\\n    \\'oline\\': 8254,\\n    \\'frasl\\': 8260,\\n    \\'euro\\': 8364,\\n    \\'image\\': 8465,\\n    \\'weierp\\': 8472,\\n    \\'real\\': 8476,\\n    \\'trade\\': 8482,\\n    \\'alefsym\\': 8501,\\n    \\'larr\\': 8592,\\n    \\'uarr\\': 8593,\\n    \\'rarr\\': 8594,\\n    \\'darr\\': 8595,\\n    \\'harr\\': 8596,\\n    \\'crarr\\': 8629,\\n    \\'lArr\\': 8656,\\n    \\'uArr\\': 8657,\\n    \\'rArr\\': 8658,\\n    \\'dArr\\': 8659,\\n    \\'hArr\\': 8660,\\n    \\'forall\\': 8704,\\n    \\'part\\': 8706,\\n    \\'exist\\': 8707,\\n    \\'empty\\': 8709,\\n    \\'nabla\\': 8711,\\n    \\'isin\\': 8712,\\n    \\'notin\\': 8713,\\n    \\'ni\\': 8715,\\n    \\'prod\\': 8719,\\n    \\'sum\\': 8721,\\n    \\'minus\\': 8722,\\n    \\'lowast\\': 8727,\\n    \\'radic\\': 8730,\\n    \\'prop\\': 8733,\\n    \\'infin\\': 8734,\\n    \\'ang\\': 8736,\\n    \\'and\\': 8743,\\n    \\'or\\': 8744,\\n    \\'cap\\': 8745,\\n    \\'cup\\': 8746,\\n    \\'int\\': 8747,\\n    \\'there4\\': 8756,\\n    \\'sim\\': 8764,\\n    \\'cong\\': 8773,\\n    \\'asymp\\': 8776,\\n    \\'ne\\': 8800,\\n    \\'equiv\\': 8801,\\n    \\'le\\': 8804,\\n    \\'ge\\': 8805,\\n    \\'sub\\': 8834,\\n    \\'sup\\': 8835,\\n    \\'nsub\\': 8836,\\n    \\'sube\\': 8838,\\n    \\'supe\\': 8839,\\n    \\'oplus\\': 8853,\\n    \\'otimes\\': 8855,\\n    \\'perp\\': 8869,\\n    \\'sdot\\': 8901,\\n    \\'lceil\\': 8968,\\n    \\'rceil\\': 8969,\\n    \\'lfloor\\': 8970,\\n    \\'rfloor\\': 8971,\\n    \\'lang\\': 9001,\\n    \\'rang\\': 9002,\\n    \\'loz\\': 9674,\\n    \\'spades\\': 9824,\\n    \\'clubs\\': 9827,\\n    \\'hearts\\': 9829,\\n    \\'diams\\': 9830\\n  }\\n\\n  Object.keys(sax.ENTITIES).forEach(function (key) {\\n    var e = sax.ENTITIES[key]\\n    var s = typeof e === \\'number\\' ? String.fromCharCode(e) : e\\n    sax.ENTITIES[key] = s\\n  })\\n\\n  for (var s in sax.STATE) {\\n    sax.STATE[sax.STATE[s]] = s\\n  }\\n\\n  // shorthand\\n  S = sax.STATE\\n\\n  function emit (parser, event, data) {\\n    parser[event] && parser[event](data)\\n  }\\n\\n  function emitNode (parser, nodeType, data) {\\n    if (parser.textNode) closeText(parser)\\n    emit(parser, nodeType, data)\\n  }\\n\\n  function closeText (parser) {\\n    parser.textNode = textopts(parser.opt, parser.textNode)\\n    if (parser.textNode) emit(parser, \\'ontext\\', parser.textNode)\\n    parser.textNode = \\'\\'\\n  }\\n\\n  function textopts (opt, text) {\\n    if (opt.trim) text = text.trim()\\n    if (opt.normalize) text = text.replace(/\\\\s+/g, \\' \\')\\n    return text\\n  }\\n\\n  function error (parser, er) {\\n    closeText(parser)\\n    if (parser.trackPosition) {\\n      er += \\'\\\\nLine: \\' + parser.line +\\n        \\'\\\\nColumn: \\' + parser.column +\\n        \\'\\\\nChar: \\' + parser.c\\n    }\\n    er = new Error(er)\\n    parser.error = er\\n    emit(parser, \\'onerror\\', er)\\n    return parser\\n  }\\n\\n  function end (parser) {\\n    if (parser.sawRoot && !parser.closedRoot) strictFail(parser, \\'Unclosed root tag\\')\\n    if ((parser.state !== S.BEGIN) &&\\n      (parser.state !== S.BEGIN_WHITESPACE) &&\\n      (parser.state !== S.TEXT)) {\\n      error(parser, \\'Unexpected end\\')\\n    }\\n    closeText(parser)\\n    parser.c = \\'\\'\\n    parser.closed = true\\n    emit(parser, \\'onend\\')\\n    SAXParser.call(parser, parser.strict, parser.opt)\\n    return parser\\n  }\\n\\n  function strictFail (parser, message) {\\n    if (typeof parser !== \\'object\\' || !(parser instanceof SAXParser)) {\\n      throw new Error(\\'bad call to strictFail\\')\\n    }\\n    if (parser.strict) {\\n      error(parser, message)\\n    }\\n  }\\n\\n  function newTag (parser) {\\n    if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()\\n    var parent = parser.tags[parser.tags.length - 1] || parser\\n    var tag = parser.tag = { name: parser.tagName, attributes: {} }\\n\\n    // will be overridden if tag contails an xmlns=\"foo\" or xmlns:foo=\"bar\"\\n    if (parser.opt.xmlns) {\\n      tag.ns = parent.ns\\n    }\\n    parser.attribList.length = 0\\n    emitNode(parser, \\'onopentagstart\\', tag)\\n  }\\n\\n  function qname (name, attribute) {\\n    var i = name.indexOf(\\':\\')\\n    var qualName = i < 0 ? [ \\'\\', name ] : name.split(\\':\\')\\n    var prefix = qualName[0]\\n    var local = qualName[1]\\n\\n    // <x \"xmlns\"=\"http://foo\">\\n    if (attribute && name === \\'xmlns\\') {\\n      prefix = \\'xmlns\\'\\n      local = \\'\\'\\n    }\\n\\n    return { prefix: prefix, local: local }\\n  }\\n\\n  function attrib (parser) {\\n    if (!parser.strict) {\\n      parser.attribName = parser.attribName[parser.looseCase]()\\n    }\\n\\n    if (parser.attribList.indexOf(parser.attribName) !== -1 ||\\n      parser.tag.attributes.hasOwnProperty(parser.attribName)) {\\n      parser.attribName = parser.attribValue = \\'\\'\\n      return\\n    }\\n\\n    if (parser.opt.xmlns) {\\n      var qn = qname(parser.attribName, true)\\n      var prefix = qn.prefix\\n      var local = qn.local\\n\\n      if (prefix === \\'xmlns\\') {\\n        // namespace binding attribute. push the binding into scope\\n        if (local === \\'xml\\' && parser.attribValue !== XML_NAMESPACE) {\\n          strictFail(parser,\\n            \\'xml: prefix must be bound to \\' + XML_NAMESPACE + \\'\\\\n\\' +\\n            \\'Actual: \\' + parser.attribValue)\\n        } else if (local === \\'xmlns\\' && parser.attribValue !== XMLNS_NAMESPACE) {\\n          strictFail(parser,\\n            \\'xmlns: prefix must be bound to \\' + XMLNS_NAMESPACE + \\'\\\\n\\' +\\n            \\'Actual: \\' + parser.attribValue)\\n        } else {\\n          var tag = parser.tag\\n          var parent = parser.tags[parser.tags.length - 1] || parser\\n          if (tag.ns === parent.ns) {\\n            tag.ns = Object.create(parent.ns)\\n          }\\n          tag.ns[local] = parser.attribValue\\n        }\\n      }\\n\\n      // defer onattribute events until all attributes have been seen\\n      // so any new bindings can take effect. preserve attribute order\\n      // so deferred events can be emitted in document order\\n      parser.attribList.push([parser.attribName, parser.attribValue])\\n    } else {\\n      // in non-xmlns mode, we can emit the event right away\\n      parser.tag.attributes[parser.attribName] = parser.attribValue\\n      emitNode(parser, \\'onattribute\\', {\\n        name: parser.attribName,\\n        value: parser.attribValue\\n      })\\n    }\\n\\n    parser.attribName = parser.attribValue = \\'\\'\\n  }\\n\\n  function openTag (parser, selfClosing) {\\n    if (parser.opt.xmlns) {\\n      // emit namespace binding events\\n      var tag = parser.tag\\n\\n      // add namespace info to tag\\n      var qn = qname(parser.tagName)\\n      tag.prefix = qn.prefix\\n      tag.local = qn.local\\n      tag.uri = tag.ns[qn.prefix] || \\'\\'\\n\\n      if (tag.prefix && !tag.uri) {\\n        strictFail(parser, \\'Unbound namespace prefix: \\' +\\n          JSON.stringify(parser.tagName))\\n        tag.uri = qn.prefix\\n      }\\n\\n      var parent = parser.tags[parser.tags.length - 1] || parser\\n      if (tag.ns && parent.ns !== tag.ns) {\\n        Object.keys(tag.ns).forEach(function (p) {\\n          emitNode(parser, \\'onopennamespace\\', {\\n            prefix: p,\\n            uri: tag.ns[p]\\n          })\\n        })\\n      }\\n\\n      // handle deferred onattribute events\\n      // Note: do not apply default ns to attributes:\\n      //   http://www.w3.org/TR/REC-xml-names/#defaulting\\n      for (var i = 0, l = parser.attribList.length; i < l; i++) {\\n        var nv = parser.attribList[i]\\n        var name = nv[0]\\n        var value = nv[1]\\n        var qualName = qname(name, true)\\n        var prefix = qualName.prefix\\n        var local = qualName.local\\n        var uri = prefix === \\'\\' ? \\'\\' : (tag.ns[prefix] || \\'\\')\\n        var a = {\\n          name: name,\\n          value: value,\\n          prefix: prefix,\\n          local: local,\\n          uri: uri\\n        }\\n\\n        // if there\\'s any attributes with an undefined namespace,\\n        // then fail on them now.\\n        if (prefix && prefix !== \\'xmlns\\' && !uri) {\\n          strictFail(parser, \\'Unbound namespace prefix: \\' +\\n            JSON.stringify(prefix))\\n          a.uri = prefix\\n        }\\n        parser.tag.attributes[name] = a\\n        emitNode(parser, \\'onattribute\\', a)\\n      }\\n      parser.attribList.length = 0\\n    }\\n\\n    parser.tag.isSelfClosing = !!selfClosing\\n\\n    // process the tag\\n    parser.sawRoot = true\\n    parser.tags.push(parser.tag)\\n    emitNode(parser, \\'onopentag\\', parser.tag)\\n    if (!selfClosing) {\\n      // special case for <script> in non-strict mode.\\n      if (!parser.noscript && parser.tagName.toLowerCase() === \\'script\\') {\\n        parser.state = S.SCRIPT\\n      } else {\\n        parser.state = S.TEXT\\n      }\\n      parser.tag = null\\n      parser.tagName = \\'\\'\\n    }\\n    parser.attribName = parser.attribValue = \\'\\'\\n    parser.attribList.length = 0\\n  }\\n\\n  function closeTag (parser) {\\n    if (!parser.tagName) {\\n      strictFail(parser, \\'Weird empty close tag.\\')\\n      parser.textNode += \\'</>\\'\\n      parser.state = S.TEXT\\n      return\\n    }\\n\\n    if (parser.script) {\\n      if (parser.tagName !== \\'script\\') {\\n        parser.script += \\'</\\' + parser.tagName + \\'>\\'\\n        parser.tagName = \\'\\'\\n        parser.state = S.SCRIPT\\n        return\\n      }\\n      emitNode(parser, \\'onscript\\', parser.script)\\n      parser.script = \\'\\'\\n    }\\n\\n    // first make sure that the closing tag actually exists.\\n    // <a><b></c></b></a> will close everything, otherwise.\\n    var t = parser.tags.length\\n    var tagName = parser.tagName\\n    if (!parser.strict) {\\n      tagName = tagName[parser.looseCase]()\\n    }\\n    var closeTo = tagName\\n    while (t--) {\\n      var close = parser.tags[t]\\n      if (close.name !== closeTo) {\\n        // fail the first time in strict mode\\n        strictFail(parser, \\'Unexpected close tag\\')\\n      } else {\\n        break\\n      }\\n    }\\n\\n    // didn\\'t find it.  we already failed for strict, so just abort.\\n    if (t < 0) {\\n      strictFail(parser, \\'Unmatched closing tag: \\' + parser.tagName)\\n      parser.textNode += \\'</\\' + parser.tagName + \\'>\\'\\n      parser.state = S.TEXT\\n      return\\n    }\\n    parser.tagName = tagName\\n    var s = parser.tags.length\\n    while (s-- > t) {\\n      var tag = parser.tag = parser.tags.pop()\\n      parser.tagName = parser.tag.name\\n      emitNode(parser, \\'onclosetag\\', parser.tagName)\\n\\n      var x = {}\\n      for (var i in tag.ns) {\\n        x[i] = tag.ns[i]\\n      }\\n\\n      var parent = parser.tags[parser.tags.length - 1] || parser\\n      if (parser.opt.xmlns && tag.ns !== parent.ns) {\\n        // remove namespace bindings introduced by tag\\n        Object.keys(tag.ns).forEach(function (p) {\\n          var n = tag.ns[p]\\n          emitNode(parser, \\'onclosenamespace\\', { prefix: p, uri: n })\\n        })\\n      }\\n    }\\n    if (t === 0) parser.closedRoot = true\\n    parser.tagName = parser.attribValue = parser.attribName = \\'\\'\\n    parser.attribList.length = 0\\n    parser.state = S.TEXT\\n  }\\n\\n  function parseEntity (parser) {\\n    var entity = parser.entity\\n    var entityLC = entity.toLowerCase()\\n    var num\\n    var numStr = \\'\\'\\n\\n    if (parser.ENTITIES[entity]) {\\n      return parser.ENTITIES[entity]\\n    }\\n    if (parser.ENTITIES[entityLC]) {\\n      return parser.ENTITIES[entityLC]\\n    }\\n    entity = entityLC\\n    if (entity.charAt(0) === \\'#\\') {\\n      if (entity.charAt(1) === \\'x\\') {\\n        entity = entity.slice(2)\\n        num = parseInt(entity, 16)\\n        numStr = num.toString(16)\\n      } else {\\n        entity = entity.slice(1)\\n        num = parseInt(entity, 10)\\n        numStr = num.toString(10)\\n      }\\n    }\\n    entity = entity.replace(/^0+/, \\'\\')\\n    if (numStr.toLowerCase() !== entity) {\\n      strictFail(parser, \\'Invalid character entity\\')\\n      return \\'&\\' + parser.entity + \\';\\'\\n    }\\n\\n    return String.fromCodePoint(num)\\n  }\\n\\n  function beginWhiteSpace (parser, c) {\\n    if (c === \\'<\\') {\\n      parser.state = S.OPEN_WAKA\\n      parser.startTagPosition = parser.position\\n    } else if (not(whitespace, c)) {\\n      // have to process this as a text node.\\n      // weird, but happens.\\n      strictFail(parser, \\'Non-whitespace before first tag.\\')\\n      parser.textNode = c\\n      parser.state = S.TEXT\\n    }\\n  }\\n\\n  function charAt (chunk, i) {\\n    var result = \\'\\'\\n    if (i < chunk.length) {\\n      result = chunk.charAt(i)\\n    }\\n    return result\\n  }\\n\\n  function write (chunk) {\\n    var parser = this\\n    if (this.error) {\\n      throw this.error\\n    }\\n    if (parser.closed) {\\n      return error(parser,\\n        \\'Cannot write after close. Assign an onready handler.\\')\\n    }\\n    if (chunk === null) {\\n      return end(parser)\\n    }\\n    if (typeof chunk === \\'object\\') {\\n      chunk = chunk.toString()\\n    }\\n    var i = 0\\n    var c = \\'\\'\\n    while (true) {\\n      c = charAt(chunk, i++)\\n      parser.c = c\\n      if (!c) {\\n        break\\n      }\\n      if (parser.trackPosition) {\\n        parser.position++\\n        if (c === \\'\\\\n\\') {\\n          parser.line++\\n          parser.column = 0\\n        } else {\\n          parser.column++\\n        }\\n      }\\n      switch (parser.state) {\\n        case S.BEGIN:\\n          parser.state = S.BEGIN_WHITESPACE\\n          if (c === \\'\\\\uFEFF\\') {\\n            continue\\n          }\\n          beginWhiteSpace(parser, c)\\n          continue\\n\\n        case S.BEGIN_WHITESPACE:\\n          beginWhiteSpace(parser, c)\\n          continue\\n\\n        case S.TEXT:\\n          if (parser.sawRoot && !parser.closedRoot) {\\n            var starti = i - 1\\n            while (c && c !== \\'<\\' && c !== \\'&\\') {\\n              c = charAt(chunk, i++)\\n              if (c && parser.trackPosition) {\\n                parser.position++\\n                if (c === \\'\\\\n\\') {\\n                  parser.line++\\n                  parser.column = 0\\n                } else {\\n                  parser.column++\\n                }\\n              }\\n            }\\n            parser.textNode += chunk.substring(starti, i - 1)\\n          }\\n          if (c === \\'<\\' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {\\n            parser.state = S.OPEN_WAKA\\n            parser.startTagPosition = parser.position\\n          } else {\\n            if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot)) {\\n              strictFail(parser, \\'Text data outside of root node.\\')\\n            }\\n            if (c === \\'&\\') {\\n              parser.state = S.TEXT_ENTITY\\n            } else {\\n              parser.textNode += c\\n            }\\n          }\\n          continue\\n\\n        case S.SCRIPT:\\n          // only non-strict\\n          if (c === \\'<\\') {\\n            parser.state = S.SCRIPT_ENDING\\n          } else {\\n            parser.script += c\\n          }\\n          continue\\n\\n        case S.SCRIPT_ENDING:\\n          if (c === \\'/\\') {\\n            parser.state = S.CLOSE_TAG\\n          } else {\\n            parser.script += \\'<\\' + c\\n            parser.state = S.SCRIPT\\n          }\\n          continue\\n\\n        case S.OPEN_WAKA:\\n          // either a /, ?, !, or text is coming next.\\n          if (c === \\'!\\') {\\n            parser.state = S.SGML_DECL\\n            parser.sgmlDecl = \\'\\'\\n          } else if (is(whitespace, c)) {\\n            // wait for it...\\n          } else if (is(nameStart, c)) {\\n            parser.state = S.OPEN_TAG\\n            parser.tagName = c\\n          } else if (c === \\'/\\') {\\n            parser.state = S.CLOSE_TAG\\n            parser.tagName = \\'\\'\\n          } else if (c === \\'?\\') {\\n            parser.state = S.PROC_INST\\n            parser.procInstName = parser.procInstBody = \\'\\'\\n          } else {\\n            strictFail(parser, \\'Unencoded <\\')\\n            // if there was some whitespace, then add that in.\\n            if (parser.startTagPosition + 1 < parser.position) {\\n              var pad = parser.position - parser.startTagPosition\\n              c = new Array(pad).join(\\' \\') + c\\n            }\\n            parser.textNode += \\'<\\' + c\\n            parser.state = S.TEXT\\n          }\\n          continue\\n\\n        case S.SGML_DECL:\\n          if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {\\n            emitNode(parser, \\'onopencdata\\')\\n            parser.state = S.CDATA\\n            parser.sgmlDecl = \\'\\'\\n            parser.cdata = \\'\\'\\n          } else if (parser.sgmlDecl + c === \\'--\\') {\\n            parser.state = S.COMMENT\\n            parser.comment = \\'\\'\\n            parser.sgmlDecl = \\'\\'\\n          } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {\\n            parser.state = S.DOCTYPE\\n            if (parser.doctype || parser.sawRoot) {\\n              strictFail(parser,\\n                \\'Inappropriately located doctype declaration\\')\\n            }\\n            parser.doctype = \\'\\'\\n            parser.sgmlDecl = \\'\\'\\n          } else if (c === \\'>\\') {\\n            emitNode(parser, \\'onsgmldeclaration\\', parser.sgmlDecl)\\n            parser.sgmlDecl = \\'\\'\\n            parser.state = S.TEXT\\n          } else if (is(quote, c)) {\\n            parser.state = S.SGML_DECL_QUOTED\\n            parser.sgmlDecl += c\\n          } else {\\n            parser.sgmlDecl += c\\n          }\\n          continue\\n\\n        case S.SGML_DECL_QUOTED:\\n          if (c === parser.q) {\\n            parser.state = S.SGML_DECL\\n            parser.q = \\'\\'\\n          }\\n          parser.sgmlDecl += c\\n          continue\\n\\n        case S.DOCTYPE:\\n          if (c === \\'>\\') {\\n            parser.state = S.TEXT\\n            emitNode(parser, \\'ondoctype\\', parser.doctype)\\n            parser.doctype = true // just remember that we saw it.\\n          } else {\\n            parser.doctype += c\\n            if (c === \\'[\\') {\\n              parser.state = S.DOCTYPE_DTD\\n            } else if (is(quote, c)) {\\n              parser.state = S.DOCTYPE_QUOTED\\n              parser.q = c\\n            }\\n          }\\n          continue\\n\\n        case S.DOCTYPE_QUOTED:\\n          parser.doctype += c\\n          if (c === parser.q) {\\n            parser.q = \\'\\'\\n            parser.state = S.DOCTYPE\\n          }\\n          continue\\n\\n        case S.DOCTYPE_DTD:\\n          parser.doctype += c\\n          if (c === \\']\\') {\\n            parser.state = S.DOCTYPE\\n          } else if (is(quote, c)) {\\n            parser.state = S.DOCTYPE_DTD_QUOTED\\n            parser.q = c\\n          }\\n          continue\\n\\n        case S.DOCTYPE_DTD_QUOTED:\\n          parser.doctype += c\\n          if (c === parser.q) {\\n            parser.state = S.DOCTYPE_DTD\\n            parser.q = \\'\\'\\n          }\\n          continue\\n\\n        case S.COMMENT:\\n          if (c === \\'-\\') {\\n            parser.state = S.COMMENT_ENDING\\n          } else {\\n            parser.comment += c\\n          }\\n          continue\\n\\n        case S.COMMENT_ENDING:\\n          if (c === \\'-\\') {\\n            parser.state = S.COMMENT_ENDED\\n            parser.comment = textopts(parser.opt, parser.comment)\\n            if (parser.comment) {\\n              emitNode(parser, \\'oncomment\\', parser.comment)\\n            }\\n            parser.comment = \\'\\'\\n          } else {\\n            parser.comment += \\'-\\' + c\\n            parser.state = S.COMMENT\\n          }\\n          continue\\n\\n        case S.COMMENT_ENDED:\\n          if (c !== \\'>\\') {\\n            strictFail(parser, \\'Malformed comment\\')\\n            // allow <!-- blah -- bloo --> in non-strict mode,\\n            // which is a comment of \" blah -- bloo \"\\n            parser.comment += \\'--\\' + c\\n            parser.state = S.COMMENT\\n          } else {\\n            parser.state = S.TEXT\\n          }\\n          continue\\n\\n        case S.CDATA:\\n          if (c === \\']\\') {\\n            parser.state = S.CDATA_ENDING\\n          } else {\\n            parser.cdata += c\\n          }\\n          continue\\n\\n        case S.CDATA_ENDING:\\n          if (c === \\']\\') {\\n            parser.state = S.CDATA_ENDING_2\\n          } else {\\n            parser.cdata += \\']\\' + c\\n            parser.state = S.CDATA\\n          }\\n          continue\\n\\n        case S.CDATA_ENDING_2:\\n          if (c === \\'>\\') {\\n            if (parser.cdata) {\\n              emitNode(parser, \\'oncdata\\', parser.cdata)\\n            }\\n            emitNode(parser, \\'onclosecdata\\')\\n            parser.cdata = \\'\\'\\n            parser.state = S.TEXT\\n          } else if (c === \\']\\') {\\n            parser.cdata += \\']\\'\\n          } else {\\n            parser.cdata += \\']]\\' + c\\n            parser.state = S.CDATA\\n          }\\n          continue\\n\\n        case S.PROC_INST:\\n          if (c === \\'?\\') {\\n            parser.state = S.PROC_INST_ENDING\\n          } else if (is(whitespace, c)) {\\n            parser.state = S.PROC_INST_BODY\\n          } else {\\n            parser.procInstName += c\\n          }\\n          continue\\n\\n        case S.PROC_INST_BODY:\\n          if (!parser.procInstBody && is(whitespace, c)) {\\n            continue\\n          } else if (c === \\'?\\') {\\n            parser.state = S.PROC_INST_ENDING\\n          } else {\\n            parser.procInstBody += c\\n          }\\n          continue\\n\\n        case S.PROC_INST_ENDING:\\n          if (c === \\'>\\') {\\n            emitNode(parser, \\'onprocessinginstruction\\', {\\n              name: parser.procInstName,\\n              body: parser.procInstBody\\n            })\\n            parser.procInstName = parser.procInstBody = \\'\\'\\n            parser.state = S.TEXT\\n          } else {\\n            parser.procInstBody += \\'?\\' + c\\n            parser.state = S.PROC_INST_BODY\\n          }\\n          continue\\n\\n        case S.OPEN_TAG:\\n          if (is(nameBody, c)) {\\n            parser.tagName += c\\n          } else {\\n            newTag(parser)\\n            if (c === \\'>\\') {\\n              openTag(parser)\\n            } else if (c === \\'/\\') {\\n              parser.state = S.OPEN_TAG_SLASH\\n            } else {\\n              if (not(whitespace, c)) {\\n                strictFail(parser, \\'Invalid character in tag name\\')\\n              }\\n              parser.state = S.ATTRIB\\n            }\\n          }\\n          continue\\n\\n        case S.OPEN_TAG_SLASH:\\n          if (c === \\'>\\') {\\n            openTag(parser, true)\\n            closeTag(parser)\\n          } else {\\n            strictFail(parser, \\'Forward-slash in opening tag not followed by >\\')\\n            parser.state = S.ATTRIB\\n          }\\n          continue\\n\\n        case S.ATTRIB:\\n          // haven\\'t read the attribute name yet.\\n          if (is(whitespace, c)) {\\n            continue\\n          } else if (c === \\'>\\') {\\n            openTag(parser)\\n          } else if (c === \\'/\\') {\\n            parser.state = S.OPEN_TAG_SLASH\\n          } else if (is(nameStart, c)) {\\n            parser.attribName = c\\n            parser.attribValue = \\'\\'\\n            parser.state = S.ATTRIB_NAME\\n          } else {\\n            strictFail(parser, \\'Invalid attribute name\\')\\n          }\\n          continue\\n\\n        case S.ATTRIB_NAME:\\n          if (c === \\'=\\') {\\n            parser.state = S.ATTRIB_VALUE\\n          } else if (c === \\'>\\') {\\n            strictFail(parser, \\'Attribute without value\\')\\n            parser.attribValue = parser.attribName\\n            attrib(parser)\\n            openTag(parser)\\n          } else if (is(whitespace, c)) {\\n            parser.state = S.ATTRIB_NAME_SAW_WHITE\\n          } else if (is(nameBody, c)) {\\n            parser.attribName += c\\n          } else {\\n            strictFail(parser, \\'Invalid attribute name\\')\\n          }\\n          continue\\n\\n        case S.ATTRIB_NAME_SAW_WHITE:\\n          if (c === \\'=\\') {\\n            parser.state = S.ATTRIB_VALUE\\n          } else if (is(whitespace, c)) {\\n            continue\\n          } else {\\n            strictFail(parser, \\'Attribute without value\\')\\n            parser.tag.attributes[parser.attribName] = \\'\\'\\n            parser.attribValue = \\'\\'\\n            emitNode(parser, \\'onattribute\\', {\\n              name: parser.attribName,\\n              value: \\'\\'\\n            })\\n            parser.attribName = \\'\\'\\n            if (c === \\'>\\') {\\n              openTag(parser)\\n            } else if (is(nameStart, c)) {\\n              parser.attribName = c\\n              parser.state = S.ATTRIB_NAME\\n            } else {\\n              strictFail(parser, \\'Invalid attribute name\\')\\n              parser.state = S.ATTRIB\\n            }\\n          }\\n          continue\\n\\n        case S.ATTRIB_VALUE:\\n          if (is(whitespace, c)) {\\n            continue\\n          } else if (is(quote, c)) {\\n            parser.q = c\\n            parser.state = S.ATTRIB_VALUE_QUOTED\\n          } else {\\n            strictFail(parser, \\'Unquoted attribute value\\')\\n            parser.state = S.ATTRIB_VALUE_UNQUOTED\\n            parser.attribValue = c\\n          }\\n          continue\\n\\n        case S.ATTRIB_VALUE_QUOTED:\\n          if (c !== parser.q) {\\n            if (c === \\'&\\') {\\n              parser.state = S.ATTRIB_VALUE_ENTITY_Q\\n            } else {\\n              parser.attribValue += c\\n            }\\n            continue\\n          }\\n          attrib(parser)\\n          parser.q = \\'\\'\\n          parser.state = S.ATTRIB_VALUE_CLOSED\\n          continue\\n\\n        case S.ATTRIB_VALUE_CLOSED:\\n          if (is(whitespace, c)) {\\n            parser.state = S.ATTRIB\\n          } else if (c === \\'>\\') {\\n            openTag(parser)\\n          } else if (c === \\'/\\') {\\n            parser.state = S.OPEN_TAG_SLASH\\n          } else if (is(nameStart, c)) {\\n            strictFail(parser, \\'No whitespace between attributes\\')\\n            parser.attribName = c\\n            parser.attribValue = \\'\\'\\n            parser.state = S.ATTRIB_NAME\\n          } else {\\n            strictFail(parser, \\'Invalid attribute name\\')\\n          }\\n          continue\\n\\n        case S.ATTRIB_VALUE_UNQUOTED:\\n          if (not(attribEnd, c)) {\\n            if (c === \\'&\\') {\\n              parser.state = S.ATTRIB_VALUE_ENTITY_U\\n            } else {\\n              parser.attribValue += c\\n            }\\n            continue\\n          }\\n          attrib(parser)\\n          if (c === \\'>\\') {\\n            openTag(parser)\\n          } else {\\n            parser.state = S.ATTRIB\\n          }\\n          continue\\n\\n        case S.CLOSE_TAG:\\n          if (!parser.tagName) {\\n            if (is(whitespace, c)) {\\n              continue\\n            } else if (not(nameStart, c)) {\\n              if (parser.script) {\\n                parser.script += \\'</\\' + c\\n                parser.state = S.SCRIPT\\n              } else {\\n                strictFail(parser, \\'Invalid tagname in closing tag.\\')\\n              }\\n            } else {\\n              parser.tagName = c\\n            }\\n          } else if (c === \\'>\\') {\\n            closeTag(parser)\\n          } else if (is(nameBody, c)) {\\n            parser.tagName += c\\n          } else if (parser.script) {\\n            parser.script += \\'</\\' + parser.tagName\\n            parser.tagName = \\'\\'\\n            parser.state = S.SCRIPT\\n          } else {\\n            if (not(whitespace, c)) {\\n              strictFail(parser, \\'Invalid tagname in closing tag\\')\\n            }\\n            parser.state = S.CLOSE_TAG_SAW_WHITE\\n          }\\n          continue\\n\\n        case S.CLOSE_TAG_SAW_WHITE:\\n          if (is(whitespace, c)) {\\n            continue\\n          }\\n          if (c === \\'>\\') {\\n            closeTag(parser)\\n          } else {\\n            strictFail(parser, \\'Invalid characters in closing tag\\')\\n          }\\n          continue\\n\\n        case S.TEXT_ENTITY:\\n        case S.ATTRIB_VALUE_ENTITY_Q:\\n        case S.ATTRIB_VALUE_ENTITY_U:\\n          var returnState\\n          var buffer\\n          switch (parser.state) {\\n            case S.TEXT_ENTITY:\\n              returnState = S.TEXT\\n              buffer = \\'textNode\\'\\n              break\\n\\n            case S.ATTRIB_VALUE_ENTITY_Q:\\n              returnState = S.ATTRIB_VALUE_QUOTED\\n              buffer = \\'attribValue\\'\\n              break\\n\\n            case S.ATTRIB_VALUE_ENTITY_U:\\n              returnState = S.ATTRIB_VALUE_UNQUOTED\\n              buffer = \\'attribValue\\'\\n              break\\n          }\\n\\n          if (c === \\';\\') {\\n            parser[buffer] += parseEntity(parser)\\n            parser.entity = \\'\\'\\n            parser.state = returnState\\n          } else if (is(parser.entity.length ? entityBody : entityStart, c)) {\\n            parser.entity += c\\n          } else {\\n            strictFail(parser, \\'Invalid character in entity name\\')\\n            parser[buffer] += \\'&\\' + parser.entity + c\\n            parser.entity = \\'\\'\\n            parser.state = returnState\\n          }\\n\\n          continue\\n\\n        default:\\n          throw new Error(parser, \\'Unknown state: \\' + parser.state)\\n      }\\n    } // while\\n\\n    if (parser.position >= parser.bufferCheckPosition) {\\n      checkBufferLength(parser)\\n    }\\n    return parser\\n  }\\n\\n  /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */\\n  if (!String.fromCodePoint) {\\n    (function () {\\n      var stringFromCharCode = String.fromCharCode\\n      var floor = Math.floor\\n      var fromCodePoint = function () {\\n        var MAX_SIZE = 0x4000\\n        var codeUnits = []\\n        var highSurrogate\\n        var lowSurrogate\\n        var index = -1\\n        var length = arguments.length\\n        if (!length) {\\n          return \\'\\'\\n        }\\n        var result = \\'\\'\\n        while (++index < length) {\\n          var codePoint = Number(arguments[index])\\n          if (\\n            !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`\\n            codePoint < 0 || // not a valid Unicode code point\\n            codePoint > 0x10FFFF || // not a valid Unicode code point\\n            floor(codePoint) !== codePoint // not an integer\\n          ) {\\n            throw RangeError(\\'Invalid code point: \\' + codePoint)\\n          }\\n          if (codePoint <= 0xFFFF) { // BMP code point\\n            codeUnits.push(codePoint)\\n          } else { // Astral code point; split in surrogate halves\\n            // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\\n            codePoint -= 0x10000\\n            highSurrogate = (codePoint >> 10) + 0xD800\\n            lowSurrogate = (codePoint % 0x400) + 0xDC00\\n            codeUnits.push(highSurrogate, lowSurrogate)\\n          }\\n          if (index + 1 === length || codeUnits.length > MAX_SIZE) {\\n            result += stringFromCharCode.apply(null, codeUnits)\\n            codeUnits.length = 0\\n          }\\n        }\\n        return result\\n      }\\n      if (Object.defineProperty) {\\n        Object.defineProperty(String, \\'fromCodePoint\\', {\\n          value: fromCodePoint,\\n          configurable: true,\\n          writable: true\\n        })\\n      } else {\\n        String.fromCodePoint = fromCodePoint\\n      }\\n    }())\\n  }\\n})(typeof exports === \\'undefined\\' ? this.sax = {} : exports)\\n\\n}).call(this,require(\"buffer\").Buffer)\\n},{\"buffer\":47,\"stream\":51,\"string_decoder\":57}],47:[function(require,module,exports){\\n/*!\\n * The buffer module from node.js, for the browser.\\n *\\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\\n * @license  MIT\\n */\\n\\nvar base64 = require(\\'base64-js\\')\\nvar ieee754 = require(\\'ieee754\\')\\n\\nexports.Buffer = Buffer\\nexports.SlowBuffer = Buffer\\nexports.INSPECT_MAX_BYTES = 50\\nBuffer.poolSize = 8192\\n\\n/**\\n * If `Buffer._useTypedArrays`:\\n *   === true    Use Uint8Array implementation (fastest)\\n *   === false   Use Object implementation (compatible down to IE6)\\n */\\nBuffer._useTypedArrays = (function () {\\n  // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+,\\n  // Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding\\n  // properties to `Uint8Array` instances, then that\\'s the same as no `Uint8Array` support\\n  // because we need to be able to add all the node Buffer API methods. This is an issue\\n  // in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438\\n  try {\\n    var buf = new ArrayBuffer(0)\\n    var arr = new Uint8Array(buf)\\n    arr.foo = function () { return 42 }\\n    return 42 === arr.foo() &&\\n        typeof arr.subarray === \\'function\\' // Chrome 9-10 lack `subarray`\\n  } catch (e) {\\n    return false\\n  }\\n})()\\n\\n/**\\n * Class: Buffer\\n * =============\\n *\\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\\n * with function properties for all the node `Buffer` API functions. We use\\n * `Uint8Array` so that square bracket notation works as expected -- it returns\\n * a single octet.\\n *\\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\\n * prototype.\\n */\\nfunction Buffer (subject, encoding, noZero) {\\n  if (!(this instanceof Buffer))\\n    return new Buffer(subject, encoding, noZero)\\n\\n  var type = typeof subject\\n\\n  // Workaround: node\\'s base64 implementation allows for non-padded strings\\n  // while base64-js does not.\\n  if (encoding === \\'base64\\' && type === \\'string\\') {\\n    subject = stringtrim(subject)\\n    while (subject.length % 4 !== 0) {\\n      subject = subject + \\'=\\'\\n    }\\n  }\\n\\n  // Find the length\\n  var length\\n  if (type === \\'number\\')\\n    length = coerce(subject)\\n  else if (type === \\'string\\')\\n    length = Buffer.byteLength(subject, encoding)\\n  else if (type === \\'object\\')\\n    length = coerce(subject.length) // assume that object is array-like\\n  else\\n    throw new Error(\\'First argument needs to be a number, array or string.\\')\\n\\n  var buf\\n  if (Buffer._useTypedArrays) {\\n    // Preferred: Return an augmented `Uint8Array` instance for best performance\\n    buf = Buffer._augment(new Uint8Array(length))\\n  } else {\\n    // Fallback: Return THIS instance of Buffer (created by `new`)\\n    buf = this\\n    buf.length = length\\n    buf._isBuffer = true\\n  }\\n\\n  var i\\n  if (Buffer._useTypedArrays && typeof subject.byteLength === \\'number\\') {\\n    // Speed optimization -- use set if we\\'re copying from a typed array\\n    buf._set(subject)\\n  } else if (isArrayish(subject)) {\\n    // Treat array-ish objects as a byte array\\n    for (i = 0; i < length; i++) {\\n      if (Buffer.isBuffer(subject))\\n        buf[i] = subject.readUInt8(i)\\n      else\\n        buf[i] = subject[i]\\n    }\\n  } else if (type === \\'string\\') {\\n    buf.write(subject, 0, encoding)\\n  } else if (type === \\'number\\' && !Buffer._useTypedArrays && !noZero) {\\n    for (i = 0; i < length; i++) {\\n      buf[i] = 0\\n    }\\n  }\\n\\n  return buf\\n}\\n\\n// STATIC METHODS\\n// ==============\\n\\nBuffer.isEncoding = function (encoding) {\\n  switch (String(encoding).toLowerCase()) {\\n    case \\'hex\\':\\n    case \\'utf8\\':\\n    case \\'utf-8\\':\\n    case \\'ascii\\':\\n    case \\'binary\\':\\n    case \\'base64\\':\\n    case \\'raw\\':\\n    case \\'ucs2\\':\\n    case \\'ucs-2\\':\\n    case \\'utf16le\\':\\n    case \\'utf-16le\\':\\n      return true\\n    default:\\n      return false\\n  }\\n}\\n\\nBuffer.isBuffer = function (b) {\\n  return !!(b !== null && b !== undefined && b._isBuffer)\\n}\\n\\nBuffer.byteLength = function (str, encoding) {\\n  var ret\\n  str = str + \\'\\'\\n  switch (encoding || \\'utf8\\') {\\n    case \\'hex\\':\\n      ret = str.length / 2\\n      break\\n    case \\'utf8\\':\\n    case \\'utf-8\\':\\n      ret = utf8ToBytes(str).length\\n      break\\n    case \\'ascii\\':\\n    case \\'binary\\':\\n    case \\'raw\\':\\n      ret = str.length\\n      break\\n    case \\'base64\\':\\n      ret = base64ToBytes(str).length\\n      break\\n    case \\'ucs2\\':\\n    case \\'ucs-2\\':\\n    case \\'utf16le\\':\\n    case \\'utf-16le\\':\\n      ret = str.length * 2\\n      break\\n    default:\\n      throw new Error(\\'Unknown encoding\\')\\n  }\\n  return ret\\n}\\n\\nBuffer.concat = function (list, totalLength) {\\n  assert(isArray(list), \\'Usage: Buffer.concat(list, [totalLength])\\\\n\\' +\\n      \\'list should be an Array.\\')\\n\\n  if (list.length === 0) {\\n    return new Buffer(0)\\n  } else if (list.length === 1) {\\n    return list[0]\\n  }\\n\\n  var i\\n  if (typeof totalLength !== \\'number\\') {\\n    totalLength = 0\\n    for (i = 0; i < list.length; i++) {\\n      totalLength += list[i].length\\n    }\\n  }\\n\\n  var buf = new Buffer(totalLength)\\n  var pos = 0\\n  for (i = 0; i < list.length; i++) {\\n    var item = list[i]\\n    item.copy(buf, pos)\\n    pos += item.length\\n  }\\n  return buf\\n}\\n\\n// BUFFER INSTANCE METHODS\\n// =======================\\n\\nfunction _hexWrite (buf, string, offset, length) {\\n  offset = Number(offset) || 0\\n  var remaining = buf.length - offset\\n  if (!length) {\\n    length = remaining\\n  } else {\\n    length = Number(length)\\n    if (length > remaining) {\\n      length = remaining\\n    }\\n  }\\n\\n  // must be an even number of digits\\n  var strLen = string.length\\n  assert(strLen % 2 === 0, \\'Invalid hex string\\')\\n\\n  if (length > strLen / 2) {\\n    length = strLen / 2\\n  }\\n  for (var i = 0; i < length; i++) {\\n    var byte = parseInt(string.substr(i * 2, 2), 16)\\n    assert(!isNaN(byte), \\'Invalid hex string\\')\\n    buf[offset + i] = byte\\n  }\\n  Buffer._charsWritten = i * 2\\n  return i\\n}\\n\\nfunction _utf8Write (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(utf8ToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nfunction _asciiWrite (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(asciiToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nfunction _binaryWrite (buf, string, offset, length) {\\n  return _asciiWrite(buf, string, offset, length)\\n}\\n\\nfunction _base64Write (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(base64ToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nfunction _utf16leWrite (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(utf16leToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nBuffer.prototype.write = function (string, offset, length, encoding) {\\n  // Support both (string, offset, length, encoding)\\n  // and the legacy (string, encoding, offset, length)\\n  if (isFinite(offset)) {\\n    if (!isFinite(length)) {\\n      encoding = length\\n      length = undefined\\n    }\\n  } else {  // legacy\\n    var swap = encoding\\n    encoding = offset\\n    offset = length\\n    length = swap\\n  }\\n\\n  offset = Number(offset) || 0\\n  var remaining = this.length - offset\\n  if (!length) {\\n    length = remaining\\n  } else {\\n    length = Number(length)\\n    if (length > remaining) {\\n      length = remaining\\n    }\\n  }\\n  encoding = String(encoding || \\'utf8\\').toLowerCase()\\n\\n  var ret\\n  switch (encoding) {\\n    case \\'hex\\':\\n      ret = _hexWrite(this, string, offset, length)\\n      break\\n    case \\'utf8\\':\\n    case \\'utf-8\\':\\n      ret = _utf8Write(this, string, offset, length)\\n      break\\n    case \\'ascii\\':\\n      ret = _asciiWrite(this, string, offset, length)\\n      break\\n    case \\'binary\\':\\n      ret = _binaryWrite(this, string, offset, length)\\n      break\\n    case \\'base64\\':\\n      ret = _base64Write(this, string, offset, length)\\n      break\\n    case \\'ucs2\\':\\n    case \\'ucs-2\\':\\n    case \\'utf16le\\':\\n    case \\'utf-16le\\':\\n      ret = _utf16leWrite(this, string, offset, length)\\n      break\\n    default:\\n      throw new Error(\\'Unknown encoding\\')\\n  }\\n  return ret\\n}\\n\\nBuffer.prototype.toString = function (encoding, start, end) {\\n  var self = this\\n\\n  encoding = String(encoding || \\'utf8\\').toLowerCase()\\n  start = Number(start) || 0\\n  end = (end !== undefined)\\n    ? Number(end)\\n    : end = self.length\\n\\n  // Fastpath empty strings\\n  if (end === start)\\n    return \\'\\'\\n\\n  var ret\\n  switch (encoding) {\\n    case \\'hex\\':\\n      ret = _hexSlice(self, start, end)\\n      break\\n    case \\'utf8\\':\\n    case \\'utf-8\\':\\n      ret = _utf8Slice(self, start, end)\\n      break\\n    case \\'ascii\\':\\n      ret = _asciiSlice(self, start, end)\\n      break\\n    case \\'binary\\':\\n      ret = _binarySlice(self, start, end)\\n      break\\n    case \\'base64\\':\\n      ret = _base64Slice(self, start, end)\\n      break\\n    case \\'ucs2\\':\\n    case \\'ucs-2\\':\\n    case \\'utf16le\\':\\n    case \\'utf-16le\\':\\n      ret = _utf16leSlice(self, start, end)\\n      break\\n    default:\\n      throw new Error(\\'Unknown encoding\\')\\n  }\\n  return ret\\n}\\n\\nBuffer.prototype.toJSON = function () {\\n  return {\\n    type: \\'Buffer\\',\\n    data: Array.prototype.slice.call(this._arr || this, 0)\\n  }\\n}\\n\\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\\nBuffer.prototype.copy = function (target, target_start, start, end) {\\n  var source = this\\n\\n  if (!start) start = 0\\n  if (!end && end !== 0) end = this.length\\n  if (!target_start) target_start = 0\\n\\n  // Copy 0 bytes; we\\'re done\\n  if (end === start) return\\n  if (target.length === 0 || source.length === 0) return\\n\\n  // Fatal error conditions\\n  assert(end >= start, \\'sourceEnd < sourceStart\\')\\n  assert(target_start >= 0 && target_start < target.length,\\n      \\'targetStart out of bounds\\')\\n  assert(start >= 0 && start < source.length, \\'sourceStart out of bounds\\')\\n  assert(end >= 0 && end <= source.length, \\'sourceEnd out of bounds\\')\\n\\n  // Are we oob?\\n  if (end > this.length)\\n    end = this.length\\n  if (target.length - target_start < end - start)\\n    end = target.length - target_start + start\\n\\n  var len = end - start\\n\\n  if (len < 100 || !Buffer._useTypedArrays) {\\n    for (var i = 0; i < len; i++)\\n      target[i + target_start] = this[i + start]\\n  } else {\\n    target._set(this.subarray(start, start + len), target_start)\\n  }\\n}\\n\\nfunction _base64Slice (buf, start, end) {\\n  if (start === 0 && end === buf.length) {\\n    return base64.fromByteArray(buf)\\n  } else {\\n    return base64.fromByteArray(buf.slice(start, end))\\n  }\\n}\\n\\nfunction _utf8Slice (buf, start, end) {\\n  var res = \\'\\'\\n  var tmp = \\'\\'\\n  end = Math.min(buf.length, end)\\n\\n  for (var i = start; i < end; i++) {\\n    if (buf[i] <= 0x7F) {\\n      res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\\n      tmp = \\'\\'\\n    } else {\\n      tmp += \\'%\\' + buf[i].toString(16)\\n    }\\n  }\\n\\n  return res + decodeUtf8Char(tmp)\\n}\\n\\nfunction _asciiSlice (buf, start, end) {\\n  var ret = \\'\\'\\n  end = Math.min(buf.length, end)\\n\\n  for (var i = start; i < end; i++)\\n    ret += String.fromCharCode(buf[i])\\n  return ret\\n}\\n\\nfunction _binarySlice (buf, start, end) {\\n  return _asciiSlice(buf, start, end)\\n}\\n\\nfunction _hexSlice (buf, start, end) {\\n  var len = buf.length\\n\\n  if (!start || start < 0) start = 0\\n  if (!end || end < 0 || end > len) end = len\\n\\n  var out = \\'\\'\\n  for (var i = start; i < end; i++) {\\n    out += toHex(buf[i])\\n  }\\n  return out\\n}\\n\\nfunction _utf16leSlice (buf, start, end) {\\n  var bytes = buf.slice(start, end)\\n  var res = \\'\\'\\n  for (var i = 0; i < bytes.length; i += 2) {\\n    res += String.fromCharCode(bytes[i] + bytes[i+1] * 256)\\n  }\\n  return res\\n}\\n\\nBuffer.prototype.slice = function (start, end) {\\n  var len = this.length\\n  start = clamp(start, len, 0)\\n  end = clamp(end, len, len)\\n\\n  if (Buffer._useTypedArrays) {\\n    return Buffer._augment(this.subarray(start, end))\\n  } else {\\n    var sliceLen = end - start\\n    var newBuf = new Buffer(sliceLen, undefined, true)\\n    for (var i = 0; i < sliceLen; i++) {\\n      newBuf[i] = this[i + start]\\n    }\\n    return newBuf\\n  }\\n}\\n\\n// `get` will be removed in Node 0.13+\\nBuffer.prototype.get = function (offset) {\\n  console.log(\\'.get() is deprecated. Access using array indexes instead.\\')\\n  return this.readUInt8(offset)\\n}\\n\\n// `set` will be removed in Node 0.13+\\nBuffer.prototype.set = function (v, offset) {\\n  console.log(\\'.set() is deprecated. Access using array indexes instead.\\')\\n  return this.writeUInt8(v, offset)\\n}\\n\\nBuffer.prototype.readUInt8 = function (offset, noAssert) {\\n  if (!noAssert) {\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset < this.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  if (offset >= this.length)\\n    return\\n\\n  return this[offset]\\n}\\n\\nfunction _readUInt16 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 1 < buf.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val\\n  if (littleEndian) {\\n    val = buf[offset]\\n    if (offset + 1 < len)\\n      val |= buf[offset + 1] << 8\\n  } else {\\n    val = buf[offset] << 8\\n    if (offset + 1 < len)\\n      val |= buf[offset + 1]\\n  }\\n  return val\\n}\\n\\nBuffer.prototype.readUInt16LE = function (offset, noAssert) {\\n  return _readUInt16(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readUInt16BE = function (offset, noAssert) {\\n  return _readUInt16(this, offset, false, noAssert)\\n}\\n\\nfunction _readUInt32 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 3 < buf.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val\\n  if (littleEndian) {\\n    if (offset + 2 < len)\\n      val = buf[offset + 2] << 16\\n    if (offset + 1 < len)\\n      val |= buf[offset + 1] << 8\\n    val |= buf[offset]\\n    if (offset + 3 < len)\\n      val = val + (buf[offset + 3] << 24 >>> 0)\\n  } else {\\n    if (offset + 1 < len)\\n      val = buf[offset + 1] << 16\\n    if (offset + 2 < len)\\n      val |= buf[offset + 2] << 8\\n    if (offset + 3 < len)\\n      val |= buf[offset + 3]\\n    val = val + (buf[offset] << 24 >>> 0)\\n  }\\n  return val\\n}\\n\\nBuffer.prototype.readUInt32LE = function (offset, noAssert) {\\n  return _readUInt32(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readUInt32BE = function (offset, noAssert) {\\n  return _readUInt32(this, offset, false, noAssert)\\n}\\n\\nBuffer.prototype.readInt8 = function (offset, noAssert) {\\n  if (!noAssert) {\\n    assert(offset !== undefined && offset !== null,\\n        \\'missing offset\\')\\n    assert(offset < this.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  if (offset >= this.length)\\n    return\\n\\n  var neg = this[offset] & 0x80\\n  if (neg)\\n    return (0xff - this[offset] + 1) * -1\\n  else\\n    return this[offset]\\n}\\n\\nfunction _readInt16 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 1 < buf.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val = _readUInt16(buf, offset, littleEndian, true)\\n  var neg = val & 0x8000\\n  if (neg)\\n    return (0xffff - val + 1) * -1\\n  else\\n    return val\\n}\\n\\nBuffer.prototype.readInt16LE = function (offset, noAssert) {\\n  return _readInt16(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readInt16BE = function (offset, noAssert) {\\n  return _readInt16(this, offset, false, noAssert)\\n}\\n\\nfunction _readInt32 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 3 < buf.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val = _readUInt32(buf, offset, littleEndian, true)\\n  var neg = val & 0x80000000\\n  if (neg)\\n    return (0xffffffff - val + 1) * -1\\n  else\\n    return val\\n}\\n\\nBuffer.prototype.readInt32LE = function (offset, noAssert) {\\n  return _readInt32(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readInt32BE = function (offset, noAssert) {\\n  return _readInt32(this, offset, false, noAssert)\\n}\\n\\nfunction _readFloat (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset + 3 < buf.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  return ieee754.read(buf, offset, littleEndian, 23, 4)\\n}\\n\\nBuffer.prototype.readFloatLE = function (offset, noAssert) {\\n  return _readFloat(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readFloatBE = function (offset, noAssert) {\\n  return _readFloat(this, offset, false, noAssert)\\n}\\n\\nfunction _readDouble (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset + 7 < buf.length, \\'Trying to read beyond buffer length\\')\\n  }\\n\\n  return ieee754.read(buf, offset, littleEndian, 52, 8)\\n}\\n\\nBuffer.prototype.readDoubleLE = function (offset, noAssert) {\\n  return _readDouble(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readDoubleBE = function (offset, noAssert) {\\n  return _readDouble(this, offset, false, noAssert)\\n}\\n\\nBuffer.prototype.writeUInt8 = function (value, offset, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset < this.length, \\'trying to write beyond buffer length\\')\\n    verifuint(value, 0xff)\\n  }\\n\\n  if (offset >= this.length) return\\n\\n  this[offset] = value\\n}\\n\\nfunction _writeUInt16 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 1 < buf.length, \\'trying to write beyond buffer length\\')\\n    verifuint(value, 0xffff)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {\\n    buf[offset + i] =\\n        (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\\n            (littleEndian ? i : 1 - i) * 8\\n  }\\n}\\n\\nBuffer.prototype.writeUInt16LE = function (value, offset, noAssert) {\\n  _writeUInt16(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeUInt16BE = function (value, offset, noAssert) {\\n  _writeUInt16(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeUInt32 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 3 < buf.length, \\'trying to write beyond buffer length\\')\\n    verifuint(value, 0xffffffff)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {\\n    buf[offset + i] =\\n        (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\\n  }\\n}\\n\\nBuffer.prototype.writeUInt32LE = function (value, offset, noAssert) {\\n  _writeUInt32(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeUInt32BE = function (value, offset, noAssert) {\\n  _writeUInt32(this, value, offset, false, noAssert)\\n}\\n\\nBuffer.prototype.writeInt8 = function (value, offset, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset < this.length, \\'Trying to write beyond buffer length\\')\\n    verifsint(value, 0x7f, -0x80)\\n  }\\n\\n  if (offset >= this.length)\\n    return\\n\\n  if (value >= 0)\\n    this.writeUInt8(value, offset, noAssert)\\n  else\\n    this.writeUInt8(0xff + value + 1, offset, noAssert)\\n}\\n\\nfunction _writeInt16 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 1 < buf.length, \\'Trying to write beyond buffer length\\')\\n    verifsint(value, 0x7fff, -0x8000)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  if (value >= 0)\\n    _writeUInt16(buf, value, offset, littleEndian, noAssert)\\n  else\\n    _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)\\n}\\n\\nBuffer.prototype.writeInt16LE = function (value, offset, noAssert) {\\n  _writeInt16(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeInt16BE = function (value, offset, noAssert) {\\n  _writeInt16(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeInt32 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 3 < buf.length, \\'Trying to write beyond buffer length\\')\\n    verifsint(value, 0x7fffffff, -0x80000000)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  if (value >= 0)\\n    _writeUInt32(buf, value, offset, littleEndian, noAssert)\\n  else\\n    _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)\\n}\\n\\nBuffer.prototype.writeInt32LE = function (value, offset, noAssert) {\\n  _writeInt32(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeInt32BE = function (value, offset, noAssert) {\\n  _writeInt32(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeFloat (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 3 < buf.length, \\'Trying to write beyond buffer length\\')\\n    verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\\n}\\n\\nBuffer.prototype.writeFloatLE = function (value, offset, noAssert) {\\n  _writeFloat(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeFloatBE = function (value, offset, noAssert) {\\n  _writeFloat(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeDouble (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, \\'missing value\\')\\n    assert(typeof littleEndian === \\'boolean\\', \\'missing or invalid endian\\')\\n    assert(offset !== undefined && offset !== null, \\'missing offset\\')\\n    assert(offset + 7 < buf.length,\\n        \\'Trying to write beyond buffer length\\')\\n    verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\\n}\\n\\nBuffer.prototype.writeDoubleLE = function (value, offset, noAssert) {\\n  _writeDouble(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeDoubleBE = function (value, offset, noAssert) {\\n  _writeDouble(this, value, offset, false, noAssert)\\n}\\n\\n// fill(value, start=0, end=buffer.length)\\nBuffer.prototype.fill = function (value, start, end) {\\n  if (!value) value = 0\\n  if (!start) start = 0\\n  if (!end) end = this.length\\n\\n  if (typeof value === \\'string\\') {\\n    value = value.charCodeAt(0)\\n  }\\n\\n  assert(typeof value === \\'number\\' && !isNaN(value), \\'value is not a number\\')\\n  assert(end >= start, \\'end < start\\')\\n\\n  // Fill 0 bytes; we\\'re done\\n  if (end === start) return\\n  if (this.length === 0) return\\n\\n  assert(start >= 0 && start < this.length, \\'start out of bounds\\')\\n  assert(end >= 0 && end <= this.length, \\'end out of bounds\\')\\n\\n  for (var i = start; i < end; i++) {\\n    this[i] = value\\n  }\\n}\\n\\nBuffer.prototype.inspect = function () {\\n  var out = []\\n  var len = this.length\\n  for (var i = 0; i < len; i++) {\\n    out[i] = toHex(this[i])\\n    if (i === exports.INSPECT_MAX_BYTES) {\\n      out[i + 1] = \\'...\\'\\n      break\\n    }\\n  }\\n  return \\'<Buffer \\' + out.join(\\' \\') + \\'>\\'\\n}\\n\\n/**\\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\\n */\\nBuffer.prototype.toArrayBuffer = function () {\\n  if (typeof Uint8Array !== \\'undefined\\') {\\n    if (Buffer._useTypedArrays) {\\n      return (new Buffer(this)).buffer\\n    } else {\\n      var buf = new Uint8Array(this.length)\\n      for (var i = 0, len = buf.length; i < len; i += 1)\\n        buf[i] = this[i]\\n      return buf.buffer\\n    }\\n  } else {\\n    throw new Error(\\'Buffer.toArrayBuffer not supported in this browser\\')\\n  }\\n}\\n\\n// HELPER FUNCTIONS\\n// ================\\n\\nfunction stringtrim (str) {\\n  if (str.trim) return str.trim()\\n  return str.replace(/^\\\\s+|\\\\s+$/g, \\'\\')\\n}\\n\\nvar BP = Buffer.prototype\\n\\n/**\\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\\n */\\nBuffer._augment = function (arr) {\\n  arr._isBuffer = true\\n\\n  // save reference to original Uint8Array get/set methods before overwriting\\n  arr._get = arr.get\\n  arr._set = arr.set\\n\\n  // deprecated, will be removed in node 0.13+\\n  arr.get = BP.get\\n  arr.set = BP.set\\n\\n  arr.write = BP.write\\n  arr.toString = BP.toString\\n  arr.toLocaleString = BP.toString\\n  arr.toJSON = BP.toJSON\\n  arr.copy = BP.copy\\n  arr.slice = BP.slice\\n  arr.readUInt8 = BP.readUInt8\\n  arr.readUInt16LE = BP.readUInt16LE\\n  arr.readUInt16BE = BP.readUInt16BE\\n  arr.readUInt32LE = BP.readUInt32LE\\n  arr.readUInt32BE = BP.readUInt32BE\\n  arr.readInt8 = BP.readInt8\\n  arr.readInt16LE = BP.readInt16LE\\n  arr.readInt16BE = BP.readInt16BE\\n  arr.readInt32LE = BP.readInt32LE\\n  arr.readInt32BE = BP.readInt32BE\\n  arr.readFloatLE = BP.readFloatLE\\n  arr.readFloatBE = BP.readFloatBE\\n  arr.readDoubleLE = BP.readDoubleLE\\n  arr.readDoubleBE = BP.readDoubleBE\\n  arr.writeUInt8 = BP.writeUInt8\\n  arr.writeUInt16LE = BP.writeUInt16LE\\n  arr.writeUInt16BE = BP.writeUInt16BE\\n  arr.writeUInt32LE = BP.writeUInt32LE\\n  arr.writeUInt32BE = BP.writeUInt32BE\\n  arr.writeInt8 = BP.writeInt8\\n  arr.writeInt16LE = BP.writeInt16LE\\n  arr.writeInt16BE = BP.writeInt16BE\\n  arr.writeInt32LE = BP.writeInt32LE\\n  arr.writeInt32BE = BP.writeInt32BE\\n  arr.writeFloatLE = BP.writeFloatLE\\n  arr.writeFloatBE = BP.writeFloatBE\\n  arr.writeDoubleLE = BP.writeDoubleLE\\n  arr.writeDoubleBE = BP.writeDoubleBE\\n  arr.fill = BP.fill\\n  arr.inspect = BP.inspect\\n  arr.toArrayBuffer = BP.toArrayBuffer\\n\\n  return arr\\n}\\n\\n// slice(start, end)\\nfunction clamp (index, len, defaultValue) {\\n  if (typeof index !== \\'number\\') return defaultValue\\n  index = ~~index;  // Coerce to integer.\\n  if (index >= len) return len\\n  if (index >= 0) return index\\n  index += len\\n  if (index >= 0) return index\\n  return 0\\n}\\n\\nfunction coerce (length) {\\n  // Coerce length to a number (possibly NaN), round up\\n  // in case it\\'s fractional (e.g. 123.456) then do a\\n  // double negate to coerce a NaN to 0. Easy, right?\\n  length = ~~Math.ceil(+length)\\n  return length < 0 ? 0 : length\\n}\\n\\nfunction isArray (subject) {\\n  return (Array.isArray || function (subject) {\\n    return Object.prototype.toString.call(subject) === \\'[object Array]\\'\\n  })(subject)\\n}\\n\\nfunction isArrayish (subject) {\\n  return isArray(subject) || Buffer.isBuffer(subject) ||\\n      subject && typeof subject === \\'object\\' &&\\n      typeof subject.length === \\'number\\'\\n}\\n\\nfunction toHex (n) {\\n  if (n < 16) return \\'0\\' + n.toString(16)\\n  return n.toString(16)\\n}\\n\\nfunction utf8ToBytes (str) {\\n  var byteArray = []\\n  for (var i = 0; i < str.length; i++) {\\n    var b = str.charCodeAt(i)\\n    if (b <= 0x7F)\\n      byteArray.push(str.charCodeAt(i))\\n    else {\\n      var start = i\\n      if (b >= 0xD800 && b <= 0xDFFF) i++\\n      var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split(\\'%\\')\\n      for (var j = 0; j < h.length; j++)\\n        byteArray.push(parseInt(h[j], 16))\\n    }\\n  }\\n  return byteArray\\n}\\n\\nfunction asciiToBytes (str) {\\n  var byteArray = []\\n  for (var i = 0; i < str.length; i++) {\\n    // Node\\'s code seems to be doing this and not & 0x7F..\\n    byteArray.push(str.charCodeAt(i) & 0xFF)\\n  }\\n  return byteArray\\n}\\n\\nfunction utf16leToBytes (str) {\\n  var c, hi, lo\\n  var byteArray = []\\n  for (var i = 0; i < str.length; i++) {\\n    c = str.charCodeAt(i)\\n    hi = c >> 8\\n    lo = c % 256\\n    byteArray.push(lo)\\n    byteArray.push(hi)\\n  }\\n\\n  return byteArray\\n}\\n\\nfunction base64ToBytes (str) {\\n  return base64.toByteArray(str)\\n}\\n\\nfunction blitBuffer (src, dst, offset, length) {\\n  var pos\\n  for (var i = 0; i < length; i++) {\\n    if ((i + offset >= dst.length) || (i >= src.length))\\n      break\\n    dst[i + offset] = src[i]\\n  }\\n  return i\\n}\\n\\nfunction decodeUtf8Char (str) {\\n  try {\\n    return decodeURIComponent(str)\\n  } catch (err) {\\n    return String.fromCharCode(0xFFFD) // UTF 8 invalid char\\n  }\\n}\\n\\n/*\\n * We have to make sure that the value is a valid integer. This means that it\\n * is non-negative. It has no fractional component and that it does not\\n * exceed the maximum allowed value.\\n */\\nfunction verifuint (value, max) {\\n  assert(typeof value === \\'number\\', \\'cannot write a non-number as a number\\')\\n  assert(value >= 0, \\'specified a negative value for writing an unsigned value\\')\\n  assert(value <= max, \\'value is larger than maximum value for type\\')\\n  assert(Math.floor(value) === value, \\'value has a fractional component\\')\\n}\\n\\nfunction verifsint (value, max, min) {\\n  assert(typeof value === \\'number\\', \\'cannot write a non-number as a number\\')\\n  assert(value <= max, \\'value larger than maximum allowed value\\')\\n  assert(value >= min, \\'value smaller than minimum allowed value\\')\\n  assert(Math.floor(value) === value, \\'value has a fractional component\\')\\n}\\n\\nfunction verifIEEE754 (value, max, min) {\\n  assert(typeof value === \\'number\\', \\'cannot write a non-number as a number\\')\\n  assert(value <= max, \\'value larger than maximum allowed value\\')\\n  assert(value >= min, \\'value smaller than minimum allowed value\\')\\n}\\n\\nfunction assert (test, message) {\\n  if (!test) throw new Error(message || \\'Failed assertion\\')\\n}\\n\\n},{\"base64-js\":1,\"ieee754\":3}],48:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nfunction EventEmitter() {\\n  this._events = this._events || {};\\n  this._maxListeners = this._maxListeners || undefined;\\n}\\nmodule.exports = EventEmitter;\\n\\n// Backwards-compat with node 0.10.x\\nEventEmitter.EventEmitter = EventEmitter;\\n\\nEventEmitter.prototype._events = undefined;\\nEventEmitter.prototype._maxListeners = undefined;\\n\\n// By default EventEmitters will print a warning if more than 10 listeners are\\n// added to it. This is a useful default which helps finding memory leaks.\\nEventEmitter.defaultMaxListeners = 10;\\n\\n// Obviously not all Emitters should be limited to 10. This function allows\\n// that to be increased. Set to zero for unlimited.\\nEventEmitter.prototype.setMaxListeners = function(n) {\\n  if (!isNumber(n) || n < 0 || isNaN(n))\\n    throw TypeError(\\'n must be a positive number\\');\\n  this._maxListeners = n;\\n  return this;\\n};\\n\\nEventEmitter.prototype.emit = function(type) {\\n  var er, handler, len, args, i, listeners;\\n\\n  if (!this._events)\\n    this._events = {};\\n\\n  // If there is no \\'error\\' event listener then throw.\\n  if (type === \\'error\\') {\\n    if (!this._events.error ||\\n        (isObject(this._events.error) && !this._events.error.length)) {\\n      er = arguments[1];\\n      if (er instanceof Error) {\\n        throw er; // Unhandled \\'error\\' event\\n      }\\n      throw TypeError(\\'Uncaught, unspecified \"error\" event.\\');\\n    }\\n  }\\n\\n  handler = this._events[type];\\n\\n  if (isUndefined(handler))\\n    return false;\\n\\n  if (isFunction(handler)) {\\n    switch (arguments.length) {\\n      // fast cases\\n      case 1:\\n        handler.call(this);\\n        break;\\n      case 2:\\n        handler.call(this, arguments[1]);\\n        break;\\n      case 3:\\n        handler.call(this, arguments[1], arguments[2]);\\n        break;\\n      // slower\\n      default:\\n        len = arguments.length;\\n        args = new Array(len - 1);\\n        for (i = 1; i < len; i++)\\n          args[i - 1] = arguments[i];\\n        handler.apply(this, args);\\n    }\\n  } else if (isObject(handler)) {\\n    len = arguments.length;\\n    args = new Array(len - 1);\\n    for (i = 1; i < len; i++)\\n      args[i - 1] = arguments[i];\\n\\n    listeners = handler.slice();\\n    len = listeners.length;\\n    for (i = 0; i < len; i++)\\n      listeners[i].apply(this, args);\\n  }\\n\\n  return true;\\n};\\n\\nEventEmitter.prototype.addListener = function(type, listener) {\\n  var m;\\n\\n  if (!isFunction(listener))\\n    throw TypeError(\\'listener must be a function\\');\\n\\n  if (!this._events)\\n    this._events = {};\\n\\n  // To avoid recursion in the case that type === \"newListener\"! Before\\n  // adding it to the listeners, first emit \"newListener\".\\n  if (this._events.newListener)\\n    this.emit(\\'newListener\\', type,\\n              isFunction(listener.listener) ?\\n              listener.listener : listener);\\n\\n  if (!this._events[type])\\n    // Optimize the case of one listener. Don\\'t need the extra array object.\\n    this._events[type] = listener;\\n  else if (isObject(this._events[type]))\\n    // If we\\'ve already got an array, just append.\\n    this._events[type].push(listener);\\n  else\\n    // Adding the second element, need to change to array.\\n    this._events[type] = [this._events[type], listener];\\n\\n  // Check for listener leak\\n  if (isObject(this._events[type]) && !this._events[type].warned) {\\n    var m;\\n    if (!isUndefined(this._maxListeners)) {\\n      m = this._maxListeners;\\n    } else {\\n      m = EventEmitter.defaultMaxListeners;\\n    }\\n\\n    if (m && m > 0 && this._events[type].length > m) {\\n      this._events[type].warned = true;\\n      console.error(\\'(node) warning: possible EventEmitter memory \\' +\\n                    \\'leak detected. %d listeners added. \\' +\\n                    \\'Use emitter.setMaxListeners() to increase limit.\\',\\n                    this._events[type].length);\\n      if (typeof console.trace === \\'function\\') {\\n        // not supported in IE 10\\n        console.trace();\\n      }\\n    }\\n  }\\n\\n  return this;\\n};\\n\\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\\n\\nEventEmitter.prototype.once = function(type, listener) {\\n  if (!isFunction(listener))\\n    throw TypeError(\\'listener must be a function\\');\\n\\n  var fired = false;\\n\\n  function g() {\\n    this.removeListener(type, g);\\n\\n    if (!fired) {\\n      fired = true;\\n      listener.apply(this, arguments);\\n    }\\n  }\\n\\n  g.listener = listener;\\n  this.on(type, g);\\n\\n  return this;\\n};\\n\\n// emits a \\'removeListener\\' event iff the listener was removed\\nEventEmitter.prototype.removeListener = function(type, listener) {\\n  var list, position, length, i;\\n\\n  if (!isFunction(listener))\\n    throw TypeError(\\'listener must be a function\\');\\n\\n  if (!this._events || !this._events[type])\\n    return this;\\n\\n  list = this._events[type];\\n  length = list.length;\\n  position = -1;\\n\\n  if (list === listener ||\\n      (isFunction(list.listener) && list.listener === listener)) {\\n    delete this._events[type];\\n    if (this._events.removeListener)\\n      this.emit(\\'removeListener\\', type, listener);\\n\\n  } else if (isObject(list)) {\\n    for (i = length; i-- > 0;) {\\n      if (list[i] === listener ||\\n          (list[i].listener && list[i].listener === listener)) {\\n        position = i;\\n        break;\\n      }\\n    }\\n\\n    if (position < 0)\\n      return this;\\n\\n    if (list.length === 1) {\\n      list.length = 0;\\n      delete this._events[type];\\n    } else {\\n      list.splice(position, 1);\\n    }\\n\\n    if (this._events.removeListener)\\n      this.emit(\\'removeListener\\', type, listener);\\n  }\\n\\n  return this;\\n};\\n\\nEventEmitter.prototype.removeAllListeners = function(type) {\\n  var key, listeners;\\n\\n  if (!this._events)\\n    return this;\\n\\n  // not listening for removeListener, no need to emit\\n  if (!this._events.removeListener) {\\n    if (arguments.length === 0)\\n      this._events = {};\\n    else if (this._events[type])\\n      delete this._events[type];\\n    return this;\\n  }\\n\\n  // emit removeListener for all listeners on all events\\n  if (arguments.length === 0) {\\n    for (key in this._events) {\\n      if (key === \\'removeListener\\') continue;\\n      this.removeAllListeners(key);\\n    }\\n    this.removeAllListeners(\\'removeListener\\');\\n    this._events = {};\\n    return this;\\n  }\\n\\n  listeners = this._events[type];\\n\\n  if (isFunction(listeners)) {\\n    this.removeListener(type, listeners);\\n  } else {\\n    // LIFO order\\n    while (listeners.length)\\n      this.removeListener(type, listeners[listeners.length - 1]);\\n  }\\n  delete this._events[type];\\n\\n  return this;\\n};\\n\\nEventEmitter.prototype.listeners = function(type) {\\n  var ret;\\n  if (!this._events || !this._events[type])\\n    ret = [];\\n  else if (isFunction(this._events[type]))\\n    ret = [this._events[type]];\\n  else\\n    ret = this._events[type].slice();\\n  return ret;\\n};\\n\\nEventEmitter.listenerCount = function(emitter, type) {\\n  var ret;\\n  if (!emitter._events || !emitter._events[type])\\n    ret = 0;\\n  else if (isFunction(emitter._events[type]))\\n    ret = 1;\\n  else\\n    ret = emitter._events[type].length;\\n  return ret;\\n};\\n\\nfunction isFunction(arg) {\\n  return typeof arg === \\'function\\';\\n}\\n\\nfunction isNumber(arg) {\\n  return typeof arg === \\'number\\';\\n}\\n\\nfunction isObject(arg) {\\n  return typeof arg === \\'object\\' && arg !== null;\\n}\\n\\nfunction isUndefined(arg) {\\n  return arg === void 0;\\n}\\n\\n},{}],49:[function(require,module,exports){\\n// shim for using process in browser\\n\\nvar process = module.exports = {};\\n\\nprocess.nextTick = (function () {\\n    var canSetImmediate = typeof window !== \\'undefined\\'\\n    && window.setImmediate;\\n    var canPost = typeof window !== \\'undefined\\'\\n    && window.postMessage && window.addEventListener\\n    ;\\n\\n    if (canSetImmediate) {\\n        return function (f) { return window.setImmediate(f) };\\n    }\\n\\n    if (canPost) {\\n        var queue = [];\\n        window.addEventListener(\\'message\\', function (ev) {\\n            var source = ev.source;\\n            if ((source === window || source === null) && ev.data === \\'process-tick\\') {\\n                ev.stopPropagation();\\n                if (queue.length > 0) {\\n                    var fn = queue.shift();\\n                    fn();\\n                }\\n            }\\n        }, true);\\n\\n        return function nextTick(fn) {\\n            queue.push(fn);\\n            window.postMessage(\\'process-tick\\', \\'*\\');\\n        };\\n    }\\n\\n    return function nextTick(fn) {\\n        setTimeout(fn, 0);\\n    };\\n})();\\n\\nprocess.title = \\'browser\\';\\nprocess.browser = true;\\nprocess.env = {};\\nprocess.argv = [];\\n\\nfunction noop() {}\\n\\nprocess.on = noop;\\nprocess.once = noop;\\nprocess.off = noop;\\nprocess.emit = noop;\\n\\nprocess.binding = function (name) {\\n    throw new Error(\\'process.binding is not supported\\');\\n}\\n\\n// TODO(shtylman)\\nprocess.cwd = function () { return \\'/\\' };\\nprocess.chdir = function (dir) {\\n    throw new Error(\\'process.chdir is not supported\\');\\n};\\n\\n},{}],50:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// a duplex stream is just a stream that is both readable and writable.\\n// Since JS doesn\\'t have multiple prototypal inheritance, this class\\n// prototypally inherits from Readable, and then parasitically from\\n// Writable.\\n\\nmodule.exports = Duplex;\\nvar inherits = require(\\'inherits\\');\\nvar setImmediate = require(\\'process/browser.js\\').nextTick;\\nvar Readable = require(\\'./readable.js\\');\\nvar Writable = require(\\'./writable.js\\');\\n\\ninherits(Duplex, Readable);\\n\\nDuplex.prototype.write = Writable.prototype.write;\\nDuplex.prototype.end = Writable.prototype.end;\\nDuplex.prototype._write = Writable.prototype._write;\\n\\nfunction Duplex(options) {\\n  if (!(this instanceof Duplex))\\n    return new Duplex(options);\\n\\n  Readable.call(this, options);\\n  Writable.call(this, options);\\n\\n  if (options && options.readable === false)\\n    this.readable = false;\\n\\n  if (options && options.writable === false)\\n    this.writable = false;\\n\\n  this.allowHalfOpen = true;\\n  if (options && options.allowHalfOpen === false)\\n    this.allowHalfOpen = false;\\n\\n  this.once(\\'end\\', onend);\\n}\\n\\n// the no-half-open enforcer\\nfunction onend() {\\n  // if we allow half-open state, or if the writable side ended,\\n  // then we\\'re ok.\\n  if (this.allowHalfOpen || this._writableState.ended)\\n    return;\\n\\n  // no more data can be written.\\n  // But allow more writes to happen in this tick.\\n  var self = this;\\n  setImmediate(function () {\\n    self.end();\\n  });\\n}\\n\\n},{\"./readable.js\":54,\"./writable.js\":56,\"inherits\":4,\"process/browser.js\":52}],51:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nmodule.exports = Stream;\\n\\nvar EE = require(\\'events\\').EventEmitter;\\nvar inherits = require(\\'inherits\\');\\n\\ninherits(Stream, EE);\\nStream.Readable = require(\\'./readable.js\\');\\nStream.Writable = require(\\'./writable.js\\');\\nStream.Duplex = require(\\'./duplex.js\\');\\nStream.Transform = require(\\'./transform.js\\');\\nStream.PassThrough = require(\\'./passthrough.js\\');\\n\\n// Backwards-compat with node 0.4.x\\nStream.Stream = Stream;\\n\\n\\n\\n// old-style streams.  Note that the pipe method (the only relevant\\n// part of this class) is overridden in the Readable class.\\n\\nfunction Stream() {\\n  EE.call(this);\\n}\\n\\nStream.prototype.pipe = function(dest, options) {\\n  var source = this;\\n\\n  function ondata(chunk) {\\n    if (dest.writable) {\\n      if (false === dest.write(chunk) && source.pause) {\\n        source.pause();\\n      }\\n    }\\n  }\\n\\n  source.on(\\'data\\', ondata);\\n\\n  function ondrain() {\\n    if (source.readable && source.resume) {\\n      source.resume();\\n    }\\n  }\\n\\n  dest.on(\\'drain\\', ondrain);\\n\\n  // If the \\'end\\' option is not supplied, dest.end() will be called when\\n  // source gets the \\'end\\' or \\'close\\' events.  Only dest.end() once.\\n  if (!dest._isStdio && (!options || options.end !== false)) {\\n    source.on(\\'end\\', onend);\\n    source.on(\\'close\\', onclose);\\n  }\\n\\n  var didOnEnd = false;\\n  function onend() {\\n    if (didOnEnd) return;\\n    didOnEnd = true;\\n\\n    dest.end();\\n  }\\n\\n\\n  function onclose() {\\n    if (didOnEnd) return;\\n    didOnEnd = true;\\n\\n    if (typeof dest.destroy === \\'function\\') dest.destroy();\\n  }\\n\\n  // don\\'t leave dangling pipes when there are errors.\\n  function onerror(er) {\\n    cleanup();\\n    if (EE.listenerCount(this, \\'error\\') === 0) {\\n      throw er; // Unhandled stream error in pipe.\\n    }\\n  }\\n\\n  source.on(\\'error\\', onerror);\\n  dest.on(\\'error\\', onerror);\\n\\n  // remove all the event listeners that were added.\\n  function cleanup() {\\n    source.removeListener(\\'data\\', ondata);\\n    dest.removeListener(\\'drain\\', ondrain);\\n\\n    source.removeListener(\\'end\\', onend);\\n    source.removeListener(\\'close\\', onclose);\\n\\n    source.removeListener(\\'error\\', onerror);\\n    dest.removeListener(\\'error\\', onerror);\\n\\n    source.removeListener(\\'end\\', cleanup);\\n    source.removeListener(\\'close\\', cleanup);\\n\\n    dest.removeListener(\\'close\\', cleanup);\\n  }\\n\\n  source.on(\\'end\\', cleanup);\\n  source.on(\\'close\\', cleanup);\\n\\n  dest.on(\\'close\\', cleanup);\\n\\n  dest.emit(\\'pipe\\', source);\\n\\n  // Allow for unix-like usage: A.pipe(B).pipe(C)\\n  return dest;\\n};\\n\\n},{\"./duplex.js\":50,\"./passthrough.js\":53,\"./readable.js\":54,\"./transform.js\":55,\"./writable.js\":56,\"events\":48,\"inherits\":4}],52:[function(require,module,exports){\\n// shim for using process in browser\\n\\nvar process = module.exports = {};\\n\\nprocess.nextTick = (function () {\\n    var canSetImmediate = typeof window !== \\'undefined\\'\\n    && window.setImmediate;\\n    var canPost = typeof window !== \\'undefined\\'\\n    && window.postMessage && window.addEventListener\\n    ;\\n\\n    if (canSetImmediate) {\\n        return function (f) { return window.setImmediate(f) };\\n    }\\n\\n    if (canPost) {\\n        var queue = [];\\n        window.addEventListener(\\'message\\', function (ev) {\\n            var source = ev.source;\\n            if ((source === window || source === null) && ev.data === \\'process-tick\\') {\\n                ev.stopPropagation();\\n                if (queue.length > 0) {\\n                    var fn = queue.shift();\\n                    fn();\\n                }\\n            }\\n        }, true);\\n\\n        return function nextTick(fn) {\\n            queue.push(fn);\\n            window.postMessage(\\'process-tick\\', \\'*\\');\\n        };\\n    }\\n\\n    return function nextTick(fn) {\\n        setTimeout(fn, 0);\\n    };\\n})();\\n\\nprocess.title = \\'browser\\';\\nprocess.browser = true;\\nprocess.env = {};\\nprocess.argv = [];\\n\\nprocess.binding = function (name) {\\n    throw new Error(\\'process.binding is not supported\\');\\n}\\n\\n// TODO(shtylman)\\nprocess.cwd = function () { return \\'/\\' };\\nprocess.chdir = function (dir) {\\n    throw new Error(\\'process.chdir is not supported\\');\\n};\\n\\n},{}],53:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// a passthrough stream.\\n// basically just the most minimal sort of Transform stream.\\n// Every written chunk gets output as-is.\\n\\nmodule.exports = PassThrough;\\n\\nvar Transform = require(\\'./transform.js\\');\\nvar inherits = require(\\'inherits\\');\\ninherits(PassThrough, Transform);\\n\\nfunction PassThrough(options) {\\n  if (!(this instanceof PassThrough))\\n    return new PassThrough(options);\\n\\n  Transform.call(this, options);\\n}\\n\\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\\n  cb(null, chunk);\\n};\\n\\n},{\"./transform.js\":55,\"inherits\":4}],54:[function(require,module,exports){\\n(function (process){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nmodule.exports = Readable;\\nReadable.ReadableState = ReadableState;\\n\\nvar EE = require(\\'events\\').EventEmitter;\\nvar Stream = require(\\'./index.js\\');\\nvar Buffer = require(\\'buffer\\').Buffer;\\nvar setImmediate = require(\\'process/browser.js\\').nextTick;\\nvar StringDecoder;\\n\\nvar inherits = require(\\'inherits\\');\\ninherits(Readable, Stream);\\n\\nfunction ReadableState(options, stream) {\\n  options = options || {};\\n\\n  // the point at which it stops calling _read() to fill the buffer\\n  // Note: 0 is a valid value, means \"don\\'t call _read preemptively ever\"\\n  var hwm = options.highWaterMark;\\n  this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\\n\\n  // cast to ints.\\n  this.highWaterMark = ~~this.highWaterMark;\\n\\n  this.buffer = [];\\n  this.length = 0;\\n  this.pipes = null;\\n  this.pipesCount = 0;\\n  this.flowing = false;\\n  this.ended = false;\\n  this.endEmitted = false;\\n  this.reading = false;\\n\\n  // In streams that never have any data, and do push(null) right away,\\n  // the consumer can miss the \\'end\\' event if they do some I/O before\\n  // consuming the stream.  So, we don\\'t emit(\\'end\\') until some reading\\n  // happens.\\n  this.calledRead = false;\\n\\n  // a flag to be able to tell if the onwrite cb is called immediately,\\n  // or on a later tick.  We set this to true at first, becuase any\\n  // actions that shouldn\\'t happen until \"later\" should generally also\\n  // not happen before the first write call.\\n  this.sync = true;\\n\\n  // whenever we return null, then we set a flag to say\\n  // that we\\'re awaiting a \\'readable\\' event emission.\\n  this.needReadable = false;\\n  this.emittedReadable = false;\\n  this.readableListening = false;\\n\\n\\n  // object stream flag. Used to make read(n) ignore n and to\\n  // make all the buffer merging and length checks go away\\n  this.objectMode = !!options.objectMode;\\n\\n  // Crypto is kind of old and crusty.  Historically, its default string\\n  // encoding is \\'binary\\' so we have to make this configurable.\\n  // Everything else in the universe uses \\'utf8\\', though.\\n  this.defaultEncoding = options.defaultEncoding || \\'utf8\\';\\n\\n  // when piping, we only care about \\'readable\\' events that happen\\n  // after read()ing all the bytes and not getting any pushback.\\n  this.ranOut = false;\\n\\n  // the number of writers that are awaiting a drain event in .pipe()s\\n  this.awaitDrain = 0;\\n\\n  // if true, a maybeReadMore has been scheduled\\n  this.readingMore = false;\\n\\n  this.decoder = null;\\n  this.encoding = null;\\n  if (options.encoding) {\\n    if (!StringDecoder)\\n      StringDecoder = require(\\'string_decoder\\').StringDecoder;\\n    this.decoder = new StringDecoder(options.encoding);\\n    this.encoding = options.encoding;\\n  }\\n}\\n\\nfunction Readable(options) {\\n  if (!(this instanceof Readable))\\n    return new Readable(options);\\n\\n  this._readableState = new ReadableState(options, this);\\n\\n  // legacy\\n  this.readable = true;\\n\\n  Stream.call(this);\\n}\\n\\n// Manually shove something into the read() buffer.\\n// This returns true if the highWaterMark has not been hit yet,\\n// similar to how Writable.write() returns true if you should\\n// write() some more.\\nReadable.prototype.push = function(chunk, encoding) {\\n  var state = this._readableState;\\n\\n  if (typeof chunk === \\'string\\' && !state.objectMode) {\\n    encoding = encoding || state.defaultEncoding;\\n    if (encoding !== state.encoding) {\\n      chunk = new Buffer(chunk, encoding);\\n      encoding = \\'\\';\\n    }\\n  }\\n\\n  return readableAddChunk(this, state, chunk, encoding, false);\\n};\\n\\n// Unshift should *always* be something directly out of read()\\nReadable.prototype.unshift = function(chunk) {\\n  var state = this._readableState;\\n  return readableAddChunk(this, state, chunk, \\'\\', true);\\n};\\n\\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\\n  var er = chunkInvalid(state, chunk);\\n  if (er) {\\n    stream.emit(\\'error\\', er);\\n  } else if (chunk === null || chunk === undefined) {\\n    state.reading = false;\\n    if (!state.ended)\\n      onEofChunk(stream, state);\\n  } else if (state.objectMode || chunk && chunk.length > 0) {\\n    if (state.ended && !addToFront) {\\n      var e = new Error(\\'stream.push() after EOF\\');\\n      stream.emit(\\'error\\', e);\\n    } else if (state.endEmitted && addToFront) {\\n      var e = new Error(\\'stream.unshift() after end event\\');\\n      stream.emit(\\'error\\', e);\\n    } else {\\n      if (state.decoder && !addToFront && !encoding)\\n        chunk = state.decoder.write(chunk);\\n\\n      // update the buffer info.\\n      state.length += state.objectMode ? 1 : chunk.length;\\n      if (addToFront) {\\n        state.buffer.unshift(chunk);\\n      } else {\\n        state.reading = false;\\n        state.buffer.push(chunk);\\n      }\\n\\n      if (state.needReadable)\\n        emitReadable(stream);\\n\\n      maybeReadMore(stream, state);\\n    }\\n  } else if (!addToFront) {\\n    state.reading = false;\\n  }\\n\\n  return needMoreData(state);\\n}\\n\\n\\n\\n// if it\\'s past the high water mark, we can push in some more.\\n// Also, if we have no data yet, we can stand some\\n// more bytes.  This is to work around cases where hwm=0,\\n// such as the repl.  Also, if the push() triggered a\\n// readable event, and the user called read(largeNumber) such that\\n// needReadable was set, then we ought to push more, so that another\\n// \\'readable\\' event will be triggered.\\nfunction needMoreData(state) {\\n  return !state.ended &&\\n         (state.needReadable ||\\n          state.length < state.highWaterMark ||\\n          state.length === 0);\\n}\\n\\n// backwards compatibility.\\nReadable.prototype.setEncoding = function(enc) {\\n  if (!StringDecoder)\\n    StringDecoder = require(\\'string_decoder\\').StringDecoder;\\n  this._readableState.decoder = new StringDecoder(enc);\\n  this._readableState.encoding = enc;\\n};\\n\\n// Don\\'t raise the hwm > 128MB\\nvar MAX_HWM = 0x800000;\\nfunction roundUpToNextPowerOf2(n) {\\n  if (n >= MAX_HWM) {\\n    n = MAX_HWM;\\n  } else {\\n    // Get the next highest power of 2\\n    n--;\\n    for (var p = 1; p < 32; p <<= 1) n |= n >> p;\\n    n++;\\n  }\\n  return n;\\n}\\n\\nfunction howMuchToRead(n, state) {\\n  if (state.length === 0 && state.ended)\\n    return 0;\\n\\n  if (state.objectMode)\\n    return n === 0 ? 0 : 1;\\n\\n  if (isNaN(n) || n === null) {\\n    // only flow one buffer at a time\\n    if (state.flowing && state.buffer.length)\\n      return state.buffer[0].length;\\n    else\\n      return state.length;\\n  }\\n\\n  if (n <= 0)\\n    return 0;\\n\\n  // If we\\'re asking for more than the target buffer level,\\n  // then raise the water mark.  Bump up to the next highest\\n  // power of 2, to prevent increasing it excessively in tiny\\n  // amounts.\\n  if (n > state.highWaterMark)\\n    state.highWaterMark = roundUpToNextPowerOf2(n);\\n\\n  // don\\'t have that much.  return null, unless we\\'ve ended.\\n  if (n > state.length) {\\n    if (!state.ended) {\\n      state.needReadable = true;\\n      return 0;\\n    } else\\n      return state.length;\\n  }\\n\\n  return n;\\n}\\n\\n// you can override either this method, or the async _read(n) below.\\nReadable.prototype.read = function(n) {\\n  var state = this._readableState;\\n  state.calledRead = true;\\n  var nOrig = n;\\n\\n  if (typeof n !== \\'number\\' || n > 0)\\n    state.emittedReadable = false;\\n\\n  // if we\\'re doing read(0) to trigger a readable event, but we\\n  // already have a bunch of data in the buffer, then just trigger\\n  // the \\'readable\\' event and move on.\\n  if (n === 0 &&\\n      state.needReadable &&\\n      (state.length >= state.highWaterMark || state.ended)) {\\n    emitReadable(this);\\n    return null;\\n  }\\n\\n  n = howMuchToRead(n, state);\\n\\n  // if we\\'ve ended, and we\\'re now clear, then finish it up.\\n  if (n === 0 && state.ended) {\\n    if (state.length === 0)\\n      endReadable(this);\\n    return null;\\n  }\\n\\n  // All the actual chunk generation logic needs to be\\n  // *below* the call to _read.  The reason is that in certain\\n  // synthetic stream cases, such as passthrough streams, _read\\n  // may be a completely synchronous operation which may change\\n  // the state of the read buffer, providing enough data when\\n  // before there was *not* enough.\\n  //\\n  // So, the steps are:\\n  // 1. Figure out what the state of things will be after we do\\n  // a read from the buffer.\\n  //\\n  // 2. If that resulting state will trigger a _read, then call _read.\\n  // Note that this may be asynchronous, or synchronous.  Yes, it is\\n  // deeply ugly to write APIs this way, but that still doesn\\'t mean\\n  // that the Readable class should behave improperly, as streams are\\n  // designed to be sync/async agnostic.\\n  // Take note if the _read call is sync or async (ie, if the read call\\n  // has returned yet), so that we know whether or not it\\'s safe to emit\\n  // \\'readable\\' etc.\\n  //\\n  // 3. Actually pull the requested chunks out of the buffer and return.\\n\\n  // if we need a readable event, then we need to do some reading.\\n  var doRead = state.needReadable;\\n\\n  // if we currently have less than the highWaterMark, then also read some\\n  if (state.length - n <= state.highWaterMark)\\n    doRead = true;\\n\\n  // however, if we\\'ve ended, then there\\'s no point, and if we\\'re already\\n  // reading, then it\\'s unnecessary.\\n  if (state.ended || state.reading)\\n    doRead = false;\\n\\n  if (doRead) {\\n    state.reading = true;\\n    state.sync = true;\\n    // if the length is currently zero, then we *need* a readable event.\\n    if (state.length === 0)\\n      state.needReadable = true;\\n    // call internal read method\\n    this._read(state.highWaterMark);\\n    state.sync = false;\\n  }\\n\\n  // If _read called its callback synchronously, then `reading`\\n  // will be false, and we need to re-evaluate how much data we\\n  // can return to the user.\\n  if (doRead && !state.reading)\\n    n = howMuchToRead(nOrig, state);\\n\\n  var ret;\\n  if (n > 0)\\n    ret = fromList(n, state);\\n  else\\n    ret = null;\\n\\n  if (ret === null) {\\n    state.needReadable = true;\\n    n = 0;\\n  }\\n\\n  state.length -= n;\\n\\n  // If we have nothing in the buffer, then we want to know\\n  // as soon as we *do* get something into the buffer.\\n  if (state.length === 0 && !state.ended)\\n    state.needReadable = true;\\n\\n  // If we happened to read() exactly the remaining amount in the\\n  // buffer, and the EOF has been seen at this point, then make sure\\n  // that we emit \\'end\\' on the very next tick.\\n  if (state.ended && !state.endEmitted && state.length === 0)\\n    endReadable(this);\\n\\n  return ret;\\n};\\n\\nfunction chunkInvalid(state, chunk) {\\n  var er = null;\\n  if (!Buffer.isBuffer(chunk) &&\\n      \\'string\\' !== typeof chunk &&\\n      chunk !== null &&\\n      chunk !== undefined &&\\n      !state.objectMode &&\\n      !er) {\\n    er = new TypeError(\\'Invalid non-string/buffer chunk\\');\\n  }\\n  return er;\\n}\\n\\n\\nfunction onEofChunk(stream, state) {\\n  if (state.decoder && !state.ended) {\\n    var chunk = state.decoder.end();\\n    if (chunk && chunk.length) {\\n      state.buffer.push(chunk);\\n      state.length += state.objectMode ? 1 : chunk.length;\\n    }\\n  }\\n  state.ended = true;\\n\\n  // if we\\'ve ended and we have some data left, then emit\\n  // \\'readable\\' now to make sure it gets picked up.\\n  if (state.length > 0)\\n    emitReadable(stream);\\n  else\\n    endReadable(stream);\\n}\\n\\n// Don\\'t emit readable right away in sync mode, because this can trigger\\n// another read() call => stack overflow.  This way, it might trigger\\n// a nextTick recursion warning, but that\\'s not so bad.\\nfunction emitReadable(stream) {\\n  var state = stream._readableState;\\n  state.needReadable = false;\\n  if (state.emittedReadable)\\n    return;\\n\\n  state.emittedReadable = true;\\n  if (state.sync)\\n    setImmediate(function() {\\n      emitReadable_(stream);\\n    });\\n  else\\n    emitReadable_(stream);\\n}\\n\\nfunction emitReadable_(stream) {\\n  stream.emit(\\'readable\\');\\n}\\n\\n\\n// at this point, the user has presumably seen the \\'readable\\' event,\\n// and called read() to consume some data.  that may have triggered\\n// in turn another _read(n) call, in which case reading = true if\\n// it\\'s in progress.\\n// However, if we\\'re not ended, or reading, and the length < hwm,\\n// then go ahead and try to read some more preemptively.\\nfunction maybeReadMore(stream, state) {\\n  if (!state.readingMore) {\\n    state.readingMore = true;\\n    setImmediate(function() {\\n      maybeReadMore_(stream, state);\\n    });\\n  }\\n}\\n\\nfunction maybeReadMore_(stream, state) {\\n  var len = state.length;\\n  while (!state.reading && !state.flowing && !state.ended &&\\n         state.length < state.highWaterMark) {\\n    stream.read(0);\\n    if (len === state.length)\\n      // didn\\'t get any data, stop spinning.\\n      break;\\n    else\\n      len = state.length;\\n  }\\n  state.readingMore = false;\\n}\\n\\n// abstract method.  to be overridden in specific implementation classes.\\n// call cb(er, data) where data is <= n in length.\\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\\n// arbitrary, and perhaps not very meaningful.\\nReadable.prototype._read = function(n) {\\n  this.emit(\\'error\\', new Error(\\'not implemented\\'));\\n};\\n\\nReadable.prototype.pipe = function(dest, pipeOpts) {\\n  var src = this;\\n  var state = this._readableState;\\n\\n  switch (state.pipesCount) {\\n    case 0:\\n      state.pipes = dest;\\n      break;\\n    case 1:\\n      state.pipes = [state.pipes, dest];\\n      break;\\n    default:\\n      state.pipes.push(dest);\\n      break;\\n  }\\n  state.pipesCount += 1;\\n\\n  var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\\n              dest !== process.stdout &&\\n              dest !== process.stderr;\\n\\n  var endFn = doEnd ? onend : cleanup;\\n  if (state.endEmitted)\\n    setImmediate(endFn);\\n  else\\n    src.once(\\'end\\', endFn);\\n\\n  dest.on(\\'unpipe\\', onunpipe);\\n  function onunpipe(readable) {\\n    if (readable !== src) return;\\n    cleanup();\\n  }\\n\\n  function onend() {\\n    dest.end();\\n  }\\n\\n  // when the dest drains, it reduces the awaitDrain counter\\n  // on the source.  This would be more elegant with a .once()\\n  // handler in flow(), but adding and removing repeatedly is\\n  // too slow.\\n  var ondrain = pipeOnDrain(src);\\n  dest.on(\\'drain\\', ondrain);\\n\\n  function cleanup() {\\n    // cleanup event handlers once the pipe is broken\\n    dest.removeListener(\\'close\\', onclose);\\n    dest.removeListener(\\'finish\\', onfinish);\\n    dest.removeListener(\\'drain\\', ondrain);\\n    dest.removeListener(\\'error\\', onerror);\\n    dest.removeListener(\\'unpipe\\', onunpipe);\\n    src.removeListener(\\'end\\', onend);\\n    src.removeListener(\\'end\\', cleanup);\\n\\n    // if the reader is waiting for a drain event from this\\n    // specific writer, then it would cause it to never start\\n    // flowing again.\\n    // So, if this is awaiting a drain, then we just call it now.\\n    // If we don\\'t know, then assume that we are waiting for one.\\n    if (!dest._writableState || dest._writableState.needDrain)\\n      ondrain();\\n  }\\n\\n  // if the dest has an error, then stop piping into it.\\n  // however, don\\'t suppress the throwing behavior for this.\\n  // check for listeners before emit removes one-time listeners.\\n  var errListeners = EE.listenerCount(dest, \\'error\\');\\n  function onerror(er) {\\n    unpipe();\\n    if (errListeners === 0 && EE.listenerCount(dest, \\'error\\') === 0)\\n      dest.emit(\\'error\\', er);\\n  }\\n  dest.once(\\'error\\', onerror);\\n\\n  // Both close and finish should trigger unpipe, but only once.\\n  function onclose() {\\n    dest.removeListener(\\'finish\\', onfinish);\\n    unpipe();\\n  }\\n  dest.once(\\'close\\', onclose);\\n  function onfinish() {\\n    dest.removeListener(\\'close\\', onclose);\\n    unpipe();\\n  }\\n  dest.once(\\'finish\\', onfinish);\\n\\n  function unpipe() {\\n    src.unpipe(dest);\\n  }\\n\\n  // tell the dest that it\\'s being piped to\\n  dest.emit(\\'pipe\\', src);\\n\\n  // start the flow if it hasn\\'t been started already.\\n  if (!state.flowing) {\\n    // the handler that waits for readable events after all\\n    // the data gets sucked out in flow.\\n    // This would be easier to follow with a .once() handler\\n    // in flow(), but that is too slow.\\n    this.on(\\'readable\\', pipeOnReadable);\\n\\n    state.flowing = true;\\n    setImmediate(function() {\\n      flow(src);\\n    });\\n  }\\n\\n  return dest;\\n};\\n\\nfunction pipeOnDrain(src) {\\n  return function() {\\n    var dest = this;\\n    var state = src._readableState;\\n    state.awaitDrain--;\\n    if (state.awaitDrain === 0)\\n      flow(src);\\n  };\\n}\\n\\nfunction flow(src) {\\n  var state = src._readableState;\\n  var chunk;\\n  state.awaitDrain = 0;\\n\\n  function write(dest, i, list) {\\n    var written = dest.write(chunk);\\n    if (false === written) {\\n      state.awaitDrain++;\\n    }\\n  }\\n\\n  while (state.pipesCount && null !== (chunk = src.read())) {\\n\\n    if (state.pipesCount === 1)\\n      write(state.pipes, 0, null);\\n    else\\n      forEach(state.pipes, write);\\n\\n    src.emit(\\'data\\', chunk);\\n\\n    // if anyone needs a drain, then we have to wait for that.\\n    if (state.awaitDrain > 0)\\n      return;\\n  }\\n\\n  // if every destination was unpiped, either before entering this\\n  // function, or in the while loop, then stop flowing.\\n  //\\n  // NB: This is a pretty rare edge case.\\n  if (state.pipesCount === 0) {\\n    state.flowing = false;\\n\\n    // if there were data event listeners added, then switch to old mode.\\n    if (EE.listenerCount(src, \\'data\\') > 0)\\n      emitDataEvents(src);\\n    return;\\n  }\\n\\n  // at this point, no one needed a drain, so we just ran out of data\\n  // on the next readable event, start it over again.\\n  state.ranOut = true;\\n}\\n\\nfunction pipeOnReadable() {\\n  if (this._readableState.ranOut) {\\n    this._readableState.ranOut = false;\\n    flow(this);\\n  }\\n}\\n\\n\\nReadable.prototype.unpipe = function(dest) {\\n  var state = this._readableState;\\n\\n  // if we\\'re not piping anywhere, then do nothing.\\n  if (state.pipesCount === 0)\\n    return this;\\n\\n  // just one destination.  most common case.\\n  if (state.pipesCount === 1) {\\n    // passed in one, but it\\'s not the right one.\\n    if (dest && dest !== state.pipes)\\n      return this;\\n\\n    if (!dest)\\n      dest = state.pipes;\\n\\n    // got a match.\\n    state.pipes = null;\\n    state.pipesCount = 0;\\n    this.removeListener(\\'readable\\', pipeOnReadable);\\n    state.flowing = false;\\n    if (dest)\\n      dest.emit(\\'unpipe\\', this);\\n    return this;\\n  }\\n\\n  // slow case. multiple pipe destinations.\\n\\n  if (!dest) {\\n    // remove all.\\n    var dests = state.pipes;\\n    var len = state.pipesCount;\\n    state.pipes = null;\\n    state.pipesCount = 0;\\n    this.removeListener(\\'readable\\', pipeOnReadable);\\n    state.flowing = false;\\n\\n    for (var i = 0; i < len; i++)\\n      dests[i].emit(\\'unpipe\\', this);\\n    return this;\\n  }\\n\\n  // try to find the right one.\\n  var i = indexOf(state.pipes, dest);\\n  if (i === -1)\\n    return this;\\n\\n  state.pipes.splice(i, 1);\\n  state.pipesCount -= 1;\\n  if (state.pipesCount === 1)\\n    state.pipes = state.pipes[0];\\n\\n  dest.emit(\\'unpipe\\', this);\\n\\n  return this;\\n};\\n\\n// set up data events if they are asked for\\n// Ensure readable listeners eventually get something\\nReadable.prototype.on = function(ev, fn) {\\n  var res = Stream.prototype.on.call(this, ev, fn);\\n\\n  if (ev === \\'data\\' && !this._readableState.flowing)\\n    emitDataEvents(this);\\n\\n  if (ev === \\'readable\\' && this.readable) {\\n    var state = this._readableState;\\n    if (!state.readableListening) {\\n      state.readableListening = true;\\n      state.emittedReadable = false;\\n      state.needReadable = true;\\n      if (!state.reading) {\\n        this.read(0);\\n      } else if (state.length) {\\n        emitReadable(this, state);\\n      }\\n    }\\n  }\\n\\n  return res;\\n};\\nReadable.prototype.addListener = Readable.prototype.on;\\n\\n// pause() and resume() are remnants of the legacy readable stream API\\n// If the user uses them, then switch into old mode.\\nReadable.prototype.resume = function() {\\n  emitDataEvents(this);\\n  this.read(0);\\n  this.emit(\\'resume\\');\\n};\\n\\nReadable.prototype.pause = function() {\\n  emitDataEvents(this, true);\\n  this.emit(\\'pause\\');\\n};\\n\\nfunction emitDataEvents(stream, startPaused) {\\n  var state = stream._readableState;\\n\\n  if (state.flowing) {\\n    // https://github.com/isaacs/readable-stream/issues/16\\n    throw new Error(\\'Cannot switch to old mode now.\\');\\n  }\\n\\n  var paused = startPaused || false;\\n  var readable = false;\\n\\n  // convert to an old-style stream.\\n  stream.readable = true;\\n  stream.pipe = Stream.prototype.pipe;\\n  stream.on = stream.addListener = Stream.prototype.on;\\n\\n  stream.on(\\'readable\\', function() {\\n    readable = true;\\n\\n    var c;\\n    while (!paused && (null !== (c = stream.read())))\\n      stream.emit(\\'data\\', c);\\n\\n    if (c === null) {\\n      readable = false;\\n      stream._readableState.needReadable = true;\\n    }\\n  });\\n\\n  stream.pause = function() {\\n    paused = true;\\n    this.emit(\\'pause\\');\\n  };\\n\\n  stream.resume = function() {\\n    paused = false;\\n    if (readable)\\n      setImmediate(function() {\\n        stream.emit(\\'readable\\');\\n      });\\n    else\\n      this.read(0);\\n    this.emit(\\'resume\\');\\n  };\\n\\n  // now make it start, just in case it hadn\\'t already.\\n  stream.emit(\\'readable\\');\\n}\\n\\n// wrap an old-style stream as the async data source.\\n// This is *not* part of the readable stream interface.\\n// It is an ugly unfortunate mess of history.\\nReadable.prototype.wrap = function(stream) {\\n  var state = this._readableState;\\n  var paused = false;\\n\\n  var self = this;\\n  stream.on(\\'end\\', function() {\\n    if (state.decoder && !state.ended) {\\n      var chunk = state.decoder.end();\\n      if (chunk && chunk.length)\\n        self.push(chunk);\\n    }\\n\\n    self.push(null);\\n  });\\n\\n  stream.on(\\'data\\', function(chunk) {\\n    if (state.decoder)\\n      chunk = state.decoder.write(chunk);\\n    if (!chunk || !state.objectMode && !chunk.length)\\n      return;\\n\\n    var ret = self.push(chunk);\\n    if (!ret) {\\n      paused = true;\\n      stream.pause();\\n    }\\n  });\\n\\n  // proxy all the other methods.\\n  // important when wrapping filters and duplexes.\\n  for (var i in stream) {\\n    if (typeof stream[i] === \\'function\\' &&\\n        typeof this[i] === \\'undefined\\') {\\n      this[i] = function(method) { return function() {\\n        return stream[method].apply(stream, arguments);\\n      }}(i);\\n    }\\n  }\\n\\n  // proxy certain important events.\\n  var events = [\\'error\\', \\'close\\', \\'destroy\\', \\'pause\\', \\'resume\\'];\\n  forEach(events, function(ev) {\\n    stream.on(ev, function (x) {\\n      return self.emit.apply(self, ev, x);\\n    });\\n  });\\n\\n  // when we try to consume some more bytes, simply unpause the\\n  // underlying stream.\\n  self._read = function(n) {\\n    if (paused) {\\n      paused = false;\\n      stream.resume();\\n    }\\n  };\\n\\n  return self;\\n};\\n\\n\\n\\n// exposed for testing purposes only.\\nReadable._fromList = fromList;\\n\\n// Pluck off n bytes from an array of buffers.\\n// Length is the combined lengths of all the buffers in the list.\\nfunction fromList(n, state) {\\n  var list = state.buffer;\\n  var length = state.length;\\n  var stringMode = !!state.decoder;\\n  var objectMode = !!state.objectMode;\\n  var ret;\\n\\n  // nothing in the list, definitely empty.\\n  if (list.length === 0)\\n    return null;\\n\\n  if (length === 0)\\n    ret = null;\\n  else if (objectMode)\\n    ret = list.shift();\\n  else if (!n || n >= length) {\\n    // read it all, truncate the array.\\n    if (stringMode)\\n      ret = list.join(\\'\\');\\n    else\\n      ret = Buffer.concat(list, length);\\n    list.length = 0;\\n  } else {\\n    // read just some of it.\\n    if (n < list[0].length) {\\n      // just take a part of the first list item.\\n      // slice is the same for buffers and strings.\\n      var buf = list[0];\\n      ret = buf.slice(0, n);\\n      list[0] = buf.slice(n);\\n    } else if (n === list[0].length) {\\n      // first list is a perfect match\\n      ret = list.shift();\\n    } else {\\n      // complex case.\\n      // we have enough to cover it, but it spans past the first buffer.\\n      if (stringMode)\\n        ret = \\'\\';\\n      else\\n        ret = new Buffer(n);\\n\\n      var c = 0;\\n      for (var i = 0, l = list.length; i < l && c < n; i++) {\\n        var buf = list[0];\\n        var cpy = Math.min(n - c, buf.length);\\n\\n        if (stringMode)\\n          ret += buf.slice(0, cpy);\\n        else\\n          buf.copy(ret, c, 0, cpy);\\n\\n        if (cpy < buf.length)\\n          list[0] = buf.slice(cpy);\\n        else\\n          list.shift();\\n\\n        c += cpy;\\n      }\\n    }\\n  }\\n\\n  return ret;\\n}\\n\\nfunction endReadable(stream) {\\n  var state = stream._readableState;\\n\\n  // If we get here before consuming all the bytes, then that is a\\n  // bug in node.  Should never happen.\\n  if (state.length > 0)\\n    throw new Error(\\'endReadable called on non-empty stream\\');\\n\\n  if (!state.endEmitted && state.calledRead) {\\n    state.ended = true;\\n    setImmediate(function() {\\n      // Check that we didn\\'t get one last unshift.\\n      if (!state.endEmitted && state.length === 0) {\\n        state.endEmitted = true;\\n        stream.readable = false;\\n        stream.emit(\\'end\\');\\n      }\\n    });\\n  }\\n}\\n\\nfunction forEach (xs, f) {\\n  for (var i = 0, l = xs.length; i < l; i++) {\\n    f(xs[i], i);\\n  }\\n}\\n\\nfunction indexOf (xs, x) {\\n  for (var i = 0, l = xs.length; i < l; i++) {\\n    if (xs[i] === x) return i;\\n  }\\n  return -1;\\n}\\n\\n}).call(this,require(\"/Users/kraftwerk-mb/dev/projects/usco/usco-3mf-parser/node_modules/workerify/node_modules/process/browser.js\"))\\n},{\"./index.js\":51,\"/Users/kraftwerk-mb/dev/projects/usco/usco-3mf-parser/node_modules/workerify/node_modules/process/browser.js\":49,\"buffer\":47,\"events\":48,\"inherits\":4,\"process/browser.js\":52,\"string_decoder\":57}],55:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// a transform stream is a readable/writable stream where you do\\n// something with the data.  Sometimes it\\'s called a \"filter\",\\n// but that\\'s not a great name for it, since that implies a thing where\\n// some bits pass through, and others are simply ignored.  (That would\\n// be a valid example of a transform, of course.)\\n//\\n// While the output is causally related to the input, it\\'s not a\\n// necessarily symmetric or synchronous transformation.  For example,\\n// a zlib stream might take multiple plain-text writes(), and then\\n// emit a single compressed chunk some time in the future.\\n//\\n// Here\\'s how this works:\\n//\\n// The Transform stream has all the aspects of the readable and writable\\n// stream classes.  When you write(chunk), that calls _write(chunk,cb)\\n// internally, and returns false if there\\'s a lot of pending writes\\n// buffered up.  When you call read(), that calls _read(n) until\\n// there\\'s enough pending readable data buffered up.\\n//\\n// In a transform stream, the written data is placed in a buffer.  When\\n// _read(n) is called, it transforms the queued up data, calling the\\n// buffered _write cb\\'s as it consumes chunks.  If consuming a single\\n// written chunk would result in multiple output chunks, then the first\\n// outputted bit calls the readcb, and subsequent chunks just go into\\n// the read buffer, and will cause it to emit \\'readable\\' if necessary.\\n//\\n// This way, back-pressure is actually determined by the reading side,\\n// since _read has to be called to start processing a new chunk.  However,\\n// a pathological inflate type of transform can cause excessive buffering\\n// here.  For example, imagine a stream where every byte of input is\\n// interpreted as an integer from 0-255, and then results in that many\\n// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in\\n// 1kb of data being output.  In this case, you could write a very small\\n// amount of input, and end up with a very large amount of output.  In\\n// such a pathological inflating mechanism, there\\'d be no way to tell\\n// the system to stop doing the transform.  A single 4MB write could\\n// cause the system to run out of memory.\\n//\\n// However, even in such a pathological case, only a single written chunk\\n// would be consumed, and then the rest would wait (un-transformed) until\\n// the results of the previous transformed chunk were consumed.\\n\\nmodule.exports = Transform;\\n\\nvar Duplex = require(\\'./duplex.js\\');\\nvar inherits = require(\\'inherits\\');\\ninherits(Transform, Duplex);\\n\\n\\nfunction TransformState(options, stream) {\\n  this.afterTransform = function(er, data) {\\n    return afterTransform(stream, er, data);\\n  };\\n\\n  this.needTransform = false;\\n  this.transforming = false;\\n  this.writecb = null;\\n  this.writechunk = null;\\n}\\n\\nfunction afterTransform(stream, er, data) {\\n  var ts = stream._transformState;\\n  ts.transforming = false;\\n\\n  var cb = ts.writecb;\\n\\n  if (!cb)\\n    return stream.emit(\\'error\\', new Error(\\'no writecb in Transform class\\'));\\n\\n  ts.writechunk = null;\\n  ts.writecb = null;\\n\\n  if (data !== null && data !== undefined)\\n    stream.push(data);\\n\\n  if (cb)\\n    cb(er);\\n\\n  var rs = stream._readableState;\\n  rs.reading = false;\\n  if (rs.needReadable || rs.length < rs.highWaterMark) {\\n    stream._read(rs.highWaterMark);\\n  }\\n}\\n\\n\\nfunction Transform(options) {\\n  if (!(this instanceof Transform))\\n    return new Transform(options);\\n\\n  Duplex.call(this, options);\\n\\n  var ts = this._transformState = new TransformState(options, this);\\n\\n  // when the writable side finishes, then flush out anything remaining.\\n  var stream = this;\\n\\n  // start out asking for a readable event once data is transformed.\\n  this._readableState.needReadable = true;\\n\\n  // we have implemented the _read method, and done the other things\\n  // that Readable wants before the first _read call, so unset the\\n  // sync guard flag.\\n  this._readableState.sync = false;\\n\\n  this.once(\\'finish\\', function() {\\n    if (\\'function\\' === typeof this._flush)\\n      this._flush(function(er) {\\n        done(stream, er);\\n      });\\n    else\\n      done(stream);\\n  });\\n}\\n\\nTransform.prototype.push = function(chunk, encoding) {\\n  this._transformState.needTransform = false;\\n  return Duplex.prototype.push.call(this, chunk, encoding);\\n};\\n\\n// This is the part where you do stuff!\\n// override this function in implementation classes.\\n// \\'chunk\\' is an input chunk.\\n//\\n// Call `push(newChunk)` to pass along transformed output\\n// to the readable side.  You may call \\'push\\' zero or more times.\\n//\\n// Call `cb(err)` when you are done with this chunk.  If you pass\\n// an error, then that\\'ll put the hurt on the whole operation.  If you\\n// never call cb(), then you\\'ll never get another chunk.\\nTransform.prototype._transform = function(chunk, encoding, cb) {\\n  throw new Error(\\'not implemented\\');\\n};\\n\\nTransform.prototype._write = function(chunk, encoding, cb) {\\n  var ts = this._transformState;\\n  ts.writecb = cb;\\n  ts.writechunk = chunk;\\n  ts.writeencoding = encoding;\\n  if (!ts.transforming) {\\n    var rs = this._readableState;\\n    if (ts.needTransform ||\\n        rs.needReadable ||\\n        rs.length < rs.highWaterMark)\\n      this._read(rs.highWaterMark);\\n  }\\n};\\n\\n// Doesn\\'t matter what the args are here.\\n// _transform does all the work.\\n// That we got here means that the readable side wants more data.\\nTransform.prototype._read = function(n) {\\n  var ts = this._transformState;\\n\\n  if (ts.writechunk && ts.writecb && !ts.transforming) {\\n    ts.transforming = true;\\n    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\\n  } else {\\n    // mark that we need a transform, so that any data that comes in\\n    // will get processed, now that we\\'ve asked for it.\\n    ts.needTransform = true;\\n  }\\n};\\n\\n\\nfunction done(stream, er) {\\n  if (er)\\n    return stream.emit(\\'error\\', er);\\n\\n  // if there\\'s nothing in the write buffer, then that means\\n  // that nothing more will ever be provided\\n  var ws = stream._writableState;\\n  var rs = stream._readableState;\\n  var ts = stream._transformState;\\n\\n  if (ws.length)\\n    throw new Error(\\'calling transform done when ws.length != 0\\');\\n\\n  if (ts.transforming)\\n    throw new Error(\\'calling transform done when still transforming\\');\\n\\n  return stream.push(null);\\n}\\n\\n},{\"./duplex.js\":50,\"inherits\":4}],56:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// A bit simpler than readable streams.\\n// Implement an async ._write(chunk, cb), and it\\'ll handle all\\n// the drain event emission and buffering.\\n\\nmodule.exports = Writable;\\nWritable.WritableState = WritableState;\\n\\nvar isUint8Array = typeof Uint8Array !== \\'undefined\\'\\n  ? function (x) { return x instanceof Uint8Array }\\n  : function (x) {\\n    return x && x.constructor && x.constructor.name === \\'Uint8Array\\'\\n  }\\n;\\nvar isArrayBuffer = typeof ArrayBuffer !== \\'undefined\\'\\n  ? function (x) { return x instanceof ArrayBuffer }\\n  : function (x) {\\n    return x && x.constructor && x.constructor.name === \\'ArrayBuffer\\'\\n  }\\n;\\n\\nvar inherits = require(\\'inherits\\');\\nvar Stream = require(\\'./index.js\\');\\nvar setImmediate = require(\\'process/browser.js\\').nextTick;\\nvar Buffer = require(\\'buffer\\').Buffer;\\n\\ninherits(Writable, Stream);\\n\\nfunction WriteReq(chunk, encoding, cb) {\\n  this.chunk = chunk;\\n  this.encoding = encoding;\\n  this.callback = cb;\\n}\\n\\nfunction WritableState(options, stream) {\\n  options = options || {};\\n\\n  // the point at which write() starts returning false\\n  // Note: 0 is a valid value, means that we always return false if\\n  // the entire buffer is not flushed immediately on write()\\n  var hwm = options.highWaterMark;\\n  this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\\n\\n  // object stream flag to indicate whether or not this stream\\n  // contains buffers or objects.\\n  this.objectMode = !!options.objectMode;\\n\\n  // cast to ints.\\n  this.highWaterMark = ~~this.highWaterMark;\\n\\n  this.needDrain = false;\\n  // at the start of calling end()\\n  this.ending = false;\\n  // when end() has been called, and returned\\n  this.ended = false;\\n  // when \\'finish\\' is emitted\\n  this.finished = false;\\n\\n  // should we decode strings into buffers before passing to _write?\\n  // this is here so that some node-core streams can optimize string\\n  // handling at a lower level.\\n  var noDecode = options.decodeStrings === false;\\n  this.decodeStrings = !noDecode;\\n\\n  // Crypto is kind of old and crusty.  Historically, its default string\\n  // encoding is \\'binary\\' so we have to make this configurable.\\n  // Everything else in the universe uses \\'utf8\\', though.\\n  this.defaultEncoding = options.defaultEncoding || \\'utf8\\';\\n\\n  // not an actual buffer we keep track of, but a measurement\\n  // of how much we\\'re waiting to get pushed to some underlying\\n  // socket or file.\\n  this.length = 0;\\n\\n  // a flag to see when we\\'re in the middle of a write.\\n  this.writing = false;\\n\\n  // a flag to be able to tell if the onwrite cb is called immediately,\\n  // or on a later tick.  We set this to true at first, becuase any\\n  // actions that shouldn\\'t happen until \"later\" should generally also\\n  // not happen before the first write call.\\n  this.sync = true;\\n\\n  // a flag to know if we\\'re processing previously buffered items, which\\n  // may call the _write() callback in the same tick, so that we don\\'t\\n  // end up in an overlapped onwrite situation.\\n  this.bufferProcessing = false;\\n\\n  // the callback that\\'s passed to _write(chunk,cb)\\n  this.onwrite = function(er) {\\n    onwrite(stream, er);\\n  };\\n\\n  // the callback that the user supplies to write(chunk,encoding,cb)\\n  this.writecb = null;\\n\\n  // the amount that is being written when _write is called.\\n  this.writelen = 0;\\n\\n  this.buffer = [];\\n}\\n\\nfunction Writable(options) {\\n  // Writable ctor is applied to Duplexes, though they\\'re not\\n  // instanceof Writable, they\\'re instanceof Readable.\\n  if (!(this instanceof Writable) && !(this instanceof Stream.Duplex))\\n    return new Writable(options);\\n\\n  this._writableState = new WritableState(options, this);\\n\\n  // legacy.\\n  this.writable = true;\\n\\n  Stream.call(this);\\n}\\n\\n// Otherwise people can pipe Writable streams, which is just wrong.\\nWritable.prototype.pipe = function() {\\n  this.emit(\\'error\\', new Error(\\'Cannot pipe. Not readable.\\'));\\n};\\n\\n\\nfunction writeAfterEnd(stream, state, cb) {\\n  var er = new Error(\\'write after end\\');\\n  // TODO: defer error events consistently everywhere, not just the cb\\n  stream.emit(\\'error\\', er);\\n  setImmediate(function() {\\n    cb(er);\\n  });\\n}\\n\\n// If we get something that is not a buffer, string, null, or undefined,\\n// and we\\'re not in objectMode, then that\\'s an error.\\n// Otherwise stream chunks are all considered to be of length=1, and the\\n// watermarks determine how many objects to keep in the buffer, rather than\\n// how many bytes or characters.\\nfunction validChunk(stream, state, chunk, cb) {\\n  var valid = true;\\n  if (!Buffer.isBuffer(chunk) &&\\n      \\'string\\' !== typeof chunk &&\\n      chunk !== null &&\\n      chunk !== undefined &&\\n      !state.objectMode) {\\n    var er = new TypeError(\\'Invalid non-string/buffer chunk\\');\\n    stream.emit(\\'error\\', er);\\n    setImmediate(function() {\\n      cb(er);\\n    });\\n    valid = false;\\n  }\\n  return valid;\\n}\\n\\nWritable.prototype.write = function(chunk, encoding, cb) {\\n  var state = this._writableState;\\n  var ret = false;\\n\\n  if (typeof encoding === \\'function\\') {\\n    cb = encoding;\\n    encoding = null;\\n  }\\n\\n  if (!Buffer.isBuffer(chunk) && isUint8Array(chunk))\\n    chunk = new Buffer(chunk);\\n  if (isArrayBuffer(chunk) && typeof Uint8Array !== \\'undefined\\')\\n    chunk = new Buffer(new Uint8Array(chunk));\\n  \\n  if (Buffer.isBuffer(chunk))\\n    encoding = \\'buffer\\';\\n  else if (!encoding)\\n    encoding = state.defaultEncoding;\\n\\n  if (typeof cb !== \\'function\\')\\n    cb = function() {};\\n\\n  if (state.ended)\\n    writeAfterEnd(this, state, cb);\\n  else if (validChunk(this, state, chunk, cb))\\n    ret = writeOrBuffer(this, state, chunk, encoding, cb);\\n\\n  return ret;\\n};\\n\\nfunction decodeChunk(state, chunk, encoding) {\\n  if (!state.objectMode &&\\n      state.decodeStrings !== false &&\\n      typeof chunk === \\'string\\') {\\n    chunk = new Buffer(chunk, encoding);\\n  }\\n  return chunk;\\n}\\n\\n// if we\\'re already writing something, then just put this\\n// in the queue, and wait our turn.  Otherwise, call _write\\n// If we return false, then we need a drain event, so set that flag.\\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\\n  chunk = decodeChunk(state, chunk, encoding);\\n  var len = state.objectMode ? 1 : chunk.length;\\n\\n  state.length += len;\\n\\n  var ret = state.length < state.highWaterMark;\\n  state.needDrain = !ret;\\n\\n  if (state.writing)\\n    state.buffer.push(new WriteReq(chunk, encoding, cb));\\n  else\\n    doWrite(stream, state, len, chunk, encoding, cb);\\n\\n  return ret;\\n}\\n\\nfunction doWrite(stream, state, len, chunk, encoding, cb) {\\n  state.writelen = len;\\n  state.writecb = cb;\\n  state.writing = true;\\n  state.sync = true;\\n  stream._write(chunk, encoding, state.onwrite);\\n  state.sync = false;\\n}\\n\\nfunction onwriteError(stream, state, sync, er, cb) {\\n  if (sync)\\n    setImmediate(function() {\\n      cb(er);\\n    });\\n  else\\n    cb(er);\\n\\n  stream.emit(\\'error\\', er);\\n}\\n\\nfunction onwriteStateUpdate(state) {\\n  state.writing = false;\\n  state.writecb = null;\\n  state.length -= state.writelen;\\n  state.writelen = 0;\\n}\\n\\nfunction onwrite(stream, er) {\\n  var state = stream._writableState;\\n  var sync = state.sync;\\n  var cb = state.writecb;\\n\\n  onwriteStateUpdate(state);\\n\\n  if (er)\\n    onwriteError(stream, state, sync, er, cb);\\n  else {\\n    // Check if we\\'re actually ready to finish, but don\\'t emit yet\\n    var finished = needFinish(stream, state);\\n\\n    if (!finished && !state.bufferProcessing && state.buffer.length)\\n      clearBuffer(stream, state);\\n\\n    if (sync) {\\n      setImmediate(function() {\\n        afterWrite(stream, state, finished, cb);\\n      });\\n    } else {\\n      afterWrite(stream, state, finished, cb);\\n    }\\n  }\\n}\\n\\nfunction afterWrite(stream, state, finished, cb) {\\n  if (!finished)\\n    onwriteDrain(stream, state);\\n  cb();\\n  if (finished)\\n    finishMaybe(stream, state);\\n}\\n\\n// Must force callback to be called on nextTick, so that we don\\'t\\n// emit \\'drain\\' before the write() consumer gets the \\'false\\' return\\n// value, and has a chance to attach a \\'drain\\' listener.\\nfunction onwriteDrain(stream, state) {\\n  if (state.length === 0 && state.needDrain) {\\n    state.needDrain = false;\\n    stream.emit(\\'drain\\');\\n  }\\n}\\n\\n\\n// if there\\'s something in the buffer waiting, then process it\\nfunction clearBuffer(stream, state) {\\n  state.bufferProcessing = true;\\n\\n  for (var c = 0; c < state.buffer.length; c++) {\\n    var entry = state.buffer[c];\\n    var chunk = entry.chunk;\\n    var encoding = entry.encoding;\\n    var cb = entry.callback;\\n    var len = state.objectMode ? 1 : chunk.length;\\n\\n    doWrite(stream, state, len, chunk, encoding, cb);\\n\\n    // if we didn\\'t call the onwrite immediately, then\\n    // it means that we need to wait until it does.\\n    // also, that means that the chunk and cb are currently\\n    // being processed, so move the buffer counter past them.\\n    if (state.writing) {\\n      c++;\\n      break;\\n    }\\n  }\\n\\n  state.bufferProcessing = false;\\n  if (c < state.buffer.length)\\n    state.buffer = state.buffer.slice(c);\\n  else\\n    state.buffer.length = 0;\\n}\\n\\nWritable.prototype._write = function(chunk, encoding, cb) {\\n  cb(new Error(\\'not implemented\\'));\\n};\\n\\nWritable.prototype.end = function(chunk, encoding, cb) {\\n  var state = this._writableState;\\n\\n  if (typeof chunk === \\'function\\') {\\n    cb = chunk;\\n    chunk = null;\\n    encoding = null;\\n  } else if (typeof encoding === \\'function\\') {\\n    cb = encoding;\\n    encoding = null;\\n  }\\n\\n  if (typeof chunk !== \\'undefined\\' && chunk !== null)\\n    this.write(chunk, encoding);\\n\\n  // ignore unnecessary end() calls.\\n  if (!state.ending && !state.finished)\\n    endWritable(this, state, cb);\\n};\\n\\n\\nfunction needFinish(stream, state) {\\n  return (state.ending &&\\n          state.length === 0 &&\\n          !state.finished &&\\n          !state.writing);\\n}\\n\\nfunction finishMaybe(stream, state) {\\n  var need = needFinish(stream, state);\\n  if (need) {\\n    state.finished = true;\\n    stream.emit(\\'finish\\');\\n  }\\n  return need;\\n}\\n\\nfunction endWritable(stream, state, cb) {\\n  state.ending = true;\\n  finishMaybe(stream, state);\\n  if (cb) {\\n    if (state.finished)\\n      setImmediate(cb);\\n    else\\n      stream.once(\\'finish\\', cb);\\n  }\\n  state.ended = true;\\n}\\n\\n},{\"./index.js\":51,\"buffer\":47,\"inherits\":4,\"process/browser.js\":52}],57:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \"Software\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nvar Buffer = require(\\'buffer\\').Buffer;\\n\\nfunction assertEncoding(encoding) {\\n  if (encoding && !Buffer.isEncoding(encoding)) {\\n    throw new Error(\\'Unknown encoding: \\' + encoding);\\n  }\\n}\\n\\nvar StringDecoder = exports.StringDecoder = function(encoding) {\\n  this.encoding = (encoding || \\'utf8\\').toLowerCase().replace(/[-_]/, \\'\\');\\n  assertEncoding(encoding);\\n  switch (this.encoding) {\\n    case \\'utf8\\':\\n      // CESU-8 represents each of Surrogate Pair by 3-bytes\\n      this.surrogateSize = 3;\\n      break;\\n    case \\'ucs2\\':\\n    case \\'utf16le\\':\\n      // UTF-16 represents each of Surrogate Pair by 2-bytes\\n      this.surrogateSize = 2;\\n      this.detectIncompleteChar = utf16DetectIncompleteChar;\\n      break;\\n    case \\'base64\\':\\n      // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\\n      this.surrogateSize = 3;\\n      this.detectIncompleteChar = base64DetectIncompleteChar;\\n      break;\\n    default:\\n      this.write = passThroughWrite;\\n      return;\\n  }\\n\\n  this.charBuffer = new Buffer(6);\\n  this.charReceived = 0;\\n  this.charLength = 0;\\n};\\n\\n\\nStringDecoder.prototype.write = function(buffer) {\\n  var charStr = \\'\\';\\n  var offset = 0;\\n\\n  // if our last write ended with an incomplete multibyte character\\n  while (this.charLength) {\\n    // determine how many remaining bytes this buffer has to offer for this char\\n    var i = (buffer.length >= this.charLength - this.charReceived) ?\\n                this.charLength - this.charReceived :\\n                buffer.length;\\n\\n    // add the new bytes to the char buffer\\n    buffer.copy(this.charBuffer, this.charReceived, offset, i);\\n    this.charReceived += (i - offset);\\n    offset = i;\\n\\n    if (this.charReceived < this.charLength) {\\n      // still not enough chars in this buffer? wait for more ...\\n      return \\'\\';\\n    }\\n\\n    // get the character that was split\\n    charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\\n\\n    // lead surrogate (D800-DBFF) is also the incomplete character\\n    var charCode = charStr.charCodeAt(charStr.length - 1);\\n    if (charCode >= 0xD800 && charCode <= 0xDBFF) {\\n      this.charLength += this.surrogateSize;\\n      charStr = \\'\\';\\n      continue;\\n    }\\n    this.charReceived = this.charLength = 0;\\n\\n    // if there are no more bytes in this buffer, just emit our char\\n    if (i == buffer.length) return charStr;\\n\\n    // otherwise cut off the characters end from the beginning of this buffer\\n    buffer = buffer.slice(i, buffer.length);\\n    break;\\n  }\\n\\n  var lenIncomplete = this.detectIncompleteChar(buffer);\\n\\n  var end = buffer.length;\\n  if (this.charLength) {\\n    // buffer the incomplete character bytes we got\\n    buffer.copy(this.charBuffer, 0, buffer.length - lenIncomplete, end);\\n    this.charReceived = lenIncomplete;\\n    end -= lenIncomplete;\\n  }\\n\\n  charStr += buffer.toString(this.encoding, 0, end);\\n\\n  var end = charStr.length - 1;\\n  var charCode = charStr.charCodeAt(end);\\n  // lead surrogate (D800-DBFF) is also the incomplete character\\n  if (charCode >= 0xD800 && charCode <= 0xDBFF) {\\n    var size = this.surrogateSize;\\n    this.charLength += size;\\n    this.charReceived += size;\\n    this.charBuffer.copy(this.charBuffer, size, 0, size);\\n    this.charBuffer.write(charStr.charAt(charStr.length - 1), this.encoding);\\n    return charStr.substring(0, end);\\n  }\\n\\n  // or just emit the charStr\\n  return charStr;\\n};\\n\\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\\n  // determine how many bytes we have to check at the end of this buffer\\n  var i = (buffer.length >= 3) ? 3 : buffer.length;\\n\\n  // Figure out if one of the last i bytes of our buffer announces an\\n  // incomplete char.\\n  for (; i > 0; i--) {\\n    var c = buffer[buffer.length - i];\\n\\n    // See http://en.wikipedia.org/wiki/UTF-8#Description\\n\\n    // 110XXXXX\\n    if (i == 1 && c >> 5 == 0x06) {\\n      this.charLength = 2;\\n      break;\\n    }\\n\\n    // 1110XXXX\\n    if (i <= 2 && c >> 4 == 0x0E) {\\n      this.charLength = 3;\\n      break;\\n    }\\n\\n    // 11110XXX\\n    if (i <= 3 && c >> 3 == 0x1E) {\\n      this.charLength = 4;\\n      break;\\n    }\\n  }\\n\\n  return i;\\n};\\n\\nStringDecoder.prototype.end = function(buffer) {\\n  var res = \\'\\';\\n  if (buffer && buffer.length)\\n    res = this.write(buffer);\\n\\n  if (this.charReceived) {\\n    var cr = this.charReceived;\\n    var buf = this.charBuffer;\\n    var enc = this.encoding;\\n    res += buf.slice(0, cr).toString(enc);\\n  }\\n\\n  return res;\\n};\\n\\nfunction passThroughWrite(buffer) {\\n  return buffer.toString(this.encoding);\\n}\\n\\nfunction utf16DetectIncompleteChar(buffer) {\\n  var incomplete = this.charReceived = buffer.length % 2;\\n  this.charLength = incomplete ? 2 : 0;\\n  return incomplete;\\n}\\n\\nfunction base64DetectIncompleteChar(buffer) {\\n  var incomplete = this.charReceived = buffer.length % 3;\\n  this.charLength = incomplete ? 3 : 0;\\n  return incomplete;\\n}\\n\\n},{\"buffer\":47}],58:[function(require,module,exports){\\n\\'use strict\\';\\n\\nObject.defineProperty(exports, \"__esModule\", {\\n  value: true\\n});\\nexports.default = assemble;\\n\\nvar _assign = require(\\'fast.js/object/assign\\');\\n\\nvar _assign2 = _interopRequireDefault(_assign);\\n\\nvar _unpack = require(\\'./unpack\\');\\n\\nvar _unpack2 = _interopRequireDefault(_unpack);\\n\\nvar _parseRawXml = require(\\'./parseRawXml\\');\\n\\nvar _parseRawXml2 = _interopRequireDefault(_parseRawXml);\\n\\nvar _parseHelpers = require(\\'./parseHelpers\\');\\n\\nvar _modelHelpers = require(\\'./modelHelpers\\');\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nfunction threeMFInfo(data) {\\n  var tag = data.tag;\\n  var unit = tag.attributes[\\'unit\\'];\\n  var version = tag.attributes[\\'version\\'];\\n  return { unit: unit, version: version };\\n}\\n\\nfunction extractMetadata(data) {\\n  var tag = data.tag;\\n  var text = data.text;\\n\\n\\n  var name = tag.attributes[\\'name\\'];\\n  var value = text;\\n  var result = {};\\n  result[name] = value;\\n  return result;\\n}\\n\\nfunction vertexCoordinate(data) {\\n  var tag = data.tag;\\n\\n  var vertexCoords = (0, _parseHelpers.parseVector3)(tag);\\n  return vertexCoords;\\n}\\n\\nfunction vertexIndices(data) {\\n  var tag = data.tag;\\n\\n  var vertexIndices = (0, _parseHelpers.parseIndices)(tag);\\n  return vertexIndices;\\n}\\n\\nfunction vertexColors(data) {\\n  var tag = data.tag;\\n\\n\\n  var colorIds = [\\'pid\\', \\'p1\\', \\'p2\\', \\'p3\\'].reduce(function (result, key) {\\n    if (key in tag.attributes) {\\n      var value = tag.attributes[key];\\n      result[key] = parseInt(value, 10);\\n    }\\n    return result;\\n  }, {});\\n\\n  var output = (0, _assign2.default)({}, colorIds, vertexIndices(data));\\n  return output;\\n}\\n\\nfunction component(data) {\\n  var tag = data.tag;\\n\\n  return [\\'objectid\\', \\'transform\\'].reduce(function (result, key) {\\n    if (key in tag.attributes) {\\n      result[key] = tag.attributes[key];\\n    }\\n    return result;\\n  }, {});\\n}\\n\\nfunction extractColor(data) {\\n  var tag = data.tag;\\n\\n  var color = tag.attributes[\\'color\\'];\\n  if (color) {\\n    color = (0, _parseHelpers.hexToRgba)(color);\\n    color = (0, _parseHelpers.normalizeRgba)(color);\\n  }\\n  return color;\\n}\\n\\nfunction extractColorGroup(data) {\\n  var tag = data.tag;\\n\\n\\n  var colorgroupData = [\\'id\\'].reduce(function (result, key) {\\n    if (key in tag.attributes) {\\n      var value = tag.attributes[key];\\n      result[key] = parseInt(value, 10);\\n    }\\n    return result;\\n  }, {});\\n\\n  return colorgroupData;\\n}\\n\\nfunction makeActions(rawData$) {\\n  var metadata$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'metadata\\' && d.text;\\n  }).map(extractMetadata);\\n\\n  var vCoords$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'vertex\\' && d.start;\\n  }).map(vertexCoordinate);\\n\\n  var triangle$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'triangle\\' && d.start;\\n  }).share();\\n\\n  var vIndices$ = triangle$.map(vertexIndices);\\n\\n  var vColors$ = triangle$.filter(function (data) {\\n    return data.tag.attributes.hasOwnProperty(\\'pid\\') && (data.tag.attributes.hasOwnProperty(\\'p1\\') || data.tag.attributes.hasOwnProperty(\\'p2\\') || data.tag.attributes.hasOwnProperty(\\'p3\\'));\\n  }).map(vertexColors);\\n\\n  var vNormals$ = triangle$.map(vertexIndices);\\n\\n  var vCoords2$ = triangle$.map(vertexIndices);\\n\\n  var startObject$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'object\\' && d.start;\\n  });\\n\\n  var finishObject$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'object\\' && d.end;\\n  });\\n\\n  var finishBuild$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'build\\' && d.end;\\n  });\\n\\n  var item$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'item\\' && d.start;\\n  });\\n\\n  // colors & materials\\n  var colorGroup$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'m:colorgroup\\' && d.end;\\n  }).map(extractColorGroup);\\n\\n  var color$ = rawData$.filter(function (d) {\\n    return d.tag.name === \\'m:color\\' && d.start;\\n  }).map(extractColor);\\n\\n  return {\\n    metadata$: metadata$,\\n    color$: color$,\\n    colorGroup$: colorGroup$,\\n    vCoords$: vCoords$,\\n    vCoords2$: vCoords2$,\\n    vIndices$: vIndices$,\\n    vNormals$: vNormals$,\\n    vColors$: vColors$,\\n    startObject$: startObject$,\\n    finishObject$: finishObject$,\\n    item$: item$,\\n    finishBuild$: finishBuild$\\n  };\\n}\\n\\nfunction makeReducers() {\\n  var updateFns = {\\n    metadata: metadata,\\n    color: color,\\n    colorGroup: colorGroup,\\n    vCoords: vCoords,\\n    vCoords2: vCoords2,\\n    vIndices: vIndices,\\n    vNormals: vNormals,\\n    vColors: vColors,\\n    startObject: startObject,\\n    finishObject: finishObject,\\n    item: item,\\n    finishBuild: finishBuild\\n  };\\n  return updateFns;\\n}\\n\\n/*\\n  const components$  = rawData$\\n  const component$  = rawData$*/\\n\\nfunction metadata(state, input) {\\n  var metadata = (0, _assign2.default)({}, state.metadata, input);\\n  state.metadata = metadata;\\n  return state;\\n}\\n\\nfunction vCoords(state, input) {\\n  state.currentObject.positions = state.currentObject.positions.concat(input);\\n  // state = assign(state, )\\n  // console.log(\"positions\",input, state.currentObject.positions)\\n  return state;\\n}\\n\\nfunction vCoords2(state, input) {\\n  var positions = state.currentObject.positions;\\n  var A = [positions[input[0] * 3], positions[input[0] * 3 + 1], positions[input[0] * 3 + 2]];\\n  var B = [positions[input[1] * 3], positions[input[1] * 3 + 1], positions[input[1] * 3 + 2]];\\n  var C = [positions[input[2] * 3], positions[input[2] * 3 + 1], positions[input[2] * 3 + 2]];\\n\\n  // console.log(\"positions 2\",positions, A, B, C)\\n  state.currentObject._attributes.positions = state.currentObject._attributes.positions.concat(A).concat(B).concat(C);\\n  return state;\\n}\\n\\nfunction vIndices(state, input) {\\n  state.currentObject._attributes.indices = state.currentObject._attributes.indices.concat(input);\\n  return state;\\n}\\n\\nfunction vNormals(state, input) {\\n  // see specs : A triangle face normal (for triangle ABC, in that order) throughout this specification is defined as\\n  // a unit vector in the direction of the vector cross product (B - A) x (C - A).\\n  // (B - A) x (C - A).\\n  var normalIndices = [input[0], input[1], input[2]];\\n  var positions = state.currentObject.positions;\\n\\n  var A = [positions[input[0] * 3], positions[input[0] * 3 + 1], positions[input[0] * 3 + 2]];\\n  var B = [positions[input[1] * 3], positions[input[1] * 3 + 1], positions[input[1] * 3 + 2]];\\n  var C = [positions[input[2] * 3], positions[input[2] * 3 + 1], positions[input[2] * 3 + 2]];\\n\\n  // console.log(\"indices\",normalIndices,input[0], positions, \"A\",A,\"B\",B,\"C\",C)\\n\\n  function cross(a, b) {\\n    var ax = a[0],\\n        ay = a[1],\\n        az = a[2];\\n    var bx = b[0],\\n        by = b[1],\\n        bz = b[2];\\n\\n    var x = ay * bz - az * by;\\n    var y = az * bx - ax * bz;\\n    var z = ax * by - ay * bx;\\n    return [x, y, z];\\n  }\\n  function sub(a, b) {\\n    return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];\\n  }\\n\\n  function length(v) {\\n    return Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);\\n  }\\n\\n  function multiplyScalar(v, s) {\\n    return [v[0] * s, v[1] * s, v[2] * s];\\n  }\\n  function divideScalar(vector, scalar) {\\n    return multiplyScalar(vector, 1 / scalar);\\n  }\\n\\n  function normalize(v) {\\n    return divideScalar(v, length(v));\\n  }\\n\\n  var normal = normalize(cross(sub(B, A), sub(C, A)));\\n\\n  function assignAtIndex(target, startIndex, data) {\\n    for (var i = 0; i < 3; i++) {\\n      console.log(\\'assign\\', target, startIndex, data, data[i]);\\n      target[startIndex + i] = data[i];\\n    }\\n  }\\n\\n  function assignAllAtIndices(target, indices, data) {\\n    indices.forEach(function (cindex) {\\n      assignAtIndex(target, cindex * 3, data);\\n    });\\n  }\\n\\n  state.currentObject._attributes.normals = state.currentObject._attributes.normals.concat(normal).concat(normal).concat(normal);\\n\\n  return state;\\n}\\n\\nfunction vColors(state, input) {\\n  // FIXME: deal with color GROUPS\\n  // console.log(\"vColors\",input)\\n  var colorGroup = state.colors[input.pid];\\n\\n  var p1 = \\'p1\\' in input;\\n  var p2 = \\'p2\\' in input;\\n  var p3 = \\'p3\\' in input;\\n\\n  var p1Decides = p1 && !p2 && !p3;\\n  var allP = p1 && p2 && p3;\\n\\n  var colors = [];\\n\\n  function assignAtIndex(target, startIndex, data) {\\n    for (var i = 0; i < 4; i++) {\\n      target[startIndex + i] = data[i];\\n    }\\n  }\\n\\n  function assignAllAtIndices(target, indices, data) {\\n    indices.forEach(function (cindex, index) {\\n      assignAtIndex(target, cindex * 4, data[index]);\\n    });\\n  }\\n  var colorIndices = [input[0], input[1], input[2]];\\n\\n  /* if(state.currentObject._attributes.colors.length ===0){\\n    state.currentObject._attributes.colors = new Array(7)\\n  }*/\\n\\n  if (allP) {\\n    colors = colorGroup[input.p1].concat(colorGroup[input.p2], colorGroup[input.p3]);\\n    // const values = [colorGroup[input.p1], colorGroup[input.p2], colorGroup[input.p3]]\\n    // assignAllAtIndices(state.currentObject._attributes.colors, colorIndices, values)\\n  } else if (p1Decides) {\\n      var p1Color = colorGroup[input.p1];\\n      colors = p1Color.concat(p1Color, p1Color);\\n\\n      // const values = [p1Color,p1Color,p1Color]\\n      // assignAllAtIndices(state.currentObject._attributes.colors, colorIndices, values)\\n    }\\n\\n  if (colors.length > 0) {\\n    state.currentObject._attributes.colors = state.currentObject._attributes.colors.concat(colors);\\n  }\\n\\n  return state;\\n}\\n\\nfunction color(state, input) {\\n  // state.colors = state.colors.concat( input )\\n  state.currentColorGroup.push(input);\\n  return state;\\n}\\n\\nfunction colorGroup(state, input) {\\n  state.colors[input.id] = state.currentColorGroup;\\n  state.currentColorGroup = [];\\n  return state;\\n}\\n\\nfunction startObject(state, input) {\\n  var tag = input.tag;\\n\\n\\n  var object = [\\'id\\', \\'name\\', \\'type\\', \\'pid\\'].reduce(function (result, key) {\\n    if (key in tag.attributes) {\\n      result[key] = tag.attributes[key];\\n    }\\n    return result;\\n  }, {});\\n  state.currentObject = (0, _assign2.default)({}, state.currentObject, object);\\n  return state;\\n}\\n\\nfunction finishObject(state, input) {\\n  state.objects[state.currentObject.id] = (0, _parseHelpers.createModelBuffers)(state.currentObject);\\n\\n  state.currentObject = {\\n    id: undefined,\\n    name: undefined,\\n    positions: [],\\n    _attributes: {\\n      positions: [],\\n      normals: [],\\n      indices: [],\\n      colors: []\\n    }\\n  };\\n  return state;\\n}\\n\\nfunction item(state, input) {\\n  var tag = input.tag;\\n\\n  var item = [\\'objectid\\', \\'transform\\', \\'partnumber\\'].reduce(function (result, key) {\\n    if (key in tag.attributes) {\\n      if (key === \\'transform\\') {\\n        result[\\'transforms\\'] = tag.attributes[key].split(\\' \\').map(function (t) {\\n          return parseFloat(t);\\n        });\\n      } else {\\n        result[key] = tag.attributes[key];\\n      }\\n    }\\n    return result;\\n  }, {});\\n\\n  state.build = state.build.concat([item]);\\n  return state;\\n}\\n\\nfunction finishBuild(state, input) {\\n  state._finished = true;\\n  return state;\\n}\\n\\nfunction assemble(data) {\\n  var rawData$ = (0, _unpack2.default)(data).flatMap(_parseRawXml2.default).share();\\n\\n  var defaultData = {\\n    metadata: {},\\n    objects: {},\\n    build: [],\\n    colors: {},\\n    currentObject: {\\n      id: undefined,\\n      positions: [],\\n      _attributes: {\\n        positions: [],\\n        normals: [],\\n        indices: [],\\n        colors: []\\n      }\\n    },\\n    currentColorGroup: []\\n  };\\n\\n  var actions = makeActions(rawData$);\\n  var updateFns = makeReducers();\\n  var data$ = (0, _modelHelpers.makeModel)(defaultData, updateFns, actions);\\n  return data$;\\n}\\n\\n},{\"./modelHelpers\":59,\"./parseHelpers\":60,\"./parseRawXml\":61,\"./unpack\":62,\"fast.js/object/assign\":2}],59:[function(require,module,exports){\\n\\'use strict\\';\\n\\nObject.defineProperty(exports, \"__esModule\", {\\n  value: true\\n});\\nexports.mergeData = mergeData;\\nexports.applyDefaults = applyDefaults;\\nexports.applyTransform = applyTransform;\\nexports.makeModifications = makeModifications;\\nexports.makeModel = makeModel;\\n\\nvar _rx = require(\\'rx\\');\\n\\nvar _rx2 = _interopRequireDefault(_rx);\\n\\nvar _assign = require(\\'fast.js/object/assign\\');\\n\\nvar _assign2 = _interopRequireDefault(_assign);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nvar merge = _rx2.default.Observable.merge;\\nvar just = _rx2.default.Observable.just;\\n\\n// faster object.assign\\n\\n// TODO: this needs to be an external lib, for re-use\\n// merge the current data with any number of input data\\nfunction mergeData(currentData) {\\n  for (var _len = arguments.length, inputs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\\n    inputs[_key - 1] = arguments[_key];\\n  }\\n\\n  if (\\'merge\\' in currentData) {\\n    return currentData.merge(inputs);\\n  }\\n  return _assign2.default.apply(undefined, [{}, currentData].concat(inputs));\\n}\\n\\n// need to make sure source data structure is right\\nfunction applyDefaults(data$, defaults) {\\n  return data$.map(function (data) {\\n    return mergeData(defaults, data);\\n  });\\n}\\n\\n// need to make sure the \"type\" (immutable) is right\\nfunction applyTransform(data$, transform) {\\n  return data$.map(function (data) {\\n    return transform(data);\\n  });\\n}\\n\\nfunction makeModifications(actions, updateFns, options) {\\n  var mods$ = Object.keys(actions).map(function (key) {\\n    var op = actions[key];\\n    var opName = key.replace(/\\\\$/g, \\'\\');\\n    var modFn = updateFns[opName];\\n\\n    // here is where the \"magic happens\"\\n    // for each \"operation/action\" we map it to an observable with history & state\\n    var mod$ = op.map(function (input) {\\n      return function (state) {\\n        state = modFn(state, input); // call the adapted function\\n        return state;\\n      };\\n    });\\n\\n    if (modFn) {\\n      return mod$;\\n    }\\n  }).filter(function (e) {\\n    return e !== undefined;\\n  });\\n\\n  return merge(mods$);\\n}\\n\\nfunction makeModel(defaults, updateFns, actions, source) {\\n  var options = arguments.length <= 4 || arguments[4] === undefined ? { doApplyTransform: false } : arguments[4];\\n\\n  var mods$ = makeModifications(actions, updateFns, options);\\n\\n  var source$ = source || just(defaults);\\n\\n  source$ = applyDefaults(source$, defaults);\\n\\n  if (options.doApplyTransform) {\\n    source$ = applyTransform(source$, transform);\\n  }\\n\\n  return mods$.merge(source$).scan(function (currentData, modFn) {\\n    return modFn(currentData);\\n  }); // combine existing data with new one\\n  // .distinctUntilChanged()\\n}\\n\\n},{\"fast.js/object/assign\":2,\"rx\":45}],60:[function(require,module,exports){\\n\\'use strict\\';\\n\\nObject.defineProperty(exports, \"__esModule\", {\\n  value: true\\n});\\nexports.parseText = parseText;\\nexports.parseColor = parseColor;\\nexports.hexToRgba = hexToRgba;\\nexports.normalizeRgba = normalizeRgba;\\nexports.parseVector3 = parseVector3;\\nexports.parseIndices = parseIndices;\\nexports.parseMapCoords = parseMapCoords;\\nexports.createModelBuffers = createModelBuffers;\\nfunction parseText(value, toType, defaultValue) {\\n  defaultValue = defaultValue || null;\\n\\n  if (value !== null && value !== undefined) {\\n    switch (toType) {\\n      case \\'float\\':\\n        value = parseFloat(value);\\n        break;\\n      case \\'int\\':\\n        value = parseInt(value);\\n        break;\\n      // default:\\n    }\\n  } else if (defaultValue !== null) {\\n      value = defaultValue;\\n    }\\n  return value;\\n}\\n\\n/*export function parseAttribute( value , toType, defaultValue){\\n  attributes\\n}*/\\n\\nfunction parseColor(node, defaultValue) {\\n  var color = defaultValue || null; // let color = volumeColor !== null ? volumeColor : new THREE.Color(\"#ffffff\")\\n\\n  var r = parseText(node.r.value, \\'float\\', 1.0);\\n  var g = parseText(node.g.value, \\'float\\', 1.0);\\n  var b = parseText(node.b.value, \\'float\\', 1.0);\\n  var a = \\'a\\' in node ? parseText(node.a.value, \\'float\\', 1.0) : 1.0;\\n  color = [r, g, b, a];\\n  return color;\\n}\\n\\nfunction hexToRgba(hex) {\\n  hex = hex.replace(\\'#\\', \\'\\');\\n  var r = parseInt(hex.substring(0, 2), 16);\\n  var g = parseInt(hex.substring(2, 4), 16);\\n  var b = parseInt(hex.substring(4, 6), 16);\\n  var a = parseInt(hex.substring(6, 8), 16);\\n  return [r, g, b, a];\\n}\\n\\n// normalize 0-255 values to 0-1\\nfunction normalizeRgba(rgba) {\\n  return rgba.map(function (v) {\\n    return +(v / 255).toFixed(2);\\n  });\\n}\\n\\nfunction parseVector3(node, prefix, defaultValue) {\\n  var coords = null;\\n  prefix = prefix || \\'\\';\\n  defaultValue = defaultValue || 0.0;\\n\\n  var x = prefix + \\'x\\' in node.attributes ? parseText(node.attributes[prefix + \\'x\\'], \\'float\\', defaultValue) : defaultValue;\\n  var y = prefix + \\'y\\' in node.attributes ? parseText(node.attributes[prefix + \\'y\\'], \\'float\\', defaultValue) : defaultValue;\\n  var z = prefix + \\'z\\' in node.attributes ? parseText(node.attributes[prefix + \\'z\\'], \\'float\\', defaultValue) : defaultValue;\\n\\n  coords = [x, y, z];\\n  return coords;\\n}\\n\\nfunction parseIndices(node) {\\n  var prefix = \\'\\';\\n  var defaultValue = 0;\\n  var v1 = parseText(node.attributes[prefix + \\'v1\\'], \\'int\\', defaultValue);\\n  var v2 = parseText(node.attributes[prefix + \\'v2\\'], \\'int\\', defaultValue);\\n  var v3 = parseText(node.attributes[prefix + \\'v3\\'], \\'int\\', defaultValue);\\n\\n  return [v1, v2, v3];\\n}\\n\\nfunction parseMapCoords(node, prefix, defaultValue) {\\n  // console.log(\"parsing map coords\", node, (\"btexid\" in node) , node.btexid)\\n  // get vertex UVs (optional)\\n  // rtexid, gtexid, btexid\\n\\n  var rtexid = \\'rtexid\\' in node ? parseText(node[\\'rtexid\\'], \\'int\\', null) : null;\\n  var gtexid = \\'gtexid\\' in node ? parseText(node[\\'gtexid\\'], \\'int\\', defaultValue) : null;\\n  var btexid = \\'btexid\\' in node ? parseText(node[\\'btexid\\'], \\'int\\', defaultValue) : null;\\n\\n  var u1 = \\'u1\\' in node ? parseText(node[\\'u1\\'].value, \\'float\\', defaultValue) : null;\\n  var u2 = \\'u2\\' in node ? parseText(node[\\'u2\\'].value, \\'float\\', defaultValue) : null;\\n  var u3 = \\'u3\\' in node ? parseText(node[\\'u3\\'].value, \\'float\\', defaultValue) : null;\\n\\n  var v1 = \\'v1\\' in node ? parseText(node[\\'v1\\'].value, \\'float\\', defaultValue) : null;\\n  var v2 = \\'v2\\' in node ? parseText(node[\\'v2\\'].value, \\'float\\', defaultValue) : null;\\n  var v3 = \\'v3\\' in node ? parseText(node[\\'v3\\'].value, \\'float\\', defaultValue) : null;\\n\\n  // console.log(\"textures ids\", rtexid,gtexid,btexid,\"coords\", u1,u2,u3,\"/\", v1,v2,v3)\\n  // face.materialIndex  = rtexid\\n  // face.materialIndex  = 0\\n\\n  var uv1 = u1 !== null && v1 != null ? [u1, v1] : null;\\n  var uv2 = u2 !== null && v2 != null ? [u2, v2] : null;\\n  var uv3 = u3 !== null && v3 != null ? [u3, v3] : null;\\n\\n  var mappingData = { matId: 0, uvs: [uv1, uv2, uv3] };\\n  // currentGeometry.faceVertexUvs[ 0 ].push( [uv1,uv2,uv3])\\n  return mappingData;\\n}\\n\\nfunction createModelBuffers(modelData) {\\n  // console.log(\"creating model buffers\")//modelData, modelData._attributes)\\n  // other implementation\\n  var dataTypes = { \\'positions\\': Float32Array, \\'indices\\': Uint32Array, \\'normals\\': Float32Array, \\'colors\\': Float32Array };\\n\\n  var output = [\\'positions\\', \\'normals\\', \\'colors\\'] // , \"indices\"]\\n  .reduce(function (result, key) {\\n    if (key in modelData._attributes) {\\n      var data = modelData._attributes[key];\\n\\n      var dataBuff = new dataTypes[key](data.length);\\n      dataBuff.set(data);\\n\\n      result[key] = dataBuff;\\n    }\\n    return result;\\n  }, {});\\n\\n  output.id = modelData.id;\\n  output.name = modelData.name;\\n\\n  return output;\\n}\\n\\n},{}],61:[function(require,module,exports){\\n\\'use strict\\';\\n\\nObject.defineProperty(exports, \"__esModule\", {\\n  value: true\\n});\\nexports.default = parseRawXml;\\n\\nvar _rx = require(\\'rx\\');\\n\\nvar _rx2 = _interopRequireDefault(_rx);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nvar sax = require(\\'sax\\');\\n\\n// input can be a stream ?\\nfunction parseRawXml(input) {\\n  return _rx2.default.Observable.create(function (parsedData) {\\n    function onTagOpen(tag) {\\n      // console.log(\"onTagOpen\",tag)\\n      parsedData.onNext({ tag: tag, start: true });\\n    }\\n\\n    function onTagClose(tag) {\\n      // console.log(\"onTagClose\",tag)\\n      if (!tag.name) {\\n        tag = { name: tag };\\n      }\\n      parsedData.onNext({ tag: this._parser.tag, end: true });\\n    }\\n\\n    function onTagText(text) {\\n      // console.log(\"text\",text)//, this._parser.tag)\\n      parsedData.onNext({ tag: this._parser.tag, text: text });\\n    }\\n\\n    var saxStream = sax.createStream(true, { trim: true });\\n\\n    // console.log(\"saxStream\",saxStream)\\n    saxStream.on(\\'error\\', function (e) {\\n      // unhandled errors will throw, since this is a proper node\\n      // event emitter.\\n      console.error(\\'error!\\', e);\\n      // clear the error\\n      this._parser.error = null;\\n      this._parser.resume();\\n    });\\n    saxStream.on(\\'opentag\\', onTagOpen);\\n    saxStream.on(\\'closetag\\', onTagClose);\\n    saxStream.on(\\'text\\', onTagText);\\n\\n    saxStream.on(\\'ready\\', function () {\\n      console.log(\\'ready\\');\\n    });\\n\\n    // split up stream\\n    /* let length = input.length\\n    let chunkedLength = 0\\n    let chunkSize     = 300 //length\\n    let chunk         = \"\"\\n    let c = 0\\n    saxStream.on(\"ready\",function(){\\n      if( chunkedLength < length)\\n      {\\n        chunk = input.slice(chunkedLength, chunkedLength += chunkSize)\\n        saxStream.write( chunk ).close()\\n      }\\n    })\\n     chunk = input.slice(chunkedLength, chunkedLength += chunkSize)\\n    saxStream.write( chunk ).close()*/\\n    saxStream.write(input);\\n\\n    return function () {\\n      console.log(\\'disposed\\');\\n    };\\n  });\\n}\\n\\n},{\"rx\":45,\"sax\":46}],62:[function(require,module,exports){\\n(function (Buffer){\\n\\'use strict\\';\\n\\nObject.defineProperty(exports, \"__esModule\", {\\n  value: true\\n});\\nexports.default = unpack;\\n\\nvar _rx = require(\\'rx\\');\\n\\nvar _rx2 = _interopRequireDefault(_rx);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nvar JSZip = require(\\'jszip\\');\\n\\nvar from = _rx2.default.Observable.from;\\n\\nfunction toBuffer(ab) {\\n  var buffer = new Buffer(ab.byteLength);\\n  var view = new Uint8Array(ab);\\n  for (var i = 0; i < buffer.length; ++i) {\\n    buffer[i] = view[i];\\n  }\\n  return buffer;\\n}\\n\\n// not really streaming...yet\\nfunction streamZipData(arrayBuffer, obs) {\\n  if (typeof Blob !== \\'undefined\\') {\\n    // browser land\\n    var blob = new Blob([arrayBuffer]);\\n    var reader = new FileReader();\\n\\n    reader.onload = function (e) {\\n      var txt = e.target.result;\\n      obs.onNext(txt);\\n    };\\n    reader.readAsText(blob);\\n  } else {\\n    // node land\\n    // let fs = require(\\'fs\\')\\n    var buffer = toBuffer(arrayBuffer);\\n    obs.onNext(ensureString(buffer));\\n  }\\n}\\n\\n// TODO this needs to stream the data\\nfunction unpack(data) {\\n  var zip = new JSZip(data);\\n  // console.log(\"entries\", zip.files)\\n  var entries$ = from(Object.keys(zip.files).map(function (key) {\\n    return zip.files[key];\\n  }));\\n\\n  return entries$.filter(function (entry) {\\n    return entry !== undefined;\\n  }).filter(function (entry) {\\n    return entry._data !== null;\\n  }).filter(function (entry) {\\n    return entry.dir === false;\\n  }).filter(function (entry) {\\n    return entry.name.startsWith(\\'3D/\\');\\n  }).flatMap(function (entry) {\\n    var result = new _rx2.default.ReplaySubject(1);\\n    var ab = entry.asArrayBuffer();\\n    streamZipData(ab, result);\\n    return result;\\n  }).catch(function (error) {\\n    // console.log(\"error\",error)\\n    var formated = ensureString(data); // why do we use this ?\\n    return formated;\\n  });\\n}\\n\\nfunction ensureString(buf) {\\n  if (typeof buf !== \\'string\\') {\\n    var array_buffer = new Uint8Array(buf);\\n    var str = \\'\\';\\n    for (var i = 0; i < buf.byteLength; i++) {\\n      str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian\\n    }\\n    return str;\\n  } else {\\n    return buf;\\n  }\\n}\\n\\n}).call(this,require(\"buffer\").Buffer)\\n},{\"buffer\":47,\"jszip\":14,\"rx\":45}],63:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar _assemble = require(\\'./assemble\\');\\n\\nvar _assemble2 = _interopRequireDefault(_assemble);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nself.onmessage = function (event) {\\n  var data = event.data;\\n  data = data.data;\\n\\n  (0, _assemble2.default)(data).subscribe(function (data) {\\n    if (data._finished === true) {\\n      self.postMessage({ data: data });\\n      self.close();\\n    }\\n  });\\n};\\n\\n},{\"./assemble\":58}]},{},[63])'],{type:\"text/javascript\"}))); // browserify\nworker.onmessage=function(event){obs.onNext(event.data.data);obs.onNext({progress:1,total:Math.NaN});obs.onCompleted();};worker.onerror=function(event){obs.onError('error: '+event.message);};worker.postMessage({'data':data});obs.catch(function(e){return worker.terminate();});})();}else {(0,_assemble2.default)(data) /* .last(function (data, idx, obs) {\n      return data._finished === true\n    })*/ // WHY U NO WORK ??\n.subscribe(function(data){if(data._finished===true){obs.onNext({progress:1,total:Math.NaN});obs.onNext(data);obs.onCompleted();}});}return obs;}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./assemble\":69,\"composite-detect\":5,\"fast.js/object/assign\":8}],71:[function(require,module,exports){\n(function (global){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.mergeData = mergeData;\nexports.applyDefaults = applyDefaults;\nexports.applyTransform = applyTransform;\nexports.makeModifications = makeModifications;\nexports.makeModel = makeModel;\n\nvar _rx = typeof window !== \"undefined\" ? window['Rx'] : typeof global !== \"undefined\" ? global['Rx'] : null;\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _assign = require('fast.js/object/assign');\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\nvar merge = _rx2.default.Observable.merge;\nvar just = _rx2.default.Observable.just;\n\n// faster object.assign\n\n// TODO: this needs to be an external lib, for re-use\n// merge the current data with any number of input data\nfunction mergeData(currentData) {\n  for (var _len = arguments.length, inputs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n    inputs[_key - 1] = arguments[_key];\n  }\n\n  if ('merge' in currentData) {\n    return currentData.merge(inputs);\n  }\n  return _assign2.default.apply(undefined, [{}, currentData].concat(inputs));\n}\n\n// need to make sure source data structure is right\nfunction applyDefaults(data$, defaults) {\n  return data$.map(function (data) {\n    return mergeData(defaults, data);\n  });\n}\n\n// need to make sure the \"type\" (immutable) is right\nfunction applyTransform(data$, transform) {\n  return data$.map(function (data) {\n    return transform(data);\n  });\n}\n\nfunction makeModifications(actions, updateFns, options) {\n  var mods$ = Object.keys(actions).map(function (key) {\n    var op = actions[key];\n    var opName = key.replace(/\\$/g, '');\n    var modFn = updateFns[opName];\n\n    // here is where the \"magic happens\"\n    // for each \"operation/action\" we map it to an observable with history & state\n    var mod$ = op.map(function (input) {\n      return function (state) {\n        state = modFn(state, input); // call the adapted function\n        return state;\n      };\n    });\n\n    if (modFn) {\n      return mod$;\n    }\n  }).filter(function (e) {\n    return e !== undefined;\n  });\n\n  return merge(mods$);\n}\n\nfunction makeModel(defaults, updateFns, actions, source) {\n  var options = arguments.length <= 4 || arguments[4] === undefined ? { doApplyTransform: false } : arguments[4];\n\n  var mods$ = makeModifications(actions, updateFns, options);\n\n  var source$ = source || just(defaults);\n\n  source$ = applyDefaults(source$, defaults);\n\n  if (options.doApplyTransform) {\n    source$ = applyTransform(source$, transform);\n  }\n\n  return mods$.merge(source$).scan(function (currentData, modFn) {\n    return modFn(currentData);\n  }); // combine existing data with new one\n  // .distinctUntilChanged()\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"fast.js/object/assign\":8}],72:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.parseText = parseText;\nexports.parseColor = parseColor;\nexports.hexToRgba = hexToRgba;\nexports.normalizeRgba = normalizeRgba;\nexports.parseVector3 = parseVector3;\nexports.parseIndices = parseIndices;\nexports.parseMapCoords = parseMapCoords;\nexports.createModelBuffers = createModelBuffers;\nfunction parseText(value, toType, defaultValue) {\n  defaultValue = defaultValue || null;\n\n  if (value !== null && value !== undefined) {\n    switch (toType) {\n      case 'float':\n        value = parseFloat(value);\n        break;\n      case 'int':\n        value = parseInt(value);\n        break;\n      // default:\n    }\n  } else if (defaultValue !== null) {\n      value = defaultValue;\n    }\n  return value;\n}\n\n/*export function parseAttribute( value , toType, defaultValue){\n  attributes\n}*/\n\nfunction parseColor(node, defaultValue) {\n  var color = defaultValue || null; // let color = volumeColor !== null ? volumeColor : new THREE.Color(\"#ffffff\")\n\n  var r = parseText(node.r.value, 'float', 1.0);\n  var g = parseText(node.g.value, 'float', 1.0);\n  var b = parseText(node.b.value, 'float', 1.0);\n  var a = 'a' in node ? parseText(node.a.value, 'float', 1.0) : 1.0;\n  color = [r, g, b, a];\n  return color;\n}\n\nfunction hexToRgba(hex) {\n  hex = hex.replace('#', '');\n  var r = parseInt(hex.substring(0, 2), 16);\n  var g = parseInt(hex.substring(2, 4), 16);\n  var b = parseInt(hex.substring(4, 6), 16);\n  var a = parseInt(hex.substring(6, 8), 16);\n  return [r, g, b, a];\n}\n\n// normalize 0-255 values to 0-1\nfunction normalizeRgba(rgba) {\n  return rgba.map(function (v) {\n    return +(v / 255).toFixed(2);\n  });\n}\n\nfunction parseVector3(node, prefix, defaultValue) {\n  var coords = null;\n  prefix = prefix || '';\n  defaultValue = defaultValue || 0.0;\n\n  var x = prefix + 'x' in node.attributes ? parseText(node.attributes[prefix + 'x'], 'float', defaultValue) : defaultValue;\n  var y = prefix + 'y' in node.attributes ? parseText(node.attributes[prefix + 'y'], 'float', defaultValue) : defaultValue;\n  var z = prefix + 'z' in node.attributes ? parseText(node.attributes[prefix + 'z'], 'float', defaultValue) : defaultValue;\n\n  coords = [x, y, z];\n  return coords;\n}\n\nfunction parseIndices(node) {\n  var prefix = '';\n  var defaultValue = 0;\n  var v1 = parseText(node.attributes[prefix + 'v1'], 'int', defaultValue);\n  var v2 = parseText(node.attributes[prefix + 'v2'], 'int', defaultValue);\n  var v3 = parseText(node.attributes[prefix + 'v3'], 'int', defaultValue);\n\n  return [v1, v2, v3];\n}\n\nfunction parseMapCoords(node, prefix, defaultValue) {\n  // console.log(\"parsing map coords\", node, (\"btexid\" in node) , node.btexid)\n  // get vertex UVs (optional)\n  // rtexid, gtexid, btexid\n\n  var rtexid = 'rtexid' in node ? parseText(node['rtexid'], 'int', null) : null;\n  var gtexid = 'gtexid' in node ? parseText(node['gtexid'], 'int', defaultValue) : null;\n  var btexid = 'btexid' in node ? parseText(node['btexid'], 'int', defaultValue) : null;\n\n  var u1 = 'u1' in node ? parseText(node['u1'].value, 'float', defaultValue) : null;\n  var u2 = 'u2' in node ? parseText(node['u2'].value, 'float', defaultValue) : null;\n  var u3 = 'u3' in node ? parseText(node['u3'].value, 'float', defaultValue) : null;\n\n  var v1 = 'v1' in node ? parseText(node['v1'].value, 'float', defaultValue) : null;\n  var v2 = 'v2' in node ? parseText(node['v2'].value, 'float', defaultValue) : null;\n  var v3 = 'v3' in node ? parseText(node['v3'].value, 'float', defaultValue) : null;\n\n  // console.log(\"textures ids\", rtexid,gtexid,btexid,\"coords\", u1,u2,u3,\"/\", v1,v2,v3)\n  // face.materialIndex  = rtexid\n  // face.materialIndex  = 0\n\n  var uv1 = u1 !== null && v1 != null ? [u1, v1] : null;\n  var uv2 = u2 !== null && v2 != null ? [u2, v2] : null;\n  var uv3 = u3 !== null && v3 != null ? [u3, v3] : null;\n\n  var mappingData = { matId: 0, uvs: [uv1, uv2, uv3] };\n  // currentGeometry.faceVertexUvs[ 0 ].push( [uv1,uv2,uv3])\n  return mappingData;\n}\n\nfunction createModelBuffers(modelData) {\n  // console.log(\"creating model buffers\")//modelData, modelData._attributes)\n  // other implementation\n  var dataTypes = { 'positions': Float32Array, 'indices': Uint32Array, 'normals': Float32Array, 'colors': Float32Array };\n\n  var output = ['positions', 'normals', 'colors'] // , \"indices\"]\n  .reduce(function (result, key) {\n    if (key in modelData._attributes) {\n      var data = modelData._attributes[key];\n\n      var dataBuff = new dataTypes[key](data.length);\n      dataBuff.set(data);\n\n      result[key] = dataBuff;\n    }\n    return result;\n  }, {});\n\n  output.id = modelData.id;\n  output.name = modelData.name;\n\n  return output;\n}\n\n},{}],73:[function(require,module,exports){\n(function (global){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = parseRawXml;\n\nvar _rx = typeof window !== \"undefined\" ? window['Rx'] : typeof global !== \"undefined\" ? global['Rx'] : null;\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\nvar sax = require('sax');\n\n// input can be a stream ?\nfunction parseRawXml(input) {\n  return _rx2.default.Observable.create(function (parsedData) {\n    function onTagOpen(tag) {\n      // console.log(\"onTagOpen\",tag)\n      parsedData.onNext({ tag: tag, start: true });\n    }\n\n    function onTagClose(tag) {\n      // console.log(\"onTagClose\",tag)\n      if (!tag.name) {\n        tag = { name: tag };\n      }\n      parsedData.onNext({ tag: this._parser.tag, end: true });\n    }\n\n    function onTagText(text) {\n      // console.log(\"text\",text)//, this._parser.tag)\n      parsedData.onNext({ tag: this._parser.tag, text: text });\n    }\n\n    var saxStream = sax.createStream(true, { trim: true });\n\n    // console.log(\"saxStream\",saxStream)\n    saxStream.on('error', function (e) {\n      // unhandled errors will throw, since this is a proper node\n      // event emitter.\n      console.error('error!', e);\n      // clear the error\n      this._parser.error = null;\n      this._parser.resume();\n    });\n    saxStream.on('opentag', onTagOpen);\n    saxStream.on('closetag', onTagClose);\n    saxStream.on('text', onTagText);\n\n    saxStream.on('ready', function () {\n      console.log('ready');\n    });\n\n    // split up stream\n    /* let length = input.length\n    let chunkedLength = 0\n    let chunkSize     = 300 //length\n    let chunk         = \"\"\n    let c = 0\n    saxStream.on(\"ready\",function(){\n      if( chunkedLength < length)\n      {\n        chunk = input.slice(chunkedLength, chunkedLength += chunkSize)\n        saxStream.write( chunk ).close()\n      }\n    })\n     chunk = input.slice(chunkedLength, chunkedLength += chunkSize)\n    saxStream.write( chunk ).close()*/\n    saxStream.write(input);\n\n    return function () {\n      console.log('disposed');\n    };\n  });\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"sax\":65}],74:[function(require,module,exports){\n(function (global,Buffer){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = unpack;\n\nvar _rx = typeof window !== \"undefined\" ? window['Rx'] : typeof global !== \"undefined\" ? global['Rx'] : null;\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\nvar JSZip = require('jszip');\n\nvar from = _rx2.default.Observable.from;\n\nfunction toBuffer(ab) {\n  var buffer = new Buffer(ab.byteLength);\n  var view = new Uint8Array(ab);\n  for (var i = 0; i < buffer.length; ++i) {\n    buffer[i] = view[i];\n  }\n  return buffer;\n}\n\n// not really streaming...yet\nfunction streamZipData(arrayBuffer, obs) {\n  if (typeof Blob !== 'undefined') {\n    // browser land\n    var blob = new Blob([arrayBuffer]);\n    var reader = new FileReader();\n\n    reader.onload = function (e) {\n      var txt = e.target.result;\n      obs.onNext(txt);\n    };\n    reader.readAsText(blob);\n  } else {\n    // node land\n    // let fs = require('fs')\n    var buffer = toBuffer(arrayBuffer);\n    obs.onNext(ensureString(buffer));\n  }\n}\n\n// TODO this needs to stream the data\nfunction unpack(data) {\n  var zip = new JSZip(data);\n  // console.log(\"entries\", zip.files)\n  var entries$ = from(Object.keys(zip.files).map(function (key) {\n    return zip.files[key];\n  }));\n\n  return entries$.filter(function (entry) {\n    return entry !== undefined;\n  }).filter(function (entry) {\n    return entry._data !== null;\n  }).filter(function (entry) {\n    return entry.dir === false;\n  }).filter(function (entry) {\n    return entry.name.startsWith('3D/');\n  }).flatMap(function (entry) {\n    var result = new _rx2.default.ReplaySubject(1);\n    var ab = entry.asArrayBuffer();\n    streamZipData(ab, result);\n    return result;\n  }).catch(function (error) {\n    // console.log(\"error\",error)\n    var formated = ensureString(data); // why do we use this ?\n    return formated;\n  });\n}\n\nfunction ensureString(buf) {\n  if (typeof buf !== 'string') {\n    var array_buffer = new Uint8Array(buf);\n    var str = '';\n    for (var i = 0; i < buf.byteLength; i++) {\n      str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian\n    }\n    return str;\n  } else {\n    return buf;\n  }\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {},require(\"buffer\").Buffer)\n},{\"buffer\":3,\"jszip\":21}]},{},[70])(70)\n});\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(59).Buffer, __webpack_require__(36).setImmediate))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-3mf-parser/lib/browser/3mf-parser.js\n ** module id = 349\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-3mf-parser/lib/browser/3mf-parser.js?");
},function(module,exports,__webpack_require__){eval('var require;var require;/* WEBPACK VAR INJECTION */(function(global) {(function(f){if(true){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ctmParser = f()}})(function(){var define,module,exports;return (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 require(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = setTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = \'browser\';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = \'\'; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error(\'process.binding is not supported\');\n};\n\nprocess.cwd = function () { return \'/\' };\nprocess.chdir = function (dir) {\n    throw new Error(\'process.chdir is not supported\');\n};\nprocess.umask = function() { return 0; };\n\n},{}],2:[function(require,module,exports){\n(function (process){\n(function () {\n  // Hueristics.\n  var isNode = typeof process !== \'undefined\' && process.versions && !!process.versions.node;\n  var isBrowser = typeof window !== \'undefined\';\n  var isModule = typeof module !== \'undefined\' && !!module.exports;\n\n  // Export.\n  var detect = (isModule ? exports : (this.detect = {}));\n  detect.isNode = isNode;\n  detect.isBrowser = isBrowser;\n  detect.isModule = isModule;\n}).call(this);\n}).call(this,require(\'_process\'))\n},{"_process":1}],3:[function(require,module,exports){\n\'use strict\';\n\n/**\n * Analogue of Object.assign().\n * Copies properties from one or more source objects to\n * a target object. Existing keys on the target object will be overwritten.\n *\n * > Note: This differs from spec in some important ways:\n * > 1. Will throw if passed non-objects, including `undefined` or `null` values.\n * > 2. Does not support the curious Exception handling behavior, exceptions are thrown immediately.\n * > For more details, see:\n * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n *\n *\n *\n * @param  {Object} target      The target object to copy properties to.\n * @param  {Object} source, ... The source(s) to copy properties from.\n * @return {Object}             The updated target object.\n */\nmodule.exports = function fastAssign (target) {\n  var totalArgs = arguments.length,\n      source, i, totalKeys, keys, key, j;\n\n  for (i = 1; i < totalArgs; i++) {\n    source = arguments[i];\n    keys = Object.keys(source);\n    totalKeys = keys.length;\n    for (j = 0; j < totalKeys; j++) {\n      key = keys[j];\n      target[key] = source[key];\n    }\n  }\n  return target;\n};\n\n},{}],4:[function(require,module,exports){\n\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\n\nvar _lzma = require(\'./lzma\');\n\nvar _lzma2 = _interopRequireDefault(_lzma);\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\nvar CTM = CTM || {}; /*\n                     Copyright (c) 2011 Juan Mellado\n                     \n                     Permission is hereby granted, free of charge, to any person obtaining a copy\n                     of this software and associated documentation files (the "Software"), to deal\n                     in the Software without restriction, including without limitation the rights\n                     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n                     copies of the Software, and to permit persons to whom the Software is\n                     furnished to do so, subject to the following conditions:\n                     \n                     The above copyright notice and this permission notice shall be included in\n                     all copies or substantial portions of the Software.\n                     \n                     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n                     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n                     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n                     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n                     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n                     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n                     THE SOFTWARE.\n                     */\n\n/*\nReferences:\n- "OpenCTM: The Open Compressed Triangle Mesh file format" by Marcus Geelnard\n  http://openctm.sourceforge.net/\n*/\n\nCTM.CompressionMethod = {\n  RAW: 0x00574152,\n  MG1: 0x0031474d,\n  MG2: 0x0032474d\n};\n\nCTM.Flags = {\n  NORMALS: 0x00000001\n};\n\nCTM.File = function (stream) {\n  this.load(stream);\n};\n\nCTM.File.prototype.load = function (stream) {\n  this.header = new CTM.FileHeader(stream);\n  this.body = new CTM.FileBody(this.header);\n\n  this.getReader().read(stream, this.body);\n  /*  var reader = this.getReader()\n    reader.read(stream, this.body);*/\n};\n\nCTM.File.prototype.getReader = function () {\n  var reader;\n\n  switch (this.header.compressionMethod) {\n    case CTM.CompressionMethod.RAW:\n      reader = new CTM.ReaderRAW();\n      break;\n    case CTM.CompressionMethod.MG1:\n      reader = new CTM.ReaderMG1();\n      break;\n    case CTM.CompressionMethod.MG2:\n      reader = new CTM.ReaderMG2();\n      break;\n  }\n\n  return reader;\n};\n\nCTM.FileHeader = function (stream) {\n  stream.readInt32(); // magic "OCTM"\n  this.fileFormat = stream.readInt32();\n  this.compressionMethod = stream.readInt32();\n  this.vertexCount = stream.readInt32();\n  this.triangleCount = stream.readInt32();\n  this.uvMapCount = stream.readInt32();\n  this.attrMapCount = stream.readInt32();\n  this.flags = stream.readInt32();\n  this.comment = stream.readString();\n};\n\nCTM.FileHeader.prototype.hasNormals = function () {\n  return this.flags & CTM.Flags.NORMALS;\n};\n\nCTM.FileBody = function (header) {\n  var i = header.triangleCount * 3,\n      v = header.vertexCount * 3,\n      n = header.hasNormals() ? header.vertexCount * 3 : 0,\n      u = header.vertexCount * 2,\n      a = header.vertexCount * 4,\n      j = 0;\n\n  var data = new ArrayBuffer((i + v + n + u * header.uvMapCount + a * header.attrMapCount) * 4);\n\n  this.indices = new Uint32Array(data, 0, i);\n\n  this.vertices = new Float32Array(data, i * 4, v);\n\n  if (header.hasNormals()) {\n    this.normals = new Float32Array(data, (i + v) * 4, n);\n  }\n\n  if (header.uvMapCount) {\n    this.uvMaps = [];\n    for (j = 0; j < header.uvMapCount; ++j) {\n      this.uvMaps[j] = { uv: new Float32Array(data, (i + v + n + j * u) * 4, u) };\n    }\n  }\n\n  if (header.attrMapCount) {\n    this.attrMaps = [];\n    for (j = 0; j < header.attrMapCount; ++j) {\n      this.attrMaps[j] = { attr: new Float32Array(data, (i + v + n + u * header.uvMapCount + j * a) * 4, a) };\n    }\n  }\n};\n\nCTM.FileMG2Header = function (stream) {\n  stream.readInt32(); // magic "MG2H"\n  this.vertexPrecision = stream.readFloat32();\n  this.normalPrecision = stream.readFloat32();\n  this.lowerBoundx = stream.readFloat32();\n  this.lowerBoundy = stream.readFloat32();\n  this.lowerBoundz = stream.readFloat32();\n  this.higherBoundx = stream.readFloat32();\n  this.higherBoundy = stream.readFloat32();\n  this.higherBoundz = stream.readFloat32();\n  this.divx = stream.readInt32();\n  this.divy = stream.readInt32();\n  this.divz = stream.readInt32();\n\n  this.sizex = (this.higherBoundx - this.lowerBoundx) / this.divx;\n  this.sizey = (this.higherBoundy - this.lowerBoundy) / this.divy;\n  this.sizez = (this.higherBoundz - this.lowerBoundz) / this.divz;\n};\n\nCTM.ReaderRAW = function () {};\n\nCTM.ReaderRAW.prototype.read = function (stream, body) {\n  this.readIndices(stream, body.indices);\n  this.readVertices(stream, body.vertices);\n\n  if (body.normals) {\n    this.readNormals(stream, body.normals);\n  }\n  if (body.uvMaps) {\n    this.readUVMaps(stream, body.uvMaps);\n  }\n  if (body.attrMaps) {\n    this.readAttrMaps(stream, body.attrMaps);\n  }\n};\n\nCTM.ReaderRAW.prototype.readIndices = function (stream, indices) {\n  stream.readInt32(); // magic "INDX"\n  stream.readArrayInt32(indices);\n};\n\nCTM.ReaderRAW.prototype.readVertices = function (stream, vertices) {\n  stream.readInt32(); // magic "VERT"\n  stream.readArrayFloat32(vertices);\n};\n\nCTM.ReaderRAW.prototype.readNormals = function (stream, normals) {\n  stream.readInt32(); // magic "NORM"\n  stream.readArrayFloat32(normals);\n};\n\nCTM.ReaderRAW.prototype.readUVMaps = function (stream, uvMaps) {\n  var i = 0;\n  for (; i < uvMaps.length; ++i) {\n    stream.readInt32(); // magic "TEXC"\n\n    uvMaps[i].name = stream.readString();\n    uvMaps[i].filename = stream.readString();\n    stream.readArrayFloat32(uvMaps[i].uv);\n  }\n};\n\nCTM.ReaderRAW.prototype.readAttrMaps = function (stream, attrMaps) {\n  var i = 0;\n  for (; i < attrMaps.length; ++i) {\n    stream.readInt32(); // magic "ATTR"\n\n    attrMaps[i].name = stream.readString();\n    stream.readArrayFloat32(attrMaps[i].attr);\n  }\n};\n\nCTM.ReaderMG1 = function () {};\n\nCTM.ReaderMG1.prototype.read = function (stream, body) {\n  this.readIndices(stream, body.indices);\n  this.readVertices(stream, body.vertices);\n\n  if (body.normals) {\n    this.readNormals(stream, body.normals);\n  }\n  if (body.uvMaps) {\n    this.readUVMaps(stream, body.uvMaps);\n  }\n  if (body.attrMaps) {\n    this.readAttrMaps(stream, body.attrMaps);\n  }\n};\n\nCTM.ReaderMG1.prototype.readIndices = function (stream, indices) {\n  stream.readInt32(); // magic "INDX"\n  stream.readInt32(); // packed size\n\n  var interleaved = new CTM.InterleavedStream(indices, 3);\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n\n  CTM.restoreIndices(indices, indices.length);\n};\n\nCTM.ReaderMG1.prototype.readVertices = function (stream, vertices) {\n  stream.readInt32(); // magic "VERT"\n  stream.readInt32(); // packed size\n\n  var interleaved = new CTM.InterleavedStream(vertices, 1);\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n};\n\nCTM.ReaderMG1.prototype.readNormals = function (stream, normals) {\n  stream.readInt32(); // magic "NORM"\n  stream.readInt32(); // packed size\n\n  var interleaved = new CTM.InterleavedStream(normals, 3);\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n};\n\nCTM.ReaderMG1.prototype.readUVMaps = function (stream, uvMaps) {\n  var i = 0;\n  for (; i < uvMaps.length; ++i) {\n    stream.readInt32(); // magic "TEXC"\n\n    uvMaps[i].name = stream.readString();\n    uvMaps[i].filename = stream.readString();\n\n    stream.readInt32(); // packed size\n\n    var interleaved = new CTM.InterleavedStream(uvMaps[i].uv, 2);\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n  }\n};\n\nCTM.ReaderMG1.prototype.readAttrMaps = function (stream, attrMaps) {\n  var i = 0;\n  for (; i < attrMaps.length; ++i) {\n    stream.readInt32(); // magic "ATTR"\n\n    attrMaps[i].name = stream.readString();\n\n    stream.readInt32(); // packed size\n\n    var interleaved = new CTM.InterleavedStream(attrMaps[i].attr, 4);\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n  }\n};\n\nCTM.ReaderMG2 = function () {};\n\nCTM.ReaderMG2.prototype.read = function (stream, body) {\n  this.MG2Header = new CTM.FileMG2Header(stream);\n\n  this.readVertices(stream, body.vertices);\n  this.readIndices(stream, body.indices);\n\n  if (body.normals) {\n    this.readNormals(stream, body);\n  }\n  if (body.uvMaps) {\n    this.readUVMaps(stream, body.uvMaps);\n  }\n  if (body.attrMaps) {\n    this.readAttrMaps(stream, body.attrMaps);\n  }\n};\n\nCTM.ReaderMG2.prototype.readVertices = function (stream, vertices) {\n  stream.readInt32(); // magic "VERT"\n  stream.readInt32(); // packed size\n\n  var interleaved = new CTM.InterleavedStream(vertices, 3);\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n\n  var gridIndices = this.readGridIndices(stream, vertices);\n\n  CTM.restoreVertices(vertices, this.MG2Header, gridIndices, this.MG2Header.vertexPrecision);\n};\n\nCTM.ReaderMG2.prototype.readGridIndices = function (stream, vertices) {\n  stream.readInt32(); // magic "GIDX"\n  stream.readInt32(); // packed size\n\n  var gridIndices = new Uint32Array(vertices.length / 3);\n\n  var interleaved = new CTM.InterleavedStream(gridIndices, 1);\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n\n  CTM.restoreGridIndices(gridIndices, gridIndices.length);\n\n  return gridIndices;\n};\n\nCTM.ReaderMG2.prototype.readIndices = function (stream, indices) {\n  stream.readInt32(); // magic "INDX"\n  stream.readInt32(); // packed size\n\n  var interleaved = new CTM.InterleavedStream(indices, 3);\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n\n  CTM.restoreIndices(indices, indices.length);\n};\n\nCTM.ReaderMG2.prototype.readNormals = function (stream, body) {\n  stream.readInt32(); // magic "NORM"\n  stream.readInt32(); // packed size\n\n  var interleaved = new CTM.InterleavedStream(body.normals, 3);\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n\n  var smooth = CTM.calcSmoothNormals(body.indices, body.vertices);\n\n  CTM.restoreNormals(body.normals, smooth, this.MG2Header.normalPrecision);\n};\n\nCTM.ReaderMG2.prototype.readUVMaps = function (stream, uvMaps) {\n  var i = 0;\n  for (; i < uvMaps.length; ++i) {\n    stream.readInt32(); // magic "TEXC"\n\n    uvMaps[i].name = stream.readString();\n    uvMaps[i].filename = stream.readString();\n\n    var precision = stream.readFloat32();\n\n    stream.readInt32(); // packed size\n\n    var interleaved = new CTM.InterleavedStream(uvMaps[i].uv, 2);\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n\n    CTM.restoreMap(uvMaps[i].uv, 2, precision);\n  }\n};\n\nCTM.ReaderMG2.prototype.readAttrMaps = function (stream, attrMaps) {\n  var i = 0;\n  for (; i < attrMaps.length; ++i) {\n    stream.readInt32(); // magic "ATTR"\n\n    attrMaps[i].name = stream.readString();\n\n    var precision = stream.readFloat32();\n\n    stream.readInt32(); // packed size\n\n    var interleaved = new CTM.InterleavedStream(attrMaps[i].attr, 4);\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\n\n    CTM.restoreMap(attrMaps[i].attr, 4, precision);\n  }\n};\n\nCTM.restoreIndices = function (indices, len) {\n  var i = 3;\n  if (len > 0) {\n    indices[2] += indices[0];\n    indices[1] += indices[0];\n  }\n  for (; i < len; i += 3) {\n    indices[i] += indices[i - 3];\n\n    if (indices[i] === indices[i - 3]) {\n      indices[i + 1] += indices[i - 2];\n    } else {\n      indices[i + 1] += indices[i];\n    }\n\n    indices[i + 2] += indices[i];\n  }\n};\n\nCTM.restoreGridIndices = function (gridIndices, len) {\n  var i = 1;\n  for (; i < len; ++i) {\n    gridIndices[i] += gridIndices[i - 1];\n  }\n};\n\nCTM.restoreVertices = function (vertices, grid, gridIndices, precision) {\n  var gridIdx,\n      delta,\n      x,\n      y,\n      z,\n      intVertices = new Uint32Array(vertices.buffer, vertices.byteOffset, vertices.length),\n      ydiv = grid.divx,\n      zdiv = ydiv * grid.divy,\n      prevGridIdx = 0x7fffffff,\n      prevDelta = 0,\n      i = 0,\n      j = 0,\n      len = gridIndices.length;\n\n  for (; i < len; j += 3) {\n    x = gridIdx = gridIndices[i++];\n\n    z = ~ ~(x / zdiv);\n    x -= ~ ~(z * zdiv);\n    y = ~ ~(x / ydiv);\n    x -= ~ ~(y * ydiv);\n\n    delta = intVertices[j];\n    if (gridIdx === prevGridIdx) {\n      delta += prevDelta;\n    }\n\n    vertices[j] = grid.lowerBoundx + x * grid.sizex + precision * delta;\n    vertices[j + 1] = grid.lowerBoundy + y * grid.sizey + precision * intVertices[j + 1];\n    vertices[j + 2] = grid.lowerBoundz + z * grid.sizez + precision * intVertices[j + 2];\n\n    prevGridIdx = gridIdx;\n    prevDelta = delta;\n  }\n};\n\nCTM.restoreNormals = function (normals, smooth, precision) {\n  var ro,\n      phi,\n      theta,\n      sinPhi,\n      nx,\n      ny,\n      nz,\n      by,\n      bz,\n      len,\n      intNormals = new Uint32Array(normals.buffer, normals.byteOffset, normals.length),\n      i = 0,\n      k = normals.length,\n      PI_DIV_2 = 3.141592653589793238462643 * 0.5;\n\n  for (; i < k; i += 3) {\n    ro = intNormals[i] * precision;\n    phi = intNormals[i + 1];\n\n    if (phi === 0) {\n      normals[i] = smooth[i] * ro;\n      normals[i + 1] = smooth[i + 1] * ro;\n      normals[i + 2] = smooth[i + 2] * ro;\n    } else {\n      if (phi <= 4) {\n        theta = (intNormals[i + 2] - 2) * PI_DIV_2;\n      } else {\n        theta = (intNormals[i + 2] * 4 / phi - 2) * PI_DIV_2;\n      }\n\n      phi *= precision * PI_DIV_2;\n      sinPhi = ro * Math.sin(phi);\n\n      nx = sinPhi * Math.cos(theta);\n      ny = sinPhi * Math.sin(theta);\n      nz = ro * Math.cos(phi);\n\n      bz = smooth[i + 1];\n      by = smooth[i] - smooth[i + 2];\n\n      len = Math.sqrt(2 * bz * bz + by * by);\n      if (len > 1e-20) {\n        by /= len;\n        bz /= len;\n      }\n\n      normals[i] = smooth[i] * nz + (smooth[i + 1] * bz - smooth[i + 2] * by) * ny - bz * nx;\n      normals[i + 1] = smooth[i + 1] * nz - (smooth[i + 2] + smooth[i]) * bz * ny + by * nx;\n      normals[i + 2] = smooth[i + 2] * nz + (smooth[i] * by + smooth[i + 1] * bz) * ny + bz * nx;\n    }\n  }\n};\n\nCTM.restoreMap = function (map, count, precision) {\n  var delta,\n      value,\n      intMap = new Uint32Array(map.buffer, map.byteOffset, map.length),\n      i = 0,\n      j,\n      len = map.length;\n\n  for (; i < count; ++i) {\n    delta = 0;\n\n    for (j = i; j < len; j += count) {\n      value = intMap[j];\n\n      delta += value & 1 ? -(value + 1 >> 1) : value >> 1;\n\n      map[j] = delta * precision;\n    }\n  }\n};\n\nCTM.calcSmoothNormals = function (indices, vertices) {\n  var smooth = new Float32Array(vertices.length),\n      indx,\n      indy,\n      indz,\n      nx,\n      ny,\n      nz,\n      v1x,\n      v1y,\n      v1z,\n      v2x,\n      v2y,\n      v2z,\n      len,\n      i,\n      k;\n\n  for (i = 0, k = indices.length; i < k;) {\n    indx = indices[i++] * 3;\n    indy = indices[i++] * 3;\n    indz = indices[i++] * 3;\n\n    v1x = vertices[indy] - vertices[indx];\n    v2x = vertices[indz] - vertices[indx];\n    v1y = vertices[indy + 1] - vertices[indx + 1];\n    v2y = vertices[indz + 1] - vertices[indx + 1];\n    v1z = vertices[indy + 2] - vertices[indx + 2];\n    v2z = vertices[indz + 2] - vertices[indx + 2];\n\n    nx = v1y * v2z - v1z * v2y;\n    ny = v1z * v2x - v1x * v2z;\n    nz = v1x * v2y - v1y * v2x;\n\n    len = Math.sqrt(nx * nx + ny * ny + nz * nz);\n    if (len > 1e-10) {\n      nx /= len;\n      ny /= len;\n      nz /= len;\n    }\n\n    smooth[indx] += nx;\n    smooth[indx + 1] += ny;\n    smooth[indx + 2] += nz;\n    smooth[indy] += nx;\n    smooth[indy + 1] += ny;\n    smooth[indy + 2] += nz;\n    smooth[indz] += nx;\n    smooth[indz + 1] += ny;\n    smooth[indz + 2] += nz;\n  }\n\n  for (i = 0, k = smooth.length; i < k; i += 3) {\n    len = Math.sqrt(smooth[i] * smooth[i] + smooth[i + 1] * smooth[i + 1] + smooth[i + 2] * smooth[i + 2]);\n\n    if (len > 1e-10) {\n      smooth[i] /= len;\n      smooth[i + 1] /= len;\n      smooth[i + 2] /= len;\n    }\n  }\n\n  return smooth;\n};\n\nCTM.isLittleEndian = (function () {\n  var buffer = new ArrayBuffer(2),\n      bytes = new Uint8Array(buffer),\n      ints = new Uint16Array(buffer);\n\n  bytes[0] = 1;\n\n  return ints[0] === 1;\n})();\n\nCTM.InterleavedStream = function (data, count) {\n  this.data = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n  this.offset = CTM.isLittleEndian ? 3 : 0;\n  this.count = count * 4;\n  this.len = this.data.length;\n};\n\nCTM.InterleavedStream.prototype.writeByte = function (value) {\n  this.data[this.offset] = value;\n\n  this.offset += this.count;\n  if (this.offset >= this.len) {\n    this.offset -= this.len - 4;\n    if (this.offset >= this.count) {\n      this.offset -= this.count + (CTM.isLittleEndian ? 1 : -1);\n    }\n  }\n};\n\nCTM.Stream = function (data) {\n  this.data = data;\n  this.offset = 0;\n};\n\nCTM.Stream.prototype.TWO_POW_MINUS23 = Math.pow(2, -23);\n\nCTM.Stream.prototype.TWO_POW_MINUS126 = Math.pow(2, -126);\n\nCTM.Stream.prototype.readByte = function () {\n  return this.data[this.offset++] & 0xff;\n};\n\nCTM.Stream.prototype.readInt32 = function () {\n  var i = this.readByte();\n  i |= this.readByte() << 8;\n  i |= this.readByte() << 16;\n  return i | this.readByte() << 24;\n};\n\nCTM.Stream.prototype.readFloat32 = function () {\n  var m = this.readByte();\n  m += this.readByte() << 8;\n\n  var b1 = this.readByte();\n  var b2 = this.readByte();\n\n  m += (b1 & 0x7f) << 16;\n  var e = (b2 & 0x7f) << 1 | (b1 & 0x80) >>> 7;\n  var s = b2 & 0x80 ? -1 : 1;\n\n  if (e === 255) {\n    return m !== 0 ? NaN : s * Infinity;\n  }\n  if (e > 0) {\n    return s * (1 + m * this.TWO_POW_MINUS23) * Math.pow(2, e - 127);\n  }\n  if (m !== 0) {\n    return s * m * this.TWO_POW_MINUS126;\n  }\n  return s * 0;\n};\n\nCTM.Stream.prototype.readString = function () {\n  var len = this.readInt32();\n\n  this.offset += len;\n\n  return String.fromCharCode.apply(null, this.data.subarray(this.offset - len, this.offset));\n};\n\nCTM.Stream.prototype.readArrayInt32 = function (array) {\n  var i = 0,\n      len = array.length;\n\n  while (i < len) {\n    array[i++] = this.readInt32();\n  }\n\n  return array;\n};\n\nCTM.Stream.prototype.readArrayFloat32 = function (array) {\n  var i = 0,\n      len = array.length;\n\n  while (i < len) {\n    array[i++] = this.readFloat32();\n  }\n\n  return array;\n};\n\nexports.default = CTM;\n\n},{"./lzma":6}],5:[function(require,module,exports){\n(function (global){\n\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.inputDataType = exports.outputs = undefined;\nexports.default = parse;\n\nvar _compositeDetect = require(\'composite-detect\');\n\nvar _compositeDetect2 = _interopRequireDefault(_compositeDetect);\n\nvar _assign = require(\'fast.js/object/assign\');\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _rx = typeof window !== "undefined" ? window[\'Rx\'] : typeof global !== "undefined" ? global[\'Rx\'] : null;\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ctm = require(\'./ctm\');\n\nvar _ctm2 = _interopRequireDefault(_ctm);\n\nvar _utils = require(\'./utils\');\n\nvar _parseHelpers = require(\'./parseHelpers\');\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\n// import {parseSteps} from \'./parseHelpers\'\n\n/**\n * Loader for CTM encoded models generated by OpenCTM tools:\n *	http://openctm.sourceforge.net/\n *\n * Uses js-openctm library by Juan Mellado\n *	http://code.google.com/p/js-openctm/\n *\n * @author alteredq / http://alteredqualia.com/\n * heavilly modified by kaosat-dev\n */\n\nvar outputs = exports.outputs = [\'geometry\']; // to be able to auto determine data type(s) fetched by parser\nvar inputDataType = exports.inputDataType = \'arrayBuffer\'; // to be able to set required input data type\n\n// Load CTM compressed models\nfunction parse(data) {\n  var parameters = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n  var defaults = {\n    useWorker: _compositeDetect2.default.isBrowser === true,\n    offsets: [0]\n  };\n  parameters = (0, _assign2.default)({}, defaults, parameters);\n\n  var _parameters = parameters;\n  var useWorker = _parameters.useWorker;\n  var offsets = _parameters.offsets;\n\n  var obs = new _rx2.default.ReplaySubject(1);\n\n  var length = 0;\n  data = (0, _utils.ensureArrayBuffer)(data);\n\n  var binaryData = new Uint8Array(data);\n  var result = null;\n\n  // var binaryData = new Uint8Array(data)\n  // var binaryData = new Uint8Array( new ArrayBuffer(data) )\n  // var binaryData = new Buffer( new Uint8Array(data) )\n\n  // TODO: this is only temporary for NODE.js side\n  // var data = toArrayBuffer(data)\n\n  if (useWorker) {\n    (function () {\n      // let Worker = require("./worker.js");//Webpack worker!\n      // var worker = new Worker\n\n      var worker = new Worker(window.URL.createObjectURL(new Blob([\'(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);throw new Error("Cannot find module \\\'"+o+"\\\'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\\n\\\'use strict\\\';\\n\\nObject.defineProperty(exports, "__esModule", {\\n  value: true\\n});\\n\\nvar _lzma = require(\\\'./lzma\\\');\\n\\nvar _lzma2 = _interopRequireDefault(_lzma);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nvar CTM = CTM || {}; /*\\n                     Copyright (c) 2011 Juan Mellado\\n                     \\n                     Permission is hereby granted, free of charge, to any person obtaining a copy\\n                     of this software and associated documentation files (the "Software"), to deal\\n                     in the Software without restriction, including without limitation the rights\\n                     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\\n                     copies of the Software, and to permit persons to whom the Software is\\n                     furnished to do so, subject to the following conditions:\\n                     \\n                     The above copyright notice and this permission notice shall be included in\\n                     all copies or substantial portions of the Software.\\n                     \\n                     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\\n                     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\\n                     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\\n                     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\\n                     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\\n                     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\\n                     THE SOFTWARE.\\n                     */\\n\\n/*\\nReferences:\\n- "OpenCTM: The Open Compressed Triangle Mesh file format" by Marcus Geelnard\\n  http://openctm.sourceforge.net/\\n*/\\n\\nCTM.CompressionMethod = {\\n  RAW: 0x00574152,\\n  MG1: 0x0031474d,\\n  MG2: 0x0032474d\\n};\\n\\nCTM.Flags = {\\n  NORMALS: 0x00000001\\n};\\n\\nCTM.File = function (stream) {\\n  this.load(stream);\\n};\\n\\nCTM.File.prototype.load = function (stream) {\\n  this.header = new CTM.FileHeader(stream);\\n  this.body = new CTM.FileBody(this.header);\\n\\n  this.getReader().read(stream, this.body);\\n  /*  var reader = this.getReader()\\n    reader.read(stream, this.body);*/\\n};\\n\\nCTM.File.prototype.getReader = function () {\\n  var reader;\\n\\n  switch (this.header.compressionMethod) {\\n    case CTM.CompressionMethod.RAW:\\n      reader = new CTM.ReaderRAW();\\n      break;\\n    case CTM.CompressionMethod.MG1:\\n      reader = new CTM.ReaderMG1();\\n      break;\\n    case CTM.CompressionMethod.MG2:\\n      reader = new CTM.ReaderMG2();\\n      break;\\n  }\\n\\n  return reader;\\n};\\n\\nCTM.FileHeader = function (stream) {\\n  stream.readInt32(); // magic "OCTM"\\n  this.fileFormat = stream.readInt32();\\n  this.compressionMethod = stream.readInt32();\\n  this.vertexCount = stream.readInt32();\\n  this.triangleCount = stream.readInt32();\\n  this.uvMapCount = stream.readInt32();\\n  this.attrMapCount = stream.readInt32();\\n  this.flags = stream.readInt32();\\n  this.comment = stream.readString();\\n};\\n\\nCTM.FileHeader.prototype.hasNormals = function () {\\n  return this.flags & CTM.Flags.NORMALS;\\n};\\n\\nCTM.FileBody = function (header) {\\n  var i = header.triangleCount * 3,\\n      v = header.vertexCount * 3,\\n      n = header.hasNormals() ? header.vertexCount * 3 : 0,\\n      u = header.vertexCount * 2,\\n      a = header.vertexCount * 4,\\n      j = 0;\\n\\n  var data = new ArrayBuffer((i + v + n + u * header.uvMapCount + a * header.attrMapCount) * 4);\\n\\n  this.indices = new Uint32Array(data, 0, i);\\n\\n  this.vertices = new Float32Array(data, i * 4, v);\\n\\n  if (header.hasNormals()) {\\n    this.normals = new Float32Array(data, (i + v) * 4, n);\\n  }\\n\\n  if (header.uvMapCount) {\\n    this.uvMaps = [];\\n    for (j = 0; j < header.uvMapCount; ++j) {\\n      this.uvMaps[j] = { uv: new Float32Array(data, (i + v + n + j * u) * 4, u) };\\n    }\\n  }\\n\\n  if (header.attrMapCount) {\\n    this.attrMaps = [];\\n    for (j = 0; j < header.attrMapCount; ++j) {\\n      this.attrMaps[j] = { attr: new Float32Array(data, (i + v + n + u * header.uvMapCount + j * a) * 4, a) };\\n    }\\n  }\\n};\\n\\nCTM.FileMG2Header = function (stream) {\\n  stream.readInt32(); // magic "MG2H"\\n  this.vertexPrecision = stream.readFloat32();\\n  this.normalPrecision = stream.readFloat32();\\n  this.lowerBoundx = stream.readFloat32();\\n  this.lowerBoundy = stream.readFloat32();\\n  this.lowerBoundz = stream.readFloat32();\\n  this.higherBoundx = stream.readFloat32();\\n  this.higherBoundy = stream.readFloat32();\\n  this.higherBoundz = stream.readFloat32();\\n  this.divx = stream.readInt32();\\n  this.divy = stream.readInt32();\\n  this.divz = stream.readInt32();\\n\\n  this.sizex = (this.higherBoundx - this.lowerBoundx) / this.divx;\\n  this.sizey = (this.higherBoundy - this.lowerBoundy) / this.divy;\\n  this.sizez = (this.higherBoundz - this.lowerBoundz) / this.divz;\\n};\\n\\nCTM.ReaderRAW = function () {};\\n\\nCTM.ReaderRAW.prototype.read = function (stream, body) {\\n  this.readIndices(stream, body.indices);\\n  this.readVertices(stream, body.vertices);\\n\\n  if (body.normals) {\\n    this.readNormals(stream, body.normals);\\n  }\\n  if (body.uvMaps) {\\n    this.readUVMaps(stream, body.uvMaps);\\n  }\\n  if (body.attrMaps) {\\n    this.readAttrMaps(stream, body.attrMaps);\\n  }\\n};\\n\\nCTM.ReaderRAW.prototype.readIndices = function (stream, indices) {\\n  stream.readInt32(); // magic "INDX"\\n  stream.readArrayInt32(indices);\\n};\\n\\nCTM.ReaderRAW.prototype.readVertices = function (stream, vertices) {\\n  stream.readInt32(); // magic "VERT"\\n  stream.readArrayFloat32(vertices);\\n};\\n\\nCTM.ReaderRAW.prototype.readNormals = function (stream, normals) {\\n  stream.readInt32(); // magic "NORM"\\n  stream.readArrayFloat32(normals);\\n};\\n\\nCTM.ReaderRAW.prototype.readUVMaps = function (stream, uvMaps) {\\n  var i = 0;\\n  for (; i < uvMaps.length; ++i) {\\n    stream.readInt32(); // magic "TEXC"\\n\\n    uvMaps[i].name = stream.readString();\\n    uvMaps[i].filename = stream.readString();\\n    stream.readArrayFloat32(uvMaps[i].uv);\\n  }\\n};\\n\\nCTM.ReaderRAW.prototype.readAttrMaps = function (stream, attrMaps) {\\n  var i = 0;\\n  for (; i < attrMaps.length; ++i) {\\n    stream.readInt32(); // magic "ATTR"\\n\\n    attrMaps[i].name = stream.readString();\\n    stream.readArrayFloat32(attrMaps[i].attr);\\n  }\\n};\\n\\nCTM.ReaderMG1 = function () {};\\n\\nCTM.ReaderMG1.prototype.read = function (stream, body) {\\n  this.readIndices(stream, body.indices);\\n  this.readVertices(stream, body.vertices);\\n\\n  if (body.normals) {\\n    this.readNormals(stream, body.normals);\\n  }\\n  if (body.uvMaps) {\\n    this.readUVMaps(stream, body.uvMaps);\\n  }\\n  if (body.attrMaps) {\\n    this.readAttrMaps(stream, body.attrMaps);\\n  }\\n};\\n\\nCTM.ReaderMG1.prototype.readIndices = function (stream, indices) {\\n  stream.readInt32(); // magic "INDX"\\n  stream.readInt32(); // packed size\\n\\n  var interleaved = new CTM.InterleavedStream(indices, 3);\\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n\\n  CTM.restoreIndices(indices, indices.length);\\n};\\n\\nCTM.ReaderMG1.prototype.readVertices = function (stream, vertices) {\\n  stream.readInt32(); // magic "VERT"\\n  stream.readInt32(); // packed size\\n\\n  var interleaved = new CTM.InterleavedStream(vertices, 1);\\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n};\\n\\nCTM.ReaderMG1.prototype.readNormals = function (stream, normals) {\\n  stream.readInt32(); // magic "NORM"\\n  stream.readInt32(); // packed size\\n\\n  var interleaved = new CTM.InterleavedStream(normals, 3);\\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n};\\n\\nCTM.ReaderMG1.prototype.readUVMaps = function (stream, uvMaps) {\\n  var i = 0;\\n  for (; i < uvMaps.length; ++i) {\\n    stream.readInt32(); // magic "TEXC"\\n\\n    uvMaps[i].name = stream.readString();\\n    uvMaps[i].filename = stream.readString();\\n\\n    stream.readInt32(); // packed size\\n\\n    var interleaved = new CTM.InterleavedStream(uvMaps[i].uv, 2);\\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n  }\\n};\\n\\nCTM.ReaderMG1.prototype.readAttrMaps = function (stream, attrMaps) {\\n  var i = 0;\\n  for (; i < attrMaps.length; ++i) {\\n    stream.readInt32(); // magic "ATTR"\\n\\n    attrMaps[i].name = stream.readString();\\n\\n    stream.readInt32(); // packed size\\n\\n    var interleaved = new CTM.InterleavedStream(attrMaps[i].attr, 4);\\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n  }\\n};\\n\\nCTM.ReaderMG2 = function () {};\\n\\nCTM.ReaderMG2.prototype.read = function (stream, body) {\\n  this.MG2Header = new CTM.FileMG2Header(stream);\\n\\n  this.readVertices(stream, body.vertices);\\n  this.readIndices(stream, body.indices);\\n\\n  if (body.normals) {\\n    this.readNormals(stream, body);\\n  }\\n  if (body.uvMaps) {\\n    this.readUVMaps(stream, body.uvMaps);\\n  }\\n  if (body.attrMaps) {\\n    this.readAttrMaps(stream, body.attrMaps);\\n  }\\n};\\n\\nCTM.ReaderMG2.prototype.readVertices = function (stream, vertices) {\\n  stream.readInt32(); // magic "VERT"\\n  stream.readInt32(); // packed size\\n\\n  var interleaved = new CTM.InterleavedStream(vertices, 3);\\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n\\n  var gridIndices = this.readGridIndices(stream, vertices);\\n\\n  CTM.restoreVertices(vertices, this.MG2Header, gridIndices, this.MG2Header.vertexPrecision);\\n};\\n\\nCTM.ReaderMG2.prototype.readGridIndices = function (stream, vertices) {\\n  stream.readInt32(); // magic "GIDX"\\n  stream.readInt32(); // packed size\\n\\n  var gridIndices = new Uint32Array(vertices.length / 3);\\n\\n  var interleaved = new CTM.InterleavedStream(gridIndices, 1);\\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n\\n  CTM.restoreGridIndices(gridIndices, gridIndices.length);\\n\\n  return gridIndices;\\n};\\n\\nCTM.ReaderMG2.prototype.readIndices = function (stream, indices) {\\n  stream.readInt32(); // magic "INDX"\\n  stream.readInt32(); // packed size\\n\\n  var interleaved = new CTM.InterleavedStream(indices, 3);\\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n\\n  CTM.restoreIndices(indices, indices.length);\\n};\\n\\nCTM.ReaderMG2.prototype.readNormals = function (stream, body) {\\n  stream.readInt32(); // magic "NORM"\\n  stream.readInt32(); // packed size\\n\\n  var interleaved = new CTM.InterleavedStream(body.normals, 3);\\n  _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n\\n  var smooth = CTM.calcSmoothNormals(body.indices, body.vertices);\\n\\n  CTM.restoreNormals(body.normals, smooth, this.MG2Header.normalPrecision);\\n};\\n\\nCTM.ReaderMG2.prototype.readUVMaps = function (stream, uvMaps) {\\n  var i = 0;\\n  for (; i < uvMaps.length; ++i) {\\n    stream.readInt32(); // magic "TEXC"\\n\\n    uvMaps[i].name = stream.readString();\\n    uvMaps[i].filename = stream.readString();\\n\\n    var precision = stream.readFloat32();\\n\\n    stream.readInt32(); // packed size\\n\\n    var interleaved = new CTM.InterleavedStream(uvMaps[i].uv, 2);\\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n\\n    CTM.restoreMap(uvMaps[i].uv, 2, precision);\\n  }\\n};\\n\\nCTM.ReaderMG2.prototype.readAttrMaps = function (stream, attrMaps) {\\n  var i = 0;\\n  for (; i < attrMaps.length; ++i) {\\n    stream.readInt32(); // magic "ATTR"\\n\\n    attrMaps[i].name = stream.readString();\\n\\n    var precision = stream.readFloat32();\\n\\n    stream.readInt32(); // packed size\\n\\n    var interleaved = new CTM.InterleavedStream(attrMaps[i].attr, 4);\\n    _lzma2.default.decompress(stream, stream, interleaved, interleaved.data.length);\\n\\n    CTM.restoreMap(attrMaps[i].attr, 4, precision);\\n  }\\n};\\n\\nCTM.restoreIndices = function (indices, len) {\\n  var i = 3;\\n  if (len > 0) {\\n    indices[2] += indices[0];\\n    indices[1] += indices[0];\\n  }\\n  for (; i < len; i += 3) {\\n    indices[i] += indices[i - 3];\\n\\n    if (indices[i] === indices[i - 3]) {\\n      indices[i + 1] += indices[i - 2];\\n    } else {\\n      indices[i + 1] += indices[i];\\n    }\\n\\n    indices[i + 2] += indices[i];\\n  }\\n};\\n\\nCTM.restoreGridIndices = function (gridIndices, len) {\\n  var i = 1;\\n  for (; i < len; ++i) {\\n    gridIndices[i] += gridIndices[i - 1];\\n  }\\n};\\n\\nCTM.restoreVertices = function (vertices, grid, gridIndices, precision) {\\n  var gridIdx,\\n      delta,\\n      x,\\n      y,\\n      z,\\n      intVertices = new Uint32Array(vertices.buffer, vertices.byteOffset, vertices.length),\\n      ydiv = grid.divx,\\n      zdiv = ydiv * grid.divy,\\n      prevGridIdx = 0x7fffffff,\\n      prevDelta = 0,\\n      i = 0,\\n      j = 0,\\n      len = gridIndices.length;\\n\\n  for (; i < len; j += 3) {\\n    x = gridIdx = gridIndices[i++];\\n\\n    z = ~ ~(x / zdiv);\\n    x -= ~ ~(z * zdiv);\\n    y = ~ ~(x / ydiv);\\n    x -= ~ ~(y * ydiv);\\n\\n    delta = intVertices[j];\\n    if (gridIdx === prevGridIdx) {\\n      delta += prevDelta;\\n    }\\n\\n    vertices[j] = grid.lowerBoundx + x * grid.sizex + precision * delta;\\n    vertices[j + 1] = grid.lowerBoundy + y * grid.sizey + precision * intVertices[j + 1];\\n    vertices[j + 2] = grid.lowerBoundz + z * grid.sizez + precision * intVertices[j + 2];\\n\\n    prevGridIdx = gridIdx;\\n    prevDelta = delta;\\n  }\\n};\\n\\nCTM.restoreNormals = function (normals, smooth, precision) {\\n  var ro,\\n      phi,\\n      theta,\\n      sinPhi,\\n      nx,\\n      ny,\\n      nz,\\n      by,\\n      bz,\\n      len,\\n      intNormals = new Uint32Array(normals.buffer, normals.byteOffset, normals.length),\\n      i = 0,\\n      k = normals.length,\\n      PI_DIV_2 = 3.141592653589793238462643 * 0.5;\\n\\n  for (; i < k; i += 3) {\\n    ro = intNormals[i] * precision;\\n    phi = intNormals[i + 1];\\n\\n    if (phi === 0) {\\n      normals[i] = smooth[i] * ro;\\n      normals[i + 1] = smooth[i + 1] * ro;\\n      normals[i + 2] = smooth[i + 2] * ro;\\n    } else {\\n      if (phi <= 4) {\\n        theta = (intNormals[i + 2] - 2) * PI_DIV_2;\\n      } else {\\n        theta = (intNormals[i + 2] * 4 / phi - 2) * PI_DIV_2;\\n      }\\n\\n      phi *= precision * PI_DIV_2;\\n      sinPhi = ro * Math.sin(phi);\\n\\n      nx = sinPhi * Math.cos(theta);\\n      ny = sinPhi * Math.sin(theta);\\n      nz = ro * Math.cos(phi);\\n\\n      bz = smooth[i + 1];\\n      by = smooth[i] - smooth[i + 2];\\n\\n      len = Math.sqrt(2 * bz * bz + by * by);\\n      if (len > 1e-20) {\\n        by /= len;\\n        bz /= len;\\n      }\\n\\n      normals[i] = smooth[i] * nz + (smooth[i + 1] * bz - smooth[i + 2] * by) * ny - bz * nx;\\n      normals[i + 1] = smooth[i + 1] * nz - (smooth[i + 2] + smooth[i]) * bz * ny + by * nx;\\n      normals[i + 2] = smooth[i + 2] * nz + (smooth[i] * by + smooth[i + 1] * bz) * ny + bz * nx;\\n    }\\n  }\\n};\\n\\nCTM.restoreMap = function (map, count, precision) {\\n  var delta,\\n      value,\\n      intMap = new Uint32Array(map.buffer, map.byteOffset, map.length),\\n      i = 0,\\n      j,\\n      len = map.length;\\n\\n  for (; i < count; ++i) {\\n    delta = 0;\\n\\n    for (j = i; j < len; j += count) {\\n      value = intMap[j];\\n\\n      delta += value & 1 ? -(value + 1 >> 1) : value >> 1;\\n\\n      map[j] = delta * precision;\\n    }\\n  }\\n};\\n\\nCTM.calcSmoothNormals = function (indices, vertices) {\\n  var smooth = new Float32Array(vertices.length),\\n      indx,\\n      indy,\\n      indz,\\n      nx,\\n      ny,\\n      nz,\\n      v1x,\\n      v1y,\\n      v1z,\\n      v2x,\\n      v2y,\\n      v2z,\\n      len,\\n      i,\\n      k;\\n\\n  for (i = 0, k = indices.length; i < k;) {\\n    indx = indices[i++] * 3;\\n    indy = indices[i++] * 3;\\n    indz = indices[i++] * 3;\\n\\n    v1x = vertices[indy] - vertices[indx];\\n    v2x = vertices[indz] - vertices[indx];\\n    v1y = vertices[indy + 1] - vertices[indx + 1];\\n    v2y = vertices[indz + 1] - vertices[indx + 1];\\n    v1z = vertices[indy + 2] - vertices[indx + 2];\\n    v2z = vertices[indz + 2] - vertices[indx + 2];\\n\\n    nx = v1y * v2z - v1z * v2y;\\n    ny = v1z * v2x - v1x * v2z;\\n    nz = v1x * v2y - v1y * v2x;\\n\\n    len = Math.sqrt(nx * nx + ny * ny + nz * nz);\\n    if (len > 1e-10) {\\n      nx /= len;\\n      ny /= len;\\n      nz /= len;\\n    }\\n\\n    smooth[indx] += nx;\\n    smooth[indx + 1] += ny;\\n    smooth[indx + 2] += nz;\\n    smooth[indy] += nx;\\n    smooth[indy + 1] += ny;\\n    smooth[indy + 2] += nz;\\n    smooth[indz] += nx;\\n    smooth[indz + 1] += ny;\\n    smooth[indz + 2] += nz;\\n  }\\n\\n  for (i = 0, k = smooth.length; i < k; i += 3) {\\n    len = Math.sqrt(smooth[i] * smooth[i] + smooth[i + 1] * smooth[i + 1] + smooth[i + 2] * smooth[i + 2]);\\n\\n    if (len > 1e-10) {\\n      smooth[i] /= len;\\n      smooth[i + 1] /= len;\\n      smooth[i + 2] /= len;\\n    }\\n  }\\n\\n  return smooth;\\n};\\n\\nCTM.isLittleEndian = (function () {\\n  var buffer = new ArrayBuffer(2),\\n      bytes = new Uint8Array(buffer),\\n      ints = new Uint16Array(buffer);\\n\\n  bytes[0] = 1;\\n\\n  return ints[0] === 1;\\n})();\\n\\nCTM.InterleavedStream = function (data, count) {\\n  this.data = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\\n  this.offset = CTM.isLittleEndian ? 3 : 0;\\n  this.count = count * 4;\\n  this.len = this.data.length;\\n};\\n\\nCTM.InterleavedStream.prototype.writeByte = function (value) {\\n  this.data[this.offset] = value;\\n\\n  this.offset += this.count;\\n  if (this.offset >= this.len) {\\n    this.offset -= this.len - 4;\\n    if (this.offset >= this.count) {\\n      this.offset -= this.count + (CTM.isLittleEndian ? 1 : -1);\\n    }\\n  }\\n};\\n\\nCTM.Stream = function (data) {\\n  this.data = data;\\n  this.offset = 0;\\n};\\n\\nCTM.Stream.prototype.TWO_POW_MINUS23 = Math.pow(2, -23);\\n\\nCTM.Stream.prototype.TWO_POW_MINUS126 = Math.pow(2, -126);\\n\\nCTM.Stream.prototype.readByte = function () {\\n  return this.data[this.offset++] & 0xff;\\n};\\n\\nCTM.Stream.prototype.readInt32 = function () {\\n  var i = this.readByte();\\n  i |= this.readByte() << 8;\\n  i |= this.readByte() << 16;\\n  return i | this.readByte() << 24;\\n};\\n\\nCTM.Stream.prototype.readFloat32 = function () {\\n  var m = this.readByte();\\n  m += this.readByte() << 8;\\n\\n  var b1 = this.readByte();\\n  var b2 = this.readByte();\\n\\n  m += (b1 & 0x7f) << 16;\\n  var e = (b2 & 0x7f) << 1 | (b1 & 0x80) >>> 7;\\n  var s = b2 & 0x80 ? -1 : 1;\\n\\n  if (e === 255) {\\n    return m !== 0 ? NaN : s * Infinity;\\n  }\\n  if (e > 0) {\\n    return s * (1 + m * this.TWO_POW_MINUS23) * Math.pow(2, e - 127);\\n  }\\n  if (m !== 0) {\\n    return s * m * this.TWO_POW_MINUS126;\\n  }\\n  return s * 0;\\n};\\n\\nCTM.Stream.prototype.readString = function () {\\n  var len = this.readInt32();\\n\\n  this.offset += len;\\n\\n  return String.fromCharCode.apply(null, this.data.subarray(this.offset - len, this.offset));\\n};\\n\\nCTM.Stream.prototype.readArrayInt32 = function (array) {\\n  var i = 0,\\n      len = array.length;\\n\\n  while (i < len) {\\n    array[i++] = this.readInt32();\\n  }\\n\\n  return array;\\n};\\n\\nCTM.Stream.prototype.readArrayFloat32 = function (array) {\\n  var i = 0,\\n      len = array.length;\\n\\n  while (i < len) {\\n    array[i++] = this.readFloat32();\\n  }\\n\\n  return array;\\n};\\n\\nexports.default = CTM;\\n\\n},{"./lzma":2}],2:[function(require,module,exports){\\n\\\'use strict\\\';\\n\\nObject.defineProperty(exports, "__esModule", {\\n  value: true\\n});\\nvar LZMA = LZMA || {};\\n\\nLZMA.OutWindow = function () {\\n  this._windowSize = 0;\\n};\\n\\nLZMA.OutWindow.prototype.create = function (windowSize) {\\n  if (!this._buffer || this._windowSize !== windowSize) {\\n    this._buffer = [];\\n  }\\n  this._windowSize = windowSize;\\n  this._pos = 0;\\n  this._streamPos = 0;\\n};\\n\\nLZMA.OutWindow.prototype.flush = function () {\\n  var size = this._pos - this._streamPos;\\n  if (size !== 0) {\\n    while (size--) {\\n      this._stream.writeByte(this._buffer[this._streamPos++]);\\n    }\\n    if (this._pos >= this._windowSize) {\\n      this._pos = 0;\\n    }\\n    this._streamPos = this._pos;\\n  }\\n};\\n\\nLZMA.OutWindow.prototype.releaseStream = function () {\\n  this.flush();\\n  this._stream = null;\\n};\\n\\nLZMA.OutWindow.prototype.setStream = function (stream) {\\n  this.releaseStream();\\n  this._stream = stream;\\n};\\n\\nLZMA.OutWindow.prototype.init = function (solid) {\\n  if (!solid) {\\n    this._streamPos = 0;\\n    this._pos = 0;\\n  }\\n};\\n\\nLZMA.OutWindow.prototype.copyBlock = function (distance, len) {\\n  var pos = this._pos - distance - 1;\\n  if (pos < 0) {\\n    pos += this._windowSize;\\n  }\\n  while (len--) {\\n    if (pos >= this._windowSize) {\\n      pos = 0;\\n    }\\n    this._buffer[this._pos++] = this._buffer[pos++];\\n    if (this._pos >= this._windowSize) {\\n      this.flush();\\n    }\\n  }\\n};\\n\\nLZMA.OutWindow.prototype.putByte = function (b) {\\n  this._buffer[this._pos++] = b;\\n  if (this._pos >= this._windowSize) {\\n    this.flush();\\n  }\\n};\\n\\nLZMA.OutWindow.prototype.getByte = function (distance) {\\n  var pos = this._pos - distance - 1;\\n  if (pos < 0) {\\n    pos += this._windowSize;\\n  }\\n  return this._buffer[pos];\\n};\\n\\nLZMA.RangeDecoder = function () {};\\n\\nLZMA.RangeDecoder.prototype.setStream = function (stream) {\\n  this._stream = stream;\\n};\\n\\nLZMA.RangeDecoder.prototype.releaseStream = function () {\\n  this._stream = null;\\n};\\n\\nLZMA.RangeDecoder.prototype.init = function () {\\n  var i = 5;\\n\\n  this._code = 0;\\n  this._range = -1;\\n\\n  while (i--) {\\n    this._code = this._code << 8 | this._stream.readByte();\\n  }\\n};\\n\\nLZMA.RangeDecoder.prototype.decodeDirectBits = function (numTotalBits) {\\n  var result = 0,\\n      i = numTotalBits,\\n      t;\\n\\n  while (i--) {\\n    this._range >>>= 1;\\n    t = this._code - this._range >>> 31;\\n    this._code -= this._range & t - 1;\\n    result = result << 1 | 1 - t;\\n\\n    if ((this._range & 0xff000000) === 0) {\\n      this._code = this._code << 8 | this._stream.readByte();\\n      this._range <<= 8;\\n    }\\n  }\\n\\n  return result;\\n};\\n\\nLZMA.RangeDecoder.prototype.decodeBit = function (probs, index) {\\n  var prob = probs[index],\\n      newBound = (this._range >>> 11) * prob;\\n\\n  if ((this._code ^ 0x80000000) < (newBound ^ 0x80000000)) {\\n    this._range = newBound;\\n    probs[index] += 2048 - prob >>> 5;\\n    if ((this._range & 0xff000000) === 0) {\\n      this._code = this._code << 8 | this._stream.readByte();\\n      this._range <<= 8;\\n    }\\n    return 0;\\n  }\\n\\n  this._range -= newBound;\\n  this._code -= newBound;\\n  probs[index] -= prob >>> 5;\\n  if ((this._range & 0xff000000) === 0) {\\n    this._code = this._code << 8 | this._stream.readByte();\\n    this._range <<= 8;\\n  }\\n  return 1;\\n};\\n\\nLZMA.initBitModels = function (probs, len) {\\n  while (len--) {\\n    probs[len] = 1024;\\n  }\\n};\\n\\nLZMA.BitTreeDecoder = function (numBitLevels) {\\n  this._models = [];\\n  this._numBitLevels = numBitLevels;\\n};\\n\\nLZMA.BitTreeDecoder.prototype.init = function () {\\n  LZMA.initBitModels(this._models, 1 << this._numBitLevels);\\n};\\n\\nLZMA.BitTreeDecoder.prototype.decode = function (rangeDecoder) {\\n  var m = 1,\\n      i = this._numBitLevels;\\n\\n  while (i--) {\\n    m = m << 1 | rangeDecoder.decodeBit(this._models, m);\\n  }\\n  return m - (1 << this._numBitLevels);\\n};\\n\\nLZMA.BitTreeDecoder.prototype.reverseDecode = function (rangeDecoder) {\\n  var m = 1,\\n      symbol = 0,\\n      i = 0,\\n      bit;\\n\\n  for (; i < this._numBitLevels; ++i) {\\n    bit = rangeDecoder.decodeBit(this._models, m);\\n    m = m << 1 | bit;\\n    symbol |= bit << i;\\n  }\\n  return symbol;\\n};\\n\\nLZMA.reverseDecode2 = function (models, startIndex, rangeDecoder, numBitLevels) {\\n  var m = 1,\\n      symbol = 0,\\n      i = 0,\\n      bit;\\n\\n  for (; i < numBitLevels; ++i) {\\n    bit = rangeDecoder.decodeBit(models, startIndex + m);\\n    m = m << 1 | bit;\\n    symbol |= bit << i;\\n  }\\n  return symbol;\\n};\\n\\nLZMA.LenDecoder = function () {\\n  this._choice = [];\\n  this._lowCoder = [];\\n  this._midCoder = [];\\n  this._highCoder = new LZMA.BitTreeDecoder(8);\\n  this._numPosStates = 0;\\n};\\n\\nLZMA.LenDecoder.prototype.create = function (numPosStates) {\\n  for (; this._numPosStates < numPosStates; ++this._numPosStates) {\\n    this._lowCoder[this._numPosStates] = new LZMA.BitTreeDecoder(3);\\n    this._midCoder[this._numPosStates] = new LZMA.BitTreeDecoder(3);\\n  }\\n};\\n\\nLZMA.LenDecoder.prototype.init = function () {\\n  var i = this._numPosStates;\\n  LZMA.initBitModels(this._choice, 2);\\n  while (i--) {\\n    this._lowCoder[i].init();\\n    this._midCoder[i].init();\\n  }\\n  this._highCoder.init();\\n};\\n\\nLZMA.LenDecoder.prototype.decode = function (rangeDecoder, posState) {\\n  if (rangeDecoder.decodeBit(this._choice, 0) === 0) {\\n    return this._lowCoder[posState].decode(rangeDecoder);\\n  }\\n  if (rangeDecoder.decodeBit(this._choice, 1) === 0) {\\n    return 8 + this._midCoder[posState].decode(rangeDecoder);\\n  }\\n  return 16 + this._highCoder.decode(rangeDecoder);\\n};\\n\\nLZMA.Decoder2 = function () {\\n  this._decoders = [];\\n};\\n\\nLZMA.Decoder2.prototype.init = function () {\\n  LZMA.initBitModels(this._decoders, 0x300);\\n};\\n\\nLZMA.Decoder2.prototype.decodeNormal = function (rangeDecoder) {\\n  var symbol = 1;\\n\\n  do {\\n    symbol = symbol << 1 | rangeDecoder.decodeBit(this._decoders, symbol);\\n  } while (symbol < 0x100);\\n\\n  return symbol & 0xff;\\n};\\n\\nLZMA.Decoder2.prototype.decodeWithMatchByte = function (rangeDecoder, matchByte) {\\n  var symbol = 1,\\n      matchBit,\\n      bit;\\n\\n  do {\\n    matchBit = matchByte >> 7 & 1;\\n    matchByte <<= 1;\\n    bit = rangeDecoder.decodeBit(this._decoders, (1 + matchBit << 8) + symbol);\\n    symbol = symbol << 1 | bit;\\n    if (matchBit !== bit) {\\n      while (symbol < 0x100) {\\n        symbol = symbol << 1 | rangeDecoder.decodeBit(this._decoders, symbol);\\n      }\\n      break;\\n    }\\n  } while (symbol < 0x100);\\n\\n  return symbol & 0xff;\\n};\\n\\nLZMA.LiteralDecoder = function () {};\\n\\nLZMA.LiteralDecoder.prototype.create = function (numPosBits, numPrevBits) {\\n  var i;\\n\\n  if (this._coders && this._numPrevBits === numPrevBits && this._numPosBits === numPosBits) {\\n    return;\\n  }\\n  this._numPosBits = numPosBits;\\n  this._posMask = (1 << numPosBits) - 1;\\n  this._numPrevBits = numPrevBits;\\n\\n  this._coders = [];\\n\\n  i = 1 << this._numPrevBits + this._numPosBits;\\n  while (i--) {\\n    this._coders[i] = new LZMA.Decoder2();\\n  }\\n};\\n\\nLZMA.LiteralDecoder.prototype.init = function () {\\n  var i = 1 << this._numPrevBits + this._numPosBits;\\n  while (i--) {\\n    this._coders[i].init();\\n  }\\n};\\n\\nLZMA.LiteralDecoder.prototype.getDecoder = function (pos, prevByte) {\\n  return this._coders[((pos & this._posMask) << this._numPrevBits) + ((prevByte & 0xff) >>> 8 - this._numPrevBits)];\\n};\\n\\nLZMA.Decoder = function () {\\n  this._outWindow = new LZMA.OutWindow();\\n  this._rangeDecoder = new LZMA.RangeDecoder();\\n  this._isMatchDecoders = [];\\n  this._isRepDecoders = [];\\n  this._isRepG0Decoders = [];\\n  this._isRepG1Decoders = [];\\n  this._isRepG2Decoders = [];\\n  this._isRep0LongDecoders = [];\\n  this._posSlotDecoder = [];\\n  this._posDecoders = [];\\n  this._posAlignDecoder = new LZMA.BitTreeDecoder(4);\\n  this._lenDecoder = new LZMA.LenDecoder();\\n  this._repLenDecoder = new LZMA.LenDecoder();\\n  this._literalDecoder = new LZMA.LiteralDecoder();\\n  this._dictionarySize = -1;\\n  this._dictionarySizeCheck = -1;\\n\\n  this._posSlotDecoder[0] = new LZMA.BitTreeDecoder(6);\\n  this._posSlotDecoder[1] = new LZMA.BitTreeDecoder(6);\\n  this._posSlotDecoder[2] = new LZMA.BitTreeDecoder(6);\\n  this._posSlotDecoder[3] = new LZMA.BitTreeDecoder(6);\\n};\\n\\nLZMA.Decoder.prototype.setDictionarySize = function (dictionarySize) {\\n  if (dictionarySize < 0) {\\n    return false;\\n  }\\n  if (this._dictionarySize !== dictionarySize) {\\n    this._dictionarySize = dictionarySize;\\n    this._dictionarySizeCheck = Math.max(this._dictionarySize, 1);\\n    this._outWindow.create(Math.max(this._dictionarySizeCheck, 4096));\\n  }\\n  return true;\\n};\\n\\nLZMA.Decoder.prototype.setLcLpPb = function (lc, lp, pb) {\\n  var numPosStates = 1 << pb;\\n\\n  if (lc > 8 || lp > 4 || pb > 4) {\\n    return false;\\n  }\\n\\n  this._literalDecoder.create(lp, lc);\\n\\n  this._lenDecoder.create(numPosStates);\\n  this._repLenDecoder.create(numPosStates);\\n  this._posStateMask = numPosStates - 1;\\n\\n  return true;\\n};\\n\\nLZMA.Decoder.prototype.init = function () {\\n  var i = 4;\\n\\n  this._outWindow.init(false);\\n\\n  LZMA.initBitModels(this._isMatchDecoders, 192);\\n  LZMA.initBitModels(this._isRep0LongDecoders, 192);\\n  LZMA.initBitModels(this._isRepDecoders, 12);\\n  LZMA.initBitModels(this._isRepG0Decoders, 12);\\n  LZMA.initBitModels(this._isRepG1Decoders, 12);\\n  LZMA.initBitModels(this._isRepG2Decoders, 12);\\n  LZMA.initBitModels(this._posDecoders, 114);\\n\\n  this._literalDecoder.init();\\n\\n  while (i--) {\\n    this._posSlotDecoder[i].init();\\n  }\\n\\n  this._lenDecoder.init();\\n  this._repLenDecoder.init();\\n  this._posAlignDecoder.init();\\n  this._rangeDecoder.init();\\n};\\n\\nLZMA.Decoder.prototype.decode = function (inStream, outStream, outSize) {\\n  var state = 0,\\n      rep0 = 0,\\n      rep1 = 0,\\n      rep2 = 0,\\n      rep3 = 0,\\n      nowPos64 = 0,\\n      prevByte = 0,\\n      posState,\\n      decoder2,\\n      len,\\n      distance,\\n      posSlot,\\n      numDirectBits;\\n\\n  this._rangeDecoder.setStream(inStream);\\n  this._outWindow.setStream(outStream);\\n\\n  this.init();\\n\\n  while (outSize < 0 || nowPos64 < outSize) {\\n    posState = nowPos64 & this._posStateMask;\\n\\n    if (this._rangeDecoder.decodeBit(this._isMatchDecoders, (state << 4) + posState) === 0) {\\n      decoder2 = this._literalDecoder.getDecoder(nowPos64++, prevByte);\\n\\n      if (state >= 7) {\\n        prevByte = decoder2.decodeWithMatchByte(this._rangeDecoder, this._outWindow.getByte(rep0));\\n      } else {\\n        prevByte = decoder2.decodeNormal(this._rangeDecoder);\\n      }\\n      this._outWindow.putByte(prevByte);\\n\\n      state = state < 4 ? 0 : state - (state < 10 ? 3 : 6);\\n    } else {\\n      if (this._rangeDecoder.decodeBit(this._isRepDecoders, state) === 1) {\\n        len = 0;\\n        if (this._rangeDecoder.decodeBit(this._isRepG0Decoders, state) === 0) {\\n          if (this._rangeDecoder.decodeBit(this._isRep0LongDecoders, (state << 4) + posState) === 0) {\\n            state = state < 7 ? 9 : 11;\\n            len = 1;\\n          }\\n        } else {\\n          if (this._rangeDecoder.decodeBit(this._isRepG1Decoders, state) === 0) {\\n            distance = rep1;\\n          } else {\\n            if (this._rangeDecoder.decodeBit(this._isRepG2Decoders, state) === 0) {\\n              distance = rep2;\\n            } else {\\n              distance = rep3;\\n              rep3 = rep2;\\n            }\\n            rep2 = rep1;\\n          }\\n          rep1 = rep0;\\n          rep0 = distance;\\n        }\\n        if (len === 0) {\\n          len = 2 + this._repLenDecoder.decode(this._rangeDecoder, posState);\\n          state = state < 7 ? 8 : 11;\\n        }\\n      } else {\\n        rep3 = rep2;\\n        rep2 = rep1;\\n        rep1 = rep0;\\n\\n        len = 2 + this._lenDecoder.decode(this._rangeDecoder, posState);\\n        state = state < 7 ? 7 : 10;\\n\\n        posSlot = this._posSlotDecoder[len <= 5 ? len - 2 : 3].decode(this._rangeDecoder);\\n        if (posSlot >= 4) {\\n          numDirectBits = (posSlot >> 1) - 1;\\n          rep0 = (2 | posSlot & 1) << numDirectBits;\\n\\n          if (posSlot < 14) {\\n            rep0 += LZMA.reverseDecode2(this._posDecoders, rep0 - posSlot - 1, this._rangeDecoder, numDirectBits);\\n          } else {\\n            rep0 += this._rangeDecoder.decodeDirectBits(numDirectBits - 4) << 4;\\n            rep0 += this._posAlignDecoder.reverseDecode(this._rangeDecoder);\\n            if (rep0 < 0) {\\n              if (rep0 === -1) {\\n                break;\\n              }\\n              return false;\\n            }\\n          }\\n        } else {\\n          rep0 = posSlot;\\n        }\\n      }\\n\\n      if (rep0 >= nowPos64 || rep0 >= this._dictionarySizeCheck) {\\n        return false;\\n      }\\n\\n      this._outWindow.copyBlock(rep0, len);\\n      nowPos64 += len;\\n      prevByte = this._outWindow.getByte(0);\\n    }\\n  }\\n\\n  this._outWindow.flush();\\n  this._outWindow.releaseStream();\\n  this._rangeDecoder.releaseStream();\\n\\n  return true;\\n};\\n\\nLZMA.Decoder.prototype.setDecoderProperties = function (properties) {\\n  var value, lc, lp, pb, dictionarySize;\\n\\n  if (properties.size < 5) {\\n    return false;\\n  }\\n\\n  value = properties.readByte();\\n  lc = value % 9;\\n  value = ~ ~(value / 9);\\n  lp = value % 5;\\n  pb = ~ ~(value / 5);\\n\\n  if (!this.setLcLpPb(lc, lp, pb)) {\\n    return false;\\n  }\\n\\n  dictionarySize = properties.readByte();\\n  dictionarySize |= properties.readByte() << 8;\\n  dictionarySize |= properties.readByte() << 16;\\n  dictionarySize += properties.readByte() * 16777216;\\n\\n  return this.setDictionarySize(dictionarySize);\\n};\\n\\nLZMA.decompress = function (properties, inStream, outStream, outSize) {\\n  var decoder = new LZMA.Decoder();\\n\\n  if (!decoder.setDecoderProperties(properties)) {\\n    throw \\\'Incorrect stream properties\\\';\\n  }\\n\\n  if (!decoder.decode(inStream, outStream, outSize)) {\\n    throw \\\'Error in data stream\\\';\\n  }\\n\\n  return true;\\n};\\n\\nexports.default = LZMA;\\n\\n},{}],3:[function(require,module,exports){\\n\\\'use strict\\\';\\n\\nObject.defineProperty(exports, "__esModule", {\\n  value: true\\n});\\nexports.unIndexGeometryData = unIndexGeometryData;\\nexports.createModelBuffers = createModelBuffers;\\n/*\\n  un-indexes raw geometry data hash with indices\\n  @geomData: hash containing arraybuffers, by attributes : ie\\n  {\\n      position: [....],\\n      normal: [....],\\n      indices: [...]\\n  }\\n*/\\nfunction unIndexGeometryData(geomData) {\\n  if (!(\\\'indices\\\' in geomData)) {\\n    return geomData;\\n  }\\n  var bufferTypes = [\\\'positions\\\', \\\'normals\\\', \\\'colors\\\', \\\'uvs\\\'];\\n  var bufferTypeSizes = { positions: 3, normals: 3, colors: 4, uvs: 3 };\\n  var output = {};\\n  geomData.indices.forEach(function (inputIndex, outIndex) {\\n    bufferTypes.forEach(function (bufferType) {\\n      if (geomData[bufferType] && geomData[bufferType].length > 0) {\\n        var size = bufferTypeSizes[bufferType];\\n\\n        if (!output[bufferType]) {\\n          output[bufferType] = new Float32Array(geomData.indices.length * size);\\n        }\\n\\n        for (var i = 0; i < size; i++) {\\n          output[bufferType][outIndex * size + i] = geomData[bufferType][inputIndex * size + i];\\n        }\\n        // output[bufferType][outIndex * size] = geomData[bufferType][inputIndex * size]\\n        // output[bufferType][outIndex * size + 1] = geomData[bufferType][inputIndex * size + 1]\\n        // output[bufferType][outIndex * size + 2] = geomData[bufferType][inputIndex * size + 2]\\n      }\\n    });\\n  });\\n  return output;\\n}\\n\\nfunction createModelBuffers(file) {\\n  console.log(\\\'creating model buffers\\\');\\n\\n  var indices = file.body.indices;\\n  var positions = file.body.vertices;\\n  var normals = file.body.normals;\\n  var uvs = [];\\n  var colors = [];\\n\\n  // materials = []\\n\\n  var uvMaps = file.body.uvMaps;\\n  if (uvMaps !== undefined && uvMaps.length > 0) {\\n    uvs = uvMaps[0].uv;\\n  }\\n\\n  var attrMaps = file.body.attrMaps;\\n  if (attrMaps !== undefined && attrMaps.length > 0 && attrMaps[0].name === \\\'Color\\\') {\\n    colors = attrMaps[0].attr;\\n  }\\n\\n  /*\\n    geometry.computeOffsets()\\n   // compute vertex normals if not present in the CTM model\\n  if ( geometry.attributes.normal === undefined ) {\\n    geometry.computeVertexNormals()\\n  }*/\\n\\n  return { positions: positions, indices: indices, normals: normals, uvs: uvs, colors: colors };\\n}\\n\\n},{}],4:[function(require,module,exports){\\n\\\'use strict\\\';\\n\\nvar _ctm = require(\\\'./ctm\\\');\\n\\nvar _ctm2 = _interopRequireDefault(_ctm);\\n\\nvar _parseHelpers = require(\\\'./parseHelpers\\\');\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nself.onmessage = function (event) {\\n  var files = [];\\n\\n  for (var i = 0; i < event.data.offsets.length; i++) {\\n    var stream = new _ctm2.default.Stream(event.data.data);\\n    stream.offset = event.data.offsets[i];\\n\\n    var geometry = (0, _parseHelpers.unIndexGeometryData)((0, _parseHelpers.createModelBuffers)(new _ctm2.default.File(stream)));\\n    files[i] = geometry;\\n  }\\n\\n  self.postMessage(files);\\n  self.close();\\n};\\n\\n},{"./ctm":1,"./parseHelpers":3}]},{},[4])\'], { type: "text/javascript" }))); // browserify\n\n      worker.onmessage = function (event) {\n        var files = event.data;\n\n        obs.onNext({ progress: 1, total: Math.NaN }); // FIXME : this is absurd, and should not be done BEFORE the actual end of data\n        //but we need to fix asset managment first\n        files.forEach(function (geometry) {\n          //let geometry = createModelBuffers(ctmFile)\n          // obs.onNext({progress: 1, total:Math.NaN})\n          obs.onNext(geometry);\n        });\n\n        obs.onCompleted();\n      };\n      worker.onerror = function (event) {\n        obs.onError(\'filename:\' + event.filename + \' lineno: \' + event.lineno + \' error: \' + event.message);\n      };\n\n      worker.postMessage({ \'data\': binaryData, \'offsets\': offsets });\n      obs.catch(function (e) {\n        return worker.terminate();\n      });\n    })();\n  } else {\n    for (var i = 0; i < offsets.length; i++) {\n      try {\n        var stream = new _ctm2.default.Stream(binaryData);\n\n        stream.offset = offsets[i];\n        var ctmFile = new _ctm2.default.File(stream);\n\n        var geometry = (0, _parseHelpers.createModelBuffers)(ctmFile);\n        // obs.onNext({progress: 1, total:Math.NaN})\n        obs.onNext(geometry);\n      } catch (error) {\n        obs.onError(error);\n      }\n    }\n\n    // obs.onNext({progress: 1, total:Math.NaN})\n    // obs.onCompleted()\n  }\n  return obs;\n}\n\n}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})\n},{"./ctm":4,"./parseHelpers":7,"./utils":8,"composite-detect":2,"fast.js/object/assign":3}],6:[function(require,module,exports){\n\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nvar LZMA = LZMA || {};\n\nLZMA.OutWindow = function () {\n  this._windowSize = 0;\n};\n\nLZMA.OutWindow.prototype.create = function (windowSize) {\n  if (!this._buffer || this._windowSize !== windowSize) {\n    this._buffer = [];\n  }\n  this._windowSize = windowSize;\n  this._pos = 0;\n  this._streamPos = 0;\n};\n\nLZMA.OutWindow.prototype.flush = function () {\n  var size = this._pos - this._streamPos;\n  if (size !== 0) {\n    while (size--) {\n      this._stream.writeByte(this._buffer[this._streamPos++]);\n    }\n    if (this._pos >= this._windowSize) {\n      this._pos = 0;\n    }\n    this._streamPos = this._pos;\n  }\n};\n\nLZMA.OutWindow.prototype.releaseStream = function () {\n  this.flush();\n  this._stream = null;\n};\n\nLZMA.OutWindow.prototype.setStream = function (stream) {\n  this.releaseStream();\n  this._stream = stream;\n};\n\nLZMA.OutWindow.prototype.init = function (solid) {\n  if (!solid) {\n    this._streamPos = 0;\n    this._pos = 0;\n  }\n};\n\nLZMA.OutWindow.prototype.copyBlock = function (distance, len) {\n  var pos = this._pos - distance - 1;\n  if (pos < 0) {\n    pos += this._windowSize;\n  }\n  while (len--) {\n    if (pos >= this._windowSize) {\n      pos = 0;\n    }\n    this._buffer[this._pos++] = this._buffer[pos++];\n    if (this._pos >= this._windowSize) {\n      this.flush();\n    }\n  }\n};\n\nLZMA.OutWindow.prototype.putByte = function (b) {\n  this._buffer[this._pos++] = b;\n  if (this._pos >= this._windowSize) {\n    this.flush();\n  }\n};\n\nLZMA.OutWindow.prototype.getByte = function (distance) {\n  var pos = this._pos - distance - 1;\n  if (pos < 0) {\n    pos += this._windowSize;\n  }\n  return this._buffer[pos];\n};\n\nLZMA.RangeDecoder = function () {};\n\nLZMA.RangeDecoder.prototype.setStream = function (stream) {\n  this._stream = stream;\n};\n\nLZMA.RangeDecoder.prototype.releaseStream = function () {\n  this._stream = null;\n};\n\nLZMA.RangeDecoder.prototype.init = function () {\n  var i = 5;\n\n  this._code = 0;\n  this._range = -1;\n\n  while (i--) {\n    this._code = this._code << 8 | this._stream.readByte();\n  }\n};\n\nLZMA.RangeDecoder.prototype.decodeDirectBits = function (numTotalBits) {\n  var result = 0,\n      i = numTotalBits,\n      t;\n\n  while (i--) {\n    this._range >>>= 1;\n    t = this._code - this._range >>> 31;\n    this._code -= this._range & t - 1;\n    result = result << 1 | 1 - t;\n\n    if ((this._range & 0xff000000) === 0) {\n      this._code = this._code << 8 | this._stream.readByte();\n      this._range <<= 8;\n    }\n  }\n\n  return result;\n};\n\nLZMA.RangeDecoder.prototype.decodeBit = function (probs, index) {\n  var prob = probs[index],\n      newBound = (this._range >>> 11) * prob;\n\n  if ((this._code ^ 0x80000000) < (newBound ^ 0x80000000)) {\n    this._range = newBound;\n    probs[index] += 2048 - prob >>> 5;\n    if ((this._range & 0xff000000) === 0) {\n      this._code = this._code << 8 | this._stream.readByte();\n      this._range <<= 8;\n    }\n    return 0;\n  }\n\n  this._range -= newBound;\n  this._code -= newBound;\n  probs[index] -= prob >>> 5;\n  if ((this._range & 0xff000000) === 0) {\n    this._code = this._code << 8 | this._stream.readByte();\n    this._range <<= 8;\n  }\n  return 1;\n};\n\nLZMA.initBitModels = function (probs, len) {\n  while (len--) {\n    probs[len] = 1024;\n  }\n};\n\nLZMA.BitTreeDecoder = function (numBitLevels) {\n  this._models = [];\n  this._numBitLevels = numBitLevels;\n};\n\nLZMA.BitTreeDecoder.prototype.init = function () {\n  LZMA.initBitModels(this._models, 1 << this._numBitLevels);\n};\n\nLZMA.BitTreeDecoder.prototype.decode = function (rangeDecoder) {\n  var m = 1,\n      i = this._numBitLevels;\n\n  while (i--) {\n    m = m << 1 | rangeDecoder.decodeBit(this._models, m);\n  }\n  return m - (1 << this._numBitLevels);\n};\n\nLZMA.BitTreeDecoder.prototype.reverseDecode = function (rangeDecoder) {\n  var m = 1,\n      symbol = 0,\n      i = 0,\n      bit;\n\n  for (; i < this._numBitLevels; ++i) {\n    bit = rangeDecoder.decodeBit(this._models, m);\n    m = m << 1 | bit;\n    symbol |= bit << i;\n  }\n  return symbol;\n};\n\nLZMA.reverseDecode2 = function (models, startIndex, rangeDecoder, numBitLevels) {\n  var m = 1,\n      symbol = 0,\n      i = 0,\n      bit;\n\n  for (; i < numBitLevels; ++i) {\n    bit = rangeDecoder.decodeBit(models, startIndex + m);\n    m = m << 1 | bit;\n    symbol |= bit << i;\n  }\n  return symbol;\n};\n\nLZMA.LenDecoder = function () {\n  this._choice = [];\n  this._lowCoder = [];\n  this._midCoder = [];\n  this._highCoder = new LZMA.BitTreeDecoder(8);\n  this._numPosStates = 0;\n};\n\nLZMA.LenDecoder.prototype.create = function (numPosStates) {\n  for (; this._numPosStates < numPosStates; ++this._numPosStates) {\n    this._lowCoder[this._numPosStates] = new LZMA.BitTreeDecoder(3);\n    this._midCoder[this._numPosStates] = new LZMA.BitTreeDecoder(3);\n  }\n};\n\nLZMA.LenDecoder.prototype.init = function () {\n  var i = this._numPosStates;\n  LZMA.initBitModels(this._choice, 2);\n  while (i--) {\n    this._lowCoder[i].init();\n    this._midCoder[i].init();\n  }\n  this._highCoder.init();\n};\n\nLZMA.LenDecoder.prototype.decode = function (rangeDecoder, posState) {\n  if (rangeDecoder.decodeBit(this._choice, 0) === 0) {\n    return this._lowCoder[posState].decode(rangeDecoder);\n  }\n  if (rangeDecoder.decodeBit(this._choice, 1) === 0) {\n    return 8 + this._midCoder[posState].decode(rangeDecoder);\n  }\n  return 16 + this._highCoder.decode(rangeDecoder);\n};\n\nLZMA.Decoder2 = function () {\n  this._decoders = [];\n};\n\nLZMA.Decoder2.prototype.init = function () {\n  LZMA.initBitModels(this._decoders, 0x300);\n};\n\nLZMA.Decoder2.prototype.decodeNormal = function (rangeDecoder) {\n  var symbol = 1;\n\n  do {\n    symbol = symbol << 1 | rangeDecoder.decodeBit(this._decoders, symbol);\n  } while (symbol < 0x100);\n\n  return symbol & 0xff;\n};\n\nLZMA.Decoder2.prototype.decodeWithMatchByte = function (rangeDecoder, matchByte) {\n  var symbol = 1,\n      matchBit,\n      bit;\n\n  do {\n    matchBit = matchByte >> 7 & 1;\n    matchByte <<= 1;\n    bit = rangeDecoder.decodeBit(this._decoders, (1 + matchBit << 8) + symbol);\n    symbol = symbol << 1 | bit;\n    if (matchBit !== bit) {\n      while (symbol < 0x100) {\n        symbol = symbol << 1 | rangeDecoder.decodeBit(this._decoders, symbol);\n      }\n      break;\n    }\n  } while (symbol < 0x100);\n\n  return symbol & 0xff;\n};\n\nLZMA.LiteralDecoder = function () {};\n\nLZMA.LiteralDecoder.prototype.create = function (numPosBits, numPrevBits) {\n  var i;\n\n  if (this._coders && this._numPrevBits === numPrevBits && this._numPosBits === numPosBits) {\n    return;\n  }\n  this._numPosBits = numPosBits;\n  this._posMask = (1 << numPosBits) - 1;\n  this._numPrevBits = numPrevBits;\n\n  this._coders = [];\n\n  i = 1 << this._numPrevBits + this._numPosBits;\n  while (i--) {\n    this._coders[i] = new LZMA.Decoder2();\n  }\n};\n\nLZMA.LiteralDecoder.prototype.init = function () {\n  var i = 1 << this._numPrevBits + this._numPosBits;\n  while (i--) {\n    this._coders[i].init();\n  }\n};\n\nLZMA.LiteralDecoder.prototype.getDecoder = function (pos, prevByte) {\n  return this._coders[((pos & this._posMask) << this._numPrevBits) + ((prevByte & 0xff) >>> 8 - this._numPrevBits)];\n};\n\nLZMA.Decoder = function () {\n  this._outWindow = new LZMA.OutWindow();\n  this._rangeDecoder = new LZMA.RangeDecoder();\n  this._isMatchDecoders = [];\n  this._isRepDecoders = [];\n  this._isRepG0Decoders = [];\n  this._isRepG1Decoders = [];\n  this._isRepG2Decoders = [];\n  this._isRep0LongDecoders = [];\n  this._posSlotDecoder = [];\n  this._posDecoders = [];\n  this._posAlignDecoder = new LZMA.BitTreeDecoder(4);\n  this._lenDecoder = new LZMA.LenDecoder();\n  this._repLenDecoder = new LZMA.LenDecoder();\n  this._literalDecoder = new LZMA.LiteralDecoder();\n  this._dictionarySize = -1;\n  this._dictionarySizeCheck = -1;\n\n  this._posSlotDecoder[0] = new LZMA.BitTreeDecoder(6);\n  this._posSlotDecoder[1] = new LZMA.BitTreeDecoder(6);\n  this._posSlotDecoder[2] = new LZMA.BitTreeDecoder(6);\n  this._posSlotDecoder[3] = new LZMA.BitTreeDecoder(6);\n};\n\nLZMA.Decoder.prototype.setDictionarySize = function (dictionarySize) {\n  if (dictionarySize < 0) {\n    return false;\n  }\n  if (this._dictionarySize !== dictionarySize) {\n    this._dictionarySize = dictionarySize;\n    this._dictionarySizeCheck = Math.max(this._dictionarySize, 1);\n    this._outWindow.create(Math.max(this._dictionarySizeCheck, 4096));\n  }\n  return true;\n};\n\nLZMA.Decoder.prototype.setLcLpPb = function (lc, lp, pb) {\n  var numPosStates = 1 << pb;\n\n  if (lc > 8 || lp > 4 || pb > 4) {\n    return false;\n  }\n\n  this._literalDecoder.create(lp, lc);\n\n  this._lenDecoder.create(numPosStates);\n  this._repLenDecoder.create(numPosStates);\n  this._posStateMask = numPosStates - 1;\n\n  return true;\n};\n\nLZMA.Decoder.prototype.init = function () {\n  var i = 4;\n\n  this._outWindow.init(false);\n\n  LZMA.initBitModels(this._isMatchDecoders, 192);\n  LZMA.initBitModels(this._isRep0LongDecoders, 192);\n  LZMA.initBitModels(this._isRepDecoders, 12);\n  LZMA.initBitModels(this._isRepG0Decoders, 12);\n  LZMA.initBitModels(this._isRepG1Decoders, 12);\n  LZMA.initBitModels(this._isRepG2Decoders, 12);\n  LZMA.initBitModels(this._posDecoders, 114);\n\n  this._literalDecoder.init();\n\n  while (i--) {\n    this._posSlotDecoder[i].init();\n  }\n\n  this._lenDecoder.init();\n  this._repLenDecoder.init();\n  this._posAlignDecoder.init();\n  this._rangeDecoder.init();\n};\n\nLZMA.Decoder.prototype.decode = function (inStream, outStream, outSize) {\n  var state = 0,\n      rep0 = 0,\n      rep1 = 0,\n      rep2 = 0,\n      rep3 = 0,\n      nowPos64 = 0,\n      prevByte = 0,\n      posState,\n      decoder2,\n      len,\n      distance,\n      posSlot,\n      numDirectBits;\n\n  this._rangeDecoder.setStream(inStream);\n  this._outWindow.setStream(outStream);\n\n  this.init();\n\n  while (outSize < 0 || nowPos64 < outSize) {\n    posState = nowPos64 & this._posStateMask;\n\n    if (this._rangeDecoder.decodeBit(this._isMatchDecoders, (state << 4) + posState) === 0) {\n      decoder2 = this._literalDecoder.getDecoder(nowPos64++, prevByte);\n\n      if (state >= 7) {\n        prevByte = decoder2.decodeWithMatchByte(this._rangeDecoder, this._outWindow.getByte(rep0));\n      } else {\n        prevByte = decoder2.decodeNormal(this._rangeDecoder);\n      }\n      this._outWindow.putByte(prevByte);\n\n      state = state < 4 ? 0 : state - (state < 10 ? 3 : 6);\n    } else {\n      if (this._rangeDecoder.decodeBit(this._isRepDecoders, state) === 1) {\n        len = 0;\n        if (this._rangeDecoder.decodeBit(this._isRepG0Decoders, state) === 0) {\n          if (this._rangeDecoder.decodeBit(this._isRep0LongDecoders, (state << 4) + posState) === 0) {\n            state = state < 7 ? 9 : 11;\n            len = 1;\n          }\n        } else {\n          if (this._rangeDecoder.decodeBit(this._isRepG1Decoders, state) === 0) {\n            distance = rep1;\n          } else {\n            if (this._rangeDecoder.decodeBit(this._isRepG2Decoders, state) === 0) {\n              distance = rep2;\n            } else {\n              distance = rep3;\n              rep3 = rep2;\n            }\n            rep2 = rep1;\n          }\n          rep1 = rep0;\n          rep0 = distance;\n        }\n        if (len === 0) {\n          len = 2 + this._repLenDecoder.decode(this._rangeDecoder, posState);\n          state = state < 7 ? 8 : 11;\n        }\n      } else {\n        rep3 = rep2;\n        rep2 = rep1;\n        rep1 = rep0;\n\n        len = 2 + this._lenDecoder.decode(this._rangeDecoder, posState);\n        state = state < 7 ? 7 : 10;\n\n        posSlot = this._posSlotDecoder[len <= 5 ? len - 2 : 3].decode(this._rangeDecoder);\n        if (posSlot >= 4) {\n          numDirectBits = (posSlot >> 1) - 1;\n          rep0 = (2 | posSlot & 1) << numDirectBits;\n\n          if (posSlot < 14) {\n            rep0 += LZMA.reverseDecode2(this._posDecoders, rep0 - posSlot - 1, this._rangeDecoder, numDirectBits);\n          } else {\n            rep0 += this._rangeDecoder.decodeDirectBits(numDirectBits - 4) << 4;\n            rep0 += this._posAlignDecoder.reverseDecode(this._rangeDecoder);\n            if (rep0 < 0) {\n              if (rep0 === -1) {\n                break;\n              }\n              return false;\n            }\n          }\n        } else {\n          rep0 = posSlot;\n        }\n      }\n\n      if (rep0 >= nowPos64 || rep0 >= this._dictionarySizeCheck) {\n        return false;\n      }\n\n      this._outWindow.copyBlock(rep0, len);\n      nowPos64 += len;\n      prevByte = this._outWindow.getByte(0);\n    }\n  }\n\n  this._outWindow.flush();\n  this._outWindow.releaseStream();\n  this._rangeDecoder.releaseStream();\n\n  return true;\n};\n\nLZMA.Decoder.prototype.setDecoderProperties = function (properties) {\n  var value, lc, lp, pb, dictionarySize;\n\n  if (properties.size < 5) {\n    return false;\n  }\n\n  value = properties.readByte();\n  lc = value % 9;\n  value = ~ ~(value / 9);\n  lp = value % 5;\n  pb = ~ ~(value / 5);\n\n  if (!this.setLcLpPb(lc, lp, pb)) {\n    return false;\n  }\n\n  dictionarySize = properties.readByte();\n  dictionarySize |= properties.readByte() << 8;\n  dictionarySize |= properties.readByte() << 16;\n  dictionarySize += properties.readByte() * 16777216;\n\n  return this.setDictionarySize(dictionarySize);\n};\n\nLZMA.decompress = function (properties, inStream, outStream, outSize) {\n  var decoder = new LZMA.Decoder();\n\n  if (!decoder.setDecoderProperties(properties)) {\n    throw \'Incorrect stream properties\';\n  }\n\n  if (!decoder.decode(inStream, outStream, outSize)) {\n    throw \'Error in data stream\';\n  }\n\n  return true;\n};\n\nexports.default = LZMA;\n\n},{}],7:[function(require,module,exports){\n\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.unIndexGeometryData = unIndexGeometryData;\nexports.createModelBuffers = createModelBuffers;\n/*\n  un-indexes raw geometry data hash with indices\n  @geomData: hash containing arraybuffers, by attributes : ie\n  {\n      position: [....],\n      normal: [....],\n      indices: [...]\n  }\n*/\nfunction unIndexGeometryData(geomData) {\n  if (!(\'indices\' in geomData)) {\n    return geomData;\n  }\n  var bufferTypes = [\'positions\', \'normals\', \'colors\', \'uvs\'];\n  var bufferTypeSizes = { positions: 3, normals: 3, colors: 4, uvs: 3 };\n  var output = {};\n  geomData.indices.forEach(function (inputIndex, outIndex) {\n    bufferTypes.forEach(function (bufferType) {\n      if (geomData[bufferType] && geomData[bufferType].length > 0) {\n        var size = bufferTypeSizes[bufferType];\n\n        if (!output[bufferType]) {\n          output[bufferType] = new Float32Array(geomData.indices.length * size);\n        }\n\n        for (var i = 0; i < size; i++) {\n          output[bufferType][outIndex * size + i] = geomData[bufferType][inputIndex * size + i];\n        }\n        // output[bufferType][outIndex * size] = geomData[bufferType][inputIndex * size]\n        // output[bufferType][outIndex * size + 1] = geomData[bufferType][inputIndex * size + 1]\n        // output[bufferType][outIndex * size + 2] = geomData[bufferType][inputIndex * size + 2]\n      }\n    });\n  });\n  return output;\n}\n\nfunction createModelBuffers(file) {\n  console.log(\'creating model buffers\');\n\n  var indices = file.body.indices;\n  var positions = file.body.vertices;\n  var normals = file.body.normals;\n  var uvs = [];\n  var colors = [];\n\n  // materials = []\n\n  var uvMaps = file.body.uvMaps;\n  if (uvMaps !== undefined && uvMaps.length > 0) {\n    uvs = uvMaps[0].uv;\n  }\n\n  var attrMaps = file.body.attrMaps;\n  if (attrMaps !== undefined && attrMaps.length > 0 && attrMaps[0].name === \'Color\') {\n    colors = attrMaps[0].attr;\n  }\n\n  /*\n    geometry.computeOffsets()\n   // compute vertex normals if not present in the CTM model\n  if ( geometry.attributes.normal === undefined ) {\n    geometry.computeVertexNormals()\n  }*/\n\n  return { positions: positions, indices: indices, normals: normals, uvs: uvs, colors: colors };\n}\n\n},{}],8:[function(require,module,exports){\n\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.toArrayBuffer = toArrayBuffer;\nexports.str2ab = str2ab;\nexports.str2ab2 = str2ab2;\nexports.ensureArrayBuffer = ensureArrayBuffer;\nfunction toArrayBuffer(buffer) {\n  var ab = new ArrayBuffer(buffer.length);\n  var view = new Uint8Array(ab);\n  for (var i = 0; i < buffer.length; ++i) {\n    view[i] = buffer[i];\n  }\n  return ab;\n}\n\nfunction str2ab(str) {\n  var buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char\n  var bufView = new Uint16Array(buf);\n  for (var i = 0, strLen = str.length; i < strLen; i++) {\n    bufView[i] = str.charCodeAt(i);\n  }\n  return buf;\n}\n\nfunction str2ab2(str) {\n  var idx,\n      len = str.length,\n      arr = new Array(len);\n  for (idx = 0; idx < len; ++idx) {\n    arr[idx] = str.charCodeAt(idx) & 0xFF;\n  }\n  // You may create an ArrayBuffer from a standard array (of values) as follows:\n  return new Uint8Array(arr).buffer;\n}\n\nfunction ensureArrayBuffer(data) {\n  if (typeof data == \'string\' || data instanceof String) {\n    return str2ab2(data);\n  } else {\n    return data;\n  }\n}\n\n},{}]},{},[5])(5)\n});\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-ctm-parser/lib/browser/ctm-parser.js\n ** module id = 350\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-ctm-parser/lib/browser/ctm-parser.js?');
},function(module,exports,__webpack_require__){eval("var require;var require;/* WEBPACK VAR INJECTION */(function(global, Buffer, setImmediate, clearImmediate) {(function(f){if(true){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.gcodeParser = f()}})(function(){var define,module,exports;return (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 require(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n\n},{}],2:[function(require,module,exports){\narguments[4][1][0].apply(exports,arguments)\n},{\"dup\":1}],3:[function(require,module,exports){\n(function (global){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license  MIT\n */\n/* eslint-disable no-proto */\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('is-array')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n *   === true    Use Uint8Array implementation (fastest)\n *   === false   Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n *   - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property\n *     on objects.\n *\n *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n *     incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n  ? global.TYPED_ARRAY_SUPPORT\n  : typedArraySupport()\n\nfunction typedArraySupport () {\n  function Bar () {}\n  try {\n    var arr = new Uint8Array(1)\n    arr.foo = function () { return 42 }\n    arr.constructor = Bar\n    return arr.foo() === 42 && // typed array instances can be augmented\n        arr.constructor === Bar && // constructor can be set\n        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n  } catch (e) {\n    return false\n  }\n}\n\nfunction kMaxLength () {\n  return Buffer.TYPED_ARRAY_SUPPORT\n    ? 0x7fffffff\n    : 0x3fffffff\n}\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (arg) {\n  if (!(this instanceof Buffer)) {\n    // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n    if (arguments.length > 1) return new Buffer(arg, arguments[1])\n    return new Buffer(arg)\n  }\n\n  this.length = 0\n  this.parent = undefined\n\n  // Common case.\n  if (typeof arg === 'number') {\n    return fromNumber(this, arg)\n  }\n\n  // Slightly less common case.\n  if (typeof arg === 'string') {\n    return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n  }\n\n  // Unusual.\n  return fromObject(this, arg)\n}\n\nfunction fromNumber (that, length) {\n  that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) {\n    for (var i = 0; i < length; i++) {\n      that[i] = 0\n    }\n  }\n  return that\n}\n\nfunction fromString (that, string, encoding) {\n  if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n  // Assumption: byteLength() return value is always < kMaxLength.\n  var length = byteLength(string, encoding) | 0\n  that = allocate(that, length)\n\n  that.write(string, encoding)\n  return that\n}\n\nfunction fromObject (that, object) {\n  if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n  if (isArray(object)) return fromArray(that, object)\n\n  if (object == null) {\n    throw new TypeError('must start with number, buffer, array or string')\n  }\n\n  if (typeof ArrayBuffer !== 'undefined') {\n    if (object.buffer instanceof ArrayBuffer) {\n      return fromTypedArray(that, object)\n    }\n    if (object instanceof ArrayBuffer) {\n      return fromArrayBuffer(that, object)\n    }\n  }\n\n  if (object.length) return fromArrayLike(that, object)\n\n  return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n  var length = checked(buffer.length) | 0\n  that = allocate(that, length)\n  buffer.copy(that, 0, 0, length)\n  return that\n}\n\nfunction fromArray (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  // Truncating the elements is probably not what people expect from typed\n  // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n  // of the old Buffer constructor.\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nfunction fromArrayBuffer (that, array) {\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    array.byteLength\n    that = Buffer._augment(new Uint8Array(array))\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    that = fromTypedArray(that, new Uint8Array(array))\n  }\n  return that\n}\n\nfunction fromArrayLike (that, array) {\n  var length = checked(array.length) | 0\n  that = allocate(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n  var array\n  var length = 0\n\n  if (object.type === 'Buffer' && isArray(object.data)) {\n    array = object.data\n    length = checked(array.length) | 0\n  }\n  that = allocate(that, length)\n\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n  Buffer.prototype.__proto__ = Uint8Array.prototype\n  Buffer.__proto__ = Uint8Array\n}\n\nfunction allocate (that, length) {\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    that = Buffer._augment(new Uint8Array(length))\n    that.__proto__ = Buffer.prototype\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    that.length = length\n    that._isBuffer = true\n  }\n\n  var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n  if (fromPool) that.parent = rootParent\n\n  return that\n}\n\nfunction checked (length) {\n  // Note: cannot use `length < kMaxLength` here because that fails when\n  // length is NaN (which is otherwise coerced to zero.)\n  if (length >= kMaxLength()) {\n    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n                         'size: 0x' + kMaxLength().toString(16) + ' bytes')\n  }\n  return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n  if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n  var buf = new Buffer(subject, encoding)\n  delete buf.parent\n  return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n  return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n    throw new TypeError('Arguments must be Buffers')\n  }\n\n  if (a === b) return 0\n\n  var x = a.length\n  var y = b.length\n\n  var i = 0\n  var len = Math.min(x, y)\n  while (i < len) {\n    if (a[i] !== b[i]) break\n\n    ++i\n  }\n\n  if (i !== len) {\n    x = a[i]\n    y = b[i]\n  }\n\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'binary':\n    case 'base64':\n    case 'raw':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.concat = function concat (list, length) {\n  if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n  if (list.length === 0) {\n    return new Buffer(0)\n  }\n\n  var i\n  if (length === undefined) {\n    length = 0\n    for (i = 0; i < list.length; i++) {\n      length += list[i].length\n    }\n  }\n\n  var buf = new Buffer(length)\n  var pos = 0\n  for (i = 0; i < list.length; i++) {\n    var item = list[i]\n    item.copy(buf, pos)\n    pos += item.length\n  }\n  return buf\n}\n\nfunction byteLength (string, encoding) {\n  if (typeof string !== 'string') string = '' + string\n\n  var len = string.length\n  if (len === 0) return 0\n\n  // Use a for loop to avoid recursion\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'ascii':\n      case 'binary':\n      // Deprecated\n      case 'raw':\n      case 'raws':\n        return len\n      case 'utf8':\n      case 'utf-8':\n        return utf8ToBytes(string).length\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return len * 2\n      case 'hex':\n        return len >>> 1\n      case 'base64':\n        return base64ToBytes(string).length\n      default:\n        if (loweredCase) return utf8ToBytes(string).length // assume utf8\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\nBuffer.byteLength = byteLength\n\n// pre-set for values that may exist in the future\nBuffer.prototype.length = undefined\nBuffer.prototype.parent = undefined\n\nfunction slowToString (encoding, start, end) {\n  var loweredCase = false\n\n  start = start | 0\n  end = end === undefined || end === Infinity ? this.length : end | 0\n\n  if (!encoding) encoding = 'utf8'\n  if (start < 0) start = 0\n  if (end > this.length) end = this.length\n  if (end <= start) return ''\n\n  while (true) {\n    switch (encoding) {\n      case 'hex':\n        return hexSlice(this, start, end)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Slice(this, start, end)\n\n      case 'ascii':\n        return asciiSlice(this, start, end)\n\n      case 'binary':\n        return binarySlice(this, start, end)\n\n      case 'base64':\n        return base64Slice(this, start, end)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return utf16leSlice(this, start, end)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = (encoding + '').toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toString = function toString () {\n  var length = this.length | 0\n  if (length === 0) return ''\n  if (arguments.length === 0) return utf8Slice(this, 0, length)\n  return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return true\n  return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n  var str = ''\n  var max = exports.INSPECT_MAX_BYTES\n  if (this.length > 0) {\n    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n    if (this.length > max) str += ' ... '\n  }\n  return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return 0\n  return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n  if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n  else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n  byteOffset >>= 0\n\n  if (this.length === 0) return -1\n  if (byteOffset >= this.length) return -1\n\n  // Negative offsets start from the end of the buffer\n  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n  if (typeof val === 'string') {\n    if (val.length === 0) return -1 // special case: looking for empty string always fails\n    return String.prototype.indexOf.call(this, val, byteOffset)\n  }\n  if (Buffer.isBuffer(val)) {\n    return arrayIndexOf(this, val, byteOffset)\n  }\n  if (typeof val === 'number') {\n    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n    }\n    return arrayIndexOf(this, [ val ], byteOffset)\n  }\n\n  function arrayIndexOf (arr, val, byteOffset) {\n    var foundIndex = -1\n    for (var i = 0; byteOffset + i < arr.length; i++) {\n      if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n        if (foundIndex === -1) foundIndex = i\n        if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n      } else {\n        foundIndex = -1\n      }\n    }\n    return -1\n  }\n\n  throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` is deprecated\nBuffer.prototype.get = function get (offset) {\n  console.log('.get() is deprecated. Access using array indexes instead.')\n  return this.readUInt8(offset)\n}\n\n// `set` is deprecated\nBuffer.prototype.set = function set (v, offset) {\n  console.log('.set() is deprecated. Access using array indexes instead.')\n  return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  // must be an even number of digits\n  var strLen = string.length\n  if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; i++) {\n    var parsed = parseInt(string.substr(i * 2, 2), 16)\n    if (isNaN(parsed)) throw new Error('Invalid hex string')\n    buf[offset + i] = parsed\n  }\n  return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n  return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n  return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n  return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n  // Buffer#write(string)\n  if (offset === undefined) {\n    encoding = 'utf8'\n    length = this.length\n    offset = 0\n  // Buffer#write(string, encoding)\n  } else if (length === undefined && typeof offset === 'string') {\n    encoding = offset\n    length = this.length\n    offset = 0\n  // Buffer#write(string, offset[, length][, encoding])\n  } else if (isFinite(offset)) {\n    offset = offset | 0\n    if (isFinite(length)) {\n      length = length | 0\n      if (encoding === undefined) encoding = 'utf8'\n    } else {\n      encoding = length\n      length = undefined\n    }\n  // legacy write(string, encoding, offset, length) - remove in v0.13\n  } else {\n    var swap = encoding\n    encoding = offset\n    offset = length | 0\n    length = swap\n  }\n\n  var remaining = this.length - offset\n  if (length === undefined || length > remaining) length = remaining\n\n  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n    throw new RangeError('attempt to write outside buffer bounds')\n  }\n\n  if (!encoding) encoding = 'utf8'\n\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'hex':\n        return hexWrite(this, string, offset, length)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Write(this, string, offset, length)\n\n      case 'ascii':\n        return asciiWrite(this, string, offset, length)\n\n      case 'binary':\n        return binaryWrite(this, string, offset, length)\n\n      case 'base64':\n        // Warning: maxLength not taken into account in base64Write\n        return base64Write(this, string, offset, length)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return ucs2Write(this, string, offset, length)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nfunction base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction utf8Slice (buf, start, end) {\n  end = Math.min(buf.length, end)\n  var res = []\n\n  var i = start\n  while (i < end) {\n    var firstByte = buf[i]\n    var codePoint = null\n    var bytesPerSequence = (firstByte > 0xEF) ? 4\n      : (firstByte > 0xDF) ? 3\n      : (firstByte > 0xBF) ? 2\n      : 1\n\n    if (i + bytesPerSequence <= end) {\n      var secondByte, thirdByte, fourthByte, tempCodePoint\n\n      switch (bytesPerSequence) {\n        case 1:\n          if (firstByte < 0x80) {\n            codePoint = firstByte\n          }\n          break\n        case 2:\n          secondByte = buf[i + 1]\n          if ((secondByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n            if (tempCodePoint > 0x7F) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 3:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 4:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          fourthByte = buf[i + 3]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n              codePoint = tempCodePoint\n            }\n          }\n      }\n    }\n\n    if (codePoint === null) {\n      // we did not generate a valid codePoint so insert a\n      // replacement char (U+FFFD) and advance only 1 byte\n      codePoint = 0xFFFD\n      bytesPerSequence = 1\n    } else if (codePoint > 0xFFFF) {\n      // encode to utf16 (surrogate pair dance)\n      codePoint -= 0x10000\n      res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n      codePoint = 0xDC00 | codePoint & 0x3FF\n    }\n\n    res.push(codePoint)\n    i += bytesPerSequence\n  }\n\n  return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n  var len = codePoints.length\n  if (len <= MAX_ARGUMENTS_LENGTH) {\n    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n  }\n\n  // Decode in chunks to avoid \"call stack size exceeded\".\n  var res = ''\n  var i = 0\n  while (i < len) {\n    res += String.fromCharCode.apply(\n      String,\n      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n    )\n  }\n  return res\n}\n\nfunction asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i] & 0x7F)\n  }\n  return ret\n}\n\nfunction binarySlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i])\n  }\n  return ret\n}\n\nfunction hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; i++) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n  var len = this.length\n  start = ~~start\n  end = end === undefined ? len : ~~end\n\n  if (start < 0) {\n    start += len\n    if (start < 0) start = 0\n  } else if (start > len) {\n    start = len\n  }\n\n  if (end < 0) {\n    end += len\n    if (end < 0) end = 0\n  } else if (end > len) {\n    end = len\n  }\n\n  if (end < start) end = start\n\n  var newBuf\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    newBuf = Buffer._augment(this.subarray(start, end))\n  } else {\n    var sliceLen = end - start\n    newBuf = new Buffer(sliceLen, undefined)\n    for (var i = 0; i < sliceLen; i++) {\n      newBuf[i] = this[i + start]\n    }\n  }\n\n  if (newBuf.length) newBuf.parent = this.parent || this\n\n  return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    checkOffset(offset, byteLength, this.length)\n  }\n\n  var val = this[offset + --byteLength]\n  var mul = 1\n  while (byteLength > 0 && (mul *= 0x100)) {\n    val += this[offset + --byteLength] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return ((this[offset]) |\n      (this[offset + 1] << 8) |\n      (this[offset + 2] << 16)) +\n      (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] * 0x1000000) +\n    ((this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var i = byteLength\n  var mul = 1\n  var val = this[offset + --i]\n  while (i > 0 && (mul *= 0x100)) {\n    val += this[offset + --i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  if (!(this[offset] & 0x80)) return (this[offset])\n  return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset] | (this[offset + 1] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset + 1] | (this[offset] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset]) |\n    (this[offset + 1] << 8) |\n    (this[offset + 2] << 16) |\n    (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] << 24) |\n    (this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n  if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var mul = 1\n  var i = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var i = byteLength - 1\n  var mul = 1\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n      (littleEndian ? i : 1 - i) * 8\n  }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffffffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset + 3] = (value >>> 24)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 1] = (value >>> 8)\n    this[offset] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = 0\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  if (value < 0) value = 0xff + value + 1\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 3] = (value >>> 24)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (value < 0) value = 0xffffffff + value + 1\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n  if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n  return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n  return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (targetStart >= target.length) targetStart = target.length\n  if (!targetStart) targetStart = 0\n  if (end > 0 && end < start) end = start\n\n  // Copy 0 bytes; we're done\n  if (end === start) return 0\n  if (target.length === 0 || this.length === 0) return 0\n\n  // Fatal error conditions\n  if (targetStart < 0) {\n    throw new RangeError('targetStart out of bounds')\n  }\n  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n  if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n  // Are we oob?\n  if (end > this.length) end = this.length\n  if (target.length - targetStart < end - start) {\n    end = target.length - targetStart + start\n  }\n\n  var len = end - start\n  var i\n\n  if (this === target && start < targetStart && targetStart < end) {\n    // descending copy from end\n    for (i = len - 1; i >= 0; i--) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n    // ascending copy from start\n    for (i = 0; i < len; i++) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else {\n    target._set(this.subarray(start, start + len), targetStart)\n  }\n\n  return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n  if (!value) value = 0\n  if (!start) start = 0\n  if (!end) end = this.length\n\n  if (end < start) throw new RangeError('end < start')\n\n  // Fill 0 bytes; we're done\n  if (end === start) return\n  if (this.length === 0) return\n\n  if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n  if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n  var i\n  if (typeof value === 'number') {\n    for (i = start; i < end; i++) {\n      this[i] = value\n    }\n  } else {\n    var bytes = utf8ToBytes(value.toString())\n    var len = bytes.length\n    for (i = start; i < end; i++) {\n      this[i] = bytes[i % len]\n    }\n  }\n\n  return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n  if (typeof Uint8Array !== 'undefined') {\n    if (Buffer.TYPED_ARRAY_SUPPORT) {\n      return (new Buffer(this)).buffer\n    } else {\n      var buf = new Uint8Array(this.length)\n      for (var i = 0, len = buf.length; i < len; i += 1) {\n        buf[i] = this[i]\n      }\n      return buf.buffer\n    }\n  } else {\n    throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n  }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n  arr.constructor = Buffer\n  arr._isBuffer = true\n\n  // save reference to original Uint8Array set method before overwriting\n  arr._set = arr.set\n\n  // deprecated\n  arr.get = BP.get\n  arr.set = BP.set\n\n  arr.write = BP.write\n  arr.toString = BP.toString\n  arr.toLocaleString = BP.toString\n  arr.toJSON = BP.toJSON\n  arr.equals = BP.equals\n  arr.compare = BP.compare\n  arr.indexOf = BP.indexOf\n  arr.copy = BP.copy\n  arr.slice = BP.slice\n  arr.readUIntLE = BP.readUIntLE\n  arr.readUIntBE = BP.readUIntBE\n  arr.readUInt8 = BP.readUInt8\n  arr.readUInt16LE = BP.readUInt16LE\n  arr.readUInt16BE = BP.readUInt16BE\n  arr.readUInt32LE = BP.readUInt32LE\n  arr.readUInt32BE = BP.readUInt32BE\n  arr.readIntLE = BP.readIntLE\n  arr.readIntBE = BP.readIntBE\n  arr.readInt8 = BP.readInt8\n  arr.readInt16LE = BP.readInt16LE\n  arr.readInt16BE = BP.readInt16BE\n  arr.readInt32LE = BP.readInt32LE\n  arr.readInt32BE = BP.readInt32BE\n  arr.readFloatLE = BP.readFloatLE\n  arr.readFloatBE = BP.readFloatBE\n  arr.readDoubleLE = BP.readDoubleLE\n  arr.readDoubleBE = BP.readDoubleBE\n  arr.writeUInt8 = BP.writeUInt8\n  arr.writeUIntLE = BP.writeUIntLE\n  arr.writeUIntBE = BP.writeUIntBE\n  arr.writeUInt16LE = BP.writeUInt16LE\n  arr.writeUInt16BE = BP.writeUInt16BE\n  arr.writeUInt32LE = BP.writeUInt32LE\n  arr.writeUInt32BE = BP.writeUInt32BE\n  arr.writeIntLE = BP.writeIntLE\n  arr.writeIntBE = BP.writeIntBE\n  arr.writeInt8 = BP.writeInt8\n  arr.writeInt16LE = BP.writeInt16LE\n  arr.writeInt16BE = BP.writeInt16BE\n  arr.writeInt32LE = BP.writeInt32LE\n  arr.writeInt32BE = BP.writeInt32BE\n  arr.writeFloatLE = BP.writeFloatLE\n  arr.writeFloatBE = BP.writeFloatBE\n  arr.writeDoubleLE = BP.writeDoubleLE\n  arr.writeDoubleBE = BP.writeDoubleBE\n  arr.fill = BP.fill\n  arr.inspect = BP.inspect\n  arr.toArrayBuffer = BP.toArrayBuffer\n\n  return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n  // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n  str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n  // Node converts strings with length < 2 to ''\n  if (str.length < 2) return ''\n  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n  while (str.length % 4 !== 0) {\n    str = str + '='\n  }\n  return str\n}\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n  units = units || Infinity\n  var codePoint\n  var length = string.length\n  var leadSurrogate = null\n  var bytes = []\n\n  for (var i = 0; i < length; i++) {\n    codePoint = string.charCodeAt(i)\n\n    // is surrogate component\n    if (codePoint > 0xD7FF && codePoint < 0xE000) {\n      // last char was a lead\n      if (!leadSurrogate) {\n        // no lead yet\n        if (codePoint > 0xDBFF) {\n          // unexpected trail\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        } else if (i + 1 === length) {\n          // unpaired lead\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        }\n\n        // valid lead\n        leadSurrogate = codePoint\n\n        continue\n      }\n\n      // 2 leads in a row\n      if (codePoint < 0xDC00) {\n        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n        leadSurrogate = codePoint\n        continue\n      }\n\n      // valid surrogate pair\n      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n    } else if (leadSurrogate) {\n      // valid bmp char, but last char was a lead\n      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n    }\n\n    leadSurrogate = null\n\n    // encode utf8\n    if (codePoint < 0x80) {\n      if ((units -= 1) < 0) break\n      bytes.push(codePoint)\n    } else if (codePoint < 0x800) {\n      if ((units -= 2) < 0) break\n      bytes.push(\n        codePoint >> 0x6 | 0xC0,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x10000) {\n      if ((units -= 3) < 0) break\n      bytes.push(\n        codePoint >> 0xC | 0xE0,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x110000) {\n      if ((units -= 4) < 0) break\n      bytes.push(\n        codePoint >> 0x12 | 0xF0,\n        codePoint >> 0xC & 0x3F | 0x80,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else {\n      throw new Error('Invalid code point')\n    }\n  }\n\n  return bytes\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    // Node's code seems to be doing this and not & 0x7F..\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    if ((units -= 2) < 0) break\n\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  for (var i = 0; i < length; i++) {\n    if ((i + offset >= dst.length) || (i >= src.length)) break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"base64-js\":4,\"ieee754\":5,\"is-array\":6}],4:[function(require,module,exports){\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n	'use strict';\n\n  var Arr = (typeof Uint8Array !== 'undefined')\n    ? Uint8Array\n    : Array\n\n	var PLUS   = '+'.charCodeAt(0)\n	var SLASH  = '/'.charCodeAt(0)\n	var NUMBER = '0'.charCodeAt(0)\n	var LOWER  = 'a'.charCodeAt(0)\n	var UPPER  = 'A'.charCodeAt(0)\n	var PLUS_URL_SAFE = '-'.charCodeAt(0)\n	var SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n	function decode (elt) {\n		var code = elt.charCodeAt(0)\n		if (code === PLUS ||\n		    code === PLUS_URL_SAFE)\n			return 62 // '+'\n		if (code === SLASH ||\n		    code === SLASH_URL_SAFE)\n			return 63 // '/'\n		if (code < NUMBER)\n			return -1 //no match\n		if (code < NUMBER + 10)\n			return code - NUMBER + 26 + 26\n		if (code < UPPER + 26)\n			return code - UPPER\n		if (code < LOWER + 26)\n			return code - LOWER + 26\n	}\n\n	function b64ToByteArray (b64) {\n		var i, j, l, tmp, placeHolders, arr\n\n		if (b64.length % 4 > 0) {\n			throw new Error('Invalid string. Length must be a multiple of 4')\n		}\n\n		// the number of equal signs (place holders)\n		// if there are two placeholders, than the two characters before it\n		// represent one byte\n		// if there is only one, then the three characters before it represent 2 bytes\n		// this is just a cheap hack to not do indexOf twice\n		var len = b64.length\n		placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n		// base64 is 4/3 + up to two characters of the original data\n		arr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n		// if there are placeholders, only get up to the last complete 4 chars\n		l = placeHolders > 0 ? b64.length - 4 : b64.length\n\n		var L = 0\n\n		function push (v) {\n			arr[L++] = v\n		}\n\n		for (i = 0, j = 0; i < l; i += 4, j += 3) {\n			tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n			push((tmp & 0xFF0000) >> 16)\n			push((tmp & 0xFF00) >> 8)\n			push(tmp & 0xFF)\n		}\n\n		if (placeHolders === 2) {\n			tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n			push(tmp & 0xFF)\n		} else if (placeHolders === 1) {\n			tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n			push((tmp >> 8) & 0xFF)\n			push(tmp & 0xFF)\n		}\n\n		return arr\n	}\n\n	function uint8ToBase64 (uint8) {\n		var i,\n			extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n			output = \"\",\n			temp, length\n\n		function encode (num) {\n			return lookup.charAt(num)\n		}\n\n		function tripletToBase64 (num) {\n			return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n		}\n\n		// go through the array every three bytes, we'll deal with trailing stuff later\n		for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n			temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n			output += tripletToBase64(temp)\n		}\n\n		// pad the end with zeros, but make sure to not forget the extra bytes\n		switch (extraBytes) {\n			case 1:\n				temp = uint8[uint8.length - 1]\n				output += encode(temp >> 2)\n				output += encode((temp << 4) & 0x3F)\n				output += '=='\n				break\n			case 2:\n				temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n				output += encode(temp >> 10)\n				output += encode((temp >> 4) & 0x3F)\n				output += encode((temp << 2) & 0x3F)\n				output += '='\n				break\n		}\n\n		return output\n	}\n\n	exports.toByteArray = b64ToByteArray\n	exports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n\n},{}],5:[function(require,module,exports){\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n  var e, m\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var nBits = -7\n  var i = isLE ? (nBytes - 1) : 0\n  var d = isLE ? -1 : 1\n  var s = buffer[offset + i]\n\n  i += d\n\n  e = s & ((1 << (-nBits)) - 1)\n  s >>= (-nBits)\n  nBits += eLen\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  m = e & ((1 << (-nBits)) - 1)\n  e >>= (-nBits)\n  nBits += mLen\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  if (e === 0) {\n    e = 1 - eBias\n  } else if (e === eMax) {\n    return m ? NaN : ((s ? -1 : 1) * Infinity)\n  } else {\n    m = m + Math.pow(2, mLen)\n    e = e - eBias\n  }\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n  var e, m, c\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n  var i = isLE ? 0 : (nBytes - 1)\n  var d = isLE ? 1 : -1\n  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n  value = Math.abs(value)\n\n  if (isNaN(value) || value === Infinity) {\n    m = isNaN(value) ? 1 : 0\n    e = eMax\n  } else {\n    e = Math.floor(Math.log(value) / Math.LN2)\n    if (value * (c = Math.pow(2, -e)) < 1) {\n      e--\n      c *= 2\n    }\n    if (e + eBias >= 1) {\n      value += rt / c\n    } else {\n      value += rt * Math.pow(2, 1 - eBias)\n    }\n    if (value * c >= 2) {\n      e++\n      c /= 2\n    }\n\n    if (e + eBias >= eMax) {\n      m = 0\n      e = eMax\n    } else if (e + eBias >= 1) {\n      m = (value * c - 1) * Math.pow(2, mLen)\n      e = e + eBias\n    } else {\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n      e = 0\n    }\n  }\n\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n  e = (e << mLen) | m\n  eLen += mLen\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n  buffer[offset + i - d] |= s * 128\n}\n\n},{}],6:[function(require,module,exports){\n\n/**\n * isArray\n */\n\nvar isArray = Array.isArray;\n\n/**\n * toString\n */\n\nvar str = Object.prototype.toString;\n\n/**\n * Whether or not the given `val`\n * is an array.\n *\n * example:\n *\n *        isArray([]);\n *        // > true\n *        isArray(arguments);\n *        // > false\n *        isArray('');\n *        // > false\n *\n * @param {mixed} val\n * @return {bool}\n */\n\nmodule.exports = isArray || function (val) {\n  return !! val && '[object Array]' == str.call(val);\n};\n\n},{}],7:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n  this._events = this._events || {};\n  this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n  if (!isNumber(n) || n < 0 || isNaN(n))\n    throw TypeError('n must be a positive number');\n  this._maxListeners = n;\n  return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n  var er, handler, len, args, i, listeners;\n\n  if (!this._events)\n    this._events = {};\n\n  // If there is no 'error' event listener then throw.\n  if (type === 'error') {\n    if (!this._events.error ||\n        (isObject(this._events.error) && !this._events.error.length)) {\n      er = arguments[1];\n      if (er instanceof Error) {\n        throw er; // Unhandled 'error' event\n      }\n      throw TypeError('Uncaught, unspecified \"error\" event.');\n    }\n  }\n\n  handler = this._events[type];\n\n  if (isUndefined(handler))\n    return false;\n\n  if (isFunction(handler)) {\n    switch (arguments.length) {\n      // fast cases\n      case 1:\n        handler.call(this);\n        break;\n      case 2:\n        handler.call(this, arguments[1]);\n        break;\n      case 3:\n        handler.call(this, arguments[1], arguments[2]);\n        break;\n      // slower\n      default:\n        args = Array.prototype.slice.call(arguments, 1);\n        handler.apply(this, args);\n    }\n  } else if (isObject(handler)) {\n    args = Array.prototype.slice.call(arguments, 1);\n    listeners = handler.slice();\n    len = listeners.length;\n    for (i = 0; i < len; i++)\n      listeners[i].apply(this, args);\n  }\n\n  return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n  var m;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events)\n    this._events = {};\n\n  // To avoid recursion in the case that type === \"newListener\"! Before\n  // adding it to the listeners, first emit \"newListener\".\n  if (this._events.newListener)\n    this.emit('newListener', type,\n              isFunction(listener.listener) ?\n              listener.listener : listener);\n\n  if (!this._events[type])\n    // Optimize the case of one listener. Don't need the extra array object.\n    this._events[type] = listener;\n  else if (isObject(this._events[type]))\n    // If we've already got an array, just append.\n    this._events[type].push(listener);\n  else\n    // Adding the second element, need to change to array.\n    this._events[type] = [this._events[type], listener];\n\n  // Check for listener leak\n  if (isObject(this._events[type]) && !this._events[type].warned) {\n    if (!isUndefined(this._maxListeners)) {\n      m = this._maxListeners;\n    } else {\n      m = EventEmitter.defaultMaxListeners;\n    }\n\n    if (m && m > 0 && this._events[type].length > m) {\n      this._events[type].warned = true;\n      console.error('(node) warning: possible EventEmitter memory ' +\n                    'leak detected. %d listeners added. ' +\n                    'Use emitter.setMaxListeners() to increase limit.',\n                    this._events[type].length);\n      if (typeof console.trace === 'function') {\n        // not supported in IE 10\n        console.trace();\n      }\n    }\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  var fired = false;\n\n  function g() {\n    this.removeListener(type, g);\n\n    if (!fired) {\n      fired = true;\n      listener.apply(this, arguments);\n    }\n  }\n\n  g.listener = listener;\n  this.on(type, g);\n\n  return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n  var list, position, length, i;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events || !this._events[type])\n    return this;\n\n  list = this._events[type];\n  length = list.length;\n  position = -1;\n\n  if (list === listener ||\n      (isFunction(list.listener) && list.listener === listener)) {\n    delete this._events[type];\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n\n  } else if (isObject(list)) {\n    for (i = length; i-- > 0;) {\n      if (list[i] === listener ||\n          (list[i].listener && list[i].listener === listener)) {\n        position = i;\n        break;\n      }\n    }\n\n    if (position < 0)\n      return this;\n\n    if (list.length === 1) {\n      list.length = 0;\n      delete this._events[type];\n    } else {\n      list.splice(position, 1);\n    }\n\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n  var key, listeners;\n\n  if (!this._events)\n    return this;\n\n  // not listening for removeListener, no need to emit\n  if (!this._events.removeListener) {\n    if (arguments.length === 0)\n      this._events = {};\n    else if (this._events[type])\n      delete this._events[type];\n    return this;\n  }\n\n  // emit removeListener for all listeners on all events\n  if (arguments.length === 0) {\n    for (key in this._events) {\n      if (key === 'removeListener') continue;\n      this.removeAllListeners(key);\n    }\n    this.removeAllListeners('removeListener');\n    this._events = {};\n    return this;\n  }\n\n  listeners = this._events[type];\n\n  if (isFunction(listeners)) {\n    this.removeListener(type, listeners);\n  } else if (listeners) {\n    // LIFO order\n    while (listeners.length)\n      this.removeListener(type, listeners[listeners.length - 1]);\n  }\n  delete this._events[type];\n\n  return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n  var ret;\n  if (!this._events || !this._events[type])\n    ret = [];\n  else if (isFunction(this._events[type]))\n    ret = [this._events[type]];\n  else\n    ret = this._events[type].slice();\n  return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n  if (this._events) {\n    var evlistener = this._events[type];\n\n    if (isFunction(evlistener))\n      return 1;\n    else if (evlistener)\n      return evlistener.length;\n  }\n  return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n  return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\n\n},{}],8:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n  // implementation from standard node.js 'util' module\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    ctor.prototype = Object.create(superCtor.prototype, {\n      constructor: {\n        value: ctor,\n        enumerable: false,\n        writable: true,\n        configurable: true\n      }\n    });\n  };\n} else {\n  // old school shim for old browsers\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    var TempCtor = function () {}\n    TempCtor.prototype = superCtor.prototype\n    ctor.prototype = new TempCtor()\n    ctor.prototype.constructor = ctor\n  }\n}\n\n},{}],9:[function(require,module,exports){\n/**\n * Determine if an object is Buffer\n *\n * Author:   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * License:  MIT\n *\n * `npm install is-buffer`\n */\n\nmodule.exports = function (obj) {\n  return !!(obj != null &&\n    (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)\n      (obj.constructor &&\n      typeof obj.constructor.isBuffer === 'function' &&\n      obj.constructor.isBuffer(obj))\n    ))\n}\n\n},{}],10:[function(require,module,exports){\nmodule.exports = Array.isArray || function (arr) {\n  return Object.prototype.toString.call(arr) == '[object Array]';\n};\n\n},{}],11:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = setTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],12:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_duplex.js\")\n\n},{\"./lib/_stream_duplex.js\":13}],13:[function(require,module,exports){\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/*<replacement>*/\nvar objectKeys = Object.keys || function (obj) {\n  var keys = [];\n  for (var key in obj) keys.push(key);\n  return keys;\n}\n/*</replacement>*/\n\n\nmodule.exports = Duplex;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nvar keys = objectKeys(Writable.prototype);\nfor (var v = 0; v < keys.length; v++) {\n  var method = keys[v];\n  if (!Duplex.prototype[method])\n    Duplex.prototype[method] = Writable.prototype[method];\n}\n\nfunction Duplex(options) {\n  if (!(this instanceof Duplex))\n    return new Duplex(options);\n\n  Readable.call(this, options);\n  Writable.call(this, options);\n\n  if (options && options.readable === false)\n    this.readable = false;\n\n  if (options && options.writable === false)\n    this.writable = false;\n\n  this.allowHalfOpen = true;\n  if (options && options.allowHalfOpen === false)\n    this.allowHalfOpen = false;\n\n  this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n  // if we allow half-open state, or if the writable side ended,\n  // then we're ok.\n  if (this.allowHalfOpen || this._writableState.ended)\n    return;\n\n  // no more data can be written.\n  // But allow more writes to happen in this tick.\n  processNextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n  self.end();\n}\n\nfunction forEach (xs, f) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    f(xs[i], i);\n  }\n}\n\n},{\"./_stream_readable\":15,\"./_stream_writable\":17,\"core-util-is\":18,\"inherits\":8,\"process-nextick-args\":19}],14:[function(require,module,exports){\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n  if (!(this instanceof PassThrough))\n    return new PassThrough(options);\n\n  Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n  cb(null, chunk);\n};\n\n},{\"./_stream_transform\":16,\"core-util-is\":18,\"inherits\":8}],15:[function(require,module,exports){\n(function (process){\n'use strict';\n\nmodule.exports = Readable;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n\n/*<replacement>*/\nvar isArray = require('isarray');\n/*</replacement>*/\n\n\n/*<replacement>*/\nvar Buffer = require('buffer').Buffer;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events');\n\n/*<replacement>*/\nvar EElistenerCount = function(emitter, type) {\n  return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n\n\n/*<replacement>*/\nvar Stream;\n(function (){try{\n  Stream = require('st' + 'ream');\n}catch(_){}finally{\n  if (!Stream)\n    Stream = require('events').EventEmitter;\n}}())\n/*</replacement>*/\n\nvar Buffer = require('buffer').Buffer;\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n\n\n/*<replacement>*/\nvar debugUtil = require('util');\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n  debug = debugUtil.debuglog('stream');\n} else {\n  debug = function () {};\n}\n/*</replacement>*/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nfunction ReadableState(options, stream) {\n  var Duplex = require('./_stream_duplex');\n\n  options = options || {};\n\n  // object stream flag. Used to make read(n) ignore n and to\n  // make all the buffer merging and length checks go away\n  this.objectMode = !!options.objectMode;\n\n  if (stream instanceof Duplex)\n    this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n  // the point at which it stops calling _read() to fill the buffer\n  // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n  var hwm = options.highWaterMark;\n  var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n  this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n  // cast to ints.\n  this.highWaterMark = ~~this.highWaterMark;\n\n  this.buffer = [];\n  this.length = 0;\n  this.pipes = null;\n  this.pipesCount = 0;\n  this.flowing = null;\n  this.ended = false;\n  this.endEmitted = false;\n  this.reading = false;\n\n  // a flag to be able to tell if the onwrite cb is called immediately,\n  // or on a later tick.  We set this to true at first, because any\n  // actions that shouldn't happen until \"later\" should generally also\n  // not happen before the first write call.\n  this.sync = true;\n\n  // whenever we return null, then we set a flag to say\n  // that we're awaiting a 'readable' event emission.\n  this.needReadable = false;\n  this.emittedReadable = false;\n  this.readableListening = false;\n\n  // Crypto is kind of old and crusty.  Historically, its default string\n  // encoding is 'binary' so we have to make this configurable.\n  // Everything else in the universe uses 'utf8', though.\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n  // when piping, we only care about 'readable' events that happen\n  // after read()ing all the bytes and not getting any pushback.\n  this.ranOut = false;\n\n  // the number of writers that are awaiting a drain event in .pipe()s\n  this.awaitDrain = 0;\n\n  // if true, a maybeReadMore has been scheduled\n  this.readingMore = false;\n\n  this.decoder = null;\n  this.encoding = null;\n  if (options.encoding) {\n    if (!StringDecoder)\n      StringDecoder = require('string_decoder/').StringDecoder;\n    this.decoder = new StringDecoder(options.encoding);\n    this.encoding = options.encoding;\n  }\n}\n\nfunction Readable(options) {\n  var Duplex = require('./_stream_duplex');\n\n  if (!(this instanceof Readable))\n    return new Readable(options);\n\n  this._readableState = new ReadableState(options, this);\n\n  // legacy\n  this.readable = true;\n\n  if (options && typeof options.read === 'function')\n    this._read = options.read;\n\n  Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n  var state = this._readableState;\n\n  if (!state.objectMode && typeof chunk === 'string') {\n    encoding = encoding || state.defaultEncoding;\n    if (encoding !== state.encoding) {\n      chunk = new Buffer(chunk, encoding);\n      encoding = '';\n    }\n  }\n\n  return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n  var state = this._readableState;\n  return readableAddChunk(this, state, chunk, '', true);\n};\n\nReadable.prototype.isPaused = function() {\n  return this._readableState.flowing === false;\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n  var er = chunkInvalid(state, chunk);\n  if (er) {\n    stream.emit('error', er);\n  } else if (chunk === null) {\n    state.reading = false;\n    onEofChunk(stream, state);\n  } else if (state.objectMode || chunk && chunk.length > 0) {\n    if (state.ended && !addToFront) {\n      var e = new Error('stream.push() after EOF');\n      stream.emit('error', e);\n    } else if (state.endEmitted && addToFront) {\n      var e = new Error('stream.unshift() after end event');\n      stream.emit('error', e);\n    } else {\n      if (state.decoder && !addToFront && !encoding)\n        chunk = state.decoder.write(chunk);\n\n      if (!addToFront)\n        state.reading = false;\n\n      // if we want the data now, just emit it.\n      if (state.flowing && state.length === 0 && !state.sync) {\n        stream.emit('data', chunk);\n        stream.read(0);\n      } else {\n        // update the buffer info.\n        state.length += state.objectMode ? 1 : chunk.length;\n        if (addToFront)\n          state.buffer.unshift(chunk);\n        else\n          state.buffer.push(chunk);\n\n        if (state.needReadable)\n          emitReadable(stream);\n      }\n\n      maybeReadMore(stream, state);\n    }\n  } else if (!addToFront) {\n    state.reading = false;\n  }\n\n  return needMoreData(state);\n}\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes.  This is to work around cases where hwm=0,\n// such as the repl.  Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n  return !state.ended &&\n         (state.needReadable ||\n          state.length < state.highWaterMark ||\n          state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n  if (!StringDecoder)\n    StringDecoder = require('string_decoder/').StringDecoder;\n  this._readableState.decoder = new StringDecoder(enc);\n  this._readableState.encoding = enc;\n  return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n  if (n >= MAX_HWM) {\n    n = MAX_HWM;\n  } else {\n    // Get the next highest power of 2\n    n--;\n    n |= n >>> 1;\n    n |= n >>> 2;\n    n |= n >>> 4;\n    n |= n >>> 8;\n    n |= n >>> 16;\n    n++;\n  }\n  return n;\n}\n\nfunction howMuchToRead(n, state) {\n  if (state.length === 0 && state.ended)\n    return 0;\n\n  if (state.objectMode)\n    return n === 0 ? 0 : 1;\n\n  if (n === null || isNaN(n)) {\n    // only flow one buffer at a time\n    if (state.flowing && state.buffer.length)\n      return state.buffer[0].length;\n    else\n      return state.length;\n  }\n\n  if (n <= 0)\n    return 0;\n\n  // If we're asking for more than the target buffer level,\n  // then raise the water mark.  Bump up to the next highest\n  // power of 2, to prevent increasing it excessively in tiny\n  // amounts.\n  if (n > state.highWaterMark)\n    state.highWaterMark = computeNewHighWaterMark(n);\n\n  // don't have that much.  return null, unless we've ended.\n  if (n > state.length) {\n    if (!state.ended) {\n      state.needReadable = true;\n      return 0;\n    } else {\n      return state.length;\n    }\n  }\n\n  return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n  debug('read', n);\n  var state = this._readableState;\n  var nOrig = n;\n\n  if (typeof n !== 'number' || n > 0)\n    state.emittedReadable = false;\n\n  // if we're doing read(0) to trigger a readable event, but we\n  // already have a bunch of data in the buffer, then just trigger\n  // the 'readable' event and move on.\n  if (n === 0 &&\n      state.needReadable &&\n      (state.length >= state.highWaterMark || state.ended)) {\n    debug('read: emitReadable', state.length, state.ended);\n    if (state.length === 0 && state.ended)\n      endReadable(this);\n    else\n      emitReadable(this);\n    return null;\n  }\n\n  n = howMuchToRead(n, state);\n\n  // if we've ended, and we're now clear, then finish it up.\n  if (n === 0 && state.ended) {\n    if (state.length === 0)\n      endReadable(this);\n    return null;\n  }\n\n  // All the actual chunk generation logic needs to be\n  // *below* the call to _read.  The reason is that in certain\n  // synthetic stream cases, such as passthrough streams, _read\n  // may be a completely synchronous operation which may change\n  // the state of the read buffer, providing enough data when\n  // before there was *not* enough.\n  //\n  // So, the steps are:\n  // 1. Figure out what the state of things will be after we do\n  // a read from the buffer.\n  //\n  // 2. If that resulting state will trigger a _read, then call _read.\n  // Note that this may be asynchronous, or synchronous.  Yes, it is\n  // deeply ugly to write APIs this way, but that still doesn't mean\n  // that the Readable class should behave improperly, as streams are\n  // designed to be sync/async agnostic.\n  // Take note if the _read call is sync or async (ie, if the read call\n  // has returned yet), so that we know whether or not it's safe to emit\n  // 'readable' etc.\n  //\n  // 3. Actually pull the requested chunks out of the buffer and return.\n\n  // if we need a readable event, then we need to do some reading.\n  var doRead = state.needReadable;\n  debug('need readable', doRead);\n\n  // if we currently have less than the highWaterMark, then also read some\n  if (state.length === 0 || state.length - n < state.highWaterMark) {\n    doRead = true;\n    debug('length less than watermark', doRead);\n  }\n\n  // however, if we've ended, then there's no point, and if we're already\n  // reading, then it's unnecessary.\n  if (state.ended || state.reading) {\n    doRead = false;\n    debug('reading or ended', doRead);\n  }\n\n  if (doRead) {\n    debug('do read');\n    state.reading = true;\n    state.sync = true;\n    // if the length is currently zero, then we *need* a readable event.\n    if (state.length === 0)\n      state.needReadable = true;\n    // call internal read method\n    this._read(state.highWaterMark);\n    state.sync = false;\n  }\n\n  // If _read pushed data synchronously, then `reading` will be false,\n  // and we need to re-evaluate how much data we can return to the user.\n  if (doRead && !state.reading)\n    n = howMuchToRead(nOrig, state);\n\n  var ret;\n  if (n > 0)\n    ret = fromList(n, state);\n  else\n    ret = null;\n\n  if (ret === null) {\n    state.needReadable = true;\n    n = 0;\n  }\n\n  state.length -= n;\n\n  // If we have nothing in the buffer, then we want to know\n  // as soon as we *do* get something into the buffer.\n  if (state.length === 0 && !state.ended)\n    state.needReadable = true;\n\n  // If we tried to read() past the EOF, then emit end on the next tick.\n  if (nOrig !== n && state.ended && state.length === 0)\n    endReadable(this);\n\n  if (ret !== null)\n    this.emit('data', ret);\n\n  return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n  var er = null;\n  if (!(Buffer.isBuffer(chunk)) &&\n      typeof chunk !== 'string' &&\n      chunk !== null &&\n      chunk !== undefined &&\n      !state.objectMode) {\n    er = new TypeError('Invalid non-string/buffer chunk');\n  }\n  return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n  if (state.ended) return;\n  if (state.decoder) {\n    var chunk = state.decoder.end();\n    if (chunk && chunk.length) {\n      state.buffer.push(chunk);\n      state.length += state.objectMode ? 1 : chunk.length;\n    }\n  }\n  state.ended = true;\n\n  // emit 'readable' now to make sure it gets picked up.\n  emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow.  This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n  var state = stream._readableState;\n  state.needReadable = false;\n  if (!state.emittedReadable) {\n    debug('emitReadable', state.flowing);\n    state.emittedReadable = true;\n    if (state.sync)\n      processNextTick(emitReadable_, stream);\n    else\n      emitReadable_(stream);\n  }\n}\n\nfunction emitReadable_(stream) {\n  debug('emit readable');\n  stream.emit('readable');\n  flow(stream);\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data.  that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n  if (!state.readingMore) {\n    state.readingMore = true;\n    processNextTick(maybeReadMore_, stream, state);\n  }\n}\n\nfunction maybeReadMore_(stream, state) {\n  var len = state.length;\n  while (!state.reading && !state.flowing && !state.ended &&\n         state.length < state.highWaterMark) {\n    debug('maybeReadMore read 0');\n    stream.read(0);\n    if (len === state.length)\n      // didn't get any data, stop spinning.\n      break;\n    else\n      len = state.length;\n  }\n  state.readingMore = false;\n}\n\n// abstract method.  to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n  this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n  var src = this;\n  var state = this._readableState;\n\n  switch (state.pipesCount) {\n    case 0:\n      state.pipes = dest;\n      break;\n    case 1:\n      state.pipes = [state.pipes, dest];\n      break;\n    default:\n      state.pipes.push(dest);\n      break;\n  }\n  state.pipesCount += 1;\n  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n  var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n              dest !== process.stdout &&\n              dest !== process.stderr;\n\n  var endFn = doEnd ? onend : cleanup;\n  if (state.endEmitted)\n    processNextTick(endFn);\n  else\n    src.once('end', endFn);\n\n  dest.on('unpipe', onunpipe);\n  function onunpipe(readable) {\n    debug('onunpipe');\n    if (readable === src) {\n      cleanup();\n    }\n  }\n\n  function onend() {\n    debug('onend');\n    dest.end();\n  }\n\n  // when the dest drains, it reduces the awaitDrain counter\n  // on the source.  This would be more elegant with a .once()\n  // handler in flow(), but adding and removing repeatedly is\n  // too slow.\n  var ondrain = pipeOnDrain(src);\n  dest.on('drain', ondrain);\n\n  var cleanedUp = false;\n  function cleanup() {\n    debug('cleanup');\n    // cleanup event handlers once the pipe is broken\n    dest.removeListener('close', onclose);\n    dest.removeListener('finish', onfinish);\n    dest.removeListener('drain', ondrain);\n    dest.removeListener('error', onerror);\n    dest.removeListener('unpipe', onunpipe);\n    src.removeListener('end', onend);\n    src.removeListener('end', cleanup);\n    src.removeListener('data', ondata);\n\n    cleanedUp = true;\n\n    // if the reader is waiting for a drain event from this\n    // specific writer, then it would cause it to never start\n    // flowing again.\n    // So, if this is awaiting a drain, then we just call it now.\n    // If we don't know, then assume that we are waiting for one.\n    if (state.awaitDrain &&\n        (!dest._writableState || dest._writableState.needDrain))\n      ondrain();\n  }\n\n  src.on('data', ondata);\n  function ondata(chunk) {\n    debug('ondata');\n    var ret = dest.write(chunk);\n    if (false === ret) {\n      // If the user unpiped during `dest.write()`, it is possible\n      // to get stuck in a permanently paused state if that write\n      // also returned false.\n      if (state.pipesCount === 1 &&\n          state.pipes[0] === dest &&\n          src.listenerCount('data') === 1 &&\n          !cleanedUp) {\n        debug('false write response, pause', src._readableState.awaitDrain);\n        src._readableState.awaitDrain++;\n      }\n      src.pause();\n    }\n  }\n\n  // if the dest has an error, then stop piping into it.\n  // however, don't suppress the throwing behavior for this.\n  function onerror(er) {\n    debug('onerror', er);\n    unpipe();\n    dest.removeListener('error', onerror);\n    if (EElistenerCount(dest, 'error') === 0)\n      dest.emit('error', er);\n  }\n  // This is a brutally ugly hack to make sure that our error handler\n  // is attached before any userland ones.  NEVER DO THIS.\n  if (!dest._events || !dest._events.error)\n    dest.on('error', onerror);\n  else if (isArray(dest._events.error))\n    dest._events.error.unshift(onerror);\n  else\n    dest._events.error = [onerror, dest._events.error];\n\n\n  // Both close and finish should trigger unpipe, but only once.\n  function onclose() {\n    dest.removeListener('finish', onfinish);\n    unpipe();\n  }\n  dest.once('close', onclose);\n  function onfinish() {\n    debug('onfinish');\n    dest.removeListener('close', onclose);\n    unpipe();\n  }\n  dest.once('finish', onfinish);\n\n  function unpipe() {\n    debug('unpipe');\n    src.unpipe(dest);\n  }\n\n  // tell the dest that it's being piped to\n  dest.emit('pipe', src);\n\n  // start the flow if it hasn't been started already.\n  if (!state.flowing) {\n    debug('pipe resume');\n    src.resume();\n  }\n\n  return dest;\n};\n\nfunction pipeOnDrain(src) {\n  return function() {\n    var state = src._readableState;\n    debug('pipeOnDrain', state.awaitDrain);\n    if (state.awaitDrain)\n      state.awaitDrain--;\n    if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n      state.flowing = true;\n      flow(src);\n    }\n  };\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n  var state = this._readableState;\n\n  // if we're not piping anywhere, then do nothing.\n  if (state.pipesCount === 0)\n    return this;\n\n  // just one destination.  most common case.\n  if (state.pipesCount === 1) {\n    // passed in one, but it's not the right one.\n    if (dest && dest !== state.pipes)\n      return this;\n\n    if (!dest)\n      dest = state.pipes;\n\n    // got a match.\n    state.pipes = null;\n    state.pipesCount = 0;\n    state.flowing = false;\n    if (dest)\n      dest.emit('unpipe', this);\n    return this;\n  }\n\n  // slow case. multiple pipe destinations.\n\n  if (!dest) {\n    // remove all.\n    var dests = state.pipes;\n    var len = state.pipesCount;\n    state.pipes = null;\n    state.pipesCount = 0;\n    state.flowing = false;\n\n    for (var i = 0; i < len; i++)\n      dests[i].emit('unpipe', this);\n    return this;\n  }\n\n  // try to find the right one.\n  var i = indexOf(state.pipes, dest);\n  if (i === -1)\n    return this;\n\n  state.pipes.splice(i, 1);\n  state.pipesCount -= 1;\n  if (state.pipesCount === 1)\n    state.pipes = state.pipes[0];\n\n  dest.emit('unpipe', this);\n\n  return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n  var res = Stream.prototype.on.call(this, ev, fn);\n\n  // If listening to data, and it has not explicitly been paused,\n  // then call resume to start the flow of data on the next tick.\n  if (ev === 'data' && false !== this._readableState.flowing) {\n    this.resume();\n  }\n\n  if (ev === 'readable' && this.readable) {\n    var state = this._readableState;\n    if (!state.readableListening) {\n      state.readableListening = true;\n      state.emittedReadable = false;\n      state.needReadable = true;\n      if (!state.reading) {\n        processNextTick(nReadingNextTick, this);\n      } else if (state.length) {\n        emitReadable(this, state);\n      }\n    }\n  }\n\n  return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n  debug('readable nexttick read 0');\n  self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n  var state = this._readableState;\n  if (!state.flowing) {\n    debug('resume');\n    state.flowing = true;\n    resume(this, state);\n  }\n  return this;\n};\n\nfunction resume(stream, state) {\n  if (!state.resumeScheduled) {\n    state.resumeScheduled = true;\n    processNextTick(resume_, stream, state);\n  }\n}\n\nfunction resume_(stream, state) {\n  if (!state.reading) {\n    debug('resume read 0');\n    stream.read(0);\n  }\n\n  state.resumeScheduled = false;\n  stream.emit('resume');\n  flow(stream);\n  if (state.flowing && !state.reading)\n    stream.read(0);\n}\n\nReadable.prototype.pause = function() {\n  debug('call pause flowing=%j', this._readableState.flowing);\n  if (false !== this._readableState.flowing) {\n    debug('pause');\n    this._readableState.flowing = false;\n    this.emit('pause');\n  }\n  return this;\n};\n\nfunction flow(stream) {\n  var state = stream._readableState;\n  debug('flow', state.flowing);\n  if (state.flowing) {\n    do {\n      var chunk = stream.read();\n    } while (null !== chunk && state.flowing);\n  }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n  var state = this._readableState;\n  var paused = false;\n\n  var self = this;\n  stream.on('end', function() {\n    debug('wrapped end');\n    if (state.decoder && !state.ended) {\n      var chunk = state.decoder.end();\n      if (chunk && chunk.length)\n        self.push(chunk);\n    }\n\n    self.push(null);\n  });\n\n  stream.on('data', function(chunk) {\n    debug('wrapped data');\n    if (state.decoder)\n      chunk = state.decoder.write(chunk);\n\n    // don't skip over falsy values in objectMode\n    if (state.objectMode && (chunk === null || chunk === undefined))\n      return;\n    else if (!state.objectMode && (!chunk || !chunk.length))\n      return;\n\n    var ret = self.push(chunk);\n    if (!ret) {\n      paused = true;\n      stream.pause();\n    }\n  });\n\n  // proxy all the other methods.\n  // important when wrapping filters and duplexes.\n  for (var i in stream) {\n    if (this[i] === undefined && typeof stream[i] === 'function') {\n      this[i] = function(method) { return function() {\n        return stream[method].apply(stream, arguments);\n      }; }(i);\n    }\n  }\n\n  // proxy certain important events.\n  var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n  forEach(events, function(ev) {\n    stream.on(ev, self.emit.bind(self, ev));\n  });\n\n  // when we try to consume some more bytes, simply unpause the\n  // underlying stream.\n  self._read = function(n) {\n    debug('wrapped _read', n);\n    if (paused) {\n      paused = false;\n      stream.resume();\n    }\n  };\n\n  return self;\n};\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n  var list = state.buffer;\n  var length = state.length;\n  var stringMode = !!state.decoder;\n  var objectMode = !!state.objectMode;\n  var ret;\n\n  // nothing in the list, definitely empty.\n  if (list.length === 0)\n    return null;\n\n  if (length === 0)\n    ret = null;\n  else if (objectMode)\n    ret = list.shift();\n  else if (!n || n >= length) {\n    // read it all, truncate the array.\n    if (stringMode)\n      ret = list.join('');\n    else if (list.length === 1)\n      ret = list[0];\n    else\n      ret = Buffer.concat(list, length);\n    list.length = 0;\n  } else {\n    // read just some of it.\n    if (n < list[0].length) {\n      // just take a part of the first list item.\n      // slice is the same for buffers and strings.\n      var buf = list[0];\n      ret = buf.slice(0, n);\n      list[0] = buf.slice(n);\n    } else if (n === list[0].length) {\n      // first list is a perfect match\n      ret = list.shift();\n    } else {\n      // complex case.\n      // we have enough to cover it, but it spans past the first buffer.\n      if (stringMode)\n        ret = '';\n      else\n        ret = new Buffer(n);\n\n      var c = 0;\n      for (var i = 0, l = list.length; i < l && c < n; i++) {\n        var buf = list[0];\n        var cpy = Math.min(n - c, buf.length);\n\n        if (stringMode)\n          ret += buf.slice(0, cpy);\n        else\n          buf.copy(ret, c, 0, cpy);\n\n        if (cpy < buf.length)\n          list[0] = buf.slice(cpy);\n        else\n          list.shift();\n\n        c += cpy;\n      }\n    }\n  }\n\n  return ret;\n}\n\nfunction endReadable(stream) {\n  var state = stream._readableState;\n\n  // If we get here before consuming all the bytes, then that is a\n  // bug in node.  Should never happen.\n  if (state.length > 0)\n    throw new Error('endReadable called on non-empty stream');\n\n  if (!state.endEmitted) {\n    state.ended = true;\n    processNextTick(endReadableNT, state, stream);\n  }\n}\n\nfunction endReadableNT(state, stream) {\n  // Check that we didn't get one last unshift.\n  if (!state.endEmitted && state.length === 0) {\n    state.endEmitted = true;\n    stream.readable = false;\n    stream.emit('end');\n  }\n}\n\nfunction forEach (xs, f) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    f(xs[i], i);\n  }\n}\n\nfunction indexOf (xs, x) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    if (xs[i] === x) return i;\n  }\n  return -1;\n}\n\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":13,\"_process\":11,\"buffer\":3,\"core-util-is\":18,\"events\":7,\"inherits\":8,\"isarray\":10,\"process-nextick-args\":19,\"string_decoder/\":26,\"util\":2}],16:[function(require,module,exports){\n// a transform stream is a readable/writable stream where you do\n// something with the data.  Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored.  (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation.  For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes.  When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up.  When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer.  When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks.  If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk.  However,\n// a pathological inflate type of transform can cause excessive buffering\n// here.  For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output.  In this case, you could write a very small\n// amount of input, and end up with a very large amount of output.  In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform.  A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(stream) {\n  this.afterTransform = function(er, data) {\n    return afterTransform(stream, er, data);\n  };\n\n  this.needTransform = false;\n  this.transforming = false;\n  this.writecb = null;\n  this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n  var ts = stream._transformState;\n  ts.transforming = false;\n\n  var cb = ts.writecb;\n\n  if (!cb)\n    return stream.emit('error', new Error('no writecb in Transform class'));\n\n  ts.writechunk = null;\n  ts.writecb = null;\n\n  if (data !== null && data !== undefined)\n    stream.push(data);\n\n  if (cb)\n    cb(er);\n\n  var rs = stream._readableState;\n  rs.reading = false;\n  if (rs.needReadable || rs.length < rs.highWaterMark) {\n    stream._read(rs.highWaterMark);\n  }\n}\n\n\nfunction Transform(options) {\n  if (!(this instanceof Transform))\n    return new Transform(options);\n\n  Duplex.call(this, options);\n\n  this._transformState = new TransformState(this);\n\n  // when the writable side finishes, then flush out anything remaining.\n  var stream = this;\n\n  // start out asking for a readable event once data is transformed.\n  this._readableState.needReadable = true;\n\n  // we have implemented the _read method, and done the other things\n  // that Readable wants before the first _read call, so unset the\n  // sync guard flag.\n  this._readableState.sync = false;\n\n  if (options) {\n    if (typeof options.transform === 'function')\n      this._transform = options.transform;\n\n    if (typeof options.flush === 'function')\n      this._flush = options.flush;\n  }\n\n  this.once('prefinish', function() {\n    if (typeof this._flush === 'function')\n      this._flush(function(er) {\n        done(stream, er);\n      });\n    else\n      done(stream);\n  });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n  this._transformState.needTransform = false;\n  return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side.  You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk.  If you pass\n// an error, then that'll put the hurt on the whole operation.  If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n  throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n  var ts = this._transformState;\n  ts.writecb = cb;\n  ts.writechunk = chunk;\n  ts.writeencoding = encoding;\n  if (!ts.transforming) {\n    var rs = this._readableState;\n    if (ts.needTransform ||\n        rs.needReadable ||\n        rs.length < rs.highWaterMark)\n      this._read(rs.highWaterMark);\n  }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n  var ts = this._transformState;\n\n  if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n    ts.transforming = true;\n    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n  } else {\n    // mark that we need a transform, so that any data that comes in\n    // will get processed, now that we've asked for it.\n    ts.needTransform = true;\n  }\n};\n\n\nfunction done(stream, er) {\n  if (er)\n    return stream.emit('error', er);\n\n  // if there's nothing in the write buffer, then that means\n  // that nothing more will ever be provided\n  var ws = stream._writableState;\n  var ts = stream._transformState;\n\n  if (ws.length)\n    throw new Error('calling transform done when ws.length != 0');\n\n  if (ts.transforming)\n    throw new Error('calling transform done when still transforming');\n\n  return stream.push(null);\n}\n\n},{\"./_stream_duplex\":13,\"core-util-is\":18,\"inherits\":8}],17:[function(require,module,exports){\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n\n/*<replacement>*/\nvar Buffer = require('buffer').Buffer;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n\n/*<replacement>*/\nvar internalUtil = {\n  deprecate: require('util-deprecate')\n};\n/*</replacement>*/\n\n\n\n/*<replacement>*/\nvar Stream;\n(function (){try{\n  Stream = require('st' + 'ream');\n}catch(_){}finally{\n  if (!Stream)\n    Stream = require('events').EventEmitter;\n}}())\n/*</replacement>*/\n\nvar Buffer = require('buffer').Buffer;\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WriteReq(chunk, encoding, cb) {\n  this.chunk = chunk;\n  this.encoding = encoding;\n  this.callback = cb;\n  this.next = null;\n}\n\nfunction WritableState(options, stream) {\n  var Duplex = require('./_stream_duplex');\n\n  options = options || {};\n\n  // object stream flag to indicate whether or not this stream\n  // contains buffers or objects.\n  this.objectMode = !!options.objectMode;\n\n  if (stream instanceof Duplex)\n    this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n  // the point at which write() starts returning false\n  // Note: 0 is a valid value, means that we always return false if\n  // the entire buffer is not flushed immediately on write()\n  var hwm = options.highWaterMark;\n  var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n  this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n  // cast to ints.\n  this.highWaterMark = ~~this.highWaterMark;\n\n  this.needDrain = false;\n  // at the start of calling end()\n  this.ending = false;\n  // when end() has been called, and returned\n  this.ended = false;\n  // when 'finish' is emitted\n  this.finished = false;\n\n  // should we decode strings into buffers before passing to _write?\n  // this is here so that some node-core streams can optimize string\n  // handling at a lower level.\n  var noDecode = options.decodeStrings === false;\n  this.decodeStrings = !noDecode;\n\n  // Crypto is kind of old and crusty.  Historically, its default string\n  // encoding is 'binary' so we have to make this configurable.\n  // Everything else in the universe uses 'utf8', though.\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n  // not an actual buffer we keep track of, but a measurement\n  // of how much we're waiting to get pushed to some underlying\n  // socket or file.\n  this.length = 0;\n\n  // a flag to see when we're in the middle of a write.\n  this.writing = false;\n\n  // when true all writes will be buffered until .uncork() call\n  this.corked = 0;\n\n  // a flag to be able to tell if the onwrite cb is called immediately,\n  // or on a later tick.  We set this to true at first, because any\n  // actions that shouldn't happen until \"later\" should generally also\n  // not happen before the first write call.\n  this.sync = true;\n\n  // a flag to know if we're processing previously buffered items, which\n  // may call the _write() callback in the same tick, so that we don't\n  // end up in an overlapped onwrite situation.\n  this.bufferProcessing = false;\n\n  // the callback that's passed to _write(chunk,cb)\n  this.onwrite = function(er) {\n    onwrite(stream, er);\n  };\n\n  // the callback that the user supplies to write(chunk,encoding,cb)\n  this.writecb = null;\n\n  // the amount that is being written when _write is called.\n  this.writelen = 0;\n\n  this.bufferedRequest = null;\n  this.lastBufferedRequest = null;\n\n  // number of pending user-supplied write callbacks\n  // this must be 0 before 'finish' can be emitted\n  this.pendingcb = 0;\n\n  // emit prefinish if the only thing we're waiting for is _write cbs\n  // This is relevant for synchronous Transform streams\n  this.prefinished = false;\n\n  // True if the error was already emitted and should not be thrown again\n  this.errorEmitted = false;\n}\n\nWritableState.prototype.getBuffer = function writableStateGetBuffer() {\n  var current = this.bufferedRequest;\n  var out = [];\n  while (current) {\n    out.push(current);\n    current = current.next;\n  }\n  return out;\n};\n\n(function (){try {\nObject.defineProperty(WritableState.prototype, 'buffer', {\n  get: internalUtil.deprecate(function() {\n    return this.getBuffer();\n  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' +\n     'instead.')\n});\n}catch(_){}}());\n\n\nfunction Writable(options) {\n  var Duplex = require('./_stream_duplex');\n\n  // Writable ctor is applied to Duplexes, though they're not\n  // instanceof Writable, they're instanceof Readable.\n  if (!(this instanceof Writable) && !(this instanceof Duplex))\n    return new Writable(options);\n\n  this._writableState = new WritableState(options, this);\n\n  // legacy.\n  this.writable = true;\n\n  if (options) {\n    if (typeof options.write === 'function')\n      this._write = options.write;\n\n    if (typeof options.writev === 'function')\n      this._writev = options.writev;\n  }\n\n  Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n  this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, cb) {\n  var er = new Error('write after end');\n  // TODO: defer error events consistently everywhere, not just the cb\n  stream.emit('error', er);\n  processNextTick(cb, er);\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n  var valid = true;\n\n  if (!(Buffer.isBuffer(chunk)) &&\n      typeof chunk !== 'string' &&\n      chunk !== null &&\n      chunk !== undefined &&\n      !state.objectMode) {\n    var er = new TypeError('Invalid non-string/buffer chunk');\n    stream.emit('error', er);\n    processNextTick(cb, er);\n    valid = false;\n  }\n  return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n  var state = this._writableState;\n  var ret = false;\n\n  if (typeof encoding === 'function') {\n    cb = encoding;\n    encoding = null;\n  }\n\n  if (Buffer.isBuffer(chunk))\n    encoding = 'buffer';\n  else if (!encoding)\n    encoding = state.defaultEncoding;\n\n  if (typeof cb !== 'function')\n    cb = nop;\n\n  if (state.ended)\n    writeAfterEnd(this, cb);\n  else if (validChunk(this, state, chunk, cb)) {\n    state.pendingcb++;\n    ret = writeOrBuffer(this, state, chunk, encoding, cb);\n  }\n\n  return ret;\n};\n\nWritable.prototype.cork = function() {\n  var state = this._writableState;\n\n  state.corked++;\n};\n\nWritable.prototype.uncork = function() {\n  var state = this._writableState;\n\n  if (state.corked) {\n    state.corked--;\n\n    if (!state.writing &&\n        !state.corked &&\n        !state.finished &&\n        !state.bufferProcessing &&\n        state.bufferedRequest)\n      clearBuffer(this, state);\n  }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n  // node::ParseEncoding() requires lower case.\n  if (typeof encoding === 'string')\n    encoding = encoding.toLowerCase();\n  if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',\n'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']\n.indexOf((encoding + '').toLowerCase()) > -1))\n    throw new TypeError('Unknown encoding: ' + encoding);\n  this._writableState.defaultEncoding = encoding;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n  if (!state.objectMode &&\n      state.decodeStrings !== false &&\n      typeof chunk === 'string') {\n    chunk = new Buffer(chunk, encoding);\n  }\n  return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn.  Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n  chunk = decodeChunk(state, chunk, encoding);\n\n  if (Buffer.isBuffer(chunk))\n    encoding = 'buffer';\n  var len = state.objectMode ? 1 : chunk.length;\n\n  state.length += len;\n\n  var ret = state.length < state.highWaterMark;\n  // we must ensure that previous needDrain will not be reset to false.\n  if (!ret)\n    state.needDrain = true;\n\n  if (state.writing || state.corked) {\n    var last = state.lastBufferedRequest;\n    state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);\n    if (last) {\n      last.next = state.lastBufferedRequest;\n    } else {\n      state.bufferedRequest = state.lastBufferedRequest;\n    }\n  } else {\n    doWrite(stream, state, false, len, chunk, encoding, cb);\n  }\n\n  return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n  state.writelen = len;\n  state.writecb = cb;\n  state.writing = true;\n  state.sync = true;\n  if (writev)\n    stream._writev(chunk, state.onwrite);\n  else\n    stream._write(chunk, encoding, state.onwrite);\n  state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n  --state.pendingcb;\n  if (sync)\n    processNextTick(cb, er);\n  else\n    cb(er);\n\n  stream._writableState.errorEmitted = true;\n  stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n  state.writing = false;\n  state.writecb = null;\n  state.length -= state.writelen;\n  state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n  var state = stream._writableState;\n  var sync = state.sync;\n  var cb = state.writecb;\n\n  onwriteStateUpdate(state);\n\n  if (er)\n    onwriteError(stream, state, sync, er, cb);\n  else {\n    // Check if we're actually ready to finish, but don't emit yet\n    var finished = needFinish(state);\n\n    if (!finished &&\n        !state.corked &&\n        !state.bufferProcessing &&\n        state.bufferedRequest) {\n      clearBuffer(stream, state);\n    }\n\n    if (sync) {\n      processNextTick(afterWrite, stream, state, finished, cb);\n    } else {\n      afterWrite(stream, state, finished, cb);\n    }\n  }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n  if (!finished)\n    onwriteDrain(stream, state);\n  state.pendingcb--;\n  cb();\n  finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n  if (state.length === 0 && state.needDrain) {\n    state.needDrain = false;\n    stream.emit('drain');\n  }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n  state.bufferProcessing = true;\n  var entry = state.bufferedRequest;\n\n  if (stream._writev && entry && entry.next) {\n    // Fast case, write everything using _writev()\n    var buffer = [];\n    var cbs = [];\n    while (entry) {\n      cbs.push(entry.callback);\n      buffer.push(entry);\n      entry = entry.next;\n    }\n\n    // count the one we are adding, as well.\n    // TODO(isaacs) clean this up\n    state.pendingcb++;\n    state.lastBufferedRequest = null;\n    doWrite(stream, state, true, state.length, buffer, '', function(err) {\n      for (var i = 0; i < cbs.length; i++) {\n        state.pendingcb--;\n        cbs[i](err);\n      }\n    });\n\n    // Clear buffer\n  } else {\n    // Slow case, write chunks one-by-one\n    while (entry) {\n      var chunk = entry.chunk;\n      var encoding = entry.encoding;\n      var cb = entry.callback;\n      var len = state.objectMode ? 1 : chunk.length;\n\n      doWrite(stream, state, false, len, chunk, encoding, cb);\n      entry = entry.next;\n      // if we didn't call the onwrite immediately, then\n      // it means that we need to wait until it does.\n      // also, that means that the chunk and cb are currently\n      // being processed, so move the buffer counter past them.\n      if (state.writing) {\n        break;\n      }\n    }\n\n    if (entry === null)\n      state.lastBufferedRequest = null;\n  }\n  state.bufferedRequest = entry;\n  state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n  cb(new Error('not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n  var state = this._writableState;\n\n  if (typeof chunk === 'function') {\n    cb = chunk;\n    chunk = null;\n    encoding = null;\n  } else if (typeof encoding === 'function') {\n    cb = encoding;\n    encoding = null;\n  }\n\n  if (chunk !== null && chunk !== undefined)\n    this.write(chunk, encoding);\n\n  // .end() fully uncorks\n  if (state.corked) {\n    state.corked = 1;\n    this.uncork();\n  }\n\n  // ignore unnecessary end() calls.\n  if (!state.ending && !state.finished)\n    endWritable(this, state, cb);\n};\n\n\nfunction needFinish(state) {\n  return (state.ending &&\n          state.length === 0 &&\n          state.bufferedRequest === null &&\n          !state.finished &&\n          !state.writing);\n}\n\nfunction prefinish(stream, state) {\n  if (!state.prefinished) {\n    state.prefinished = true;\n    stream.emit('prefinish');\n  }\n}\n\nfunction finishMaybe(stream, state) {\n  var need = needFinish(state);\n  if (need) {\n    if (state.pendingcb === 0) {\n      prefinish(stream, state);\n      state.finished = true;\n      stream.emit('finish');\n    } else {\n      prefinish(stream, state);\n    }\n  }\n  return need;\n}\n\nfunction endWritable(stream, state, cb) {\n  state.ending = true;\n  finishMaybe(stream, state);\n  if (cb) {\n    if (state.finished)\n      processNextTick(cb);\n    else\n      stream.once('finish', cb);\n  }\n  state.ended = true;\n}\n\n},{\"./_stream_duplex\":13,\"buffer\":3,\"core-util-is\":18,\"events\":7,\"inherits\":8,\"process-nextick-args\":19,\"util-deprecate\":20}],18:[function(require,module,exports){\n(function (Buffer){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n  if (Array.isArray) {\n    return Array.isArray(arg);\n  }\n  return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n  return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n  return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n  return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n  return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n  return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n  return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n  return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n  return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n  return arg === null ||\n         typeof arg === 'boolean' ||\n         typeof arg === 'number' ||\n         typeof arg === 'string' ||\n         typeof arg === 'symbol' ||  // ES6 symbol\n         typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n  return Object.prototype.toString.call(o);\n}\n\n}).call(this,{\"isBuffer\":require(\"../../../../insert-module-globals/node_modules/is-buffer/index.js\")})\n},{\"../../../../insert-module-globals/node_modules/is-buffer/index.js\":9}],19:[function(require,module,exports){\n(function (process){\n'use strict';\nmodule.exports = nextTick;\n\nfunction nextTick(fn) {\n  var args = new Array(arguments.length - 1);\n  var i = 0;\n  while (i < args.length) {\n    args[i++] = arguments[i];\n  }\n  process.nextTick(function afterTick() {\n    fn.apply(null, args);\n  });\n}\n\n}).call(this,require('_process'))\n},{\"_process\":11}],20:[function(require,module,exports){\n(function (global){\n\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n  if (config('noDeprecation')) {\n    return fn;\n  }\n\n  var warned = false;\n  function deprecated() {\n    if (!warned) {\n      if (config('throwDeprecation')) {\n        throw new Error(msg);\n      } else if (config('traceDeprecation')) {\n        console.trace(msg);\n      } else {\n        console.warn(msg);\n      }\n      warned = true;\n    }\n    return fn.apply(this, arguments);\n  }\n\n  return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n  // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n  try {\n    if (!global.localStorage) return false;\n  } catch (_) {\n    return false;\n  }\n  var val = global.localStorage[name];\n  if (null == val) return false;\n  return String(val).toLowerCase() === 'true';\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],21:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_passthrough.js\")\n\n},{\"./lib/_stream_passthrough.js\":14}],22:[function(require,module,exports){\nvar Stream = (function (){\n  try {\n    return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify\n  } catch(_){}\n}());\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = Stream || exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n\n},{\"./lib/_stream_duplex.js\":13,\"./lib/_stream_passthrough.js\":14,\"./lib/_stream_readable.js\":15,\"./lib/_stream_transform.js\":16,\"./lib/_stream_writable.js\":17}],23:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_transform.js\")\n\n},{\"./lib/_stream_transform.js\":16}],24:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_writable.js\")\n\n},{\"./lib/_stream_writable.js\":17}],25:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams.  Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n  EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n  var source = this;\n\n  function ondata(chunk) {\n    if (dest.writable) {\n      if (false === dest.write(chunk) && source.pause) {\n        source.pause();\n      }\n    }\n  }\n\n  source.on('data', ondata);\n\n  function ondrain() {\n    if (source.readable && source.resume) {\n      source.resume();\n    }\n  }\n\n  dest.on('drain', ondrain);\n\n  // If the 'end' option is not supplied, dest.end() will be called when\n  // source gets the 'end' or 'close' events.  Only dest.end() once.\n  if (!dest._isStdio && (!options || options.end !== false)) {\n    source.on('end', onend);\n    source.on('close', onclose);\n  }\n\n  var didOnEnd = false;\n  function onend() {\n    if (didOnEnd) return;\n    didOnEnd = true;\n\n    dest.end();\n  }\n\n\n  function onclose() {\n    if (didOnEnd) return;\n    didOnEnd = true;\n\n    if (typeof dest.destroy === 'function') dest.destroy();\n  }\n\n  // don't leave dangling pipes when there are errors.\n  function onerror(er) {\n    cleanup();\n    if (EE.listenerCount(this, 'error') === 0) {\n      throw er; // Unhandled stream error in pipe.\n    }\n  }\n\n  source.on('error', onerror);\n  dest.on('error', onerror);\n\n  // remove all the event listeners that were added.\n  function cleanup() {\n    source.removeListener('data', ondata);\n    dest.removeListener('drain', ondrain);\n\n    source.removeListener('end', onend);\n    source.removeListener('close', onclose);\n\n    source.removeListener('error', onerror);\n    dest.removeListener('error', onerror);\n\n    source.removeListener('end', cleanup);\n    source.removeListener('close', cleanup);\n\n    dest.removeListener('close', cleanup);\n  }\n\n  source.on('end', cleanup);\n  source.on('close', cleanup);\n\n  dest.on('close', cleanup);\n\n  dest.emit('pipe', source);\n\n  // Allow for unix-like usage: A.pipe(B).pipe(C)\n  return dest;\n};\n\n},{\"events\":7,\"inherits\":8,\"readable-stream/duplex.js\":12,\"readable-stream/passthrough.js\":21,\"readable-stream/readable.js\":22,\"readable-stream/transform.js\":23,\"readable-stream/writable.js\":24}],26:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar Buffer = require('buffer').Buffer;\n\nvar isBufferEncoding = Buffer.isEncoding\n  || function(encoding) {\n       switch (encoding && encoding.toLowerCase()) {\n         case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;\n         default: return false;\n       }\n     }\n\n\nfunction assertEncoding(encoding) {\n  if (encoding && !isBufferEncoding(encoding)) {\n    throw new Error('Unknown encoding: ' + encoding);\n  }\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters. CESU-8 is handled as part of the UTF-8 encoding.\n//\n// @TODO Handling all encodings inside a single object makes it very difficult\n// to reason about this code, so it should be split up in the future.\n// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code\n// points as used by CESU-8.\nvar StringDecoder = exports.StringDecoder = function(encoding) {\n  this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');\n  assertEncoding(encoding);\n  switch (this.encoding) {\n    case 'utf8':\n      // CESU-8 represents each of Surrogate Pair by 3-bytes\n      this.surrogateSize = 3;\n      break;\n    case 'ucs2':\n    case 'utf16le':\n      // UTF-16 represents each of Surrogate Pair by 2-bytes\n      this.surrogateSize = 2;\n      this.detectIncompleteChar = utf16DetectIncompleteChar;\n      break;\n    case 'base64':\n      // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\n      this.surrogateSize = 3;\n      this.detectIncompleteChar = base64DetectIncompleteChar;\n      break;\n    default:\n      this.write = passThroughWrite;\n      return;\n  }\n\n  // Enough space to store all bytes of a single character. UTF-8 needs 4\n  // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).\n  this.charBuffer = new Buffer(6);\n  // Number of bytes received for the current incomplete multi-byte character.\n  this.charReceived = 0;\n  // Number of bytes expected for the current incomplete multi-byte character.\n  this.charLength = 0;\n};\n\n\n// write decodes the given buffer and returns it as JS string that is\n// guaranteed to not contain any partial multi-byte characters. Any partial\n// character found at the end of the buffer is buffered up, and will be\n// returned when calling write again with the remaining bytes.\n//\n// Note: Converting a Buffer containing an orphan surrogate to a String\n// currently works, but converting a String to a Buffer (via `new Buffer`, or\n// Buffer#write) will replace incomplete surrogates with the unicode\n// replacement character. See https://codereview.chromium.org/121173009/ .\nStringDecoder.prototype.write = function(buffer) {\n  var charStr = '';\n  // if our last write ended with an incomplete multibyte character\n  while (this.charLength) {\n    // determine how many remaining bytes this buffer has to offer for this char\n    var available = (buffer.length >= this.charLength - this.charReceived) ?\n        this.charLength - this.charReceived :\n        buffer.length;\n\n    // add the new bytes to the char buffer\n    buffer.copy(this.charBuffer, this.charReceived, 0, available);\n    this.charReceived += available;\n\n    if (this.charReceived < this.charLength) {\n      // still not enough chars in this buffer? wait for more ...\n      return '';\n    }\n\n    // remove bytes belonging to the current character from the buffer\n    buffer = buffer.slice(available, buffer.length);\n\n    // get the character that was split\n    charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\n\n    // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n    var charCode = charStr.charCodeAt(charStr.length - 1);\n    if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n      this.charLength += this.surrogateSize;\n      charStr = '';\n      continue;\n    }\n    this.charReceived = this.charLength = 0;\n\n    // if there are no more bytes in this buffer, just emit our char\n    if (buffer.length === 0) {\n      return charStr;\n    }\n    break;\n  }\n\n  // determine and set charLength / charReceived\n  this.detectIncompleteChar(buffer);\n\n  var end = buffer.length;\n  if (this.charLength) {\n    // buffer the incomplete character bytes we got\n    buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);\n    end -= this.charReceived;\n  }\n\n  charStr += buffer.toString(this.encoding, 0, end);\n\n  var end = charStr.length - 1;\n  var charCode = charStr.charCodeAt(end);\n  // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n  if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n    var size = this.surrogateSize;\n    this.charLength += size;\n    this.charReceived += size;\n    this.charBuffer.copy(this.charBuffer, size, 0, size);\n    buffer.copy(this.charBuffer, 0, 0, size);\n    return charStr.substring(0, end);\n  }\n\n  // or just emit the charStr\n  return charStr;\n};\n\n// detectIncompleteChar determines if there is an incomplete UTF-8 character at\n// the end of the given buffer. If so, it sets this.charLength to the byte\n// length that character, and sets this.charReceived to the number of bytes\n// that are available for this character.\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\n  // determine how many bytes we have to check at the end of this buffer\n  var i = (buffer.length >= 3) ? 3 : buffer.length;\n\n  // Figure out if one of the last i bytes of our buffer announces an\n  // incomplete char.\n  for (; i > 0; i--) {\n    var c = buffer[buffer.length - i];\n\n    // See http://en.wikipedia.org/wiki/UTF-8#Description\n\n    // 110XXXXX\n    if (i == 1 && c >> 5 == 0x06) {\n      this.charLength = 2;\n      break;\n    }\n\n    // 1110XXXX\n    if (i <= 2 && c >> 4 == 0x0E) {\n      this.charLength = 3;\n      break;\n    }\n\n    // 11110XXX\n    if (i <= 3 && c >> 3 == 0x1E) {\n      this.charLength = 4;\n      break;\n    }\n  }\n  this.charReceived = i;\n};\n\nStringDecoder.prototype.end = function(buffer) {\n  var res = '';\n  if (buffer && buffer.length)\n    res = this.write(buffer);\n\n  if (this.charReceived) {\n    var cr = this.charReceived;\n    var buf = this.charBuffer;\n    var enc = this.encoding;\n    res += buf.slice(0, cr).toString(enc);\n  }\n\n  return res;\n};\n\nfunction passThroughWrite(buffer) {\n  return buffer.toString(this.encoding);\n}\n\nfunction utf16DetectIncompleteChar(buffer) {\n  this.charReceived = buffer.length % 2;\n  this.charLength = this.charReceived ? 2 : 0;\n}\n\nfunction base64DetectIncompleteChar(buffer) {\n  this.charReceived = buffer.length % 3;\n  this.charLength = this.charReceived ? 3 : 0;\n}\n\n},{\"buffer\":3}],27:[function(require,module,exports){\nvar nextTick = require('process/browser.js').nextTick;\nvar apply = Function.prototype.apply;\nvar slice = Array.prototype.slice;\nvar immediateIds = {};\nvar nextImmediateId = 0;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n  return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n  return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) { timeout.close(); };\n\nfunction Timeout(id, clearFn) {\n  this._id = id;\n  this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n  this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n  clearTimeout(item._idleTimeoutId);\n  item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n  clearTimeout(item._idleTimeoutId);\n  item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n  clearTimeout(item._idleTimeoutId);\n\n  var msecs = item._idleTimeout;\n  if (msecs >= 0) {\n    item._idleTimeoutId = setTimeout(function onTimeout() {\n      if (item._onTimeout)\n        item._onTimeout();\n    }, msecs);\n  }\n};\n\n// That's not how node.js implements it but the exposed api is the same.\nexports.setImmediate = typeof setImmediate === \"function\" ? setImmediate : function(fn) {\n  var id = nextImmediateId++;\n  var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n\n  immediateIds[id] = true;\n\n  nextTick(function onNextTick() {\n    if (immediateIds[id]) {\n      // fn.call() is faster so we optimize for the common use-case\n      // @see http://jsperf.com/call-apply-segu\n      if (args) {\n        fn.apply(null, args);\n      } else {\n        fn.call(null);\n      }\n      // Prevent ids from leaking\n      exports.clearImmediate(id);\n    }\n  });\n\n  return id;\n};\n\nexports.clearImmediate = typeof clearImmediate === \"function\" ? clearImmediate : function(id) {\n  delete immediateIds[id];\n};\n},{\"process/browser.js\":11}],28:[function(require,module,exports){\n(function (process){\n(function () {\n  // Hueristics.\n  var isNode = typeof process !== 'undefined' && process.versions && !!process.versions.node;\n  var isBrowser = typeof window !== 'undefined';\n  var isModule = typeof module !== 'undefined' && !!module.exports;\n\n  // Export.\n  var detect = (isModule ? exports : (this.detect = {}));\n  detect.isNode = isNode;\n  detect.isBrowser = isBrowser;\n  detect.isModule = isModule;\n}).call(this);\n}).call(this,require('_process'))\n},{\"_process\":11}],29:[function(require,module,exports){\n'use strict';\n\n/**\n * Analogue of Object.assign().\n * Copies properties from one or more source objects to\n * a target object. Existing keys on the target object will be overwritten.\n *\n * > Note: This differs from spec in some important ways:\n * > 1. Will throw if passed non-objects, including `undefined` or `null` values.\n * > 2. Does not support the curious Exception handling behavior, exceptions are thrown immediately.\n * > For more details, see:\n * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n *\n *\n *\n * @param  {Object} target      The target object to copy properties to.\n * @param  {Object} source, ... The source(s) to copy properties from.\n * @return {Object}             The updated target object.\n */\nmodule.exports = function fastAssign (target) {\n  var totalArgs = arguments.length,\n      source, i, totalKeys, keys, key, j;\n\n  for (i = 1; i < totalArgs; i++) {\n    source = arguments[i];\n    keys = Object.keys(source);\n    totalKeys = keys.length;\n    for (j = 0; j < totalKeys; j++) {\n      key = keys[j];\n      target[key] = source[key];\n    }\n  }\n  return target;\n};\n\n},{}],30:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n    value: true\n});\nexports.GCodeInterpreter = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _lodash = require('lodash');\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _gcodeParser = require('gcode-parser');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar noop = function noop() {};\n\nvar partitionWordsByGroup = function partitionWordsByGroup(words) {\n    var groups = [];\n\n    _lodash2.default.each(words, function (word) {\n        var letter = word[0];\n        var argument = word[1];\n\n        if (_lodash2.default.includes(['G', 'M'], letter)) {\n            groups.push([word]);\n            return;\n        }\n\n        if (_lodash2.default.size(groups) > 0) {\n            groups[groups.length - 1].push(word);\n        } else {\n            groups.push([word]);\n        }\n    });\n\n    return groups;\n};\n\nvar interpret = function interpret(self, data) {\n    var groups = partitionWordsByGroup(data.words);\n    _lodash2.default.each(groups, function (words) {\n        var word = words[0] || [];\n        var letter = word[0];\n        var arg = word[1];\n        var cmd = letter + arg;\n        var args = {};\n\n        if (_lodash2.default.includes(['G', 'M'], letter)) {\n            self.cmd = cmd;\n            args = _lodash2.default.fromPairs(words.slice(1)); // returns an object composed from arrays of property names and values\n        } else {\n                // Use the same command if the line does not start with Gxx or Mxx.\n                // For example:\n                // G0 Z0.25\n                //  X-0.5 Y0.\n                //  Z0.1\n                // G01 Z0. F5.\n                //  X0.5 Y0. I0. J-0.5\n                //  X0. Y-0.5 I-0.5 J0.\n                //  X-0.5 Y0. I0. J0.5\n                cmd = self.cmd;\n                args = _lodash2.default.fromPairs(words); // returns an object composed from arrays of property names and values.\n            }\n\n        if (typeof self.handlers[cmd] === 'function') {\n            var func = self.handlers[cmd];\n            func(args);\n        }\n\n        if (typeof self[cmd] === 'function') {\n            var func = self[cmd].bind(self);\n            func(args);\n        }\n    });\n};\n\nvar GCodeInterpreter = function () {\n    function GCodeInterpreter(options) {\n        _classCallCheck(this, GCodeInterpreter);\n\n        this.cmd = '';\n        this.handlers = {};\n\n        options = options || {};\n        options.handlers = options.handlers || {};\n\n        this.handlers = options.handlers;\n    }\n\n    _createClass(GCodeInterpreter, [{\n        key: 'loadFromStream',\n        value: function loadFromStream(stream) {\n            var _this = this;\n\n            var callback = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];\n\n            var s = (0, _gcodeParser.parseStream)(stream, callback);\n            s.on('data', function (data) {\n                interpret(_this, data);\n            });\n            return s;\n        }\n    }, {\n        key: 'loadFromFile',\n        value: function loadFromFile(file) {\n            var _this2 = this;\n\n            var callback = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];\n\n            var s = (0, _gcodeParser.parseFile)(file, callback);\n            s.on('data', function (data) {\n                interpret(_this2, data);\n            });\n            return s;\n        }\n    }, {\n        key: 'loadFromString',\n        value: function loadFromString(str) {\n            var _this3 = this;\n\n            var callback = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];\n\n            var s = (0, _gcodeParser.parseString)(str, callback);\n            s.on('data', function (data) {\n                interpret(_this3, data);\n            });\n            return s;\n        }\n    }]);\n\n    return GCodeInterpreter;\n}();\n\nexports.GCodeInterpreter = GCodeInterpreter;\n},{\"gcode-parser\":32,\"lodash\":31}],31:[function(require,module,exports){\n(function (global){\n/**\n * @license\n * lodash 4.11.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash -d -o ./foo/lodash.js`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n;(function() {\n\n  /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n  var undefined;\n\n  /** Used as the semantic version number. */\n  var VERSION = '4.11.1';\n\n  /** Used as the size to enable large array optimizations. */\n  var LARGE_ARRAY_SIZE = 200;\n\n  /** Used as the `TypeError` message for \"Functions\" methods. */\n  var FUNC_ERROR_TEXT = 'Expected a function';\n\n  /** Used to stand-in for `undefined` hash values. */\n  var HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n  /** Used as the internal argument placeholder. */\n  var PLACEHOLDER = '__lodash_placeholder__';\n\n  /** Used to compose bitmasks for wrapper metadata. */\n  var BIND_FLAG = 1,\n      BIND_KEY_FLAG = 2,\n      CURRY_BOUND_FLAG = 4,\n      CURRY_FLAG = 8,\n      CURRY_RIGHT_FLAG = 16,\n      PARTIAL_FLAG = 32,\n      PARTIAL_RIGHT_FLAG = 64,\n      ARY_FLAG = 128,\n      REARG_FLAG = 256,\n      FLIP_FLAG = 512;\n\n  /** Used to compose bitmasks for comparison styles. */\n  var UNORDERED_COMPARE_FLAG = 1,\n      PARTIAL_COMPARE_FLAG = 2;\n\n  /** Used as default options for `_.truncate`. */\n  var DEFAULT_TRUNC_LENGTH = 30,\n      DEFAULT_TRUNC_OMISSION = '...';\n\n  /** Used to detect hot functions by number of calls within a span of milliseconds. */\n  var HOT_COUNT = 150,\n      HOT_SPAN = 16;\n\n  /** Used to indicate the type of lazy iteratees. */\n  var LAZY_FILTER_FLAG = 1,\n      LAZY_MAP_FLAG = 2,\n      LAZY_WHILE_FLAG = 3;\n\n  /** Used as references for various `Number` constants. */\n  var INFINITY = 1 / 0,\n      MAX_SAFE_INTEGER = 9007199254740991,\n      MAX_INTEGER = 1.7976931348623157e+308,\n      NAN = 0 / 0;\n\n  /** Used as references for the maximum length and index of an array. */\n  var MAX_ARRAY_LENGTH = 4294967295,\n      MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n      HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n  /** `Object#toString` result references. */\n  var argsTag = '[object Arguments]',\n      arrayTag = '[object Array]',\n      boolTag = '[object Boolean]',\n      dateTag = '[object Date]',\n      errorTag = '[object Error]',\n      funcTag = '[object Function]',\n      genTag = '[object GeneratorFunction]',\n      mapTag = '[object Map]',\n      numberTag = '[object Number]',\n      objectTag = '[object Object]',\n      promiseTag = '[object Promise]',\n      regexpTag = '[object RegExp]',\n      setTag = '[object Set]',\n      stringTag = '[object String]',\n      symbolTag = '[object Symbol]',\n      weakMapTag = '[object WeakMap]',\n      weakSetTag = '[object WeakSet]';\n\n  var arrayBufferTag = '[object ArrayBuffer]',\n      dataViewTag = '[object DataView]',\n      float32Tag = '[object Float32Array]',\n      float64Tag = '[object Float64Array]',\n      int8Tag = '[object Int8Array]',\n      int16Tag = '[object Int16Array]',\n      int32Tag = '[object Int32Array]',\n      uint8Tag = '[object Uint8Array]',\n      uint8ClampedTag = '[object Uint8ClampedArray]',\n      uint16Tag = '[object Uint16Array]',\n      uint32Tag = '[object Uint32Array]';\n\n  /** Used to match empty string literals in compiled template source. */\n  var reEmptyStringLeading = /\\b__p \\+= '';/g,\n      reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n      reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n  /** Used to match HTML entities and HTML characters. */\n  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,\n      reUnescapedHtml = /[&<>\"'`]/g,\n      reHasEscapedHtml = RegExp(reEscapedHtml.source),\n      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n  /** Used to match template delimiters. */\n  var reEscape = /<%-([\\s\\S]+?)%>/g,\n      reEvaluate = /<%([\\s\\S]+?)%>/g,\n      reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n  /** Used to match property names within property paths. */\n  var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n      reIsPlainProp = /^\\w*$/,\n      rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]/g;\n\n  /**\n   * Used to match `RegExp`\n   * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).\n   */\n  var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g,\n      reHasRegExpChar = RegExp(reRegExpChar.source);\n\n  /** Used to match leading and trailing whitespace. */\n  var reTrim = /^\\s+|\\s+$/g,\n      reTrimStart = /^\\s+/,\n      reTrimEnd = /\\s+$/;\n\n  /** Used to match non-compound words composed of alphanumeric characters. */\n  var reBasicWord = /[a-zA-Z0-9]+/g;\n\n  /** Used to match backslashes in property paths. */\n  var reEscapeChar = /\\\\(\\\\)?/g;\n\n  /**\n   * Used to match\n   * [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).\n   */\n  var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n  /** Used to match `RegExp` flags from their coerced string values. */\n  var reFlags = /\\w*$/;\n\n  /** Used to detect hexadecimal string values. */\n  var reHasHexPrefix = /^0x/i;\n\n  /** Used to detect bad signed hexadecimal string values. */\n  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n  /** Used to detect binary string values. */\n  var reIsBinary = /^0b[01]+$/i;\n\n  /** Used to detect host constructors (Safari). */\n  var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n  /** Used to detect octal string values. */\n  var reIsOctal = /^0o[0-7]+$/i;\n\n  /** Used to detect unsigned integer values. */\n  var reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n  /** Used to match latin-1 supplementary letters (excluding mathematical operators). */\n  var reLatin1 = /[\\xc0-\\xd6\\xd8-\\xde\\xdf-\\xf6\\xf8-\\xff]/g;\n\n  /** Used to ensure capturing order of template delimiters. */\n  var reNoMatch = /($^)/;\n\n  /** Used to match unescaped characters in compiled string literals. */\n  var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n  /** Used to compose unicode character classes. */\n  var rsAstralRange = '\\\\ud800-\\\\udfff',\n      rsComboMarksRange = '\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe23',\n      rsComboSymbolsRange = '\\\\u20d0-\\\\u20f0',\n      rsDingbatRange = '\\\\u2700-\\\\u27bf',\n      rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n      rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n      rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n      rsQuoteRange = '\\\\u2018\\\\u2019\\\\u201c\\\\u201d',\n      rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n      rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n      rsVarRange = '\\\\ufe0e\\\\ufe0f',\n      rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;\n\n  /** Used to compose unicode capture groups. */\n  var rsApos = \"['\\u2019]\",\n      rsAstral = '[' + rsAstralRange + ']',\n      rsBreak = '[' + rsBreakRange + ']',\n      rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',\n      rsDigits = '\\\\d+',\n      rsDingbat = '[' + rsDingbatRange + ']',\n      rsLower = '[' + rsLowerRange + ']',\n      rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n      rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n      rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n      rsNonAstral = '[^' + rsAstralRange + ']',\n      rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n      rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n      rsUpper = '[' + rsUpperRange + ']',\n      rsZWJ = '\\\\u200d';\n\n  /** Used to compose unicode regexes. */\n  var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',\n      rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',\n      rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n      rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n      reOptMod = rsModifier + '?',\n      rsOptVar = '[' + rsVarRange + ']?',\n      rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n      rsSeq = rsOptVar + reOptMod + rsOptJoin,\n      rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\n      rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n  /** Used to match apostrophes. */\n  var reApos = RegExp(rsApos, 'g');\n\n  /**\n   * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n   * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n   */\n  var reComboMark = RegExp(rsCombo, 'g');\n\n  /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\n  var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n  /** Used to match complex or compound words. */\n  var reComplexWord = RegExp([\n    rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n    rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',\n    rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,\n    rsUpper + '+' + rsOptUpperContr,\n    rsDigits,\n    rsEmoji\n  ].join('|'), 'g');\n\n  /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\n  var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange  + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');\n\n  /** Used to detect strings that need a more robust regexp to match words. */\n  var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n  /** Used to assign default `context` object properties. */\n  var contextProps = [\n    'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',\n    'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',\n    'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',\n    'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',\n    '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'\n  ];\n\n  /** Used to make template sourceURLs easier to identify. */\n  var templateCounter = -1;\n\n  /** Used to identify `toStringTag` values of typed arrays. */\n  var typedArrayTags = {};\n  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n  typedArrayTags[uint32Tag] = true;\n  typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n  typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\n  typedArrayTags[errorTag] = typedArrayTags[funcTag] =\n  typedArrayTags[mapTag] = typedArrayTags[numberTag] =\n  typedArrayTags[objectTag] = typedArrayTags[regexpTag] =\n  typedArrayTags[setTag] = typedArrayTags[stringTag] =\n  typedArrayTags[weakMapTag] = false;\n\n  /** Used to identify `toStringTag` values supported by `_.clone`. */\n  var cloneableTags = {};\n  cloneableTags[argsTag] = cloneableTags[arrayTag] =\n  cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\n  cloneableTags[boolTag] = cloneableTags[dateTag] =\n  cloneableTags[float32Tag] = cloneableTags[float64Tag] =\n  cloneableTags[int8Tag] = cloneableTags[int16Tag] =\n  cloneableTags[int32Tag] = cloneableTags[mapTag] =\n  cloneableTags[numberTag] = cloneableTags[objectTag] =\n  cloneableTags[regexpTag] = cloneableTags[setTag] =\n  cloneableTags[stringTag] = cloneableTags[symbolTag] =\n  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n  cloneableTags[errorTag] = cloneableTags[funcTag] =\n  cloneableTags[weakMapTag] = false;\n\n  /** Used to map latin-1 supplementary letters to basic latin letters. */\n  var deburredLetters = {\n    '\\xc0': 'A',  '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n    '\\xe0': 'a',  '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n    '\\xc7': 'C',  '\\xe7': 'c',\n    '\\xd0': 'D',  '\\xf0': 'd',\n    '\\xc8': 'E',  '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n    '\\xe8': 'e',  '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n    '\\xcC': 'I',  '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n    '\\xeC': 'i',  '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n    '\\xd1': 'N',  '\\xf1': 'n',\n    '\\xd2': 'O',  '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n    '\\xf2': 'o',  '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n    '\\xd9': 'U',  '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n    '\\xf9': 'u',  '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n    '\\xdd': 'Y',  '\\xfd': 'y', '\\xff': 'y',\n    '\\xc6': 'Ae', '\\xe6': 'ae',\n    '\\xde': 'Th', '\\xfe': 'th',\n    '\\xdf': 'ss'\n  };\n\n  /** Used to map characters to HTML entities. */\n  var htmlEscapes = {\n    '&': '&amp;',\n    '<': '&lt;',\n    '>': '&gt;',\n    '\"': '&quot;',\n    \"'\": '&#39;',\n    '`': '&#96;'\n  };\n\n  /** Used to map HTML entities to characters. */\n  var htmlUnescapes = {\n    '&amp;': '&',\n    '&lt;': '<',\n    '&gt;': '>',\n    '&quot;': '\"',\n    '&#39;': \"'\",\n    '&#96;': '`'\n  };\n\n  /** Used to determine if values are of the language type `Object`. */\n  var objectTypes = {\n    'function': true,\n    'object': true\n  };\n\n  /** Used to escape characters for inclusion in compiled string literals. */\n  var stringEscapes = {\n    '\\\\': '\\\\',\n    \"'\": \"'\",\n    '\\n': 'n',\n    '\\r': 'r',\n    '\\u2028': 'u2028',\n    '\\u2029': 'u2029'\n  };\n\n  /** Built-in method references without a dependency on `root`. */\n  var freeParseFloat = parseFloat,\n      freeParseInt = parseInt;\n\n  /** Detect free variable `exports`. */\n  var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)\n    ? exports\n    : undefined;\n\n  /** Detect free variable `module`. */\n  var freeModule = (objectTypes[typeof module] && module && !module.nodeType)\n    ? module\n    : undefined;\n\n  /** Detect the popular CommonJS extension `module.exports`. */\n  var moduleExports = (freeModule && freeModule.exports === freeExports)\n    ? freeExports\n    : undefined;\n\n  /** Detect free variable `global` from Node.js. */\n  var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);\n\n  /** Detect free variable `self`. */\n  var freeSelf = checkGlobal(objectTypes[typeof self] && self);\n\n  /** Detect free variable `window`. */\n  var freeWindow = checkGlobal(objectTypes[typeof window] && window);\n\n  /** Detect `this` as the global object. */\n  var thisGlobal = checkGlobal(objectTypes[typeof this] && this);\n\n  /**\n   * Used as a reference to the global object.\n   *\n   * The `this` value is used if it's the global object to avoid Greasemonkey's\n   * restricted `window` object, otherwise the `window` object is used.\n   */\n  var root = freeGlobal ||\n    ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||\n      freeSelf || thisGlobal || Function('return this')();\n\n  /*--------------------------------------------------------------------------*/\n\n  /**\n   * Adds the key-value `pair` to `map`.\n   *\n   * @private\n   * @param {Object} map The map to modify.\n   * @param {Array} pair The key-value pair to add.\n   * @returns {Object} Returns `map`.\n   */\n  function addMapEntry(map, pair) {\n    // Don't return `Map#set` because it doesn't return the map instance in IE 11.\n    map.set(pair[0], pair[1]);\n    return map;\n  }\n\n  /**\n   * Adds `value` to `set`.\n   *\n   * @private\n   * @param {Object} set The set to modify.\n   * @param {*} value The value to add.\n   * @returns {Object} Returns `set`.\n   */\n  function addSetEntry(set, value) {\n    set.add(value);\n    return set;\n  }\n\n  /**\n   * A faster alternative to `Function#apply`, this function invokes `func`\n   * with the `this` binding of `thisArg` and the arguments of `args`.\n   *\n   * @private\n   * @param {Function} func The function to invoke.\n   * @param {*} thisArg The `this` binding of `func`.\n   * @param {Array} args The arguments to invoke `func` with.\n   * @returns {*} Returns the result of `func`.\n   */\n  function apply(func, thisArg, args) {\n    var length = args.length;\n    switch (length) {\n      case 0: return func.call(thisArg);\n      case 1: return func.call(thisArg, args[0]);\n      case 2: return func.call(thisArg, args[0], args[1]);\n      case 3: return func.call(thisArg, args[0], args[1], args[2]);\n    }\n    return func.apply(thisArg, args);\n  }\n\n  /**\n   * A specialized version of `baseAggregator` for arrays.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} setter The function to set `accumulator` values.\n   * @param {Function} iteratee The iteratee to transform keys.\n   * @param {Object} accumulator The initial aggregated object.\n   * @returns {Function} Returns `accumulator`.\n   */\n  function arrayAggregator(array, setter, iteratee, accumulator) {\n    var index = -1,\n        length = array.length;\n\n    while (++index < length) {\n      var value = array[index];\n      setter(accumulator, value, iteratee(value), array);\n    }\n    return accumulator;\n  }\n\n  /**\n   * Creates a new array concatenating `array` with `other`.\n   *\n   * @private\n   * @param {Array} array The first array to concatenate.\n   * @param {Array} other The second array to concatenate.\n   * @returns {Array} Returns the new concatenated array.\n   */\n  function arrayConcat(array, other) {\n    var index = -1,\n        length = array.length,\n        othIndex = -1,\n        othLength = other.length,\n        result = Array(length + othLength);\n\n    while (++index < length) {\n      result[index] = array[index];\n    }\n    while (++othIndex < othLength) {\n      result[index++] = other[othIndex];\n    }\n    return result;\n  }\n\n  /**\n   * A specialized version of `_.forEach` for arrays without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @returns {Array} Returns `array`.\n   */\n  function arrayEach(array, iteratee) {\n    var index = -1,\n        length = array.length;\n\n    while (++index < length) {\n      if (iteratee(array[index], index, array) === false) {\n        break;\n      }\n    }\n    return array;\n  }\n\n  /**\n   * A specialized version of `_.forEachRight` for arrays without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @returns {Array} Returns `array`.\n   */\n  function arrayEachRight(array, iteratee) {\n    var length = array.length;\n\n    while (length--) {\n      if (iteratee(array[length], length, array) === false) {\n        break;\n      }\n    }\n    return array;\n  }\n\n  /**\n   * A specialized version of `_.every` for arrays without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} predicate The function invoked per iteration.\n   * @returns {boolean} Returns `true` if all elements pass the predicate check,\n   *  else `false`.\n   */\n  function arrayEvery(array, predicate) {\n    var index = -1,\n        length = array.length;\n\n    while (++index < length) {\n      if (!predicate(array[index], index, array)) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  /**\n   * A specialized version of `_.filter` for arrays without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} predicate The function invoked per iteration.\n   * @returns {Array} Returns the new filtered array.\n   */\n  function arrayFilter(array, predicate) {\n    var index = -1,\n        length = array.length,\n        resIndex = 0,\n        result = [];\n\n    while (++index < length) {\n      var value = array[index];\n      if (predicate(value, index, array)) {\n        result[resIndex++] = value;\n      }\n    }\n    return result;\n  }\n\n  /**\n   * A specialized version of `_.includes` for arrays without support for\n   * specifying an index to search from.\n   *\n   * @private\n   * @param {Array} array The array to search.\n   * @param {*} target The value to search for.\n   * @returns {boolean} Returns `true` if `target` is found, else `false`.\n   */\n  function arrayIncludes(array, value) {\n    return !!array.length && baseIndexOf(array, value, 0) > -1;\n  }\n\n  /**\n   * This function is like `arrayIncludes` except that it accepts a comparator.\n   *\n   * @private\n   * @param {Array} array The array to search.\n   * @param {*} target The value to search for.\n   * @param {Function} comparator The comparator invoked per element.\n   * @returns {boolean} Returns `true` if `target` is found, else `false`.\n   */\n  function arrayIncludesWith(array, value, comparator) {\n    var index = -1,\n        length = array.length;\n\n    while (++index < length) {\n      if (comparator(value, array[index])) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * A specialized version of `_.map` for arrays without support for iteratee\n   * shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @returns {Array} Returns the new mapped array.\n   */\n  function arrayMap(array, iteratee) {\n    var index = -1,\n        length = array.length,\n        result = Array(length);\n\n    while (++index < length) {\n      result[index] = iteratee(array[index], index, array);\n    }\n    return result;\n  }\n\n  /**\n   * Appends the elements of `values` to `array`.\n   *\n   * @private\n   * @param {Array} array The array to modify.\n   * @param {Array} values The values to append.\n   * @returns {Array} Returns `array`.\n   */\n  function arrayPush(array, values) {\n    var index = -1,\n        length = values.length,\n        offset = array.length;\n\n    while (++index < length) {\n      array[offset + index] = values[index];\n    }\n    return array;\n  }\n\n  /**\n   * A specialized version of `_.reduce` for arrays without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @param {*} [accumulator] The initial value.\n   * @param {boolean} [initAccum] Specify using the first element of `array` as\n   *  the initial value.\n   * @returns {*} Returns the accumulated value.\n   */\n  function arrayReduce(array, iteratee, accumulator, initAccum) {\n    var index = -1,\n        length = array.length;\n\n    if (initAccum && length) {\n      accumulator = array[++index];\n    }\n    while (++index < length) {\n      accumulator = iteratee(accumulator, array[index], index, array);\n    }\n    return accumulator;\n  }\n\n  /**\n   * A specialized version of `_.reduceRight` for arrays without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @param {*} [accumulator] The initial value.\n   * @param {boolean} [initAccum] Specify using the last element of `array` as\n   *  the initial value.\n   * @returns {*} Returns the accumulated value.\n   */\n  function arrayReduceRight(array, iteratee, accumulator, initAccum) {\n    var length = array.length;\n    if (initAccum && length) {\n      accumulator = array[--length];\n    }\n    while (length--) {\n      accumulator = iteratee(accumulator, array[length], length, array);\n    }\n    return accumulator;\n  }\n\n  /**\n   * A specialized version of `_.some` for arrays without support for iteratee\n   * shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} predicate The function invoked per iteration.\n   * @returns {boolean} Returns `true` if any element passes the predicate check,\n   *  else `false`.\n   */\n  function arraySome(array, predicate) {\n    var index = -1,\n        length = array.length;\n\n    while (++index < length) {\n      if (predicate(array[index], index, array)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * The base implementation of methods like `_.max` and `_.min` which accepts a\n   * `comparator` to determine the extremum value.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The iteratee invoked per iteration.\n   * @param {Function} comparator The comparator used to compare values.\n   * @returns {*} Returns the extremum value.\n   */\n  function baseExtremum(array, iteratee, comparator) {\n    var index = -1,\n        length = array.length;\n\n    while (++index < length) {\n      var value = array[index],\n          current = iteratee(value);\n\n      if (current != null && (computed === undefined\n            ? current === current\n            : comparator(current, computed)\n          )) {\n        var computed = current,\n            result = value;\n      }\n    }\n    return result;\n  }\n\n  /**\n   * The base implementation of methods like `_.find` and `_.findKey`, without\n   * support for iteratee shorthands, which iterates over `collection` using\n   * `eachFunc`.\n   *\n   * @private\n   * @param {Array|Object} collection The collection to search.\n   * @param {Function} predicate The function invoked per iteration.\n   * @param {Function} eachFunc The function to iterate over `collection`.\n   * @param {boolean} [retKey] Specify returning the key of the found element\n   *  instead of the element itself.\n   * @returns {*} Returns the found element or its key, else `undefined`.\n   */\n  function baseFind(collection, predicate, eachFunc, retKey) {\n    var result;\n    eachFunc(collection, function(value, key, collection) {\n      if (predicate(value, key, collection)) {\n        result = retKey ? key : value;\n        return false;\n      }\n    });\n    return result;\n  }\n\n  /**\n   * The base implementation of `_.findIndex` and `_.findLastIndex` without\n   * support for iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to search.\n   * @param {Function} predicate The function invoked per iteration.\n   * @param {boolean} [fromRight] Specify iterating from right to left.\n   * @returns {number} Returns the index of the matched value, else `-1`.\n   */\n  function baseFindIndex(array, predicate, fromRight) {\n    var length = array.length,\n        index = fromRight ? length : -1;\n\n    while ((fromRight ? index-- : ++index < length)) {\n      if (predicate(array[index], index, array)) {\n        return index;\n      }\n    }\n    return -1;\n  }\n\n  /**\n   * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n   *\n   * @private\n   * @param {Array} array The array to search.\n   * @param {*} value The value to search for.\n   * @param {number} fromIndex The index to search from.\n   * @returns {number} Returns the index of the matched value, else `-1`.\n   */\n  function baseIndexOf(array, value, fromIndex) {\n    if (value !== value) {\n      return indexOfNaN(array, fromIndex);\n    }\n    var index = fromIndex - 1,\n        length = array.length;\n\n    while (++index < length) {\n      if (array[index] === value) {\n        return index;\n      }\n    }\n    return -1;\n  }\n\n  /**\n   * This function is like `baseIndexOf` except that it accepts a comparator.\n   *\n   * @private\n   * @param {Array} array The array to search.\n   * @param {*} value The value to search for.\n   * @param {number} fromIndex The index to search from.\n   * @param {Function} comparator The comparator invoked per element.\n   * @returns {number} Returns the index of the matched value, else `-1`.\n   */\n  function baseIndexOfWith(array, value, fromIndex, comparator) {\n    var index = fromIndex - 1,\n        length = array.length;\n\n    while (++index < length) {\n      if (comparator(array[index], value)) {\n        return index;\n      }\n    }\n    return -1;\n  }\n\n  /**\n   * The base implementation of `_.mean` and `_.meanBy` without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @returns {number} Returns the mean.\n   */\n  function baseMean(array, iteratee) {\n    var length = array ? array.length : 0;\n    return length ? (baseSum(array, iteratee) / length) : NAN;\n  }\n\n  /**\n   * The base implementation of `_.reduce` and `_.reduceRight`, without support\n   * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n   *\n   * @private\n   * @param {Array|Object} collection The collection to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @param {*} accumulator The initial value.\n   * @param {boolean} initAccum Specify using the first or last element of\n   *  `collection` as the initial value.\n   * @param {Function} eachFunc The function to iterate over `collection`.\n   * @returns {*} Returns the accumulated value.\n   */\n  function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n    eachFunc(collection, function(value, index, collection) {\n      accumulator = initAccum\n        ? (initAccum = false, value)\n        : iteratee(accumulator, value, index, collection);\n    });\n    return accumulator;\n  }\n\n  /**\n   * The base implementation of `_.sortBy` which uses `comparer` to define the\n   * sort order of `array` and replaces criteria objects with their corresponding\n   * values.\n   *\n   * @private\n   * @param {Array} array The array to sort.\n   * @param {Function} comparer The function to define sort order.\n   * @returns {Array} Returns `array`.\n   */\n  function baseSortBy(array, comparer) {\n    var length = array.length;\n\n    array.sort(comparer);\n    while (length--) {\n      array[length] = array[length].value;\n    }\n    return array;\n  }\n\n  /**\n   * The base implementation of `_.sum` and `_.sumBy` without support for\n   * iteratee shorthands.\n   *\n   * @private\n   * @param {Array} array The array to iterate over.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @returns {number} Returns the sum.\n   */\n  function baseSum(array, iteratee) {\n    var result,\n        index = -1,\n        length = array.length;\n\n    while (++index < length) {\n      var current = iteratee(array[index]);\n      if (current !== undefined) {\n        result = result === undefined ? current : (result + current);\n      }\n    }\n    return result;\n  }\n\n  /**\n   * The base implementation of `_.times` without support for iteratee shorthands\n   * or max array length checks.\n   *\n   * @private\n   * @param {number} n The number of times to invoke `iteratee`.\n   * @param {Function} iteratee The function invoked per iteration.\n   * @returns {Array} Returns the array of results.\n   */\n  function baseTimes(n, iteratee) {\n    var index = -1,\n        result = Array(n);\n\n    while (++index < n) {\n      result[index] = iteratee(index);\n    }\n    return result;\n  }\n\n  /**\n   * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array\n   * of key-value pairs for `object` corresponding to the property names of `props`.\n   *\n   * @private\n   * @param {Object} object The object to query.\n   * @param {Array} props The property names to get values for.\n   * @returns {Object} Returns the new array of key-value pairs.\n   */\n  function baseToPairs(object, props) {\n    return arrayMap(props, function(key) {\n      return [key, object[key]];\n    });\n  }\n\n  /**\n   * The base implementation of `_.unary` without support for storing wrapper metadata.\n   *\n   * @private\n   * @param {Function} func The function to cap arguments for.\n   * @returns {Function} Returns the new function.\n   */\n  function baseUnary(func) {\n    return function(value) {\n      return func(value);\n    };\n  }\n\n  /**\n   * The base implementation of `_.values` and `_.valuesIn` which creates an\n   * array of `object` property values corresponding to the property names\n   * of `props`.\n   *\n   * @private\n   * @param {Object} object The object to query.\n   * @param {Array} props The property names to get values for.\n   * @returns {Object} Returns the array of property values.\n   */\n  function baseValues(object, props) {\n    return arrayMap(props, function(key) {\n      return object[key];\n    });\n  }\n\n  /**\n   * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\n   * that is not found in the character symbols.\n   *\n   * @private\n   * @param {Array} strSymbols The string symbols to inspect.\n   * @param {Array} chrSymbols The character symbols to find.\n   * @returns {number} Returns the index of the first unmatched string symbol.\n   */\n  function charsStartIndex(strSymbols, chrSymbols) {\n    var index = -1,\n        length = strSymbols.length;\n\n    while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n    return index;\n  }\n\n  /**\n   * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\n   * that is not found in the character symbols.\n   *\n   * @private\n   * @param {Array} strSymbols The string symbols to inspect.\n   * @param {Array} chrSymbols The character symbols to find.\n   * @returns {number} Returns the index of the last unmatched string symbol.\n   */\n  function charsEndIndex(strSymbols, chrSymbols) {\n    var index = strSymbols.length;\n\n    while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n    return index;\n  }\n\n  /**\n   * Checks if `value` is a global object.\n   *\n   * @private\n   * @param {*} value The value to check.\n   * @returns {null|Object} Returns `value` if it's a global object, else `null`.\n   */\n  function checkGlobal(value) {\n    return (value && value.Object === Object) ? value : null;\n  }\n\n  /**\n   * Compares values to sort them in ascending order.\n   *\n   * @private\n   * @param {*} value The value to compare.\n   * @param {*} other The other value to compare.\n   * @returns {number} Returns the sort order indicator for `value`.\n   */\n  function compareAscending(value, other) {\n    if (value !== other) {\n      var valIsNull = value === null,\n          valIsUndef = value === undefined,\n          valIsReflexive = value === value;\n\n      var othIsNull = other === null,\n          othIsUndef = other === undefined,\n          othIsReflexive = other === other;\n\n      if ((value > other && !othIsNull) || !valIsReflexive ||\n          (valIsNull && !othIsUndef && othIsReflexive) ||\n          (valIsUndef && othIsReflexive)) {\n        return 1;\n      }\n      if ((value < other && !valIsNull) || !othIsReflexive ||\n          (othIsNull && !valIsUndef && valIsReflexive) ||\n          (othIsUndef && valIsReflexive)) {\n        return -1;\n      }\n    }\n    return 0;\n  }\n\n  /**\n   * Used by `_.orderBy` to compare multiple properties of a value to another\n   * and stable sort them.\n   *\n   * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n   * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n   * of corresponding values.\n   *\n   * @private\n   * @param {Object} object The object to compare.\n   * @param {Object} other The other object to compare.\n   * @param {boolean[]|string[]} orders The order to sort by for each property.\n   * @returns {number} Returns the sort order indicator for `object`.\n   */\n  function compareMultiple(object, other, orders) {\n    var index = -1,\n        objCriteria = object.criteria,\n        othCriteria = other.criteria,\n        length = objCriteria.length,\n        ordersLength = orders.length;\n\n    while (++index < length) {\n      var result = compareAscending(objCriteria[index], othCriteria[index]);\n      if (result) {\n        if (index >= ordersLength) {\n          return result;\n        }\n        var order = orders[index];\n        return result * (order == 'desc' ? -1 : 1);\n      }\n    }\n    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n    // that causes it, under certain circumstances, to provide the same value for\n    // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n    // for more details.\n    //\n    // This also ensures a stable sort in V8 and other engines.\n    // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n    return object.index - other.index;\n  }\n\n  /**\n   * Gets the number of `placeholder` occurrences in `array`.\n   *\n   * @private\n   * @param {Array} array The array to inspect.\n   * @param {*} placeholder The placeholder to search for.\n   * @returns {number} Returns the placeholder count.\n   */\n  function countHolders(array, placeholder) {\n    var length = array.length,\n        result = 0;\n\n    while (length--) {\n      if (array[length] === placeholder) {\n        result++;\n      }\n    }\n    return result;\n  }\n\n  /**\n   * Creates a function that performs a mathematical operation on two values.\n   *\n   * @private\n   * @param {Function} operator The function to perform the operation.\n   * @returns {Function} Returns the new mathematical operation function.\n   */\n  function createMathOperation(operator) {\n    return function(value, other) {\n      var result;\n      if (value === undefined && other === undefined) {\n        return 0;\n      }\n      if (value !== undefined) {\n        result = value;\n      }\n      if (other !== undefined) {\n        result = result === undefined ? other : operator(result, other);\n      }\n      return result;\n    };\n  }\n\n  /**\n   * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.\n   *\n   * @private\n   * @param {string} letter The matched letter to deburr.\n   * @returns {string} Returns the deburred letter.\n   */\n  function deburrLetter(letter) {\n    return deburredLetters[letter];\n  }\n\n  /**\n   * Used by `_.escape` to convert characters to HTML entities.\n   *\n   * @private\n   * @param {string} chr The matched character to escape.\n   * @returns {string} Returns the escaped character.\n   */\n  function escapeHtmlChar(chr) {\n    return htmlEscapes[chr];\n  }\n\n  /**\n   * Used by `_.template` to escape characters for inclusion in compiled string literals.\n   *\n   * @private\n   * @param {string} chr The matched character to escape.\n   * @returns {string} Returns the escaped character.\n   */\n  function escapeStringChar(chr) {\n    return '\\\\' + stringEscapes[chr];\n  }\n\n  /**\n   * Gets the index at which the first occurrence of `NaN` is found in `array`.\n   *\n   * @private\n   * @param {Array} array The array to search.\n   * @param {number} fromIndex The index to search from.\n   * @param {boolean} [fromRight] Specify iterating from right to left.\n   * @returns {number} Returns the index of the matched `NaN`, else `-1`.\n   */\n  function indexOfNaN(array, fromIndex, fromRight) {\n    var length = array.length,\n        index = fromIndex + (fromRight ? 0 : -1);\n\n    while ((fromRight ? index-- : ++index < length)) {\n      var other = array[index];\n      if (other !== other) {\n        return index;\n      }\n    }\n    return -1;\n  }\n\n  /**\n   * Checks if `value` is a host object in IE < 9.\n   *\n   * @private\n   * @param {*} value The value to check.\n   * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n   */\n  function isHostObject(value) {\n    // Many host objects are `Object` objects that can coerce to strings\n    // despite having improperly defined `toString` methods.\n    var result = false;\n    if (value != null && typeof value.toString != 'function') {\n      try {\n        result = !!(value + '');\n      } catch (e) {}\n    }\n    return result;\n  }\n\n  /**\n   * Checks if `value` is a valid array-like index.\n   *\n   * @private\n   * @param {*} value The value to check.\n   * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n   * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n   */\n  function isIndex(value, length) {\n    value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n    length = length == null ? MAX_SAFE_INTEGER : length;\n    return value > -1 && value % 1 == 0 && value < length;\n  }\n\n  /**\n   * Converts `iterator` to an array.\n   *\n   * @private\n   * @param {Object} iterator The iterator to convert.\n   * @returns {Array} Returns the converted array.\n   */\n  function iteratorToArray(iterator) {\n    var data,\n        result = [];\n\n    while (!(data = iterator.next()).done) {\n      result.push(data.value);\n    }\n    return result;\n  }\n\n  /**\n   * Converts `map` to an array.\n   *\n   * @private\n   * @param {Object} map The map to convert.\n   * @returns {Array} Returns the converted array.\n   */\n  function mapToArray(map) {\n    var index = -1,\n        result = Array(map.size);\n\n    map.forEach(function(value, key) {\n      result[++index] = [key, value];\n    });\n    return result;\n  }\n\n  /**\n   * Replaces all `placeholder` elements in `array` with an internal placeholder\n   * and returns an array of their indexes.\n   *\n   * @private\n   * @param {Array} array The array to modify.\n   * @param {*} placeholder The placeholder to replace.\n   * @returns {Array} Returns the new array of placeholder indexes.\n   */\n  function replaceHolders(array, placeholder) {\n    var index = -1,\n        length = array.length,\n        resIndex = 0,\n        result = [];\n\n    while (++index < length) {\n      var value = array[index];\n      if (value === placeholder || value === PLACEHOLDER) {\n        array[index] = PLACEHOLDER;\n        result[resIndex++] = index;\n      }\n    }\n    return result;\n  }\n\n  /**\n   * Converts `set` to an array.\n   *\n   * @private\n   * @param {Object} set The set to convert.\n   * @returns {Array} Returns the converted array.\n   */\n  function setToArray(set) {\n    var index = -1,\n        result = Array(set.size);\n\n    set.forEach(function(value) {\n      result[++index] = value;\n    });\n    return result;\n  }\n\n  /**\n   * Gets the number of symbols in `string`.\n   *\n   * @private\n   * @param {string} string The string to inspect.\n   * @returns {number} Returns the string size.\n   */\n  function stringSize(string) {\n    if (!(string && reHasComplexSymbol.test(string))) {\n      return string.length;\n    }\n    var result = reComplexSymbol.lastIndex = 0;\n    while (reComplexSymbol.test(string)) {\n      result++;\n    }\n    return result;\n  }\n\n  /**\n   * Converts `string` to an array.\n   *\n   * @private\n   * @param {string} string The string to convert.\n   * @returns {Array} Returns the converted array.\n   */\n  function stringToArray(string) {\n    return string.match(reComplexSymbol);\n  }\n\n  /**\n   * Used by `_.unescape` to convert HTML entities to characters.\n   *\n   * @private\n   * @param {string} chr The matched character to unescape.\n   * @returns {string} Returns the unescaped character.\n   */\n  function unescapeHtmlChar(chr) {\n    return htmlUnescapes[chr];\n  }\n\n  /*--------------------------------------------------------------------------*/\n\n  /**\n   * Create a new pristine `lodash` function using the `context` object.\n   *\n   * @static\n   * @memberOf _\n   * @since 1.1.0\n   * @category Util\n   * @param {Object} [context=root] The context object.\n   * @returns {Function} Returns a new `lodash` function.\n   * @example\n   *\n   * _.mixin({ 'foo': _.constant('foo') });\n   *\n   * var lodash = _.runInContext();\n   * lodash.mixin({ 'bar': lodash.constant('bar') });\n   *\n   * _.isFunction(_.foo);\n   * // => true\n   * _.isFunction(_.bar);\n   * // => false\n   *\n   * lodash.isFunction(lodash.foo);\n   * // => false\n   * lodash.isFunction(lodash.bar);\n   * // => true\n   *\n   * // Use `context` to mock `Date#getTime` use in `_.now`.\n   * var mock = _.runInContext({\n   *   'Date': function() {\n   *     return { 'getTime': getTimeMock };\n   *   }\n   * });\n   *\n   * // Create a suped-up `defer` in Node.js.\n   * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n   */\n  function runInContext(context) {\n    context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root;\n\n    /** Built-in constructor references. */\n    var Date = context.Date,\n        Error = context.Error,\n        Math = context.Math,\n        RegExp = context.RegExp,\n        TypeError = context.TypeError;\n\n    /** Used for built-in method references. */\n    var arrayProto = context.Array.prototype,\n        objectProto = context.Object.prototype,\n        stringProto = context.String.prototype;\n\n    /** Used to resolve the decompiled source of functions. */\n    var funcToString = context.Function.prototype.toString;\n\n    /** Used to check objects for own properties. */\n    var hasOwnProperty = objectProto.hasOwnProperty;\n\n    /** Used to generate unique IDs. */\n    var idCounter = 0;\n\n    /** Used to infer the `Object` constructor. */\n    var objectCtorString = funcToString.call(Object);\n\n    /**\n     * Used to resolve the\n     * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n     * of values.\n     */\n    var objectToString = objectProto.toString;\n\n    /** Used to restore the original `_` reference in `_.noConflict`. */\n    var oldDash = root._;\n\n    /** Used to detect if a method is native. */\n    var reIsNative = RegExp('^' +\n      funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n      .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n    );\n\n    /** Built-in value references. */\n    var Buffer = moduleExports ? context.Buffer : undefined,\n        Reflect = context.Reflect,\n        Symbol = context.Symbol,\n        Uint8Array = context.Uint8Array,\n        clearTimeout = context.clearTimeout,\n        enumerate = Reflect ? Reflect.enumerate : undefined,\n        getOwnPropertySymbols = Object.getOwnPropertySymbols,\n        iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,\n        objectCreate = Object.create,\n        propertyIsEnumerable = objectProto.propertyIsEnumerable,\n        setTimeout = context.setTimeout,\n        splice = arrayProto.splice;\n\n    /* Built-in method references for those with the same name as other `lodash` methods. */\n    var nativeCeil = Math.ceil,\n        nativeFloor = Math.floor,\n        nativeGetPrototype = Object.getPrototypeOf,\n        nativeIsFinite = context.isFinite,\n        nativeJoin = arrayProto.join,\n        nativeKeys = Object.keys,\n        nativeMax = Math.max,\n        nativeMin = Math.min,\n        nativeParseInt = context.parseInt,\n        nativeRandom = Math.random,\n        nativeReplace = stringProto.replace,\n        nativeReverse = arrayProto.reverse,\n        nativeSplit = stringProto.split;\n\n    /* Built-in method references that are verified to be native. */\n    var DataView = getNative(context, 'DataView'),\n        Map = getNative(context, 'Map'),\n        Promise = getNative(context, 'Promise'),\n        Set = getNative(context, 'Set'),\n        WeakMap = getNative(context, 'WeakMap'),\n        nativeCreate = getNative(Object, 'create');\n\n    /** Used to store function metadata. */\n    var metaMap = WeakMap && new WeakMap;\n\n    /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */\n    var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');\n\n    /** Used to lookup unminified function names. */\n    var realNames = {};\n\n    /** Used to detect maps, sets, and weakmaps. */\n    var dataViewCtorString = toSource(DataView),\n        mapCtorString = toSource(Map),\n        promiseCtorString = toSource(Promise),\n        setCtorString = toSource(Set),\n        weakMapCtorString = toSource(WeakMap);\n\n    /** Used to convert symbols to primitives and strings. */\n    var symbolProto = Symbol ? Symbol.prototype : undefined,\n        symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,\n        symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates a `lodash` object which wraps `value` to enable implicit method\n     * chain sequences. Methods that operate on and return arrays, collections,\n     * and functions can be chained together. Methods that retrieve a single value\n     * or may return a primitive value will automatically end the chain sequence\n     * and return the unwrapped value. Otherwise, the value must be unwrapped\n     * with `_#value`.\n     *\n     * Explicit chain sequences, which must be unwrapped with `_#value`, may be\n     * enabled using `_.chain`.\n     *\n     * The execution of chained methods is lazy, that is, it's deferred until\n     * `_#value` is implicitly or explicitly called.\n     *\n     * Lazy evaluation allows several methods to support shortcut fusion.\n     * Shortcut fusion is an optimization to merge iteratee calls; this avoids\n     * the creation of intermediate arrays and can greatly reduce the number of\n     * iteratee executions. Sections of a chain sequence qualify for shortcut\n     * fusion if the section is applied to an array of at least `200` elements\n     * and any iteratees accept only one argument. The heuristic for whether a\n     * section qualifies for shortcut fusion is subject to change.\n     *\n     * Chaining is supported in custom builds as long as the `_#value` method is\n     * directly or indirectly included in the build.\n     *\n     * In addition to lodash methods, wrappers have `Array` and `String` methods.\n     *\n     * The wrapper `Array` methods are:\n     * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`\n     *\n     * The wrapper `String` methods are:\n     * `replace` and `split`\n     *\n     * The wrapper methods that support shortcut fusion are:\n     * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,\n     * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,\n     * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`\n     *\n     * The chainable wrapper methods are:\n     * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,\n     * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,\n     * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,\n     * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,\n     * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,\n     * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,\n     * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,\n     * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,\n     * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,\n     * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,\n     * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,\n     * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,\n     * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,\n     * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,\n     * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,\n     * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,\n     * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,\n     * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,\n     * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,\n     * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,\n     * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,\n     * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,\n     * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,\n     * `zipObject`, `zipObjectDeep`, and `zipWith`\n     *\n     * The wrapper methods that are **not** chainable by default are:\n     * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,\n     * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`,\n     * `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`,\n     * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`,\n     * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,\n     * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`,\n     * `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`,\n     * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`,\n     * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,\n     * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`,\n     * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,\n     * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,\n     * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,\n     * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,\n     * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,\n     * `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`,\n     * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,\n     * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,\n     * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,\n     * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`,\n     * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`,\n     * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,\n     * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words`\n     *\n     * @name _\n     * @constructor\n     * @category Seq\n     * @param {*} value The value to wrap in a `lodash` instance.\n     * @returns {Object} Returns the new `lodash` wrapper instance.\n     * @example\n     *\n     * function square(n) {\n     *   return n * n;\n     * }\n     *\n     * var wrapped = _([1, 2, 3]);\n     *\n     * // Returns an unwrapped value.\n     * wrapped.reduce(_.add);\n     * // => 6\n     *\n     * // Returns a wrapped value.\n     * var squares = wrapped.map(square);\n     *\n     * _.isArray(squares);\n     * // => false\n     *\n     * _.isArray(squares.value());\n     * // => true\n     */\n    function lodash(value) {\n      if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n        if (value instanceof LodashWrapper) {\n          return value;\n        }\n        if (hasOwnProperty.call(value, '__wrapped__')) {\n          return wrapperClone(value);\n        }\n      }\n      return new LodashWrapper(value);\n    }\n\n    /**\n     * The function whose prototype chain sequence wrappers inherit from.\n     *\n     * @private\n     */\n    function baseLodash() {\n      // No operation performed.\n    }\n\n    /**\n     * The base constructor for creating `lodash` wrapper objects.\n     *\n     * @private\n     * @param {*} value The value to wrap.\n     * @param {boolean} [chainAll] Enable explicit method chain sequences.\n     */\n    function LodashWrapper(value, chainAll) {\n      this.__wrapped__ = value;\n      this.__actions__ = [];\n      this.__chain__ = !!chainAll;\n      this.__index__ = 0;\n      this.__values__ = undefined;\n    }\n\n    /**\n     * By default, the template delimiters used by lodash are like those in\n     * embedded Ruby (ERB). Change the following template settings to use\n     * alternative delimiters.\n     *\n     * @static\n     * @memberOf _\n     * @type {Object}\n     */\n    lodash.templateSettings = {\n\n      /**\n       * Used to detect `data` property values to be HTML-escaped.\n       *\n       * @memberOf _.templateSettings\n       * @type {RegExp}\n       */\n      'escape': reEscape,\n\n      /**\n       * Used to detect code to be evaluated.\n       *\n       * @memberOf _.templateSettings\n       * @type {RegExp}\n       */\n      'evaluate': reEvaluate,\n\n      /**\n       * Used to detect `data` property values to inject.\n       *\n       * @memberOf _.templateSettings\n       * @type {RegExp}\n       */\n      'interpolate': reInterpolate,\n\n      /**\n       * Used to reference the data object in the template text.\n       *\n       * @memberOf _.templateSettings\n       * @type {string}\n       */\n      'variable': '',\n\n      /**\n       * Used to import variables into the compiled template.\n       *\n       * @memberOf _.templateSettings\n       * @type {Object}\n       */\n      'imports': {\n\n        /**\n         * A reference to the `lodash` function.\n         *\n         * @memberOf _.templateSettings.imports\n         * @type {Function}\n         */\n        '_': lodash\n      }\n    };\n\n    // Ensure wrappers are instances of `baseLodash`.\n    lodash.prototype = baseLodash.prototype;\n    lodash.prototype.constructor = lodash;\n\n    LodashWrapper.prototype = baseCreate(baseLodash.prototype);\n    LodashWrapper.prototype.constructor = LodashWrapper;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n     *\n     * @private\n     * @constructor\n     * @param {*} value The value to wrap.\n     */\n    function LazyWrapper(value) {\n      this.__wrapped__ = value;\n      this.__actions__ = [];\n      this.__dir__ = 1;\n      this.__filtered__ = false;\n      this.__iteratees__ = [];\n      this.__takeCount__ = MAX_ARRAY_LENGTH;\n      this.__views__ = [];\n    }\n\n    /**\n     * Creates a clone of the lazy wrapper object.\n     *\n     * @private\n     * @name clone\n     * @memberOf LazyWrapper\n     * @returns {Object} Returns the cloned `LazyWrapper` object.\n     */\n    function lazyClone() {\n      var result = new LazyWrapper(this.__wrapped__);\n      result.__actions__ = copyArray(this.__actions__);\n      result.__dir__ = this.__dir__;\n      result.__filtered__ = this.__filtered__;\n      result.__iteratees__ = copyArray(this.__iteratees__);\n      result.__takeCount__ = this.__takeCount__;\n      result.__views__ = copyArray(this.__views__);\n      return result;\n    }\n\n    /**\n     * Reverses the direction of lazy iteration.\n     *\n     * @private\n     * @name reverse\n     * @memberOf LazyWrapper\n     * @returns {Object} Returns the new reversed `LazyWrapper` object.\n     */\n    function lazyReverse() {\n      if (this.__filtered__) {\n        var result = new LazyWrapper(this);\n        result.__dir__ = -1;\n        result.__filtered__ = true;\n      } else {\n        result = this.clone();\n        result.__dir__ *= -1;\n      }\n      return result;\n    }\n\n    /**\n     * Extracts the unwrapped value from its lazy wrapper.\n     *\n     * @private\n     * @name value\n     * @memberOf LazyWrapper\n     * @returns {*} Returns the unwrapped value.\n     */\n    function lazyValue() {\n      var array = this.__wrapped__.value(),\n          dir = this.__dir__,\n          isArr = isArray(array),\n          isRight = dir < 0,\n          arrLength = isArr ? array.length : 0,\n          view = getView(0, arrLength, this.__views__),\n          start = view.start,\n          end = view.end,\n          length = end - start,\n          index = isRight ? end : (start - 1),\n          iteratees = this.__iteratees__,\n          iterLength = iteratees.length,\n          resIndex = 0,\n          takeCount = nativeMin(length, this.__takeCount__);\n\n      if (!isArr || arrLength < LARGE_ARRAY_SIZE ||\n          (arrLength == length && takeCount == length)) {\n        return baseWrapperValue(array, this.__actions__);\n      }\n      var result = [];\n\n      outer:\n      while (length-- && resIndex < takeCount) {\n        index += dir;\n\n        var iterIndex = -1,\n            value = array[index];\n\n        while (++iterIndex < iterLength) {\n          var data = iteratees[iterIndex],\n              iteratee = data.iteratee,\n              type = data.type,\n              computed = iteratee(value);\n\n          if (type == LAZY_MAP_FLAG) {\n            value = computed;\n          } else if (!computed) {\n            if (type == LAZY_FILTER_FLAG) {\n              continue outer;\n            } else {\n              break outer;\n            }\n          }\n        }\n        result[resIndex++] = value;\n      }\n      return result;\n    }\n\n    // Ensure `LazyWrapper` is an instance of `baseLodash`.\n    LazyWrapper.prototype = baseCreate(baseLodash.prototype);\n    LazyWrapper.prototype.constructor = LazyWrapper;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates a hash object.\n     *\n     * @private\n     * @constructor\n     * @returns {Object} Returns the new hash object.\n     */\n    function Hash() {}\n\n    /**\n     * Removes `key` and its value from the hash.\n     *\n     * @private\n     * @param {Object} hash The hash to modify.\n     * @param {string} key The key of the value to remove.\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n     */\n    function hashDelete(hash, key) {\n      return hashHas(hash, key) && delete hash[key];\n    }\n\n    /**\n     * Gets the hash value for `key`.\n     *\n     * @private\n     * @param {Object} hash The hash to query.\n     * @param {string} key The key of the value to get.\n     * @returns {*} Returns the entry value.\n     */\n    function hashGet(hash, key) {\n      if (nativeCreate) {\n        var result = hash[key];\n        return result === HASH_UNDEFINED ? undefined : result;\n      }\n      return hasOwnProperty.call(hash, key) ? hash[key] : undefined;\n    }\n\n    /**\n     * Checks if a hash value for `key` exists.\n     *\n     * @private\n     * @param {Object} hash The hash to query.\n     * @param {string} key The key of the entry to check.\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n     */\n    function hashHas(hash, key) {\n      return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key);\n    }\n\n    /**\n     * Sets the hash `key` to `value`.\n     *\n     * @private\n     * @param {Object} hash The hash to modify.\n     * @param {string} key The key of the value to set.\n     * @param {*} value The value to set.\n     */\n    function hashSet(hash, key, value) {\n      hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n    }\n\n    // Avoid inheriting from `Object.prototype` when possible.\n    Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates a map cache object to store key-value pairs.\n     *\n     * @private\n     * @constructor\n     * @param {Array} [values] The values to cache.\n     */\n    function MapCache(values) {\n      var index = -1,\n          length = values ? values.length : 0;\n\n      this.clear();\n      while (++index < length) {\n        var entry = values[index];\n        this.set(entry[0], entry[1]);\n      }\n    }\n\n    /**\n     * Removes all key-value entries from the map.\n     *\n     * @private\n     * @name clear\n     * @memberOf MapCache\n     */\n    function mapClear() {\n      this.__data__ = {\n        'hash': new Hash,\n        'map': Map ? new Map : [],\n        'string': new Hash\n      };\n    }\n\n    /**\n     * Removes `key` and its value from the map.\n     *\n     * @private\n     * @name delete\n     * @memberOf MapCache\n     * @param {string} key The key of the value to remove.\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n     */\n    function mapDelete(key) {\n      var data = this.__data__;\n      if (isKeyable(key)) {\n        return hashDelete(typeof key == 'string' ? data.string : data.hash, key);\n      }\n      return Map ? data.map['delete'](key) : assocDelete(data.map, key);\n    }\n\n    /**\n     * Gets the map value for `key`.\n     *\n     * @private\n     * @name get\n     * @memberOf MapCache\n     * @param {string} key The key of the value to get.\n     * @returns {*} Returns the entry value.\n     */\n    function mapGet(key) {\n      var data = this.__data__;\n      if (isKeyable(key)) {\n        return hashGet(typeof key == 'string' ? data.string : data.hash, key);\n      }\n      return Map ? data.map.get(key) : assocGet(data.map, key);\n    }\n\n    /**\n     * Checks if a map value for `key` exists.\n     *\n     * @private\n     * @name has\n     * @memberOf MapCache\n     * @param {string} key The key of the entry to check.\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n     */\n    function mapHas(key) {\n      var data = this.__data__;\n      if (isKeyable(key)) {\n        return hashHas(typeof key == 'string' ? data.string : data.hash, key);\n      }\n      return Map ? data.map.has(key) : assocHas(data.map, key);\n    }\n\n    /**\n     * Sets the map `key` to `value`.\n     *\n     * @private\n     * @name set\n     * @memberOf MapCache\n     * @param {string} key The key of the value to set.\n     * @param {*} value The value to set.\n     * @returns {Object} Returns the map cache instance.\n     */\n    function mapSet(key, value) {\n      var data = this.__data__;\n      if (isKeyable(key)) {\n        hashSet(typeof key == 'string' ? data.string : data.hash, key, value);\n      } else if (Map) {\n        data.map.set(key, value);\n      } else {\n        assocSet(data.map, key, value);\n      }\n      return this;\n    }\n\n    // Add methods to `MapCache`.\n    MapCache.prototype.clear = mapClear;\n    MapCache.prototype['delete'] = mapDelete;\n    MapCache.prototype.get = mapGet;\n    MapCache.prototype.has = mapHas;\n    MapCache.prototype.set = mapSet;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     *\n     * Creates a set cache object to store unique values.\n     *\n     * @private\n     * @constructor\n     * @param {Array} [values] The values to cache.\n     */\n    function SetCache(values) {\n      var index = -1,\n          length = values ? values.length : 0;\n\n      this.__data__ = new MapCache;\n      while (++index < length) {\n        this.push(values[index]);\n      }\n    }\n\n    /**\n     * Checks if `value` is in `cache`.\n     *\n     * @private\n     * @param {Object} cache The set cache to search.\n     * @param {*} value The value to search for.\n     * @returns {number} Returns `true` if `value` is found, else `false`.\n     */\n    function cacheHas(cache, value) {\n      var map = cache.__data__;\n      if (isKeyable(value)) {\n        var data = map.__data__,\n            hash = typeof value == 'string' ? data.string : data.hash;\n\n        return hash[value] === HASH_UNDEFINED;\n      }\n      return map.has(value);\n    }\n\n    /**\n     * Adds `value` to the set cache.\n     *\n     * @private\n     * @name push\n     * @memberOf SetCache\n     * @param {*} value The value to cache.\n     */\n    function cachePush(value) {\n      var map = this.__data__;\n      if (isKeyable(value)) {\n        var data = map.__data__,\n            hash = typeof value == 'string' ? data.string : data.hash;\n\n        hash[value] = HASH_UNDEFINED;\n      }\n      else {\n        map.set(value, HASH_UNDEFINED);\n      }\n    }\n\n    // Add methods to `SetCache`.\n    SetCache.prototype.push = cachePush;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates a stack cache object to store key-value pairs.\n     *\n     * @private\n     * @constructor\n     * @param {Array} [values] The values to cache.\n     */\n    function Stack(values) {\n      var index = -1,\n          length = values ? values.length : 0;\n\n      this.clear();\n      while (++index < length) {\n        var entry = values[index];\n        this.set(entry[0], entry[1]);\n      }\n    }\n\n    /**\n     * Removes all key-value entries from the stack.\n     *\n     * @private\n     * @name clear\n     * @memberOf Stack\n     */\n    function stackClear() {\n      this.__data__ = { 'array': [], 'map': null };\n    }\n\n    /**\n     * Removes `key` and its value from the stack.\n     *\n     * @private\n     * @name delete\n     * @memberOf Stack\n     * @param {string} key The key of the value to remove.\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n     */\n    function stackDelete(key) {\n      var data = this.__data__,\n          array = data.array;\n\n      return array ? assocDelete(array, key) : data.map['delete'](key);\n    }\n\n    /**\n     * Gets the stack value for `key`.\n     *\n     * @private\n     * @name get\n     * @memberOf Stack\n     * @param {string} key The key of the value to get.\n     * @returns {*} Returns the entry value.\n     */\n    function stackGet(key) {\n      var data = this.__data__,\n          array = data.array;\n\n      return array ? assocGet(array, key) : data.map.get(key);\n    }\n\n    /**\n     * Checks if a stack value for `key` exists.\n     *\n     * @private\n     * @name has\n     * @memberOf Stack\n     * @param {string} key The key of the entry to check.\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n     */\n    function stackHas(key) {\n      var data = this.__data__,\n          array = data.array;\n\n      return array ? assocHas(array, key) : data.map.has(key);\n    }\n\n    /**\n     * Sets the stack `key` to `value`.\n     *\n     * @private\n     * @name set\n     * @memberOf Stack\n     * @param {string} key The key of the value to set.\n     * @param {*} value The value to set.\n     * @returns {Object} Returns the stack cache instance.\n     */\n    function stackSet(key, value) {\n      var data = this.__data__,\n          array = data.array;\n\n      if (array) {\n        if (array.length < (LARGE_ARRAY_SIZE - 1)) {\n          assocSet(array, key, value);\n        } else {\n          data.array = null;\n          data.map = new MapCache(array);\n        }\n      }\n      var map = data.map;\n      if (map) {\n        map.set(key, value);\n      }\n      return this;\n    }\n\n    // Add methods to `Stack`.\n    Stack.prototype.clear = stackClear;\n    Stack.prototype['delete'] = stackDelete;\n    Stack.prototype.get = stackGet;\n    Stack.prototype.has = stackHas;\n    Stack.prototype.set = stackSet;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Removes `key` and its value from the associative array.\n     *\n     * @private\n     * @param {Array} array The array to modify.\n     * @param {string} key The key of the value to remove.\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n     */\n    function assocDelete(array, key) {\n      var index = assocIndexOf(array, key);\n      if (index < 0) {\n        return false;\n      }\n      var lastIndex = array.length - 1;\n      if (index == lastIndex) {\n        array.pop();\n      } else {\n        splice.call(array, index, 1);\n      }\n      return true;\n    }\n\n    /**\n     * Gets the associative array value for `key`.\n     *\n     * @private\n     * @param {Array} array The array to query.\n     * @param {string} key The key of the value to get.\n     * @returns {*} Returns the entry value.\n     */\n    function assocGet(array, key) {\n      var index = assocIndexOf(array, key);\n      return index < 0 ? undefined : array[index][1];\n    }\n\n    /**\n     * Checks if an associative array value for `key` exists.\n     *\n     * @private\n     * @param {Array} array The array to query.\n     * @param {string} key The key of the entry to check.\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n     */\n    function assocHas(array, key) {\n      return assocIndexOf(array, key) > -1;\n    }\n\n    /**\n     * Gets the index at which the `key` is found in `array` of key-value pairs.\n     *\n     * @private\n     * @param {Array} array The array to search.\n     * @param {*} key The key to search for.\n     * @returns {number} Returns the index of the matched value, else `-1`.\n     */\n    function assocIndexOf(array, key) {\n      var length = array.length;\n      while (length--) {\n        if (eq(array[length][0], key)) {\n          return length;\n        }\n      }\n      return -1;\n    }\n\n    /**\n     * Sets the associative array `key` to `value`.\n     *\n     * @private\n     * @param {Array} array The array to modify.\n     * @param {string} key The key of the value to set.\n     * @param {*} value The value to set.\n     */\n    function assocSet(array, key, value) {\n      var index = assocIndexOf(array, key);\n      if (index < 0) {\n        array.push([key, value]);\n      } else {\n        array[index][1] = value;\n      }\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Used by `_.defaults` to customize its `_.assignIn` use.\n     *\n     * @private\n     * @param {*} objValue The destination value.\n     * @param {*} srcValue The source value.\n     * @param {string} key The key of the property to assign.\n     * @param {Object} object The parent object of `objValue`.\n     * @returns {*} Returns the value to assign.\n     */\n    function assignInDefaults(objValue, srcValue, key, object) {\n      if (objValue === undefined ||\n          (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n        return srcValue;\n      }\n      return objValue;\n    }\n\n    /**\n     * This function is like `assignValue` except that it doesn't assign\n     * `undefined` values.\n     *\n     * @private\n     * @param {Object} object The object to modify.\n     * @param {string} key The key of the property to assign.\n     * @param {*} value The value to assign.\n     */\n    function assignMergeValue(object, key, value) {\n      if ((value !== undefined && !eq(object[key], value)) ||\n          (typeof key == 'number' && value === undefined && !(key in object))) {\n        object[key] = value;\n      }\n    }\n\n    /**\n     * Assigns `value` to `key` of `object` if the existing value is not equivalent\n     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons.\n     *\n     * @private\n     * @param {Object} object The object to modify.\n     * @param {string} key The key of the property to assign.\n     * @param {*} value The value to assign.\n     */\n    function assignValue(object, key, value) {\n      var objValue = object[key];\n      if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n          (value === undefined && !(key in object))) {\n        object[key] = value;\n      }\n    }\n\n    /**\n     * Aggregates elements of `collection` on `accumulator` with keys transformed\n     * by `iteratee` and values set by `setter`.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} setter The function to set `accumulator` values.\n     * @param {Function} iteratee The iteratee to transform keys.\n     * @param {Object} accumulator The initial aggregated object.\n     * @returns {Function} Returns `accumulator`.\n     */\n    function baseAggregator(collection, setter, iteratee, accumulator) {\n      baseEach(collection, function(value, key, collection) {\n        setter(accumulator, value, iteratee(value), collection);\n      });\n      return accumulator;\n    }\n\n    /**\n     * The base implementation of `_.assign` without support for multiple sources\n     * or `customizer` functions.\n     *\n     * @private\n     * @param {Object} object The destination object.\n     * @param {Object} source The source object.\n     * @returns {Object} Returns `object`.\n     */\n    function baseAssign(object, source) {\n      return object && copyObject(source, keys(source), object);\n    }\n\n    /**\n     * The base implementation of `_.at` without support for individual paths.\n     *\n     * @private\n     * @param {Object} object The object to iterate over.\n     * @param {string[]} paths The property paths of elements to pick.\n     * @returns {Array} Returns the new array of picked elements.\n     */\n    function baseAt(object, paths) {\n      var index = -1,\n          isNil = object == null,\n          length = paths.length,\n          result = Array(length);\n\n      while (++index < length) {\n        result[index] = isNil ? undefined : get(object, paths[index]);\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.clamp` which doesn't coerce arguments to numbers.\n     *\n     * @private\n     * @param {number} number The number to clamp.\n     * @param {number} [lower] The lower bound.\n     * @param {number} upper The upper bound.\n     * @returns {number} Returns the clamped number.\n     */\n    function baseClamp(number, lower, upper) {\n      if (number === number) {\n        if (upper !== undefined) {\n          number = number <= upper ? number : upper;\n        }\n        if (lower !== undefined) {\n          number = number >= lower ? number : lower;\n        }\n      }\n      return number;\n    }\n\n    /**\n     * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n     * traversed objects.\n     *\n     * @private\n     * @param {*} value The value to clone.\n     * @param {boolean} [isDeep] Specify a deep clone.\n     * @param {boolean} [isFull] Specify a clone including symbols.\n     * @param {Function} [customizer] The function to customize cloning.\n     * @param {string} [key] The key of `value`.\n     * @param {Object} [object] The parent object of `value`.\n     * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n     * @returns {*} Returns the cloned value.\n     */\n    function baseClone(value, isDeep, isFull, customizer, key, object, stack) {\n      var result;\n      if (customizer) {\n        result = object ? customizer(value, key, object, stack) : customizer(value);\n      }\n      if (result !== undefined) {\n        return result;\n      }\n      if (!isObject(value)) {\n        return value;\n      }\n      var isArr = isArray(value);\n      if (isArr) {\n        result = initCloneArray(value);\n        if (!isDeep) {\n          return copyArray(value, result);\n        }\n      } else {\n        var tag = getTag(value),\n            isFunc = tag == funcTag || tag == genTag;\n\n        if (isBuffer(value)) {\n          return cloneBuffer(value, isDeep);\n        }\n        if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n          if (isHostObject(value)) {\n            return object ? value : {};\n          }\n          result = initCloneObject(isFunc ? {} : value);\n          if (!isDeep) {\n            return copySymbols(value, baseAssign(result, value));\n          }\n        } else {\n          if (!cloneableTags[tag]) {\n            return object ? value : {};\n          }\n          result = initCloneByTag(value, tag, baseClone, isDeep);\n        }\n      }\n      // Check for circular references and return its corresponding clone.\n      stack || (stack = new Stack);\n      var stacked = stack.get(value);\n      if (stacked) {\n        return stacked;\n      }\n      stack.set(value, result);\n\n      if (!isArr) {\n        var props = isFull ? getAllKeys(value) : keys(value);\n      }\n      // Recursively populate clone (susceptible to call stack limits).\n      arrayEach(props || value, function(subValue, key) {\n        if (props) {\n          key = subValue;\n          subValue = value[key];\n        }\n        assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));\n      });\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.conforms` which doesn't clone `source`.\n     *\n     * @private\n     * @param {Object} source The object of property predicates to conform to.\n     * @returns {Function} Returns the new function.\n     */\n    function baseConforms(source) {\n      var props = keys(source),\n          length = props.length;\n\n      return function(object) {\n        if (object == null) {\n          return !length;\n        }\n        var index = length;\n        while (index--) {\n          var key = props[index],\n              predicate = source[key],\n              value = object[key];\n\n          if ((value === undefined &&\n              !(key in Object(object))) || !predicate(value)) {\n            return false;\n          }\n        }\n        return true;\n      };\n    }\n\n    /**\n     * The base implementation of `_.create` without support for assigning\n     * properties to the created object.\n     *\n     * @private\n     * @param {Object} prototype The object to inherit from.\n     * @returns {Object} Returns the new object.\n     */\n    function baseCreate(proto) {\n      return isObject(proto) ? objectCreate(proto) : {};\n    }\n\n    /**\n     * The base implementation of `_.delay` and `_.defer` which accepts an array\n     * of `func` arguments.\n     *\n     * @private\n     * @param {Function} func The function to delay.\n     * @param {number} wait The number of milliseconds to delay invocation.\n     * @param {Object} args The arguments to provide to `func`.\n     * @returns {number} Returns the timer id.\n     */\n    function baseDelay(func, wait, args) {\n      if (typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      return setTimeout(function() { func.apply(undefined, args); }, wait);\n    }\n\n    /**\n     * The base implementation of methods like `_.difference` without support\n     * for excluding multiple arrays or iteratee shorthands.\n     *\n     * @private\n     * @param {Array} array The array to inspect.\n     * @param {Array} values The values to exclude.\n     * @param {Function} [iteratee] The iteratee invoked per element.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new array of filtered values.\n     */\n    function baseDifference(array, values, iteratee, comparator) {\n      var index = -1,\n          includes = arrayIncludes,\n          isCommon = true,\n          length = array.length,\n          result = [],\n          valuesLength = values.length;\n\n      if (!length) {\n        return result;\n      }\n      if (iteratee) {\n        values = arrayMap(values, baseUnary(iteratee));\n      }\n      if (comparator) {\n        includes = arrayIncludesWith;\n        isCommon = false;\n      }\n      else if (values.length >= LARGE_ARRAY_SIZE) {\n        includes = cacheHas;\n        isCommon = false;\n        values = new SetCache(values);\n      }\n      outer:\n      while (++index < length) {\n        var value = array[index],\n            computed = iteratee ? iteratee(value) : value;\n\n        if (isCommon && computed === computed) {\n          var valuesIndex = valuesLength;\n          while (valuesIndex--) {\n            if (values[valuesIndex] === computed) {\n              continue outer;\n            }\n          }\n          result.push(value);\n        }\n        else if (!includes(values, computed, comparator)) {\n          result.push(value);\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.forEach` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} iteratee The function invoked per iteration.\n     * @returns {Array|Object} Returns `collection`.\n     */\n    var baseEach = createBaseEach(baseForOwn);\n\n    /**\n     * The base implementation of `_.forEachRight` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} iteratee The function invoked per iteration.\n     * @returns {Array|Object} Returns `collection`.\n     */\n    var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n    /**\n     * The base implementation of `_.every` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} predicate The function invoked per iteration.\n     * @returns {boolean} Returns `true` if all elements pass the predicate check,\n     *  else `false`\n     */\n    function baseEvery(collection, predicate) {\n      var result = true;\n      baseEach(collection, function(value, index, collection) {\n        result = !!predicate(value, index, collection);\n        return result;\n      });\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.fill` without an iteratee call guard.\n     *\n     * @private\n     * @param {Array} array The array to fill.\n     * @param {*} value The value to fill `array` with.\n     * @param {number} [start=0] The start position.\n     * @param {number} [end=array.length] The end position.\n     * @returns {Array} Returns `array`.\n     */\n    function baseFill(array, value, start, end) {\n      var length = array.length;\n\n      start = toInteger(start);\n      if (start < 0) {\n        start = -start > length ? 0 : (length + start);\n      }\n      end = (end === undefined || end > length) ? length : toInteger(end);\n      if (end < 0) {\n        end += length;\n      }\n      end = start > end ? 0 : toLength(end);\n      while (start < end) {\n        array[start++] = value;\n      }\n      return array;\n    }\n\n    /**\n     * The base implementation of `_.filter` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} predicate The function invoked per iteration.\n     * @returns {Array} Returns the new filtered array.\n     */\n    function baseFilter(collection, predicate) {\n      var result = [];\n      baseEach(collection, function(value, index, collection) {\n        if (predicate(value, index, collection)) {\n          result.push(value);\n        }\n      });\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.flatten` with support for restricting flattening.\n     *\n     * @private\n     * @param {Array} array The array to flatten.\n     * @param {number} depth The maximum recursion depth.\n     * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n     * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n     * @param {Array} [result=[]] The initial result value.\n     * @returns {Array} Returns the new flattened array.\n     */\n    function baseFlatten(array, depth, predicate, isStrict, result) {\n      var index = -1,\n          length = array.length;\n\n      predicate || (predicate = isFlattenable);\n      result || (result = []);\n\n      while (++index < length) {\n        var value = array[index];\n        if (depth > 0 && predicate(value)) {\n          if (depth > 1) {\n            // Recursively flatten arrays (susceptible to call stack limits).\n            baseFlatten(value, depth - 1, predicate, isStrict, result);\n          } else {\n            arrayPush(result, value);\n          }\n        } else if (!isStrict) {\n          result[result.length] = value;\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `baseForOwn` which iterates over `object`\n     * properties returned by `keysFunc` and invokes `iteratee` for each property.\n     * Iteratee functions may exit iteration early by explicitly returning `false`.\n     *\n     * @private\n     * @param {Object} object The object to iterate over.\n     * @param {Function} iteratee The function invoked per iteration.\n     * @param {Function} keysFunc The function to get the keys of `object`.\n     * @returns {Object} Returns `object`.\n     */\n    var baseFor = createBaseFor();\n\n    /**\n     * This function is like `baseFor` except that it iterates over properties\n     * in the opposite order.\n     *\n     * @private\n     * @param {Object} object The object to iterate over.\n     * @param {Function} iteratee The function invoked per iteration.\n     * @param {Function} keysFunc The function to get the keys of `object`.\n     * @returns {Object} Returns `object`.\n     */\n    var baseForRight = createBaseFor(true);\n\n    /**\n     * The base implementation of `_.forOwn` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Object} object The object to iterate over.\n     * @param {Function} iteratee The function invoked per iteration.\n     * @returns {Object} Returns `object`.\n     */\n    function baseForOwn(object, iteratee) {\n      return object && baseFor(object, iteratee, keys);\n    }\n\n    /**\n     * The base implementation of `_.forOwnRight` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Object} object The object to iterate over.\n     * @param {Function} iteratee The function invoked per iteration.\n     * @returns {Object} Returns `object`.\n     */\n    function baseForOwnRight(object, iteratee) {\n      return object && baseForRight(object, iteratee, keys);\n    }\n\n    /**\n     * The base implementation of `_.functions` which creates an array of\n     * `object` function property names filtered from `props`.\n     *\n     * @private\n     * @param {Object} object The object to inspect.\n     * @param {Array} props The property names to filter.\n     * @returns {Array} Returns the new array of filtered property names.\n     */\n    function baseFunctions(object, props) {\n      return arrayFilter(props, function(key) {\n        return isFunction(object[key]);\n      });\n    }\n\n    /**\n     * The base implementation of `_.get` without support for default values.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path of the property to get.\n     * @returns {*} Returns the resolved value.\n     */\n    function baseGet(object, path) {\n      path = isKey(path, object) ? [path] : castPath(path);\n\n      var index = 0,\n          length = path.length;\n\n      while (object != null && index < length) {\n        object = object[path[index++]];\n      }\n      return (index && index == length) ? object : undefined;\n    }\n\n    /**\n     * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n     * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n     * symbols of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Function} keysFunc The function to get the keys of `object`.\n     * @param {Function} symbolsFunc The function to get the symbols of `object`.\n     * @returns {Array} Returns the array of property names and symbols.\n     */\n    function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n      var result = keysFunc(object);\n      return isArray(object)\n        ? result\n        : arrayPush(result, symbolsFunc(object));\n    }\n\n    /**\n     * The base implementation of `_.has` without support for deep paths.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array|string} key The key to check.\n     * @returns {boolean} Returns `true` if `key` exists, else `false`.\n     */\n    function baseHas(object, key) {\n      // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n      // that are composed entirely of index properties, return `false` for\n      // `hasOwnProperty` checks of them.\n      return hasOwnProperty.call(object, key) ||\n        (typeof object == 'object' && key in object && getPrototype(object) === null);\n    }\n\n    /**\n     * The base implementation of `_.hasIn` without support for deep paths.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array|string} key The key to check.\n     * @returns {boolean} Returns `true` if `key` exists, else `false`.\n     */\n    function baseHasIn(object, key) {\n      return key in Object(object);\n    }\n\n    /**\n     * The base implementation of `_.inRange` which doesn't coerce arguments to numbers.\n     *\n     * @private\n     * @param {number} number The number to check.\n     * @param {number} start The start of the range.\n     * @param {number} end The end of the range.\n     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n     */\n    function baseInRange(number, start, end) {\n      return number >= nativeMin(start, end) && number < nativeMax(start, end);\n    }\n\n    /**\n     * The base implementation of methods like `_.intersection`, without support\n     * for iteratee shorthands, that accepts an array of arrays to inspect.\n     *\n     * @private\n     * @param {Array} arrays The arrays to inspect.\n     * @param {Function} [iteratee] The iteratee invoked per element.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new array of shared values.\n     */\n    function baseIntersection(arrays, iteratee, comparator) {\n      var includes = comparator ? arrayIncludesWith : arrayIncludes,\n          length = arrays[0].length,\n          othLength = arrays.length,\n          othIndex = othLength,\n          caches = Array(othLength),\n          maxLength = Infinity,\n          result = [];\n\n      while (othIndex--) {\n        var array = arrays[othIndex];\n        if (othIndex && iteratee) {\n          array = arrayMap(array, baseUnary(iteratee));\n        }\n        maxLength = nativeMin(array.length, maxLength);\n        caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))\n          ? new SetCache(othIndex && array)\n          : undefined;\n      }\n      array = arrays[0];\n\n      var index = -1,\n          seen = caches[0];\n\n      outer:\n      while (++index < length && result.length < maxLength) {\n        var value = array[index],\n            computed = iteratee ? iteratee(value) : value;\n\n        if (!(seen\n              ? cacheHas(seen, computed)\n              : includes(result, computed, comparator)\n            )) {\n          othIndex = othLength;\n          while (--othIndex) {\n            var cache = caches[othIndex];\n            if (!(cache\n                  ? cacheHas(cache, computed)\n                  : includes(arrays[othIndex], computed, comparator))\n                ) {\n              continue outer;\n            }\n          }\n          if (seen) {\n            seen.push(computed);\n          }\n          result.push(value);\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.invert` and `_.invertBy` which inverts\n     * `object` with values transformed by `iteratee` and set by `setter`.\n     *\n     * @private\n     * @param {Object} object The object to iterate over.\n     * @param {Function} setter The function to set `accumulator` values.\n     * @param {Function} iteratee The iteratee to transform values.\n     * @param {Object} accumulator The initial inverted object.\n     * @returns {Function} Returns `accumulator`.\n     */\n    function baseInverter(object, setter, iteratee, accumulator) {\n      baseForOwn(object, function(value, key, object) {\n        setter(accumulator, iteratee(value), key, object);\n      });\n      return accumulator;\n    }\n\n    /**\n     * The base implementation of `_.invoke` without support for individual\n     * method arguments.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path of the method to invoke.\n     * @param {Array} args The arguments to invoke the method with.\n     * @returns {*} Returns the result of the invoked method.\n     */\n    function baseInvoke(object, path, args) {\n      if (!isKey(path, object)) {\n        path = castPath(path);\n        object = parent(object, path);\n        path = last(path);\n      }\n      var func = object == null ? object : object[path];\n      return func == null ? undefined : apply(func, object, args);\n    }\n\n    /**\n     * The base implementation of `_.isEqual` which supports partial comparisons\n     * and tracks traversed objects.\n     *\n     * @private\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @param {Function} [customizer] The function to customize comparisons.\n     * @param {boolean} [bitmask] The bitmask of comparison flags.\n     *  The bitmask may be composed of the following flags:\n     *     1 - Unordered comparison\n     *     2 - Partial comparison\n     * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n     */\n    function baseIsEqual(value, other, customizer, bitmask, stack) {\n      if (value === other) {\n        return true;\n      }\n      if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\n        return value !== value && other !== other;\n      }\n      return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);\n    }\n\n    /**\n     * A specialized version of `baseIsEqual` for arrays and objects which performs\n     * deep comparisons and tracks traversed objects enabling objects with circular\n     * references to be compared.\n     *\n     * @private\n     * @param {Object} object The object to compare.\n     * @param {Object} other The other object to compare.\n     * @param {Function} equalFunc The function to determine equivalents of values.\n     * @param {Function} [customizer] The function to customize comparisons.\n     * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`\n     *  for more details.\n     * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n     */\n    function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {\n      var objIsArr = isArray(object),\n          othIsArr = isArray(other),\n          objTag = arrayTag,\n          othTag = arrayTag;\n\n      if (!objIsArr) {\n        objTag = getTag(object);\n        objTag = objTag == argsTag ? objectTag : objTag;\n      }\n      if (!othIsArr) {\n        othTag = getTag(other);\n        othTag = othTag == argsTag ? objectTag : othTag;\n      }\n      var objIsObj = objTag == objectTag && !isHostObject(object),\n          othIsObj = othTag == objectTag && !isHostObject(other),\n          isSameTag = objTag == othTag;\n\n      if (isSameTag && !objIsObj) {\n        stack || (stack = new Stack);\n        return (objIsArr || isTypedArray(object))\n          ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)\n          : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);\n      }\n      if (!(bitmask & PARTIAL_COMPARE_FLAG)) {\n        var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n            othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n        if (objIsWrapped || othIsWrapped) {\n          var objUnwrapped = objIsWrapped ? object.value() : object,\n              othUnwrapped = othIsWrapped ? other.value() : other;\n\n          stack || (stack = new Stack);\n          return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);\n        }\n      }\n      if (!isSameTag) {\n        return false;\n      }\n      stack || (stack = new Stack);\n      return equalObjects(object, other, equalFunc, customizer, bitmask, stack);\n    }\n\n    /**\n     * The base implementation of `_.isMatch` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Object} object The object to inspect.\n     * @param {Object} source The object of property values to match.\n     * @param {Array} matchData The property names, values, and compare flags to match.\n     * @param {Function} [customizer] The function to customize comparisons.\n     * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n     */\n    function baseIsMatch(object, source, matchData, customizer) {\n      var index = matchData.length,\n          length = index,\n          noCustomizer = !customizer;\n\n      if (object == null) {\n        return !length;\n      }\n      object = Object(object);\n      while (index--) {\n        var data = matchData[index];\n        if ((noCustomizer && data[2])\n              ? data[1] !== object[data[0]]\n              : !(data[0] in object)\n            ) {\n          return false;\n        }\n      }\n      while (++index < length) {\n        data = matchData[index];\n        var key = data[0],\n            objValue = object[key],\n            srcValue = data[1];\n\n        if (noCustomizer && data[2]) {\n          if (objValue === undefined && !(key in object)) {\n            return false;\n          }\n        } else {\n          var stack = new Stack;\n          if (customizer) {\n            var result = customizer(objValue, srcValue, key, object, source, stack);\n          }\n          if (!(result === undefined\n                ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)\n                : result\n              )) {\n            return false;\n          }\n        }\n      }\n      return true;\n    }\n\n    /**\n     * The base implementation of `_.iteratee`.\n     *\n     * @private\n     * @param {*} [value=_.identity] The value to convert to an iteratee.\n     * @returns {Function} Returns the iteratee.\n     */\n    function baseIteratee(value) {\n      // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n      // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n      if (typeof value == 'function') {\n        return value;\n      }\n      if (value == null) {\n        return identity;\n      }\n      if (typeof value == 'object') {\n        return isArray(value)\n          ? baseMatchesProperty(value[0], value[1])\n          : baseMatches(value);\n      }\n      return property(value);\n    }\n\n    /**\n     * The base implementation of `_.keys` which doesn't skip the constructor\n     * property of prototypes or treat sparse arrays as dense.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property names.\n     */\n    function baseKeys(object) {\n      return nativeKeys(Object(object));\n    }\n\n    /**\n     * The base implementation of `_.keysIn` which doesn't skip the constructor\n     * property of prototypes or treat sparse arrays as dense.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property names.\n     */\n    function baseKeysIn(object) {\n      object = object == null ? object : Object(object);\n\n      var result = [];\n      for (var key in object) {\n        result.push(key);\n      }\n      return result;\n    }\n\n    // Fallback for IE < 9 with es6-shim.\n    if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) {\n      baseKeysIn = function(object) {\n        return iteratorToArray(enumerate(object));\n      };\n    }\n\n    /**\n     * The base implementation of `_.map` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} iteratee The function invoked per iteration.\n     * @returns {Array} Returns the new mapped array.\n     */\n    function baseMap(collection, iteratee) {\n      var index = -1,\n          result = isArrayLike(collection) ? Array(collection.length) : [];\n\n      baseEach(collection, function(value, key, collection) {\n        result[++index] = iteratee(value, key, collection);\n      });\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.matches` which doesn't clone `source`.\n     *\n     * @private\n     * @param {Object} source The object of property values to match.\n     * @returns {Function} Returns the new function.\n     */\n    function baseMatches(source) {\n      var matchData = getMatchData(source);\n      if (matchData.length == 1 && matchData[0][2]) {\n        return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n      }\n      return function(object) {\n        return object === source || baseIsMatch(object, source, matchData);\n      };\n    }\n\n    /**\n     * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n     *\n     * @private\n     * @param {string} path The path of the property to get.\n     * @param {*} srcValue The value to match.\n     * @returns {Function} Returns the new function.\n     */\n    function baseMatchesProperty(path, srcValue) {\n      if (isKey(path) && isStrictComparable(srcValue)) {\n        return matchesStrictComparable(path, srcValue);\n      }\n      return function(object) {\n        var objValue = get(object, path);\n        return (objValue === undefined && objValue === srcValue)\n          ? hasIn(object, path)\n          : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);\n      };\n    }\n\n    /**\n     * The base implementation of `_.merge` without support for multiple sources.\n     *\n     * @private\n     * @param {Object} object The destination object.\n     * @param {Object} source The source object.\n     * @param {number} srcIndex The index of `source`.\n     * @param {Function} [customizer] The function to customize merged values.\n     * @param {Object} [stack] Tracks traversed source values and their merged\n     *  counterparts.\n     */\n    function baseMerge(object, source, srcIndex, customizer, stack) {\n      if (object === source) {\n        return;\n      }\n      if (!(isArray(source) || isTypedArray(source))) {\n        var props = keysIn(source);\n      }\n      arrayEach(props || source, function(srcValue, key) {\n        if (props) {\n          key = srcValue;\n          srcValue = source[key];\n        }\n        if (isObject(srcValue)) {\n          stack || (stack = new Stack);\n          baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n        }\n        else {\n          var newValue = customizer\n            ? customizer(object[key], srcValue, (key + ''), object, source, stack)\n            : undefined;\n\n          if (newValue === undefined) {\n            newValue = srcValue;\n          }\n          assignMergeValue(object, key, newValue);\n        }\n      });\n    }\n\n    /**\n     * A specialized version of `baseMerge` for arrays and objects which performs\n     * deep merges and tracks traversed objects enabling objects with circular\n     * references to be merged.\n     *\n     * @private\n     * @param {Object} object The destination object.\n     * @param {Object} source The source object.\n     * @param {string} key The key of the value to merge.\n     * @param {number} srcIndex The index of `source`.\n     * @param {Function} mergeFunc The function to merge values.\n     * @param {Function} [customizer] The function to customize assigned values.\n     * @param {Object} [stack] Tracks traversed source values and their merged\n     *  counterparts.\n     */\n    function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n      var objValue = object[key],\n          srcValue = source[key],\n          stacked = stack.get(srcValue);\n\n      if (stacked) {\n        assignMergeValue(object, key, stacked);\n        return;\n      }\n      var newValue = customizer\n        ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n        : undefined;\n\n      var isCommon = newValue === undefined;\n\n      if (isCommon) {\n        newValue = srcValue;\n        if (isArray(srcValue) || isTypedArray(srcValue)) {\n          if (isArray(objValue)) {\n            newValue = objValue;\n          }\n          else if (isArrayLikeObject(objValue)) {\n            newValue = copyArray(objValue);\n          }\n          else {\n            isCommon = false;\n            newValue = baseClone(srcValue, true);\n          }\n        }\n        else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n          if (isArguments(objValue)) {\n            newValue = toPlainObject(objValue);\n          }\n          else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {\n            isCommon = false;\n            newValue = baseClone(srcValue, true);\n          }\n          else {\n            newValue = objValue;\n          }\n        }\n        else {\n          isCommon = false;\n        }\n      }\n      stack.set(srcValue, newValue);\n\n      if (isCommon) {\n        // Recursively merge objects and arrays (susceptible to call stack limits).\n        mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n      }\n      stack['delete'](srcValue);\n      assignMergeValue(object, key, newValue);\n    }\n\n    /**\n     * The base implementation of `_.nth` which doesn't coerce `n` to an integer.\n     *\n     * @private\n     * @param {Array} array The array to query.\n     * @param {number} n The index of the element to return.\n     * @returns {*} Returns the nth element of `array`.\n     */\n    function baseNth(array, n) {\n      var length = array.length;\n      if (!length) {\n        return;\n      }\n      n += n < 0 ? length : 0;\n      return isIndex(n, length) ? array[n] : undefined;\n    }\n\n    /**\n     * The base implementation of `_.orderBy` without param guards.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n     * @param {string[]} orders The sort orders of `iteratees`.\n     * @returns {Array} Returns the new sorted array.\n     */\n    function baseOrderBy(collection, iteratees, orders) {\n      var index = -1;\n      iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));\n\n      var result = baseMap(collection, function(value, key, collection) {\n        var criteria = arrayMap(iteratees, function(iteratee) {\n          return iteratee(value);\n        });\n        return { 'criteria': criteria, 'index': ++index, 'value': value };\n      });\n\n      return baseSortBy(result, function(object, other) {\n        return compareMultiple(object, other, orders);\n      });\n    }\n\n    /**\n     * The base implementation of `_.pick` without support for individual\n     * property identifiers.\n     *\n     * @private\n     * @param {Object} object The source object.\n     * @param {string[]} props The property identifiers to pick.\n     * @returns {Object} Returns the new object.\n     */\n    function basePick(object, props) {\n      object = Object(object);\n      return arrayReduce(props, function(result, key) {\n        if (key in object) {\n          result[key] = object[key];\n        }\n        return result;\n      }, {});\n    }\n\n    /**\n     * The base implementation of  `_.pickBy` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Object} object The source object.\n     * @param {Function} predicate The function invoked per property.\n     * @returns {Object} Returns the new object.\n     */\n    function basePickBy(object, predicate) {\n      var index = -1,\n          props = getAllKeysIn(object),\n          length = props.length,\n          result = {};\n\n      while (++index < length) {\n        var key = props[index],\n            value = object[key];\n\n        if (predicate(value, key)) {\n          result[key] = value;\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.property` without support for deep paths.\n     *\n     * @private\n     * @param {string} key The key of the property to get.\n     * @returns {Function} Returns the new function.\n     */\n    function baseProperty(key) {\n      return function(object) {\n        return object == null ? undefined : object[key];\n      };\n    }\n\n    /**\n     * A specialized version of `baseProperty` which supports deep paths.\n     *\n     * @private\n     * @param {Array|string} path The path of the property to get.\n     * @returns {Function} Returns the new function.\n     */\n    function basePropertyDeep(path) {\n      return function(object) {\n        return baseGet(object, path);\n      };\n    }\n\n    /**\n     * The base implementation of `_.pullAllBy` without support for iteratee\n     * shorthands.\n     *\n     * @private\n     * @param {Array} array The array to modify.\n     * @param {Array} values The values to remove.\n     * @param {Function} [iteratee] The iteratee invoked per element.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns `array`.\n     */\n    function basePullAll(array, values, iteratee, comparator) {\n      var indexOf = comparator ? baseIndexOfWith : baseIndexOf,\n          index = -1,\n          length = values.length,\n          seen = array;\n\n      if (iteratee) {\n        seen = arrayMap(array, baseUnary(iteratee));\n      }\n      while (++index < length) {\n        var fromIndex = 0,\n            value = values[index],\n            computed = iteratee ? iteratee(value) : value;\n\n        while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {\n          if (seen !== array) {\n            splice.call(seen, fromIndex, 1);\n          }\n          splice.call(array, fromIndex, 1);\n        }\n      }\n      return array;\n    }\n\n    /**\n     * The base implementation of `_.pullAt` without support for individual\n     * indexes or capturing the removed elements.\n     *\n     * @private\n     * @param {Array} array The array to modify.\n     * @param {number[]} indexes The indexes of elements to remove.\n     * @returns {Array} Returns `array`.\n     */\n    function basePullAt(array, indexes) {\n      var length = array ? indexes.length : 0,\n          lastIndex = length - 1;\n\n      while (length--) {\n        var index = indexes[length];\n        if (lastIndex == length || index != previous) {\n          var previous = index;\n          if (isIndex(index)) {\n            splice.call(array, index, 1);\n          }\n          else if (!isKey(index, array)) {\n            var path = castPath(index),\n                object = parent(array, path);\n\n            if (object != null) {\n              delete object[last(path)];\n            }\n          }\n          else {\n            delete array[index];\n          }\n        }\n      }\n      return array;\n    }\n\n    /**\n     * The base implementation of `_.random` without support for returning\n     * floating-point numbers.\n     *\n     * @private\n     * @param {number} lower The lower bound.\n     * @param {number} upper The upper bound.\n     * @returns {number} Returns the random number.\n     */\n    function baseRandom(lower, upper) {\n      return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n    }\n\n    /**\n     * The base implementation of `_.range` and `_.rangeRight` which doesn't\n     * coerce arguments to numbers.\n     *\n     * @private\n     * @param {number} start The start of the range.\n     * @param {number} end The end of the range.\n     * @param {number} step The value to increment or decrement by.\n     * @param {boolean} [fromRight] Specify iterating from right to left.\n     * @returns {Array} Returns the new array of numbers.\n     */\n    function baseRange(start, end, step, fromRight) {\n      var index = -1,\n          length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n          result = Array(length);\n\n      while (length--) {\n        result[fromRight ? length : ++index] = start;\n        start += step;\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.repeat` which doesn't coerce arguments.\n     *\n     * @private\n     * @param {string} string The string to repeat.\n     * @param {number} n The number of times to repeat the string.\n     * @returns {string} Returns the repeated string.\n     */\n    function baseRepeat(string, n) {\n      var result = '';\n      if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n        return result;\n      }\n      // Leverage the exponentiation by squaring algorithm for a faster repeat.\n      // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n      do {\n        if (n % 2) {\n          result += string;\n        }\n        n = nativeFloor(n / 2);\n        if (n) {\n          string += string;\n        }\n      } while (n);\n\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.set`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path of the property to set.\n     * @param {*} value The value to set.\n     * @param {Function} [customizer] The function to customize path creation.\n     * @returns {Object} Returns `object`.\n     */\n    function baseSet(object, path, value, customizer) {\n      path = isKey(path, object) ? [path] : castPath(path);\n\n      var index = -1,\n          length = path.length,\n          lastIndex = length - 1,\n          nested = object;\n\n      while (nested != null && ++index < length) {\n        var key = path[index];\n        if (isObject(nested)) {\n          var newValue = value;\n          if (index != lastIndex) {\n            var objValue = nested[key];\n            newValue = customizer ? customizer(objValue, key, nested) : undefined;\n            if (newValue === undefined) {\n              newValue = objValue == null\n                ? (isIndex(path[index + 1]) ? [] : {})\n                : objValue;\n            }\n          }\n          assignValue(nested, key, newValue);\n        }\n        nested = nested[key];\n      }\n      return object;\n    }\n\n    /**\n     * The base implementation of `setData` without support for hot loop detection.\n     *\n     * @private\n     * @param {Function} func The function to associate metadata with.\n     * @param {*} data The metadata.\n     * @returns {Function} Returns `func`.\n     */\n    var baseSetData = !metaMap ? identity : function(func, data) {\n      metaMap.set(func, data);\n      return func;\n    };\n\n    /**\n     * The base implementation of `_.slice` without an iteratee call guard.\n     *\n     * @private\n     * @param {Array} array The array to slice.\n     * @param {number} [start=0] The start position.\n     * @param {number} [end=array.length] The end position.\n     * @returns {Array} Returns the slice of `array`.\n     */\n    function baseSlice(array, start, end) {\n      var index = -1,\n          length = array.length;\n\n      if (start < 0) {\n        start = -start > length ? 0 : (length + start);\n      }\n      end = end > length ? length : end;\n      if (end < 0) {\n        end += length;\n      }\n      length = start > end ? 0 : ((end - start) >>> 0);\n      start >>>= 0;\n\n      var result = Array(length);\n      while (++index < length) {\n        result[index] = array[index + start];\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.some` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} predicate The function invoked per iteration.\n     * @returns {boolean} Returns `true` if any element passes the predicate check,\n     *  else `false`.\n     */\n    function baseSome(collection, predicate) {\n      var result;\n\n      baseEach(collection, function(value, index, collection) {\n        result = predicate(value, index, collection);\n        return !result;\n      });\n      return !!result;\n    }\n\n    /**\n     * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which\n     * performs a binary search of `array` to determine the index at which `value`\n     * should be inserted into `array` in order to maintain its sort order.\n     *\n     * @private\n     * @param {Array} array The sorted array to inspect.\n     * @param {*} value The value to evaluate.\n     * @param {boolean} [retHighest] Specify returning the highest qualified index.\n     * @returns {number} Returns the index at which `value` should be inserted\n     *  into `array`.\n     */\n    function baseSortedIndex(array, value, retHighest) {\n      var low = 0,\n          high = array ? array.length : low;\n\n      if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n        while (low < high) {\n          var mid = (low + high) >>> 1,\n              computed = array[mid];\n\n          if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {\n            low = mid + 1;\n          } else {\n            high = mid;\n          }\n        }\n        return high;\n      }\n      return baseSortedIndexBy(array, value, identity, retHighest);\n    }\n\n    /**\n     * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`\n     * which invokes `iteratee` for `value` and each element of `array` to compute\n     * their sort ranking. The iteratee is invoked with one argument; (value).\n     *\n     * @private\n     * @param {Array} array The sorted array to inspect.\n     * @param {*} value The value to evaluate.\n     * @param {Function} iteratee The iteratee invoked per element.\n     * @param {boolean} [retHighest] Specify returning the highest qualified index.\n     * @returns {number} Returns the index at which `value` should be inserted\n     *  into `array`.\n     */\n    function baseSortedIndexBy(array, value, iteratee, retHighest) {\n      value = iteratee(value);\n\n      var low = 0,\n          high = array ? array.length : 0,\n          valIsNaN = value !== value,\n          valIsNull = value === null,\n          valIsUndef = value === undefined;\n\n      while (low < high) {\n        var mid = nativeFloor((low + high) / 2),\n            computed = iteratee(array[mid]),\n            isDef = computed !== undefined,\n            isReflexive = computed === computed;\n\n        if (valIsNaN) {\n          var setLow = isReflexive || retHighest;\n        } else if (valIsNull) {\n          setLow = isReflexive && isDef && (retHighest || computed != null);\n        } else if (valIsUndef) {\n          setLow = isReflexive && (retHighest || isDef);\n        } else if (computed == null) {\n          setLow = false;\n        } else {\n          setLow = retHighest ? (computed <= value) : (computed < value);\n        }\n        if (setLow) {\n          low = mid + 1;\n        } else {\n          high = mid;\n        }\n      }\n      return nativeMin(high, MAX_ARRAY_INDEX);\n    }\n\n    /**\n     * The base implementation of `_.sortedUniq`.\n     *\n     * @private\n     * @param {Array} array The array to inspect.\n     * @returns {Array} Returns the new duplicate free array.\n     */\n    function baseSortedUniq(array) {\n      return baseSortedUniqBy(array);\n    }\n\n    /**\n     * The base implementation of `_.sortedUniqBy` without support for iteratee\n     * shorthands.\n     *\n     * @private\n     * @param {Array} array The array to inspect.\n     * @param {Function} [iteratee] The iteratee invoked per element.\n     * @returns {Array} Returns the new duplicate free array.\n     */\n    function baseSortedUniqBy(array, iteratee) {\n      var index = 0,\n          length = array.length,\n          value = array[0],\n          computed = iteratee ? iteratee(value) : value,\n          seen = computed,\n          resIndex = 1,\n          result = [value];\n\n      while (++index < length) {\n        value = array[index],\n        computed = iteratee ? iteratee(value) : value;\n\n        if (!eq(computed, seen)) {\n          seen = computed;\n          result[resIndex++] = value;\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array} array The array to inspect.\n     * @param {Function} [iteratee] The iteratee invoked per element.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new duplicate free array.\n     */\n    function baseUniq(array, iteratee, comparator) {\n      var index = -1,\n          includes = arrayIncludes,\n          length = array.length,\n          isCommon = true,\n          result = [],\n          seen = result;\n\n      if (comparator) {\n        isCommon = false;\n        includes = arrayIncludesWith;\n      }\n      else if (length >= LARGE_ARRAY_SIZE) {\n        var set = iteratee ? null : createSet(array);\n        if (set) {\n          return setToArray(set);\n        }\n        isCommon = false;\n        includes = cacheHas;\n        seen = new SetCache;\n      }\n      else {\n        seen = iteratee ? [] : result;\n      }\n      outer:\n      while (++index < length) {\n        var value = array[index],\n            computed = iteratee ? iteratee(value) : value;\n\n        if (isCommon && computed === computed) {\n          var seenIndex = seen.length;\n          while (seenIndex--) {\n            if (seen[seenIndex] === computed) {\n              continue outer;\n            }\n          }\n          if (iteratee) {\n            seen.push(computed);\n          }\n          result.push(value);\n        }\n        else if (!includes(seen, computed, comparator)) {\n          if (seen !== result) {\n            seen.push(computed);\n          }\n          result.push(value);\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.unset`.\n     *\n     * @private\n     * @param {Object} object The object to modify.\n     * @param {Array|string} path The path of the property to unset.\n     * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n     */\n    function baseUnset(object, path) {\n      path = isKey(path, object) ? [path] : castPath(path);\n      object = parent(object, path);\n      var key = last(path);\n      return (object != null && has(object, key)) ? delete object[key] : true;\n    }\n\n    /**\n     * The base implementation of `_.update`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path of the property to update.\n     * @param {Function} updater The function to produce the updated value.\n     * @param {Function} [customizer] The function to customize path creation.\n     * @returns {Object} Returns `object`.\n     */\n    function baseUpdate(object, path, updater, customizer) {\n      return baseSet(object, path, updater(baseGet(object, path)), customizer);\n    }\n\n    /**\n     * The base implementation of methods like `_.dropWhile` and `_.takeWhile`\n     * without support for iteratee shorthands.\n     *\n     * @private\n     * @param {Array} array The array to query.\n     * @param {Function} predicate The function invoked per iteration.\n     * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n     * @param {boolean} [fromRight] Specify iterating from right to left.\n     * @returns {Array} Returns the slice of `array`.\n     */\n    function baseWhile(array, predicate, isDrop, fromRight) {\n      var length = array.length,\n          index = fromRight ? length : -1;\n\n      while ((fromRight ? index-- : ++index < length) &&\n        predicate(array[index], index, array)) {}\n\n      return isDrop\n        ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n        : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n    }\n\n    /**\n     * The base implementation of `wrapperValue` which returns the result of\n     * performing a sequence of actions on the unwrapped `value`, where each\n     * successive action is supplied the return value of the previous.\n     *\n     * @private\n     * @param {*} value The unwrapped value.\n     * @param {Array} actions Actions to perform to resolve the unwrapped value.\n     * @returns {*} Returns the resolved value.\n     */\n    function baseWrapperValue(value, actions) {\n      var result = value;\n      if (result instanceof LazyWrapper) {\n        result = result.value();\n      }\n      return arrayReduce(actions, function(result, action) {\n        return action.func.apply(action.thisArg, arrayPush([result], action.args));\n      }, result);\n    }\n\n    /**\n     * The base implementation of methods like `_.xor`, without support for\n     * iteratee shorthands, that accepts an array of arrays to inspect.\n     *\n     * @private\n     * @param {Array} arrays The arrays to inspect.\n     * @param {Function} [iteratee] The iteratee invoked per element.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new array of values.\n     */\n    function baseXor(arrays, iteratee, comparator) {\n      var index = -1,\n          length = arrays.length;\n\n      while (++index < length) {\n        var result = result\n          ? arrayPush(\n              baseDifference(result, arrays[index], iteratee, comparator),\n              baseDifference(arrays[index], result, iteratee, comparator)\n            )\n          : arrays[index];\n      }\n      return (result && result.length) ? baseUniq(result, iteratee, comparator) : [];\n    }\n\n    /**\n     * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n     *\n     * @private\n     * @param {Array} props The property identifiers.\n     * @param {Array} values The property values.\n     * @param {Function} assignFunc The function to assign values.\n     * @returns {Object} Returns the new object.\n     */\n    function baseZipObject(props, values, assignFunc) {\n      var index = -1,\n          length = props.length,\n          valsLength = values.length,\n          result = {};\n\n      while (++index < length) {\n        var value = index < valsLength ? values[index] : undefined;\n        assignFunc(result, props[index], value);\n      }\n      return result;\n    }\n\n    /**\n     * Casts `value` to an empty array if it's not an array like object.\n     *\n     * @private\n     * @param {*} value The value to inspect.\n     * @returns {Array|Object} Returns the cast array-like object.\n     */\n    function castArrayLikeObject(value) {\n      return isArrayLikeObject(value) ? value : [];\n    }\n\n    /**\n     * Casts `value` to `identity` if it's not a function.\n     *\n     * @private\n     * @param {*} value The value to inspect.\n     * @returns {Function} Returns cast function.\n     */\n    function castFunction(value) {\n      return typeof value == 'function' ? value : identity;\n    }\n\n    /**\n     * Casts `value` to a path array if it's not one.\n     *\n     * @private\n     * @param {*} value The value to inspect.\n     * @returns {Array} Returns the cast property path array.\n     */\n    function castPath(value) {\n      return isArray(value) ? value : stringToPath(value);\n    }\n\n    /**\n     * Casts `array` to a slice if it's needed.\n     *\n     * @private\n     * @param {Array} array The array to inspect.\n     * @param {number} start The start position.\n     * @param {number} [end=array.length] The end position.\n     * @returns {Array} Returns the cast slice.\n     */\n    function castSlice(array, start, end) {\n      var length = array.length;\n      end = end === undefined ? length : end;\n      return (!start && end >= length) ? array : baseSlice(array, start, end);\n    }\n\n    /**\n     * Creates a clone of  `buffer`.\n     *\n     * @private\n     * @param {Buffer} buffer The buffer to clone.\n     * @param {boolean} [isDeep] Specify a deep clone.\n     * @returns {Buffer} Returns the cloned buffer.\n     */\n    function cloneBuffer(buffer, isDeep) {\n      if (isDeep) {\n        return buffer.slice();\n      }\n      var result = new buffer.constructor(buffer.length);\n      buffer.copy(result);\n      return result;\n    }\n\n    /**\n     * Creates a clone of `arrayBuffer`.\n     *\n     * @private\n     * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n     * @returns {ArrayBuffer} Returns the cloned array buffer.\n     */\n    function cloneArrayBuffer(arrayBuffer) {\n      var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n      new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n      return result;\n    }\n\n    /**\n     * Creates a clone of `dataView`.\n     *\n     * @private\n     * @param {Object} dataView The data view to clone.\n     * @param {boolean} [isDeep] Specify a deep clone.\n     * @returns {Object} Returns the cloned data view.\n     */\n    function cloneDataView(dataView, isDeep) {\n      var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n      return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n    }\n\n    /**\n     * Creates a clone of `map`.\n     *\n     * @private\n     * @param {Object} map The map to clone.\n     * @param {Function} cloneFunc The function to clone values.\n     * @param {boolean} [isDeep] Specify a deep clone.\n     * @returns {Object} Returns the cloned map.\n     */\n    function cloneMap(map, isDeep, cloneFunc) {\n      var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);\n      return arrayReduce(array, addMapEntry, new map.constructor);\n    }\n\n    /**\n     * Creates a clone of `regexp`.\n     *\n     * @private\n     * @param {Object} regexp The regexp to clone.\n     * @returns {Object} Returns the cloned regexp.\n     */\n    function cloneRegExp(regexp) {\n      var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n      result.lastIndex = regexp.lastIndex;\n      return result;\n    }\n\n    /**\n     * Creates a clone of `set`.\n     *\n     * @private\n     * @param {Object} set The set to clone.\n     * @param {Function} cloneFunc The function to clone values.\n     * @param {boolean} [isDeep] Specify a deep clone.\n     * @returns {Object} Returns the cloned set.\n     */\n    function cloneSet(set, isDeep, cloneFunc) {\n      var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);\n      return arrayReduce(array, addSetEntry, new set.constructor);\n    }\n\n    /**\n     * Creates a clone of the `symbol` object.\n     *\n     * @private\n     * @param {Object} symbol The symbol object to clone.\n     * @returns {Object} Returns the cloned symbol object.\n     */\n    function cloneSymbol(symbol) {\n      return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n    }\n\n    /**\n     * Creates a clone of `typedArray`.\n     *\n     * @private\n     * @param {Object} typedArray The typed array to clone.\n     * @param {boolean} [isDeep] Specify a deep clone.\n     * @returns {Object} Returns the cloned typed array.\n     */\n    function cloneTypedArray(typedArray, isDeep) {\n      var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n      return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n    }\n\n    /**\n     * Creates an array that is the composition of partially applied arguments,\n     * placeholders, and provided arguments into a single array of arguments.\n     *\n     * @private\n     * @param {Array|Object} args The provided arguments.\n     * @param {Array} partials The arguments to prepend to those provided.\n     * @param {Array} holders The `partials` placeholder indexes.\n     * @params {boolean} [isCurried] Specify composing for a curried function.\n     * @returns {Array} Returns the new array of composed arguments.\n     */\n    function composeArgs(args, partials, holders, isCurried) {\n      var argsIndex = -1,\n          argsLength = args.length,\n          holdersLength = holders.length,\n          leftIndex = -1,\n          leftLength = partials.length,\n          rangeLength = nativeMax(argsLength - holdersLength, 0),\n          result = Array(leftLength + rangeLength),\n          isUncurried = !isCurried;\n\n      while (++leftIndex < leftLength) {\n        result[leftIndex] = partials[leftIndex];\n      }\n      while (++argsIndex < holdersLength) {\n        if (isUncurried || argsIndex < argsLength) {\n          result[holders[argsIndex]] = args[argsIndex];\n        }\n      }\n      while (rangeLength--) {\n        result[leftIndex++] = args[argsIndex++];\n      }\n      return result;\n    }\n\n    /**\n     * This function is like `composeArgs` except that the arguments composition\n     * is tailored for `_.partialRight`.\n     *\n     * @private\n     * @param {Array|Object} args The provided arguments.\n     * @param {Array} partials The arguments to append to those provided.\n     * @param {Array} holders The `partials` placeholder indexes.\n     * @params {boolean} [isCurried] Specify composing for a curried function.\n     * @returns {Array} Returns the new array of composed arguments.\n     */\n    function composeArgsRight(args, partials, holders, isCurried) {\n      var argsIndex = -1,\n          argsLength = args.length,\n          holdersIndex = -1,\n          holdersLength = holders.length,\n          rightIndex = -1,\n          rightLength = partials.length,\n          rangeLength = nativeMax(argsLength - holdersLength, 0),\n          result = Array(rangeLength + rightLength),\n          isUncurried = !isCurried;\n\n      while (++argsIndex < rangeLength) {\n        result[argsIndex] = args[argsIndex];\n      }\n      var offset = argsIndex;\n      while (++rightIndex < rightLength) {\n        result[offset + rightIndex] = partials[rightIndex];\n      }\n      while (++holdersIndex < holdersLength) {\n        if (isUncurried || argsIndex < argsLength) {\n          result[offset + holders[holdersIndex]] = args[argsIndex++];\n        }\n      }\n      return result;\n    }\n\n    /**\n     * Copies the values of `source` to `array`.\n     *\n     * @private\n     * @param {Array} source The array to copy values from.\n     * @param {Array} [array=[]] The array to copy values to.\n     * @returns {Array} Returns `array`.\n     */\n    function copyArray(source, array) {\n      var index = -1,\n          length = source.length;\n\n      array || (array = Array(length));\n      while (++index < length) {\n        array[index] = source[index];\n      }\n      return array;\n    }\n\n    /**\n     * Copies properties of `source` to `object`.\n     *\n     * @private\n     * @param {Object} source The object to copy properties from.\n     * @param {Array} props The property identifiers to copy.\n     * @param {Object} [object={}] The object to copy properties to.\n     * @param {Function} [customizer] The function to customize copied values.\n     * @returns {Object} Returns `object`.\n     */\n    function copyObject(source, props, object, customizer) {\n      object || (object = {});\n\n      var index = -1,\n          length = props.length;\n\n      while (++index < length) {\n        var key = props[index];\n\n        var newValue = customizer\n          ? customizer(object[key], source[key], key, object, source)\n          : source[key];\n\n        assignValue(object, key, newValue);\n      }\n      return object;\n    }\n\n    /**\n     * Copies own symbol properties of `source` to `object`.\n     *\n     * @private\n     * @param {Object} source The object to copy symbols from.\n     * @param {Object} [object={}] The object to copy symbols to.\n     * @returns {Object} Returns `object`.\n     */\n    function copySymbols(source, object) {\n      return copyObject(source, getSymbols(source), object);\n    }\n\n    /**\n     * Creates a function like `_.groupBy`.\n     *\n     * @private\n     * @param {Function} setter The function to set accumulator values.\n     * @param {Function} [initializer] The accumulator object initializer.\n     * @returns {Function} Returns the new aggregator function.\n     */\n    function createAggregator(setter, initializer) {\n      return function(collection, iteratee) {\n        var func = isArray(collection) ? arrayAggregator : baseAggregator,\n            accumulator = initializer ? initializer() : {};\n\n        return func(collection, setter, getIteratee(iteratee), accumulator);\n      };\n    }\n\n    /**\n     * Creates a function like `_.assign`.\n     *\n     * @private\n     * @param {Function} assigner The function to assign values.\n     * @returns {Function} Returns the new assigner function.\n     */\n    function createAssigner(assigner) {\n      return rest(function(object, sources) {\n        var index = -1,\n            length = sources.length,\n            customizer = length > 1 ? sources[length - 1] : undefined,\n            guard = length > 2 ? sources[2] : undefined;\n\n        customizer = typeof customizer == 'function'\n          ? (length--, customizer)\n          : undefined;\n\n        if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n          customizer = length < 3 ? undefined : customizer;\n          length = 1;\n        }\n        object = Object(object);\n        while (++index < length) {\n          var source = sources[index];\n          if (source) {\n            assigner(object, source, index, customizer);\n          }\n        }\n        return object;\n      });\n    }\n\n    /**\n     * Creates a `baseEach` or `baseEachRight` function.\n     *\n     * @private\n     * @param {Function} eachFunc The function to iterate over a collection.\n     * @param {boolean} [fromRight] Specify iterating from right to left.\n     * @returns {Function} Returns the new base function.\n     */\n    function createBaseEach(eachFunc, fromRight) {\n      return function(collection, iteratee) {\n        if (collection == null) {\n          return collection;\n        }\n        if (!isArrayLike(collection)) {\n          return eachFunc(collection, iteratee);\n        }\n        var length = collection.length,\n            index = fromRight ? length : -1,\n            iterable = Object(collection);\n\n        while ((fromRight ? index-- : ++index < length)) {\n          if (iteratee(iterable[index], index, iterable) === false) {\n            break;\n          }\n        }\n        return collection;\n      };\n    }\n\n    /**\n     * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n     *\n     * @private\n     * @param {boolean} [fromRight] Specify iterating from right to left.\n     * @returns {Function} Returns the new base function.\n     */\n    function createBaseFor(fromRight) {\n      return function(object, iteratee, keysFunc) {\n        var index = -1,\n            iterable = Object(object),\n            props = keysFunc(object),\n            length = props.length;\n\n        while (length--) {\n          var key = props[fromRight ? length : ++index];\n          if (iteratee(iterable[key], key, iterable) === false) {\n            break;\n          }\n        }\n        return object;\n      };\n    }\n\n    /**\n     * Creates a function that wraps `func` to invoke it with the optional `this`\n     * binding of `thisArg`.\n     *\n     * @private\n     * @param {Function} func The function to wrap.\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\n     *  for more details.\n     * @param {*} [thisArg] The `this` binding of `func`.\n     * @returns {Function} Returns the new wrapped function.\n     */\n    function createBaseWrapper(func, bitmask, thisArg) {\n      var isBind = bitmask & BIND_FLAG,\n          Ctor = createCtorWrapper(func);\n\n      function wrapper() {\n        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n        return fn.apply(isBind ? thisArg : this, arguments);\n      }\n      return wrapper;\n    }\n\n    /**\n     * Creates a function like `_.lowerFirst`.\n     *\n     * @private\n     * @param {string} methodName The name of the `String` case method to use.\n     * @returns {Function} Returns the new function.\n     */\n    function createCaseFirst(methodName) {\n      return function(string) {\n        string = toString(string);\n\n        var strSymbols = reHasComplexSymbol.test(string)\n          ? stringToArray(string)\n          : undefined;\n\n        var chr = strSymbols\n          ? strSymbols[0]\n          : string.charAt(0);\n\n        var trailing = strSymbols\n          ? castSlice(strSymbols, 1).join('')\n          : string.slice(1);\n\n        return chr[methodName]() + trailing;\n      };\n    }\n\n    /**\n     * Creates a function like `_.camelCase`.\n     *\n     * @private\n     * @param {Function} callback The function to combine each word.\n     * @returns {Function} Returns the new compounder function.\n     */\n    function createCompounder(callback) {\n      return function(string) {\n        return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n      };\n    }\n\n    /**\n     * Creates a function that produces an instance of `Ctor` regardless of\n     * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n     *\n     * @private\n     * @param {Function} Ctor The constructor to wrap.\n     * @returns {Function} Returns the new wrapped function.\n     */\n    function createCtorWrapper(Ctor) {\n      return function() {\n        // Use a `switch` statement to work with class constructors. See\n        // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n        // for more details.\n        var args = arguments;\n        switch (args.length) {\n          case 0: return new Ctor;\n          case 1: return new Ctor(args[0]);\n          case 2: return new Ctor(args[0], args[1]);\n          case 3: return new Ctor(args[0], args[1], args[2]);\n          case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n          case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n          case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n          case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n        }\n        var thisBinding = baseCreate(Ctor.prototype),\n            result = Ctor.apply(thisBinding, args);\n\n        // Mimic the constructor's `return` behavior.\n        // See https://es5.github.io/#x13.2.2 for more details.\n        return isObject(result) ? result : thisBinding;\n      };\n    }\n\n    /**\n     * Creates a function that wraps `func` to enable currying.\n     *\n     * @private\n     * @param {Function} func The function to wrap.\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\n     *  for more details.\n     * @param {number} arity The arity of `func`.\n     * @returns {Function} Returns the new wrapped function.\n     */\n    function createCurryWrapper(func, bitmask, arity) {\n      var Ctor = createCtorWrapper(func);\n\n      function wrapper() {\n        var length = arguments.length,\n            args = Array(length),\n            index = length,\n            placeholder = getPlaceholder(wrapper);\n\n        while (index--) {\n          args[index] = arguments[index];\n        }\n        var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)\n          ? []\n          : replaceHolders(args, placeholder);\n\n        length -= holders.length;\n        if (length < arity) {\n          return createRecurryWrapper(\n            func, bitmask, createHybridWrapper, wrapper.placeholder, undefined,\n            args, holders, undefined, undefined, arity - length);\n        }\n        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n        return apply(fn, this, args);\n      }\n      return wrapper;\n    }\n\n    /**\n     * Creates a `_.flow` or `_.flowRight` function.\n     *\n     * @private\n     * @param {boolean} [fromRight] Specify iterating from right to left.\n     * @returns {Function} Returns the new flow function.\n     */\n    function createFlow(fromRight) {\n      return rest(function(funcs) {\n        funcs = baseFlatten(funcs, 1);\n\n        var length = funcs.length,\n            index = length,\n            prereq = LodashWrapper.prototype.thru;\n\n        if (fromRight) {\n          funcs.reverse();\n        }\n        while (index--) {\n          var func = funcs[index];\n          if (typeof func != 'function') {\n            throw new TypeError(FUNC_ERROR_TEXT);\n          }\n          if (prereq && !wrapper && getFuncName(func) == 'wrapper') {\n            var wrapper = new LodashWrapper([], true);\n          }\n        }\n        index = wrapper ? index : length;\n        while (++index < length) {\n          func = funcs[index];\n\n          var funcName = getFuncName(func),\n              data = funcName == 'wrapper' ? getData(func) : undefined;\n\n          if (data && isLaziable(data[0]) &&\n                data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) &&\n                !data[4].length && data[9] == 1\n              ) {\n            wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n          } else {\n            wrapper = (func.length == 1 && isLaziable(func))\n              ? wrapper[funcName]()\n              : wrapper.thru(func);\n          }\n        }\n        return function() {\n          var args = arguments,\n              value = args[0];\n\n          if (wrapper && args.length == 1 &&\n              isArray(value) && value.length >= LARGE_ARRAY_SIZE) {\n            return wrapper.plant(value).value();\n          }\n          var index = 0,\n              result = length ? funcs[index].apply(this, args) : value;\n\n          while (++index < length) {\n            result = funcs[index].call(this, result);\n          }\n          return result;\n        };\n      });\n    }\n\n    /**\n     * Creates a function that wraps `func` to invoke it with optional `this`\n     * binding of `thisArg`, partial application, and currying.\n     *\n     * @private\n     * @param {Function|string} func The function or method name to wrap.\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\n     *  for more details.\n     * @param {*} [thisArg] The `this` binding of `func`.\n     * @param {Array} [partials] The arguments to prepend to those provided to\n     *  the new function.\n     * @param {Array} [holders] The `partials` placeholder indexes.\n     * @param {Array} [partialsRight] The arguments to append to those provided\n     *  to the new function.\n     * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n     * @param {Array} [argPos] The argument positions of the new function.\n     * @param {number} [ary] The arity cap of `func`.\n     * @param {number} [arity] The arity of `func`.\n     * @returns {Function} Returns the new wrapped function.\n     */\n    function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n      var isAry = bitmask & ARY_FLAG,\n          isBind = bitmask & BIND_FLAG,\n          isBindKey = bitmask & BIND_KEY_FLAG,\n          isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),\n          isFlip = bitmask & FLIP_FLAG,\n          Ctor = isBindKey ? undefined : createCtorWrapper(func);\n\n      function wrapper() {\n        var length = arguments.length,\n            index = length,\n            args = Array(length);\n\n        while (index--) {\n          args[index] = arguments[index];\n        }\n        if (isCurried) {\n          var placeholder = getPlaceholder(wrapper),\n              holdersCount = countHolders(args, placeholder);\n        }\n        if (partials) {\n          args = composeArgs(args, partials, holders, isCurried);\n        }\n        if (partialsRight) {\n          args = composeArgsRight(args, partialsRight, holdersRight, isCurried);\n        }\n        length -= holdersCount;\n        if (isCurried && length < arity) {\n          var newHolders = replaceHolders(args, placeholder);\n          return createRecurryWrapper(\n            func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg,\n            args, newHolders, argPos, ary, arity - length\n          );\n        }\n        var thisBinding = isBind ? thisArg : this,\n            fn = isBindKey ? thisBinding[func] : func;\n\n        length = args.length;\n        if (argPos) {\n          args = reorder(args, argPos);\n        } else if (isFlip && length > 1) {\n          args.reverse();\n        }\n        if (isAry && ary < length) {\n          args.length = ary;\n        }\n        if (this && this !== root && this instanceof wrapper) {\n          fn = Ctor || createCtorWrapper(fn);\n        }\n        return fn.apply(thisBinding, args);\n      }\n      return wrapper;\n    }\n\n    /**\n     * Creates a function like `_.invertBy`.\n     *\n     * @private\n     * @param {Function} setter The function to set accumulator values.\n     * @param {Function} toIteratee The function to resolve iteratees.\n     * @returns {Function} Returns the new inverter function.\n     */\n    function createInverter(setter, toIteratee) {\n      return function(object, iteratee) {\n        return baseInverter(object, setter, toIteratee(iteratee), {});\n      };\n    }\n\n    /**\n     * Creates a function like `_.over`.\n     *\n     * @private\n     * @param {Function} arrayFunc The function to iterate over iteratees.\n     * @returns {Function} Returns the new invoker function.\n     */\n    function createOver(arrayFunc) {\n      return rest(function(iteratees) {\n        iteratees = (iteratees.length == 1 && isArray(iteratees[0]))\n          ? arrayMap(iteratees[0], baseUnary(getIteratee()))\n          : arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(getIteratee()));\n\n        return rest(function(args) {\n          var thisArg = this;\n          return arrayFunc(iteratees, function(iteratee) {\n            return apply(iteratee, thisArg, args);\n          });\n        });\n      });\n    }\n\n    /**\n     * Creates the padding for `string` based on `length`. The `chars` string\n     * is truncated if the number of characters exceeds `length`.\n     *\n     * @private\n     * @param {number} length The padding length.\n     * @param {string} [chars=' '] The string used as padding.\n     * @returns {string} Returns the padding for `string`.\n     */\n    function createPadding(length, chars) {\n      chars = chars === undefined ? ' ' : (chars + '');\n\n      var charsLength = chars.length;\n      if (charsLength < 2) {\n        return charsLength ? baseRepeat(chars, length) : chars;\n      }\n      var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\n      return reHasComplexSymbol.test(chars)\n        ? castSlice(stringToArray(result), 0, length).join('')\n        : result.slice(0, length);\n    }\n\n    /**\n     * Creates a function that wraps `func` to invoke it with the `this` binding\n     * of `thisArg` and `partials` prepended to the arguments it receives.\n     *\n     * @private\n     * @param {Function} func The function to wrap.\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\n     *  for more details.\n     * @param {*} thisArg The `this` binding of `func`.\n     * @param {Array} partials The arguments to prepend to those provided to\n     *  the new function.\n     * @returns {Function} Returns the new wrapped function.\n     */\n    function createPartialWrapper(func, bitmask, thisArg, partials) {\n      var isBind = bitmask & BIND_FLAG,\n          Ctor = createCtorWrapper(func);\n\n      function wrapper() {\n        var argsIndex = -1,\n            argsLength = arguments.length,\n            leftIndex = -1,\n            leftLength = partials.length,\n            args = Array(leftLength + argsLength),\n            fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n\n        while (++leftIndex < leftLength) {\n          args[leftIndex] = partials[leftIndex];\n        }\n        while (argsLength--) {\n          args[leftIndex++] = arguments[++argsIndex];\n        }\n        return apply(fn, isBind ? thisArg : this, args);\n      }\n      return wrapper;\n    }\n\n    /**\n     * Creates a `_.range` or `_.rangeRight` function.\n     *\n     * @private\n     * @param {boolean} [fromRight] Specify iterating from right to left.\n     * @returns {Function} Returns the new range function.\n     */\n    function createRange(fromRight) {\n      return function(start, end, step) {\n        if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n          end = step = undefined;\n        }\n        // Ensure the sign of `-0` is preserved.\n        start = toNumber(start);\n        start = start === start ? start : 0;\n        if (end === undefined) {\n          end = start;\n          start = 0;\n        } else {\n          end = toNumber(end) || 0;\n        }\n        step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);\n        return baseRange(start, end, step, fromRight);\n      };\n    }\n\n    /**\n     * Creates a function that wraps `func` to continue currying.\n     *\n     * @private\n     * @param {Function} func The function to wrap.\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\n     *  for more details.\n     * @param {Function} wrapFunc The function to create the `func` wrapper.\n     * @param {*} placeholder The placeholder value.\n     * @param {*} [thisArg] The `this` binding of `func`.\n     * @param {Array} [partials] The arguments to prepend to those provided to\n     *  the new function.\n     * @param {Array} [holders] The `partials` placeholder indexes.\n     * @param {Array} [argPos] The argument positions of the new function.\n     * @param {number} [ary] The arity cap of `func`.\n     * @param {number} [arity] The arity of `func`.\n     * @returns {Function} Returns the new wrapped function.\n     */\n    function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {\n      var isCurry = bitmask & CURRY_FLAG,\n          newHolders = isCurry ? holders : undefined,\n          newHoldersRight = isCurry ? undefined : holders,\n          newPartials = isCurry ? partials : undefined,\n          newPartialsRight = isCurry ? undefined : partials;\n\n      bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);\n      bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);\n\n      if (!(bitmask & CURRY_BOUND_FLAG)) {\n        bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);\n      }\n      var newData = [\n        func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,\n        newHoldersRight, argPos, ary, arity\n      ];\n\n      var result = wrapFunc.apply(undefined, newData);\n      if (isLaziable(func)) {\n        setData(result, newData);\n      }\n      result.placeholder = placeholder;\n      return result;\n    }\n\n    /**\n     * Creates a function like `_.round`.\n     *\n     * @private\n     * @param {string} methodName The name of the `Math` method to use when rounding.\n     * @returns {Function} Returns the new round function.\n     */\n    function createRound(methodName) {\n      var func = Math[methodName];\n      return function(number, precision) {\n        number = toNumber(number);\n        precision = toInteger(precision);\n        if (precision) {\n          // Shift with exponential notation to avoid floating-point issues.\n          // See [MDN](https://mdn.io/round#Examples) for more details.\n          var pair = (toString(number) + 'e').split('e'),\n              value = func(pair[0] + 'e' + (+pair[1] + precision));\n\n          pair = (toString(value) + 'e').split('e');\n          return +(pair[0] + 'e' + (+pair[1] - precision));\n        }\n        return func(number);\n      };\n    }\n\n    /**\n     * Creates a set of `values`.\n     *\n     * @private\n     * @param {Array} values The values to add to the set.\n     * @returns {Object} Returns the new set.\n     */\n    var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) {\n      return new Set(values);\n    };\n\n    /**\n     * Creates a function that either curries or invokes `func` with optional\n     * `this` binding and partially applied arguments.\n     *\n     * @private\n     * @param {Function|string} func The function or method name to wrap.\n     * @param {number} bitmask The bitmask of wrapper flags.\n     *  The bitmask may be composed of the following flags:\n     *     1 - `_.bind`\n     *     2 - `_.bindKey`\n     *     4 - `_.curry` or `_.curryRight` of a bound function\n     *     8 - `_.curry`\n     *    16 - `_.curryRight`\n     *    32 - `_.partial`\n     *    64 - `_.partialRight`\n     *   128 - `_.rearg`\n     *   256 - `_.ary`\n     * @param {*} [thisArg] The `this` binding of `func`.\n     * @param {Array} [partials] The arguments to be partially applied.\n     * @param {Array} [holders] The `partials` placeholder indexes.\n     * @param {Array} [argPos] The argument positions of the new function.\n     * @param {number} [ary] The arity cap of `func`.\n     * @param {number} [arity] The arity of `func`.\n     * @returns {Function} Returns the new wrapped function.\n     */\n    function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n      var isBindKey = bitmask & BIND_KEY_FLAG;\n      if (!isBindKey && typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      var length = partials ? partials.length : 0;\n      if (!length) {\n        bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);\n        partials = holders = undefined;\n      }\n      ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);\n      arity = arity === undefined ? arity : toInteger(arity);\n      length -= holders ? holders.length : 0;\n\n      if (bitmask & PARTIAL_RIGHT_FLAG) {\n        var partialsRight = partials,\n            holdersRight = holders;\n\n        partials = holders = undefined;\n      }\n      var data = isBindKey ? undefined : getData(func);\n\n      var newData = [\n        func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,\n        argPos, ary, arity\n      ];\n\n      if (data) {\n        mergeData(newData, data);\n      }\n      func = newData[0];\n      bitmask = newData[1];\n      thisArg = newData[2];\n      partials = newData[3];\n      holders = newData[4];\n      arity = newData[9] = newData[9] == null\n        ? (isBindKey ? 0 : func.length)\n        : nativeMax(newData[9] - length, 0);\n\n      if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) {\n        bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG);\n      }\n      if (!bitmask || bitmask == BIND_FLAG) {\n        var result = createBaseWrapper(func, bitmask, thisArg);\n      } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) {\n        result = createCurryWrapper(func, bitmask, arity);\n      } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {\n        result = createPartialWrapper(func, bitmask, thisArg, partials);\n      } else {\n        result = createHybridWrapper.apply(undefined, newData);\n      }\n      var setter = data ? baseSetData : setData;\n      return setter(result, newData);\n    }\n\n    /**\n     * A specialized version of `baseIsEqualDeep` for arrays with support for\n     * partial deep comparisons.\n     *\n     * @private\n     * @param {Array} array The array to compare.\n     * @param {Array} other The other array to compare.\n     * @param {Function} equalFunc The function to determine equivalents of values.\n     * @param {Function} customizer The function to customize comparisons.\n     * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`\n     *  for more details.\n     * @param {Object} stack Tracks traversed `array` and `other` objects.\n     * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n     */\n    function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {\n      var index = -1,\n          isPartial = bitmask & PARTIAL_COMPARE_FLAG,\n          isUnordered = bitmask & UNORDERED_COMPARE_FLAG,\n          arrLength = array.length,\n          othLength = other.length;\n\n      if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n        return false;\n      }\n      // Assume cyclic values are equal.\n      var stacked = stack.get(array);\n      if (stacked) {\n        return stacked == other;\n      }\n      var result = true;\n      stack.set(array, other);\n\n      // Ignore non-index properties.\n      while (++index < arrLength) {\n        var arrValue = array[index],\n            othValue = other[index];\n\n        if (customizer) {\n          var compared = isPartial\n            ? customizer(othValue, arrValue, index, other, array, stack)\n            : customizer(arrValue, othValue, index, array, other, stack);\n        }\n        if (compared !== undefined) {\n          if (compared) {\n            continue;\n          }\n          result = false;\n          break;\n        }\n        // Recursively compare arrays (susceptible to call stack limits).\n        if (isUnordered) {\n          if (!arraySome(other, function(othValue) {\n                return arrValue === othValue ||\n                  equalFunc(arrValue, othValue, customizer, bitmask, stack);\n              })) {\n            result = false;\n            break;\n          }\n        } else if (!(\n              arrValue === othValue ||\n                equalFunc(arrValue, othValue, customizer, bitmask, stack)\n            )) {\n          result = false;\n          break;\n        }\n      }\n      stack['delete'](array);\n      return result;\n    }\n\n    /**\n     * A specialized version of `baseIsEqualDeep` for comparing objects of\n     * the same `toStringTag`.\n     *\n     * **Note:** This function only supports comparing values with tags of\n     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n     *\n     * @private\n     * @param {Object} object The object to compare.\n     * @param {Object} other The other object to compare.\n     * @param {string} tag The `toStringTag` of the objects to compare.\n     * @param {Function} equalFunc The function to determine equivalents of values.\n     * @param {Function} customizer The function to customize comparisons.\n     * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`\n     *  for more details.\n     * @param {Object} stack Tracks traversed `object` and `other` objects.\n     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n     */\n    function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {\n      switch (tag) {\n        case dataViewTag:\n          if ((object.byteLength != other.byteLength) ||\n              (object.byteOffset != other.byteOffset)) {\n            return false;\n          }\n          object = object.buffer;\n          other = other.buffer;\n\n        case arrayBufferTag:\n          if ((object.byteLength != other.byteLength) ||\n              !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n            return false;\n          }\n          return true;\n\n        case boolTag:\n        case dateTag:\n          // Coerce dates and booleans to numbers, dates to milliseconds and\n          // booleans to `1` or `0` treating invalid dates coerced to `NaN` as\n          // not equal.\n          return +object == +other;\n\n        case errorTag:\n          return object.name == other.name && object.message == other.message;\n\n        case numberTag:\n          // Treat `NaN` vs. `NaN` as equal.\n          return (object != +object) ? other != +other : object == +other;\n\n        case regexpTag:\n        case stringTag:\n          // Coerce regexes to strings and treat strings, primitives and objects,\n          // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring\n          // for more details.\n          return object == (other + '');\n\n        case mapTag:\n          var convert = mapToArray;\n\n        case setTag:\n          var isPartial = bitmask & PARTIAL_COMPARE_FLAG;\n          convert || (convert = setToArray);\n\n          if (object.size != other.size && !isPartial) {\n            return false;\n          }\n          // Assume cyclic values are equal.\n          var stacked = stack.get(object);\n          if (stacked) {\n            return stacked == other;\n          }\n          bitmask |= UNORDERED_COMPARE_FLAG;\n          stack.set(object, other);\n\n          // Recursively compare objects (susceptible to call stack limits).\n          return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);\n\n        case symbolTag:\n          if (symbolValueOf) {\n            return symbolValueOf.call(object) == symbolValueOf.call(other);\n          }\n      }\n      return false;\n    }\n\n    /**\n     * A specialized version of `baseIsEqualDeep` for objects with support for\n     * partial deep comparisons.\n     *\n     * @private\n     * @param {Object} object The object to compare.\n     * @param {Object} other The other object to compare.\n     * @param {Function} equalFunc The function to determine equivalents of values.\n     * @param {Function} customizer The function to customize comparisons.\n     * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`\n     *  for more details.\n     * @param {Object} stack Tracks traversed `object` and `other` objects.\n     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n     */\n    function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {\n      var isPartial = bitmask & PARTIAL_COMPARE_FLAG,\n          objProps = keys(object),\n          objLength = objProps.length,\n          othProps = keys(other),\n          othLength = othProps.length;\n\n      if (objLength != othLength && !isPartial) {\n        return false;\n      }\n      var index = objLength;\n      while (index--) {\n        var key = objProps[index];\n        if (!(isPartial ? key in other : baseHas(other, key))) {\n          return false;\n        }\n      }\n      // Assume cyclic values are equal.\n      var stacked = stack.get(object);\n      if (stacked) {\n        return stacked == other;\n      }\n      var result = true;\n      stack.set(object, other);\n\n      var skipCtor = isPartial;\n      while (++index < objLength) {\n        key = objProps[index];\n        var objValue = object[key],\n            othValue = other[key];\n\n        if (customizer) {\n          var compared = isPartial\n            ? customizer(othValue, objValue, key, other, object, stack)\n            : customizer(objValue, othValue, key, object, other, stack);\n        }\n        // Recursively compare objects (susceptible to call stack limits).\n        if (!(compared === undefined\n              ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))\n              : compared\n            )) {\n          result = false;\n          break;\n        }\n        skipCtor || (skipCtor = key == 'constructor');\n      }\n      if (result && !skipCtor) {\n        var objCtor = object.constructor,\n            othCtor = other.constructor;\n\n        // Non `Object` object instances with different constructors are not equal.\n        if (objCtor != othCtor &&\n            ('constructor' in object && 'constructor' in other) &&\n            !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n              typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n          result = false;\n        }\n      }\n      stack['delete'](object);\n      return result;\n    }\n\n    /**\n     * Creates an array of own enumerable property names and symbols of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property names and symbols.\n     */\n    function getAllKeys(object) {\n      return baseGetAllKeys(object, keys, getSymbols);\n    }\n\n    /**\n     * Creates an array of own and inherited enumerable property names and\n     * symbols of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property names and symbols.\n     */\n    function getAllKeysIn(object) {\n      return baseGetAllKeys(object, keysIn, getSymbolsIn);\n    }\n\n    /**\n     * Gets metadata for `func`.\n     *\n     * @private\n     * @param {Function} func The function to query.\n     * @returns {*} Returns the metadata for `func`.\n     */\n    var getData = !metaMap ? noop : function(func) {\n      return metaMap.get(func);\n    };\n\n    /**\n     * Gets the name of `func`.\n     *\n     * @private\n     * @param {Function} func The function to query.\n     * @returns {string} Returns the function name.\n     */\n    function getFuncName(func) {\n      var result = (func.name + ''),\n          array = realNames[result],\n          length = hasOwnProperty.call(realNames, result) ? array.length : 0;\n\n      while (length--) {\n        var data = array[length],\n            otherFunc = data.func;\n        if (otherFunc == null || otherFunc == func) {\n          return data.name;\n        }\n      }\n      return result;\n    }\n\n    /**\n     * Gets the appropriate \"iteratee\" function. If `_.iteratee` is customized,\n     * this function returns the custom method, otherwise it returns `baseIteratee`.\n     * If arguments are provided, the chosen function is invoked with them and\n     * its result is returned.\n     *\n     * @private\n     * @param {*} [value] The value to convert to an iteratee.\n     * @param {number} [arity] The arity of the created iteratee.\n     * @returns {Function} Returns the chosen function or its result.\n     */\n    function getIteratee() {\n      var result = lodash.iteratee || iteratee;\n      result = result === iteratee ? baseIteratee : result;\n      return arguments.length ? result(arguments[0], arguments[1]) : result;\n    }\n\n    /**\n     * Gets the \"length\" property value of `object`.\n     *\n     * **Note:** This function is used to avoid a\n     * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects\n     * Safari on at least iOS 8.1-8.3 ARM64.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {*} Returns the \"length\" value.\n     */\n    var getLength = baseProperty('length');\n\n    /**\n     * Gets the property names, values, and compare flags of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the match data of `object`.\n     */\n    function getMatchData(object) {\n      var result = toPairs(object),\n          length = result.length;\n\n      while (length--) {\n        result[length][2] = isStrictComparable(result[length][1]);\n      }\n      return result;\n    }\n\n    /**\n     * Gets the native function at `key` of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {string} key The key of the method to get.\n     * @returns {*} Returns the function if it's native, else `undefined`.\n     */\n    function getNative(object, key) {\n      var value = object[key];\n      return isNative(value) ? value : undefined;\n    }\n\n    /**\n     * Gets the argument placeholder value for `func`.\n     *\n     * @private\n     * @param {Function} func The function to inspect.\n     * @returns {*} Returns the placeholder value.\n     */\n    function getPlaceholder(func) {\n      var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;\n      return object.placeholder;\n    }\n\n    /**\n     * Gets the `[[Prototype]]` of `value`.\n     *\n     * @private\n     * @param {*} value The value to query.\n     * @returns {null|Object} Returns the `[[Prototype]]`.\n     */\n    function getPrototype(value) {\n      return nativeGetPrototype(Object(value));\n    }\n\n    /**\n     * Creates an array of the own enumerable symbol properties of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of symbols.\n     */\n    function getSymbols(object) {\n      // Coerce `object` to an object to avoid non-object errors in V8.\n      // See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details.\n      return getOwnPropertySymbols(Object(object));\n    }\n\n    // Fallback for IE < 11.\n    if (!getOwnPropertySymbols) {\n      getSymbols = function() {\n        return [];\n      };\n    }\n\n    /**\n     * Creates an array of the own and inherited enumerable symbol properties\n     * of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of symbols.\n     */\n    var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {\n      var result = [];\n      while (object) {\n        arrayPush(result, getSymbols(object));\n        object = getPrototype(object);\n      }\n      return result;\n    };\n\n    /**\n     * Gets the `toStringTag` of `value`.\n     *\n     * @private\n     * @param {*} value The value to query.\n     * @returns {string} Returns the `toStringTag`.\n     */\n    function getTag(value) {\n      return objectToString.call(value);\n    }\n\n    // Fallback for data views, maps, sets, and weak maps in IE 11,\n    // for data views in Edge, and promises in Node.js.\n    if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n        (Map && getTag(new Map) != mapTag) ||\n        (Promise && getTag(Promise.resolve()) != promiseTag) ||\n        (Set && getTag(new Set) != setTag) ||\n        (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n      getTag = function(value) {\n        var result = objectToString.call(value),\n            Ctor = result == objectTag ? value.constructor : undefined,\n            ctorString = Ctor ? toSource(Ctor) : undefined;\n\n        if (ctorString) {\n          switch (ctorString) {\n            case dataViewCtorString: return dataViewTag;\n            case mapCtorString: return mapTag;\n            case promiseCtorString: return promiseTag;\n            case setCtorString: return setTag;\n            case weakMapCtorString: return weakMapTag;\n          }\n        }\n        return result;\n      };\n    }\n\n    /**\n     * Gets the view, applying any `transforms` to the `start` and `end` positions.\n     *\n     * @private\n     * @param {number} start The start of the view.\n     * @param {number} end The end of the view.\n     * @param {Array} transforms The transformations to apply to the view.\n     * @returns {Object} Returns an object containing the `start` and `end`\n     *  positions of the view.\n     */\n    function getView(start, end, transforms) {\n      var index = -1,\n          length = transforms.length;\n\n      while (++index < length) {\n        var data = transforms[index],\n            size = data.size;\n\n        switch (data.type) {\n          case 'drop':      start += size; break;\n          case 'dropRight': end -= size; break;\n          case 'take':      end = nativeMin(end, start + size); break;\n          case 'takeRight': start = nativeMax(start, end - size); break;\n        }\n      }\n      return { 'start': start, 'end': end };\n    }\n\n    /**\n     * Checks if `path` exists on `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path to check.\n     * @param {Function} hasFunc The function to check properties.\n     * @returns {boolean} Returns `true` if `path` exists, else `false`.\n     */\n    function hasPath(object, path, hasFunc) {\n      path = isKey(path, object) ? [path] : castPath(path);\n\n      var result,\n          index = -1,\n          length = path.length;\n\n      while (++index < length) {\n        var key = path[index];\n        if (!(result = object != null && hasFunc(object, key))) {\n          break;\n        }\n        object = object[key];\n      }\n      if (result) {\n        return result;\n      }\n      var length = object ? object.length : 0;\n      return !!length && isLength(length) && isIndex(key, length) &&\n        (isArray(object) || isString(object) || isArguments(object));\n    }\n\n    /**\n     * Initializes an array clone.\n     *\n     * @private\n     * @param {Array} array The array to clone.\n     * @returns {Array} Returns the initialized clone.\n     */\n    function initCloneArray(array) {\n      var length = array.length,\n          result = array.constructor(length);\n\n      // Add properties assigned by `RegExp#exec`.\n      if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n        result.index = array.index;\n        result.input = array.input;\n      }\n      return result;\n    }\n\n    /**\n     * Initializes an object clone.\n     *\n     * @private\n     * @param {Object} object The object to clone.\n     * @returns {Object} Returns the initialized clone.\n     */\n    function initCloneObject(object) {\n      return (typeof object.constructor == 'function' && !isPrototype(object))\n        ? baseCreate(getPrototype(object))\n        : {};\n    }\n\n    /**\n     * Initializes an object clone based on its `toStringTag`.\n     *\n     * **Note:** This function only supports cloning values with tags of\n     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n     *\n     * @private\n     * @param {Object} object The object to clone.\n     * @param {string} tag The `toStringTag` of the object to clone.\n     * @param {Function} cloneFunc The function to clone values.\n     * @param {boolean} [isDeep] Specify a deep clone.\n     * @returns {Object} Returns the initialized clone.\n     */\n    function initCloneByTag(object, tag, cloneFunc, isDeep) {\n      var Ctor = object.constructor;\n      switch (tag) {\n        case arrayBufferTag:\n          return cloneArrayBuffer(object);\n\n        case boolTag:\n        case dateTag:\n          return new Ctor(+object);\n\n        case dataViewTag:\n          return cloneDataView(object, isDeep);\n\n        case float32Tag: case float64Tag:\n        case int8Tag: case int16Tag: case int32Tag:\n        case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n          return cloneTypedArray(object, isDeep);\n\n        case mapTag:\n          return cloneMap(object, isDeep, cloneFunc);\n\n        case numberTag:\n        case stringTag:\n          return new Ctor(object);\n\n        case regexpTag:\n          return cloneRegExp(object);\n\n        case setTag:\n          return cloneSet(object, isDeep, cloneFunc);\n\n        case symbolTag:\n          return cloneSymbol(object);\n      }\n    }\n\n    /**\n     * Creates an array of index keys for `object` values of arrays,\n     * `arguments` objects, and strings, otherwise `null` is returned.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @returns {Array|null} Returns index keys, else `null`.\n     */\n    function indexKeys(object) {\n      var length = object ? object.length : undefined;\n      if (isLength(length) &&\n          (isArray(object) || isString(object) || isArguments(object))) {\n        return baseTimes(length, String);\n      }\n      return null;\n    }\n\n    /**\n     * Checks if `value` is a flattenable `arguments` object or array.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n     */\n    function isFlattenable(value) {\n      return isArrayLikeObject(value) && (isArray(value) || isArguments(value));\n    }\n\n    /**\n     * Checks if `value` is a flattenable array and not a `_.matchesProperty`\n     * iteratee shorthand.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n     */\n    function isFlattenableIteratee(value) {\n      return isArray(value) && !(value.length == 2 && !isFunction(value[0]));\n    }\n\n    /**\n     * Checks if the given arguments are from an iteratee call.\n     *\n     * @private\n     * @param {*} value The potential iteratee value argument.\n     * @param {*} index The potential iteratee index or key argument.\n     * @param {*} object The potential iteratee object argument.\n     * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n     *  else `false`.\n     */\n    function isIterateeCall(value, index, object) {\n      if (!isObject(object)) {\n        return false;\n      }\n      var type = typeof index;\n      if (type == 'number'\n            ? (isArrayLike(object) && isIndex(index, object.length))\n            : (type == 'string' && index in object)\n          ) {\n        return eq(object[index], value);\n      }\n      return false;\n    }\n\n    /**\n     * Checks if `value` is a property name and not a property path.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @param {Object} [object] The object to query keys on.\n     * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n     */\n    function isKey(value, object) {\n      var type = typeof value;\n      if (type == 'number' || type == 'symbol') {\n        return true;\n      }\n      return !isArray(value) &&\n        (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n          (object != null && value in Object(object)));\n    }\n\n    /**\n     * Checks if `value` is suitable for use as unique object key.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n     */\n    function isKeyable(value) {\n      var type = typeof value;\n      return type == 'number' || type == 'boolean' ||\n        (type == 'string' && value != '__proto__') || value == null;\n    }\n\n    /**\n     * Checks if `func` has a lazy counterpart.\n     *\n     * @private\n     * @param {Function} func The function to check.\n     * @returns {boolean} Returns `true` if `func` has a lazy counterpart,\n     *  else `false`.\n     */\n    function isLaziable(func) {\n      var funcName = getFuncName(func),\n          other = lodash[funcName];\n\n      if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\n        return false;\n      }\n      if (func === other) {\n        return true;\n      }\n      var data = getData(other);\n      return !!data && func === data[0];\n    }\n\n    /**\n     * Checks if `value` is likely a prototype object.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n     */\n    function isPrototype(value) {\n      var Ctor = value && value.constructor,\n          proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n      return value === proto;\n    }\n\n    /**\n     * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` if suitable for strict\n     *  equality comparisons, else `false`.\n     */\n    function isStrictComparable(value) {\n      return value === value && !isObject(value);\n    }\n\n    /**\n     * A specialized version of `matchesProperty` for source values suitable\n     * for strict equality comparisons, i.e. `===`.\n     *\n     * @private\n     * @param {string} key The key of the property to get.\n     * @param {*} srcValue The value to match.\n     * @returns {Function} Returns the new function.\n     */\n    function matchesStrictComparable(key, srcValue) {\n      return function(object) {\n        if (object == null) {\n          return false;\n        }\n        return object[key] === srcValue &&\n          (srcValue !== undefined || (key in Object(object)));\n      };\n    }\n\n    /**\n     * Merges the function metadata of `source` into `data`.\n     *\n     * Merging metadata reduces the number of wrappers used to invoke a function.\n     * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n     * may be applied regardless of execution order. Methods like `_.ary` and\n     * `_.rearg` modify function arguments, making the order in which they are\n     * executed important, preventing the merging of metadata. However, we make\n     * an exception for a safe combined case where curried functions have `_.ary`\n     * and or `_.rearg` applied.\n     *\n     * @private\n     * @param {Array} data The destination metadata.\n     * @param {Array} source The source metadata.\n     * @returns {Array} Returns `data`.\n     */\n    function mergeData(data, source) {\n      var bitmask = data[1],\n          srcBitmask = source[1],\n          newBitmask = bitmask | srcBitmask,\n          isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG);\n\n      var isCombo =\n        ((srcBitmask == ARY_FLAG) && (bitmask == CURRY_FLAG)) ||\n        ((srcBitmask == ARY_FLAG) && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) ||\n        ((srcBitmask == (ARY_FLAG | REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG));\n\n      // Exit early if metadata can't be merged.\n      if (!(isCommon || isCombo)) {\n        return data;\n      }\n      // Use source `thisArg` if available.\n      if (srcBitmask & BIND_FLAG) {\n        data[2] = source[2];\n        // Set when currying a bound function.\n        newBitmask |= bitmask & BIND_FLAG ? 0 : CURRY_BOUND_FLAG;\n      }\n      // Compose partial arguments.\n      var value = source[3];\n      if (value) {\n        var partials = data[3];\n        data[3] = partials ? composeArgs(partials, value, source[4]) : value;\n        data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];\n      }\n      // Compose partial right arguments.\n      value = source[5];\n      if (value) {\n        partials = data[5];\n        data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;\n        data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];\n      }\n      // Use source `argPos` if available.\n      value = source[7];\n      if (value) {\n        data[7] = value;\n      }\n      // Use source `ary` if it's smaller.\n      if (srcBitmask & ARY_FLAG) {\n        data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n      }\n      // Use source `arity` if one is not provided.\n      if (data[9] == null) {\n        data[9] = source[9];\n      }\n      // Use source `func` and merge bitmasks.\n      data[0] = source[0];\n      data[1] = newBitmask;\n\n      return data;\n    }\n\n    /**\n     * Used by `_.defaultsDeep` to customize its `_.merge` use.\n     *\n     * @private\n     * @param {*} objValue The destination value.\n     * @param {*} srcValue The source value.\n     * @param {string} key The key of the property to merge.\n     * @param {Object} object The parent object of `objValue`.\n     * @param {Object} source The parent object of `srcValue`.\n     * @param {Object} [stack] Tracks traversed source values and their merged\n     *  counterparts.\n     * @returns {*} Returns the value to assign.\n     */\n    function mergeDefaults(objValue, srcValue, key, object, source, stack) {\n      if (isObject(objValue) && isObject(srcValue)) {\n        baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue));\n      }\n      return objValue;\n    }\n\n    /**\n     * Gets the parent value at `path` of `object`.\n     *\n     * @private\n     * @param {Object} object The object to query.\n     * @param {Array} path The path to get the parent value of.\n     * @returns {*} Returns the parent value.\n     */\n    function parent(object, path) {\n      return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n    }\n\n    /**\n     * Reorder `array` according to the specified indexes where the element at\n     * the first index is assigned as the first element, the element at\n     * the second index is assigned as the second element, and so on.\n     *\n     * @private\n     * @param {Array} array The array to reorder.\n     * @param {Array} indexes The arranged array indexes.\n     * @returns {Array} Returns `array`.\n     */\n    function reorder(array, indexes) {\n      var arrLength = array.length,\n          length = nativeMin(indexes.length, arrLength),\n          oldArray = copyArray(array);\n\n      while (length--) {\n        var index = indexes[length];\n        array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n      }\n      return array;\n    }\n\n    /**\n     * Sets metadata for `func`.\n     *\n     * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n     * period of time, it will trip its breaker and transition to an identity\n     * function to avoid garbage collection pauses in V8. See\n     * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)\n     * for more details.\n     *\n     * @private\n     * @param {Function} func The function to associate metadata with.\n     * @param {*} data The metadata.\n     * @returns {Function} Returns `func`.\n     */\n    var setData = (function() {\n      var count = 0,\n          lastCalled = 0;\n\n      return function(key, value) {\n        var stamp = now(),\n            remaining = HOT_SPAN - (stamp - lastCalled);\n\n        lastCalled = stamp;\n        if (remaining > 0) {\n          if (++count >= HOT_COUNT) {\n            return key;\n          }\n        } else {\n          count = 0;\n        }\n        return baseSetData(key, value);\n      };\n    }());\n\n    /**\n     * Converts `string` to a property path array.\n     *\n     * @private\n     * @param {string} string The string to convert.\n     * @returns {Array} Returns the property path array.\n     */\n    var stringToPath = memoize(function(string) {\n      var result = [];\n      toString(string).replace(rePropName, function(match, number, quote, string) {\n        result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n      });\n      return result;\n    });\n\n    /**\n     * Converts `value` to a string key if it's not a string or symbol.\n     *\n     * @private\n     * @param {*} value The value to inspect.\n     * @returns {string|symbol} Returns the key.\n     */\n    function toKey(key) {\n      return (typeof key == 'string' || isSymbol(key)) ? key : (key + '');\n    }\n\n    /**\n     * Converts `func` to its source code.\n     *\n     * @private\n     * @param {Function} func The function to process.\n     * @returns {string} Returns the source code.\n     */\n    function toSource(func) {\n      if (func != null) {\n        try {\n          return funcToString.call(func);\n        } catch (e) {}\n        try {\n          return (func + '');\n        } catch (e) {}\n      }\n      return '';\n    }\n\n    /**\n     * Creates a clone of `wrapper`.\n     *\n     * @private\n     * @param {Object} wrapper The wrapper to clone.\n     * @returns {Object} Returns the cloned wrapper.\n     */\n    function wrapperClone(wrapper) {\n      if (wrapper instanceof LazyWrapper) {\n        return wrapper.clone();\n      }\n      var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);\n      result.__actions__ = copyArray(wrapper.__actions__);\n      result.__index__  = wrapper.__index__;\n      result.__values__ = wrapper.__values__;\n      return result;\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates an array of elements split into groups the length of `size`.\n     * If `array` can't be split evenly, the final chunk will be the remaining\n     * elements.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to process.\n     * @param {number} [size=1] The length of each chunk\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Array} Returns the new array containing chunks.\n     * @example\n     *\n     * _.chunk(['a', 'b', 'c', 'd'], 2);\n     * // => [['a', 'b'], ['c', 'd']]\n     *\n     * _.chunk(['a', 'b', 'c', 'd'], 3);\n     * // => [['a', 'b', 'c'], ['d']]\n     */\n    function chunk(array, size, guard) {\n      if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {\n        size = 1;\n      } else {\n        size = nativeMax(toInteger(size), 0);\n      }\n      var length = array ? array.length : 0;\n      if (!length || size < 1) {\n        return [];\n      }\n      var index = 0,\n          resIndex = 0,\n          result = Array(nativeCeil(length / size));\n\n      while (index < length) {\n        result[resIndex++] = baseSlice(array, index, (index += size));\n      }\n      return result;\n    }\n\n    /**\n     * Creates an array with all falsey values removed. The values `false`, `null`,\n     * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to compact.\n     * @returns {Array} Returns the new array of filtered values.\n     * @example\n     *\n     * _.compact([0, 1, false, 2, '', 3]);\n     * // => [1, 2, 3]\n     */\n    function compact(array) {\n      var index = -1,\n          length = array ? array.length : 0,\n          resIndex = 0,\n          result = [];\n\n      while (++index < length) {\n        var value = array[index];\n        if (value) {\n          result[resIndex++] = value;\n        }\n      }\n      return result;\n    }\n\n    /**\n     * Creates a new array concatenating `array` with any additional arrays\n     * and/or values.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to concatenate.\n     * @param {...*} [values] The values to concatenate.\n     * @returns {Array} Returns the new concatenated array.\n     * @example\n     *\n     * var array = [1];\n     * var other = _.concat(array, 2, [3], [[4]]);\n     *\n     * console.log(other);\n     * // => [1, 2, 3, [4]]\n     *\n     * console.log(array);\n     * // => [1]\n     */\n    function concat() {\n      var length = arguments.length,\n          array = castArray(arguments[0]);\n\n      if (length < 2) {\n        return length ? copyArray(array) : [];\n      }\n      var args = Array(length - 1);\n      while (length--) {\n        args[length - 1] = arguments[length];\n      }\n      return arrayConcat(array, baseFlatten(args, 1));\n    }\n\n    /**\n     * Creates an array of unique `array` values not included in the other given\n     * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons. The order of result values is determined by the\n     * order they occur in the first array.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @param {...Array} [values] The values to exclude.\n     * @returns {Array} Returns the new array of filtered values.\n     * @example\n     *\n     * _.difference([3, 2, 1], [4, 2]);\n     * // => [3, 1]\n     */\n    var difference = rest(function(array, values) {\n      return isArrayLikeObject(array)\n        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n        : [];\n    });\n\n    /**\n     * This method is like `_.difference` except that it accepts `iteratee` which\n     * is invoked for each element of `array` and `values` to generate the criterion\n     * by which they're compared. Result values are chosen from the first array.\n     * The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @param {...Array} [values] The values to exclude.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {Array} Returns the new array of filtered values.\n     * @example\n     *\n     * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);\n     * // => [3.1, 1.3]\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n     * // => [{ 'x': 2 }]\n     */\n    var differenceBy = rest(function(array, values) {\n      var iteratee = last(values);\n      if (isArrayLikeObject(iteratee)) {\n        iteratee = undefined;\n      }\n      return isArrayLikeObject(array)\n        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee))\n        : [];\n    });\n\n    /**\n     * This method is like `_.difference` except that it accepts `comparator`\n     * which is invoked to compare elements of `array` to `values`. Result values\n     * are chosen from the first array. The comparator is invoked with two arguments:\n     * (arrVal, othVal).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @param {...Array} [values] The values to exclude.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new array of filtered values.\n     * @example\n     *\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n     *\n     * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n     * // => [{ 'x': 2, 'y': 1 }]\n     */\n    var differenceWith = rest(function(array, values) {\n      var comparator = last(values);\n      if (isArrayLikeObject(comparator)) {\n        comparator = undefined;\n      }\n      return isArrayLikeObject(array)\n        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)\n        : [];\n    });\n\n    /**\n     * Creates a slice of `array` with `n` elements dropped from the beginning.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.5.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {number} [n=1] The number of elements to drop.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * _.drop([1, 2, 3]);\n     * // => [2, 3]\n     *\n     * _.drop([1, 2, 3], 2);\n     * // => [3]\n     *\n     * _.drop([1, 2, 3], 5);\n     * // => []\n     *\n     * _.drop([1, 2, 3], 0);\n     * // => [1, 2, 3]\n     */\n    function drop(array, n, guard) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return [];\n      }\n      n = (guard || n === undefined) ? 1 : toInteger(n);\n      return baseSlice(array, n < 0 ? 0 : n, length);\n    }\n\n    /**\n     * Creates a slice of `array` with `n` elements dropped from the end.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {number} [n=1] The number of elements to drop.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * _.dropRight([1, 2, 3]);\n     * // => [1, 2]\n     *\n     * _.dropRight([1, 2, 3], 2);\n     * // => [1]\n     *\n     * _.dropRight([1, 2, 3], 5);\n     * // => []\n     *\n     * _.dropRight([1, 2, 3], 0);\n     * // => [1, 2, 3]\n     */\n    function dropRight(array, n, guard) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return [];\n      }\n      n = (guard || n === undefined) ? 1 : toInteger(n);\n      n = length - n;\n      return baseSlice(array, 0, n < 0 ? 0 : n);\n    }\n\n    /**\n     * Creates a slice of `array` excluding elements dropped from the end.\n     * Elements are dropped until `predicate` returns falsey. The predicate is\n     * invoked with three arguments: (value, index, array).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'active': true },\n     *   { 'user': 'fred',    'active': false },\n     *   { 'user': 'pebbles', 'active': false }\n     * ];\n     *\n     * _.dropRightWhile(users, function(o) { return !o.active; });\n     * // => objects for ['barney']\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });\n     * // => objects for ['barney', 'fred']\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.dropRightWhile(users, ['active', false]);\n     * // => objects for ['barney']\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.dropRightWhile(users, 'active');\n     * // => objects for ['barney', 'fred', 'pebbles']\n     */\n    function dropRightWhile(array, predicate) {\n      return (array && array.length)\n        ? baseWhile(array, getIteratee(predicate, 3), true, true)\n        : [];\n    }\n\n    /**\n     * Creates a slice of `array` excluding elements dropped from the beginning.\n     * Elements are dropped until `predicate` returns falsey. The predicate is\n     * invoked with three arguments: (value, index, array).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'active': false },\n     *   { 'user': 'fred',    'active': false },\n     *   { 'user': 'pebbles', 'active': true }\n     * ];\n     *\n     * _.dropWhile(users, function(o) { return !o.active; });\n     * // => objects for ['pebbles']\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.dropWhile(users, { 'user': 'barney', 'active': false });\n     * // => objects for ['fred', 'pebbles']\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.dropWhile(users, ['active', false]);\n     * // => objects for ['pebbles']\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.dropWhile(users, 'active');\n     * // => objects for ['barney', 'fred', 'pebbles']\n     */\n    function dropWhile(array, predicate) {\n      return (array && array.length)\n        ? baseWhile(array, getIteratee(predicate, 3), true)\n        : [];\n    }\n\n    /**\n     * Fills elements of `array` with `value` from `start` up to, but not\n     * including, `end`.\n     *\n     * **Note:** This method mutates `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.2.0\n     * @category Array\n     * @param {Array} array The array to fill.\n     * @param {*} value The value to fill `array` with.\n     * @param {number} [start=0] The start position.\n     * @param {number} [end=array.length] The end position.\n     * @returns {Array} Returns `array`.\n     * @example\n     *\n     * var array = [1, 2, 3];\n     *\n     * _.fill(array, 'a');\n     * console.log(array);\n     * // => ['a', 'a', 'a']\n     *\n     * _.fill(Array(3), 2);\n     * // => [2, 2, 2]\n     *\n     * _.fill([4, 6, 8, 10], '*', 1, 3);\n     * // => [4, '*', '*', 10]\n     */\n    function fill(array, value, start, end) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return [];\n      }\n      if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n        start = 0;\n        end = length;\n      }\n      return baseFill(array, value, start, end);\n    }\n\n    /**\n     * This method is like `_.find` except that it returns the index of the first\n     * element `predicate` returns truthy for instead of the element itself.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.1.0\n     * @category Array\n     * @param {Array} array The array to search.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {number} Returns the index of the found element, else `-1`.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'active': false },\n     *   { 'user': 'fred',    'active': false },\n     *   { 'user': 'pebbles', 'active': true }\n     * ];\n     *\n     * _.findIndex(users, function(o) { return o.user == 'barney'; });\n     * // => 0\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.findIndex(users, { 'user': 'fred', 'active': false });\n     * // => 1\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.findIndex(users, ['active', false]);\n     * // => 0\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.findIndex(users, 'active');\n     * // => 2\n     */\n    function findIndex(array, predicate) {\n      return (array && array.length)\n        ? baseFindIndex(array, getIteratee(predicate, 3))\n        : -1;\n    }\n\n    /**\n     * This method is like `_.findIndex` except that it iterates over elements\n     * of `collection` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Array\n     * @param {Array} array The array to search.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {number} Returns the index of the found element, else `-1`.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'active': true },\n     *   { 'user': 'fred',    'active': false },\n     *   { 'user': 'pebbles', 'active': false }\n     * ];\n     *\n     * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });\n     * // => 2\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n     * // => 0\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.findLastIndex(users, ['active', false]);\n     * // => 2\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.findLastIndex(users, 'active');\n     * // => 0\n     */\n    function findLastIndex(array, predicate) {\n      return (array && array.length)\n        ? baseFindIndex(array, getIteratee(predicate, 3), true)\n        : -1;\n    }\n\n    /**\n     * Flattens `array` a single level deep.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to flatten.\n     * @returns {Array} Returns the new flattened array.\n     * @example\n     *\n     * _.flatten([1, [2, [3, [4]], 5]]);\n     * // => [1, 2, [3, [4]], 5]\n     */\n    function flatten(array) {\n      var length = array ? array.length : 0;\n      return length ? baseFlatten(array, 1) : [];\n    }\n\n    /**\n     * Recursively flattens `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to flatten.\n     * @returns {Array} Returns the new flattened array.\n     * @example\n     *\n     * _.flattenDeep([1, [2, [3, [4]], 5]]);\n     * // => [1, 2, 3, 4, 5]\n     */\n    function flattenDeep(array) {\n      var length = array ? array.length : 0;\n      return length ? baseFlatten(array, INFINITY) : [];\n    }\n\n    /**\n     * Recursively flatten `array` up to `depth` times.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.4.0\n     * @category Array\n     * @param {Array} array The array to flatten.\n     * @param {number} [depth=1] The maximum recursion depth.\n     * @returns {Array} Returns the new flattened array.\n     * @example\n     *\n     * var array = [1, [2, [3, [4]], 5]];\n     *\n     * _.flattenDepth(array, 1);\n     * // => [1, 2, [3, [4]], 5]\n     *\n     * _.flattenDepth(array, 2);\n     * // => [1, 2, 3, [4], 5]\n     */\n    function flattenDepth(array, depth) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return [];\n      }\n      depth = depth === undefined ? 1 : toInteger(depth);\n      return baseFlatten(array, depth);\n    }\n\n    /**\n     * The inverse of `_.toPairs`; this method returns an object composed\n     * from key-value `pairs`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} pairs The key-value pairs.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * _.fromPairs([['fred', 30], ['barney', 40]]);\n     * // => { 'fred': 30, 'barney': 40 }\n     */\n    function fromPairs(pairs) {\n      var index = -1,\n          length = pairs ? pairs.length : 0,\n          result = {};\n\n      while (++index < length) {\n        var pair = pairs[index];\n        result[pair[0]] = pair[1];\n      }\n      return result;\n    }\n\n    /**\n     * Gets the first element of `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @alias first\n     * @category Array\n     * @param {Array} array The array to query.\n     * @returns {*} Returns the first element of `array`.\n     * @example\n     *\n     * _.head([1, 2, 3]);\n     * // => 1\n     *\n     * _.head([]);\n     * // => undefined\n     */\n    function head(array) {\n      return (array && array.length) ? array[0] : undefined;\n    }\n\n    /**\n     * Gets the index at which the first occurrence of `value` is found in `array`\n     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons. If `fromIndex` is negative, it's used as the\n     * offset from the end of `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to search.\n     * @param {*} value The value to search for.\n     * @param {number} [fromIndex=0] The index to search from.\n     * @returns {number} Returns the index of the matched value, else `-1`.\n     * @example\n     *\n     * _.indexOf([1, 2, 1, 2], 2);\n     * // => 1\n     *\n     * // Search from the `fromIndex`.\n     * _.indexOf([1, 2, 1, 2], 2, 2);\n     * // => 3\n     */\n    function indexOf(array, value, fromIndex) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return -1;\n      }\n      fromIndex = toInteger(fromIndex);\n      if (fromIndex < 0) {\n        fromIndex = nativeMax(length + fromIndex, 0);\n      }\n      return baseIndexOf(array, value, fromIndex);\n    }\n\n    /**\n     * Gets all but the last element of `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * _.initial([1, 2, 3]);\n     * // => [1, 2]\n     */\n    function initial(array) {\n      return dropRight(array, 1);\n    }\n\n    /**\n     * Creates an array of unique values that are included in all given arrays\n     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons. The order of result values is determined by the\n     * order they occur in the first array.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @returns {Array} Returns the new array of intersecting values.\n     * @example\n     *\n     * _.intersection([2, 1], [4, 2], [1, 2]);\n     * // => [2]\n     */\n    var intersection = rest(function(arrays) {\n      var mapped = arrayMap(arrays, castArrayLikeObject);\n      return (mapped.length && mapped[0] === arrays[0])\n        ? baseIntersection(mapped)\n        : [];\n    });\n\n    /**\n     * This method is like `_.intersection` except that it accepts `iteratee`\n     * which is invoked for each element of each `arrays` to generate the criterion\n     * by which they're compared. Result values are chosen from the first array.\n     * The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {Array} Returns the new array of intersecting values.\n     * @example\n     *\n     * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n     * // => [2.1]\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n     * // => [{ 'x': 1 }]\n     */\n    var intersectionBy = rest(function(arrays) {\n      var iteratee = last(arrays),\n          mapped = arrayMap(arrays, castArrayLikeObject);\n\n      if (iteratee === last(mapped)) {\n        iteratee = undefined;\n      } else {\n        mapped.pop();\n      }\n      return (mapped.length && mapped[0] === arrays[0])\n        ? baseIntersection(mapped, getIteratee(iteratee))\n        : [];\n    });\n\n    /**\n     * This method is like `_.intersection` except that it accepts `comparator`\n     * which is invoked to compare elements of `arrays`. Result values are chosen\n     * from the first array. The comparator is invoked with two arguments:\n     * (arrVal, othVal).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new array of intersecting values.\n     * @example\n     *\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n     *\n     * _.intersectionWith(objects, others, _.isEqual);\n     * // => [{ 'x': 1, 'y': 2 }]\n     */\n    var intersectionWith = rest(function(arrays) {\n      var comparator = last(arrays),\n          mapped = arrayMap(arrays, castArrayLikeObject);\n\n      if (comparator === last(mapped)) {\n        comparator = undefined;\n      } else {\n        mapped.pop();\n      }\n      return (mapped.length && mapped[0] === arrays[0])\n        ? baseIntersection(mapped, undefined, comparator)\n        : [];\n    });\n\n    /**\n     * Converts all elements in `array` into a string separated by `separator`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to convert.\n     * @param {string} [separator=','] The element separator.\n     * @returns {string} Returns the joined string.\n     * @example\n     *\n     * _.join(['a', 'b', 'c'], '~');\n     * // => 'a~b~c'\n     */\n    function join(array, separator) {\n      return array ? nativeJoin.call(array, separator) : '';\n    }\n\n    /**\n     * Gets the last element of `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @returns {*} Returns the last element of `array`.\n     * @example\n     *\n     * _.last([1, 2, 3]);\n     * // => 3\n     */\n    function last(array) {\n      var length = array ? array.length : 0;\n      return length ? array[length - 1] : undefined;\n    }\n\n    /**\n     * This method is like `_.indexOf` except that it iterates over elements of\n     * `array` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to search.\n     * @param {*} value The value to search for.\n     * @param {number} [fromIndex=array.length-1] The index to search from.\n     * @returns {number} Returns the index of the matched value, else `-1`.\n     * @example\n     *\n     * _.lastIndexOf([1, 2, 1, 2], 2);\n     * // => 3\n     *\n     * // Search from the `fromIndex`.\n     * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n     * // => 1\n     */\n    function lastIndexOf(array, value, fromIndex) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return -1;\n      }\n      var index = length;\n      if (fromIndex !== undefined) {\n        index = toInteger(fromIndex);\n        index = (\n          index < 0\n            ? nativeMax(length + index, 0)\n            : nativeMin(index, length - 1)\n        ) + 1;\n      }\n      if (value !== value) {\n        return indexOfNaN(array, index, true);\n      }\n      while (index--) {\n        if (array[index] === value) {\n          return index;\n        }\n      }\n      return -1;\n    }\n\n    /**\n     * Gets the nth element of `array`. If `n` is negative, the nth element\n     * from the end is returned.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.11.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {number} [n=0] The index of the element to return.\n     * @returns {*} Returns the nth element of `array`.\n     * @example\n     *\n     * var array = ['a', 'b', 'c', 'd'];\n     *\n     * _.nth(array, 1);\n     * // => 'b'\n     *\n     * _.nth(array, -2);\n     * // => 'c';\n     */\n    function nth(array, n) {\n      return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;\n    }\n\n    /**\n     * Removes all given values from `array` using\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons.\n     *\n     * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`\n     * to remove elements from an array by predicate.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Array\n     * @param {Array} array The array to modify.\n     * @param {...*} [values] The values to remove.\n     * @returns {Array} Returns `array`.\n     * @example\n     *\n     * var array = [1, 2, 3, 1, 2, 3];\n     *\n     * _.pull(array, 2, 3);\n     * console.log(array);\n     * // => [1, 1]\n     */\n    var pull = rest(pullAll);\n\n    /**\n     * This method is like `_.pull` except that it accepts an array of values to remove.\n     *\n     * **Note:** Unlike `_.difference`, this method mutates `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to modify.\n     * @param {Array} values The values to remove.\n     * @returns {Array} Returns `array`.\n     * @example\n     *\n     * var array = [1, 2, 3, 1, 2, 3];\n     *\n     * _.pullAll(array, [2, 3]);\n     * console.log(array);\n     * // => [1, 1]\n     */\n    function pullAll(array, values) {\n      return (array && array.length && values && values.length)\n        ? basePullAll(array, values)\n        : array;\n    }\n\n    /**\n     * This method is like `_.pullAll` except that it accepts `iteratee` which is\n     * invoked for each element of `array` and `values` to generate the criterion\n     * by which they're compared. The iteratee is invoked with one argument: (value).\n     *\n     * **Note:** Unlike `_.differenceBy`, this method mutates `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to modify.\n     * @param {Array} values The values to remove.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {Array} Returns `array`.\n     * @example\n     *\n     * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n     *\n     * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\n     * console.log(array);\n     * // => [{ 'x': 2 }]\n     */\n    function pullAllBy(array, values, iteratee) {\n      return (array && array.length && values && values.length)\n        ? basePullAll(array, values, getIteratee(iteratee))\n        : array;\n    }\n\n    /**\n     * This method is like `_.pullAll` except that it accepts `comparator` which\n     * is invoked to compare elements of `array` to `values`. The comparator is\n     * invoked with two arguments: (arrVal, othVal).\n     *\n     * **Note:** Unlike `_.differenceWith`, this method mutates `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.6.0\n     * @category Array\n     * @param {Array} array The array to modify.\n     * @param {Array} values The values to remove.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns `array`.\n     * @example\n     *\n     * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];\n     *\n     * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);\n     * console.log(array);\n     * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\n     */\n    function pullAllWith(array, values, comparator) {\n      return (array && array.length && values && values.length)\n        ? basePullAll(array, values, undefined, comparator)\n        : array;\n    }\n\n    /**\n     * Removes elements from `array` corresponding to `indexes` and returns an\n     * array of removed elements.\n     *\n     * **Note:** Unlike `_.at`, this method mutates `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to modify.\n     * @param {...(number|number[])} [indexes] The indexes of elements to remove.\n     * @returns {Array} Returns the new array of removed elements.\n     * @example\n     *\n     * var array = [5, 10, 15, 20];\n     * var evens = _.pullAt(array, 1, 3);\n     *\n     * console.log(array);\n     * // => [5, 15]\n     *\n     * console.log(evens);\n     * // => [10, 20]\n     */\n    var pullAt = rest(function(array, indexes) {\n      indexes = arrayMap(baseFlatten(indexes, 1), String);\n\n      var result = baseAt(array, indexes);\n      basePullAt(array, indexes.sort(compareAscending));\n      return result;\n    });\n\n    /**\n     * Removes all elements from `array` that `predicate` returns truthy for\n     * and returns an array of the removed elements. The predicate is invoked\n     * with three arguments: (value, index, array).\n     *\n     * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`\n     * to pull elements from an array by value.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Array\n     * @param {Array} array The array to modify.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the new array of removed elements.\n     * @example\n     *\n     * var array = [1, 2, 3, 4];\n     * var evens = _.remove(array, function(n) {\n     *   return n % 2 == 0;\n     * });\n     *\n     * console.log(array);\n     * // => [1, 3]\n     *\n     * console.log(evens);\n     * // => [2, 4]\n     */\n    function remove(array, predicate) {\n      var result = [];\n      if (!(array && array.length)) {\n        return result;\n      }\n      var index = -1,\n          indexes = [],\n          length = array.length;\n\n      predicate = getIteratee(predicate, 3);\n      while (++index < length) {\n        var value = array[index];\n        if (predicate(value, index, array)) {\n          result.push(value);\n          indexes.push(index);\n        }\n      }\n      basePullAt(array, indexes);\n      return result;\n    }\n\n    /**\n     * Reverses `array` so that the first element becomes the last, the second\n     * element becomes the second to last, and so on.\n     *\n     * **Note:** This method mutates `array` and is based on\n     * [`Array#reverse`](https://mdn.io/Array/reverse).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to modify.\n     * @returns {Array} Returns `array`.\n     * @example\n     *\n     * var array = [1, 2, 3];\n     *\n     * _.reverse(array);\n     * // => [3, 2, 1]\n     *\n     * console.log(array);\n     * // => [3, 2, 1]\n     */\n    function reverse(array) {\n      return array ? nativeReverse.call(array) : array;\n    }\n\n    /**\n     * Creates a slice of `array` from `start` up to, but not including, `end`.\n     *\n     * **Note:** This method is used instead of\n     * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\n     * returned.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to slice.\n     * @param {number} [start=0] The start position.\n     * @param {number} [end=array.length] The end position.\n     * @returns {Array} Returns the slice of `array`.\n     */\n    function slice(array, start, end) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return [];\n      }\n      if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n        start = 0;\n        end = length;\n      }\n      else {\n        start = start == null ? 0 : toInteger(start);\n        end = end === undefined ? length : toInteger(end);\n      }\n      return baseSlice(array, start, end);\n    }\n\n    /**\n     * Uses a binary search to determine the lowest index at which `value`\n     * should be inserted into `array` in order to maintain its sort order.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The sorted array to inspect.\n     * @param {*} value The value to evaluate.\n     * @returns {number} Returns the index at which `value` should be inserted\n     *  into `array`.\n     * @example\n     *\n     * _.sortedIndex([30, 50], 40);\n     * // => 1\n     *\n     * _.sortedIndex([4, 5], 4);\n     * // => 0\n     */\n    function sortedIndex(array, value) {\n      return baseSortedIndex(array, value);\n    }\n\n    /**\n     * This method is like `_.sortedIndex` except that it accepts `iteratee`\n     * which is invoked for `value` and each element of `array` to compute their\n     * sort ranking. The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The sorted array to inspect.\n     * @param {*} value The value to evaluate.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {number} Returns the index at which `value` should be inserted\n     *  into `array`.\n     * @example\n     *\n     * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };\n     *\n     * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));\n     * // => 1\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\n     * // => 0\n     */\n    function sortedIndexBy(array, value, iteratee) {\n      return baseSortedIndexBy(array, value, getIteratee(iteratee));\n    }\n\n    /**\n     * This method is like `_.indexOf` except that it performs a binary\n     * search on a sorted `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to search.\n     * @param {*} value The value to search for.\n     * @returns {number} Returns the index of the matched value, else `-1`.\n     * @example\n     *\n     * _.sortedIndexOf([1, 1, 2, 2], 2);\n     * // => 2\n     */\n    function sortedIndexOf(array, value) {\n      var length = array ? array.length : 0;\n      if (length) {\n        var index = baseSortedIndex(array, value);\n        if (index < length && eq(array[index], value)) {\n          return index;\n        }\n      }\n      return -1;\n    }\n\n    /**\n     * This method is like `_.sortedIndex` except that it returns the highest\n     * index at which `value` should be inserted into `array` in order to\n     * maintain its sort order.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The sorted array to inspect.\n     * @param {*} value The value to evaluate.\n     * @returns {number} Returns the index at which `value` should be inserted\n     *  into `array`.\n     * @example\n     *\n     * _.sortedLastIndex([4, 5], 4);\n     * // => 1\n     */\n    function sortedLastIndex(array, value) {\n      return baseSortedIndex(array, value, true);\n    }\n\n    /**\n     * This method is like `_.sortedLastIndex` except that it accepts `iteratee`\n     * which is invoked for `value` and each element of `array` to compute their\n     * sort ranking. The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The sorted array to inspect.\n     * @param {*} value The value to evaluate.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {number} Returns the index at which `value` should be inserted\n     *  into `array`.\n     * @example\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\n     * // => 1\n     */\n    function sortedLastIndexBy(array, value, iteratee) {\n      return baseSortedIndexBy(array, value, getIteratee(iteratee), true);\n    }\n\n    /**\n     * This method is like `_.lastIndexOf` except that it performs a binary\n     * search on a sorted `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to search.\n     * @param {*} value The value to search for.\n     * @returns {number} Returns the index of the matched value, else `-1`.\n     * @example\n     *\n     * _.sortedLastIndexOf([1, 1, 2, 2], 2);\n     * // => 3\n     */\n    function sortedLastIndexOf(array, value) {\n      var length = array ? array.length : 0;\n      if (length) {\n        var index = baseSortedIndex(array, value, true) - 1;\n        if (eq(array[index], value)) {\n          return index;\n        }\n      }\n      return -1;\n    }\n\n    /**\n     * This method is like `_.uniq` except that it's designed and optimized\n     * for sorted arrays.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @returns {Array} Returns the new duplicate free array.\n     * @example\n     *\n     * _.sortedUniq([1, 1, 2]);\n     * // => [1, 2]\n     */\n    function sortedUniq(array) {\n      return (array && array.length)\n        ? baseSortedUniq(array)\n        : [];\n    }\n\n    /**\n     * This method is like `_.uniqBy` except that it's designed and optimized\n     * for sorted arrays.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @param {Function} [iteratee] The iteratee invoked per element.\n     * @returns {Array} Returns the new duplicate free array.\n     * @example\n     *\n     * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n     * // => [1.1, 2.3]\n     */\n    function sortedUniqBy(array, iteratee) {\n      return (array && array.length)\n        ? baseSortedUniqBy(array, getIteratee(iteratee))\n        : [];\n    }\n\n    /**\n     * Gets all but the first element of `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * _.tail([1, 2, 3]);\n     * // => [2, 3]\n     */\n    function tail(array) {\n      return drop(array, 1);\n    }\n\n    /**\n     * Creates a slice of `array` with `n` elements taken from the beginning.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {number} [n=1] The number of elements to take.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * _.take([1, 2, 3]);\n     * // => [1]\n     *\n     * _.take([1, 2, 3], 2);\n     * // => [1, 2]\n     *\n     * _.take([1, 2, 3], 5);\n     * // => [1, 2, 3]\n     *\n     * _.take([1, 2, 3], 0);\n     * // => []\n     */\n    function take(array, n, guard) {\n      if (!(array && array.length)) {\n        return [];\n      }\n      n = (guard || n === undefined) ? 1 : toInteger(n);\n      return baseSlice(array, 0, n < 0 ? 0 : n);\n    }\n\n    /**\n     * Creates a slice of `array` with `n` elements taken from the end.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {number} [n=1] The number of elements to take.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * _.takeRight([1, 2, 3]);\n     * // => [3]\n     *\n     * _.takeRight([1, 2, 3], 2);\n     * // => [2, 3]\n     *\n     * _.takeRight([1, 2, 3], 5);\n     * // => [1, 2, 3]\n     *\n     * _.takeRight([1, 2, 3], 0);\n     * // => []\n     */\n    function takeRight(array, n, guard) {\n      var length = array ? array.length : 0;\n      if (!length) {\n        return [];\n      }\n      n = (guard || n === undefined) ? 1 : toInteger(n);\n      n = length - n;\n      return baseSlice(array, n < 0 ? 0 : n, length);\n    }\n\n    /**\n     * Creates a slice of `array` with elements taken from the end. Elements are\n     * taken until `predicate` returns falsey. The predicate is invoked with\n     * three arguments: (value, index, array).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'active': true },\n     *   { 'user': 'fred',    'active': false },\n     *   { 'user': 'pebbles', 'active': false }\n     * ];\n     *\n     * _.takeRightWhile(users, function(o) { return !o.active; });\n     * // => objects for ['fred', 'pebbles']\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });\n     * // => objects for ['pebbles']\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.takeRightWhile(users, ['active', false]);\n     * // => objects for ['fred', 'pebbles']\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.takeRightWhile(users, 'active');\n     * // => []\n     */\n    function takeRightWhile(array, predicate) {\n      return (array && array.length)\n        ? baseWhile(array, getIteratee(predicate, 3), false, true)\n        : [];\n    }\n\n    /**\n     * Creates a slice of `array` with elements taken from the beginning. Elements\n     * are taken until `predicate` returns falsey. The predicate is invoked with\n     * three arguments: (value, index, array).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Array\n     * @param {Array} array The array to query.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the slice of `array`.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'active': false },\n     *   { 'user': 'fred',    'active': false},\n     *   { 'user': 'pebbles', 'active': true }\n     * ];\n     *\n     * _.takeWhile(users, function(o) { return !o.active; });\n     * // => objects for ['barney', 'fred']\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.takeWhile(users, { 'user': 'barney', 'active': false });\n     * // => objects for ['barney']\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.takeWhile(users, ['active', false]);\n     * // => objects for ['barney', 'fred']\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.takeWhile(users, 'active');\n     * // => []\n     */\n    function takeWhile(array, predicate) {\n      return (array && array.length)\n        ? baseWhile(array, getIteratee(predicate, 3))\n        : [];\n    }\n\n    /**\n     * Creates an array of unique values, in order, from all given arrays using\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @returns {Array} Returns the new array of combined values.\n     * @example\n     *\n     * _.union([2, 1], [4, 2], [1, 2]);\n     * // => [2, 1, 4]\n     */\n    var union = rest(function(arrays) {\n      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n    });\n\n    /**\n     * This method is like `_.union` except that it accepts `iteratee` which is\n     * invoked for each element of each `arrays` to generate the criterion by\n     * which uniqueness is computed. The iteratee is invoked with one argument:\n     * (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {Array} Returns the new array of combined values.\n     * @example\n     *\n     * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n     * // => [2.1, 1.2, 4.3]\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n     * // => [{ 'x': 1 }, { 'x': 2 }]\n     */\n    var unionBy = rest(function(arrays) {\n      var iteratee = last(arrays);\n      if (isArrayLikeObject(iteratee)) {\n        iteratee = undefined;\n      }\n      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee));\n    });\n\n    /**\n     * This method is like `_.union` except that it accepts `comparator` which\n     * is invoked to compare elements of `arrays`. The comparator is invoked\n     * with two arguments: (arrVal, othVal).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new array of combined values.\n     * @example\n     *\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n     *\n     * _.unionWith(objects, others, _.isEqual);\n     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n     */\n    var unionWith = rest(function(arrays) {\n      var comparator = last(arrays);\n      if (isArrayLikeObject(comparator)) {\n        comparator = undefined;\n      }\n      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);\n    });\n\n    /**\n     * Creates a duplicate-free version of an array, using\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons, in which only the first occurrence of each\n     * element is kept.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @returns {Array} Returns the new duplicate free array.\n     * @example\n     *\n     * _.uniq([2, 1, 2]);\n     * // => [2, 1]\n     */\n    function uniq(array) {\n      return (array && array.length)\n        ? baseUniq(array)\n        : [];\n    }\n\n    /**\n     * This method is like `_.uniq` except that it accepts `iteratee` which is\n     * invoked for each element in `array` to generate the criterion by which\n     * uniqueness is computed. The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {Array} Returns the new duplicate free array.\n     * @example\n     *\n     * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n     * // => [2.1, 1.2]\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n     * // => [{ 'x': 1 }, { 'x': 2 }]\n     */\n    function uniqBy(array, iteratee) {\n      return (array && array.length)\n        ? baseUniq(array, getIteratee(iteratee))\n        : [];\n    }\n\n    /**\n     * This method is like `_.uniq` except that it accepts `comparator` which\n     * is invoked to compare elements of `array`. The comparator is invoked with\n     * two arguments: (arrVal, othVal).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {Array} array The array to inspect.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new duplicate free array.\n     * @example\n     *\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 },  { 'x': 1, 'y': 2 }];\n     *\n     * _.uniqWith(objects, _.isEqual);\n     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n     */\n    function uniqWith(array, comparator) {\n      return (array && array.length)\n        ? baseUniq(array, undefined, comparator)\n        : [];\n    }\n\n    /**\n     * This method is like `_.zip` except that it accepts an array of grouped\n     * elements and creates an array regrouping the elements to their pre-zip\n     * configuration.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.2.0\n     * @category Array\n     * @param {Array} array The array of grouped elements to process.\n     * @returns {Array} Returns the new array of regrouped elements.\n     * @example\n     *\n     * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);\n     * // => [['fred', 30, true], ['barney', 40, false]]\n     *\n     * _.unzip(zipped);\n     * // => [['fred', 'barney'], [30, 40], [true, false]]\n     */\n    function unzip(array) {\n      if (!(array && array.length)) {\n        return [];\n      }\n      var length = 0;\n      array = arrayFilter(array, function(group) {\n        if (isArrayLikeObject(group)) {\n          length = nativeMax(group.length, length);\n          return true;\n        }\n      });\n      return baseTimes(length, function(index) {\n        return arrayMap(array, baseProperty(index));\n      });\n    }\n\n    /**\n     * This method is like `_.unzip` except that it accepts `iteratee` to specify\n     * how regrouped values should be combined. The iteratee is invoked with the\n     * elements of each group: (...group).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.8.0\n     * @category Array\n     * @param {Array} array The array of grouped elements to process.\n     * @param {Function} [iteratee=_.identity] The function to combine\n     *  regrouped values.\n     * @returns {Array} Returns the new array of regrouped elements.\n     * @example\n     *\n     * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n     * // => [[1, 10, 100], [2, 20, 200]]\n     *\n     * _.unzipWith(zipped, _.add);\n     * // => [3, 30, 300]\n     */\n    function unzipWith(array, iteratee) {\n      if (!(array && array.length)) {\n        return [];\n      }\n      var result = unzip(array);\n      if (iteratee == null) {\n        return result;\n      }\n      return arrayMap(result, function(group) {\n        return apply(iteratee, undefined, group);\n      });\n    }\n\n    /**\n     * Creates an array excluding all given values using\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * for equality comparisons.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {Array} array The array to filter.\n     * @param {...*} [values] The values to exclude.\n     * @returns {Array} Returns the new array of filtered values.\n     * @example\n     *\n     * _.without([1, 2, 1, 3], 1, 2);\n     * // => [3]\n     */\n    var without = rest(function(array, values) {\n      return isArrayLikeObject(array)\n        ? baseDifference(array, values)\n        : [];\n    });\n\n    /**\n     * Creates an array of unique values that is the\n     * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n     * of the given arrays. The order of result values is determined by the order\n     * they occur in the arrays.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.4.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @returns {Array} Returns the new array of values.\n     * @example\n     *\n     * _.xor([2, 1], [4, 2]);\n     * // => [1, 4]\n     */\n    var xor = rest(function(arrays) {\n      return baseXor(arrayFilter(arrays, isArrayLikeObject));\n    });\n\n    /**\n     * This method is like `_.xor` except that it accepts `iteratee` which is\n     * invoked for each element of each `arrays` to generate the criterion by\n     * which by which they're compared. The iteratee is invoked with one argument:\n     * (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {Array} Returns the new array of values.\n     * @example\n     *\n     * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n     * // => [1.2, 4.3]\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n     * // => [{ 'x': 2 }]\n     */\n    var xorBy = rest(function(arrays) {\n      var iteratee = last(arrays);\n      if (isArrayLikeObject(iteratee)) {\n        iteratee = undefined;\n      }\n      return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee));\n    });\n\n    /**\n     * This method is like `_.xor` except that it accepts `comparator` which is\n     * invoked to compare elements of `arrays`. The comparator is invoked with\n     * two arguments: (arrVal, othVal).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to inspect.\n     * @param {Function} [comparator] The comparator invoked per element.\n     * @returns {Array} Returns the new array of values.\n     * @example\n     *\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n     *\n     * _.xorWith(objects, others, _.isEqual);\n     * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n     */\n    var xorWith = rest(function(arrays) {\n      var comparator = last(arrays);\n      if (isArrayLikeObject(comparator)) {\n        comparator = undefined;\n      }\n      return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);\n    });\n\n    /**\n     * Creates an array of grouped elements, the first of which contains the\n     * first elements of the given arrays, the second of which contains the\n     * second elements of the given arrays, and so on.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to process.\n     * @returns {Array} Returns the new array of grouped elements.\n     * @example\n     *\n     * _.zip(['fred', 'barney'], [30, 40], [true, false]);\n     * // => [['fred', 30, true], ['barney', 40, false]]\n     */\n    var zip = rest(unzip);\n\n    /**\n     * This method is like `_.fromPairs` except that it accepts two arrays,\n     * one of property identifiers and one of corresponding values.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.4.0\n     * @category Array\n     * @param {Array} [props=[]] The property identifiers.\n     * @param {Array} [values=[]] The property values.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * _.zipObject(['a', 'b'], [1, 2]);\n     * // => { 'a': 1, 'b': 2 }\n     */\n    function zipObject(props, values) {\n      return baseZipObject(props || [], values || [], assignValue);\n    }\n\n    /**\n     * This method is like `_.zipObject` except that it supports property paths.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.1.0\n     * @category Array\n     * @param {Array} [props=[]] The property identifiers.\n     * @param {Array} [values=[]] The property values.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);\n     * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n     */\n    function zipObjectDeep(props, values) {\n      return baseZipObject(props || [], values || [], baseSet);\n    }\n\n    /**\n     * This method is like `_.zip` except that it accepts `iteratee` to specify\n     * how grouped values should be combined. The iteratee is invoked with the\n     * elements of each group: (...group).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.8.0\n     * @category Array\n     * @param {...Array} [arrays] The arrays to process.\n     * @param {Function} [iteratee=_.identity] The function to combine grouped values.\n     * @returns {Array} Returns the new array of grouped elements.\n     * @example\n     *\n     * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {\n     *   return a + b + c;\n     * });\n     * // => [111, 222]\n     */\n    var zipWith = rest(function(arrays) {\n      var length = arrays.length,\n          iteratee = length > 1 ? arrays[length - 1] : undefined;\n\n      iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;\n      return unzipWith(arrays, iteratee);\n    });\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates a `lodash` wrapper instance that wraps `value` with explicit method\n     * chain sequences enabled. The result of such sequences must be unwrapped\n     * with `_#value`.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.3.0\n     * @category Seq\n     * @param {*} value The value to wrap.\n     * @returns {Object} Returns the new `lodash` wrapper instance.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'age': 36 },\n     *   { 'user': 'fred',    'age': 40 },\n     *   { 'user': 'pebbles', 'age': 1 }\n     * ];\n     *\n     * var youngest = _\n     *   .chain(users)\n     *   .sortBy('age')\n     *   .map(function(o) {\n     *     return o.user + ' is ' + o.age;\n     *   })\n     *   .head()\n     *   .value();\n     * // => 'pebbles is 1'\n     */\n    function chain(value) {\n      var result = lodash(value);\n      result.__chain__ = true;\n      return result;\n    }\n\n    /**\n     * This method invokes `interceptor` and returns `value`. The interceptor\n     * is invoked with one argument; (value). The purpose of this method is to\n     * \"tap into\" a method chain sequence in order to modify intermediate results.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Seq\n     * @param {*} value The value to provide to `interceptor`.\n     * @param {Function} interceptor The function to invoke.\n     * @returns {*} Returns `value`.\n     * @example\n     *\n     * _([1, 2, 3])\n     *  .tap(function(array) {\n     *    // Mutate input array.\n     *    array.pop();\n     *  })\n     *  .reverse()\n     *  .value();\n     * // => [2, 1]\n     */\n    function tap(value, interceptor) {\n      interceptor(value);\n      return value;\n    }\n\n    /**\n     * This method is like `_.tap` except that it returns the result of `interceptor`.\n     * The purpose of this method is to \"pass thru\" values replacing intermediate\n     * results in a method chain sequence.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Seq\n     * @param {*} value The value to provide to `interceptor`.\n     * @param {Function} interceptor The function to invoke.\n     * @returns {*} Returns the result of `interceptor`.\n     * @example\n     *\n     * _('  abc  ')\n     *  .chain()\n     *  .trim()\n     *  .thru(function(value) {\n     *    return [value];\n     *  })\n     *  .value();\n     * // => ['abc']\n     */\n    function thru(value, interceptor) {\n      return interceptor(value);\n    }\n\n    /**\n     * This method is the wrapper version of `_.at`.\n     *\n     * @name at\n     * @memberOf _\n     * @since 1.0.0\n     * @category Seq\n     * @param {...(string|string[])} [paths] The property paths of elements to pick.\n     * @returns {Object} Returns the new `lodash` wrapper instance.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n     *\n     * _(object).at(['a[0].b.c', 'a[1]']).value();\n     * // => [3, 4]\n     *\n     * _(['a', 'b', 'c']).at(0, 2).value();\n     * // => ['a', 'c']\n     */\n    var wrapperAt = rest(function(paths) {\n      paths = baseFlatten(paths, 1);\n      var length = paths.length,\n          start = length ? paths[0] : 0,\n          value = this.__wrapped__,\n          interceptor = function(object) { return baseAt(object, paths); };\n\n      if (length > 1 || this.__actions__.length ||\n          !(value instanceof LazyWrapper) || !isIndex(start)) {\n        return this.thru(interceptor);\n      }\n      value = value.slice(start, +start + (length ? 1 : 0));\n      value.__actions__.push({\n        'func': thru,\n        'args': [interceptor],\n        'thisArg': undefined\n      });\n      return new LodashWrapper(value, this.__chain__).thru(function(array) {\n        if (length && !array.length) {\n          array.push(undefined);\n        }\n        return array;\n      });\n    });\n\n    /**\n     * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.\n     *\n     * @name chain\n     * @memberOf _\n     * @since 0.1.0\n     * @category Seq\n     * @returns {Object} Returns the new `lodash` wrapper instance.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney', 'age': 36 },\n     *   { 'user': 'fred',   'age': 40 }\n     * ];\n     *\n     * // A sequence without explicit chaining.\n     * _(users).head();\n     * // => { 'user': 'barney', 'age': 36 }\n     *\n     * // A sequence with explicit chaining.\n     * _(users)\n     *   .chain()\n     *   .head()\n     *   .pick('user')\n     *   .value();\n     * // => { 'user': 'barney' }\n     */\n    function wrapperChain() {\n      return chain(this);\n    }\n\n    /**\n     * Executes the chain sequence and returns the wrapped result.\n     *\n     * @name commit\n     * @memberOf _\n     * @since 3.2.0\n     * @category Seq\n     * @returns {Object} Returns the new `lodash` wrapper instance.\n     * @example\n     *\n     * var array = [1, 2];\n     * var wrapped = _(array).push(3);\n     *\n     * console.log(array);\n     * // => [1, 2]\n     *\n     * wrapped = wrapped.commit();\n     * console.log(array);\n     * // => [1, 2, 3]\n     *\n     * wrapped.last();\n     * // => 3\n     *\n     * console.log(array);\n     * // => [1, 2, 3]\n     */\n    function wrapperCommit() {\n      return new LodashWrapper(this.value(), this.__chain__);\n    }\n\n    /**\n     * Gets the next value on a wrapped object following the\n     * [iterator protocol](https://mdn.io/iteration_protocols#iterator).\n     *\n     * @name next\n     * @memberOf _\n     * @since 4.0.0\n     * @category Seq\n     * @returns {Object} Returns the next iterator value.\n     * @example\n     *\n     * var wrapped = _([1, 2]);\n     *\n     * wrapped.next();\n     * // => { 'done': false, 'value': 1 }\n     *\n     * wrapped.next();\n     * // => { 'done': false, 'value': 2 }\n     *\n     * wrapped.next();\n     * // => { 'done': true, 'value': undefined }\n     */\n    function wrapperNext() {\n      if (this.__values__ === undefined) {\n        this.__values__ = toArray(this.value());\n      }\n      var done = this.__index__ >= this.__values__.length,\n          value = done ? undefined : this.__values__[this.__index__++];\n\n      return { 'done': done, 'value': value };\n    }\n\n    /**\n     * Enables the wrapper to be iterable.\n     *\n     * @name Symbol.iterator\n     * @memberOf _\n     * @since 4.0.0\n     * @category Seq\n     * @returns {Object} Returns the wrapper object.\n     * @example\n     *\n     * var wrapped = _([1, 2]);\n     *\n     * wrapped[Symbol.iterator]() === wrapped;\n     * // => true\n     *\n     * Array.from(wrapped);\n     * // => [1, 2]\n     */\n    function wrapperToIterator() {\n      return this;\n    }\n\n    /**\n     * Creates a clone of the chain sequence planting `value` as the wrapped value.\n     *\n     * @name plant\n     * @memberOf _\n     * @since 3.2.0\n     * @category Seq\n     * @param {*} value The value to plant.\n     * @returns {Object} Returns the new `lodash` wrapper instance.\n     * @example\n     *\n     * function square(n) {\n     *   return n * n;\n     * }\n     *\n     * var wrapped = _([1, 2]).map(square);\n     * var other = wrapped.plant([3, 4]);\n     *\n     * other.value();\n     * // => [9, 16]\n     *\n     * wrapped.value();\n     * // => [1, 4]\n     */\n    function wrapperPlant(value) {\n      var result,\n          parent = this;\n\n      while (parent instanceof baseLodash) {\n        var clone = wrapperClone(parent);\n        clone.__index__ = 0;\n        clone.__values__ = undefined;\n        if (result) {\n          previous.__wrapped__ = clone;\n        } else {\n          result = clone;\n        }\n        var previous = clone;\n        parent = parent.__wrapped__;\n      }\n      previous.__wrapped__ = value;\n      return result;\n    }\n\n    /**\n     * This method is the wrapper version of `_.reverse`.\n     *\n     * **Note:** This method mutates the wrapped array.\n     *\n     * @name reverse\n     * @memberOf _\n     * @since 0.1.0\n     * @category Seq\n     * @returns {Object} Returns the new `lodash` wrapper instance.\n     * @example\n     *\n     * var array = [1, 2, 3];\n     *\n     * _(array).reverse().value()\n     * // => [3, 2, 1]\n     *\n     * console.log(array);\n     * // => [3, 2, 1]\n     */\n    function wrapperReverse() {\n      var value = this.__wrapped__;\n      if (value instanceof LazyWrapper) {\n        var wrapped = value;\n        if (this.__actions__.length) {\n          wrapped = new LazyWrapper(this);\n        }\n        wrapped = wrapped.reverse();\n        wrapped.__actions__.push({\n          'func': thru,\n          'args': [reverse],\n          'thisArg': undefined\n        });\n        return new LodashWrapper(wrapped, this.__chain__);\n      }\n      return this.thru(reverse);\n    }\n\n    /**\n     * Executes the chain sequence to resolve the unwrapped value.\n     *\n     * @name value\n     * @memberOf _\n     * @since 0.1.0\n     * @alias toJSON, valueOf\n     * @category Seq\n     * @returns {*} Returns the resolved unwrapped value.\n     * @example\n     *\n     * _([1, 2, 3]).value();\n     * // => [1, 2, 3]\n     */\n    function wrapperValue() {\n      return baseWrapperValue(this.__wrapped__, this.__actions__);\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Creates an object composed of keys generated from the results of running\n     * each element of `collection` thru `iteratee`. The corresponding value of\n     * each key is the number of times the key was returned by `iteratee`. The\n     * iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.5.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee to transform keys.\n     * @returns {Object} Returns the composed aggregate object.\n     * @example\n     *\n     * _.countBy([6.1, 4.2, 6.3], Math.floor);\n     * // => { '4': 1, '6': 2 }\n     *\n     * _.countBy(['one', 'two', 'three'], 'length');\n     * // => { '3': 2, '5': 1 }\n     */\n    var countBy = createAggregator(function(result, value, key) {\n      hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);\n    });\n\n    /**\n     * Checks if `predicate` returns truthy for **all** elements of `collection`.\n     * Iteration is stopped once `predicate` returns falsey. The predicate is\n     * invoked with three arguments: (value, index|key, collection).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {boolean} Returns `true` if all elements pass the predicate check,\n     *  else `false`.\n     * @example\n     *\n     * _.every([true, 1, null, 'yes'], Boolean);\n     * // => false\n     *\n     * var users = [\n     *   { 'user': 'barney', 'age': 36, 'active': false },\n     *   { 'user': 'fred',   'age': 40, 'active': false }\n     * ];\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.every(users, { 'user': 'barney', 'active': false });\n     * // => false\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.every(users, ['active', false]);\n     * // => true\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.every(users, 'active');\n     * // => false\n     */\n    function every(collection, predicate, guard) {\n      var func = isArray(collection) ? arrayEvery : baseEvery;\n      if (guard && isIterateeCall(collection, predicate, guard)) {\n        predicate = undefined;\n      }\n      return func(collection, getIteratee(predicate, 3));\n    }\n\n    /**\n     * Iterates over elements of `collection`, returning an array of all elements\n     * `predicate` returns truthy for. The predicate is invoked with three\n     * arguments: (value, index|key, collection).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the new filtered array.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney', 'age': 36, 'active': true },\n     *   { 'user': 'fred',   'age': 40, 'active': false }\n     * ];\n     *\n     * _.filter(users, function(o) { return !o.active; });\n     * // => objects for ['fred']\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.filter(users, { 'age': 36, 'active': true });\n     * // => objects for ['barney']\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.filter(users, ['active', false]);\n     * // => objects for ['fred']\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.filter(users, 'active');\n     * // => objects for ['barney']\n     */\n    function filter(collection, predicate) {\n      var func = isArray(collection) ? arrayFilter : baseFilter;\n      return func(collection, getIteratee(predicate, 3));\n    }\n\n    /**\n     * Iterates over elements of `collection`, returning the first element\n     * `predicate` returns truthy for. The predicate is invoked with three\n     * arguments: (value, index|key, collection).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to search.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {*} Returns the matched element, else `undefined`.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'age': 36, 'active': true },\n     *   { 'user': 'fred',    'age': 40, 'active': false },\n     *   { 'user': 'pebbles', 'age': 1,  'active': true }\n     * ];\n     *\n     * _.find(users, function(o) { return o.age < 40; });\n     * // => object for 'barney'\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.find(users, { 'age': 1, 'active': true });\n     * // => object for 'pebbles'\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.find(users, ['active', false]);\n     * // => object for 'fred'\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.find(users, 'active');\n     * // => object for 'barney'\n     */\n    function find(collection, predicate) {\n      predicate = getIteratee(predicate, 3);\n      if (isArray(collection)) {\n        var index = baseFindIndex(collection, predicate);\n        return index > -1 ? collection[index] : undefined;\n      }\n      return baseFind(collection, predicate, baseEach);\n    }\n\n    /**\n     * This method is like `_.find` except that it iterates over elements of\n     * `collection` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to search.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {*} Returns the matched element, else `undefined`.\n     * @example\n     *\n     * _.findLast([1, 2, 3, 4], function(n) {\n     *   return n % 2 == 1;\n     * });\n     * // => 3\n     */\n    function findLast(collection, predicate) {\n      predicate = getIteratee(predicate, 3);\n      if (isArray(collection)) {\n        var index = baseFindIndex(collection, predicate, true);\n        return index > -1 ? collection[index] : undefined;\n      }\n      return baseFind(collection, predicate, baseEachRight);\n    }\n\n    /**\n     * Creates a flattened array of values by running each element in `collection`\n     * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n     * with three arguments: (value, index|key, collection).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the new flattened array.\n     * @example\n     *\n     * function duplicate(n) {\n     *   return [n, n];\n     * }\n     *\n     * _.flatMap([1, 2], duplicate);\n     * // => [1, 1, 2, 2]\n     */\n    function flatMap(collection, iteratee) {\n      return baseFlatten(map(collection, iteratee), 1);\n    }\n\n    /**\n     * This method is like `_.flatMap` except that it recursively flattens the\n     * mapped results.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.7.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the new flattened array.\n     * @example\n     *\n     * function duplicate(n) {\n     *   return [[[n, n]]];\n     * }\n     *\n     * _.flatMapDeep([1, 2], duplicate);\n     * // => [1, 1, 2, 2]\n     */\n    function flatMapDeep(collection, iteratee) {\n      return baseFlatten(map(collection, iteratee), INFINITY);\n    }\n\n    /**\n     * This method is like `_.flatMap` except that it recursively flattens the\n     * mapped results up to `depth` times.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.7.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The function invoked per iteration.\n     * @param {number} [depth=1] The maximum recursion depth.\n     * @returns {Array} Returns the new flattened array.\n     * @example\n     *\n     * function duplicate(n) {\n     *   return [[[n, n]]];\n     * }\n     *\n     * _.flatMapDepth([1, 2], duplicate, 2);\n     * // => [[1, 1], [2, 2]]\n     */\n    function flatMapDepth(collection, iteratee, depth) {\n      depth = depth === undefined ? 1 : toInteger(depth);\n      return baseFlatten(map(collection, iteratee), depth);\n    }\n\n    /**\n     * Iterates over elements of `collection` and invokes `iteratee` for each element.\n     * The iteratee is invoked with three arguments: (value, index|key, collection).\n     * Iteratee functions may exit iteration early by explicitly returning `false`.\n     *\n     * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n     * property are iterated like arrays. To avoid this behavior use `_.forIn`\n     * or `_.forOwn` for object iteration.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @alias each\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @returns {Array|Object} Returns `collection`.\n     * @example\n     *\n     * _([1, 2]).forEach(function(value) {\n     *   console.log(value);\n     * });\n     * // => Logs `1` then `2`.\n     *\n     * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n     *   console.log(key);\n     * });\n     * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n     */\n    function forEach(collection, iteratee) {\n      return (typeof iteratee == 'function' && isArray(collection))\n        ? arrayEach(collection, iteratee)\n        : baseEach(collection, getIteratee(iteratee));\n    }\n\n    /**\n     * This method is like `_.forEach` except that it iterates over elements of\n     * `collection` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @alias eachRight\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @returns {Array|Object} Returns `collection`.\n     * @example\n     *\n     * _.forEachRight([1, 2], function(value) {\n     *   console.log(value);\n     * });\n     * // => Logs `2` then `1`.\n     */\n    function forEachRight(collection, iteratee) {\n      return (typeof iteratee == 'function' && isArray(collection))\n        ? arrayEachRight(collection, iteratee)\n        : baseEachRight(collection, getIteratee(iteratee));\n    }\n\n    /**\n     * Creates an object composed of keys generated from the results of running\n     * each element of `collection` thru `iteratee`. The order of grouped values\n     * is determined by the order they occur in `collection`. The corresponding\n     * value of each key is an array of elements responsible for generating the\n     * key. The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee to transform keys.\n     * @returns {Object} Returns the composed aggregate object.\n     * @example\n     *\n     * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n     * // => { '4': [4.2], '6': [6.1, 6.3] }\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.groupBy(['one', 'two', 'three'], 'length');\n     * // => { '3': ['one', 'two'], '5': ['three'] }\n     */\n    var groupBy = createAggregator(function(result, value, key) {\n      if (hasOwnProperty.call(result, key)) {\n        result[key].push(value);\n      } else {\n        result[key] = [value];\n      }\n    });\n\n    /**\n     * Checks if `value` is in `collection`. If `collection` is a string, it's\n     * checked for a substring of `value`, otherwise\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * is used for equality comparisons. If `fromIndex` is negative, it's used as\n     * the offset from the end of `collection`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object|string} collection The collection to search.\n     * @param {*} value The value to search for.\n     * @param {number} [fromIndex=0] The index to search from.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n     * @returns {boolean} Returns `true` if `value` is found, else `false`.\n     * @example\n     *\n     * _.includes([1, 2, 3], 1);\n     * // => true\n     *\n     * _.includes([1, 2, 3], 1, 2);\n     * // => false\n     *\n     * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');\n     * // => true\n     *\n     * _.includes('pebbles', 'eb');\n     * // => true\n     */\n    function includes(collection, value, fromIndex, guard) {\n      collection = isArrayLike(collection) ? collection : values(collection);\n      fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n      var length = collection.length;\n      if (fromIndex < 0) {\n        fromIndex = nativeMax(length + fromIndex, 0);\n      }\n      return isString(collection)\n        ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n        : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n    }\n\n    /**\n     * Invokes the method at `path` of each element in `collection`, returning\n     * an array of the results of each invoked method. Any additional arguments\n     * are provided to each invoked method. If `methodName` is a function, it's\n     * invoked for and `this` bound to, each element in `collection`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|string} path The path of the method to invoke or\n     *  the function invoked per iteration.\n     * @param {...*} [args] The arguments to invoke each method with.\n     * @returns {Array} Returns the array of results.\n     * @example\n     *\n     * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n     * // => [[1, 5, 7], [1, 2, 3]]\n     *\n     * _.invokeMap([123, 456], String.prototype.split, '');\n     * // => [['1', '2', '3'], ['4', '5', '6']]\n     */\n    var invokeMap = rest(function(collection, path, args) {\n      var index = -1,\n          isFunc = typeof path == 'function',\n          isProp = isKey(path),\n          result = isArrayLike(collection) ? Array(collection.length) : [];\n\n      baseEach(collection, function(value) {\n        var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);\n        result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args);\n      });\n      return result;\n    });\n\n    /**\n     * Creates an object composed of keys generated from the results of running\n     * each element of `collection` thru `iteratee`. The corresponding value of\n     * each key is the last element responsible for generating the key. The\n     * iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee to transform keys.\n     * @returns {Object} Returns the composed aggregate object.\n     * @example\n     *\n     * var array = [\n     *   { 'dir': 'left', 'code': 97 },\n     *   { 'dir': 'right', 'code': 100 }\n     * ];\n     *\n     * _.keyBy(array, function(o) {\n     *   return String.fromCharCode(o.code);\n     * });\n     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n     *\n     * _.keyBy(array, 'dir');\n     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n     */\n    var keyBy = createAggregator(function(result, value, key) {\n      result[key] = value;\n    });\n\n    /**\n     * Creates an array of values by running each element in `collection` thru\n     * `iteratee`. The iteratee is invoked with three arguments:\n     * (value, index|key, collection).\n     *\n     * Many lodash methods are guarded to work as iteratees for methods like\n     * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n     *\n     * The guarded methods are:\n     * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n     * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n     * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n     * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the new mapped array.\n     * @example\n     *\n     * function square(n) {\n     *   return n * n;\n     * }\n     *\n     * _.map([4, 8], square);\n     * // => [16, 64]\n     *\n     * _.map({ 'a': 4, 'b': 8 }, square);\n     * // => [16, 64] (iteration order is not guaranteed)\n     *\n     * var users = [\n     *   { 'user': 'barney' },\n     *   { 'user': 'fred' }\n     * ];\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.map(users, 'user');\n     * // => ['barney', 'fred']\n     */\n    function map(collection, iteratee) {\n      var func = isArray(collection) ? arrayMap : baseMap;\n      return func(collection, getIteratee(iteratee, 3));\n    }\n\n    /**\n     * This method is like `_.sortBy` except that it allows specifying the sort\n     * orders of the iteratees to sort by. If `orders` is unspecified, all values\n     * are sorted in ascending order. Otherwise, specify an order of \"desc\" for\n     * descending or \"asc\" for ascending sort order of corresponding values.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]\n     *  The iteratees to sort by.\n     * @param {string[]} [orders] The sort orders of `iteratees`.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n     * @returns {Array} Returns the new sorted array.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'fred',   'age': 48 },\n     *   { 'user': 'barney', 'age': 34 },\n     *   { 'user': 'fred',   'age': 40 },\n     *   { 'user': 'barney', 'age': 36 }\n     * ];\n     *\n     * // Sort by `user` in ascending order and by `age` in descending order.\n     * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);\n     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n     */\n    function orderBy(collection, iteratees, orders, guard) {\n      if (collection == null) {\n        return [];\n      }\n      if (!isArray(iteratees)) {\n        iteratees = iteratees == null ? [] : [iteratees];\n      }\n      orders = guard ? undefined : orders;\n      if (!isArray(orders)) {\n        orders = orders == null ? [] : [orders];\n      }\n      return baseOrderBy(collection, iteratees, orders);\n    }\n\n    /**\n     * Creates an array of elements split into two groups, the first of which\n     * contains elements `predicate` returns truthy for, the second of which\n     * contains elements `predicate` returns falsey for. The predicate is\n     * invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the array of grouped elements.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney',  'age': 36, 'active': false },\n     *   { 'user': 'fred',    'age': 40, 'active': true },\n     *   { 'user': 'pebbles', 'age': 1,  'active': false }\n     * ];\n     *\n     * _.partition(users, function(o) { return o.active; });\n     * // => objects for [['fred'], ['barney', 'pebbles']]\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.partition(users, { 'age': 1, 'active': false });\n     * // => objects for [['pebbles'], ['barney', 'fred']]\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.partition(users, ['active', false]);\n     * // => objects for [['barney', 'pebbles'], ['fred']]\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.partition(users, 'active');\n     * // => objects for [['fred'], ['barney', 'pebbles']]\n     */\n    var partition = createAggregator(function(result, value, key) {\n      result[key ? 0 : 1].push(value);\n    }, function() { return [[], []]; });\n\n    /**\n     * Reduces `collection` to a value which is the accumulated result of running\n     * each element in `collection` thru `iteratee`, where each successive\n     * invocation is supplied the return value of the previous. If `accumulator`\n     * is not given, the first element of `collection` is used as the initial\n     * value. The iteratee is invoked with four arguments:\n     * (accumulator, value, index|key, collection).\n     *\n     * Many lodash methods are guarded to work as iteratees for methods like\n     * `_.reduce`, `_.reduceRight`, and `_.transform`.\n     *\n     * The guarded methods are:\n     * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n     * and `sortBy`\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @param {*} [accumulator] The initial value.\n     * @returns {*} Returns the accumulated value.\n     * @example\n     *\n     * _.reduce([1, 2], function(sum, n) {\n     *   return sum + n;\n     * }, 0);\n     * // => 3\n     *\n     * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n     *   (result[value] || (result[value] = [])).push(key);\n     *   return result;\n     * }, {});\n     * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n     */\n    function reduce(collection, iteratee, accumulator) {\n      var func = isArray(collection) ? arrayReduce : baseReduce,\n          initAccum = arguments.length < 3;\n\n      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n    }\n\n    /**\n     * This method is like `_.reduce` except that it iterates over elements of\n     * `collection` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @param {*} [accumulator] The initial value.\n     * @returns {*} Returns the accumulated value.\n     * @example\n     *\n     * var array = [[0, 1], [2, 3], [4, 5]];\n     *\n     * _.reduceRight(array, function(flattened, other) {\n     *   return flattened.concat(other);\n     * }, []);\n     * // => [4, 5, 2, 3, 0, 1]\n     */\n    function reduceRight(collection, iteratee, accumulator) {\n      var func = isArray(collection) ? arrayReduceRight : baseReduce,\n          initAccum = arguments.length < 3;\n\n      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);\n    }\n\n    /**\n     * The opposite of `_.filter`; this method returns the elements of `collection`\n     * that `predicate` does **not** return truthy for.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Array} Returns the new filtered array.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney', 'age': 36, 'active': false },\n     *   { 'user': 'fred',   'age': 40, 'active': true }\n     * ];\n     *\n     * _.reject(users, function(o) { return !o.active; });\n     * // => objects for ['fred']\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.reject(users, { 'age': 40, 'active': true });\n     * // => objects for ['barney']\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.reject(users, ['active', false]);\n     * // => objects for ['fred']\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.reject(users, 'active');\n     * // => objects for ['barney']\n     */\n    function reject(collection, predicate) {\n      var func = isArray(collection) ? arrayFilter : baseFilter;\n      predicate = getIteratee(predicate, 3);\n      return func(collection, function(value, index, collection) {\n        return !predicate(value, index, collection);\n      });\n    }\n\n    /**\n     * Gets a random element from `collection`.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to sample.\n     * @returns {*} Returns the random element.\n     * @example\n     *\n     * _.sample([1, 2, 3, 4]);\n     * // => 2\n     */\n    function sample(collection) {\n      var array = isArrayLike(collection) ? collection : values(collection),\n          length = array.length;\n\n      return length > 0 ? array[baseRandom(0, length - 1)] : undefined;\n    }\n\n    /**\n     * Gets `n` random elements at unique keys from `collection` up to the\n     * size of `collection`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to sample.\n     * @param {number} [n=1] The number of elements to sample.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Array} Returns the random elements.\n     * @example\n     *\n     * _.sampleSize([1, 2, 3], 2);\n     * // => [3, 1]\n     *\n     * _.sampleSize([1, 2, 3], 4);\n     * // => [2, 3, 1]\n     */\n    function sampleSize(collection, n, guard) {\n      var index = -1,\n          result = toArray(collection),\n          length = result.length,\n          lastIndex = length - 1;\n\n      if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n        n = 1;\n      } else {\n        n = baseClamp(toInteger(n), 0, length);\n      }\n      while (++index < n) {\n        var rand = baseRandom(index, lastIndex),\n            value = result[rand];\n\n        result[rand] = result[index];\n        result[index] = value;\n      }\n      result.length = n;\n      return result;\n    }\n\n    /**\n     * Creates an array of shuffled values, using a version of the\n     * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to shuffle.\n     * @returns {Array} Returns the new shuffled array.\n     * @example\n     *\n     * _.shuffle([1, 2, 3, 4]);\n     * // => [4, 1, 3, 2]\n     */\n    function shuffle(collection) {\n      return sampleSize(collection, MAX_ARRAY_LENGTH);\n    }\n\n    /**\n     * Gets the size of `collection` by returning its length for array-like\n     * values or the number of own enumerable string keyed properties for objects.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to inspect.\n     * @returns {number} Returns the collection size.\n     * @example\n     *\n     * _.size([1, 2, 3]);\n     * // => 3\n     *\n     * _.size({ 'a': 1, 'b': 2 });\n     * // => 2\n     *\n     * _.size('pebbles');\n     * // => 7\n     */\n    function size(collection) {\n      if (collection == null) {\n        return 0;\n      }\n      if (isArrayLike(collection)) {\n        var result = collection.length;\n        return (result && isString(collection)) ? stringSize(collection) : result;\n      }\n      if (isObjectLike(collection)) {\n        var tag = getTag(collection);\n        if (tag == mapTag || tag == setTag) {\n          return collection.size;\n        }\n      }\n      return keys(collection).length;\n    }\n\n    /**\n     * Checks if `predicate` returns truthy for **any** element of `collection`.\n     * Iteration is stopped once `predicate` returns truthy. The predicate is\n     * invoked with three arguments: (value, index|key, collection).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {boolean} Returns `true` if any element passes the predicate check,\n     *  else `false`.\n     * @example\n     *\n     * _.some([null, 0, 'yes', false], Boolean);\n     * // => true\n     *\n     * var users = [\n     *   { 'user': 'barney', 'active': true },\n     *   { 'user': 'fred',   'active': false }\n     * ];\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.some(users, { 'user': 'barney', 'active': false });\n     * // => false\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.some(users, ['active', false]);\n     * // => true\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.some(users, 'active');\n     * // => true\n     */\n    function some(collection, predicate, guard) {\n      var func = isArray(collection) ? arraySome : baseSome;\n      if (guard && isIterateeCall(collection, predicate, guard)) {\n        predicate = undefined;\n      }\n      return func(collection, getIteratee(predicate, 3));\n    }\n\n    /**\n     * Creates an array of elements, sorted in ascending order by the results of\n     * running each element in a collection thru each iteratee. This method\n     * performs a stable sort, that is, it preserves the original sort order of\n     * equal elements. The iteratees are invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Collection\n     * @param {Array|Object} collection The collection to iterate over.\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\n     *  [iteratees=[_.identity]] The iteratees to sort by.\n     * @returns {Array} Returns the new sorted array.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'fred',   'age': 48 },\n     *   { 'user': 'barney', 'age': 36 },\n     *   { 'user': 'fred',   'age': 40 },\n     *   { 'user': 'barney', 'age': 34 }\n     * ];\n     *\n     * _.sortBy(users, function(o) { return o.user; });\n     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n     *\n     * _.sortBy(users, ['user', 'age']);\n     * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]\n     *\n     * _.sortBy(users, 'user', function(o) {\n     *   return Math.floor(o.age / 10);\n     * });\n     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n     */\n    var sortBy = rest(function(collection, iteratees) {\n      if (collection == null) {\n        return [];\n      }\n      var length = iteratees.length;\n      if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n        iteratees = [];\n      } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n        iteratees = [iteratees[0]];\n      }\n      iteratees = (iteratees.length == 1 && isArray(iteratees[0]))\n        ? iteratees[0]\n        : baseFlatten(iteratees, 1, isFlattenableIteratee);\n\n      return baseOrderBy(collection, iteratees, []);\n    });\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Gets the timestamp of the number of milliseconds that have elapsed since\n     * the Unix epoch (1 January 1970 00:00:00 UTC).\n     *\n     * @static\n     * @memberOf _\n     * @since 2.4.0\n     * @type {Function}\n     * @category Date\n     * @returns {number} Returns the timestamp.\n     * @example\n     *\n     * _.defer(function(stamp) {\n     *   console.log(_.now() - stamp);\n     * }, _.now());\n     * // => Logs the number of milliseconds it took for the deferred function to be invoked.\n     */\n    var now = Date.now;\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * The opposite of `_.before`; this method creates a function that invokes\n     * `func` once it's called `n` or more times.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {number} n The number of calls before `func` is invoked.\n     * @param {Function} func The function to restrict.\n     * @returns {Function} Returns the new restricted function.\n     * @example\n     *\n     * var saves = ['profile', 'settings'];\n     *\n     * var done = _.after(saves.length, function() {\n     *   console.log('done saving!');\n     * });\n     *\n     * _.forEach(saves, function(type) {\n     *   asyncSave({ 'type': type, 'complete': done });\n     * });\n     * // => Logs 'done saving!' after the two async saves have completed.\n     */\n    function after(n, func) {\n      if (typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      n = toInteger(n);\n      return function() {\n        if (--n < 1) {\n          return func.apply(this, arguments);\n        }\n      };\n    }\n\n    /**\n     * Creates a function that invokes `func`, with up to `n` arguments,\n     * ignoring any additional arguments.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Function\n     * @param {Function} func The function to cap arguments for.\n     * @param {number} [n=func.length] The arity cap.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n     * // => [6, 8, 10]\n     */\n    function ary(func, n, guard) {\n      n = guard ? undefined : n;\n      n = (func && n == null) ? func.length : n;\n      return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);\n    }\n\n    /**\n     * Creates a function that invokes `func`, with the `this` binding and arguments\n     * of the created function, while it's called less than `n` times. Subsequent\n     * calls to the created function return the result of the last `func` invocation.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Function\n     * @param {number} n The number of calls at which `func` is no longer invoked.\n     * @param {Function} func The function to restrict.\n     * @returns {Function} Returns the new restricted function.\n     * @example\n     *\n     * jQuery(element).on('click', _.before(5, addContactToList));\n     * // => allows adding up to 4 contacts to the list\n     */\n    function before(n, func) {\n      var result;\n      if (typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      n = toInteger(n);\n      return function() {\n        if (--n > 0) {\n          result = func.apply(this, arguments);\n        }\n        if (n <= 1) {\n          func = undefined;\n        }\n        return result;\n      };\n    }\n\n    /**\n     * Creates a function that invokes `func` with the `this` binding of `thisArg`\n     * and `partials` prepended to the arguments it receives.\n     *\n     * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n     * may be used as a placeholder for partially applied arguments.\n     *\n     * **Note:** Unlike native `Function#bind` this method doesn't set the \"length\"\n     * property of bound functions.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {Function} func The function to bind.\n     * @param {*} thisArg The `this` binding of `func`.\n     * @param {...*} [partials] The arguments to be partially applied.\n     * @returns {Function} Returns the new bound function.\n     * @example\n     *\n     * var greet = function(greeting, punctuation) {\n     *   return greeting + ' ' + this.user + punctuation;\n     * };\n     *\n     * var object = { 'user': 'fred' };\n     *\n     * var bound = _.bind(greet, object, 'hi');\n     * bound('!');\n     * // => 'hi fred!'\n     *\n     * // Bound with placeholders.\n     * var bound = _.bind(greet, object, _, '!');\n     * bound('hi');\n     * // => 'hi fred!'\n     */\n    var bind = rest(function(func, thisArg, partials) {\n      var bitmask = BIND_FLAG;\n      if (partials.length) {\n        var holders = replaceHolders(partials, getPlaceholder(bind));\n        bitmask |= PARTIAL_FLAG;\n      }\n      return createWrapper(func, bitmask, thisArg, partials, holders);\n    });\n\n    /**\n     * Creates a function that invokes the method at `object[key]` with `partials`\n     * prepended to the arguments it receives.\n     *\n     * This method differs from `_.bind` by allowing bound functions to reference\n     * methods that may be redefined or don't yet exist. See\n     * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n     * for more details.\n     *\n     * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n     * builds, may be used as a placeholder for partially applied arguments.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.10.0\n     * @category Function\n     * @param {Object} object The object to invoke the method on.\n     * @param {string} key The key of the method.\n     * @param {...*} [partials] The arguments to be partially applied.\n     * @returns {Function} Returns the new bound function.\n     * @example\n     *\n     * var object = {\n     *   'user': 'fred',\n     *   'greet': function(greeting, punctuation) {\n     *     return greeting + ' ' + this.user + punctuation;\n     *   }\n     * };\n     *\n     * var bound = _.bindKey(object, 'greet', 'hi');\n     * bound('!');\n     * // => 'hi fred!'\n     *\n     * object.greet = function(greeting, punctuation) {\n     *   return greeting + 'ya ' + this.user + punctuation;\n     * };\n     *\n     * bound('!');\n     * // => 'hiya fred!'\n     *\n     * // Bound with placeholders.\n     * var bound = _.bindKey(object, 'greet', _, '!');\n     * bound('hi');\n     * // => 'hiya fred!'\n     */\n    var bindKey = rest(function(object, key, partials) {\n      var bitmask = BIND_FLAG | BIND_KEY_FLAG;\n      if (partials.length) {\n        var holders = replaceHolders(partials, getPlaceholder(bindKey));\n        bitmask |= PARTIAL_FLAG;\n      }\n      return createWrapper(key, bitmask, object, partials, holders);\n    });\n\n    /**\n     * Creates a function that accepts arguments of `func` and either invokes\n     * `func` returning its result, if at least `arity` number of arguments have\n     * been provided, or returns a function that accepts the remaining `func`\n     * arguments, and so on. The arity of `func` may be specified if `func.length`\n     * is not sufficient.\n     *\n     * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n     * may be used as a placeholder for provided arguments.\n     *\n     * **Note:** This method doesn't set the \"length\" property of curried functions.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Function\n     * @param {Function} func The function to curry.\n     * @param {number} [arity=func.length] The arity of `func`.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Function} Returns the new curried function.\n     * @example\n     *\n     * var abc = function(a, b, c) {\n     *   return [a, b, c];\n     * };\n     *\n     * var curried = _.curry(abc);\n     *\n     * curried(1)(2)(3);\n     * // => [1, 2, 3]\n     *\n     * curried(1, 2)(3);\n     * // => [1, 2, 3]\n     *\n     * curried(1, 2, 3);\n     * // => [1, 2, 3]\n     *\n     * // Curried with placeholders.\n     * curried(1)(_, 3)(2);\n     * // => [1, 2, 3]\n     */\n    function curry(func, arity, guard) {\n      arity = guard ? undefined : arity;\n      var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n      result.placeholder = curry.placeholder;\n      return result;\n    }\n\n    /**\n     * This method is like `_.curry` except that arguments are applied to `func`\n     * in the manner of `_.partialRight` instead of `_.partial`.\n     *\n     * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n     * builds, may be used as a placeholder for provided arguments.\n     *\n     * **Note:** This method doesn't set the \"length\" property of curried functions.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Function\n     * @param {Function} func The function to curry.\n     * @param {number} [arity=func.length] The arity of `func`.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Function} Returns the new curried function.\n     * @example\n     *\n     * var abc = function(a, b, c) {\n     *   return [a, b, c];\n     * };\n     *\n     * var curried = _.curryRight(abc);\n     *\n     * curried(3)(2)(1);\n     * // => [1, 2, 3]\n     *\n     * curried(2, 3)(1);\n     * // => [1, 2, 3]\n     *\n     * curried(1, 2, 3);\n     * // => [1, 2, 3]\n     *\n     * // Curried with placeholders.\n     * curried(3)(1, _)(2);\n     * // => [1, 2, 3]\n     */\n    function curryRight(func, arity, guard) {\n      arity = guard ? undefined : arity;\n      var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n      result.placeholder = curryRight.placeholder;\n      return result;\n    }\n\n    /**\n     * Creates a debounced function that delays invoking `func` until after `wait`\n     * milliseconds have elapsed since the last time the debounced function was\n     * invoked. The debounced function comes with a `cancel` method to cancel\n     * delayed `func` invocations and a `flush` method to immediately invoke them.\n     * Provide an options object to indicate whether `func` should be invoked on\n     * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n     * with the last arguments provided to the debounced function. Subsequent calls\n     * to the debounced function return the result of the last `func` invocation.\n     *\n     * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n     * on the trailing edge of the timeout only if the debounced function is\n     * invoked more than once during the `wait` timeout.\n     *\n     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n     * for details over the differences between `_.debounce` and `_.throttle`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {Function} func The function to debounce.\n     * @param {number} [wait=0] The number of milliseconds to delay.\n     * @param {Object} [options={}] The options object.\n     * @param {boolean} [options.leading=false]\n     *  Specify invoking on the leading edge of the timeout.\n     * @param {number} [options.maxWait]\n     *  The maximum time `func` is allowed to be delayed before it's invoked.\n     * @param {boolean} [options.trailing=true]\n     *  Specify invoking on the trailing edge of the timeout.\n     * @returns {Function} Returns the new debounced function.\n     * @example\n     *\n     * // Avoid costly calculations while the window size is in flux.\n     * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n     *\n     * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n     * jQuery(element).on('click', _.debounce(sendMail, 300, {\n     *   'leading': true,\n     *   'trailing': false\n     * }));\n     *\n     * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n     * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n     * var source = new EventSource('/stream');\n     * jQuery(source).on('message', debounced);\n     *\n     * // Cancel the trailing debounced invocation.\n     * jQuery(window).on('popstate', debounced.cancel);\n     */\n    function debounce(func, wait, options) {\n      var lastArgs,\n          lastThis,\n          maxWait,\n          result,\n          timerId,\n          lastCallTime = 0,\n          lastInvokeTime = 0,\n          leading = false,\n          maxing = false,\n          trailing = true;\n\n      if (typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      wait = toNumber(wait) || 0;\n      if (isObject(options)) {\n        leading = !!options.leading;\n        maxing = 'maxWait' in options;\n        maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n        trailing = 'trailing' in options ? !!options.trailing : trailing;\n      }\n\n      function invokeFunc(time) {\n        var args = lastArgs,\n            thisArg = lastThis;\n\n        lastArgs = lastThis = undefined;\n        lastInvokeTime = time;\n        result = func.apply(thisArg, args);\n        return result;\n      }\n\n      function leadingEdge(time) {\n        // Reset any `maxWait` timer.\n        lastInvokeTime = time;\n        // Start the timer for the trailing edge.\n        timerId = setTimeout(timerExpired, wait);\n        // Invoke the leading edge.\n        return leading ? invokeFunc(time) : result;\n      }\n\n      function remainingWait(time) {\n        var timeSinceLastCall = time - lastCallTime,\n            timeSinceLastInvoke = time - lastInvokeTime,\n            result = wait - timeSinceLastCall;\n\n        return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n      }\n\n      function shouldInvoke(time) {\n        var timeSinceLastCall = time - lastCallTime,\n            timeSinceLastInvoke = time - lastInvokeTime;\n\n        // Either this is the first call, activity has stopped and we're at the\n        // trailing edge, the system time has gone backwards and we're treating\n        // it as the trailing edge, or we've hit the `maxWait` limit.\n        return (!lastCallTime || (timeSinceLastCall >= wait) ||\n          (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n      }\n\n      function timerExpired() {\n        var time = now();\n        if (shouldInvoke(time)) {\n          return trailingEdge(time);\n        }\n        // Restart the timer.\n        timerId = setTimeout(timerExpired, remainingWait(time));\n      }\n\n      function trailingEdge(time) {\n        clearTimeout(timerId);\n        timerId = undefined;\n\n        // Only invoke if we have `lastArgs` which means `func` has been\n        // debounced at least once.\n        if (trailing && lastArgs) {\n          return invokeFunc(time);\n        }\n        lastArgs = lastThis = undefined;\n        return result;\n      }\n\n      function cancel() {\n        if (timerId !== undefined) {\n          clearTimeout(timerId);\n        }\n        lastCallTime = lastInvokeTime = 0;\n        lastArgs = lastThis = timerId = undefined;\n      }\n\n      function flush() {\n        return timerId === undefined ? result : trailingEdge(now());\n      }\n\n      function debounced() {\n        var time = now(),\n            isInvoking = shouldInvoke(time);\n\n        lastArgs = arguments;\n        lastThis = this;\n        lastCallTime = time;\n\n        if (isInvoking) {\n          if (timerId === undefined) {\n            return leadingEdge(lastCallTime);\n          }\n          if (maxing) {\n            // Handle invocations in a tight loop.\n            clearTimeout(timerId);\n            timerId = setTimeout(timerExpired, wait);\n            return invokeFunc(lastCallTime);\n          }\n        }\n        if (timerId === undefined) {\n          timerId = setTimeout(timerExpired, wait);\n        }\n        return result;\n      }\n      debounced.cancel = cancel;\n      debounced.flush = flush;\n      return debounced;\n    }\n\n    /**\n     * Defers invoking the `func` until the current call stack has cleared. Any\n     * additional arguments are provided to `func` when it's invoked.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {Function} func The function to defer.\n     * @param {...*} [args] The arguments to invoke `func` with.\n     * @returns {number} Returns the timer id.\n     * @example\n     *\n     * _.defer(function(text) {\n     *   console.log(text);\n     * }, 'deferred');\n     * // => Logs 'deferred' after one or more milliseconds.\n     */\n    var defer = rest(function(func, args) {\n      return baseDelay(func, 1, args);\n    });\n\n    /**\n     * Invokes `func` after `wait` milliseconds. Any additional arguments are\n     * provided to `func` when it's invoked.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {Function} func The function to delay.\n     * @param {number} wait The number of milliseconds to delay invocation.\n     * @param {...*} [args] The arguments to invoke `func` with.\n     * @returns {number} Returns the timer id.\n     * @example\n     *\n     * _.delay(function(text) {\n     *   console.log(text);\n     * }, 1000, 'later');\n     * // => Logs 'later' after one second.\n     */\n    var delay = rest(function(func, wait, args) {\n      return baseDelay(func, toNumber(wait) || 0, args);\n    });\n\n    /**\n     * Creates a function that invokes `func` with arguments reversed.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Function\n     * @param {Function} func The function to flip arguments for.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var flipped = _.flip(function() {\n     *   return _.toArray(arguments);\n     * });\n     *\n     * flipped('a', 'b', 'c', 'd');\n     * // => ['d', 'c', 'b', 'a']\n     */\n    function flip(func) {\n      return createWrapper(func, FLIP_FLAG);\n    }\n\n    /**\n     * Creates a function that memoizes the result of `func`. If `resolver` is\n     * provided, it determines the cache key for storing the result based on the\n     * arguments provided to the memoized function. By default, the first argument\n     * provided to the memoized function is used as the map cache key. The `func`\n     * is invoked with the `this` binding of the memoized function.\n     *\n     * **Note:** The cache is exposed as the `cache` property on the memoized\n     * function. Its creation may be customized by replacing the `_.memoize.Cache`\n     * constructor with one whose instances implement the\n     * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)\n     * method interface of `delete`, `get`, `has`, and `set`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {Function} func The function to have its output memoized.\n     * @param {Function} [resolver] The function to resolve the cache key.\n     * @returns {Function} Returns the new memoizing function.\n     * @example\n     *\n     * var object = { 'a': 1, 'b': 2 };\n     * var other = { 'c': 3, 'd': 4 };\n     *\n     * var values = _.memoize(_.values);\n     * values(object);\n     * // => [1, 2]\n     *\n     * values(other);\n     * // => [3, 4]\n     *\n     * object.a = 2;\n     * values(object);\n     * // => [1, 2]\n     *\n     * // Modify the result cache.\n     * values.cache.set(object, ['a', 'b']);\n     * values(object);\n     * // => ['a', 'b']\n     *\n     * // Replace `_.memoize.Cache`.\n     * _.memoize.Cache = WeakMap;\n     */\n    function memoize(func, resolver) {\n      if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      var memoized = function() {\n        var args = arguments,\n            key = resolver ? resolver.apply(this, args) : args[0],\n            cache = memoized.cache;\n\n        if (cache.has(key)) {\n          return cache.get(key);\n        }\n        var result = func.apply(this, args);\n        memoized.cache = cache.set(key, result);\n        return result;\n      };\n      memoized.cache = new (memoize.Cache || MapCache);\n      return memoized;\n    }\n\n    // Assign cache to `_.memoize`.\n    memoize.Cache = MapCache;\n\n    /**\n     * Creates a function that negates the result of the predicate `func`. The\n     * `func` predicate is invoked with the `this` binding and arguments of the\n     * created function.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Function\n     * @param {Function} predicate The predicate to negate.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * function isEven(n) {\n     *   return n % 2 == 0;\n     * }\n     *\n     * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n     * // => [1, 3, 5]\n     */\n    function negate(predicate) {\n      if (typeof predicate != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      return function() {\n        return !predicate.apply(this, arguments);\n      };\n    }\n\n    /**\n     * Creates a function that is restricted to invoking `func` once. Repeat calls\n     * to the function return the value of the first invocation. The `func` is\n     * invoked with the `this` binding and arguments of the created function.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {Function} func The function to restrict.\n     * @returns {Function} Returns the new restricted function.\n     * @example\n     *\n     * var initialize = _.once(createApplication);\n     * initialize();\n     * initialize();\n     * // `initialize` invokes `createApplication` once\n     */\n    function once(func) {\n      return before(2, func);\n    }\n\n    /**\n     * Creates a function that invokes `func` with arguments transformed by\n     * corresponding `transforms`.\n     *\n     * @static\n     * @since 4.0.0\n     * @memberOf _\n     * @category Function\n     * @param {Function} func The function to wrap.\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\n     *  [transforms[_.identity]] The functions to transform.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * function doubled(n) {\n     *   return n * 2;\n     * }\n     *\n     * function square(n) {\n     *   return n * n;\n     * }\n     *\n     * var func = _.overArgs(function(x, y) {\n     *   return [x, y];\n     * }, square, doubled);\n     *\n     * func(9, 3);\n     * // => [81, 6]\n     *\n     * func(10, 5);\n     * // => [100, 10]\n     */\n    var overArgs = rest(function(func, transforms) {\n      transforms = (transforms.length == 1 && isArray(transforms[0]))\n        ? arrayMap(transforms[0], baseUnary(getIteratee()))\n        : arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(getIteratee()));\n\n      var funcsLength = transforms.length;\n      return rest(function(args) {\n        var index = -1,\n            length = nativeMin(args.length, funcsLength);\n\n        while (++index < length) {\n          args[index] = transforms[index].call(this, args[index]);\n        }\n        return apply(func, this, args);\n      });\n    });\n\n    /**\n     * Creates a function that invokes `func` with `partials` prepended to the\n     * arguments it receives. This method is like `_.bind` except it does **not**\n     * alter the `this` binding.\n     *\n     * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n     * builds, may be used as a placeholder for partially applied arguments.\n     *\n     * **Note:** This method doesn't set the \"length\" property of partially\n     * applied functions.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.2.0\n     * @category Function\n     * @param {Function} func The function to partially apply arguments to.\n     * @param {...*} [partials] The arguments to be partially applied.\n     * @returns {Function} Returns the new partially applied function.\n     * @example\n     *\n     * var greet = function(greeting, name) {\n     *   return greeting + ' ' + name;\n     * };\n     *\n     * var sayHelloTo = _.partial(greet, 'hello');\n     * sayHelloTo('fred');\n     * // => 'hello fred'\n     *\n     * // Partially applied with placeholders.\n     * var greetFred = _.partial(greet, _, 'fred');\n     * greetFred('hi');\n     * // => 'hi fred'\n     */\n    var partial = rest(function(func, partials) {\n      var holders = replaceHolders(partials, getPlaceholder(partial));\n      return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);\n    });\n\n    /**\n     * This method is like `_.partial` except that partially applied arguments\n     * are appended to the arguments it receives.\n     *\n     * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n     * builds, may be used as a placeholder for partially applied arguments.\n     *\n     * **Note:** This method doesn't set the \"length\" property of partially\n     * applied functions.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.0.0\n     * @category Function\n     * @param {Function} func The function to partially apply arguments to.\n     * @param {...*} [partials] The arguments to be partially applied.\n     * @returns {Function} Returns the new partially applied function.\n     * @example\n     *\n     * var greet = function(greeting, name) {\n     *   return greeting + ' ' + name;\n     * };\n     *\n     * var greetFred = _.partialRight(greet, 'fred');\n     * greetFred('hi');\n     * // => 'hi fred'\n     *\n     * // Partially applied with placeholders.\n     * var sayHelloTo = _.partialRight(greet, 'hello', _);\n     * sayHelloTo('fred');\n     * // => 'hello fred'\n     */\n    var partialRight = rest(function(func, partials) {\n      var holders = replaceHolders(partials, getPlaceholder(partialRight));\n      return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);\n    });\n\n    /**\n     * Creates a function that invokes `func` with arguments arranged according\n     * to the specified `indexes` where the argument value at the first index is\n     * provided as the first argument, the argument value at the second index is\n     * provided as the second argument, and so on.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Function\n     * @param {Function} func The function to rearrange arguments for.\n     * @param {...(number|number[])} indexes The arranged argument indexes.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var rearged = _.rearg(function(a, b, c) {\n     *   return [a, b, c];\n     * }, 2, 0, 1);\n     *\n     * rearged('b', 'c', 'a')\n     * // => ['a', 'b', 'c']\n     */\n    var rearg = rest(function(func, indexes) {\n      return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1));\n    });\n\n    /**\n     * Creates a function that invokes `func` with the `this` binding of the\n     * created function and arguments from `start` and beyond provided as\n     * an array.\n     *\n     * **Note:** This method is based on the\n     * [rest parameter](https://mdn.io/rest_parameters).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Function\n     * @param {Function} func The function to apply a rest parameter to.\n     * @param {number} [start=func.length-1] The start position of the rest parameter.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var say = _.rest(function(what, names) {\n     *   return what + ' ' + _.initial(names).join(', ') +\n     *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n     * });\n     *\n     * say('hello', 'fred', 'barney', 'pebbles');\n     * // => 'hello fred, barney, & pebbles'\n     */\n    function rest(func, start) {\n      if (typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n      return function() {\n        var args = arguments,\n            index = -1,\n            length = nativeMax(args.length - start, 0),\n            array = Array(length);\n\n        while (++index < length) {\n          array[index] = args[start + index];\n        }\n        switch (start) {\n          case 0: return func.call(this, array);\n          case 1: return func.call(this, args[0], array);\n          case 2: return func.call(this, args[0], args[1], array);\n        }\n        var otherArgs = Array(start + 1);\n        index = -1;\n        while (++index < start) {\n          otherArgs[index] = args[index];\n        }\n        otherArgs[start] = array;\n        return apply(func, this, otherArgs);\n      };\n    }\n\n    /**\n     * Creates a function that invokes `func` with the `this` binding of the\n     * create function and an array of arguments much like\n     * [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply).\n     *\n     * **Note:** This method is based on the\n     * [spread operator](https://mdn.io/spread_operator).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.2.0\n     * @category Function\n     * @param {Function} func The function to spread arguments over.\n     * @param {number} [start=0] The start position of the spread.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var say = _.spread(function(who, what) {\n     *   return who + ' says ' + what;\n     * });\n     *\n     * say(['fred', 'hello']);\n     * // => 'fred says hello'\n     *\n     * var numbers = Promise.all([\n     *   Promise.resolve(40),\n     *   Promise.resolve(36)\n     * ]);\n     *\n     * numbers.then(_.spread(function(x, y) {\n     *   return x + y;\n     * }));\n     * // => a Promise of 76\n     */\n    function spread(func, start) {\n      if (typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      start = start === undefined ? 0 : nativeMax(toInteger(start), 0);\n      return rest(function(args) {\n        var array = args[start],\n            otherArgs = castSlice(args, 0, start);\n\n        if (array) {\n          arrayPush(otherArgs, array);\n        }\n        return apply(func, this, otherArgs);\n      });\n    }\n\n    /**\n     * Creates a throttled function that only invokes `func` at most once per\n     * every `wait` milliseconds. The throttled function comes with a `cancel`\n     * method to cancel delayed `func` invocations and a `flush` method to\n     * immediately invoke them. Provide an options object to indicate whether\n     * `func` should be invoked on the leading and/or trailing edge of the `wait`\n     * timeout. The `func` is invoked with the last arguments provided to the\n     * throttled function. Subsequent calls to the throttled function return the\n     * result of the last `func` invocation.\n     *\n     * **Note:** If `leading` and `trailing` options are `true`, `func` is\n     * invoked on the trailing edge of the timeout only if the throttled function\n     * is invoked more than once during the `wait` timeout.\n     *\n     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n     * for details over the differences between `_.throttle` and `_.debounce`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {Function} func The function to throttle.\n     * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n     * @param {Object} [options={}] The options object.\n     * @param {boolean} [options.leading=true]\n     *  Specify invoking on the leading edge of the timeout.\n     * @param {boolean} [options.trailing=true]\n     *  Specify invoking on the trailing edge of the timeout.\n     * @returns {Function} Returns the new throttled function.\n     * @example\n     *\n     * // Avoid excessively updating the position while scrolling.\n     * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n     *\n     * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n     * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n     * jQuery(element).on('click', throttled);\n     *\n     * // Cancel the trailing throttled invocation.\n     * jQuery(window).on('popstate', throttled.cancel);\n     */\n    function throttle(func, wait, options) {\n      var leading = true,\n          trailing = true;\n\n      if (typeof func != 'function') {\n        throw new TypeError(FUNC_ERROR_TEXT);\n      }\n      if (isObject(options)) {\n        leading = 'leading' in options ? !!options.leading : leading;\n        trailing = 'trailing' in options ? !!options.trailing : trailing;\n      }\n      return debounce(func, wait, {\n        'leading': leading,\n        'maxWait': wait,\n        'trailing': trailing\n      });\n    }\n\n    /**\n     * Creates a function that accepts up to one argument, ignoring any\n     * additional arguments.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Function\n     * @param {Function} func The function to cap arguments for.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * _.map(['6', '8', '10'], _.unary(parseInt));\n     * // => [6, 8, 10]\n     */\n    function unary(func) {\n      return ary(func, 1);\n    }\n\n    /**\n     * Creates a function that provides `value` to the wrapper function as its\n     * first argument. Any additional arguments provided to the function are\n     * appended to those provided to the wrapper function. The wrapper is invoked\n     * with the `this` binding of the created function.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Function\n     * @param {*} value The value to wrap.\n     * @param {Function} [wrapper=identity] The wrapper function.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var p = _.wrap(_.escape, function(func, text) {\n     *   return '<p>' + func(text) + '</p>';\n     * });\n     *\n     * p('fred, barney, & pebbles');\n     * // => '<p>fred, barney, &amp; pebbles</p>'\n     */\n    function wrap(value, wrapper) {\n      wrapper = wrapper == null ? identity : wrapper;\n      return partial(wrapper, value);\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Casts `value` as an array if it's not one.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.4.0\n     * @category Lang\n     * @param {*} value The value to inspect.\n     * @returns {Array} Returns the cast array.\n     * @example\n     *\n     * _.castArray(1);\n     * // => [1]\n     *\n     * _.castArray({ 'a': 1 });\n     * // => [{ 'a': 1 }]\n     *\n     * _.castArray('abc');\n     * // => ['abc']\n     *\n     * _.castArray(null);\n     * // => [null]\n     *\n     * _.castArray(undefined);\n     * // => [undefined]\n     *\n     * _.castArray();\n     * // => []\n     *\n     * var array = [1, 2, 3];\n     * console.log(_.castArray(array) === array);\n     * // => true\n     */\n    function castArray() {\n      if (!arguments.length) {\n        return [];\n      }\n      var value = arguments[0];\n      return isArray(value) ? value : [value];\n    }\n\n    /**\n     * Creates a shallow clone of `value`.\n     *\n     * **Note:** This method is loosely based on the\n     * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n     * and supports cloning arrays, array buffers, booleans, date objects, maps,\n     * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n     * arrays. The own enumerable properties of `arguments` objects are cloned\n     * as plain objects. An empty object is returned for uncloneable values such\n     * as error objects, functions, DOM nodes, and WeakMaps.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to clone.\n     * @returns {*} Returns the cloned value.\n     * @example\n     *\n     * var objects = [{ 'a': 1 }, { 'b': 2 }];\n     *\n     * var shallow = _.clone(objects);\n     * console.log(shallow[0] === objects[0]);\n     * // => true\n     */\n    function clone(value) {\n      return baseClone(value, false, true);\n    }\n\n    /**\n     * This method is like `_.clone` except that it accepts `customizer` which\n     * is invoked to produce the cloned value. If `customizer` returns `undefined`,\n     * cloning is handled by the method instead. The `customizer` is invoked with\n     * up to four arguments; (value [, index|key, object, stack]).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to clone.\n     * @param {Function} [customizer] The function to customize cloning.\n     * @returns {*} Returns the cloned value.\n     * @example\n     *\n     * function customizer(value) {\n     *   if (_.isElement(value)) {\n     *     return value.cloneNode(false);\n     *   }\n     * }\n     *\n     * var el = _.cloneWith(document.body, customizer);\n     *\n     * console.log(el === document.body);\n     * // => false\n     * console.log(el.nodeName);\n     * // => 'BODY'\n     * console.log(el.childNodes.length);\n     * // => 0\n     */\n    function cloneWith(value, customizer) {\n      return baseClone(value, false, true, customizer);\n    }\n\n    /**\n     * This method is like `_.clone` except that it recursively clones `value`.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.0.0\n     * @category Lang\n     * @param {*} value The value to recursively clone.\n     * @returns {*} Returns the deep cloned value.\n     * @example\n     *\n     * var objects = [{ 'a': 1 }, { 'b': 2 }];\n     *\n     * var deep = _.cloneDeep(objects);\n     * console.log(deep[0] === objects[0]);\n     * // => false\n     */\n    function cloneDeep(value) {\n      return baseClone(value, true, true);\n    }\n\n    /**\n     * This method is like `_.cloneWith` except that it recursively clones `value`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to recursively clone.\n     * @param {Function} [customizer] The function to customize cloning.\n     * @returns {*} Returns the deep cloned value.\n     * @example\n     *\n     * function customizer(value) {\n     *   if (_.isElement(value)) {\n     *     return value.cloneNode(true);\n     *   }\n     * }\n     *\n     * var el = _.cloneDeepWith(document.body, customizer);\n     *\n     * console.log(el === document.body);\n     * // => false\n     * console.log(el.nodeName);\n     * // => 'BODY'\n     * console.log(el.childNodes.length);\n     * // => 20\n     */\n    function cloneDeepWith(value, customizer) {\n      return baseClone(value, true, true, customizer);\n    }\n\n    /**\n     * Performs a\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n     * comparison between two values to determine if they are equivalent.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n     * @example\n     *\n     * var object = { 'user': 'fred' };\n     * var other = { 'user': 'fred' };\n     *\n     * _.eq(object, object);\n     * // => true\n     *\n     * _.eq(object, other);\n     * // => false\n     *\n     * _.eq('a', 'a');\n     * // => true\n     *\n     * _.eq('a', Object('a'));\n     * // => false\n     *\n     * _.eq(NaN, NaN);\n     * // => true\n     */\n    function eq(value, other) {\n      return value === other || (value !== value && other !== other);\n    }\n\n    /**\n     * Checks if `value` is greater than `other`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.9.0\n     * @category Lang\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @returns {boolean} Returns `true` if `value` is greater than `other`,\n     *  else `false`.\n     * @example\n     *\n     * _.gt(3, 1);\n     * // => true\n     *\n     * _.gt(3, 3);\n     * // => false\n     *\n     * _.gt(1, 3);\n     * // => false\n     */\n    function gt(value, other) {\n      return value > other;\n    }\n\n    /**\n     * Checks if `value` is greater than or equal to `other`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.9.0\n     * @category Lang\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @returns {boolean} Returns `true` if `value` is greater than or equal to\n     *  `other`, else `false`.\n     * @example\n     *\n     * _.gte(3, 1);\n     * // => true\n     *\n     * _.gte(3, 3);\n     * // => true\n     *\n     * _.gte(1, 3);\n     * // => false\n     */\n    function gte(value, other) {\n      return value >= other;\n    }\n\n    /**\n     * Checks if `value` is likely an `arguments` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isArguments(function() { return arguments; }());\n     * // => true\n     *\n     * _.isArguments([1, 2, 3]);\n     * // => false\n     */\n    function isArguments(value) {\n      // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n      return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n        (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n    }\n\n    /**\n     * Checks if `value` is classified as an `Array` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @type {Function}\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isArray([1, 2, 3]);\n     * // => true\n     *\n     * _.isArray(document.body.children);\n     * // => false\n     *\n     * _.isArray('abc');\n     * // => false\n     *\n     * _.isArray(_.noop);\n     * // => false\n     */\n    var isArray = Array.isArray;\n\n    /**\n     * Checks if `value` is classified as an `ArrayBuffer` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.3.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isArrayBuffer(new ArrayBuffer(2));\n     * // => true\n     *\n     * _.isArrayBuffer(new Array(2));\n     * // => false\n     */\n    function isArrayBuffer(value) {\n      return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;\n    }\n\n    /**\n     * Checks if `value` is array-like. A value is considered array-like if it's\n     * not a function and has a `value.length` that's an integer greater than or\n     * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n     * @example\n     *\n     * _.isArrayLike([1, 2, 3]);\n     * // => true\n     *\n     * _.isArrayLike(document.body.children);\n     * // => true\n     *\n     * _.isArrayLike('abc');\n     * // => true\n     *\n     * _.isArrayLike(_.noop);\n     * // => false\n     */\n    function isArrayLike(value) {\n      return value != null && isLength(getLength(value)) && !isFunction(value);\n    }\n\n    /**\n     * This method is like `_.isArrayLike` except that it also checks if `value`\n     * is an object.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is an array-like object,\n     *  else `false`.\n     * @example\n     *\n     * _.isArrayLikeObject([1, 2, 3]);\n     * // => true\n     *\n     * _.isArrayLikeObject(document.body.children);\n     * // => true\n     *\n     * _.isArrayLikeObject('abc');\n     * // => false\n     *\n     * _.isArrayLikeObject(_.noop);\n     * // => false\n     */\n    function isArrayLikeObject(value) {\n      return isObjectLike(value) && isArrayLike(value);\n    }\n\n    /**\n     * Checks if `value` is classified as a boolean primitive or object.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isBoolean(false);\n     * // => true\n     *\n     * _.isBoolean(null);\n     * // => false\n     */\n    function isBoolean(value) {\n      return value === true || value === false ||\n        (isObjectLike(value) && objectToString.call(value) == boolTag);\n    }\n\n    /**\n     * Checks if `value` is a buffer.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.3.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n     * @example\n     *\n     * _.isBuffer(new Buffer(2));\n     * // => true\n     *\n     * _.isBuffer(new Uint8Array(2));\n     * // => false\n     */\n    var isBuffer = !Buffer ? constant(false) : function(value) {\n      return value instanceof Buffer;\n    };\n\n    /**\n     * Checks if `value` is classified as a `Date` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isDate(new Date);\n     * // => true\n     *\n     * _.isDate('Mon April 23 2012');\n     * // => false\n     */\n    function isDate(value) {\n      return isObjectLike(value) && objectToString.call(value) == dateTag;\n    }\n\n    /**\n     * Checks if `value` is likely a DOM element.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a DOM element,\n     *  else `false`.\n     * @example\n     *\n     * _.isElement(document.body);\n     * // => true\n     *\n     * _.isElement('<body>');\n     * // => false\n     */\n    function isElement(value) {\n      return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);\n    }\n\n    /**\n     * Checks if `value` is an empty object, collection, map, or set.\n     *\n     * Objects are considered empty if they have no own enumerable string keyed\n     * properties.\n     *\n     * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n     * jQuery-like collections are considered empty if they have a `length` of `0`.\n     * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n     * @example\n     *\n     * _.isEmpty(null);\n     * // => true\n     *\n     * _.isEmpty(true);\n     * // => true\n     *\n     * _.isEmpty(1);\n     * // => true\n     *\n     * _.isEmpty([1, 2, 3]);\n     * // => false\n     *\n     * _.isEmpty({ 'a': 1 });\n     * // => false\n     */\n    function isEmpty(value) {\n      if (isArrayLike(value) &&\n          (isArray(value) || isString(value) || isFunction(value.splice) ||\n            isArguments(value) || isBuffer(value))) {\n        return !value.length;\n      }\n      if (isObjectLike(value)) {\n        var tag = getTag(value);\n        if (tag == mapTag || tag == setTag) {\n          return !value.size;\n        }\n      }\n      for (var key in value) {\n        if (hasOwnProperty.call(value, key)) {\n          return false;\n        }\n      }\n      return !(nonEnumShadows && keys(value).length);\n    }\n\n    /**\n     * Performs a deep comparison between two values to determine if they are\n     * equivalent.\n     *\n     * **Note:** This method supports comparing arrays, array buffers, booleans,\n     * date objects, error objects, maps, numbers, `Object` objects, regexes,\n     * sets, strings, symbols, and typed arrays. `Object` objects are compared\n     * by their own, not inherited, enumerable properties. Functions and DOM\n     * nodes are **not** supported.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @returns {boolean} Returns `true` if the values are equivalent,\n     *  else `false`.\n     * @example\n     *\n     * var object = { 'user': 'fred' };\n     * var other = { 'user': 'fred' };\n     *\n     * _.isEqual(object, other);\n     * // => true\n     *\n     * object === other;\n     * // => false\n     */\n    function isEqual(value, other) {\n      return baseIsEqual(value, other);\n    }\n\n    /**\n     * This method is like `_.isEqual` except that it accepts `customizer` which\n     * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n     * are handled by the method instead. The `customizer` is invoked with up to\n     * six arguments: (objValue, othValue [, index|key, object, other, stack]).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @param {Function} [customizer] The function to customize comparisons.\n     * @returns {boolean} Returns `true` if the values are equivalent,\n     *  else `false`.\n     * @example\n     *\n     * function isGreeting(value) {\n     *   return /^h(?:i|ello)$/.test(value);\n     * }\n     *\n     * function customizer(objValue, othValue) {\n     *   if (isGreeting(objValue) && isGreeting(othValue)) {\n     *     return true;\n     *   }\n     * }\n     *\n     * var array = ['hello', 'goodbye'];\n     * var other = ['hi', 'goodbye'];\n     *\n     * _.isEqualWith(array, other, customizer);\n     * // => true\n     */\n    function isEqualWith(value, other, customizer) {\n      customizer = typeof customizer == 'function' ? customizer : undefined;\n      var result = customizer ? customizer(value, other) : undefined;\n      return result === undefined ? baseIsEqual(value, other, customizer) : !!result;\n    }\n\n    /**\n     * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n     * `SyntaxError`, `TypeError`, or `URIError` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is an error object,\n     *  else `false`.\n     * @example\n     *\n     * _.isError(new Error);\n     * // => true\n     *\n     * _.isError(Error);\n     * // => false\n     */\n    function isError(value) {\n      if (!isObjectLike(value)) {\n        return false;\n      }\n      return (objectToString.call(value) == errorTag) ||\n        (typeof value.message == 'string' && typeof value.name == 'string');\n    }\n\n    /**\n     * Checks if `value` is a finite primitive number.\n     *\n     * **Note:** This method is based on\n     * [`Number.isFinite`](https://mdn.io/Number/isFinite).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a finite number,\n     *  else `false`.\n     * @example\n     *\n     * _.isFinite(3);\n     * // => true\n     *\n     * _.isFinite(Number.MAX_VALUE);\n     * // => true\n     *\n     * _.isFinite(3.14);\n     * // => true\n     *\n     * _.isFinite(Infinity);\n     * // => false\n     */\n    function isFinite(value) {\n      return typeof value == 'number' && nativeIsFinite(value);\n    }\n\n    /**\n     * Checks if `value` is classified as a `Function` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isFunction(_);\n     * // => true\n     *\n     * _.isFunction(/abc/);\n     * // => false\n     */\n    function isFunction(value) {\n      // The use of `Object#toString` avoids issues with the `typeof` operator\n      // in Safari 8 which returns 'object' for typed array and weak map constructors,\n      // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n      var tag = isObject(value) ? objectToString.call(value) : '';\n      return tag == funcTag || tag == genTag;\n    }\n\n    /**\n     * Checks if `value` is an integer.\n     *\n     * **Note:** This method is based on\n     * [`Number.isInteger`](https://mdn.io/Number/isInteger).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n     * @example\n     *\n     * _.isInteger(3);\n     * // => true\n     *\n     * _.isInteger(Number.MIN_VALUE);\n     * // => false\n     *\n     * _.isInteger(Infinity);\n     * // => false\n     *\n     * _.isInteger('3');\n     * // => false\n     */\n    function isInteger(value) {\n      return typeof value == 'number' && value == toInteger(value);\n    }\n\n    /**\n     * Checks if `value` is a valid array-like length.\n     *\n     * **Note:** This function is loosely based on\n     * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a valid length,\n     *  else `false`.\n     * @example\n     *\n     * _.isLength(3);\n     * // => true\n     *\n     * _.isLength(Number.MIN_VALUE);\n     * // => false\n     *\n     * _.isLength(Infinity);\n     * // => false\n     *\n     * _.isLength('3');\n     * // => false\n     */\n    function isLength(value) {\n      return typeof value == 'number' &&\n        value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n    }\n\n    /**\n     * Checks if `value` is the\n     * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)\n     * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n     * @example\n     *\n     * _.isObject({});\n     * // => true\n     *\n     * _.isObject([1, 2, 3]);\n     * // => true\n     *\n     * _.isObject(_.noop);\n     * // => true\n     *\n     * _.isObject(null);\n     * // => false\n     */\n    function isObject(value) {\n      var type = typeof value;\n      return !!value && (type == 'object' || type == 'function');\n    }\n\n    /**\n     * Checks if `value` is object-like. A value is object-like if it's not `null`\n     * and has a `typeof` result of \"object\".\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n     * @example\n     *\n     * _.isObjectLike({});\n     * // => true\n     *\n     * _.isObjectLike([1, 2, 3]);\n     * // => true\n     *\n     * _.isObjectLike(_.noop);\n     * // => false\n     *\n     * _.isObjectLike(null);\n     * // => false\n     */\n    function isObjectLike(value) {\n      return !!value && typeof value == 'object';\n    }\n\n    /**\n     * Checks if `value` is classified as a `Map` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.3.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isMap(new Map);\n     * // => true\n     *\n     * _.isMap(new WeakMap);\n     * // => false\n     */\n    function isMap(value) {\n      return isObjectLike(value) && getTag(value) == mapTag;\n    }\n\n    /**\n     * Performs a partial deep comparison between `object` and `source` to\n     * determine if `object` contains equivalent property values. This method is\n     * equivalent to a `_.matches` function when `source` is partially applied.\n     *\n     * **Note:** This method supports comparing the same values as `_.isEqual`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Lang\n     * @param {Object} object The object to inspect.\n     * @param {Object} source The object of property values to match.\n     * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n     * @example\n     *\n     * var object = { 'user': 'fred', 'age': 40 };\n     *\n     * _.isMatch(object, { 'age': 40 });\n     * // => true\n     *\n     * _.isMatch(object, { 'age': 36 });\n     * // => false\n     */\n    function isMatch(object, source) {\n      return object === source || baseIsMatch(object, source, getMatchData(source));\n    }\n\n    /**\n     * This method is like `_.isMatch` except that it accepts `customizer` which\n     * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n     * are handled by the method instead. The `customizer` is invoked with five\n     * arguments: (objValue, srcValue, index|key, object, source).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {Object} object The object to inspect.\n     * @param {Object} source The object of property values to match.\n     * @param {Function} [customizer] The function to customize comparisons.\n     * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n     * @example\n     *\n     * function isGreeting(value) {\n     *   return /^h(?:i|ello)$/.test(value);\n     * }\n     *\n     * function customizer(objValue, srcValue) {\n     *   if (isGreeting(objValue) && isGreeting(srcValue)) {\n     *     return true;\n     *   }\n     * }\n     *\n     * var object = { 'greeting': 'hello' };\n     * var source = { 'greeting': 'hi' };\n     *\n     * _.isMatchWith(object, source, customizer);\n     * // => true\n     */\n    function isMatchWith(object, source, customizer) {\n      customizer = typeof customizer == 'function' ? customizer : undefined;\n      return baseIsMatch(object, source, getMatchData(source), customizer);\n    }\n\n    /**\n     * Checks if `value` is `NaN`.\n     *\n     * **Note:** This method is based on\n     * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\n     * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\n     * `undefined` and other non-number values.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n     * @example\n     *\n     * _.isNaN(NaN);\n     * // => true\n     *\n     * _.isNaN(new Number(NaN));\n     * // => true\n     *\n     * isNaN(undefined);\n     * // => true\n     *\n     * _.isNaN(undefined);\n     * // => false\n     */\n    function isNaN(value) {\n      // An `NaN` primitive is the only value that is not equal to itself.\n      // Perform the `toStringTag` check first to avoid errors with some\n      // ActiveX objects in IE.\n      return isNumber(value) && value != +value;\n    }\n\n    /**\n     * Checks if `value` is a native function.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a native function,\n     *  else `false`.\n     * @example\n     *\n     * _.isNative(Array.prototype.push);\n     * // => true\n     *\n     * _.isNative(_);\n     * // => false\n     */\n    function isNative(value) {\n      if (!isObject(value)) {\n        return false;\n      }\n      var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n      return pattern.test(toSource(value));\n    }\n\n    /**\n     * Checks if `value` is `null`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\n     * @example\n     *\n     * _.isNull(null);\n     * // => true\n     *\n     * _.isNull(void 0);\n     * // => false\n     */\n    function isNull(value) {\n      return value === null;\n    }\n\n    /**\n     * Checks if `value` is `null` or `undefined`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is nullish, else `false`.\n     * @example\n     *\n     * _.isNil(null);\n     * // => true\n     *\n     * _.isNil(void 0);\n     * // => true\n     *\n     * _.isNil(NaN);\n     * // => false\n     */\n    function isNil(value) {\n      return value == null;\n    }\n\n    /**\n     * Checks if `value` is classified as a `Number` primitive or object.\n     *\n     * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n     * classified as numbers, use the `_.isFinite` method.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isNumber(3);\n     * // => true\n     *\n     * _.isNumber(Number.MIN_VALUE);\n     * // => true\n     *\n     * _.isNumber(Infinity);\n     * // => true\n     *\n     * _.isNumber('3');\n     * // => false\n     */\n    function isNumber(value) {\n      return typeof value == 'number' ||\n        (isObjectLike(value) && objectToString.call(value) == numberTag);\n    }\n\n    /**\n     * Checks if `value` is a plain object, that is, an object created by the\n     * `Object` constructor or one with a `[[Prototype]]` of `null`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.8.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a plain object,\n     *  else `false`.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     * }\n     *\n     * _.isPlainObject(new Foo);\n     * // => false\n     *\n     * _.isPlainObject([1, 2, 3]);\n     * // => false\n     *\n     * _.isPlainObject({ 'x': 0, 'y': 0 });\n     * // => true\n     *\n     * _.isPlainObject(Object.create(null));\n     * // => true\n     */\n    function isPlainObject(value) {\n      if (!isObjectLike(value) ||\n          objectToString.call(value) != objectTag || isHostObject(value)) {\n        return false;\n      }\n      var proto = getPrototype(value);\n      if (proto === null) {\n        return true;\n      }\n      var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n      return (typeof Ctor == 'function' &&\n        Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);\n    }\n\n    /**\n     * Checks if `value` is classified as a `RegExp` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.1.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isRegExp(/abc/);\n     * // => true\n     *\n     * _.isRegExp('/abc/');\n     * // => false\n     */\n    function isRegExp(value) {\n      return isObject(value) && objectToString.call(value) == regexpTag;\n    }\n\n    /**\n     * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754\n     * double precision number which isn't the result of a rounded unsafe integer.\n     *\n     * **Note:** This method is based on\n     * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a safe integer,\n     *  else `false`.\n     * @example\n     *\n     * _.isSafeInteger(3);\n     * // => true\n     *\n     * _.isSafeInteger(Number.MIN_VALUE);\n     * // => false\n     *\n     * _.isSafeInteger(Infinity);\n     * // => false\n     *\n     * _.isSafeInteger('3');\n     * // => false\n     */\n    function isSafeInteger(value) {\n      return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;\n    }\n\n    /**\n     * Checks if `value` is classified as a `Set` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.3.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isSet(new Set);\n     * // => true\n     *\n     * _.isSet(new WeakSet);\n     * // => false\n     */\n    function isSet(value) {\n      return isObjectLike(value) && getTag(value) == setTag;\n    }\n\n    /**\n     * Checks if `value` is classified as a `String` primitive or object.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isString('abc');\n     * // => true\n     *\n     * _.isString(1);\n     * // => false\n     */\n    function isString(value) {\n      return typeof value == 'string' ||\n        (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n    }\n\n    /**\n     * Checks if `value` is classified as a `Symbol` primitive or object.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isSymbol(Symbol.iterator);\n     * // => true\n     *\n     * _.isSymbol('abc');\n     * // => false\n     */\n    function isSymbol(value) {\n      return typeof value == 'symbol' ||\n        (isObjectLike(value) && objectToString.call(value) == symbolTag);\n    }\n\n    /**\n     * Checks if `value` is classified as a typed array.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isTypedArray(new Uint8Array);\n     * // => true\n     *\n     * _.isTypedArray([]);\n     * // => false\n     */\n    function isTypedArray(value) {\n      return isObjectLike(value) &&\n        isLength(value.length) && !!typedArrayTags[objectToString.call(value)];\n    }\n\n    /**\n     * Checks if `value` is `undefined`.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n     * @example\n     *\n     * _.isUndefined(void 0);\n     * // => true\n     *\n     * _.isUndefined(null);\n     * // => false\n     */\n    function isUndefined(value) {\n      return value === undefined;\n    }\n\n    /**\n     * Checks if `value` is classified as a `WeakMap` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.3.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isWeakMap(new WeakMap);\n     * // => true\n     *\n     * _.isWeakMap(new Map);\n     * // => false\n     */\n    function isWeakMap(value) {\n      return isObjectLike(value) && getTag(value) == weakMapTag;\n    }\n\n    /**\n     * Checks if `value` is classified as a `WeakSet` object.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.3.0\n     * @category Lang\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\n     *  else `false`.\n     * @example\n     *\n     * _.isWeakSet(new WeakSet);\n     * // => true\n     *\n     * _.isWeakSet(new Set);\n     * // => false\n     */\n    function isWeakSet(value) {\n      return isObjectLike(value) && objectToString.call(value) == weakSetTag;\n    }\n\n    /**\n     * Checks if `value` is less than `other`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.9.0\n     * @category Lang\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @returns {boolean} Returns `true` if `value` is less than `other`,\n     *  else `false`.\n     * @example\n     *\n     * _.lt(1, 3);\n     * // => true\n     *\n     * _.lt(3, 3);\n     * // => false\n     *\n     * _.lt(3, 1);\n     * // => false\n     */\n    function lt(value, other) {\n      return value < other;\n    }\n\n    /**\n     * Checks if `value` is less than or equal to `other`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.9.0\n     * @category Lang\n     * @param {*} value The value to compare.\n     * @param {*} other The other value to compare.\n     * @returns {boolean} Returns `true` if `value` is less than or equal to\n     *  `other`, else `false`.\n     * @example\n     *\n     * _.lte(1, 3);\n     * // => true\n     *\n     * _.lte(3, 3);\n     * // => true\n     *\n     * _.lte(3, 1);\n     * // => false\n     */\n    function lte(value, other) {\n      return value <= other;\n    }\n\n    /**\n     * Converts `value` to an array.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Lang\n     * @param {*} value The value to convert.\n     * @returns {Array} Returns the converted array.\n     * @example\n     *\n     * _.toArray({ 'a': 1, 'b': 2 });\n     * // => [1, 2]\n     *\n     * _.toArray('abc');\n     * // => ['a', 'b', 'c']\n     *\n     * _.toArray(1);\n     * // => []\n     *\n     * _.toArray(null);\n     * // => []\n     */\n    function toArray(value) {\n      if (!value) {\n        return [];\n      }\n      if (isArrayLike(value)) {\n        return isString(value) ? stringToArray(value) : copyArray(value);\n      }\n      if (iteratorSymbol && value[iteratorSymbol]) {\n        return iteratorToArray(value[iteratorSymbol]());\n      }\n      var tag = getTag(value),\n          func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);\n\n      return func(value);\n    }\n\n    /**\n     * Converts `value` to an integer.\n     *\n     * **Note:** This function is loosely based on\n     * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to convert.\n     * @returns {number} Returns the converted integer.\n     * @example\n     *\n     * _.toInteger(3);\n     * // => 3\n     *\n     * _.toInteger(Number.MIN_VALUE);\n     * // => 0\n     *\n     * _.toInteger(Infinity);\n     * // => 1.7976931348623157e+308\n     *\n     * _.toInteger('3');\n     * // => 3\n     */\n    function toInteger(value) {\n      if (!value) {\n        return value === 0 ? value : 0;\n      }\n      value = toNumber(value);\n      if (value === INFINITY || value === -INFINITY) {\n        var sign = (value < 0 ? -1 : 1);\n        return sign * MAX_INTEGER;\n      }\n      var remainder = value % 1;\n      return value === value ? (remainder ? value - remainder : value) : 0;\n    }\n\n    /**\n     * Converts `value` to an integer suitable for use as the length of an\n     * array-like object.\n     *\n     * **Note:** This method is based on\n     * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to convert.\n     * @returns {number} Returns the converted integer.\n     * @example\n     *\n     * _.toLength(3);\n     * // => 3\n     *\n     * _.toLength(Number.MIN_VALUE);\n     * // => 0\n     *\n     * _.toLength(Infinity);\n     * // => 4294967295\n     *\n     * _.toLength('3');\n     * // => 3\n     */\n    function toLength(value) {\n      return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n    }\n\n    /**\n     * Converts `value` to a number.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to process.\n     * @returns {number} Returns the number.\n     * @example\n     *\n     * _.toNumber(3);\n     * // => 3\n     *\n     * _.toNumber(Number.MIN_VALUE);\n     * // => 5e-324\n     *\n     * _.toNumber(Infinity);\n     * // => Infinity\n     *\n     * _.toNumber('3');\n     * // => 3\n     */\n    function toNumber(value) {\n      if (typeof value == 'number') {\n        return value;\n      }\n      if (isSymbol(value)) {\n        return NAN;\n      }\n      if (isObject(value)) {\n        var other = isFunction(value.valueOf) ? value.valueOf() : value;\n        value = isObject(other) ? (other + '') : other;\n      }\n      if (typeof value != 'string') {\n        return value === 0 ? value : +value;\n      }\n      value = value.replace(reTrim, '');\n      var isBinary = reIsBinary.test(value);\n      return (isBinary || reIsOctal.test(value))\n        ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n        : (reIsBadHex.test(value) ? NAN : +value);\n    }\n\n    /**\n     * Converts `value` to a plain object flattening inherited enumerable string\n     * keyed properties of `value` to own properties of the plain object.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Lang\n     * @param {*} value The value to convert.\n     * @returns {Object} Returns the converted plain object.\n     * @example\n     *\n     * function Foo() {\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.assign({ 'a': 1 }, new Foo);\n     * // => { 'a': 1, 'b': 2 }\n     *\n     * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n     * // => { 'a': 1, 'b': 2, 'c': 3 }\n     */\n    function toPlainObject(value) {\n      return copyObject(value, keysIn(value));\n    }\n\n    /**\n     * Converts `value` to a safe integer. A safe integer can be compared and\n     * represented correctly.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to convert.\n     * @returns {number} Returns the converted integer.\n     * @example\n     *\n     * _.toSafeInteger(3);\n     * // => 3\n     *\n     * _.toSafeInteger(Number.MIN_VALUE);\n     * // => 0\n     *\n     * _.toSafeInteger(Infinity);\n     * // => 9007199254740991\n     *\n     * _.toSafeInteger('3');\n     * // => 3\n     */\n    function toSafeInteger(value) {\n      return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\n    }\n\n    /**\n     * Converts `value` to a string. An empty string is returned for `null`\n     * and `undefined` values. The sign of `-0` is preserved.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Lang\n     * @param {*} value The value to process.\n     * @returns {string} Returns the string.\n     * @example\n     *\n     * _.toString(null);\n     * // => ''\n     *\n     * _.toString(-0);\n     * // => '-0'\n     *\n     * _.toString([1, 2, 3]);\n     * // => '1,2,3'\n     */\n    function toString(value) {\n      // Exit early for strings to avoid a performance hit in some environments.\n      if (typeof value == 'string') {\n        return value;\n      }\n      if (value == null) {\n        return '';\n      }\n      if (isSymbol(value)) {\n        return symbolToString ? symbolToString.call(value) : '';\n      }\n      var result = (value + '');\n      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Assigns own enumerable string keyed properties of source objects to the\n     * destination object. Source objects are applied from left to right.\n     * Subsequent sources overwrite property assignments of previous sources.\n     *\n     * **Note:** This method mutates `object` and is loosely based on\n     * [`Object.assign`](https://mdn.io/Object/assign).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.10.0\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} [sources] The source objects.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Foo() {\n     *   this.c = 3;\n     * }\n     *\n     * function Bar() {\n     *   this.e = 5;\n     * }\n     *\n     * Foo.prototype.d = 4;\n     * Bar.prototype.f = 6;\n     *\n     * _.assign({ 'a': 1 }, new Foo, new Bar);\n     * // => { 'a': 1, 'c': 3, 'e': 5 }\n     */\n    var assign = createAssigner(function(object, source) {\n      if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {\n        copyObject(source, keys(source), object);\n        return;\n      }\n      for (var key in source) {\n        if (hasOwnProperty.call(source, key)) {\n          assignValue(object, key, source[key]);\n        }\n      }\n    });\n\n    /**\n     * This method is like `_.assign` except that it iterates over own and\n     * inherited source properties.\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @alias extend\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} [sources] The source objects.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Foo() {\n     *   this.b = 2;\n     * }\n     *\n     * function Bar() {\n     *   this.d = 4;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     * Bar.prototype.e = 5;\n     *\n     * _.assignIn({ 'a': 1 }, new Foo, new Bar);\n     * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }\n     */\n    var assignIn = createAssigner(function(object, source) {\n      if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {\n        copyObject(source, keysIn(source), object);\n        return;\n      }\n      for (var key in source) {\n        assignValue(object, key, source[key]);\n      }\n    });\n\n    /**\n     * This method is like `_.assignIn` except that it accepts `customizer`\n     * which is invoked to produce the assigned values. If `customizer` returns\n     * `undefined`, assignment is handled by the method instead. The `customizer`\n     * is invoked with five arguments: (objValue, srcValue, key, object, source).\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @alias extendWith\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} sources The source objects.\n     * @param {Function} [customizer] The function to customize assigned values.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function customizer(objValue, srcValue) {\n     *   return _.isUndefined(objValue) ? srcValue : objValue;\n     * }\n     *\n     * var defaults = _.partialRight(_.assignInWith, customizer);\n     *\n     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n     * // => { 'a': 1, 'b': 2 }\n     */\n    var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n      copyObject(source, keysIn(source), object, customizer);\n    });\n\n    /**\n     * This method is like `_.assign` except that it accepts `customizer`\n     * which is invoked to produce the assigned values. If `customizer` returns\n     * `undefined`, assignment is handled by the method instead. The `customizer`\n     * is invoked with five arguments: (objValue, srcValue, key, object, source).\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} sources The source objects.\n     * @param {Function} [customizer] The function to customize assigned values.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function customizer(objValue, srcValue) {\n     *   return _.isUndefined(objValue) ? srcValue : objValue;\n     * }\n     *\n     * var defaults = _.partialRight(_.assignWith, customizer);\n     *\n     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n     * // => { 'a': 1, 'b': 2 }\n     */\n    var assignWith = createAssigner(function(object, source, srcIndex, customizer) {\n      copyObject(source, keys(source), object, customizer);\n    });\n\n    /**\n     * Creates an array of values corresponding to `paths` of `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.0.0\n     * @category Object\n     * @param {Object} object The object to iterate over.\n     * @param {...(string|string[])} [paths] The property paths of elements to pick.\n     * @returns {Array} Returns the new array of picked elements.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n     *\n     * _.at(object, ['a[0].b.c', 'a[1]']);\n     * // => [3, 4]\n     *\n     * _.at(['a', 'b', 'c'], 0, 2);\n     * // => ['a', 'c']\n     */\n    var at = rest(function(object, paths) {\n      return baseAt(object, baseFlatten(paths, 1));\n    });\n\n    /**\n     * Creates an object that inherits from the `prototype` object. If a\n     * `properties` object is given, its own enumerable string keyed properties\n     * are assigned to the created object.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.3.0\n     * @category Object\n     * @param {Object} prototype The object to inherit from.\n     * @param {Object} [properties] The properties to assign to the object.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * function Shape() {\n     *   this.x = 0;\n     *   this.y = 0;\n     * }\n     *\n     * function Circle() {\n     *   Shape.call(this);\n     * }\n     *\n     * Circle.prototype = _.create(Shape.prototype, {\n     *   'constructor': Circle\n     * });\n     *\n     * var circle = new Circle;\n     * circle instanceof Circle;\n     * // => true\n     *\n     * circle instanceof Shape;\n     * // => true\n     */\n    function create(prototype, properties) {\n      var result = baseCreate(prototype);\n      return properties ? baseAssign(result, properties) : result;\n    }\n\n    /**\n     * Assigns own and inherited enumerable string keyed properties of source\n     * objects to the destination object for all destination properties that\n     * resolve to `undefined`. Source objects are applied from left to right.\n     * Once a property is set, additional values of the same property are ignored.\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} [sources] The source objects.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n     * // => { 'user': 'barney', 'age': 36 }\n     */\n    var defaults = rest(function(args) {\n      args.push(undefined, assignInDefaults);\n      return apply(assignInWith, undefined, args);\n    });\n\n    /**\n     * This method is like `_.defaults` except that it recursively assigns\n     * default properties.\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.10.0\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} [sources] The source objects.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });\n     * // => { 'user': { 'name': 'barney', 'age': 36 } }\n     *\n     */\n    var defaultsDeep = rest(function(args) {\n      args.push(undefined, mergeDefaults);\n      return apply(mergeWith, undefined, args);\n    });\n\n    /**\n     * This method is like `_.find` except that it returns the key of the first\n     * element `predicate` returns truthy for instead of the element itself.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.1.0\n     * @category Object\n     * @param {Object} object The object to search.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {string|undefined} Returns the key of the matched element,\n     *  else `undefined`.\n     * @example\n     *\n     * var users = {\n     *   'barney':  { 'age': 36, 'active': true },\n     *   'fred':    { 'age': 40, 'active': false },\n     *   'pebbles': { 'age': 1,  'active': true }\n     * };\n     *\n     * _.findKey(users, function(o) { return o.age < 40; });\n     * // => 'barney' (iteration order is not guaranteed)\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.findKey(users, { 'age': 1, 'active': true });\n     * // => 'pebbles'\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.findKey(users, ['active', false]);\n     * // => 'fred'\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.findKey(users, 'active');\n     * // => 'barney'\n     */\n    function findKey(object, predicate) {\n      return baseFind(object, getIteratee(predicate, 3), baseForOwn, true);\n    }\n\n    /**\n     * This method is like `_.findKey` except that it iterates over elements of\n     * a collection in the opposite order.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Object\n     * @param {Object} object The object to search.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per iteration.\n     * @returns {string|undefined} Returns the key of the matched element,\n     *  else `undefined`.\n     * @example\n     *\n     * var users = {\n     *   'barney':  { 'age': 36, 'active': true },\n     *   'fred':    { 'age': 40, 'active': false },\n     *   'pebbles': { 'age': 1,  'active': true }\n     * };\n     *\n     * _.findLastKey(users, function(o) { return o.age < 40; });\n     * // => returns 'pebbles' assuming `_.findKey` returns 'barney'\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.findLastKey(users, { 'age': 36, 'active': true });\n     * // => 'barney'\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.findLastKey(users, ['active', false]);\n     * // => 'fred'\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.findLastKey(users, 'active');\n     * // => 'pebbles'\n     */\n    function findLastKey(object, predicate) {\n      return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true);\n    }\n\n    /**\n     * Iterates over own and inherited enumerable string keyed properties of an\n     * object and invokes `iteratee` for each property. The iteratee is invoked\n     * with three arguments: (value, key, object). Iteratee functions may exit\n     * iteration early by explicitly returning `false`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.3.0\n     * @category Object\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.forIn(new Foo, function(value, key) {\n     *   console.log(key);\n     * });\n     * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n     */\n    function forIn(object, iteratee) {\n      return object == null\n        ? object\n        : baseFor(object, getIteratee(iteratee), keysIn);\n    }\n\n    /**\n     * This method is like `_.forIn` except that it iterates over properties of\n     * `object` in the opposite order.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Object\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.forInRight(new Foo, function(value, key) {\n     *   console.log(key);\n     * });\n     * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.\n     */\n    function forInRight(object, iteratee) {\n      return object == null\n        ? object\n        : baseForRight(object, getIteratee(iteratee), keysIn);\n    }\n\n    /**\n     * Iterates over own enumerable string keyed properties of an object and\n     * invokes `iteratee` for each property. The iteratee is invoked with three\n     * arguments: (value, key, object). Iteratee functions may exit iteration\n     * early by explicitly returning `false`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.3.0\n     * @category Object\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.forOwn(new Foo, function(value, key) {\n     *   console.log(key);\n     * });\n     * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n     */\n    function forOwn(object, iteratee) {\n      return object && baseForOwn(object, getIteratee(iteratee));\n    }\n\n    /**\n     * This method is like `_.forOwn` except that it iterates over properties of\n     * `object` in the opposite order.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.0.0\n     * @category Object\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.forOwnRight(new Foo, function(value, key) {\n     *   console.log(key);\n     * });\n     * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.\n     */\n    function forOwnRight(object, iteratee) {\n      return object && baseForOwnRight(object, getIteratee(iteratee));\n    }\n\n    /**\n     * Creates an array of function property names from own enumerable properties\n     * of `object`.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The object to inspect.\n     * @returns {Array} Returns the new array of property names.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = _.constant('a');\n     *   this.b = _.constant('b');\n     * }\n     *\n     * Foo.prototype.c = _.constant('c');\n     *\n     * _.functions(new Foo);\n     * // => ['a', 'b']\n     */\n    function functions(object) {\n      return object == null ? [] : baseFunctions(object, keys(object));\n    }\n\n    /**\n     * Creates an array of function property names from own and inherited\n     * enumerable properties of `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The object to inspect.\n     * @returns {Array} Returns the new array of property names.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = _.constant('a');\n     *   this.b = _.constant('b');\n     * }\n     *\n     * Foo.prototype.c = _.constant('c');\n     *\n     * _.functionsIn(new Foo);\n     * // => ['a', 'b', 'c']\n     */\n    function functionsIn(object) {\n      return object == null ? [] : baseFunctions(object, keysIn(object));\n    }\n\n    /**\n     * Gets the value at `path` of `object`. If the resolved value is\n     * `undefined`, the `defaultValue` is used in its place.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.7.0\n     * @category Object\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path of the property to get.\n     * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n     * @returns {*} Returns the resolved value.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n     *\n     * _.get(object, 'a[0].b.c');\n     * // => 3\n     *\n     * _.get(object, ['a', '0', 'b', 'c']);\n     * // => 3\n     *\n     * _.get(object, 'a.b.c', 'default');\n     * // => 'default'\n     */\n    function get(object, path, defaultValue) {\n      var result = object == null ? undefined : baseGet(object, path);\n      return result === undefined ? defaultValue : result;\n    }\n\n    /**\n     * Checks if `path` is a direct property of `object`.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path to check.\n     * @returns {boolean} Returns `true` if `path` exists, else `false`.\n     * @example\n     *\n     * var object = { 'a': { 'b': 2 } };\n     * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n     *\n     * _.has(object, 'a');\n     * // => true\n     *\n     * _.has(object, 'a.b');\n     * // => true\n     *\n     * _.has(object, ['a', 'b']);\n     * // => true\n     *\n     * _.has(other, 'a');\n     * // => false\n     */\n    function has(object, path) {\n      return object != null && hasPath(object, path, baseHas);\n    }\n\n    /**\n     * Checks if `path` is a direct or inherited property of `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path to check.\n     * @returns {boolean} Returns `true` if `path` exists, else `false`.\n     * @example\n     *\n     * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n     *\n     * _.hasIn(object, 'a');\n     * // => true\n     *\n     * _.hasIn(object, 'a.b');\n     * // => true\n     *\n     * _.hasIn(object, ['a', 'b']);\n     * // => true\n     *\n     * _.hasIn(object, 'b');\n     * // => false\n     */\n    function hasIn(object, path) {\n      return object != null && hasPath(object, path, baseHasIn);\n    }\n\n    /**\n     * Creates an object composed of the inverted keys and values of `object`.\n     * If `object` contains duplicate values, subsequent values overwrite\n     * property assignments of previous values.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.7.0\n     * @category Object\n     * @param {Object} object The object to invert.\n     * @returns {Object} Returns the new inverted object.\n     * @example\n     *\n     * var object = { 'a': 1, 'b': 2, 'c': 1 };\n     *\n     * _.invert(object);\n     * // => { '1': 'c', '2': 'b' }\n     */\n    var invert = createInverter(function(result, value, key) {\n      result[value] = key;\n    }, constant(identity));\n\n    /**\n     * This method is like `_.invert` except that the inverted object is generated\n     * from the results of running each element of `object` thru `iteratee`. The\n     * corresponding inverted value of each inverted key is an array of keys\n     * responsible for generating the inverted value. The iteratee is invoked\n     * with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.1.0\n     * @category Object\n     * @param {Object} object The object to invert.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {Object} Returns the new inverted object.\n     * @example\n     *\n     * var object = { 'a': 1, 'b': 2, 'c': 1 };\n     *\n     * _.invertBy(object);\n     * // => { '1': ['a', 'c'], '2': ['b'] }\n     *\n     * _.invertBy(object, function(value) {\n     *   return 'group' + value;\n     * });\n     * // => { 'group1': ['a', 'c'], 'group2': ['b'] }\n     */\n    var invertBy = createInverter(function(result, value, key) {\n      if (hasOwnProperty.call(result, value)) {\n        result[value].push(key);\n      } else {\n        result[value] = [key];\n      }\n    }, getIteratee);\n\n    /**\n     * Invokes the method at `path` of `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path of the method to invoke.\n     * @param {...*} [args] The arguments to invoke the method with.\n     * @returns {*} Returns the result of the invoked method.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n     *\n     * _.invoke(object, 'a[0].b.c.slice', 1, 3);\n     * // => [2, 3]\n     */\n    var invoke = rest(baseInvoke);\n\n    /**\n     * Creates an array of the own enumerable property names of `object`.\n     *\n     * **Note:** Non-object values are coerced to objects. See the\n     * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n     * for more details.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property names.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.keys(new Foo);\n     * // => ['a', 'b'] (iteration order is not guaranteed)\n     *\n     * _.keys('hi');\n     * // => ['0', '1']\n     */\n    function keys(object) {\n      var isProto = isPrototype(object);\n      if (!(isProto || isArrayLike(object))) {\n        return baseKeys(object);\n      }\n      var indexes = indexKeys(object),\n          skipIndexes = !!indexes,\n          result = indexes || [],\n          length = result.length;\n\n      for (var key in object) {\n        if (baseHas(object, key) &&\n            !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n            !(isProto && key == 'constructor')) {\n          result.push(key);\n        }\n      }\n      return result;\n    }\n\n    /**\n     * Creates an array of the own and inherited enumerable property names of `object`.\n     *\n     * **Note:** Non-object values are coerced to objects.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Object\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property names.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.keysIn(new Foo);\n     * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n     */\n    function keysIn(object) {\n      var index = -1,\n          isProto = isPrototype(object),\n          props = baseKeysIn(object),\n          propsLength = props.length,\n          indexes = indexKeys(object),\n          skipIndexes = !!indexes,\n          result = indexes || [],\n          length = result.length;\n\n      while (++index < propsLength) {\n        var key = props[index];\n        if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n            !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n          result.push(key);\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The opposite of `_.mapValues`; this method creates an object with the\n     * same values as `object` and keys generated by running each own enumerable\n     * string keyed property of `object` thru `iteratee`. The iteratee is invoked\n     * with three arguments: (value, key, object).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.8.0\n     * @category Object\n     * @param {Object} object The object to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Object} Returns the new mapped object.\n     * @example\n     *\n     * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n     *   return key + value;\n     * });\n     * // => { 'a1': 1, 'b2': 2 }\n     */\n    function mapKeys(object, iteratee) {\n      var result = {};\n      iteratee = getIteratee(iteratee, 3);\n\n      baseForOwn(object, function(value, key, object) {\n        result[iteratee(value, key, object)] = value;\n      });\n      return result;\n    }\n\n    /**\n     * Creates an object with the same keys as `object` and values generated\n     * by running each own enumerable string keyed property of `object` thru\n     * `iteratee`. The iteratee is invoked with three arguments:\n     * (value, key, object).\n     *\n     * @static\n     * @memberOf _\n     * @since 2.4.0\n     * @category Object\n     * @param {Object} object The object to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The function invoked per iteration.\n     * @returns {Object} Returns the new mapped object.\n     * @example\n     *\n     * var users = {\n     *   'fred':    { 'user': 'fred',    'age': 40 },\n     *   'pebbles': { 'user': 'pebbles', 'age': 1 }\n     * };\n     *\n     * _.mapValues(users, function(o) { return o.age; });\n     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.mapValues(users, 'age');\n     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n     */\n    function mapValues(object, iteratee) {\n      var result = {};\n      iteratee = getIteratee(iteratee, 3);\n\n      baseForOwn(object, function(value, key, object) {\n        result[key] = iteratee(value, key, object);\n      });\n      return result;\n    }\n\n    /**\n     * This method is like `_.assign` except that it recursively merges own and\n     * inherited enumerable string keyed properties of source objects into the\n     * destination object. Source properties that resolve to `undefined` are\n     * skipped if a destination value exists. Array and plain object properties\n     * are merged recursively.Other objects and value types are overridden by\n     * assignment. Source objects are applied from left to right. Subsequent\n     * sources overwrite property assignments of previous sources.\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.5.0\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} [sources] The source objects.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * var users = {\n     *   'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n     * };\n     *\n     * var ages = {\n     *   'data': [{ 'age': 36 }, { 'age': 40 }]\n     * };\n     *\n     * _.merge(users, ages);\n     * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n     */\n    var merge = createAssigner(function(object, source, srcIndex) {\n      baseMerge(object, source, srcIndex);\n    });\n\n    /**\n     * This method is like `_.merge` except that it accepts `customizer` which\n     * is invoked to produce the merged values of the destination and source\n     * properties. If `customizer` returns `undefined`, merging is handled by the\n     * method instead. The `customizer` is invoked with seven arguments:\n     * (objValue, srcValue, key, object, source, stack).\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The destination object.\n     * @param {...Object} sources The source objects.\n     * @param {Function} customizer The function to customize assigned values.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function customizer(objValue, srcValue) {\n     *   if (_.isArray(objValue)) {\n     *     return objValue.concat(srcValue);\n     *   }\n     * }\n     *\n     * var object = {\n     *   'fruits': ['apple'],\n     *   'vegetables': ['beet']\n     * };\n     *\n     * var other = {\n     *   'fruits': ['banana'],\n     *   'vegetables': ['carrot']\n     * };\n     *\n     * _.mergeWith(object, other, customizer);\n     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n     */\n    var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n      baseMerge(object, source, srcIndex, customizer);\n    });\n\n    /**\n     * The opposite of `_.pick`; this method creates an object composed of the\n     * own and inherited enumerable string keyed properties of `object` that are\n     * not omitted.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The source object.\n     * @param {...(string|string[])} [props] The property identifiers to omit.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\n     *\n     * _.omit(object, ['a', 'c']);\n     * // => { 'b': '2' }\n     */\n    var omit = rest(function(object, props) {\n      if (object == null) {\n        return {};\n      }\n      props = arrayMap(baseFlatten(props, 1), toKey);\n      return basePick(object, baseDifference(getAllKeysIn(object), props));\n    });\n\n    /**\n     * The opposite of `_.pickBy`; this method creates an object composed of\n     * the own and inherited enumerable string keyed properties of `object` that\n     * `predicate` doesn't return truthy for. The predicate is invoked with two\n     * arguments: (value, key).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The source object.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per property.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\n     *\n     * _.omitBy(object, _.isNumber);\n     * // => { 'b': '2' }\n     */\n    function omitBy(object, predicate) {\n      predicate = getIteratee(predicate);\n      return basePickBy(object, function(value, key) {\n        return !predicate(value, key);\n      });\n    }\n\n    /**\n     * Creates an object composed of the picked `object` properties.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The source object.\n     * @param {...(string|string[])} [props] The property identifiers to pick.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\n     *\n     * _.pick(object, ['a', 'c']);\n     * // => { 'a': 1, 'c': 3 }\n     */\n    var pick = rest(function(object, props) {\n      return object == null ? {} : basePick(object, baseFlatten(props, 1));\n    });\n\n    /**\n     * Creates an object composed of the `object` properties `predicate` returns\n     * truthy for. The predicate is invoked with two arguments: (value, key).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The source object.\n     * @param {Array|Function|Object|string} [predicate=_.identity]\n     *  The function invoked per property.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\n     *\n     * _.pickBy(object, _.isNumber);\n     * // => { 'a': 1, 'c': 3 }\n     */\n    function pickBy(object, predicate) {\n      return object == null ? {} : basePickBy(object, getIteratee(predicate));\n    }\n\n    /**\n     * This method is like `_.get` except that if the resolved value is a\n     * function it's invoked with the `this` binding of its parent object and\n     * its result is returned.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The object to query.\n     * @param {Array|string} path The path of the property to resolve.\n     * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n     * @returns {*} Returns the resolved value.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n     *\n     * _.result(object, 'a[0].b.c1');\n     * // => 3\n     *\n     * _.result(object, 'a[0].b.c2');\n     * // => 4\n     *\n     * _.result(object, 'a[0].b.c3', 'default');\n     * // => 'default'\n     *\n     * _.result(object, 'a[0].b.c3', _.constant('default'));\n     * // => 'default'\n     */\n    function result(object, path, defaultValue) {\n      path = isKey(path, object) ? [path] : castPath(path);\n\n      var index = -1,\n          length = path.length;\n\n      // Ensure the loop is entered when path is empty.\n      if (!length) {\n        object = undefined;\n        length = 1;\n      }\n      while (++index < length) {\n        var value = object == null ? undefined : object[path[index]];\n        if (value === undefined) {\n          index = length;\n          value = defaultValue;\n        }\n        object = isFunction(value) ? value.call(object) : value;\n      }\n      return object;\n    }\n\n    /**\n     * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n     * it's created. Arrays are created for missing index properties while objects\n     * are created for all other missing properties. Use `_.setWith` to customize\n     * `path` creation.\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.7.0\n     * @category Object\n     * @param {Object} object The object to modify.\n     * @param {Array|string} path The path of the property to set.\n     * @param {*} value The value to set.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n     *\n     * _.set(object, 'a[0].b.c', 4);\n     * console.log(object.a[0].b.c);\n     * // => 4\n     *\n     * _.set(object, ['x', '0', 'y', 'z'], 5);\n     * console.log(object.x[0].y.z);\n     * // => 5\n     */\n    function set(object, path, value) {\n      return object == null ? object : baseSet(object, path, value);\n    }\n\n    /**\n     * This method is like `_.set` except that it accepts `customizer` which is\n     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`\n     * path creation is handled by the method instead. The `customizer` is invoked\n     * with three arguments: (nsValue, key, nsObject).\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The object to modify.\n     * @param {Array|string} path The path of the property to set.\n     * @param {*} value The value to set.\n     * @param {Function} [customizer] The function to customize assigned values.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * var object = {};\n     *\n     * _.setWith(object, '[0][1]', 'a', Object);\n     * // => { '0': { '1': 'a' } }\n     */\n    function setWith(object, path, value, customizer) {\n      customizer = typeof customizer == 'function' ? customizer : undefined;\n      return object == null ? object : baseSet(object, path, value, customizer);\n    }\n\n    /**\n     * Creates an array of own enumerable string keyed-value pairs for `object`\n     * which can be consumed by `_.fromPairs`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @alias entries\n     * @category Object\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the new array of key-value pairs.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.toPairs(new Foo);\n     * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\n     */\n    function toPairs(object) {\n      return baseToPairs(object, keys(object));\n    }\n\n    /**\n     * Creates an array of own and inherited enumerable string keyed-value pairs\n     * for `object` which can be consumed by `_.fromPairs`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @alias entriesIn\n     * @category Object\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the new array of key-value pairs.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.toPairsIn(new Foo);\n     * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed)\n     */\n    function toPairsIn(object) {\n      return baseToPairs(object, keysIn(object));\n    }\n\n    /**\n     * An alternative to `_.reduce`; this method transforms `object` to a new\n     * `accumulator` object which is the result of running each of its own\n     * enumerable string keyed properties thru `iteratee`, with each invocation\n     * potentially mutating the `accumulator` object. The iteratee is invoked\n     * with four arguments: (accumulator, value, key, object). Iteratee functions\n     * may exit iteration early by explicitly returning `false`.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.3.0\n     * @category Object\n     * @param {Array|Object} object The object to iterate over.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @param {*} [accumulator] The custom accumulator value.\n     * @returns {*} Returns the accumulated value.\n     * @example\n     *\n     * _.transform([2, 3, 4], function(result, n) {\n     *   result.push(n *= n);\n     *   return n % 2 == 0;\n     * }, []);\n     * // => [4, 9]\n     *\n     * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n     *   (result[value] || (result[value] = [])).push(key);\n     * }, {});\n     * // => { '1': ['a', 'c'], '2': ['b'] }\n     */\n    function transform(object, iteratee, accumulator) {\n      var isArr = isArray(object) || isTypedArray(object);\n      iteratee = getIteratee(iteratee, 4);\n\n      if (accumulator == null) {\n        if (isArr || isObject(object)) {\n          var Ctor = object.constructor;\n          if (isArr) {\n            accumulator = isArray(object) ? new Ctor : [];\n          } else {\n            accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\n          }\n        } else {\n          accumulator = {};\n        }\n      }\n      (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {\n        return iteratee(accumulator, value, index, object);\n      });\n      return accumulator;\n    }\n\n    /**\n     * Removes the property at `path` of `object`.\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Object\n     * @param {Object} object The object to modify.\n     * @param {Array|string} path The path of the property to unset.\n     * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c': 7 } }] };\n     * _.unset(object, 'a[0].b.c');\n     * // => true\n     *\n     * console.log(object);\n     * // => { 'a': [{ 'b': {} }] };\n     *\n     * _.unset(object, ['a', '0', 'b', 'c']);\n     * // => true\n     *\n     * console.log(object);\n     * // => { 'a': [{ 'b': {} }] };\n     */\n    function unset(object, path) {\n      return object == null ? true : baseUnset(object, path);\n    }\n\n    /**\n     * This method is like `_.set` except that accepts `updater` to produce the\n     * value to set. Use `_.updateWith` to customize `path` creation. The `updater`\n     * is invoked with one argument: (value).\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.6.0\n     * @category Object\n     * @param {Object} object The object to modify.\n     * @param {Array|string} path The path of the property to set.\n     * @param {Function} updater The function to produce the updated value.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n     *\n     * _.update(object, 'a[0].b.c', function(n) { return n * n; });\n     * console.log(object.a[0].b.c);\n     * // => 9\n     *\n     * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });\n     * console.log(object.x[0].y.z);\n     * // => 0\n     */\n    function update(object, path, updater) {\n      return object == null ? object : baseUpdate(object, path, castFunction(updater));\n    }\n\n    /**\n     * This method is like `_.update` except that it accepts `customizer` which is\n     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`\n     * path creation is handled by the method instead. The `customizer` is invoked\n     * with three arguments: (nsValue, key, nsObject).\n     *\n     * **Note:** This method mutates `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.6.0\n     * @category Object\n     * @param {Object} object The object to modify.\n     * @param {Array|string} path The path of the property to set.\n     * @param {Function} updater The function to produce the updated value.\n     * @param {Function} [customizer] The function to customize assigned values.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * var object = {};\n     *\n     * _.updateWith(object, '[0][1]', _.constant('a'), Object);\n     * // => { '0': { '1': 'a' } }\n     */\n    function updateWith(object, path, updater, customizer) {\n      customizer = typeof customizer == 'function' ? customizer : undefined;\n      return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);\n    }\n\n    /**\n     * Creates an array of the own enumerable string keyed property values of `object`.\n     *\n     * **Note:** Non-object values are coerced to objects.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Object\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property values.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.values(new Foo);\n     * // => [1, 2] (iteration order is not guaranteed)\n     *\n     * _.values('hi');\n     * // => ['h', 'i']\n     */\n    function values(object) {\n      return object ? baseValues(object, keys(object)) : [];\n    }\n\n    /**\n     * Creates an array of the own and inherited enumerable string keyed property\n     * values of `object`.\n     *\n     * **Note:** Non-object values are coerced to objects.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Object\n     * @param {Object} object The object to query.\n     * @returns {Array} Returns the array of property values.\n     * @example\n     *\n     * function Foo() {\n     *   this.a = 1;\n     *   this.b = 2;\n     * }\n     *\n     * Foo.prototype.c = 3;\n     *\n     * _.valuesIn(new Foo);\n     * // => [1, 2, 3] (iteration order is not guaranteed)\n     */\n    function valuesIn(object) {\n      return object == null ? [] : baseValues(object, keysIn(object));\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Clamps `number` within the inclusive `lower` and `upper` bounds.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Number\n     * @param {number} number The number to clamp.\n     * @param {number} [lower] The lower bound.\n     * @param {number} upper The upper bound.\n     * @returns {number} Returns the clamped number.\n     * @example\n     *\n     * _.clamp(-10, -5, 5);\n     * // => -5\n     *\n     * _.clamp(10, -5, 5);\n     * // => 5\n     */\n    function clamp(number, lower, upper) {\n      if (upper === undefined) {\n        upper = lower;\n        lower = undefined;\n      }\n      if (upper !== undefined) {\n        upper = toNumber(upper);\n        upper = upper === upper ? upper : 0;\n      }\n      if (lower !== undefined) {\n        lower = toNumber(lower);\n        lower = lower === lower ? lower : 0;\n      }\n      return baseClamp(toNumber(number), lower, upper);\n    }\n\n    /**\n     * Checks if `n` is between `start` and up to but not including, `end`. If\n     * `end` is not specified, it's set to `start` with `start` then set to `0`.\n     * If `start` is greater than `end` the params are swapped to support\n     * negative ranges.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.3.0\n     * @category Number\n     * @param {number} number The number to check.\n     * @param {number} [start=0] The start of the range.\n     * @param {number} end The end of the range.\n     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n     * @example\n     *\n     * _.inRange(3, 2, 4);\n     * // => true\n     *\n     * _.inRange(4, 8);\n     * // => true\n     *\n     * _.inRange(4, 2);\n     * // => false\n     *\n     * _.inRange(2, 2);\n     * // => false\n     *\n     * _.inRange(1.2, 2);\n     * // => true\n     *\n     * _.inRange(5.2, 4);\n     * // => false\n     *\n     * _.inRange(-3, -2, -6);\n     * // => true\n     */\n    function inRange(number, start, end) {\n      start = toNumber(start) || 0;\n      if (end === undefined) {\n        end = start;\n        start = 0;\n      } else {\n        end = toNumber(end) || 0;\n      }\n      number = toNumber(number);\n      return baseInRange(number, start, end);\n    }\n\n    /**\n     * Produces a random number between the inclusive `lower` and `upper` bounds.\n     * If only one argument is provided a number between `0` and the given number\n     * is returned. If `floating` is `true`, or either `lower` or `upper` are\n     * floats, a floating-point number is returned instead of an integer.\n     *\n     * **Note:** JavaScript follows the IEEE-754 standard for resolving\n     * floating-point values which can produce unexpected results.\n     *\n     * @static\n     * @memberOf _\n     * @since 0.7.0\n     * @category Number\n     * @param {number} [lower=0] The lower bound.\n     * @param {number} [upper=1] The upper bound.\n     * @param {boolean} [floating] Specify returning a floating-point number.\n     * @returns {number} Returns the random number.\n     * @example\n     *\n     * _.random(0, 5);\n     * // => an integer between 0 and 5\n     *\n     * _.random(5);\n     * // => also an integer between 0 and 5\n     *\n     * _.random(5, true);\n     * // => a floating-point number between 0 and 5\n     *\n     * _.random(1.2, 5.2);\n     * // => a floating-point number between 1.2 and 5.2\n     */\n    function random(lower, upper, floating) {\n      if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {\n        upper = floating = undefined;\n      }\n      if (floating === undefined) {\n        if (typeof upper == 'boolean') {\n          floating = upper;\n          upper = undefined;\n        }\n        else if (typeof lower == 'boolean') {\n          floating = lower;\n          lower = undefined;\n        }\n      }\n      if (lower === undefined && upper === undefined) {\n        lower = 0;\n        upper = 1;\n      }\n      else {\n        lower = toNumber(lower) || 0;\n        if (upper === undefined) {\n          upper = lower;\n          lower = 0;\n        } else {\n          upper = toNumber(upper) || 0;\n        }\n      }\n      if (lower > upper) {\n        var temp = lower;\n        lower = upper;\n        upper = temp;\n      }\n      if (floating || lower % 1 || upper % 1) {\n        var rand = nativeRandom();\n        return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);\n      }\n      return baseRandom(lower, upper);\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the camel cased string.\n     * @example\n     *\n     * _.camelCase('Foo Bar');\n     * // => 'fooBar'\n     *\n     * _.camelCase('--foo-bar--');\n     * // => 'fooBar'\n     *\n     * _.camelCase('__FOO_BAR__');\n     * // => 'fooBar'\n     */\n    var camelCase = createCompounder(function(result, word, index) {\n      word = word.toLowerCase();\n      return result + (index ? capitalize(word) : word);\n    });\n\n    /**\n     * Converts the first character of `string` to upper case and the remaining\n     * to lower case.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to capitalize.\n     * @returns {string} Returns the capitalized string.\n     * @example\n     *\n     * _.capitalize('FRED');\n     * // => 'Fred'\n     */\n    function capitalize(string) {\n      return upperFirst(toString(string).toLowerCase());\n    }\n\n    /**\n     * Deburrs `string` by converting\n     * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n     * to basic latin letters and removing\n     * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to deburr.\n     * @returns {string} Returns the deburred string.\n     * @example\n     *\n     * _.deburr('déjà vu');\n     * // => 'deja vu'\n     */\n    function deburr(string) {\n      string = toString(string);\n      return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');\n    }\n\n    /**\n     * Checks if `string` ends with the given target string.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to search.\n     * @param {string} [target] The string to search for.\n     * @param {number} [position=string.length] The position to search from.\n     * @returns {boolean} Returns `true` if `string` ends with `target`,\n     *  else `false`.\n     * @example\n     *\n     * _.endsWith('abc', 'c');\n     * // => true\n     *\n     * _.endsWith('abc', 'b');\n     * // => false\n     *\n     * _.endsWith('abc', 'b', 2);\n     * // => true\n     */\n    function endsWith(string, target, position) {\n      string = toString(string);\n      target = typeof target == 'string' ? target : (target + '');\n\n      var length = string.length;\n      position = position === undefined\n        ? length\n        : baseClamp(toInteger(position), 0, length);\n\n      position -= target.length;\n      return position >= 0 && string.indexOf(target, position) == position;\n    }\n\n    /**\n     * Converts the characters \"&\", \"<\", \">\", '\"', \"'\", and \"\\`\" in `string` to\n     * their corresponding HTML entities.\n     *\n     * **Note:** No other characters are escaped. To escape additional\n     * characters use a third-party library like [_he_](https://mths.be/he).\n     *\n     * Though the \">\" character is escaped for symmetry, characters like\n     * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n     * unless they're part of a tag or unquoted attribute value. See\n     * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n     * (under \"semi-related fun fact\") for more details.\n     *\n     * Backticks are escaped because in IE < 9, they can break out of\n     * attribute values or HTML comments. See [#59](https://html5sec.org/#59),\n     * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and\n     * [#133](https://html5sec.org/#133) of the\n     * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.\n     *\n     * When working with HTML you should always\n     * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n     * XSS vectors.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category String\n     * @param {string} [string=''] The string to escape.\n     * @returns {string} Returns the escaped string.\n     * @example\n     *\n     * _.escape('fred, barney, & pebbles');\n     * // => 'fred, barney, &amp; pebbles'\n     */\n    function escape(string) {\n      string = toString(string);\n      return (string && reHasUnescapedHtml.test(string))\n        ? string.replace(reUnescapedHtml, escapeHtmlChar)\n        : string;\n    }\n\n    /**\n     * Escapes the `RegExp` special characters \"^\", \"$\", \"\\\", \".\", \"*\", \"+\",\n     * \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", and \"|\" in `string`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to escape.\n     * @returns {string} Returns the escaped string.\n     * @example\n     *\n     * _.escapeRegExp('[lodash](https://lodash.com/)');\n     * // => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n     */\n    function escapeRegExp(string) {\n      string = toString(string);\n      return (string && reHasRegExpChar.test(string))\n        ? string.replace(reRegExpChar, '\\\\$&')\n        : string;\n    }\n\n    /**\n     * Converts `string` to\n     * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the kebab cased string.\n     * @example\n     *\n     * _.kebabCase('Foo Bar');\n     * // => 'foo-bar'\n     *\n     * _.kebabCase('fooBar');\n     * // => 'foo-bar'\n     *\n     * _.kebabCase('__FOO_BAR__');\n     * // => 'foo-bar'\n     */\n    var kebabCase = createCompounder(function(result, word, index) {\n      return result + (index ? '-' : '') + word.toLowerCase();\n    });\n\n    /**\n     * Converts `string`, as space separated words, to lower case.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the lower cased string.\n     * @example\n     *\n     * _.lowerCase('--Foo-Bar--');\n     * // => 'foo bar'\n     *\n     * _.lowerCase('fooBar');\n     * // => 'foo bar'\n     *\n     * _.lowerCase('__FOO_BAR__');\n     * // => 'foo bar'\n     */\n    var lowerCase = createCompounder(function(result, word, index) {\n      return result + (index ? ' ' : '') + word.toLowerCase();\n    });\n\n    /**\n     * Converts the first character of `string` to lower case.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the converted string.\n     * @example\n     *\n     * _.lowerFirst('Fred');\n     * // => 'fred'\n     *\n     * _.lowerFirst('FRED');\n     * // => 'fRED'\n     */\n    var lowerFirst = createCaseFirst('toLowerCase');\n\n    /**\n     * Pads `string` on the left and right sides if it's shorter than `length`.\n     * Padding characters are truncated if they can't be evenly divided by `length`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to pad.\n     * @param {number} [length=0] The padding length.\n     * @param {string} [chars=' '] The string used as padding.\n     * @returns {string} Returns the padded string.\n     * @example\n     *\n     * _.pad('abc', 8);\n     * // => '  abc   '\n     *\n     * _.pad('abc', 8, '_-');\n     * // => '_-abc_-_'\n     *\n     * _.pad('abc', 3);\n     * // => 'abc'\n     */\n    function pad(string, length, chars) {\n      string = toString(string);\n      length = toInteger(length);\n\n      var strLength = length ? stringSize(string) : 0;\n      if (!length || strLength >= length) {\n        return string;\n      }\n      var mid = (length - strLength) / 2;\n      return (\n        createPadding(nativeFloor(mid), chars) +\n        string +\n        createPadding(nativeCeil(mid), chars)\n      );\n    }\n\n    /**\n     * Pads `string` on the right side if it's shorter than `length`. Padding\n     * characters are truncated if they exceed `length`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to pad.\n     * @param {number} [length=0] The padding length.\n     * @param {string} [chars=' '] The string used as padding.\n     * @returns {string} Returns the padded string.\n     * @example\n     *\n     * _.padEnd('abc', 6);\n     * // => 'abc   '\n     *\n     * _.padEnd('abc', 6, '_-');\n     * // => 'abc_-_'\n     *\n     * _.padEnd('abc', 3);\n     * // => 'abc'\n     */\n    function padEnd(string, length, chars) {\n      string = toString(string);\n      length = toInteger(length);\n\n      var strLength = length ? stringSize(string) : 0;\n      return (length && strLength < length)\n        ? (string + createPadding(length - strLength, chars))\n        : string;\n    }\n\n    /**\n     * Pads `string` on the left side if it's shorter than `length`. Padding\n     * characters are truncated if they exceed `length`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to pad.\n     * @param {number} [length=0] The padding length.\n     * @param {string} [chars=' '] The string used as padding.\n     * @returns {string} Returns the padded string.\n     * @example\n     *\n     * _.padStart('abc', 6);\n     * // => '   abc'\n     *\n     * _.padStart('abc', 6, '_-');\n     * // => '_-_abc'\n     *\n     * _.padStart('abc', 3);\n     * // => 'abc'\n     */\n    function padStart(string, length, chars) {\n      string = toString(string);\n      length = toInteger(length);\n\n      var strLength = length ? stringSize(string) : 0;\n      return (length && strLength < length)\n        ? (createPadding(length - strLength, chars) + string)\n        : string;\n    }\n\n    /**\n     * Converts `string` to an integer of the specified radix. If `radix` is\n     * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\n     * hexadecimal, in which case a `radix` of `16` is used.\n     *\n     * **Note:** This method aligns with the\n     * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\n     *\n     * @static\n     * @memberOf _\n     * @since 1.1.0\n     * @category String\n     * @param {string} string The string to convert.\n     * @param {number} [radix=10] The radix to interpret `value` by.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {number} Returns the converted integer.\n     * @example\n     *\n     * _.parseInt('08');\n     * // => 8\n     *\n     * _.map(['6', '08', '10'], _.parseInt);\n     * // => [6, 8, 10]\n     */\n    function parseInt(string, radix, guard) {\n      // Chrome fails to trim leading <BOM> whitespace characters.\n      // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details.\n      if (guard || radix == null) {\n        radix = 0;\n      } else if (radix) {\n        radix = +radix;\n      }\n      string = toString(string).replace(reTrim, '');\n      return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));\n    }\n\n    /**\n     * Repeats the given string `n` times.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to repeat.\n     * @param {number} [n=1] The number of times to repeat the string.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {string} Returns the repeated string.\n     * @example\n     *\n     * _.repeat('*', 3);\n     * // => '***'\n     *\n     * _.repeat('abc', 2);\n     * // => 'abcabc'\n     *\n     * _.repeat('abc', 0);\n     * // => ''\n     */\n    function repeat(string, n, guard) {\n      if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {\n        n = 1;\n      } else {\n        n = toInteger(n);\n      }\n      return baseRepeat(toString(string), n);\n    }\n\n    /**\n     * Replaces matches for `pattern` in `string` with `replacement`.\n     *\n     * **Note:** This method is based on\n     * [`String#replace`](https://mdn.io/String/replace).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to modify.\n     * @param {RegExp|string} pattern The pattern to replace.\n     * @param {Function|string} replacement The match replacement.\n     * @returns {string} Returns the modified string.\n     * @example\n     *\n     * _.replace('Hi Fred', 'Fred', 'Barney');\n     * // => 'Hi Barney'\n     */\n    function replace() {\n      var args = arguments,\n          string = toString(args[0]);\n\n      return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);\n    }\n\n    /**\n     * Converts `string` to\n     * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the snake cased string.\n     * @example\n     *\n     * _.snakeCase('Foo Bar');\n     * // => 'foo_bar'\n     *\n     * _.snakeCase('fooBar');\n     * // => 'foo_bar'\n     *\n     * _.snakeCase('--FOO-BAR--');\n     * // => 'foo_bar'\n     */\n    var snakeCase = createCompounder(function(result, word, index) {\n      return result + (index ? '_' : '') + word.toLowerCase();\n    });\n\n    /**\n     * Splits `string` by `separator`.\n     *\n     * **Note:** This method is based on\n     * [`String#split`](https://mdn.io/String/split).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to split.\n     * @param {RegExp|string} separator The separator pattern to split by.\n     * @param {number} [limit] The length to truncate results to.\n     * @returns {Array} Returns the new array of string segments.\n     * @example\n     *\n     * _.split('a-b-c', '-', 2);\n     * // => ['a', 'b']\n     */\n    function split(string, separator, limit) {\n      if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {\n        separator = limit = undefined;\n      }\n      limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;\n      if (!limit) {\n        return [];\n      }\n      string = toString(string);\n      if (string && (\n            typeof separator == 'string' ||\n            (separator != null && !isRegExp(separator))\n          )) {\n        separator += '';\n        if (separator == '' && reHasComplexSymbol.test(string)) {\n          return castSlice(stringToArray(string), 0, limit);\n        }\n      }\n      return nativeSplit.call(string, separator, limit);\n    }\n\n    /**\n     * Converts `string` to\n     * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n     *\n     * @static\n     * @memberOf _\n     * @since 3.1.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the start cased string.\n     * @example\n     *\n     * _.startCase('--foo-bar--');\n     * // => 'Foo Bar'\n     *\n     * _.startCase('fooBar');\n     * // => 'Foo Bar'\n     *\n     * _.startCase('__FOO_BAR__');\n     * // => 'FOO BAR'\n     */\n    var startCase = createCompounder(function(result, word, index) {\n      return result + (index ? ' ' : '') + upperFirst(word);\n    });\n\n    /**\n     * Checks if `string` starts with the given target string.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to search.\n     * @param {string} [target] The string to search for.\n     * @param {number} [position=0] The position to search from.\n     * @returns {boolean} Returns `true` if `string` starts with `target`,\n     *  else `false`.\n     * @example\n     *\n     * _.startsWith('abc', 'a');\n     * // => true\n     *\n     * _.startsWith('abc', 'b');\n     * // => false\n     *\n     * _.startsWith('abc', 'b', 1);\n     * // => true\n     */\n    function startsWith(string, target, position) {\n      string = toString(string);\n      position = baseClamp(toInteger(position), 0, string.length);\n      return string.lastIndexOf(target, position) == position;\n    }\n\n    /**\n     * Creates a compiled template function that can interpolate data properties\n     * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n     * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n     * properties may be accessed as free variables in the template. If a setting\n     * object is given, it takes precedence over `_.templateSettings` values.\n     *\n     * **Note:** In the development build `_.template` utilizes\n     * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n     * for easier debugging.\n     *\n     * For more information on precompiling templates see\n     * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n     *\n     * For more information on Chrome extension sandboxes see\n     * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category String\n     * @param {string} [string=''] The template string.\n     * @param {Object} [options={}] The options object.\n     * @param {RegExp} [options.escape=_.templateSettings.escape]\n     *  The HTML \"escape\" delimiter.\n     * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n     *  The \"evaluate\" delimiter.\n     * @param {Object} [options.imports=_.templateSettings.imports]\n     *  An object to import into the template as free variables.\n     * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n     *  The \"interpolate\" delimiter.\n     * @param {string} [options.sourceURL='lodash.templateSources[n]']\n     *  The sourceURL of the compiled template.\n     * @param {string} [options.variable='obj']\n     *  The data object variable name.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Function} Returns the compiled template function.\n     * @example\n     *\n     * // Use the \"interpolate\" delimiter to create a compiled template.\n     * var compiled = _.template('hello <%= user %>!');\n     * compiled({ 'user': 'fred' });\n     * // => 'hello fred!'\n     *\n     * // Use the HTML \"escape\" delimiter to escape data property values.\n     * var compiled = _.template('<b><%- value %></b>');\n     * compiled({ 'value': '<script>' });\n     * // => '<b>&lt;script&gt;</b>'\n     *\n     * // Use the \"evaluate\" delimiter to execute JavaScript and generate HTML.\n     * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\n     * compiled({ 'users': ['fred', 'barney'] });\n     * // => '<li>fred</li><li>barney</li>'\n     *\n     * // Use the internal `print` function in \"evaluate\" delimiters.\n     * var compiled = _.template('<% print(\"hello \" + user); %>!');\n     * compiled({ 'user': 'barney' });\n     * // => 'hello barney!'\n     *\n     * // Use the ES delimiter as an alternative to the default \"interpolate\" delimiter.\n     * var compiled = _.template('hello ${ user }!');\n     * compiled({ 'user': 'pebbles' });\n     * // => 'hello pebbles!'\n     *\n     * // Use custom template delimiters.\n     * _.templateSettings.interpolate = /{{([\\s\\S]+?)}}/g;\n     * var compiled = _.template('hello {{ user }}!');\n     * compiled({ 'user': 'mustache' });\n     * // => 'hello mustache!'\n     *\n     * // Use backslashes to treat delimiters as plain text.\n     * var compiled = _.template('<%= \"\\\\<%- value %\\\\>\" %>');\n     * compiled({ 'value': 'ignored' });\n     * // => '<%- value %>'\n     *\n     * // Use the `imports` option to import `jQuery` as `jq`.\n     * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\n     * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });\n     * compiled({ 'users': ['fred', 'barney'] });\n     * // => '<li>fred</li><li>barney</li>'\n     *\n     * // Use the `sourceURL` option to specify a custom sourceURL for the template.\n     * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\n     * compiled(data);\n     * // => Find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector.\n     *\n     * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.\n     * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\n     * compiled.source;\n     * // => function(data) {\n     * //   var __t, __p = '';\n     * //   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\n     * //   return __p;\n     * // }\n     *\n     * // Use the `source` property to inline compiled templates for meaningful\n     * // line numbers in error messages and stack traces.\n     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\\\n     *   var JST = {\\\n     *     \"main\": ' + _.template(mainText).source + '\\\n     *   };\\\n     * ');\n     */\n    function template(string, options, guard) {\n      // Based on John Resig's `tmpl` implementation\n      // (http://ejohn.org/blog/javascript-micro-templating/)\n      // and Laura Doktorova's doT.js (https://github.com/olado/doT).\n      var settings = lodash.templateSettings;\n\n      if (guard && isIterateeCall(string, options, guard)) {\n        options = undefined;\n      }\n      string = toString(string);\n      options = assignInWith({}, options, settings, assignInDefaults);\n\n      var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults),\n          importsKeys = keys(imports),\n          importsValues = baseValues(imports, importsKeys);\n\n      var isEscaping,\n          isEvaluating,\n          index = 0,\n          interpolate = options.interpolate || reNoMatch,\n          source = \"__p += '\";\n\n      // Compile the regexp to match each delimiter.\n      var reDelimiters = RegExp(\n        (options.escape || reNoMatch).source + '|' +\n        interpolate.source + '|' +\n        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +\n        (options.evaluate || reNoMatch).source + '|$'\n      , 'g');\n\n      // Use a sourceURL for easier debugging.\n      var sourceURL = '//# sourceURL=' +\n        ('sourceURL' in options\n          ? options.sourceURL\n          : ('lodash.templateSources[' + (++templateCounter) + ']')\n        ) + '\\n';\n\n      string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {\n        interpolateValue || (interpolateValue = esTemplateValue);\n\n        // Escape characters that can't be included in string literals.\n        source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);\n\n        // Replace delimiters with snippets.\n        if (escapeValue) {\n          isEscaping = true;\n          source += \"' +\\n__e(\" + escapeValue + \") +\\n'\";\n        }\n        if (evaluateValue) {\n          isEvaluating = true;\n          source += \"';\\n\" + evaluateValue + \";\\n__p += '\";\n        }\n        if (interpolateValue) {\n          source += \"' +\\n((__t = (\" + interpolateValue + \")) == null ? '' : __t) +\\n'\";\n        }\n        index = offset + match.length;\n\n        // The JS engine embedded in Adobe products needs `match` returned in\n        // order to produce the correct `offset` value.\n        return match;\n      });\n\n      source += \"';\\n\";\n\n      // If `variable` is not specified wrap a with-statement around the generated\n      // code to add the data object to the top of the scope chain.\n      var variable = options.variable;\n      if (!variable) {\n        source = 'with (obj) {\\n' + source + '\\n}\\n';\n      }\n      // Cleanup code by stripping empty strings.\n      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)\n        .replace(reEmptyStringMiddle, '$1')\n        .replace(reEmptyStringTrailing, '$1;');\n\n      // Frame code as the function body.\n      source = 'function(' + (variable || 'obj') + ') {\\n' +\n        (variable\n          ? ''\n          : 'obj || (obj = {});\\n'\n        ) +\n        \"var __t, __p = ''\" +\n        (isEscaping\n           ? ', __e = _.escape'\n           : ''\n        ) +\n        (isEvaluating\n          ? ', __j = Array.prototype.join;\\n' +\n            \"function print() { __p += __j.call(arguments, '') }\\n\"\n          : ';\\n'\n        ) +\n        source +\n        'return __p\\n}';\n\n      var result = attempt(function() {\n        return Function(importsKeys, sourceURL + 'return ' + source)\n          .apply(undefined, importsValues);\n      });\n\n      // Provide the compiled function's source by its `toString` method or\n      // the `source` property as a convenience for inlining compiled templates.\n      result.source = source;\n      if (isError(result)) {\n        throw result;\n      }\n      return result;\n    }\n\n    /**\n     * Converts `string`, as a whole, to lower case just like\n     * [String#toLowerCase](https://mdn.io/toLowerCase).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the lower cased string.\n     * @example\n     *\n     * _.toLower('--Foo-Bar--');\n     * // => '--foo-bar--'\n     *\n     * _.toLower('fooBar');\n     * // => 'foobar'\n     *\n     * _.toLower('__FOO_BAR__');\n     * // => '__foo_bar__'\n     */\n    function toLower(value) {\n      return toString(value).toLowerCase();\n    }\n\n    /**\n     * Converts `string`, as a whole, to upper case just like\n     * [String#toUpperCase](https://mdn.io/toUpperCase).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the upper cased string.\n     * @example\n     *\n     * _.toUpper('--foo-bar--');\n     * // => '--FOO-BAR--'\n     *\n     * _.toUpper('fooBar');\n     * // => 'FOOBAR'\n     *\n     * _.toUpper('__foo_bar__');\n     * // => '__FOO_BAR__'\n     */\n    function toUpper(value) {\n      return toString(value).toUpperCase();\n    }\n\n    /**\n     * Removes leading and trailing whitespace or specified characters from `string`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to trim.\n     * @param {string} [chars=whitespace] The characters to trim.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {string} Returns the trimmed string.\n     * @example\n     *\n     * _.trim('  abc  ');\n     * // => 'abc'\n     *\n     * _.trim('-_-abc-_-', '_-');\n     * // => 'abc'\n     *\n     * _.map(['  foo  ', '  bar  '], _.trim);\n     * // => ['foo', 'bar']\n     */\n    function trim(string, chars, guard) {\n      string = toString(string);\n      if (!string) {\n        return string;\n      }\n      if (guard || chars === undefined) {\n        return string.replace(reTrim, '');\n      }\n      if (!(chars += '')) {\n        return string;\n      }\n      var strSymbols = stringToArray(string),\n          chrSymbols = stringToArray(chars),\n          start = charsStartIndex(strSymbols, chrSymbols),\n          end = charsEndIndex(strSymbols, chrSymbols) + 1;\n\n      return castSlice(strSymbols, start, end).join('');\n    }\n\n    /**\n     * Removes trailing whitespace or specified characters from `string`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to trim.\n     * @param {string} [chars=whitespace] The characters to trim.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {string} Returns the trimmed string.\n     * @example\n     *\n     * _.trimEnd('  abc  ');\n     * // => '  abc'\n     *\n     * _.trimEnd('-_-abc-_-', '_-');\n     * // => '-_-abc'\n     */\n    function trimEnd(string, chars, guard) {\n      string = toString(string);\n      if (!string) {\n        return string;\n      }\n      if (guard || chars === undefined) {\n        return string.replace(reTrimEnd, '');\n      }\n      if (!(chars += '')) {\n        return string;\n      }\n      var strSymbols = stringToArray(string),\n          end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;\n\n      return castSlice(strSymbols, 0, end).join('');\n    }\n\n    /**\n     * Removes leading whitespace or specified characters from `string`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to trim.\n     * @param {string} [chars=whitespace] The characters to trim.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {string} Returns the trimmed string.\n     * @example\n     *\n     * _.trimStart('  abc  ');\n     * // => 'abc  '\n     *\n     * _.trimStart('-_-abc-_-', '_-');\n     * // => 'abc-_-'\n     */\n    function trimStart(string, chars, guard) {\n      string = toString(string);\n      if (!string) {\n        return string;\n      }\n      if (guard || chars === undefined) {\n        return string.replace(reTrimStart, '');\n      }\n      if (!(chars += '')) {\n        return string;\n      }\n      var strSymbols = stringToArray(string),\n          start = charsStartIndex(strSymbols, stringToArray(chars));\n\n      return castSlice(strSymbols, start).join('');\n    }\n\n    /**\n     * Truncates `string` if it's longer than the given maximum string length.\n     * The last characters of the truncated string are replaced with the omission\n     * string which defaults to \"...\".\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to truncate.\n     * @param {Object} [options={}] The options object.\n     * @param {number} [options.length=30] The maximum string length.\n     * @param {string} [options.omission='...'] The string to indicate text is omitted.\n     * @param {RegExp|string} [options.separator] The separator pattern to truncate to.\n     * @returns {string} Returns the truncated string.\n     * @example\n     *\n     * _.truncate('hi-diddly-ho there, neighborino');\n     * // => 'hi-diddly-ho there, neighbo...'\n     *\n     * _.truncate('hi-diddly-ho there, neighborino', {\n     *   'length': 24,\n     *   'separator': ' '\n     * });\n     * // => 'hi-diddly-ho there,...'\n     *\n     * _.truncate('hi-diddly-ho there, neighborino', {\n     *   'length': 24,\n     *   'separator': /,? +/\n     * });\n     * // => 'hi-diddly-ho there...'\n     *\n     * _.truncate('hi-diddly-ho there, neighborino', {\n     *   'omission': ' [...]'\n     * });\n     * // => 'hi-diddly-ho there, neig [...]'\n     */\n    function truncate(string, options) {\n      var length = DEFAULT_TRUNC_LENGTH,\n          omission = DEFAULT_TRUNC_OMISSION;\n\n      if (isObject(options)) {\n        var separator = 'separator' in options ? options.separator : separator;\n        length = 'length' in options ? toInteger(options.length) : length;\n        omission = 'omission' in options ? toString(options.omission) : omission;\n      }\n      string = toString(string);\n\n      var strLength = string.length;\n      if (reHasComplexSymbol.test(string)) {\n        var strSymbols = stringToArray(string);\n        strLength = strSymbols.length;\n      }\n      if (length >= strLength) {\n        return string;\n      }\n      var end = length - stringSize(omission);\n      if (end < 1) {\n        return omission;\n      }\n      var result = strSymbols\n        ? castSlice(strSymbols, 0, end).join('')\n        : string.slice(0, end);\n\n      if (separator === undefined) {\n        return result + omission;\n      }\n      if (strSymbols) {\n        end += (result.length - end);\n      }\n      if (isRegExp(separator)) {\n        if (string.slice(end).search(separator)) {\n          var match,\n              substring = result;\n\n          if (!separator.global) {\n            separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');\n          }\n          separator.lastIndex = 0;\n          while ((match = separator.exec(substring))) {\n            var newEnd = match.index;\n          }\n          result = result.slice(0, newEnd === undefined ? end : newEnd);\n        }\n      } else if (string.indexOf(separator, end) != end) {\n        var index = result.lastIndexOf(separator);\n        if (index > -1) {\n          result = result.slice(0, index);\n        }\n      }\n      return result + omission;\n    }\n\n    /**\n     * The inverse of `_.escape`; this method converts the HTML entities\n     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to\n     * their corresponding characters.\n     *\n     * **Note:** No other HTML entities are unescaped. To unescape additional\n     * HTML entities use a third-party library like [_he_](https://mths.be/he).\n     *\n     * @static\n     * @memberOf _\n     * @since 0.6.0\n     * @category String\n     * @param {string} [string=''] The string to unescape.\n     * @returns {string} Returns the unescaped string.\n     * @example\n     *\n     * _.unescape('fred, barney, &amp; pebbles');\n     * // => 'fred, barney, & pebbles'\n     */\n    function unescape(string) {\n      string = toString(string);\n      return (string && reHasEscapedHtml.test(string))\n        ? string.replace(reEscapedHtml, unescapeHtmlChar)\n        : string;\n    }\n\n    /**\n     * Converts `string`, as space separated words, to upper case.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the upper cased string.\n     * @example\n     *\n     * _.upperCase('--foo-bar');\n     * // => 'FOO BAR'\n     *\n     * _.upperCase('fooBar');\n     * // => 'FOO BAR'\n     *\n     * _.upperCase('__foo_bar__');\n     * // => 'FOO BAR'\n     */\n    var upperCase = createCompounder(function(result, word, index) {\n      return result + (index ? ' ' : '') + word.toUpperCase();\n    });\n\n    /**\n     * Converts the first character of `string` to upper case.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category String\n     * @param {string} [string=''] The string to convert.\n     * @returns {string} Returns the converted string.\n     * @example\n     *\n     * _.upperFirst('fred');\n     * // => 'Fred'\n     *\n     * _.upperFirst('FRED');\n     * // => 'FRED'\n     */\n    var upperFirst = createCaseFirst('toUpperCase');\n\n    /**\n     * Splits `string` into an array of its words.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category String\n     * @param {string} [string=''] The string to inspect.\n     * @param {RegExp|string} [pattern] The pattern to match words.\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n     * @returns {Array} Returns the words of `string`.\n     * @example\n     *\n     * _.words('fred, barney, & pebbles');\n     * // => ['fred', 'barney', 'pebbles']\n     *\n     * _.words('fred, barney, & pebbles', /[^, ]+/g);\n     * // => ['fred', 'barney', '&', 'pebbles']\n     */\n    function words(string, pattern, guard) {\n      string = toString(string);\n      pattern = guard ? undefined : pattern;\n\n      if (pattern === undefined) {\n        pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord;\n      }\n      return string.match(pattern) || [];\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Attempts to invoke `func`, returning either the result or the caught error\n     * object. Any additional arguments are provided to `func` when it's invoked.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Util\n     * @param {Function} func The function to attempt.\n     * @param {...*} [args] The arguments to invoke `func` with.\n     * @returns {*} Returns the `func` result or error object.\n     * @example\n     *\n     * // Avoid throwing errors for invalid selectors.\n     * var elements = _.attempt(function(selector) {\n     *   return document.querySelectorAll(selector);\n     * }, '>_>');\n     *\n     * if (_.isError(elements)) {\n     *   elements = [];\n     * }\n     */\n    var attempt = rest(function(func, args) {\n      try {\n        return apply(func, undefined, args);\n      } catch (e) {\n        return isError(e) ? e : new Error(e);\n      }\n    });\n\n    /**\n     * Binds methods of an object to the object itself, overwriting the existing\n     * method.\n     *\n     * **Note:** This method doesn't set the \"length\" property of bound functions.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @param {Object} object The object to bind and assign the bound methods to.\n     * @param {...(string|string[])} methodNames The object method names to bind.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * var view = {\n     *   'label': 'docs',\n     *   'onClick': function() {\n     *     console.log('clicked ' + this.label);\n     *   }\n     * };\n     *\n     * _.bindAll(view, 'onClick');\n     * jQuery(element).on('click', view.onClick);\n     * // => Logs 'clicked docs' when clicked.\n     */\n    var bindAll = rest(function(object, methodNames) {\n      arrayEach(baseFlatten(methodNames, 1), function(key) {\n        object[key] = bind(object[key], object);\n      });\n      return object;\n    });\n\n    /**\n     * Creates a function that iterates over `pairs` and invokes the corresponding\n     * function of the first predicate to return truthy. The predicate-function\n     * pairs are invoked with the `this` binding and arguments of the created\n     * function.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {Array} pairs The predicate-function pairs.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var func = _.cond([\n     *   [_.matches({ 'a': 1 }),           _.constant('matches A')],\n     *   [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],\n     *   [_.constant(true),                _.constant('no match')]\n     * ]);\n     *\n     * func({ 'a': 1, 'b': 2 });\n     * // => 'matches A'\n     *\n     * func({ 'a': 0, 'b': 1 });\n     * // => 'matches B'\n     *\n     * func({ 'a': '1', 'b': '2' });\n     * // => 'no match'\n     */\n    function cond(pairs) {\n      var length = pairs ? pairs.length : 0,\n          toIteratee = getIteratee();\n\n      pairs = !length ? [] : arrayMap(pairs, function(pair) {\n        if (typeof pair[1] != 'function') {\n          throw new TypeError(FUNC_ERROR_TEXT);\n        }\n        return [toIteratee(pair[0]), pair[1]];\n      });\n\n      return rest(function(args) {\n        var index = -1;\n        while (++index < length) {\n          var pair = pairs[index];\n          if (apply(pair[0], this, args)) {\n            return apply(pair[1], this, args);\n          }\n        }\n      });\n    }\n\n    /**\n     * Creates a function that invokes the predicate properties of `source` with\n     * the corresponding property values of a given object, returning `true` if\n     * all predicates return truthy, else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {Object} source The object of property predicates to conform to.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney', 'age': 36 },\n     *   { 'user': 'fred',   'age': 40 }\n     * ];\n     *\n     * _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) }));\n     * // => [{ 'user': 'fred', 'age': 40 }]\n     */\n    function conforms(source) {\n      return baseConforms(baseClone(source, true));\n    }\n\n    /**\n     * Creates a function that returns `value`.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.4.0\n     * @category Util\n     * @param {*} value The value to return from the new function.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var object = { 'user': 'fred' };\n     * var getter = _.constant(object);\n     *\n     * getter() === object;\n     * // => true\n     */\n    function constant(value) {\n      return function() {\n        return value;\n      };\n    }\n\n    /**\n     * Creates a function that returns the result of invoking the given functions\n     * with the `this` binding of the created function, where each successive\n     * invocation is supplied the return value of the previous.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Util\n     * @param {...(Function|Function[])} [funcs] Functions to invoke.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * function square(n) {\n     *   return n * n;\n     * }\n     *\n     * var addSquare = _.flow(_.add, square);\n     * addSquare(1, 2);\n     * // => 9\n     */\n    var flow = createFlow();\n\n    /**\n     * This method is like `_.flow` except that it creates a function that\n     * invokes the given functions from right to left.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @param {...(Function|Function[])} [funcs] Functions to invoke.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * function square(n) {\n     *   return n * n;\n     * }\n     *\n     * var addSquare = _.flowRight(square, _.add);\n     * addSquare(1, 2);\n     * // => 9\n     */\n    var flowRight = createFlow(true);\n\n    /**\n     * This method returns the first argument given to it.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @param {*} value Any value.\n     * @returns {*} Returns `value`.\n     * @example\n     *\n     * var object = { 'user': 'fred' };\n     *\n     * _.identity(object) === object;\n     * // => true\n     */\n    function identity(value) {\n      return value;\n    }\n\n    /**\n     * Creates a function that invokes `func` with the arguments of the created\n     * function. If `func` is a property name, the created function returns the\n     * property value for a given element. If `func` is an array or object, the\n     * created function returns `true` for elements that contain the equivalent\n     * source properties, otherwise it returns `false`.\n     *\n     * @static\n     * @since 4.0.0\n     * @memberOf _\n     * @category Util\n     * @param {*} [func=_.identity] The value to convert to a callback.\n     * @returns {Function} Returns the callback.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney', 'age': 36, 'active': true },\n     *   { 'user': 'fred',   'age': 40, 'active': false }\n     * ];\n     *\n     * // The `_.matches` iteratee shorthand.\n     * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));\n     * // => [{ 'user': 'barney', 'age': 36, 'active': true }]\n     *\n     * // The `_.matchesProperty` iteratee shorthand.\n     * _.filter(users, _.iteratee(['user', 'fred']));\n     * // => [{ 'user': 'fred', 'age': 40 }]\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.map(users, _.iteratee('user'));\n     * // => ['barney', 'fred']\n     *\n     * // Create custom iteratee shorthands.\n     * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {\n     *   return !_.isRegExp(func) ? iteratee(func) : function(string) {\n     *     return func.test(string);\n     *   };\n     * });\n     *\n     * _.filter(['abc', 'def'], /ef/);\n     * // => ['def']\n     */\n    function iteratee(func) {\n      return baseIteratee(typeof func == 'function' ? func : baseClone(func, true));\n    }\n\n    /**\n     * Creates a function that performs a partial deep comparison between a given\n     * object and `source`, returning `true` if the given object has equivalent\n     * property values, else `false`. The created function is equivalent to\n     * `_.isMatch` with a `source` partially applied.\n     *\n     * **Note:** This method supports comparing the same values as `_.isEqual`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Util\n     * @param {Object} source The object of property values to match.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney', 'age': 36, 'active': true },\n     *   { 'user': 'fred',   'age': 40, 'active': false }\n     * ];\n     *\n     * _.filter(users, _.matches({ 'age': 40, 'active': false }));\n     * // => [{ 'user': 'fred', 'age': 40, 'active': false }]\n     */\n    function matches(source) {\n      return baseMatches(baseClone(source, true));\n    }\n\n    /**\n     * Creates a function that performs a partial deep comparison between the\n     * value at `path` of a given object to `srcValue`, returning `true` if the\n     * object value is equivalent, else `false`.\n     *\n     * **Note:** This method supports comparing the same values as `_.isEqual`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.2.0\n     * @category Util\n     * @param {Array|string} path The path of the property to get.\n     * @param {*} srcValue The value to match.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var users = [\n     *   { 'user': 'barney' },\n     *   { 'user': 'fred' }\n     * ];\n     *\n     * _.find(users, _.matchesProperty('user', 'fred'));\n     * // => { 'user': 'fred' }\n     */\n    function matchesProperty(path, srcValue) {\n      return baseMatchesProperty(path, baseClone(srcValue, true));\n    }\n\n    /**\n     * Creates a function that invokes the method at `path` of a given object.\n     * Any additional arguments are provided to the invoked method.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.7.0\n     * @category Util\n     * @param {Array|string} path The path of the method to invoke.\n     * @param {...*} [args] The arguments to invoke the method with.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var objects = [\n     *   { 'a': { 'b': _.constant(2) } },\n     *   { 'a': { 'b': _.constant(1) } }\n     * ];\n     *\n     * _.map(objects, _.method('a.b'));\n     * // => [2, 1]\n     *\n     * _.map(objects, _.method(['a', 'b']));\n     * // => [2, 1]\n     */\n    var method = rest(function(path, args) {\n      return function(object) {\n        return baseInvoke(object, path, args);\n      };\n    });\n\n    /**\n     * The opposite of `_.method`; this method creates a function that invokes\n     * the method at a given path of `object`. Any additional arguments are\n     * provided to the invoked method.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.7.0\n     * @category Util\n     * @param {Object} object The object to query.\n     * @param {...*} [args] The arguments to invoke the method with.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var array = _.times(3, _.constant),\n     *     object = { 'a': array, 'b': array, 'c': array };\n     *\n     * _.map(['a[2]', 'c[0]'], _.methodOf(object));\n     * // => [2, 0]\n     *\n     * _.map([['a', '2'], ['c', '0']], _.methodOf(object));\n     * // => [2, 0]\n     */\n    var methodOf = rest(function(object, args) {\n      return function(path) {\n        return baseInvoke(object, path, args);\n      };\n    });\n\n    /**\n     * Adds all own enumerable string keyed function properties of a source\n     * object to the destination object. If `object` is a function, then methods\n     * are added to its prototype as well.\n     *\n     * **Note:** Use `_.runInContext` to create a pristine `lodash` function to\n     * avoid conflicts caused by modifying the original.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @param {Function|Object} [object=lodash] The destination object.\n     * @param {Object} source The object of functions to add.\n     * @param {Object} [options={}] The options object.\n     * @param {boolean} [options.chain=true] Specify whether mixins are chainable.\n     * @returns {Function|Object} Returns `object`.\n     * @example\n     *\n     * function vowels(string) {\n     *   return _.filter(string, function(v) {\n     *     return /[aeiou]/i.test(v);\n     *   });\n     * }\n     *\n     * _.mixin({ 'vowels': vowels });\n     * _.vowels('fred');\n     * // => ['e']\n     *\n     * _('fred').vowels().value();\n     * // => ['e']\n     *\n     * _.mixin({ 'vowels': vowels }, { 'chain': false });\n     * _('fred').vowels();\n     * // => ['e']\n     */\n    function mixin(object, source, options) {\n      var props = keys(source),\n          methodNames = baseFunctions(source, props);\n\n      if (options == null &&\n          !(isObject(source) && (methodNames.length || !props.length))) {\n        options = source;\n        source = object;\n        object = this;\n        methodNames = baseFunctions(source, keys(source));\n      }\n      var chain = !(isObject(options) && 'chain' in options) || !!options.chain,\n          isFunc = isFunction(object);\n\n      arrayEach(methodNames, function(methodName) {\n        var func = source[methodName];\n        object[methodName] = func;\n        if (isFunc) {\n          object.prototype[methodName] = function() {\n            var chainAll = this.__chain__;\n            if (chain || chainAll) {\n              var result = object(this.__wrapped__),\n                  actions = result.__actions__ = copyArray(this.__actions__);\n\n              actions.push({ 'func': func, 'args': arguments, 'thisArg': object });\n              result.__chain__ = chainAll;\n              return result;\n            }\n            return func.apply(object, arrayPush([this.value()], arguments));\n          };\n        }\n      });\n\n      return object;\n    }\n\n    /**\n     * Reverts the `_` variable to its previous value and returns a reference to\n     * the `lodash` function.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @returns {Function} Returns the `lodash` function.\n     * @example\n     *\n     * var lodash = _.noConflict();\n     */\n    function noConflict() {\n      if (root._ === this) {\n        root._ = oldDash;\n      }\n      return this;\n    }\n\n    /**\n     * A no-operation function that returns `undefined` regardless of the\n     * arguments it receives.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.3.0\n     * @category Util\n     * @example\n     *\n     * var object = { 'user': 'fred' };\n     *\n     * _.noop(object) === undefined;\n     * // => true\n     */\n    function noop() {\n      // No operation performed.\n    }\n\n    /**\n     * Creates a function that returns its nth argument. If `n` is negative,\n     * the nth argument from the end is returned.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {number} [n=0] The index of the argument to return.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var func = _.nthArg(1);\n     * func('a', 'b', 'c', 'd');\n     * // => 'b'\n     *\n     * var func = _.nthArg(-2);\n     * func('a', 'b', 'c', 'd');\n     * // => 'c'\n     */\n    function nthArg(n) {\n      n = toInteger(n);\n      return rest(function(args) {\n        return baseNth(args, n);\n      });\n    }\n\n    /**\n     * Creates a function that invokes `iteratees` with the arguments it receives\n     * and returns their results.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\n     *  [iteratees=[_.identity]] The iteratees to invoke.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var func = _.over(Math.max, Math.min);\n     *\n     * func(1, 2, 3, 4);\n     * // => [4, 1]\n     */\n    var over = createOver(arrayMap);\n\n    /**\n     * Creates a function that checks if **all** of the `predicates` return\n     * truthy when invoked with the arguments it receives.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\n     *  [predicates=[_.identity]] The predicates to check.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var func = _.overEvery(Boolean, isFinite);\n     *\n     * func('1');\n     * // => true\n     *\n     * func(null);\n     * // => false\n     *\n     * func(NaN);\n     * // => false\n     */\n    var overEvery = createOver(arrayEvery);\n\n    /**\n     * Creates a function that checks if **any** of the `predicates` return\n     * truthy when invoked with the arguments it receives.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\n     *  [predicates=[_.identity]] The predicates to check.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var func = _.overSome(Boolean, isFinite);\n     *\n     * func('1');\n     * // => true\n     *\n     * func(null);\n     * // => true\n     *\n     * func(NaN);\n     * // => false\n     */\n    var overSome = createOver(arraySome);\n\n    /**\n     * Creates a function that returns the value at `path` of a given object.\n     *\n     * @static\n     * @memberOf _\n     * @since 2.4.0\n     * @category Util\n     * @param {Array|string} path The path of the property to get.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var objects = [\n     *   { 'a': { 'b': 2 } },\n     *   { 'a': { 'b': 1 } }\n     * ];\n     *\n     * _.map(objects, _.property('a.b'));\n     * // => [2, 1]\n     *\n     * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n     * // => [1, 2]\n     */\n    function property(path) {\n      return isKey(path) ? baseProperty(path) : basePropertyDeep(path);\n    }\n\n    /**\n     * The opposite of `_.property`; this method creates a function that returns\n     * the value at a given path of `object`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.0.0\n     * @category Util\n     * @param {Object} object The object to query.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var array = [0, 1, 2],\n     *     object = { 'a': array, 'b': array, 'c': array };\n     *\n     * _.map(['a[2]', 'c[0]'], _.propertyOf(object));\n     * // => [2, 0]\n     *\n     * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));\n     * // => [2, 0]\n     */\n    function propertyOf(object) {\n      return function(path) {\n        return object == null ? undefined : baseGet(object, path);\n      };\n    }\n\n    /**\n     * Creates an array of numbers (positive and/or negative) progressing from\n     * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n     * `start` is specified without an `end` or `step`. If `end` is not specified,\n     * it's set to `start` with `start` then set to `0`.\n     *\n     * **Note:** JavaScript follows the IEEE-754 standard for resolving\n     * floating-point values which can produce unexpected results.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @param {number} [start=0] The start of the range.\n     * @param {number} end The end of the range.\n     * @param {number} [step=1] The value to increment or decrement by.\n     * @returns {Array} Returns the new array of numbers.\n     * @example\n     *\n     * _.range(4);\n     * // => [0, 1, 2, 3]\n     *\n     * _.range(-4);\n     * // => [0, -1, -2, -3]\n     *\n     * _.range(1, 5);\n     * // => [1, 2, 3, 4]\n     *\n     * _.range(0, 20, 5);\n     * // => [0, 5, 10, 15]\n     *\n     * _.range(0, -4, -1);\n     * // => [0, -1, -2, -3]\n     *\n     * _.range(1, 4, 0);\n     * // => [1, 1, 1]\n     *\n     * _.range(0);\n     * // => []\n     */\n    var range = createRange();\n\n    /**\n     * This method is like `_.range` except that it populates values in\n     * descending order.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {number} [start=0] The start of the range.\n     * @param {number} end The end of the range.\n     * @param {number} [step=1] The value to increment or decrement by.\n     * @returns {Array} Returns the new array of numbers.\n     * @example\n     *\n     * _.rangeRight(4);\n     * // => [3, 2, 1, 0]\n     *\n     * _.rangeRight(-4);\n     * // => [-3, -2, -1, 0]\n     *\n     * _.rangeRight(1, 5);\n     * // => [4, 3, 2, 1]\n     *\n     * _.rangeRight(0, 20, 5);\n     * // => [15, 10, 5, 0]\n     *\n     * _.rangeRight(0, -4, -1);\n     * // => [-3, -2, -1, 0]\n     *\n     * _.rangeRight(1, 4, 0);\n     * // => [1, 1, 1]\n     *\n     * _.rangeRight(0);\n     * // => []\n     */\n    var rangeRight = createRange(true);\n\n    /**\n     * Invokes the iteratee `n` times, returning an array of the results of\n     * each invocation. The iteratee is invoked with one argument; (index).\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @param {number} n The number of times to invoke `iteratee`.\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n     * @returns {Array} Returns the array of results.\n     * @example\n     *\n     * _.times(3, String);\n     * // => ['0', '1', '2']\n     *\n     *  _.times(4, _.constant(true));\n     * // => [true, true, true, true]\n     */\n    function times(n, iteratee) {\n      n = toInteger(n);\n      if (n < 1 || n > MAX_SAFE_INTEGER) {\n        return [];\n      }\n      var index = MAX_ARRAY_LENGTH,\n          length = nativeMin(n, MAX_ARRAY_LENGTH);\n\n      iteratee = getIteratee(iteratee);\n      n -= MAX_ARRAY_LENGTH;\n\n      var result = baseTimes(length, iteratee);\n      while (++index < n) {\n        iteratee(index);\n      }\n      return result;\n    }\n\n    /**\n     * Converts `value` to a property path array.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Util\n     * @param {*} value The value to convert.\n     * @returns {Array} Returns the new property path array.\n     * @example\n     *\n     * _.toPath('a.b.c');\n     * // => ['a', 'b', 'c']\n     *\n     * _.toPath('a[0].b.c');\n     * // => ['a', '0', 'b', 'c']\n     *\n     * var path = ['a', 'b', 'c'],\n     *     newPath = _.toPath(path);\n     *\n     * console.log(newPath);\n     * // => ['a', 'b', 'c']\n     *\n     * console.log(path === newPath);\n     * // => false\n     */\n    function toPath(value) {\n      if (isArray(value)) {\n        return arrayMap(value, toKey);\n      }\n      return isSymbol(value) ? [value] : copyArray(stringToPath(value));\n    }\n\n    /**\n     * Generates a unique ID. If `prefix` is given, the ID is appended to it.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Util\n     * @param {string} [prefix=''] The value to prefix the ID with.\n     * @returns {string} Returns the unique ID.\n     * @example\n     *\n     * _.uniqueId('contact_');\n     * // => 'contact_104'\n     *\n     * _.uniqueId();\n     * // => '105'\n     */\n    function uniqueId(prefix) {\n      var id = ++idCounter;\n      return toString(prefix) + id;\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * Adds two numbers.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.4.0\n     * @category Math\n     * @param {number} augend The first number in an addition.\n     * @param {number} addend The second number in an addition.\n     * @returns {number} Returns the total.\n     * @example\n     *\n     * _.add(6, 4);\n     * // => 10\n     */\n    var add = createMathOperation(function(augend, addend) {\n      return augend + addend;\n    });\n\n    /**\n     * Computes `number` rounded up to `precision`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.10.0\n     * @category Math\n     * @param {number} number The number to round up.\n     * @param {number} [precision=0] The precision to round up to.\n     * @returns {number} Returns the rounded up number.\n     * @example\n     *\n     * _.ceil(4.006);\n     * // => 5\n     *\n     * _.ceil(6.004, 2);\n     * // => 6.01\n     *\n     * _.ceil(6040, -2);\n     * // => 6100\n     */\n    var ceil = createRound('ceil');\n\n    /**\n     * Divide two numbers.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.7.0\n     * @category Math\n     * @param {number} dividend The first number in a division.\n     * @param {number} divisor The second number in a division.\n     * @returns {number} Returns the quotient.\n     * @example\n     *\n     * _.divide(6, 4);\n     * // => 1.5\n     */\n    var divide = createMathOperation(function(dividend, divisor) {\n      return dividend / divisor;\n    });\n\n    /**\n     * Computes `number` rounded down to `precision`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.10.0\n     * @category Math\n     * @param {number} number The number to round down.\n     * @param {number} [precision=0] The precision to round down to.\n     * @returns {number} Returns the rounded down number.\n     * @example\n     *\n     * _.floor(4.006);\n     * // => 4\n     *\n     * _.floor(0.046, 2);\n     * // => 0.04\n     *\n     * _.floor(4060, -2);\n     * // => 4000\n     */\n    var floor = createRound('floor');\n\n    /**\n     * Computes the maximum value of `array`. If `array` is empty or falsey,\n     * `undefined` is returned.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @returns {*} Returns the maximum value.\n     * @example\n     *\n     * _.max([4, 2, 8, 6]);\n     * // => 8\n     *\n     * _.max([]);\n     * // => undefined\n     */\n    function max(array) {\n      return (array && array.length)\n        ? baseExtremum(array, identity, gt)\n        : undefined;\n    }\n\n    /**\n     * This method is like `_.max` except that it accepts `iteratee` which is\n     * invoked for each element in `array` to generate the criterion by which\n     * the value is ranked. The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {*} Returns the maximum value.\n     * @example\n     *\n     * var objects = [{ 'n': 1 }, { 'n': 2 }];\n     *\n     * _.maxBy(objects, function(o) { return o.n; });\n     * // => { 'n': 2 }\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.maxBy(objects, 'n');\n     * // => { 'n': 2 }\n     */\n    function maxBy(array, iteratee) {\n      return (array && array.length)\n        ? baseExtremum(array, getIteratee(iteratee), gt)\n        : undefined;\n    }\n\n    /**\n     * Computes the mean of the values in `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @returns {number} Returns the mean.\n     * @example\n     *\n     * _.mean([4, 2, 8, 6]);\n     * // => 5\n     */\n    function mean(array) {\n      return baseMean(array, identity);\n    }\n\n    /**\n     * This method is like `_.mean` except that it accepts `iteratee` which is\n     * invoked for each element in `array` to generate the value to be averaged.\n     * The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.7.0\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {number} Returns the mean.\n     * @example\n     *\n     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n     *\n     * _.meanBy(objects, function(o) { return o.n; });\n     * // => 5\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.meanBy(objects, 'n');\n     * // => 5\n     */\n    function meanBy(array, iteratee) {\n      return baseMean(array, getIteratee(iteratee));\n    }\n\n    /**\n     * Computes the minimum value of `array`. If `array` is empty or falsey,\n     * `undefined` is returned.\n     *\n     * @static\n     * @since 0.1.0\n     * @memberOf _\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @returns {*} Returns the minimum value.\n     * @example\n     *\n     * _.min([4, 2, 8, 6]);\n     * // => 2\n     *\n     * _.min([]);\n     * // => undefined\n     */\n    function min(array) {\n      return (array && array.length)\n        ? baseExtremum(array, identity, lt)\n        : undefined;\n    }\n\n    /**\n     * This method is like `_.min` except that it accepts `iteratee` which is\n     * invoked for each element in `array` to generate the criterion by which\n     * the value is ranked. The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {*} Returns the minimum value.\n     * @example\n     *\n     * var objects = [{ 'n': 1 }, { 'n': 2 }];\n     *\n     * _.minBy(objects, function(o) { return o.n; });\n     * // => { 'n': 1 }\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.minBy(objects, 'n');\n     * // => { 'n': 1 }\n     */\n    function minBy(array, iteratee) {\n      return (array && array.length)\n        ? baseExtremum(array, getIteratee(iteratee), lt)\n        : undefined;\n    }\n\n    /**\n     * Multiply two numbers.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.7.0\n     * @category Math\n     * @param {number} multiplier The first number in a multiplication.\n     * @param {number} multiplicand The second number in a multiplication.\n     * @returns {number} Returns the product.\n     * @example\n     *\n     * _.multiply(6, 4);\n     * // => 24\n     */\n    var multiply = createMathOperation(function(multiplier, multiplicand) {\n      return multiplier * multiplicand;\n    });\n\n    /**\n     * Computes `number` rounded to `precision`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.10.0\n     * @category Math\n     * @param {number} number The number to round.\n     * @param {number} [precision=0] The precision to round to.\n     * @returns {number} Returns the rounded number.\n     * @example\n     *\n     * _.round(4.006);\n     * // => 4\n     *\n     * _.round(4.006, 2);\n     * // => 4.01\n     *\n     * _.round(4060, -2);\n     * // => 4100\n     */\n    var round = createRound('round');\n\n    /**\n     * Subtract two numbers.\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Math\n     * @param {number} minuend The first number in a subtraction.\n     * @param {number} subtrahend The second number in a subtraction.\n     * @returns {number} Returns the difference.\n     * @example\n     *\n     * _.subtract(6, 4);\n     * // => 2\n     */\n    var subtract = createMathOperation(function(minuend, subtrahend) {\n      return minuend - subtrahend;\n    });\n\n    /**\n     * Computes the sum of the values in `array`.\n     *\n     * @static\n     * @memberOf _\n     * @since 3.4.0\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @returns {number} Returns the sum.\n     * @example\n     *\n     * _.sum([4, 2, 8, 6]);\n     * // => 20\n     */\n    function sum(array) {\n      return (array && array.length)\n        ? baseSum(array, identity)\n        : 0;\n    }\n\n    /**\n     * This method is like `_.sum` except that it accepts `iteratee` which is\n     * invoked for each element in `array` to generate the value to be summed.\n     * The iteratee is invoked with one argument: (value).\n     *\n     * @static\n     * @memberOf _\n     * @since 4.0.0\n     * @category Math\n     * @param {Array} array The array to iterate over.\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\n     *  The iteratee invoked per element.\n     * @returns {number} Returns the sum.\n     * @example\n     *\n     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n     *\n     * _.sumBy(objects, function(o) { return o.n; });\n     * // => 20\n     *\n     * // The `_.property` iteratee shorthand.\n     * _.sumBy(objects, 'n');\n     * // => 20\n     */\n    function sumBy(array, iteratee) {\n      return (array && array.length)\n        ? baseSum(array, getIteratee(iteratee))\n        : 0;\n    }\n\n    /*------------------------------------------------------------------------*/\n\n    // Add methods that return wrapped values in chain sequences.\n    lodash.after = after;\n    lodash.ary = ary;\n    lodash.assign = assign;\n    lodash.assignIn = assignIn;\n    lodash.assignInWith = assignInWith;\n    lodash.assignWith = assignWith;\n    lodash.at = at;\n    lodash.before = before;\n    lodash.bind = bind;\n    lodash.bindAll = bindAll;\n    lodash.bindKey = bindKey;\n    lodash.castArray = castArray;\n    lodash.chain = chain;\n    lodash.chunk = chunk;\n    lodash.compact = compact;\n    lodash.concat = concat;\n    lodash.cond = cond;\n    lodash.conforms = conforms;\n    lodash.constant = constant;\n    lodash.countBy = countBy;\n    lodash.create = create;\n    lodash.curry = curry;\n    lodash.curryRight = curryRight;\n    lodash.debounce = debounce;\n    lodash.defaults = defaults;\n    lodash.defaultsDeep = defaultsDeep;\n    lodash.defer = defer;\n    lodash.delay = delay;\n    lodash.difference = difference;\n    lodash.differenceBy = differenceBy;\n    lodash.differenceWith = differenceWith;\n    lodash.drop = drop;\n    lodash.dropRight = dropRight;\n    lodash.dropRightWhile = dropRightWhile;\n    lodash.dropWhile = dropWhile;\n    lodash.fill = fill;\n    lodash.filter = filter;\n    lodash.flatMap = flatMap;\n    lodash.flatMapDeep = flatMapDeep;\n    lodash.flatMapDepth = flatMapDepth;\n    lodash.flatten = flatten;\n    lodash.flattenDeep = flattenDeep;\n    lodash.flattenDepth = flattenDepth;\n    lodash.flip = flip;\n    lodash.flow = flow;\n    lodash.flowRight = flowRight;\n    lodash.fromPairs = fromPairs;\n    lodash.functions = functions;\n    lodash.functionsIn = functionsIn;\n    lodash.groupBy = groupBy;\n    lodash.initial = initial;\n    lodash.intersection = intersection;\n    lodash.intersectionBy = intersectionBy;\n    lodash.intersectionWith = intersectionWith;\n    lodash.invert = invert;\n    lodash.invertBy = invertBy;\n    lodash.invokeMap = invokeMap;\n    lodash.iteratee = iteratee;\n    lodash.keyBy = keyBy;\n    lodash.keys = keys;\n    lodash.keysIn = keysIn;\n    lodash.map = map;\n    lodash.mapKeys = mapKeys;\n    lodash.mapValues = mapValues;\n    lodash.matches = matches;\n    lodash.matchesProperty = matchesProperty;\n    lodash.memoize = memoize;\n    lodash.merge = merge;\n    lodash.mergeWith = mergeWith;\n    lodash.method = method;\n    lodash.methodOf = methodOf;\n    lodash.mixin = mixin;\n    lodash.negate = negate;\n    lodash.nthArg = nthArg;\n    lodash.omit = omit;\n    lodash.omitBy = omitBy;\n    lodash.once = once;\n    lodash.orderBy = orderBy;\n    lodash.over = over;\n    lodash.overArgs = overArgs;\n    lodash.overEvery = overEvery;\n    lodash.overSome = overSome;\n    lodash.partial = partial;\n    lodash.partialRight = partialRight;\n    lodash.partition = partition;\n    lodash.pick = pick;\n    lodash.pickBy = pickBy;\n    lodash.property = property;\n    lodash.propertyOf = propertyOf;\n    lodash.pull = pull;\n    lodash.pullAll = pullAll;\n    lodash.pullAllBy = pullAllBy;\n    lodash.pullAllWith = pullAllWith;\n    lodash.pullAt = pullAt;\n    lodash.range = range;\n    lodash.rangeRight = rangeRight;\n    lodash.rearg = rearg;\n    lodash.reject = reject;\n    lodash.remove = remove;\n    lodash.rest = rest;\n    lodash.reverse = reverse;\n    lodash.sampleSize = sampleSize;\n    lodash.set = set;\n    lodash.setWith = setWith;\n    lodash.shuffle = shuffle;\n    lodash.slice = slice;\n    lodash.sortBy = sortBy;\n    lodash.sortedUniq = sortedUniq;\n    lodash.sortedUniqBy = sortedUniqBy;\n    lodash.split = split;\n    lodash.spread = spread;\n    lodash.tail = tail;\n    lodash.take = take;\n    lodash.takeRight = takeRight;\n    lodash.takeRightWhile = takeRightWhile;\n    lodash.takeWhile = takeWhile;\n    lodash.tap = tap;\n    lodash.throttle = throttle;\n    lodash.thru = thru;\n    lodash.toArray = toArray;\n    lodash.toPairs = toPairs;\n    lodash.toPairsIn = toPairsIn;\n    lodash.toPath = toPath;\n    lodash.toPlainObject = toPlainObject;\n    lodash.transform = transform;\n    lodash.unary = unary;\n    lodash.union = union;\n    lodash.unionBy = unionBy;\n    lodash.unionWith = unionWith;\n    lodash.uniq = uniq;\n    lodash.uniqBy = uniqBy;\n    lodash.uniqWith = uniqWith;\n    lodash.unset = unset;\n    lodash.unzip = unzip;\n    lodash.unzipWith = unzipWith;\n    lodash.update = update;\n    lodash.updateWith = updateWith;\n    lodash.values = values;\n    lodash.valuesIn = valuesIn;\n    lodash.without = without;\n    lodash.words = words;\n    lodash.wrap = wrap;\n    lodash.xor = xor;\n    lodash.xorBy = xorBy;\n    lodash.xorWith = xorWith;\n    lodash.zip = zip;\n    lodash.zipObject = zipObject;\n    lodash.zipObjectDeep = zipObjectDeep;\n    lodash.zipWith = zipWith;\n\n    // Add aliases.\n    lodash.entries = toPairs;\n    lodash.entriesIn = toPairsIn;\n    lodash.extend = assignIn;\n    lodash.extendWith = assignInWith;\n\n    // Add methods to `lodash.prototype`.\n    mixin(lodash, lodash);\n\n    /*------------------------------------------------------------------------*/\n\n    // Add methods that return unwrapped values in chain sequences.\n    lodash.add = add;\n    lodash.attempt = attempt;\n    lodash.camelCase = camelCase;\n    lodash.capitalize = capitalize;\n    lodash.ceil = ceil;\n    lodash.clamp = clamp;\n    lodash.clone = clone;\n    lodash.cloneDeep = cloneDeep;\n    lodash.cloneDeepWith = cloneDeepWith;\n    lodash.cloneWith = cloneWith;\n    lodash.deburr = deburr;\n    lodash.divide = divide;\n    lodash.endsWith = endsWith;\n    lodash.eq = eq;\n    lodash.escape = escape;\n    lodash.escapeRegExp = escapeRegExp;\n    lodash.every = every;\n    lodash.find = find;\n    lodash.findIndex = findIndex;\n    lodash.findKey = findKey;\n    lodash.findLast = findLast;\n    lodash.findLastIndex = findLastIndex;\n    lodash.findLastKey = findLastKey;\n    lodash.floor = floor;\n    lodash.forEach = forEach;\n    lodash.forEachRight = forEachRight;\n    lodash.forIn = forIn;\n    lodash.forInRight = forInRight;\n    lodash.forOwn = forOwn;\n    lodash.forOwnRight = forOwnRight;\n    lodash.get = get;\n    lodash.gt = gt;\n    lodash.gte = gte;\n    lodash.has = has;\n    lodash.hasIn = hasIn;\n    lodash.head = head;\n    lodash.identity = identity;\n    lodash.includes = includes;\n    lodash.indexOf = indexOf;\n    lodash.inRange = inRange;\n    lodash.invoke = invoke;\n    lodash.isArguments = isArguments;\n    lodash.isArray = isArray;\n    lodash.isArrayBuffer = isArrayBuffer;\n    lodash.isArrayLike = isArrayLike;\n    lodash.isArrayLikeObject = isArrayLikeObject;\n    lodash.isBoolean = isBoolean;\n    lodash.isBuffer = isBuffer;\n    lodash.isDate = isDate;\n    lodash.isElement = isElement;\n    lodash.isEmpty = isEmpty;\n    lodash.isEqual = isEqual;\n    lodash.isEqualWith = isEqualWith;\n    lodash.isError = isError;\n    lodash.isFinite = isFinite;\n    lodash.isFunction = isFunction;\n    lodash.isInteger = isInteger;\n    lodash.isLength = isLength;\n    lodash.isMap = isMap;\n    lodash.isMatch = isMatch;\n    lodash.isMatchWith = isMatchWith;\n    lodash.isNaN = isNaN;\n    lodash.isNative = isNative;\n    lodash.isNil = isNil;\n    lodash.isNull = isNull;\n    lodash.isNumber = isNumber;\n    lodash.isObject = isObject;\n    lodash.isObjectLike = isObjectLike;\n    lodash.isPlainObject = isPlainObject;\n    lodash.isRegExp = isRegExp;\n    lodash.isSafeInteger = isSafeInteger;\n    lodash.isSet = isSet;\n    lodash.isString = isString;\n    lodash.isSymbol = isSymbol;\n    lodash.isTypedArray = isTypedArray;\n    lodash.isUndefined = isUndefined;\n    lodash.isWeakMap = isWeakMap;\n    lodash.isWeakSet = isWeakSet;\n    lodash.join = join;\n    lodash.kebabCase = kebabCase;\n    lodash.last = last;\n    lodash.lastIndexOf = lastIndexOf;\n    lodash.lowerCase = lowerCase;\n    lodash.lowerFirst = lowerFirst;\n    lodash.lt = lt;\n    lodash.lte = lte;\n    lodash.max = max;\n    lodash.maxBy = maxBy;\n    lodash.mean = mean;\n    lodash.meanBy = meanBy;\n    lodash.min = min;\n    lodash.minBy = minBy;\n    lodash.multiply = multiply;\n    lodash.nth = nth;\n    lodash.noConflict = noConflict;\n    lodash.noop = noop;\n    lodash.now = now;\n    lodash.pad = pad;\n    lodash.padEnd = padEnd;\n    lodash.padStart = padStart;\n    lodash.parseInt = parseInt;\n    lodash.random = random;\n    lodash.reduce = reduce;\n    lodash.reduceRight = reduceRight;\n    lodash.repeat = repeat;\n    lodash.replace = replace;\n    lodash.result = result;\n    lodash.round = round;\n    lodash.runInContext = runInContext;\n    lodash.sample = sample;\n    lodash.size = size;\n    lodash.snakeCase = snakeCase;\n    lodash.some = some;\n    lodash.sortedIndex = sortedIndex;\n    lodash.sortedIndexBy = sortedIndexBy;\n    lodash.sortedIndexOf = sortedIndexOf;\n    lodash.sortedLastIndex = sortedLastIndex;\n    lodash.sortedLastIndexBy = sortedLastIndexBy;\n    lodash.sortedLastIndexOf = sortedLastIndexOf;\n    lodash.startCase = startCase;\n    lodash.startsWith = startsWith;\n    lodash.subtract = subtract;\n    lodash.sum = sum;\n    lodash.sumBy = sumBy;\n    lodash.template = template;\n    lodash.times = times;\n    lodash.toInteger = toInteger;\n    lodash.toLength = toLength;\n    lodash.toLower = toLower;\n    lodash.toNumber = toNumber;\n    lodash.toSafeInteger = toSafeInteger;\n    lodash.toString = toString;\n    lodash.toUpper = toUpper;\n    lodash.trim = trim;\n    lodash.trimEnd = trimEnd;\n    lodash.trimStart = trimStart;\n    lodash.truncate = truncate;\n    lodash.unescape = unescape;\n    lodash.uniqueId = uniqueId;\n    lodash.upperCase = upperCase;\n    lodash.upperFirst = upperFirst;\n\n    // Add aliases.\n    lodash.each = forEach;\n    lodash.eachRight = forEachRight;\n    lodash.first = head;\n\n    mixin(lodash, (function() {\n      var source = {};\n      baseForOwn(lodash, function(func, methodName) {\n        if (!hasOwnProperty.call(lodash.prototype, methodName)) {\n          source[methodName] = func;\n        }\n      });\n      return source;\n    }()), { 'chain': false });\n\n    /*------------------------------------------------------------------------*/\n\n    /**\n     * The semantic version number.\n     *\n     * @static\n     * @memberOf _\n     * @type {string}\n     */\n    lodash.VERSION = VERSION;\n\n    // Assign default placeholders.\n    arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {\n      lodash[methodName].placeholder = lodash;\n    });\n\n    // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.\n    arrayEach(['drop', 'take'], function(methodName, index) {\n      LazyWrapper.prototype[methodName] = function(n) {\n        var filtered = this.__filtered__;\n        if (filtered && !index) {\n          return new LazyWrapper(this);\n        }\n        n = n === undefined ? 1 : nativeMax(toInteger(n), 0);\n\n        var result = this.clone();\n        if (filtered) {\n          result.__takeCount__ = nativeMin(n, result.__takeCount__);\n        } else {\n          result.__views__.push({\n            'size': nativeMin(n, MAX_ARRAY_LENGTH),\n            'type': methodName + (result.__dir__ < 0 ? 'Right' : '')\n          });\n        }\n        return result;\n      };\n\n      LazyWrapper.prototype[methodName + 'Right'] = function(n) {\n        return this.reverse()[methodName](n).reverse();\n      };\n    });\n\n    // Add `LazyWrapper` methods that accept an `iteratee` value.\n    arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {\n      var type = index + 1,\n          isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;\n\n      LazyWrapper.prototype[methodName] = function(iteratee) {\n        var result = this.clone();\n        result.__iteratees__.push({\n          'iteratee': getIteratee(iteratee, 3),\n          'type': type\n        });\n        result.__filtered__ = result.__filtered__ || isFilter;\n        return result;\n      };\n    });\n\n    // Add `LazyWrapper` methods for `_.head` and `_.last`.\n    arrayEach(['head', 'last'], function(methodName, index) {\n      var takeName = 'take' + (index ? 'Right' : '');\n\n      LazyWrapper.prototype[methodName] = function() {\n        return this[takeName](1).value()[0];\n      };\n    });\n\n    // Add `LazyWrapper` methods for `_.initial` and `_.tail`.\n    arrayEach(['initial', 'tail'], function(methodName, index) {\n      var dropName = 'drop' + (index ? '' : 'Right');\n\n      LazyWrapper.prototype[methodName] = function() {\n        return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);\n      };\n    });\n\n    LazyWrapper.prototype.compact = function() {\n      return this.filter(identity);\n    };\n\n    LazyWrapper.prototype.find = function(predicate) {\n      return this.filter(predicate).head();\n    };\n\n    LazyWrapper.prototype.findLast = function(predicate) {\n      return this.reverse().find(predicate);\n    };\n\n    LazyWrapper.prototype.invokeMap = rest(function(path, args) {\n      if (typeof path == 'function') {\n        return new LazyWrapper(this);\n      }\n      return this.map(function(value) {\n        return baseInvoke(value, path, args);\n      });\n    });\n\n    LazyWrapper.prototype.reject = function(predicate) {\n      predicate = getIteratee(predicate, 3);\n      return this.filter(function(value) {\n        return !predicate(value);\n      });\n    };\n\n    LazyWrapper.prototype.slice = function(start, end) {\n      start = toInteger(start);\n\n      var result = this;\n      if (result.__filtered__ && (start > 0 || end < 0)) {\n        return new LazyWrapper(result);\n      }\n      if (start < 0) {\n        result = result.takeRight(-start);\n      } else if (start) {\n        result = result.drop(start);\n      }\n      if (end !== undefined) {\n        end = toInteger(end);\n        result = end < 0 ? result.dropRight(-end) : result.take(end - start);\n      }\n      return result;\n    };\n\n    LazyWrapper.prototype.takeRightWhile = function(predicate) {\n      return this.reverse().takeWhile(predicate).reverse();\n    };\n\n    LazyWrapper.prototype.toArray = function() {\n      return this.take(MAX_ARRAY_LENGTH);\n    };\n\n    // Add `LazyWrapper` methods to `lodash.prototype`.\n    baseForOwn(LazyWrapper.prototype, function(func, methodName) {\n      var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),\n          isTaker = /^(?:head|last)$/.test(methodName),\n          lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],\n          retUnwrapped = isTaker || /^find/.test(methodName);\n\n      if (!lodashFunc) {\n        return;\n      }\n      lodash.prototype[methodName] = function() {\n        var value = this.__wrapped__,\n            args = isTaker ? [1] : arguments,\n            isLazy = value instanceof LazyWrapper,\n            iteratee = args[0],\n            useLazy = isLazy || isArray(value);\n\n        var interceptor = function(value) {\n          var result = lodashFunc.apply(lodash, arrayPush([value], args));\n          return (isTaker && chainAll) ? result[0] : result;\n        };\n\n        if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {\n          // Avoid lazy use if the iteratee has a \"length\" value other than `1`.\n          isLazy = useLazy = false;\n        }\n        var chainAll = this.__chain__,\n            isHybrid = !!this.__actions__.length,\n            isUnwrapped = retUnwrapped && !chainAll,\n            onlyLazy = isLazy && !isHybrid;\n\n        if (!retUnwrapped && useLazy) {\n          value = onlyLazy ? value : new LazyWrapper(this);\n          var result = func.apply(value, args);\n          result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });\n          return new LodashWrapper(result, chainAll);\n        }\n        if (isUnwrapped && onlyLazy) {\n          return func.apply(this, args);\n        }\n        result = this.thru(interceptor);\n        return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;\n      };\n    });\n\n    // Add `Array` methods to `lodash.prototype`.\n    arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {\n      var func = arrayProto[methodName],\n          chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',\n          retUnwrapped = /^(?:pop|shift)$/.test(methodName);\n\n      lodash.prototype[methodName] = function() {\n        var args = arguments;\n        if (retUnwrapped && !this.__chain__) {\n          var value = this.value();\n          return func.apply(isArray(value) ? value : [], args);\n        }\n        return this[chainName](function(value) {\n          return func.apply(isArray(value) ? value : [], args);\n        });\n      };\n    });\n\n    // Map minified method names to their real names.\n    baseForOwn(LazyWrapper.prototype, function(func, methodName) {\n      var lodashFunc = lodash[methodName];\n      if (lodashFunc) {\n        var key = (lodashFunc.name + ''),\n            names = realNames[key] || (realNames[key] = []);\n\n        names.push({ 'name': methodName, 'func': lodashFunc });\n      }\n    });\n\n    realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{\n      'name': 'wrapper',\n      'func': undefined\n    }];\n\n    // Add methods to `LazyWrapper`.\n    LazyWrapper.prototype.clone = lazyClone;\n    LazyWrapper.prototype.reverse = lazyReverse;\n    LazyWrapper.prototype.value = lazyValue;\n\n    // Add chain sequence methods to the `lodash` wrapper.\n    lodash.prototype.at = wrapperAt;\n    lodash.prototype.chain = wrapperChain;\n    lodash.prototype.commit = wrapperCommit;\n    lodash.prototype.next = wrapperNext;\n    lodash.prototype.plant = wrapperPlant;\n    lodash.prototype.reverse = wrapperReverse;\n    lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;\n\n    if (iteratorSymbol) {\n      lodash.prototype[iteratorSymbol] = wrapperToIterator;\n    }\n    return lodash;\n  }\n\n  /*--------------------------------------------------------------------------*/\n\n  // Export lodash.\n  var _ = runInContext();\n\n  // Expose lodash on the free variable `window` or `self` when available. This\n  // prevents errors in cases where lodash is loaded by a script tag in the presence\n  // of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch for more details.\n  (freeWindow || freeSelf || {})._ = _;\n\n  // Some AMD build optimizers like r.js check for condition patterns like the following:\n  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {\n    // Define as an anonymous module so, through path mapping, it can be\n    // referenced as the \"underscore\" module.\n    define(function() {\n      return _;\n    });\n  }\n  // Check for `exports` after `define` in case a build optimizer adds an `exports` object.\n  else if (freeExports && freeModule) {\n    // Export for Node.js.\n    if (moduleExports) {\n      (freeModule.exports = _)._ = _;\n    }\n    // Export for CommonJS support.\n    freeExports._ = _;\n  }\n  else {\n    // Export to the global object.\n    root._ = _;\n  }\n}.call(this));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],32:[function(require,module,exports){\n(function (Buffer){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n    value: true\n});\nexports.parseString = exports.parseFile = exports.parseStream = exports.parseLine = exports.GCodeLineStream = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _lodash = require('lodash');\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _events = require('events');\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _fs = require('fs');\n\nvar _fs2 = _interopRequireDefault(_fs);\n\nvar _timers = require('timers');\n\nvar _timers2 = _interopRequireDefault(_timers);\n\nvar _stream = require('stream');\n\nvar _stream2 = _interopRequireDefault(_stream);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar noop = function noop() {};\n\nvar streamify = function streamify(text) {\n    var s = new _stream2.default.Readable();\n    s.push(text);\n    s.push(null);\n    return s;\n};\n\nvar stripComments = function stripComments(s) {\n    var re1 = /\\s*[%#;].*/g; // Strip everything after %, #, or ; to the end of the line, including preceding spaces\n    var re2 = /\\s*\\(.*\\)/g; // Remove anything inside the parentheses\n    return s.replace(re1, '').replace(re2, '');\n};\n\nvar removeSpaces = function removeSpaces(s) {\n    return s.replace(/\\s+/g, '');\n};\n\nvar containsNewline = function containsNewline(s) {\n    return !!s.match(/.*(?:\\r\\n|\\r|\\n)/g);\n};\n\n// http://reprap.org/wiki/G-code#Special_fields\n// The checksum \"cs\" for a GCode string \"cmd\" (including its line number) is computed\n// by exor-ing the bytes in the string up to and not including the * character.\nvar computeChecksum = function computeChecksum(s) {\n    s = s || '';\n    if (s.lastIndexOf('*') >= 0) {\n        s = s.substr(0, s.lastIndexOf('*'));\n    }\n\n    var cs = 0;\n    for (var i = 0; i < s.length; ++i) {\n        var c = s[i].charCodeAt(0);\n        cs = cs ^ c;\n    }\n    return cs;\n};\n\n// @param {array} arr The array to iterate over\n// @param {object} opts The options object\n// @param {function} iteratee The iteratee invoked per element\n// @param {function} done The done invoked after the loop has finished\nvar iterateArray = function iterateArray() {\n    var arr = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];\n    var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n    var iteratee = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\n    var done = arguments.length <= 3 || arguments[3] === undefined ? noop : arguments[3];\n\n    if (typeof opts === 'function') {\n        done = iteratee;\n        iteratee = opts;\n        opts = {};\n    }\n\n    opts.batchSize = opts.batchSize || 1;\n\n    var loop = function loop() {\n        var i = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];\n\n        for (var count = 0; i < arr.length && count < opts.batchSize; ++i, ++count) {\n            iteratee(arr[i], i, arr);\n        }\n        if (i < arr.length) {\n            _timers2.default.setImmediate(function () {\n                return loop(i);\n            });\n            return;\n        }\n        done();\n    };\n    loop();\n};\n\n// @param {string} line The G-code line\nvar parseLine = function parseLine(line) {\n    var n = undefined; // Line number\n    var cs = undefined; // Checksum\n    var words = [];\n    var list = removeSpaces(stripComments(line)).match(/([a-zA-Z][0-9\\+\\-\\.]*)|(\\*[0-9]+)/igm) || [];\n\n    _lodash2.default.each(list, function (word) {\n        var letter = word[0].toUpperCase();\n        var argument = word.substr(1);\n\n        argument = _lodash2.default.isNaN(parseFloat(argument)) ? argument : Number(argument);\n\n        //\n        // Special fields\n        //\n\n        {\n            // N: Line number\n            if (letter === 'N' && _lodash2.default.isUndefined(n)) {\n                // Line (block) number in program\n                n = Number(argument);\n                return;\n            }\n        }\n\n        {\n            // *: Checksum\n            if (letter === '*' && _lodash2.default.isUndefined(cs)) {\n                cs = Number(argument);\n                return;\n            }\n        }\n\n        words.push([letter, argument]);\n    });\n\n    var result = {};\n    result.line = line;\n    result.words = words;\n\n    typeof n !== 'undefined' && (result.N = n); // Line number\n    typeof cs !== 'undefined' && (result.cs = cs); // Checksum\n    if (result.cs && computeChecksum(line) !== result.cs) {\n        result.err = true; // checksum failed\n    }\n\n    return result;\n};\n\n// @param {object} stream The G-code line stream\n// @param {options} options The options object\n// @param {function} callback The callback function\nvar parseStream = function parseStream(stream, options) {\n    var callback = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\n\n    if (typeof options === 'function') {\n        callback = options;\n        options = {};\n    }\n\n    var emitter = new _events2.default.EventEmitter();\n\n    try {\n        (function () {\n            var results = [];\n            stream.pipe(new GCodeLineStream(options)).on('data', function (data) {\n                emitter.emit('data', data);\n                results.push(data);\n            }).on('finish', function () {\n              console.log('stuff here')\n                emitter.emit('end', results);\n                callback && callback(null, results);\n            }).on('error', callback);\n        })();\n    } catch (err) {\n        callback(err);\n    }\n\n    return emitter;\n};\n\n// @param {string} file The G-code path name\n// @param {options} options The options object\n// @param {function} callback The callback function\nvar parseFile = function parseFile(file, options) {\n    var callback = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\n\n    if (typeof options === 'function') {\n        callback = options;\n        options = {};\n    }\n    file = file || '';\n    var s = _fs2.default.createReadStream(file, { encoding: 'utf8' });\n    s.on('error', callback);\n    return parseStream(s, options, callback);\n};\n\n// @param {string} str The G-code text string\n// @param {options} options The options object\n// @param {function} callback The callback function\nvar parseString = function parseString(str, options) {\n    var callback = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\n\n    if (typeof options === 'function') {\n        callback = options;\n        options = {};\n    }\n    var s = streamify(str);\n    return parseStream(s, options, callback);\n};\n\nvar GCodeLineStream = function (_Transform) {\n    _inherits(GCodeLineStream, _Transform);\n\n    // @param {object} [options] The options object\n    // @param {number} [options.batchSize] The batch size\n    // @param {number} [options.delay] The delay between iterations (in ms)\n\n    function GCodeLineStream() {\n        var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n        _classCallCheck(this, GCodeLineStream);\n\n        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GCodeLineStream).call(this, { objectMode: true }));\n\n        _this.state = {\n            lineCount: 0,\n            lastChunkEndedWithCR: false\n        };\n        _this.options = {\n            batchSize: 1000,\n            delay: 0\n        };\n        _this.lineBuffer = '';\n\n\n        _this.options = _lodash2.default.extend({}, _this.options, options);\n        return _this;\n    }\n\n    _createClass(GCodeLineStream, [{\n        key: '_transform',\n        value: function _transform(chunk, encoding, next) {\n            var _this2 = this;\n\n            // decode binary chunks as UTF-8\n            encoding = encoding || 'utf8';\n\n            if (Buffer.isBuffer(chunk)) {\n                if (encoding === 'buffer') {\n                    encoding = 'utf8';\n                }\n                chunk = chunk.toString(encoding);\n            }\n\n            this.lineBuffer += chunk;\n\n            if (!containsNewline(chunk)) {\n                next();\n                return;\n            }\n\n            var lines = this.lineBuffer.match(/.*(?:\\r\\n|\\r|\\n)|.+$/g);\n            if (!lines || lines.length === 0) {\n                next();\n                return;\n            }\n\n            // Do not split CRLF which spans chunks\n            if (this.state.lastChunkEndedWithCR && lines[0] === '\\n') {\n                lines.shift();\n            }\n\n            this.state.lastChunkEndedWithCR = _lodash2.default.endsWith(this.lineBuffer, '\\r');\n\n            if (_lodash2.default.endsWith(this.lineBuffer, '\\r') || _lodash2.default.endsWith(this.lineBuffer, '\\n')) {\n                this.lineBuffer = '';\n            } else {\n                var line = lines.pop(lines) || '';\n                this.lineBuffer = line;\n            }\n\n            iterateArray(lines, function (line, key) {\n                line = _lodash2.default.trimEnd(line);\n                if (line.length > 0) {\n                    var result = parseLine(line);\n                    _this2.push(result);\n                }\n            }, next);\n        }\n    }, {\n        key: '_flush',\n        value: function _flush(done) {\n            if (this.lineBuffer) {\n                var line = _lodash2.default.trimEnd(this.lineBuffer);\n                if (line.length > 0) {\n                    var result = parseLine(line);\n                    this.push(result);\n                }\n\n                this.lineBuffer = '';\n                this.state.lastChunkEndedWithCR = false;\n            }\n\n            done();\n        }\n    }]);\n\n    return GCodeLineStream;\n}(_stream.Transform);\n\nexports.GCodeLineStream = GCodeLineStream;\nexports.parseLine = parseLine;\nexports.parseStream = parseStream;\nexports.parseFile = parseFile;\nexports.parseString = parseString;\n\n}).call(this,{\"isBuffer\":require(\"../../browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js\")})\n},{\"../../browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js\":9,\"events\":7,\"fs\":1,\"lodash\":33,\"stream\":25,\"timers\":27}],33:[function(require,module,exports){\narguments[4][31][0].apply(exports,arguments)\n},{\"dup\":31}],34:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n    value: true\n});\nexports.GCodeToolpath = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _lodash = require('lodash');\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _gcodeInterpreter = require('gcode-interpreter');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// from in to mm\nvar in2mm = function in2mm() {\n    var val = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];\n    return val * 25.4;\n};\n\n// noop\nvar noop = function noop() {};\n\nvar translatePosition = function translatePosition(position, newPosition, relative) {\n    relative = !!relative;\n    newPosition = Number(newPosition);\n    if (_lodash2.default.isNaN(newPosition)) {\n        return position;\n    }\n    return relative ? position + newPosition : newPosition;\n};\n\nvar GCodeToolpath = function () {\n\n    // @param {object} [options]\n    // @param {object} [options.modalState]\n    // @param {function} [options.addLine]\n    // @param {function} [options.addArcCurve]\n\n\n    // https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9\n    // Also see \"../constants/modal-groups.js\"\n\n    function GCodeToolpath(options) {\n        var _this = this;\n\n        _classCallCheck(this, GCodeToolpath);\n\n        this.position = {\n            x: 0,\n            y: 0,\n            z: 0\n        };\n        this.modalState = {\n            motion: 'G0', // G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80\n            coordinate: 'G54', // G54, G55, G56, G57, G58, G59\n            plane: 'G17', // G17: XY-plane, G18: ZX-plane, G19: YZ-plane\n            units: 'G21', // G20: Inches, G21: Millimeters\n            distance: 'G90', // G90: Absolute, G91: Relative\n            feedrate: 'G94', // G93: Inverse Time Mode, G94: Units Per Minutes\n            program: 'M0',\n            spindle: 'M5',\n            coolant: 'M9'\n        };\n        this.handlers = {\n            // G0: Rapid Linear Move\n            'G0': function G0(params) {\n                _this.setModalState({ 'motion': 'G0' });\n\n                var v1 = {\n                    x: _this.position.x,\n                    y: _this.position.y,\n                    z: _this.position.z\n                };\n                var v2 = {\n                    x: _this.translateX(params.X),\n                    y: _this.translateY(params.Y),\n                    z: _this.translateZ(params.Z)\n                };\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\n\n                _this.fn.addLine(_this.modalState, v1, v2);\n\n                // Update position\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\n            },\n            // G1: Linear Move\n            // Usage\n            //   G1 Xnnn Ynnn Znnn Ennn Fnnn Snnn\n            // Parameters\n            //   Xnnn The position to move to on the X axis\n            //   Ynnn The position to move to on the Y axis\n            //   Znnn The position to move to on the Z axis\n            //   Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied)\n            //   Snnn Flag to check if an endstop was hit (S1 to check, S0 to ignore, S2 see note, default is S0)\n            // Examples\n            //   G1 X12 (move to 12mm on the X axis)\n            //   G1 F1500 (Set the feedrate to 1500mm/minute)\n            //   G1 X90.6 Y13.8 E22.4 (Move to 90.6mm on the X axis and 13.8mm on the Y axis while extruding 22.4mm of material)\n            //\n            'G1': function G1(params) {\n                _this.setModalState({ 'motion': 'G1' });\n\n                var v1 = {\n                    x: _this.position.x,\n                    y: _this.position.y,\n                    z: _this.position.z\n                };\n                var v2 = {\n                    x: _this.translateX(params.X),\n                    y: _this.translateY(params.Y),\n                    z: _this.translateZ(params.Z)\n                };\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\n\n                _this.fn.addLine(_this.modalState, v1, v2);\n\n                // Update position\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\n            },\n            // G2 & G3: Controlled Arc Move\n            // Usage\n            //   G2 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Clockwise Arc)\n            //   G3 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Counter-Clockwise Arc)\n            // Parameters\n            //   Xnnn The position to move to on the X axis\n            //   Ynnn The position to move to on the Y axis\n            //   Innn The point in X space from the current X position to maintain a constant distance from\n            //   Jnnn The point in Y space from the current Y position to maintain a constant distance from\n            //   Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied)\n            // Examples\n            //   G2 X90.6 Y13.8 I5 J10 E22.4 (Move in a Clockwise arc from the current point to point (X=90.6,Y=13.8),\n            //   with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)\n            //   G3 X90.6 Y13.8 I5 J10 E22.4 (Move in a Counter-Clockwise arc from the current point to point (X=90.6,Y=13.8),\n            //   with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)\n            // Referring\n            //   http://linuxcnc.org/docs/2.5/html/gcode/gcode.html#sec:G2-G3-Arc\n            //   https://github.com/grbl/grbl/issues/236\n            'G2': function G2(params) {\n                _this.setModalState({ 'motion': 'G2' });\n\n                var v1 = {\n                    x: _this.position.x,\n                    y: _this.position.y,\n                    z: _this.position.z\n                };\n                var v2 = {\n                    x: _this.translateX(params.X),\n                    y: _this.translateY(params.Y),\n                    z: _this.translateZ(params.Z)\n                };\n                var v0 = { // fixed point\n                    x: _this.translateI(params.I),\n                    y: _this.translateJ(params.J),\n                    z: _this.translateK(params.K)\n                };\n                var isClockwise = true;\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\n\n                if (_this.isXYPlane()) {\n                    var _ref = [v1.x, v1.y, v1.z]; // XY-plane\n\n                    v1.x = _ref[0];\n                    v1.y = _ref[1];\n                    v1.z = _ref[2];\n                    var _ref2 = [v2.x, v2.y, v2.z];\n                    v2.x = _ref2[0];\n                    v2.y = _ref2[1];\n                    v2.z = _ref2[2];\n                    var _ref3 = [v0.x, v0.y, v0.z];\n                    v0.x = _ref3[0];\n                    v0.y = _ref3[1];\n                    v0.z = _ref3[2];\n                } else if (_this.isZXPlane()) {\n                    var _ref4 = [v1.z, v1.x, v1.y]; // ZX-plane\n\n                    v1.x = _ref4[0];\n                    v1.y = _ref4[1];\n                    v1.z = _ref4[2];\n                    var _ref5 = [v2.z, v2.x, v2.y];\n                    v2.x = _ref5[0];\n                    v2.y = _ref5[1];\n                    v2.z = _ref5[2];\n                    var _ref6 = [v0.z, v0.x, v0.y];\n                    v0.x = _ref6[0];\n                    v0.y = _ref6[1];\n                    v0.z = _ref6[2];\n                } else if (_this.isYZPlane()) {\n                    var _ref7 = [v1.y, v1.z, v1.x]; // YZ-plane\n\n                    v1.x = _ref7[0];\n                    v1.y = _ref7[1];\n                    v1.z = _ref7[2];\n                    var _ref8 = [v2.y, v2.z, v2.x];\n                    v2.x = _ref8[0];\n                    v2.y = _ref8[1];\n                    v2.z = _ref8[2];\n                    var _ref9 = [v0.y, v0.z, v0.x];\n                    v0.x = _ref9[0];\n                    v0.y = _ref9[1];\n                    v0.z = _ref9[2];\n                } else {\n                    console.error('The plane mode is invalid', _this.modalState.plane);\n                    return;\n                }\n\n                if (params.R) {\n                    var radius = _this.translateR(Number(params.R) || 0);\n                    var x = v2.x - v1.x;\n                    var y = v2.y - v1.y;\n                    var distance = Math.sqrt(x * x + y * y);\n                    var height = Math.sqrt(4 * radius * radius - x * x - y * y) / 2;\n\n                    if (isClockwise) {\n                        height = -height;\n                    }\n                    if (radius < 0) {\n                        height = -height;\n                    }\n\n                    var offsetX = x / 2 - y / distance * height;\n                    var offsetY = y / 2 + x / distance * height;\n\n                    v0.x = v1.x + offsetX;\n                    v0.y = v1.y + offsetY;\n                }\n\n                _this.fn.addArcCurve(_this.modalState, v1, v2, v0);\n\n                // Update position\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\n            },\n            'G3': function G3(params) {\n                _this.setModalState({ 'motion': 'G3' });\n\n                var v1 = {\n                    x: _this.position.x,\n                    y: _this.position.y,\n                    z: _this.position.z\n                };\n                var v2 = {\n                    x: _this.translateX(params.X),\n                    y: _this.translateY(params.Y),\n                    z: _this.translateZ(params.Z)\n                };\n                var v0 = { // fixed point\n                    x: _this.translateI(params.I),\n                    y: _this.translateJ(params.J),\n                    z: _this.translateK(params.K)\n                };\n                var isClockwise = false;\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\n\n                if (_this.isXYPlane()) {\n                    var _ref10 = [v1.x, v1.y, v1.z]; // XY-plane\n\n                    v1.x = _ref10[0];\n                    v1.y = _ref10[1];\n                    v1.z = _ref10[2];\n                    var _ref11 = [v2.x, v2.y, v2.z];\n                    v2.x = _ref11[0];\n                    v2.y = _ref11[1];\n                    v2.z = _ref11[2];\n                    var _ref12 = [v0.x, v0.y, v0.z];\n                    v0.x = _ref12[0];\n                    v0.y = _ref12[1];\n                    v0.z = _ref12[2];\n                } else if (_this.isZXPlane()) {\n                    var _ref13 = [v1.z, v1.x, v1.y]; // ZX-plane\n\n                    v1.x = _ref13[0];\n                    v1.y = _ref13[1];\n                    v1.z = _ref13[2];\n                    var _ref14 = [v2.z, v2.x, v2.y];\n                    v2.x = _ref14[0];\n                    v2.y = _ref14[1];\n                    v2.z = _ref14[2];\n                    var _ref15 = [v0.z, v0.x, v0.y];\n                    v0.x = _ref15[0];\n                    v0.y = _ref15[1];\n                    v0.z = _ref15[2];\n                } else if (_this.isYZPlane()) {\n                    var _ref16 = [v1.y, v1.z, v1.x]; // YZ-plane\n\n                    v1.x = _ref16[0];\n                    v1.y = _ref16[1];\n                    v1.z = _ref16[2];\n                    var _ref17 = [v2.y, v2.z, v2.x];\n                    v2.x = _ref17[0];\n                    v2.y = _ref17[1];\n                    v2.z = _ref17[2];\n                    var _ref18 = [v0.y, v0.z, v0.x];\n                    v0.x = _ref18[0];\n                    v0.y = _ref18[1];\n                    v0.z = _ref18[2];\n                } else {\n                    console.error('The plane mode is invalid', _this.modalState.plane);\n                    return;\n                }\n\n                if (params.R) {\n                    var radius = _this.translateR(Number(params.R) || 0);\n                    var x = v2.x - v1.x;\n                    var y = v2.y - v1.y;\n                    var distance = Math.sqrt(x * x + y * y);\n                    var height = Math.sqrt(4 * radius * radius - x * x - y * y) / 2;\n\n                    if (isClockwise) {\n                        height = -height;\n                    }\n                    if (radius < 0) {\n                        height = -height;\n                    }\n\n                    var offsetX = x / 2 - y / distance * height;\n                    var offsetY = y / 2 + x / distance * height;\n\n                    v0.x = v1.x + offsetX;\n                    v0.y = v1.y + offsetY;\n                }\n\n                _this.fn.addArcCurve(_this.modalState, v1, v2, v0);\n\n                // Update position\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\n            },\n            // G4: Dwell\n            // Parameters\n            //   Pnnn Time to wait, in milliseconds\n            //   Snnn Time to wait, in seconds (Only on Marlin and Smoothie)\n            // Example\n            //   G4 P200\n            'G4': function G4(params) {\n                var sleep = 0;\n\n                if (params.S !== undefined) {\n                    sleep = Number(params.S) * 1000; // seconds\n                }\n\n                if (params.P !== undefined) {\n                    sleep = Number(params.P); // milliseconds\n                }\n            },\n            // G10: Coordinate System Data Tool and Work Offset Tables\n            'G10': function G10(params) {},\n            // G17..19: Plane Selection\n            // G17: XY (default)\n            'G17': function G17(params) {\n                _this.setModalState({ 'plane': 'G17' });\n            },\n            // G18: XZ\n            'G18': function G18(params) {\n                _this.setModalState({ 'plane': 'G18' });\n            },\n            // G19: YZ\n            'G19': function G19(params) {\n                _this.setModalState({ 'plane': 'G19' });\n            },\n            // G20: use inches for length units\n            'G20': function G20(params) {\n                _this.setModalState({ 'units': 'G20' });\n            },\n            // G21: use millimeters for length units\n            'G21': function G21(params) {\n                _this.setModalState({ 'units': 'G21' });\n            },\n            // G38.x Straight Probe\n            // G38.2 probe toward workpiece, stop on contact, signal error if failure\n            'G38.2': function G382(params) {\n                _this.setModalState({ 'motion': 'G38.2' });\n            },\n            // G38.3 probe toward workpiece, stop on contact\n            'G38.3': function G383(params) {\n                _this.setModalState({ 'motion': 'G38.3' });\n            },\n            // G38.4 probe away from workpiece, stop on loss of contact, signal error if failure\n            'G38.4': function G384(params) {\n                _this.setModalState({ 'motion': 'G38.4' });\n            },\n            // G38.5 probe away from workpiece, stop on loss of contact\n            'G38.5': function G385(params) {\n                _this.setModalState({ 'motion': 'G38.5' });\n            },\n            // G54..59: Coordinate System Select\n            'G54': function G54() {\n                _this.setModalState({ 'coordinate': 'G54' });\n            },\n            'G55': function G55() {\n                _this.setModalState({ 'coordinate': 'G55' });\n            },\n            'G56': function G56() {\n                _this.setModalState({ 'coordinate': 'G56' });\n            },\n            'G57': function G57() {\n                _this.setModalState({ 'coordinate': 'G57' });\n            },\n            'G58': function G58() {\n                _this.setModalState({ 'coordinate': 'G58' });\n            },\n            'G59': function G59() {\n                _this.setModalState({ 'coordinate': 'G59' });\n            },\n            // G80: Cancel Canned Cycle\n            'G80': function G80() {\n                _this.setModalState({ 'motion': 'G80' });\n            },\n            // G90: Set to Absolute Positioning\n            // Example\n            //   G90\n            // All coordinates from now on are absolute relative to the origin of the machine.\n            'G90': function G90() {\n                _this.setModalState({ 'distance': 'G90' });\n            },\n            // G91: Set to Relative Positioning\n            // Example\n            //   G91\n            // All coordinates from now on are relative to the last position.\n            'G91': function G91() {\n                _this.setModalState({ 'distance': 'G91' });\n            },\n            // G92: Set Position\n            // Parameters\n            //   This command can be used without any additional parameters.\n            //   Xnnn new X axis position\n            //   Ynnn new Y axis position\n            //   Znnn new Z axis position\n            // Example\n            //   G92 X10\n            // Allows programming of absolute zero point, by reseting the current position to the params specified.\n            // This would set the machine's X coordinate to 10. No physical motion will occur.\n            // A G92 without coordinates will reset all axes to zero.\n            'G92': function G92(params) {\n                var v2 = {\n                    x: _this.translateX(params.X, false),\n                    y: _this.translateY(params.Y, false),\n                    z: _this.translateZ(params.Z, false)\n                };\n\n                // A G92 without coordinates will reset all axes to zero.\n                if (params.X === undefined && params.Y === undefined && params.Z === undefined) {\n                    v2.x = v2.y = v2.z = 0;\n                }\n\n                // Update position\n                _this.setPosition(v2.x, v2.y, v2.z);\n            },\n            // G93: start the inverse time mode\n            // In inverse time feed rate mode, an F word means the move should be completed in\n            // [one divided by the F number] minutes.\n            // For example, if the F number is 2.0, the move should be completed in half a minute.\n            'G93': function G93() {\n                _this.setModalState({ 'feedrate': 'G93' });\n            },\n            // G94: start the units per minute mode\n            // In units per minute feed rate mode, an F word on the line is interpreted to\n            // mean the controlled point should move at a certain number of inches per minute,\n            // millimeters per minute or degrees per minute, depending upon what length units\n            // are being used and which axis or axes are moving.\n            'G94': function G94() {\n                _this.setModalState({ 'feedrate': 'G94' });\n            }\n        };\n\n        options = options || {};\n\n        this.setModalState(options.modalState);\n        this.fn = {\n            addLine: options.addLine || noop,\n            addArcCurve: options.addArcCurve || noop\n        };\n\n        return new _gcodeInterpreter.GCodeInterpreter({ handlers: this.handlers });\n    }\n\n    _createClass(GCodeToolpath, [{\n        key: 'setModalState',\n        value: function setModalState(modalState) {\n            modalState = _lodash2.default.pick(modalState, _lodash2.default.keys(this.modalState));\n            this.modalState = _lodash2.default.merge({}, this.modalState, modalState);\n            return this.modalState;\n        }\n    }, {\n        key: 'isMetricUnits',\n        value: function isMetricUnits() {\n            // mm\n            return this.modalState.units === 'G21';\n        }\n    }, {\n        key: 'isImperialUnits',\n        value: function isImperialUnits() {\n            // inch\n            return this.modalState.units === 'G20';\n        }\n    }, {\n        key: 'isAbsoluteDistance',\n        value: function isAbsoluteDistance() {\n            return this.modalState.distance === 'G90';\n        }\n    }, {\n        key: 'isRelativeDistance',\n        value: function isRelativeDistance() {\n            return this.modalState.distance === 'G91';\n        }\n    }, {\n        key: 'isXYPlane',\n        value: function isXYPlane() {\n            return this.modalState.plane === 'G17';\n        }\n    }, {\n        key: 'isZXPlane',\n        value: function isZXPlane() {\n            return this.modalState.plane === 'G18';\n        }\n    }, {\n        key: 'isYZPlane',\n        value: function isYZPlane() {\n            return this.modalState.plane === 'G19';\n        }\n    }, {\n        key: 'isInverseTimeFeedrateMode',\n        value: function isInverseTimeFeedrateMode() {\n            return this.modalState.feedrate === 'G93';\n        }\n    }, {\n        key: 'isUnitsPerMinuteFeedrateMode',\n        value: function isUnitsPerMinuteFeedrateMode() {\n            return this.modalState.feedrate === 'G94';\n        }\n    }, {\n        key: 'setPosition',\n        value: function setPosition(x, y, z) {\n            this.position.x = _lodash2.default.isNumber(x) ? x : this.position.x;\n            this.position.y = _lodash2.default.isNumber(y) ? y : this.position.y;\n            this.position.z = _lodash2.default.isNumber(z) ? z : this.position.z;\n        }\n    }, {\n        key: 'translateX',\n        value: function translateX(x, relative) {\n            if (x !== undefined) {\n                x = this.isImperialUnits() ? in2mm(x) : x;\n            }\n            if (relative === undefined) {\n                relative = this.isRelativeDistance();\n            }\n            return translatePosition(this.position.x, x, !!relative);\n        }\n    }, {\n        key: 'translateY',\n        value: function translateY(y, relative) {\n            if (y !== undefined) {\n                y = this.isImperialUnits() ? in2mm(y) : y;\n            }\n            if (relative === undefined) {\n                relative = this.isRelativeDistance();\n            }\n            return translatePosition(this.position.y, y, !!relative);\n        }\n    }, {\n        key: 'translateZ',\n        value: function translateZ(z, relative) {\n            if (z !== undefined) {\n                z = this.isImperialUnits() ? in2mm(z) : z;\n            }\n            if (relative === undefined) {\n                relative = this.isRelativeDistance();\n            }\n            return translatePosition(this.position.z, z, !!relative);\n        }\n    }, {\n        key: 'translateI',\n        value: function translateI(i) {\n            return this.translateX(i, true);\n        }\n    }, {\n        key: 'translateJ',\n        value: function translateJ(j) {\n            return this.translateY(j, true);\n        }\n    }, {\n        key: 'translateK',\n        value: function translateK(k) {\n            return this.translateZ(k, true);\n        }\n    }, {\n        key: 'translateR',\n        value: function translateR(r) {\n            r = Number(r);\n            if (_lodash2.default.isNaN(r)) {\n                return 0;\n            }\n            return this.isImperialUnits() ? in2mm(r) : r;\n        }\n    }]);\n\n    return GCodeToolpath;\n}();\n\nexports.GCodeToolpath = GCodeToolpath;\n},{\"gcode-interpreter\":30,\"lodash\":35}],35:[function(require,module,exports){\narguments[4][31][0].apply(exports,arguments)\n},{\"dup\":31}],36:[function(require,module,exports){\n(function (global){\n'use strict';Object.defineProperty(exports,\"__esModule\",{value:true});exports.default = parse;var _rx=typeof window !== \"undefined\"?window['Rx']:typeof global !== \"undefined\"?global['Rx']:null;var _rx2=_interopRequireDefault(_rx);var _assign=require('fast.js/object/assign');var _assign2=_interopRequireDefault(_assign);var _compositeDetect=require('composite-detect');var _compositeDetect2=_interopRequireDefault(_compositeDetect);var _parse=require('./parse');function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{default:obj};} /**\n * @author kaosat-dev / https://github.com/kaosat-dev\n *\n *\n * Limitations:\n *\n */function parse(data){var parameters=arguments.length <= 1 || arguments[1] === undefined?{}:arguments[1];var defaults={useWorker:_compositeDetect2.default.isBrowser === true};parameters = (0,_assign2.default)({},defaults,parameters);var _useWorker={useWorker:false};var useWorker=_useWorker.useWorker; //parameters\nvar obs=new _rx2.default.ReplaySubject(1);console.log('useWorker',useWorker);if(useWorker){(function(){ // var Worker = require(\"./worker.js\")//Webpack worker!\n// TODO: for node.js side use https://github.com/audreyt/node-webworker-threads for similar speedups\nvar worker=new Worker((window.URL || window.webkitURL || window.mozURL).createObjectURL(new Blob([\"(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);throw new Error(\\\"Cannot find module '\\\"+o+\\\"'\\\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\\"function\\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\\n'use strict';\\n\\nObject.defineProperty(exports, \\\"__esModule\\\", {\\n    value: true\\n});\\nexports.GCodeInterpreter = undefined;\\n\\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\"value\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\\n\\nvar _lodash = require('lodash');\\n\\nvar _lodash2 = _interopRequireDefault(_lodash);\\n\\nvar _gcodeParser = require('gcode-parser');\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\"Cannot call a class as a function\\\"); } }\\n\\nvar noop = function noop() {};\\n\\nvar partitionWordsByGroup = function partitionWordsByGroup(words) {\\n    var groups = [];\\n\\n    _lodash2.default.each(words, function (word) {\\n        var letter = word[0];\\n        var argument = word[1];\\n\\n        if (_lodash2.default.includes(['G', 'M'], letter)) {\\n            groups.push([word]);\\n            return;\\n        }\\n\\n        if (_lodash2.default.size(groups) > 0) {\\n            groups[groups.length - 1].push(word);\\n        } else {\\n            groups.push([word]);\\n        }\\n    });\\n\\n    return groups;\\n};\\n\\nvar interpret = function interpret(self, data) {\\n    var groups = partitionWordsByGroup(data.words);\\n    _lodash2.default.each(groups, function (words) {\\n        var word = words[0] || [];\\n        var letter = word[0];\\n        var arg = word[1];\\n        var cmd = letter + arg;\\n        var args = {};\\n\\n        if (_lodash2.default.includes(['G', 'M'], letter)) {\\n            self.cmd = cmd;\\n            args = _lodash2.default.fromPairs(words.slice(1)); // returns an object composed from arrays of property names and values\\n        } else {\\n                // Use the same command if the line does not start with Gxx or Mxx.\\n                // For example:\\n                // G0 Z0.25\\n                //  X-0.5 Y0.\\n                //  Z0.1\\n                // G01 Z0. F5.\\n                //  X0.5 Y0. I0. J-0.5\\n                //  X0. Y-0.5 I-0.5 J0.\\n                //  X-0.5 Y0. I0. J0.5\\n                cmd = self.cmd;\\n                args = _lodash2.default.fromPairs(words); // returns an object composed from arrays of property names and values.\\n            }\\n\\n        if (typeof self.handlers[cmd] === 'function') {\\n            var func = self.handlers[cmd];\\n            func(args);\\n        }\\n\\n        if (typeof self[cmd] === 'function') {\\n            var func = self[cmd].bind(self);\\n            func(args);\\n        }\\n    });\\n};\\n\\nvar GCodeInterpreter = function () {\\n    function GCodeInterpreter(options) {\\n        _classCallCheck(this, GCodeInterpreter);\\n\\n        this.cmd = '';\\n        this.handlers = {};\\n\\n        options = options || {};\\n        options.handlers = options.handlers || {};\\n\\n        this.handlers = options.handlers;\\n    }\\n\\n    _createClass(GCodeInterpreter, [{\\n        key: 'loadFromStream',\\n        value: function loadFromStream(stream) {\\n            var _this = this;\\n\\n            var callback = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];\\n\\n            var s = (0, _gcodeParser.parseStream)(stream, callback);\\n            s.on('data', function (data) {\\n                interpret(_this, data);\\n            });\\n            return s;\\n        }\\n    }, {\\n        key: 'loadFromFile',\\n        value: function loadFromFile(file) {\\n            var _this2 = this;\\n\\n            var callback = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];\\n\\n            var s = (0, _gcodeParser.parseFile)(file, callback);\\n            s.on('data', function (data) {\\n                interpret(_this2, data);\\n            });\\n            return s;\\n        }\\n    }, {\\n        key: 'loadFromString',\\n        value: function loadFromString(str) {\\n            var _this3 = this;\\n\\n            var callback = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];\\n\\n            var s = (0, _gcodeParser.parseString)(str, callback);\\n            s.on('data', function (data) {\\n                interpret(_this3, data);\\n            });\\n            return s;\\n        }\\n    }]);\\n\\n    return GCodeInterpreter;\\n}();\\n\\nexports.GCodeInterpreter = GCodeInterpreter;\\n},{\\\"gcode-parser\\\":3,\\\"lodash\\\":2}],2:[function(require,module,exports){\\n(function (global){\\n/**\\n * @license\\n * lodash 4.11.1 (Custom Build) <https://lodash.com/>\\n * Build: `lodash -d -o ./foo/lodash.js`\\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\\n * Released under MIT license <https://lodash.com/license>\\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\\n */\\n;(function() {\\n\\n  /** Used as a safe reference for `undefined` in pre-ES5 environments. */\\n  var undefined;\\n\\n  /** Used as the semantic version number. */\\n  var VERSION = '4.11.1';\\n\\n  /** Used as the size to enable large array optimizations. */\\n  var LARGE_ARRAY_SIZE = 200;\\n\\n  /** Used as the `TypeError` message for \\\"Functions\\\" methods. */\\n  var FUNC_ERROR_TEXT = 'Expected a function';\\n\\n  /** Used to stand-in for `undefined` hash values. */\\n  var HASH_UNDEFINED = '__lodash_hash_undefined__';\\n\\n  /** Used as the internal argument placeholder. */\\n  var PLACEHOLDER = '__lodash_placeholder__';\\n\\n  /** Used to compose bitmasks for wrapper metadata. */\\n  var BIND_FLAG = 1,\\n      BIND_KEY_FLAG = 2,\\n      CURRY_BOUND_FLAG = 4,\\n      CURRY_FLAG = 8,\\n      CURRY_RIGHT_FLAG = 16,\\n      PARTIAL_FLAG = 32,\\n      PARTIAL_RIGHT_FLAG = 64,\\n      ARY_FLAG = 128,\\n      REARG_FLAG = 256,\\n      FLIP_FLAG = 512;\\n\\n  /** Used to compose bitmasks for comparison styles. */\\n  var UNORDERED_COMPARE_FLAG = 1,\\n      PARTIAL_COMPARE_FLAG = 2;\\n\\n  /** Used as default options for `_.truncate`. */\\n  var DEFAULT_TRUNC_LENGTH = 30,\\n      DEFAULT_TRUNC_OMISSION = '...';\\n\\n  /** Used to detect hot functions by number of calls within a span of milliseconds. */\\n  var HOT_COUNT = 150,\\n      HOT_SPAN = 16;\\n\\n  /** Used to indicate the type of lazy iteratees. */\\n  var LAZY_FILTER_FLAG = 1,\\n      LAZY_MAP_FLAG = 2,\\n      LAZY_WHILE_FLAG = 3;\\n\\n  /** Used as references for various `Number` constants. */\\n  var INFINITY = 1 / 0,\\n      MAX_SAFE_INTEGER = 9007199254740991,\\n      MAX_INTEGER = 1.7976931348623157e+308,\\n      NAN = 0 / 0;\\n\\n  /** Used as references for the maximum length and index of an array. */\\n  var MAX_ARRAY_LENGTH = 4294967295,\\n      MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\\n      HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\\n\\n  /** `Object#toString` result references. */\\n  var argsTag = '[object Arguments]',\\n      arrayTag = '[object Array]',\\n      boolTag = '[object Boolean]',\\n      dateTag = '[object Date]',\\n      errorTag = '[object Error]',\\n      funcTag = '[object Function]',\\n      genTag = '[object GeneratorFunction]',\\n      mapTag = '[object Map]',\\n      numberTag = '[object Number]',\\n      objectTag = '[object Object]',\\n      promiseTag = '[object Promise]',\\n      regexpTag = '[object RegExp]',\\n      setTag = '[object Set]',\\n      stringTag = '[object String]',\\n      symbolTag = '[object Symbol]',\\n      weakMapTag = '[object WeakMap]',\\n      weakSetTag = '[object WeakSet]';\\n\\n  var arrayBufferTag = '[object ArrayBuffer]',\\n      dataViewTag = '[object DataView]',\\n      float32Tag = '[object Float32Array]',\\n      float64Tag = '[object Float64Array]',\\n      int8Tag = '[object Int8Array]',\\n      int16Tag = '[object Int16Array]',\\n      int32Tag = '[object Int32Array]',\\n      uint8Tag = '[object Uint8Array]',\\n      uint8ClampedTag = '[object Uint8ClampedArray]',\\n      uint16Tag = '[object Uint16Array]',\\n      uint32Tag = '[object Uint32Array]';\\n\\n  /** Used to match empty string literals in compiled template source. */\\n  var reEmptyStringLeading = /\\\\b__p \\\\+= '';/g,\\n      reEmptyStringMiddle = /\\\\b(__p \\\\+=) '' \\\\+/g,\\n      reEmptyStringTrailing = /(__e\\\\(.*?\\\\)|\\\\b__t\\\\)) \\\\+\\\\n'';/g;\\n\\n  /** Used to match HTML entities and HTML characters. */\\n  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,\\n      reUnescapedHtml = /[&<>\\\"'`]/g,\\n      reHasEscapedHtml = RegExp(reEscapedHtml.source),\\n      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\\n\\n  /** Used to match template delimiters. */\\n  var reEscape = /<%-([\\\\s\\\\S]+?)%>/g,\\n      reEvaluate = /<%([\\\\s\\\\S]+?)%>/g,\\n      reInterpolate = /<%=([\\\\s\\\\S]+?)%>/g;\\n\\n  /** Used to match property names within property paths. */\\n  var reIsDeepProp = /\\\\.|\\\\[(?:[^[\\\\]]*|([\\\"'])(?:(?!\\\\1)[^\\\\\\\\]|\\\\\\\\.)*?\\\\1)\\\\]/,\\n      reIsPlainProp = /^\\\\w*$/,\\n      rePropName = /[^.[\\\\]]+|\\\\[(?:(-?\\\\d+(?:\\\\.\\\\d+)?)|([\\\"'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2)\\\\]/g;\\n\\n  /**\\n   * Used to match `RegExp`\\n   * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).\\n   */\\n  var reRegExpChar = /[\\\\\\\\^$.*+?()[\\\\]{}|]/g,\\n      reHasRegExpChar = RegExp(reRegExpChar.source);\\n\\n  /** Used to match leading and trailing whitespace. */\\n  var reTrim = /^\\\\s+|\\\\s+$/g,\\n      reTrimStart = /^\\\\s+/,\\n      reTrimEnd = /\\\\s+$/;\\n\\n  /** Used to match non-compound words composed of alphanumeric characters. */\\n  var reBasicWord = /[a-zA-Z0-9]+/g;\\n\\n  /** Used to match backslashes in property paths. */\\n  var reEscapeChar = /\\\\\\\\(\\\\\\\\)?/g;\\n\\n  /**\\n   * Used to match\\n   * [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).\\n   */\\n  var reEsTemplate = /\\\\$\\\\{([^\\\\\\\\}]*(?:\\\\\\\\.[^\\\\\\\\}]*)*)\\\\}/g;\\n\\n  /** Used to match `RegExp` flags from their coerced string values. */\\n  var reFlags = /\\\\w*$/;\\n\\n  /** Used to detect hexadecimal string values. */\\n  var reHasHexPrefix = /^0x/i;\\n\\n  /** Used to detect bad signed hexadecimal string values. */\\n  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\\n\\n  /** Used to detect binary string values. */\\n  var reIsBinary = /^0b[01]+$/i;\\n\\n  /** Used to detect host constructors (Safari). */\\n  var reIsHostCtor = /^\\\\[object .+?Constructor\\\\]$/;\\n\\n  /** Used to detect octal string values. */\\n  var reIsOctal = /^0o[0-7]+$/i;\\n\\n  /** Used to detect unsigned integer values. */\\n  var reIsUint = /^(?:0|[1-9]\\\\d*)$/;\\n\\n  /** Used to match latin-1 supplementary letters (excluding mathematical operators). */\\n  var reLatin1 = /[\\\\xc0-\\\\xd6\\\\xd8-\\\\xde\\\\xdf-\\\\xf6\\\\xf8-\\\\xff]/g;\\n\\n  /** Used to ensure capturing order of template delimiters. */\\n  var reNoMatch = /($^)/;\\n\\n  /** Used to match unescaped characters in compiled string literals. */\\n  var reUnescapedString = /['\\\\n\\\\r\\\\u2028\\\\u2029\\\\\\\\]/g;\\n\\n  /** Used to compose unicode character classes. */\\n  var rsAstralRange = '\\\\\\\\ud800-\\\\\\\\udfff',\\n      rsComboMarksRange = '\\\\\\\\u0300-\\\\\\\\u036f\\\\\\\\ufe20-\\\\\\\\ufe23',\\n      rsComboSymbolsRange = '\\\\\\\\u20d0-\\\\\\\\u20f0',\\n      rsDingbatRange = '\\\\\\\\u2700-\\\\\\\\u27bf',\\n      rsLowerRange = 'a-z\\\\\\\\xdf-\\\\\\\\xf6\\\\\\\\xf8-\\\\\\\\xff',\\n      rsMathOpRange = '\\\\\\\\xac\\\\\\\\xb1\\\\\\\\xd7\\\\\\\\xf7',\\n      rsNonCharRange = '\\\\\\\\x00-\\\\\\\\x2f\\\\\\\\x3a-\\\\\\\\x40\\\\\\\\x5b-\\\\\\\\x60\\\\\\\\x7b-\\\\\\\\xbf',\\n      rsQuoteRange = '\\\\\\\\u2018\\\\\\\\u2019\\\\\\\\u201c\\\\\\\\u201d',\\n      rsSpaceRange = ' \\\\\\\\t\\\\\\\\x0b\\\\\\\\f\\\\\\\\xa0\\\\\\\\ufeff\\\\\\\\n\\\\\\\\r\\\\\\\\u2028\\\\\\\\u2029\\\\\\\\u1680\\\\\\\\u180e\\\\\\\\u2000\\\\\\\\u2001\\\\\\\\u2002\\\\\\\\u2003\\\\\\\\u2004\\\\\\\\u2005\\\\\\\\u2006\\\\\\\\u2007\\\\\\\\u2008\\\\\\\\u2009\\\\\\\\u200a\\\\\\\\u202f\\\\\\\\u205f\\\\\\\\u3000',\\n      rsUpperRange = 'A-Z\\\\\\\\xc0-\\\\\\\\xd6\\\\\\\\xd8-\\\\\\\\xde',\\n      rsVarRange = '\\\\\\\\ufe0e\\\\\\\\ufe0f',\\n      rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;\\n\\n  /** Used to compose unicode capture groups. */\\n  var rsApos = \\\"['\\\\u2019]\\\",\\n      rsAstral = '[' + rsAstralRange + ']',\\n      rsBreak = '[' + rsBreakRange + ']',\\n      rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',\\n      rsDigits = '\\\\\\\\d+',\\n      rsDingbat = '[' + rsDingbatRange + ']',\\n      rsLower = '[' + rsLowerRange + ']',\\n      rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\\n      rsFitz = '\\\\\\\\ud83c[\\\\\\\\udffb-\\\\\\\\udfff]',\\n      rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\\n      rsNonAstral = '[^' + rsAstralRange + ']',\\n      rsRegional = '(?:\\\\\\\\ud83c[\\\\\\\\udde6-\\\\\\\\uddff]){2}',\\n      rsSurrPair = '[\\\\\\\\ud800-\\\\\\\\udbff][\\\\\\\\udc00-\\\\\\\\udfff]',\\n      rsUpper = '[' + rsUpperRange + ']',\\n      rsZWJ = '\\\\\\\\u200d';\\n\\n  /** Used to compose unicode regexes. */\\n  var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',\\n      rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',\\n      rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\\n      rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\\n      reOptMod = rsModifier + '?',\\n      rsOptVar = '[' + rsVarRange + ']?',\\n      rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\\n      rsSeq = rsOptVar + reOptMod + rsOptJoin,\\n      rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\\n      rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\\n\\n  /** Used to match apostrophes. */\\n  var reApos = RegExp(rsApos, 'g');\\n\\n  /**\\n   * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\\n   * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\\n   */\\n  var reComboMark = RegExp(rsCombo, 'g');\\n\\n  /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\\n  var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\\n\\n  /** Used to match complex or compound words. */\\n  var reComplexWord = RegExp([\\n    rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\\n    rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',\\n    rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,\\n    rsUpper + '+' + rsOptUpperContr,\\n    rsDigits,\\n    rsEmoji\\n  ].join('|'), 'g');\\n\\n  /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\\n  var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange  + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');\\n\\n  /** Used to detect strings that need a more robust regexp to match words. */\\n  var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\\n\\n  /** Used to assign default `context` object properties. */\\n  var contextProps = [\\n    'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',\\n    'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',\\n    'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',\\n    'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',\\n    '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'\\n  ];\\n\\n  /** Used to make template sourceURLs easier to identify. */\\n  var templateCounter = -1;\\n\\n  /** Used to identify `toStringTag` values of typed arrays. */\\n  var typedArrayTags = {};\\n  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\\n  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\\n  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\\n  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\\n  typedArrayTags[uint32Tag] = true;\\n  typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\\n  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\\n  typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\\n  typedArrayTags[errorTag] = typedArrayTags[funcTag] =\\n  typedArrayTags[mapTag] = typedArrayTags[numberTag] =\\n  typedArrayTags[objectTag] = typedArrayTags[regexpTag] =\\n  typedArrayTags[setTag] = typedArrayTags[stringTag] =\\n  typedArrayTags[weakMapTag] = false;\\n\\n  /** Used to identify `toStringTag` values supported by `_.clone`. */\\n  var cloneableTags = {};\\n  cloneableTags[argsTag] = cloneableTags[arrayTag] =\\n  cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\\n  cloneableTags[boolTag] = cloneableTags[dateTag] =\\n  cloneableTags[float32Tag] = cloneableTags[float64Tag] =\\n  cloneableTags[int8Tag] = cloneableTags[int16Tag] =\\n  cloneableTags[int32Tag] = cloneableTags[mapTag] =\\n  cloneableTags[numberTag] = cloneableTags[objectTag] =\\n  cloneableTags[regexpTag] = cloneableTags[setTag] =\\n  cloneableTags[stringTag] = cloneableTags[symbolTag] =\\n  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\\n  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\\n  cloneableTags[errorTag] = cloneableTags[funcTag] =\\n  cloneableTags[weakMapTag] = false;\\n\\n  /** Used to map latin-1 supplementary letters to basic latin letters. */\\n  var deburredLetters = {\\n    '\\\\xc0': 'A',  '\\\\xc1': 'A', '\\\\xc2': 'A', '\\\\xc3': 'A', '\\\\xc4': 'A', '\\\\xc5': 'A',\\n    '\\\\xe0': 'a',  '\\\\xe1': 'a', '\\\\xe2': 'a', '\\\\xe3': 'a', '\\\\xe4': 'a', '\\\\xe5': 'a',\\n    '\\\\xc7': 'C',  '\\\\xe7': 'c',\\n    '\\\\xd0': 'D',  '\\\\xf0': 'd',\\n    '\\\\xc8': 'E',  '\\\\xc9': 'E', '\\\\xca': 'E', '\\\\xcb': 'E',\\n    '\\\\xe8': 'e',  '\\\\xe9': 'e', '\\\\xea': 'e', '\\\\xeb': 'e',\\n    '\\\\xcC': 'I',  '\\\\xcd': 'I', '\\\\xce': 'I', '\\\\xcf': 'I',\\n    '\\\\xeC': 'i',  '\\\\xed': 'i', '\\\\xee': 'i', '\\\\xef': 'i',\\n    '\\\\xd1': 'N',  '\\\\xf1': 'n',\\n    '\\\\xd2': 'O',  '\\\\xd3': 'O', '\\\\xd4': 'O', '\\\\xd5': 'O', '\\\\xd6': 'O', '\\\\xd8': 'O',\\n    '\\\\xf2': 'o',  '\\\\xf3': 'o', '\\\\xf4': 'o', '\\\\xf5': 'o', '\\\\xf6': 'o', '\\\\xf8': 'o',\\n    '\\\\xd9': 'U',  '\\\\xda': 'U', '\\\\xdb': 'U', '\\\\xdc': 'U',\\n    '\\\\xf9': 'u',  '\\\\xfa': 'u', '\\\\xfb': 'u', '\\\\xfc': 'u',\\n    '\\\\xdd': 'Y',  '\\\\xfd': 'y', '\\\\xff': 'y',\\n    '\\\\xc6': 'Ae', '\\\\xe6': 'ae',\\n    '\\\\xde': 'Th', '\\\\xfe': 'th',\\n    '\\\\xdf': 'ss'\\n  };\\n\\n  /** Used to map characters to HTML entities. */\\n  var htmlEscapes = {\\n    '&': '&amp;',\\n    '<': '&lt;',\\n    '>': '&gt;',\\n    '\\\"': '&quot;',\\n    \\\"'\\\": '&#39;',\\n    '`': '&#96;'\\n  };\\n\\n  /** Used to map HTML entities to characters. */\\n  var htmlUnescapes = {\\n    '&amp;': '&',\\n    '&lt;': '<',\\n    '&gt;': '>',\\n    '&quot;': '\\\"',\\n    '&#39;': \\\"'\\\",\\n    '&#96;': '`'\\n  };\\n\\n  /** Used to determine if values are of the language type `Object`. */\\n  var objectTypes = {\\n    'function': true,\\n    'object': true\\n  };\\n\\n  /** Used to escape characters for inclusion in compiled string literals. */\\n  var stringEscapes = {\\n    '\\\\\\\\': '\\\\\\\\',\\n    \\\"'\\\": \\\"'\\\",\\n    '\\\\n': 'n',\\n    '\\\\r': 'r',\\n    '\\\\u2028': 'u2028',\\n    '\\\\u2029': 'u2029'\\n  };\\n\\n  /** Built-in method references without a dependency on `root`. */\\n  var freeParseFloat = parseFloat,\\n      freeParseInt = parseInt;\\n\\n  /** Detect free variable `exports`. */\\n  var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)\\n    ? exports\\n    : undefined;\\n\\n  /** Detect free variable `module`. */\\n  var freeModule = (objectTypes[typeof module] && module && !module.nodeType)\\n    ? module\\n    : undefined;\\n\\n  /** Detect the popular CommonJS extension `module.exports`. */\\n  var moduleExports = (freeModule && freeModule.exports === freeExports)\\n    ? freeExports\\n    : undefined;\\n\\n  /** Detect free variable `global` from Node.js. */\\n  var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);\\n\\n  /** Detect free variable `self`. */\\n  var freeSelf = checkGlobal(objectTypes[typeof self] && self);\\n\\n  /** Detect free variable `window`. */\\n  var freeWindow = checkGlobal(objectTypes[typeof window] && window);\\n\\n  /** Detect `this` as the global object. */\\n  var thisGlobal = checkGlobal(objectTypes[typeof this] && this);\\n\\n  /**\\n   * Used as a reference to the global object.\\n   *\\n   * The `this` value is used if it's the global object to avoid Greasemonkey's\\n   * restricted `window` object, otherwise the `window` object is used.\\n   */\\n  var root = freeGlobal ||\\n    ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||\\n      freeSelf || thisGlobal || Function('return this')();\\n\\n  /*--------------------------------------------------------------------------*/\\n\\n  /**\\n   * Adds the key-value `pair` to `map`.\\n   *\\n   * @private\\n   * @param {Object} map The map to modify.\\n   * @param {Array} pair The key-value pair to add.\\n   * @returns {Object} Returns `map`.\\n   */\\n  function addMapEntry(map, pair) {\\n    // Don't return `Map#set` because it doesn't return the map instance in IE 11.\\n    map.set(pair[0], pair[1]);\\n    return map;\\n  }\\n\\n  /**\\n   * Adds `value` to `set`.\\n   *\\n   * @private\\n   * @param {Object} set The set to modify.\\n   * @param {*} value The value to add.\\n   * @returns {Object} Returns `set`.\\n   */\\n  function addSetEntry(set, value) {\\n    set.add(value);\\n    return set;\\n  }\\n\\n  /**\\n   * A faster alternative to `Function#apply`, this function invokes `func`\\n   * with the `this` binding of `thisArg` and the arguments of `args`.\\n   *\\n   * @private\\n   * @param {Function} func The function to invoke.\\n   * @param {*} thisArg The `this` binding of `func`.\\n   * @param {Array} args The arguments to invoke `func` with.\\n   * @returns {*} Returns the result of `func`.\\n   */\\n  function apply(func, thisArg, args) {\\n    var length = args.length;\\n    switch (length) {\\n      case 0: return func.call(thisArg);\\n      case 1: return func.call(thisArg, args[0]);\\n      case 2: return func.call(thisArg, args[0], args[1]);\\n      case 3: return func.call(thisArg, args[0], args[1], args[2]);\\n    }\\n    return func.apply(thisArg, args);\\n  }\\n\\n  /**\\n   * A specialized version of `baseAggregator` for arrays.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} setter The function to set `accumulator` values.\\n   * @param {Function} iteratee The iteratee to transform keys.\\n   * @param {Object} accumulator The initial aggregated object.\\n   * @returns {Function} Returns `accumulator`.\\n   */\\n  function arrayAggregator(array, setter, iteratee, accumulator) {\\n    var index = -1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      var value = array[index];\\n      setter(accumulator, value, iteratee(value), array);\\n    }\\n    return accumulator;\\n  }\\n\\n  /**\\n   * Creates a new array concatenating `array` with `other`.\\n   *\\n   * @private\\n   * @param {Array} array The first array to concatenate.\\n   * @param {Array} other The second array to concatenate.\\n   * @returns {Array} Returns the new concatenated array.\\n   */\\n  function arrayConcat(array, other) {\\n    var index = -1,\\n        length = array.length,\\n        othIndex = -1,\\n        othLength = other.length,\\n        result = Array(length + othLength);\\n\\n    while (++index < length) {\\n      result[index] = array[index];\\n    }\\n    while (++othIndex < othLength) {\\n      result[index++] = other[othIndex];\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * A specialized version of `_.forEach` for arrays without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @returns {Array} Returns `array`.\\n   */\\n  function arrayEach(array, iteratee) {\\n    var index = -1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      if (iteratee(array[index], index, array) === false) {\\n        break;\\n      }\\n    }\\n    return array;\\n  }\\n\\n  /**\\n   * A specialized version of `_.forEachRight` for arrays without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @returns {Array} Returns `array`.\\n   */\\n  function arrayEachRight(array, iteratee) {\\n    var length = array.length;\\n\\n    while (length--) {\\n      if (iteratee(array[length], length, array) === false) {\\n        break;\\n      }\\n    }\\n    return array;\\n  }\\n\\n  /**\\n   * A specialized version of `_.every` for arrays without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} predicate The function invoked per iteration.\\n   * @returns {boolean} Returns `true` if all elements pass the predicate check,\\n   *  else `false`.\\n   */\\n  function arrayEvery(array, predicate) {\\n    var index = -1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      if (!predicate(array[index], index, array)) {\\n        return false;\\n      }\\n    }\\n    return true;\\n  }\\n\\n  /**\\n   * A specialized version of `_.filter` for arrays without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} predicate The function invoked per iteration.\\n   * @returns {Array} Returns the new filtered array.\\n   */\\n  function arrayFilter(array, predicate) {\\n    var index = -1,\\n        length = array.length,\\n        resIndex = 0,\\n        result = [];\\n\\n    while (++index < length) {\\n      var value = array[index];\\n      if (predicate(value, index, array)) {\\n        result[resIndex++] = value;\\n      }\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * A specialized version of `_.includes` for arrays without support for\\n   * specifying an index to search from.\\n   *\\n   * @private\\n   * @param {Array} array The array to search.\\n   * @param {*} target The value to search for.\\n   * @returns {boolean} Returns `true` if `target` is found, else `false`.\\n   */\\n  function arrayIncludes(array, value) {\\n    return !!array.length && baseIndexOf(array, value, 0) > -1;\\n  }\\n\\n  /**\\n   * This function is like `arrayIncludes` except that it accepts a comparator.\\n   *\\n   * @private\\n   * @param {Array} array The array to search.\\n   * @param {*} target The value to search for.\\n   * @param {Function} comparator The comparator invoked per element.\\n   * @returns {boolean} Returns `true` if `target` is found, else `false`.\\n   */\\n  function arrayIncludesWith(array, value, comparator) {\\n    var index = -1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      if (comparator(value, array[index])) {\\n        return true;\\n      }\\n    }\\n    return false;\\n  }\\n\\n  /**\\n   * A specialized version of `_.map` for arrays without support for iteratee\\n   * shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @returns {Array} Returns the new mapped array.\\n   */\\n  function arrayMap(array, iteratee) {\\n    var index = -1,\\n        length = array.length,\\n        result = Array(length);\\n\\n    while (++index < length) {\\n      result[index] = iteratee(array[index], index, array);\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * Appends the elements of `values` to `array`.\\n   *\\n   * @private\\n   * @param {Array} array The array to modify.\\n   * @param {Array} values The values to append.\\n   * @returns {Array} Returns `array`.\\n   */\\n  function arrayPush(array, values) {\\n    var index = -1,\\n        length = values.length,\\n        offset = array.length;\\n\\n    while (++index < length) {\\n      array[offset + index] = values[index];\\n    }\\n    return array;\\n  }\\n\\n  /**\\n   * A specialized version of `_.reduce` for arrays without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @param {*} [accumulator] The initial value.\\n   * @param {boolean} [initAccum] Specify using the first element of `array` as\\n   *  the initial value.\\n   * @returns {*} Returns the accumulated value.\\n   */\\n  function arrayReduce(array, iteratee, accumulator, initAccum) {\\n    var index = -1,\\n        length = array.length;\\n\\n    if (initAccum && length) {\\n      accumulator = array[++index];\\n    }\\n    while (++index < length) {\\n      accumulator = iteratee(accumulator, array[index], index, array);\\n    }\\n    return accumulator;\\n  }\\n\\n  /**\\n   * A specialized version of `_.reduceRight` for arrays without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @param {*} [accumulator] The initial value.\\n   * @param {boolean} [initAccum] Specify using the last element of `array` as\\n   *  the initial value.\\n   * @returns {*} Returns the accumulated value.\\n   */\\n  function arrayReduceRight(array, iteratee, accumulator, initAccum) {\\n    var length = array.length;\\n    if (initAccum && length) {\\n      accumulator = array[--length];\\n    }\\n    while (length--) {\\n      accumulator = iteratee(accumulator, array[length], length, array);\\n    }\\n    return accumulator;\\n  }\\n\\n  /**\\n   * A specialized version of `_.some` for arrays without support for iteratee\\n   * shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} predicate The function invoked per iteration.\\n   * @returns {boolean} Returns `true` if any element passes the predicate check,\\n   *  else `false`.\\n   */\\n  function arraySome(array, predicate) {\\n    var index = -1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      if (predicate(array[index], index, array)) {\\n        return true;\\n      }\\n    }\\n    return false;\\n  }\\n\\n  /**\\n   * The base implementation of methods like `_.max` and `_.min` which accepts a\\n   * `comparator` to determine the extremum value.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The iteratee invoked per iteration.\\n   * @param {Function} comparator The comparator used to compare values.\\n   * @returns {*} Returns the extremum value.\\n   */\\n  function baseExtremum(array, iteratee, comparator) {\\n    var index = -1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      var value = array[index],\\n          current = iteratee(value);\\n\\n      if (current != null && (computed === undefined\\n            ? current === current\\n            : comparator(current, computed)\\n          )) {\\n        var computed = current,\\n            result = value;\\n      }\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * The base implementation of methods like `_.find` and `_.findKey`, without\\n   * support for iteratee shorthands, which iterates over `collection` using\\n   * `eachFunc`.\\n   *\\n   * @private\\n   * @param {Array|Object} collection The collection to search.\\n   * @param {Function} predicate The function invoked per iteration.\\n   * @param {Function} eachFunc The function to iterate over `collection`.\\n   * @param {boolean} [retKey] Specify returning the key of the found element\\n   *  instead of the element itself.\\n   * @returns {*} Returns the found element or its key, else `undefined`.\\n   */\\n  function baseFind(collection, predicate, eachFunc, retKey) {\\n    var result;\\n    eachFunc(collection, function(value, key, collection) {\\n      if (predicate(value, key, collection)) {\\n        result = retKey ? key : value;\\n        return false;\\n      }\\n    });\\n    return result;\\n  }\\n\\n  /**\\n   * The base implementation of `_.findIndex` and `_.findLastIndex` without\\n   * support for iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to search.\\n   * @param {Function} predicate The function invoked per iteration.\\n   * @param {boolean} [fromRight] Specify iterating from right to left.\\n   * @returns {number} Returns the index of the matched value, else `-1`.\\n   */\\n  function baseFindIndex(array, predicate, fromRight) {\\n    var length = array.length,\\n        index = fromRight ? length : -1;\\n\\n    while ((fromRight ? index-- : ++index < length)) {\\n      if (predicate(array[index], index, array)) {\\n        return index;\\n      }\\n    }\\n    return -1;\\n  }\\n\\n  /**\\n   * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\\n   *\\n   * @private\\n   * @param {Array} array The array to search.\\n   * @param {*} value The value to search for.\\n   * @param {number} fromIndex The index to search from.\\n   * @returns {number} Returns the index of the matched value, else `-1`.\\n   */\\n  function baseIndexOf(array, value, fromIndex) {\\n    if (value !== value) {\\n      return indexOfNaN(array, fromIndex);\\n    }\\n    var index = fromIndex - 1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      if (array[index] === value) {\\n        return index;\\n      }\\n    }\\n    return -1;\\n  }\\n\\n  /**\\n   * This function is like `baseIndexOf` except that it accepts a comparator.\\n   *\\n   * @private\\n   * @param {Array} array The array to search.\\n   * @param {*} value The value to search for.\\n   * @param {number} fromIndex The index to search from.\\n   * @param {Function} comparator The comparator invoked per element.\\n   * @returns {number} Returns the index of the matched value, else `-1`.\\n   */\\n  function baseIndexOfWith(array, value, fromIndex, comparator) {\\n    var index = fromIndex - 1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      if (comparator(array[index], value)) {\\n        return index;\\n      }\\n    }\\n    return -1;\\n  }\\n\\n  /**\\n   * The base implementation of `_.mean` and `_.meanBy` without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @returns {number} Returns the mean.\\n   */\\n  function baseMean(array, iteratee) {\\n    var length = array ? array.length : 0;\\n    return length ? (baseSum(array, iteratee) / length) : NAN;\\n  }\\n\\n  /**\\n   * The base implementation of `_.reduce` and `_.reduceRight`, without support\\n   * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\\n   *\\n   * @private\\n   * @param {Array|Object} collection The collection to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @param {*} accumulator The initial value.\\n   * @param {boolean} initAccum Specify using the first or last element of\\n   *  `collection` as the initial value.\\n   * @param {Function} eachFunc The function to iterate over `collection`.\\n   * @returns {*} Returns the accumulated value.\\n   */\\n  function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\\n    eachFunc(collection, function(value, index, collection) {\\n      accumulator = initAccum\\n        ? (initAccum = false, value)\\n        : iteratee(accumulator, value, index, collection);\\n    });\\n    return accumulator;\\n  }\\n\\n  /**\\n   * The base implementation of `_.sortBy` which uses `comparer` to define the\\n   * sort order of `array` and replaces criteria objects with their corresponding\\n   * values.\\n   *\\n   * @private\\n   * @param {Array} array The array to sort.\\n   * @param {Function} comparer The function to define sort order.\\n   * @returns {Array} Returns `array`.\\n   */\\n  function baseSortBy(array, comparer) {\\n    var length = array.length;\\n\\n    array.sort(comparer);\\n    while (length--) {\\n      array[length] = array[length].value;\\n    }\\n    return array;\\n  }\\n\\n  /**\\n   * The base implementation of `_.sum` and `_.sumBy` without support for\\n   * iteratee shorthands.\\n   *\\n   * @private\\n   * @param {Array} array The array to iterate over.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @returns {number} Returns the sum.\\n   */\\n  function baseSum(array, iteratee) {\\n    var result,\\n        index = -1,\\n        length = array.length;\\n\\n    while (++index < length) {\\n      var current = iteratee(array[index]);\\n      if (current !== undefined) {\\n        result = result === undefined ? current : (result + current);\\n      }\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * The base implementation of `_.times` without support for iteratee shorthands\\n   * or max array length checks.\\n   *\\n   * @private\\n   * @param {number} n The number of times to invoke `iteratee`.\\n   * @param {Function} iteratee The function invoked per iteration.\\n   * @returns {Array} Returns the array of results.\\n   */\\n  function baseTimes(n, iteratee) {\\n    var index = -1,\\n        result = Array(n);\\n\\n    while (++index < n) {\\n      result[index] = iteratee(index);\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array\\n   * of key-value pairs for `object` corresponding to the property names of `props`.\\n   *\\n   * @private\\n   * @param {Object} object The object to query.\\n   * @param {Array} props The property names to get values for.\\n   * @returns {Object} Returns the new array of key-value pairs.\\n   */\\n  function baseToPairs(object, props) {\\n    return arrayMap(props, function(key) {\\n      return [key, object[key]];\\n    });\\n  }\\n\\n  /**\\n   * The base implementation of `_.unary` without support for storing wrapper metadata.\\n   *\\n   * @private\\n   * @param {Function} func The function to cap arguments for.\\n   * @returns {Function} Returns the new function.\\n   */\\n  function baseUnary(func) {\\n    return function(value) {\\n      return func(value);\\n    };\\n  }\\n\\n  /**\\n   * The base implementation of `_.values` and `_.valuesIn` which creates an\\n   * array of `object` property values corresponding to the property names\\n   * of `props`.\\n   *\\n   * @private\\n   * @param {Object} object The object to query.\\n   * @param {Array} props The property names to get values for.\\n   * @returns {Object} Returns the array of property values.\\n   */\\n  function baseValues(object, props) {\\n    return arrayMap(props, function(key) {\\n      return object[key];\\n    });\\n  }\\n\\n  /**\\n   * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\\n   * that is not found in the character symbols.\\n   *\\n   * @private\\n   * @param {Array} strSymbols The string symbols to inspect.\\n   * @param {Array} chrSymbols The character symbols to find.\\n   * @returns {number} Returns the index of the first unmatched string symbol.\\n   */\\n  function charsStartIndex(strSymbols, chrSymbols) {\\n    var index = -1,\\n        length = strSymbols.length;\\n\\n    while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\\n    return index;\\n  }\\n\\n  /**\\n   * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\\n   * that is not found in the character symbols.\\n   *\\n   * @private\\n   * @param {Array} strSymbols The string symbols to inspect.\\n   * @param {Array} chrSymbols The character symbols to find.\\n   * @returns {number} Returns the index of the last unmatched string symbol.\\n   */\\n  function charsEndIndex(strSymbols, chrSymbols) {\\n    var index = strSymbols.length;\\n\\n    while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\\n    return index;\\n  }\\n\\n  /**\\n   * Checks if `value` is a global object.\\n   *\\n   * @private\\n   * @param {*} value The value to check.\\n   * @returns {null|Object} Returns `value` if it's a global object, else `null`.\\n   */\\n  function checkGlobal(value) {\\n    return (value && value.Object === Object) ? value : null;\\n  }\\n\\n  /**\\n   * Compares values to sort them in ascending order.\\n   *\\n   * @private\\n   * @param {*} value The value to compare.\\n   * @param {*} other The other value to compare.\\n   * @returns {number} Returns the sort order indicator for `value`.\\n   */\\n  function compareAscending(value, other) {\\n    if (value !== other) {\\n      var valIsNull = value === null,\\n          valIsUndef = value === undefined,\\n          valIsReflexive = value === value;\\n\\n      var othIsNull = other === null,\\n          othIsUndef = other === undefined,\\n          othIsReflexive = other === other;\\n\\n      if ((value > other && !othIsNull) || !valIsReflexive ||\\n          (valIsNull && !othIsUndef && othIsReflexive) ||\\n          (valIsUndef && othIsReflexive)) {\\n        return 1;\\n      }\\n      if ((value < other && !valIsNull) || !othIsReflexive ||\\n          (othIsNull && !valIsUndef && valIsReflexive) ||\\n          (othIsUndef && valIsReflexive)) {\\n        return -1;\\n      }\\n    }\\n    return 0;\\n  }\\n\\n  /**\\n   * Used by `_.orderBy` to compare multiple properties of a value to another\\n   * and stable sort them.\\n   *\\n   * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\\n   * specify an order of \\\"desc\\\" for descending or \\\"asc\\\" for ascending sort order\\n   * of corresponding values.\\n   *\\n   * @private\\n   * @param {Object} object The object to compare.\\n   * @param {Object} other The other object to compare.\\n   * @param {boolean[]|string[]} orders The order to sort by for each property.\\n   * @returns {number} Returns the sort order indicator for `object`.\\n   */\\n  function compareMultiple(object, other, orders) {\\n    var index = -1,\\n        objCriteria = object.criteria,\\n        othCriteria = other.criteria,\\n        length = objCriteria.length,\\n        ordersLength = orders.length;\\n\\n    while (++index < length) {\\n      var result = compareAscending(objCriteria[index], othCriteria[index]);\\n      if (result) {\\n        if (index >= ordersLength) {\\n          return result;\\n        }\\n        var order = orders[index];\\n        return result * (order == 'desc' ? -1 : 1);\\n      }\\n    }\\n    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\\n    // that causes it, under certain circumstances, to provide the same value for\\n    // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\\n    // for more details.\\n    //\\n    // This also ensures a stable sort in V8 and other engines.\\n    // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\\n    return object.index - other.index;\\n  }\\n\\n  /**\\n   * Gets the number of `placeholder` occurrences in `array`.\\n   *\\n   * @private\\n   * @param {Array} array The array to inspect.\\n   * @param {*} placeholder The placeholder to search for.\\n   * @returns {number} Returns the placeholder count.\\n   */\\n  function countHolders(array, placeholder) {\\n    var length = array.length,\\n        result = 0;\\n\\n    while (length--) {\\n      if (array[length] === placeholder) {\\n        result++;\\n      }\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * Creates a function that performs a mathematical operation on two values.\\n   *\\n   * @private\\n   * @param {Function} operator The function to perform the operation.\\n   * @returns {Function} Returns the new mathematical operation function.\\n   */\\n  function createMathOperation(operator) {\\n    return function(value, other) {\\n      var result;\\n      if (value === undefined && other === undefined) {\\n        return 0;\\n      }\\n      if (value !== undefined) {\\n        result = value;\\n      }\\n      if (other !== undefined) {\\n        result = result === undefined ? other : operator(result, other);\\n      }\\n      return result;\\n    };\\n  }\\n\\n  /**\\n   * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.\\n   *\\n   * @private\\n   * @param {string} letter The matched letter to deburr.\\n   * @returns {string} Returns the deburred letter.\\n   */\\n  function deburrLetter(letter) {\\n    return deburredLetters[letter];\\n  }\\n\\n  /**\\n   * Used by `_.escape` to convert characters to HTML entities.\\n   *\\n   * @private\\n   * @param {string} chr The matched character to escape.\\n   * @returns {string} Returns the escaped character.\\n   */\\n  function escapeHtmlChar(chr) {\\n    return htmlEscapes[chr];\\n  }\\n\\n  /**\\n   * Used by `_.template` to escape characters for inclusion in compiled string literals.\\n   *\\n   * @private\\n   * @param {string} chr The matched character to escape.\\n   * @returns {string} Returns the escaped character.\\n   */\\n  function escapeStringChar(chr) {\\n    return '\\\\\\\\' + stringEscapes[chr];\\n  }\\n\\n  /**\\n   * Gets the index at which the first occurrence of `NaN` is found in `array`.\\n   *\\n   * @private\\n   * @param {Array} array The array to search.\\n   * @param {number} fromIndex The index to search from.\\n   * @param {boolean} [fromRight] Specify iterating from right to left.\\n   * @returns {number} Returns the index of the matched `NaN`, else `-1`.\\n   */\\n  function indexOfNaN(array, fromIndex, fromRight) {\\n    var length = array.length,\\n        index = fromIndex + (fromRight ? 0 : -1);\\n\\n    while ((fromRight ? index-- : ++index < length)) {\\n      var other = array[index];\\n      if (other !== other) {\\n        return index;\\n      }\\n    }\\n    return -1;\\n  }\\n\\n  /**\\n   * Checks if `value` is a host object in IE < 9.\\n   *\\n   * @private\\n   * @param {*} value The value to check.\\n   * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\\n   */\\n  function isHostObject(value) {\\n    // Many host objects are `Object` objects that can coerce to strings\\n    // despite having improperly defined `toString` methods.\\n    var result = false;\\n    if (value != null && typeof value.toString != 'function') {\\n      try {\\n        result = !!(value + '');\\n      } catch (e) {}\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * Checks if `value` is a valid array-like index.\\n   *\\n   * @private\\n   * @param {*} value The value to check.\\n   * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\\n   * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\\n   */\\n  function isIndex(value, length) {\\n    value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\\n    length = length == null ? MAX_SAFE_INTEGER : length;\\n    return value > -1 && value % 1 == 0 && value < length;\\n  }\\n\\n  /**\\n   * Converts `iterator` to an array.\\n   *\\n   * @private\\n   * @param {Object} iterator The iterator to convert.\\n   * @returns {Array} Returns the converted array.\\n   */\\n  function iteratorToArray(iterator) {\\n    var data,\\n        result = [];\\n\\n    while (!(data = iterator.next()).done) {\\n      result.push(data.value);\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * Converts `map` to an array.\\n   *\\n   * @private\\n   * @param {Object} map The map to convert.\\n   * @returns {Array} Returns the converted array.\\n   */\\n  function mapToArray(map) {\\n    var index = -1,\\n        result = Array(map.size);\\n\\n    map.forEach(function(value, key) {\\n      result[++index] = [key, value];\\n    });\\n    return result;\\n  }\\n\\n  /**\\n   * Replaces all `placeholder` elements in `array` with an internal placeholder\\n   * and returns an array of their indexes.\\n   *\\n   * @private\\n   * @param {Array} array The array to modify.\\n   * @param {*} placeholder The placeholder to replace.\\n   * @returns {Array} Returns the new array of placeholder indexes.\\n   */\\n  function replaceHolders(array, placeholder) {\\n    var index = -1,\\n        length = array.length,\\n        resIndex = 0,\\n        result = [];\\n\\n    while (++index < length) {\\n      var value = array[index];\\n      if (value === placeholder || value === PLACEHOLDER) {\\n        array[index] = PLACEHOLDER;\\n        result[resIndex++] = index;\\n      }\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * Converts `set` to an array.\\n   *\\n   * @private\\n   * @param {Object} set The set to convert.\\n   * @returns {Array} Returns the converted array.\\n   */\\n  function setToArray(set) {\\n    var index = -1,\\n        result = Array(set.size);\\n\\n    set.forEach(function(value) {\\n      result[++index] = value;\\n    });\\n    return result;\\n  }\\n\\n  /**\\n   * Gets the number of symbols in `string`.\\n   *\\n   * @private\\n   * @param {string} string The string to inspect.\\n   * @returns {number} Returns the string size.\\n   */\\n  function stringSize(string) {\\n    if (!(string && reHasComplexSymbol.test(string))) {\\n      return string.length;\\n    }\\n    var result = reComplexSymbol.lastIndex = 0;\\n    while (reComplexSymbol.test(string)) {\\n      result++;\\n    }\\n    return result;\\n  }\\n\\n  /**\\n   * Converts `string` to an array.\\n   *\\n   * @private\\n   * @param {string} string The string to convert.\\n   * @returns {Array} Returns the converted array.\\n   */\\n  function stringToArray(string) {\\n    return string.match(reComplexSymbol);\\n  }\\n\\n  /**\\n   * Used by `_.unescape` to convert HTML entities to characters.\\n   *\\n   * @private\\n   * @param {string} chr The matched character to unescape.\\n   * @returns {string} Returns the unescaped character.\\n   */\\n  function unescapeHtmlChar(chr) {\\n    return htmlUnescapes[chr];\\n  }\\n\\n  /*--------------------------------------------------------------------------*/\\n\\n  /**\\n   * Create a new pristine `lodash` function using the `context` object.\\n   *\\n   * @static\\n   * @memberOf _\\n   * @since 1.1.0\\n   * @category Util\\n   * @param {Object} [context=root] The context object.\\n   * @returns {Function} Returns a new `lodash` function.\\n   * @example\\n   *\\n   * _.mixin({ 'foo': _.constant('foo') });\\n   *\\n   * var lodash = _.runInContext();\\n   * lodash.mixin({ 'bar': lodash.constant('bar') });\\n   *\\n   * _.isFunction(_.foo);\\n   * // => true\\n   * _.isFunction(_.bar);\\n   * // => false\\n   *\\n   * lodash.isFunction(lodash.foo);\\n   * // => false\\n   * lodash.isFunction(lodash.bar);\\n   * // => true\\n   *\\n   * // Use `context` to mock `Date#getTime` use in `_.now`.\\n   * var mock = _.runInContext({\\n   *   'Date': function() {\\n   *     return { 'getTime': getTimeMock };\\n   *   }\\n   * });\\n   *\\n   * // Create a suped-up `defer` in Node.js.\\n   * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\\n   */\\n  function runInContext(context) {\\n    context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root;\\n\\n    /** Built-in constructor references. */\\n    var Date = context.Date,\\n        Error = context.Error,\\n        Math = context.Math,\\n        RegExp = context.RegExp,\\n        TypeError = context.TypeError;\\n\\n    /** Used for built-in method references. */\\n    var arrayProto = context.Array.prototype,\\n        objectProto = context.Object.prototype,\\n        stringProto = context.String.prototype;\\n\\n    /** Used to resolve the decompiled source of functions. */\\n    var funcToString = context.Function.prototype.toString;\\n\\n    /** Used to check objects for own properties. */\\n    var hasOwnProperty = objectProto.hasOwnProperty;\\n\\n    /** Used to generate unique IDs. */\\n    var idCounter = 0;\\n\\n    /** Used to infer the `Object` constructor. */\\n    var objectCtorString = funcToString.call(Object);\\n\\n    /**\\n     * Used to resolve the\\n     * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\\n     * of values.\\n     */\\n    var objectToString = objectProto.toString;\\n\\n    /** Used to restore the original `_` reference in `_.noConflict`. */\\n    var oldDash = root._;\\n\\n    /** Used to detect if a method is native. */\\n    var reIsNative = RegExp('^' +\\n      funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\\\\\$&')\\n      .replace(/hasOwnProperty|(function).*?(?=\\\\\\\\\\\\()| for .+?(?=\\\\\\\\\\\\])/g, '$1.*?') + '$'\\n    );\\n\\n    /** Built-in value references. */\\n    var Buffer = moduleExports ? context.Buffer : undefined,\\n        Reflect = context.Reflect,\\n        Symbol = context.Symbol,\\n        Uint8Array = context.Uint8Array,\\n        clearTimeout = context.clearTimeout,\\n        enumerate = Reflect ? Reflect.enumerate : undefined,\\n        getOwnPropertySymbols = Object.getOwnPropertySymbols,\\n        iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,\\n        objectCreate = Object.create,\\n        propertyIsEnumerable = objectProto.propertyIsEnumerable,\\n        setTimeout = context.setTimeout,\\n        splice = arrayProto.splice;\\n\\n    /* Built-in method references for those with the same name as other `lodash` methods. */\\n    var nativeCeil = Math.ceil,\\n        nativeFloor = Math.floor,\\n        nativeGetPrototype = Object.getPrototypeOf,\\n        nativeIsFinite = context.isFinite,\\n        nativeJoin = arrayProto.join,\\n        nativeKeys = Object.keys,\\n        nativeMax = Math.max,\\n        nativeMin = Math.min,\\n        nativeParseInt = context.parseInt,\\n        nativeRandom = Math.random,\\n        nativeReplace = stringProto.replace,\\n        nativeReverse = arrayProto.reverse,\\n        nativeSplit = stringProto.split;\\n\\n    /* Built-in method references that are verified to be native. */\\n    var DataView = getNative(context, 'DataView'),\\n        Map = getNative(context, 'Map'),\\n        Promise = getNative(context, 'Promise'),\\n        Set = getNative(context, 'Set'),\\n        WeakMap = getNative(context, 'WeakMap'),\\n        nativeCreate = getNative(Object, 'create');\\n\\n    /** Used to store function metadata. */\\n    var metaMap = WeakMap && new WeakMap;\\n\\n    /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */\\n    var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');\\n\\n    /** Used to lookup unminified function names. */\\n    var realNames = {};\\n\\n    /** Used to detect maps, sets, and weakmaps. */\\n    var dataViewCtorString = toSource(DataView),\\n        mapCtorString = toSource(Map),\\n        promiseCtorString = toSource(Promise),\\n        setCtorString = toSource(Set),\\n        weakMapCtorString = toSource(WeakMap);\\n\\n    /** Used to convert symbols to primitives and strings. */\\n    var symbolProto = Symbol ? Symbol.prototype : undefined,\\n        symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,\\n        symbolToString = symbolProto ? symbolProto.toString : undefined;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates a `lodash` object which wraps `value` to enable implicit method\\n     * chain sequences. Methods that operate on and return arrays, collections,\\n     * and functions can be chained together. Methods that retrieve a single value\\n     * or may return a primitive value will automatically end the chain sequence\\n     * and return the unwrapped value. Otherwise, the value must be unwrapped\\n     * with `_#value`.\\n     *\\n     * Explicit chain sequences, which must be unwrapped with `_#value`, may be\\n     * enabled using `_.chain`.\\n     *\\n     * The execution of chained methods is lazy, that is, it's deferred until\\n     * `_#value` is implicitly or explicitly called.\\n     *\\n     * Lazy evaluation allows several methods to support shortcut fusion.\\n     * Shortcut fusion is an optimization to merge iteratee calls; this avoids\\n     * the creation of intermediate arrays and can greatly reduce the number of\\n     * iteratee executions. Sections of a chain sequence qualify for shortcut\\n     * fusion if the section is applied to an array of at least `200` elements\\n     * and any iteratees accept only one argument. The heuristic for whether a\\n     * section qualifies for shortcut fusion is subject to change.\\n     *\\n     * Chaining is supported in custom builds as long as the `_#value` method is\\n     * directly or indirectly included in the build.\\n     *\\n     * In addition to lodash methods, wrappers have `Array` and `String` methods.\\n     *\\n     * The wrapper `Array` methods are:\\n     * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`\\n     *\\n     * The wrapper `String` methods are:\\n     * `replace` and `split`\\n     *\\n     * The wrapper methods that support shortcut fusion are:\\n     * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,\\n     * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,\\n     * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`\\n     *\\n     * The chainable wrapper methods are:\\n     * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,\\n     * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,\\n     * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,\\n     * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,\\n     * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,\\n     * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,\\n     * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,\\n     * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,\\n     * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,\\n     * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,\\n     * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,\\n     * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,\\n     * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,\\n     * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,\\n     * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,\\n     * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,\\n     * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,\\n     * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,\\n     * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,\\n     * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,\\n     * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,\\n     * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,\\n     * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,\\n     * `zipObject`, `zipObjectDeep`, and `zipWith`\\n     *\\n     * The wrapper methods that are **not** chainable by default are:\\n     * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,\\n     * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`,\\n     * `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`,\\n     * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`,\\n     * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,\\n     * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`,\\n     * `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`,\\n     * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`,\\n     * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,\\n     * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`,\\n     * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,\\n     * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,\\n     * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,\\n     * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,\\n     * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,\\n     * `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`,\\n     * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,\\n     * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,\\n     * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,\\n     * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`,\\n     * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`,\\n     * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,\\n     * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words`\\n     *\\n     * @name _\\n     * @constructor\\n     * @category Seq\\n     * @param {*} value The value to wrap in a `lodash` instance.\\n     * @returns {Object} Returns the new `lodash` wrapper instance.\\n     * @example\\n     *\\n     * function square(n) {\\n     *   return n * n;\\n     * }\\n     *\\n     * var wrapped = _([1, 2, 3]);\\n     *\\n     * // Returns an unwrapped value.\\n     * wrapped.reduce(_.add);\\n     * // => 6\\n     *\\n     * // Returns a wrapped value.\\n     * var squares = wrapped.map(square);\\n     *\\n     * _.isArray(squares);\\n     * // => false\\n     *\\n     * _.isArray(squares.value());\\n     * // => true\\n     */\\n    function lodash(value) {\\n      if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\\n        if (value instanceof LodashWrapper) {\\n          return value;\\n        }\\n        if (hasOwnProperty.call(value, '__wrapped__')) {\\n          return wrapperClone(value);\\n        }\\n      }\\n      return new LodashWrapper(value);\\n    }\\n\\n    /**\\n     * The function whose prototype chain sequence wrappers inherit from.\\n     *\\n     * @private\\n     */\\n    function baseLodash() {\\n      // No operation performed.\\n    }\\n\\n    /**\\n     * The base constructor for creating `lodash` wrapper objects.\\n     *\\n     * @private\\n     * @param {*} value The value to wrap.\\n     * @param {boolean} [chainAll] Enable explicit method chain sequences.\\n     */\\n    function LodashWrapper(value, chainAll) {\\n      this.__wrapped__ = value;\\n      this.__actions__ = [];\\n      this.__chain__ = !!chainAll;\\n      this.__index__ = 0;\\n      this.__values__ = undefined;\\n    }\\n\\n    /**\\n     * By default, the template delimiters used by lodash are like those in\\n     * embedded Ruby (ERB). Change the following template settings to use\\n     * alternative delimiters.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @type {Object}\\n     */\\n    lodash.templateSettings = {\\n\\n      /**\\n       * Used to detect `data` property values to be HTML-escaped.\\n       *\\n       * @memberOf _.templateSettings\\n       * @type {RegExp}\\n       */\\n      'escape': reEscape,\\n\\n      /**\\n       * Used to detect code to be evaluated.\\n       *\\n       * @memberOf _.templateSettings\\n       * @type {RegExp}\\n       */\\n      'evaluate': reEvaluate,\\n\\n      /**\\n       * Used to detect `data` property values to inject.\\n       *\\n       * @memberOf _.templateSettings\\n       * @type {RegExp}\\n       */\\n      'interpolate': reInterpolate,\\n\\n      /**\\n       * Used to reference the data object in the template text.\\n       *\\n       * @memberOf _.templateSettings\\n       * @type {string}\\n       */\\n      'variable': '',\\n\\n      /**\\n       * Used to import variables into the compiled template.\\n       *\\n       * @memberOf _.templateSettings\\n       * @type {Object}\\n       */\\n      'imports': {\\n\\n        /**\\n         * A reference to the `lodash` function.\\n         *\\n         * @memberOf _.templateSettings.imports\\n         * @type {Function}\\n         */\\n        '_': lodash\\n      }\\n    };\\n\\n    // Ensure wrappers are instances of `baseLodash`.\\n    lodash.prototype = baseLodash.prototype;\\n    lodash.prototype.constructor = lodash;\\n\\n    LodashWrapper.prototype = baseCreate(baseLodash.prototype);\\n    LodashWrapper.prototype.constructor = LodashWrapper;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\\n     *\\n     * @private\\n     * @constructor\\n     * @param {*} value The value to wrap.\\n     */\\n    function LazyWrapper(value) {\\n      this.__wrapped__ = value;\\n      this.__actions__ = [];\\n      this.__dir__ = 1;\\n      this.__filtered__ = false;\\n      this.__iteratees__ = [];\\n      this.__takeCount__ = MAX_ARRAY_LENGTH;\\n      this.__views__ = [];\\n    }\\n\\n    /**\\n     * Creates a clone of the lazy wrapper object.\\n     *\\n     * @private\\n     * @name clone\\n     * @memberOf LazyWrapper\\n     * @returns {Object} Returns the cloned `LazyWrapper` object.\\n     */\\n    function lazyClone() {\\n      var result = new LazyWrapper(this.__wrapped__);\\n      result.__actions__ = copyArray(this.__actions__);\\n      result.__dir__ = this.__dir__;\\n      result.__filtered__ = this.__filtered__;\\n      result.__iteratees__ = copyArray(this.__iteratees__);\\n      result.__takeCount__ = this.__takeCount__;\\n      result.__views__ = copyArray(this.__views__);\\n      return result;\\n    }\\n\\n    /**\\n     * Reverses the direction of lazy iteration.\\n     *\\n     * @private\\n     * @name reverse\\n     * @memberOf LazyWrapper\\n     * @returns {Object} Returns the new reversed `LazyWrapper` object.\\n     */\\n    function lazyReverse() {\\n      if (this.__filtered__) {\\n        var result = new LazyWrapper(this);\\n        result.__dir__ = -1;\\n        result.__filtered__ = true;\\n      } else {\\n        result = this.clone();\\n        result.__dir__ *= -1;\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Extracts the unwrapped value from its lazy wrapper.\\n     *\\n     * @private\\n     * @name value\\n     * @memberOf LazyWrapper\\n     * @returns {*} Returns the unwrapped value.\\n     */\\n    function lazyValue() {\\n      var array = this.__wrapped__.value(),\\n          dir = this.__dir__,\\n          isArr = isArray(array),\\n          isRight = dir < 0,\\n          arrLength = isArr ? array.length : 0,\\n          view = getView(0, arrLength, this.__views__),\\n          start = view.start,\\n          end = view.end,\\n          length = end - start,\\n          index = isRight ? end : (start - 1),\\n          iteratees = this.__iteratees__,\\n          iterLength = iteratees.length,\\n          resIndex = 0,\\n          takeCount = nativeMin(length, this.__takeCount__);\\n\\n      if (!isArr || arrLength < LARGE_ARRAY_SIZE ||\\n          (arrLength == length && takeCount == length)) {\\n        return baseWrapperValue(array, this.__actions__);\\n      }\\n      var result = [];\\n\\n      outer:\\n      while (length-- && resIndex < takeCount) {\\n        index += dir;\\n\\n        var iterIndex = -1,\\n            value = array[index];\\n\\n        while (++iterIndex < iterLength) {\\n          var data = iteratees[iterIndex],\\n              iteratee = data.iteratee,\\n              type = data.type,\\n              computed = iteratee(value);\\n\\n          if (type == LAZY_MAP_FLAG) {\\n            value = computed;\\n          } else if (!computed) {\\n            if (type == LAZY_FILTER_FLAG) {\\n              continue outer;\\n            } else {\\n              break outer;\\n            }\\n          }\\n        }\\n        result[resIndex++] = value;\\n      }\\n      return result;\\n    }\\n\\n    // Ensure `LazyWrapper` is an instance of `baseLodash`.\\n    LazyWrapper.prototype = baseCreate(baseLodash.prototype);\\n    LazyWrapper.prototype.constructor = LazyWrapper;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates a hash object.\\n     *\\n     * @private\\n     * @constructor\\n     * @returns {Object} Returns the new hash object.\\n     */\\n    function Hash() {}\\n\\n    /**\\n     * Removes `key` and its value from the hash.\\n     *\\n     * @private\\n     * @param {Object} hash The hash to modify.\\n     * @param {string} key The key of the value to remove.\\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\\n     */\\n    function hashDelete(hash, key) {\\n      return hashHas(hash, key) && delete hash[key];\\n    }\\n\\n    /**\\n     * Gets the hash value for `key`.\\n     *\\n     * @private\\n     * @param {Object} hash The hash to query.\\n     * @param {string} key The key of the value to get.\\n     * @returns {*} Returns the entry value.\\n     */\\n    function hashGet(hash, key) {\\n      if (nativeCreate) {\\n        var result = hash[key];\\n        return result === HASH_UNDEFINED ? undefined : result;\\n      }\\n      return hasOwnProperty.call(hash, key) ? hash[key] : undefined;\\n    }\\n\\n    /**\\n     * Checks if a hash value for `key` exists.\\n     *\\n     * @private\\n     * @param {Object} hash The hash to query.\\n     * @param {string} key The key of the entry to check.\\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\\n     */\\n    function hashHas(hash, key) {\\n      return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key);\\n    }\\n\\n    /**\\n     * Sets the hash `key` to `value`.\\n     *\\n     * @private\\n     * @param {Object} hash The hash to modify.\\n     * @param {string} key The key of the value to set.\\n     * @param {*} value The value to set.\\n     */\\n    function hashSet(hash, key, value) {\\n      hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\\n    }\\n\\n    // Avoid inheriting from `Object.prototype` when possible.\\n    Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates a map cache object to store key-value pairs.\\n     *\\n     * @private\\n     * @constructor\\n     * @param {Array} [values] The values to cache.\\n     */\\n    function MapCache(values) {\\n      var index = -1,\\n          length = values ? values.length : 0;\\n\\n      this.clear();\\n      while (++index < length) {\\n        var entry = values[index];\\n        this.set(entry[0], entry[1]);\\n      }\\n    }\\n\\n    /**\\n     * Removes all key-value entries from the map.\\n     *\\n     * @private\\n     * @name clear\\n     * @memberOf MapCache\\n     */\\n    function mapClear() {\\n      this.__data__ = {\\n        'hash': new Hash,\\n        'map': Map ? new Map : [],\\n        'string': new Hash\\n      };\\n    }\\n\\n    /**\\n     * Removes `key` and its value from the map.\\n     *\\n     * @private\\n     * @name delete\\n     * @memberOf MapCache\\n     * @param {string} key The key of the value to remove.\\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\\n     */\\n    function mapDelete(key) {\\n      var data = this.__data__;\\n      if (isKeyable(key)) {\\n        return hashDelete(typeof key == 'string' ? data.string : data.hash, key);\\n      }\\n      return Map ? data.map['delete'](key) : assocDelete(data.map, key);\\n    }\\n\\n    /**\\n     * Gets the map value for `key`.\\n     *\\n     * @private\\n     * @name get\\n     * @memberOf MapCache\\n     * @param {string} key The key of the value to get.\\n     * @returns {*} Returns the entry value.\\n     */\\n    function mapGet(key) {\\n      var data = this.__data__;\\n      if (isKeyable(key)) {\\n        return hashGet(typeof key == 'string' ? data.string : data.hash, key);\\n      }\\n      return Map ? data.map.get(key) : assocGet(data.map, key);\\n    }\\n\\n    /**\\n     * Checks if a map value for `key` exists.\\n     *\\n     * @private\\n     * @name has\\n     * @memberOf MapCache\\n     * @param {string} key The key of the entry to check.\\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\\n     */\\n    function mapHas(key) {\\n      var data = this.__data__;\\n      if (isKeyable(key)) {\\n        return hashHas(typeof key == 'string' ? data.string : data.hash, key);\\n      }\\n      return Map ? data.map.has(key) : assocHas(data.map, key);\\n    }\\n\\n    /**\\n     * Sets the map `key` to `value`.\\n     *\\n     * @private\\n     * @name set\\n     * @memberOf MapCache\\n     * @param {string} key The key of the value to set.\\n     * @param {*} value The value to set.\\n     * @returns {Object} Returns the map cache instance.\\n     */\\n    function mapSet(key, value) {\\n      var data = this.__data__;\\n      if (isKeyable(key)) {\\n        hashSet(typeof key == 'string' ? data.string : data.hash, key, value);\\n      } else if (Map) {\\n        data.map.set(key, value);\\n      } else {\\n        assocSet(data.map, key, value);\\n      }\\n      return this;\\n    }\\n\\n    // Add methods to `MapCache`.\\n    MapCache.prototype.clear = mapClear;\\n    MapCache.prototype['delete'] = mapDelete;\\n    MapCache.prototype.get = mapGet;\\n    MapCache.prototype.has = mapHas;\\n    MapCache.prototype.set = mapSet;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     *\\n     * Creates a set cache object to store unique values.\\n     *\\n     * @private\\n     * @constructor\\n     * @param {Array} [values] The values to cache.\\n     */\\n    function SetCache(values) {\\n      var index = -1,\\n          length = values ? values.length : 0;\\n\\n      this.__data__ = new MapCache;\\n      while (++index < length) {\\n        this.push(values[index]);\\n      }\\n    }\\n\\n    /**\\n     * Checks if `value` is in `cache`.\\n     *\\n     * @private\\n     * @param {Object} cache The set cache to search.\\n     * @param {*} value The value to search for.\\n     * @returns {number} Returns `true` if `value` is found, else `false`.\\n     */\\n    function cacheHas(cache, value) {\\n      var map = cache.__data__;\\n      if (isKeyable(value)) {\\n        var data = map.__data__,\\n            hash = typeof value == 'string' ? data.string : data.hash;\\n\\n        return hash[value] === HASH_UNDEFINED;\\n      }\\n      return map.has(value);\\n    }\\n\\n    /**\\n     * Adds `value` to the set cache.\\n     *\\n     * @private\\n     * @name push\\n     * @memberOf SetCache\\n     * @param {*} value The value to cache.\\n     */\\n    function cachePush(value) {\\n      var map = this.__data__;\\n      if (isKeyable(value)) {\\n        var data = map.__data__,\\n            hash = typeof value == 'string' ? data.string : data.hash;\\n\\n        hash[value] = HASH_UNDEFINED;\\n      }\\n      else {\\n        map.set(value, HASH_UNDEFINED);\\n      }\\n    }\\n\\n    // Add methods to `SetCache`.\\n    SetCache.prototype.push = cachePush;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates a stack cache object to store key-value pairs.\\n     *\\n     * @private\\n     * @constructor\\n     * @param {Array} [values] The values to cache.\\n     */\\n    function Stack(values) {\\n      var index = -1,\\n          length = values ? values.length : 0;\\n\\n      this.clear();\\n      while (++index < length) {\\n        var entry = values[index];\\n        this.set(entry[0], entry[1]);\\n      }\\n    }\\n\\n    /**\\n     * Removes all key-value entries from the stack.\\n     *\\n     * @private\\n     * @name clear\\n     * @memberOf Stack\\n     */\\n    function stackClear() {\\n      this.__data__ = { 'array': [], 'map': null };\\n    }\\n\\n    /**\\n     * Removes `key` and its value from the stack.\\n     *\\n     * @private\\n     * @name delete\\n     * @memberOf Stack\\n     * @param {string} key The key of the value to remove.\\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\\n     */\\n    function stackDelete(key) {\\n      var data = this.__data__,\\n          array = data.array;\\n\\n      return array ? assocDelete(array, key) : data.map['delete'](key);\\n    }\\n\\n    /**\\n     * Gets the stack value for `key`.\\n     *\\n     * @private\\n     * @name get\\n     * @memberOf Stack\\n     * @param {string} key The key of the value to get.\\n     * @returns {*} Returns the entry value.\\n     */\\n    function stackGet(key) {\\n      var data = this.__data__,\\n          array = data.array;\\n\\n      return array ? assocGet(array, key) : data.map.get(key);\\n    }\\n\\n    /**\\n     * Checks if a stack value for `key` exists.\\n     *\\n     * @private\\n     * @name has\\n     * @memberOf Stack\\n     * @param {string} key The key of the entry to check.\\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\\n     */\\n    function stackHas(key) {\\n      var data = this.__data__,\\n          array = data.array;\\n\\n      return array ? assocHas(array, key) : data.map.has(key);\\n    }\\n\\n    /**\\n     * Sets the stack `key` to `value`.\\n     *\\n     * @private\\n     * @name set\\n     * @memberOf Stack\\n     * @param {string} key The key of the value to set.\\n     * @param {*} value The value to set.\\n     * @returns {Object} Returns the stack cache instance.\\n     */\\n    function stackSet(key, value) {\\n      var data = this.__data__,\\n          array = data.array;\\n\\n      if (array) {\\n        if (array.length < (LARGE_ARRAY_SIZE - 1)) {\\n          assocSet(array, key, value);\\n        } else {\\n          data.array = null;\\n          data.map = new MapCache(array);\\n        }\\n      }\\n      var map = data.map;\\n      if (map) {\\n        map.set(key, value);\\n      }\\n      return this;\\n    }\\n\\n    // Add methods to `Stack`.\\n    Stack.prototype.clear = stackClear;\\n    Stack.prototype['delete'] = stackDelete;\\n    Stack.prototype.get = stackGet;\\n    Stack.prototype.has = stackHas;\\n    Stack.prototype.set = stackSet;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Removes `key` and its value from the associative array.\\n     *\\n     * @private\\n     * @param {Array} array The array to modify.\\n     * @param {string} key The key of the value to remove.\\n     * @returns {boolean} Returns `true` if the entry was removed, else `false`.\\n     */\\n    function assocDelete(array, key) {\\n      var index = assocIndexOf(array, key);\\n      if (index < 0) {\\n        return false;\\n      }\\n      var lastIndex = array.length - 1;\\n      if (index == lastIndex) {\\n        array.pop();\\n      } else {\\n        splice.call(array, index, 1);\\n      }\\n      return true;\\n    }\\n\\n    /**\\n     * Gets the associative array value for `key`.\\n     *\\n     * @private\\n     * @param {Array} array The array to query.\\n     * @param {string} key The key of the value to get.\\n     * @returns {*} Returns the entry value.\\n     */\\n    function assocGet(array, key) {\\n      var index = assocIndexOf(array, key);\\n      return index < 0 ? undefined : array[index][1];\\n    }\\n\\n    /**\\n     * Checks if an associative array value for `key` exists.\\n     *\\n     * @private\\n     * @param {Array} array The array to query.\\n     * @param {string} key The key of the entry to check.\\n     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\\n     */\\n    function assocHas(array, key) {\\n      return assocIndexOf(array, key) > -1;\\n    }\\n\\n    /**\\n     * Gets the index at which the `key` is found in `array` of key-value pairs.\\n     *\\n     * @private\\n     * @param {Array} array The array to search.\\n     * @param {*} key The key to search for.\\n     * @returns {number} Returns the index of the matched value, else `-1`.\\n     */\\n    function assocIndexOf(array, key) {\\n      var length = array.length;\\n      while (length--) {\\n        if (eq(array[length][0], key)) {\\n          return length;\\n        }\\n      }\\n      return -1;\\n    }\\n\\n    /**\\n     * Sets the associative array `key` to `value`.\\n     *\\n     * @private\\n     * @param {Array} array The array to modify.\\n     * @param {string} key The key of the value to set.\\n     * @param {*} value The value to set.\\n     */\\n    function assocSet(array, key, value) {\\n      var index = assocIndexOf(array, key);\\n      if (index < 0) {\\n        array.push([key, value]);\\n      } else {\\n        array[index][1] = value;\\n      }\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Used by `_.defaults` to customize its `_.assignIn` use.\\n     *\\n     * @private\\n     * @param {*} objValue The destination value.\\n     * @param {*} srcValue The source value.\\n     * @param {string} key The key of the property to assign.\\n     * @param {Object} object The parent object of `objValue`.\\n     * @returns {*} Returns the value to assign.\\n     */\\n    function assignInDefaults(objValue, srcValue, key, object) {\\n      if (objValue === undefined ||\\n          (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\\n        return srcValue;\\n      }\\n      return objValue;\\n    }\\n\\n    /**\\n     * This function is like `assignValue` except that it doesn't assign\\n     * `undefined` values.\\n     *\\n     * @private\\n     * @param {Object} object The object to modify.\\n     * @param {string} key The key of the property to assign.\\n     * @param {*} value The value to assign.\\n     */\\n    function assignMergeValue(object, key, value) {\\n      if ((value !== undefined && !eq(object[key], value)) ||\\n          (typeof key == 'number' && value === undefined && !(key in object))) {\\n        object[key] = value;\\n      }\\n    }\\n\\n    /**\\n     * Assigns `value` to `key` of `object` if the existing value is not equivalent\\n     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons.\\n     *\\n     * @private\\n     * @param {Object} object The object to modify.\\n     * @param {string} key The key of the property to assign.\\n     * @param {*} value The value to assign.\\n     */\\n    function assignValue(object, key, value) {\\n      var objValue = object[key];\\n      if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\\n          (value === undefined && !(key in object))) {\\n        object[key] = value;\\n      }\\n    }\\n\\n    /**\\n     * Aggregates elements of `collection` on `accumulator` with keys transformed\\n     * by `iteratee` and values set by `setter`.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} setter The function to set `accumulator` values.\\n     * @param {Function} iteratee The iteratee to transform keys.\\n     * @param {Object} accumulator The initial aggregated object.\\n     * @returns {Function} Returns `accumulator`.\\n     */\\n    function baseAggregator(collection, setter, iteratee, accumulator) {\\n      baseEach(collection, function(value, key, collection) {\\n        setter(accumulator, value, iteratee(value), collection);\\n      });\\n      return accumulator;\\n    }\\n\\n    /**\\n     * The base implementation of `_.assign` without support for multiple sources\\n     * or `customizer` functions.\\n     *\\n     * @private\\n     * @param {Object} object The destination object.\\n     * @param {Object} source The source object.\\n     * @returns {Object} Returns `object`.\\n     */\\n    function baseAssign(object, source) {\\n      return object && copyObject(source, keys(source), object);\\n    }\\n\\n    /**\\n     * The base implementation of `_.at` without support for individual paths.\\n     *\\n     * @private\\n     * @param {Object} object The object to iterate over.\\n     * @param {string[]} paths The property paths of elements to pick.\\n     * @returns {Array} Returns the new array of picked elements.\\n     */\\n    function baseAt(object, paths) {\\n      var index = -1,\\n          isNil = object == null,\\n          length = paths.length,\\n          result = Array(length);\\n\\n      while (++index < length) {\\n        result[index] = isNil ? undefined : get(object, paths[index]);\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.clamp` which doesn't coerce arguments to numbers.\\n     *\\n     * @private\\n     * @param {number} number The number to clamp.\\n     * @param {number} [lower] The lower bound.\\n     * @param {number} upper The upper bound.\\n     * @returns {number} Returns the clamped number.\\n     */\\n    function baseClamp(number, lower, upper) {\\n      if (number === number) {\\n        if (upper !== undefined) {\\n          number = number <= upper ? number : upper;\\n        }\\n        if (lower !== undefined) {\\n          number = number >= lower ? number : lower;\\n        }\\n      }\\n      return number;\\n    }\\n\\n    /**\\n     * The base implementation of `_.clone` and `_.cloneDeep` which tracks\\n     * traversed objects.\\n     *\\n     * @private\\n     * @param {*} value The value to clone.\\n     * @param {boolean} [isDeep] Specify a deep clone.\\n     * @param {boolean} [isFull] Specify a clone including symbols.\\n     * @param {Function} [customizer] The function to customize cloning.\\n     * @param {string} [key] The key of `value`.\\n     * @param {Object} [object] The parent object of `value`.\\n     * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\\n     * @returns {*} Returns the cloned value.\\n     */\\n    function baseClone(value, isDeep, isFull, customizer, key, object, stack) {\\n      var result;\\n      if (customizer) {\\n        result = object ? customizer(value, key, object, stack) : customizer(value);\\n      }\\n      if (result !== undefined) {\\n        return result;\\n      }\\n      if (!isObject(value)) {\\n        return value;\\n      }\\n      var isArr = isArray(value);\\n      if (isArr) {\\n        result = initCloneArray(value);\\n        if (!isDeep) {\\n          return copyArray(value, result);\\n        }\\n      } else {\\n        var tag = getTag(value),\\n            isFunc = tag == funcTag || tag == genTag;\\n\\n        if (isBuffer(value)) {\\n          return cloneBuffer(value, isDeep);\\n        }\\n        if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\\n          if (isHostObject(value)) {\\n            return object ? value : {};\\n          }\\n          result = initCloneObject(isFunc ? {} : value);\\n          if (!isDeep) {\\n            return copySymbols(value, baseAssign(result, value));\\n          }\\n        } else {\\n          if (!cloneableTags[tag]) {\\n            return object ? value : {};\\n          }\\n          result = initCloneByTag(value, tag, baseClone, isDeep);\\n        }\\n      }\\n      // Check for circular references and return its corresponding clone.\\n      stack || (stack = new Stack);\\n      var stacked = stack.get(value);\\n      if (stacked) {\\n        return stacked;\\n      }\\n      stack.set(value, result);\\n\\n      if (!isArr) {\\n        var props = isFull ? getAllKeys(value) : keys(value);\\n      }\\n      // Recursively populate clone (susceptible to call stack limits).\\n      arrayEach(props || value, function(subValue, key) {\\n        if (props) {\\n          key = subValue;\\n          subValue = value[key];\\n        }\\n        assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));\\n      });\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.conforms` which doesn't clone `source`.\\n     *\\n     * @private\\n     * @param {Object} source The object of property predicates to conform to.\\n     * @returns {Function} Returns the new function.\\n     */\\n    function baseConforms(source) {\\n      var props = keys(source),\\n          length = props.length;\\n\\n      return function(object) {\\n        if (object == null) {\\n          return !length;\\n        }\\n        var index = length;\\n        while (index--) {\\n          var key = props[index],\\n              predicate = source[key],\\n              value = object[key];\\n\\n          if ((value === undefined &&\\n              !(key in Object(object))) || !predicate(value)) {\\n            return false;\\n          }\\n        }\\n        return true;\\n      };\\n    }\\n\\n    /**\\n     * The base implementation of `_.create` without support for assigning\\n     * properties to the created object.\\n     *\\n     * @private\\n     * @param {Object} prototype The object to inherit from.\\n     * @returns {Object} Returns the new object.\\n     */\\n    function baseCreate(proto) {\\n      return isObject(proto) ? objectCreate(proto) : {};\\n    }\\n\\n    /**\\n     * The base implementation of `_.delay` and `_.defer` which accepts an array\\n     * of `func` arguments.\\n     *\\n     * @private\\n     * @param {Function} func The function to delay.\\n     * @param {number} wait The number of milliseconds to delay invocation.\\n     * @param {Object} args The arguments to provide to `func`.\\n     * @returns {number} Returns the timer id.\\n     */\\n    function baseDelay(func, wait, args) {\\n      if (typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      return setTimeout(function() { func.apply(undefined, args); }, wait);\\n    }\\n\\n    /**\\n     * The base implementation of methods like `_.difference` without support\\n     * for excluding multiple arrays or iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array} array The array to inspect.\\n     * @param {Array} values The values to exclude.\\n     * @param {Function} [iteratee] The iteratee invoked per element.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new array of filtered values.\\n     */\\n    function baseDifference(array, values, iteratee, comparator) {\\n      var index = -1,\\n          includes = arrayIncludes,\\n          isCommon = true,\\n          length = array.length,\\n          result = [],\\n          valuesLength = values.length;\\n\\n      if (!length) {\\n        return result;\\n      }\\n      if (iteratee) {\\n        values = arrayMap(values, baseUnary(iteratee));\\n      }\\n      if (comparator) {\\n        includes = arrayIncludesWith;\\n        isCommon = false;\\n      }\\n      else if (values.length >= LARGE_ARRAY_SIZE) {\\n        includes = cacheHas;\\n        isCommon = false;\\n        values = new SetCache(values);\\n      }\\n      outer:\\n      while (++index < length) {\\n        var value = array[index],\\n            computed = iteratee ? iteratee(value) : value;\\n\\n        if (isCommon && computed === computed) {\\n          var valuesIndex = valuesLength;\\n          while (valuesIndex--) {\\n            if (values[valuesIndex] === computed) {\\n              continue outer;\\n            }\\n          }\\n          result.push(value);\\n        }\\n        else if (!includes(values, computed, comparator)) {\\n          result.push(value);\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.forEach` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} iteratee The function invoked per iteration.\\n     * @returns {Array|Object} Returns `collection`.\\n     */\\n    var baseEach = createBaseEach(baseForOwn);\\n\\n    /**\\n     * The base implementation of `_.forEachRight` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} iteratee The function invoked per iteration.\\n     * @returns {Array|Object} Returns `collection`.\\n     */\\n    var baseEachRight = createBaseEach(baseForOwnRight, true);\\n\\n    /**\\n     * The base implementation of `_.every` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} predicate The function invoked per iteration.\\n     * @returns {boolean} Returns `true` if all elements pass the predicate check,\\n     *  else `false`\\n     */\\n    function baseEvery(collection, predicate) {\\n      var result = true;\\n      baseEach(collection, function(value, index, collection) {\\n        result = !!predicate(value, index, collection);\\n        return result;\\n      });\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.fill` without an iteratee call guard.\\n     *\\n     * @private\\n     * @param {Array} array The array to fill.\\n     * @param {*} value The value to fill `array` with.\\n     * @param {number} [start=0] The start position.\\n     * @param {number} [end=array.length] The end position.\\n     * @returns {Array} Returns `array`.\\n     */\\n    function baseFill(array, value, start, end) {\\n      var length = array.length;\\n\\n      start = toInteger(start);\\n      if (start < 0) {\\n        start = -start > length ? 0 : (length + start);\\n      }\\n      end = (end === undefined || end > length) ? length : toInteger(end);\\n      if (end < 0) {\\n        end += length;\\n      }\\n      end = start > end ? 0 : toLength(end);\\n      while (start < end) {\\n        array[start++] = value;\\n      }\\n      return array;\\n    }\\n\\n    /**\\n     * The base implementation of `_.filter` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} predicate The function invoked per iteration.\\n     * @returns {Array} Returns the new filtered array.\\n     */\\n    function baseFilter(collection, predicate) {\\n      var result = [];\\n      baseEach(collection, function(value, index, collection) {\\n        if (predicate(value, index, collection)) {\\n          result.push(value);\\n        }\\n      });\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.flatten` with support for restricting flattening.\\n     *\\n     * @private\\n     * @param {Array} array The array to flatten.\\n     * @param {number} depth The maximum recursion depth.\\n     * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\\n     * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\\n     * @param {Array} [result=[]] The initial result value.\\n     * @returns {Array} Returns the new flattened array.\\n     */\\n    function baseFlatten(array, depth, predicate, isStrict, result) {\\n      var index = -1,\\n          length = array.length;\\n\\n      predicate || (predicate = isFlattenable);\\n      result || (result = []);\\n\\n      while (++index < length) {\\n        var value = array[index];\\n        if (depth > 0 && predicate(value)) {\\n          if (depth > 1) {\\n            // Recursively flatten arrays (susceptible to call stack limits).\\n            baseFlatten(value, depth - 1, predicate, isStrict, result);\\n          } else {\\n            arrayPush(result, value);\\n          }\\n        } else if (!isStrict) {\\n          result[result.length] = value;\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `baseForOwn` which iterates over `object`\\n     * properties returned by `keysFunc` and invokes `iteratee` for each property.\\n     * Iteratee functions may exit iteration early by explicitly returning `false`.\\n     *\\n     * @private\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} iteratee The function invoked per iteration.\\n     * @param {Function} keysFunc The function to get the keys of `object`.\\n     * @returns {Object} Returns `object`.\\n     */\\n    var baseFor = createBaseFor();\\n\\n    /**\\n     * This function is like `baseFor` except that it iterates over properties\\n     * in the opposite order.\\n     *\\n     * @private\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} iteratee The function invoked per iteration.\\n     * @param {Function} keysFunc The function to get the keys of `object`.\\n     * @returns {Object} Returns `object`.\\n     */\\n    var baseForRight = createBaseFor(true);\\n\\n    /**\\n     * The base implementation of `_.forOwn` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} iteratee The function invoked per iteration.\\n     * @returns {Object} Returns `object`.\\n     */\\n    function baseForOwn(object, iteratee) {\\n      return object && baseFor(object, iteratee, keys);\\n    }\\n\\n    /**\\n     * The base implementation of `_.forOwnRight` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} iteratee The function invoked per iteration.\\n     * @returns {Object} Returns `object`.\\n     */\\n    function baseForOwnRight(object, iteratee) {\\n      return object && baseForRight(object, iteratee, keys);\\n    }\\n\\n    /**\\n     * The base implementation of `_.functions` which creates an array of\\n     * `object` function property names filtered from `props`.\\n     *\\n     * @private\\n     * @param {Object} object The object to inspect.\\n     * @param {Array} props The property names to filter.\\n     * @returns {Array} Returns the new array of filtered property names.\\n     */\\n    function baseFunctions(object, props) {\\n      return arrayFilter(props, function(key) {\\n        return isFunction(object[key]);\\n      });\\n    }\\n\\n    /**\\n     * The base implementation of `_.get` without support for default values.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path of the property to get.\\n     * @returns {*} Returns the resolved value.\\n     */\\n    function baseGet(object, path) {\\n      path = isKey(path, object) ? [path] : castPath(path);\\n\\n      var index = 0,\\n          length = path.length;\\n\\n      while (object != null && index < length) {\\n        object = object[path[index++]];\\n      }\\n      return (index && index == length) ? object : undefined;\\n    }\\n\\n    /**\\n     * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\\n     * `keysFunc` and `symbolsFunc` to get the enumerable property names and\\n     * symbols of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Function} keysFunc The function to get the keys of `object`.\\n     * @param {Function} symbolsFunc The function to get the symbols of `object`.\\n     * @returns {Array} Returns the array of property names and symbols.\\n     */\\n    function baseGetAllKeys(object, keysFunc, symbolsFunc) {\\n      var result = keysFunc(object);\\n      return isArray(object)\\n        ? result\\n        : arrayPush(result, symbolsFunc(object));\\n    }\\n\\n    /**\\n     * The base implementation of `_.has` without support for deep paths.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} key The key to check.\\n     * @returns {boolean} Returns `true` if `key` exists, else `false`.\\n     */\\n    function baseHas(object, key) {\\n      // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\\n      // that are composed entirely of index properties, return `false` for\\n      // `hasOwnProperty` checks of them.\\n      return hasOwnProperty.call(object, key) ||\\n        (typeof object == 'object' && key in object && getPrototype(object) === null);\\n    }\\n\\n    /**\\n     * The base implementation of `_.hasIn` without support for deep paths.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} key The key to check.\\n     * @returns {boolean} Returns `true` if `key` exists, else `false`.\\n     */\\n    function baseHasIn(object, key) {\\n      return key in Object(object);\\n    }\\n\\n    /**\\n     * The base implementation of `_.inRange` which doesn't coerce arguments to numbers.\\n     *\\n     * @private\\n     * @param {number} number The number to check.\\n     * @param {number} start The start of the range.\\n     * @param {number} end The end of the range.\\n     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\\n     */\\n    function baseInRange(number, start, end) {\\n      return number >= nativeMin(start, end) && number < nativeMax(start, end);\\n    }\\n\\n    /**\\n     * The base implementation of methods like `_.intersection`, without support\\n     * for iteratee shorthands, that accepts an array of arrays to inspect.\\n     *\\n     * @private\\n     * @param {Array} arrays The arrays to inspect.\\n     * @param {Function} [iteratee] The iteratee invoked per element.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new array of shared values.\\n     */\\n    function baseIntersection(arrays, iteratee, comparator) {\\n      var includes = comparator ? arrayIncludesWith : arrayIncludes,\\n          length = arrays[0].length,\\n          othLength = arrays.length,\\n          othIndex = othLength,\\n          caches = Array(othLength),\\n          maxLength = Infinity,\\n          result = [];\\n\\n      while (othIndex--) {\\n        var array = arrays[othIndex];\\n        if (othIndex && iteratee) {\\n          array = arrayMap(array, baseUnary(iteratee));\\n        }\\n        maxLength = nativeMin(array.length, maxLength);\\n        caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))\\n          ? new SetCache(othIndex && array)\\n          : undefined;\\n      }\\n      array = arrays[0];\\n\\n      var index = -1,\\n          seen = caches[0];\\n\\n      outer:\\n      while (++index < length && result.length < maxLength) {\\n        var value = array[index],\\n            computed = iteratee ? iteratee(value) : value;\\n\\n        if (!(seen\\n              ? cacheHas(seen, computed)\\n              : includes(result, computed, comparator)\\n            )) {\\n          othIndex = othLength;\\n          while (--othIndex) {\\n            var cache = caches[othIndex];\\n            if (!(cache\\n                  ? cacheHas(cache, computed)\\n                  : includes(arrays[othIndex], computed, comparator))\\n                ) {\\n              continue outer;\\n            }\\n          }\\n          if (seen) {\\n            seen.push(computed);\\n          }\\n          result.push(value);\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.invert` and `_.invertBy` which inverts\\n     * `object` with values transformed by `iteratee` and set by `setter`.\\n     *\\n     * @private\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} setter The function to set `accumulator` values.\\n     * @param {Function} iteratee The iteratee to transform values.\\n     * @param {Object} accumulator The initial inverted object.\\n     * @returns {Function} Returns `accumulator`.\\n     */\\n    function baseInverter(object, setter, iteratee, accumulator) {\\n      baseForOwn(object, function(value, key, object) {\\n        setter(accumulator, iteratee(value), key, object);\\n      });\\n      return accumulator;\\n    }\\n\\n    /**\\n     * The base implementation of `_.invoke` without support for individual\\n     * method arguments.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path of the method to invoke.\\n     * @param {Array} args The arguments to invoke the method with.\\n     * @returns {*} Returns the result of the invoked method.\\n     */\\n    function baseInvoke(object, path, args) {\\n      if (!isKey(path, object)) {\\n        path = castPath(path);\\n        object = parent(object, path);\\n        path = last(path);\\n      }\\n      var func = object == null ? object : object[path];\\n      return func == null ? undefined : apply(func, object, args);\\n    }\\n\\n    /**\\n     * The base implementation of `_.isEqual` which supports partial comparisons\\n     * and tracks traversed objects.\\n     *\\n     * @private\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @param {Function} [customizer] The function to customize comparisons.\\n     * @param {boolean} [bitmask] The bitmask of comparison flags.\\n     *  The bitmask may be composed of the following flags:\\n     *     1 - Unordered comparison\\n     *     2 - Partial comparison\\n     * @param {Object} [stack] Tracks traversed `value` and `other` objects.\\n     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\\n     */\\n    function baseIsEqual(value, other, customizer, bitmask, stack) {\\n      if (value === other) {\\n        return true;\\n      }\\n      if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\\n        return value !== value && other !== other;\\n      }\\n      return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);\\n    }\\n\\n    /**\\n     * A specialized version of `baseIsEqual` for arrays and objects which performs\\n     * deep comparisons and tracks traversed objects enabling objects with circular\\n     * references to be compared.\\n     *\\n     * @private\\n     * @param {Object} object The object to compare.\\n     * @param {Object} other The other object to compare.\\n     * @param {Function} equalFunc The function to determine equivalents of values.\\n     * @param {Function} [customizer] The function to customize comparisons.\\n     * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`\\n     *  for more details.\\n     * @param {Object} [stack] Tracks traversed `object` and `other` objects.\\n     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\\n     */\\n    function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {\\n      var objIsArr = isArray(object),\\n          othIsArr = isArray(other),\\n          objTag = arrayTag,\\n          othTag = arrayTag;\\n\\n      if (!objIsArr) {\\n        objTag = getTag(object);\\n        objTag = objTag == argsTag ? objectTag : objTag;\\n      }\\n      if (!othIsArr) {\\n        othTag = getTag(other);\\n        othTag = othTag == argsTag ? objectTag : othTag;\\n      }\\n      var objIsObj = objTag == objectTag && !isHostObject(object),\\n          othIsObj = othTag == objectTag && !isHostObject(other),\\n          isSameTag = objTag == othTag;\\n\\n      if (isSameTag && !objIsObj) {\\n        stack || (stack = new Stack);\\n        return (objIsArr || isTypedArray(object))\\n          ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)\\n          : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);\\n      }\\n      if (!(bitmask & PARTIAL_COMPARE_FLAG)) {\\n        var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\\n            othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\\n\\n        if (objIsWrapped || othIsWrapped) {\\n          var objUnwrapped = objIsWrapped ? object.value() : object,\\n              othUnwrapped = othIsWrapped ? other.value() : other;\\n\\n          stack || (stack = new Stack);\\n          return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);\\n        }\\n      }\\n      if (!isSameTag) {\\n        return false;\\n      }\\n      stack || (stack = new Stack);\\n      return equalObjects(object, other, equalFunc, customizer, bitmask, stack);\\n    }\\n\\n    /**\\n     * The base implementation of `_.isMatch` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Object} object The object to inspect.\\n     * @param {Object} source The object of property values to match.\\n     * @param {Array} matchData The property names, values, and compare flags to match.\\n     * @param {Function} [customizer] The function to customize comparisons.\\n     * @returns {boolean} Returns `true` if `object` is a match, else `false`.\\n     */\\n    function baseIsMatch(object, source, matchData, customizer) {\\n      var index = matchData.length,\\n          length = index,\\n          noCustomizer = !customizer;\\n\\n      if (object == null) {\\n        return !length;\\n      }\\n      object = Object(object);\\n      while (index--) {\\n        var data = matchData[index];\\n        if ((noCustomizer && data[2])\\n              ? data[1] !== object[data[0]]\\n              : !(data[0] in object)\\n            ) {\\n          return false;\\n        }\\n      }\\n      while (++index < length) {\\n        data = matchData[index];\\n        var key = data[0],\\n            objValue = object[key],\\n            srcValue = data[1];\\n\\n        if (noCustomizer && data[2]) {\\n          if (objValue === undefined && !(key in object)) {\\n            return false;\\n          }\\n        } else {\\n          var stack = new Stack;\\n          if (customizer) {\\n            var result = customizer(objValue, srcValue, key, object, source, stack);\\n          }\\n          if (!(result === undefined\\n                ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)\\n                : result\\n              )) {\\n            return false;\\n          }\\n        }\\n      }\\n      return true;\\n    }\\n\\n    /**\\n     * The base implementation of `_.iteratee`.\\n     *\\n     * @private\\n     * @param {*} [value=_.identity] The value to convert to an iteratee.\\n     * @returns {Function} Returns the iteratee.\\n     */\\n    function baseIteratee(value) {\\n      // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\\n      // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\\n      if (typeof value == 'function') {\\n        return value;\\n      }\\n      if (value == null) {\\n        return identity;\\n      }\\n      if (typeof value == 'object') {\\n        return isArray(value)\\n          ? baseMatchesProperty(value[0], value[1])\\n          : baseMatches(value);\\n      }\\n      return property(value);\\n    }\\n\\n    /**\\n     * The base implementation of `_.keys` which doesn't skip the constructor\\n     * property of prototypes or treat sparse arrays as dense.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property names.\\n     */\\n    function baseKeys(object) {\\n      return nativeKeys(Object(object));\\n    }\\n\\n    /**\\n     * The base implementation of `_.keysIn` which doesn't skip the constructor\\n     * property of prototypes or treat sparse arrays as dense.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property names.\\n     */\\n    function baseKeysIn(object) {\\n      object = object == null ? object : Object(object);\\n\\n      var result = [];\\n      for (var key in object) {\\n        result.push(key);\\n      }\\n      return result;\\n    }\\n\\n    // Fallback for IE < 9 with es6-shim.\\n    if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) {\\n      baseKeysIn = function(object) {\\n        return iteratorToArray(enumerate(object));\\n      };\\n    }\\n\\n    /**\\n     * The base implementation of `_.map` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} iteratee The function invoked per iteration.\\n     * @returns {Array} Returns the new mapped array.\\n     */\\n    function baseMap(collection, iteratee) {\\n      var index = -1,\\n          result = isArrayLike(collection) ? Array(collection.length) : [];\\n\\n      baseEach(collection, function(value, key, collection) {\\n        result[++index] = iteratee(value, key, collection);\\n      });\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.matches` which doesn't clone `source`.\\n     *\\n     * @private\\n     * @param {Object} source The object of property values to match.\\n     * @returns {Function} Returns the new function.\\n     */\\n    function baseMatches(source) {\\n      var matchData = getMatchData(source);\\n      if (matchData.length == 1 && matchData[0][2]) {\\n        return matchesStrictComparable(matchData[0][0], matchData[0][1]);\\n      }\\n      return function(object) {\\n        return object === source || baseIsMatch(object, source, matchData);\\n      };\\n    }\\n\\n    /**\\n     * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\\n     *\\n     * @private\\n     * @param {string} path The path of the property to get.\\n     * @param {*} srcValue The value to match.\\n     * @returns {Function} Returns the new function.\\n     */\\n    function baseMatchesProperty(path, srcValue) {\\n      if (isKey(path) && isStrictComparable(srcValue)) {\\n        return matchesStrictComparable(path, srcValue);\\n      }\\n      return function(object) {\\n        var objValue = get(object, path);\\n        return (objValue === undefined && objValue === srcValue)\\n          ? hasIn(object, path)\\n          : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);\\n      };\\n    }\\n\\n    /**\\n     * The base implementation of `_.merge` without support for multiple sources.\\n     *\\n     * @private\\n     * @param {Object} object The destination object.\\n     * @param {Object} source The source object.\\n     * @param {number} srcIndex The index of `source`.\\n     * @param {Function} [customizer] The function to customize merged values.\\n     * @param {Object} [stack] Tracks traversed source values and their merged\\n     *  counterparts.\\n     */\\n    function baseMerge(object, source, srcIndex, customizer, stack) {\\n      if (object === source) {\\n        return;\\n      }\\n      if (!(isArray(source) || isTypedArray(source))) {\\n        var props = keysIn(source);\\n      }\\n      arrayEach(props || source, function(srcValue, key) {\\n        if (props) {\\n          key = srcValue;\\n          srcValue = source[key];\\n        }\\n        if (isObject(srcValue)) {\\n          stack || (stack = new Stack);\\n          baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\\n        }\\n        else {\\n          var newValue = customizer\\n            ? customizer(object[key], srcValue, (key + ''), object, source, stack)\\n            : undefined;\\n\\n          if (newValue === undefined) {\\n            newValue = srcValue;\\n          }\\n          assignMergeValue(object, key, newValue);\\n        }\\n      });\\n    }\\n\\n    /**\\n     * A specialized version of `baseMerge` for arrays and objects which performs\\n     * deep merges and tracks traversed objects enabling objects with circular\\n     * references to be merged.\\n     *\\n     * @private\\n     * @param {Object} object The destination object.\\n     * @param {Object} source The source object.\\n     * @param {string} key The key of the value to merge.\\n     * @param {number} srcIndex The index of `source`.\\n     * @param {Function} mergeFunc The function to merge values.\\n     * @param {Function} [customizer] The function to customize assigned values.\\n     * @param {Object} [stack] Tracks traversed source values and their merged\\n     *  counterparts.\\n     */\\n    function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\\n      var objValue = object[key],\\n          srcValue = source[key],\\n          stacked = stack.get(srcValue);\\n\\n      if (stacked) {\\n        assignMergeValue(object, key, stacked);\\n        return;\\n      }\\n      var newValue = customizer\\n        ? customizer(objValue, srcValue, (key + ''), object, source, stack)\\n        : undefined;\\n\\n      var isCommon = newValue === undefined;\\n\\n      if (isCommon) {\\n        newValue = srcValue;\\n        if (isArray(srcValue) || isTypedArray(srcValue)) {\\n          if (isArray(objValue)) {\\n            newValue = objValue;\\n          }\\n          else if (isArrayLikeObject(objValue)) {\\n            newValue = copyArray(objValue);\\n          }\\n          else {\\n            isCommon = false;\\n            newValue = baseClone(srcValue, true);\\n          }\\n        }\\n        else if (isPlainObject(srcValue) || isArguments(srcValue)) {\\n          if (isArguments(objValue)) {\\n            newValue = toPlainObject(objValue);\\n          }\\n          else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {\\n            isCommon = false;\\n            newValue = baseClone(srcValue, true);\\n          }\\n          else {\\n            newValue = objValue;\\n          }\\n        }\\n        else {\\n          isCommon = false;\\n        }\\n      }\\n      stack.set(srcValue, newValue);\\n\\n      if (isCommon) {\\n        // Recursively merge objects and arrays (susceptible to call stack limits).\\n        mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\\n      }\\n      stack['delete'](srcValue);\\n      assignMergeValue(object, key, newValue);\\n    }\\n\\n    /**\\n     * The base implementation of `_.nth` which doesn't coerce `n` to an integer.\\n     *\\n     * @private\\n     * @param {Array} array The array to query.\\n     * @param {number} n The index of the element to return.\\n     * @returns {*} Returns the nth element of `array`.\\n     */\\n    function baseNth(array, n) {\\n      var length = array.length;\\n      if (!length) {\\n        return;\\n      }\\n      n += n < 0 ? length : 0;\\n      return isIndex(n, length) ? array[n] : undefined;\\n    }\\n\\n    /**\\n     * The base implementation of `_.orderBy` without param guards.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\\n     * @param {string[]} orders The sort orders of `iteratees`.\\n     * @returns {Array} Returns the new sorted array.\\n     */\\n    function baseOrderBy(collection, iteratees, orders) {\\n      var index = -1;\\n      iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));\\n\\n      var result = baseMap(collection, function(value, key, collection) {\\n        var criteria = arrayMap(iteratees, function(iteratee) {\\n          return iteratee(value);\\n        });\\n        return { 'criteria': criteria, 'index': ++index, 'value': value };\\n      });\\n\\n      return baseSortBy(result, function(object, other) {\\n        return compareMultiple(object, other, orders);\\n      });\\n    }\\n\\n    /**\\n     * The base implementation of `_.pick` without support for individual\\n     * property identifiers.\\n     *\\n     * @private\\n     * @param {Object} object The source object.\\n     * @param {string[]} props The property identifiers to pick.\\n     * @returns {Object} Returns the new object.\\n     */\\n    function basePick(object, props) {\\n      object = Object(object);\\n      return arrayReduce(props, function(result, key) {\\n        if (key in object) {\\n          result[key] = object[key];\\n        }\\n        return result;\\n      }, {});\\n    }\\n\\n    /**\\n     * The base implementation of  `_.pickBy` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Object} object The source object.\\n     * @param {Function} predicate The function invoked per property.\\n     * @returns {Object} Returns the new object.\\n     */\\n    function basePickBy(object, predicate) {\\n      var index = -1,\\n          props = getAllKeysIn(object),\\n          length = props.length,\\n          result = {};\\n\\n      while (++index < length) {\\n        var key = props[index],\\n            value = object[key];\\n\\n        if (predicate(value, key)) {\\n          result[key] = value;\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.property` without support for deep paths.\\n     *\\n     * @private\\n     * @param {string} key The key of the property to get.\\n     * @returns {Function} Returns the new function.\\n     */\\n    function baseProperty(key) {\\n      return function(object) {\\n        return object == null ? undefined : object[key];\\n      };\\n    }\\n\\n    /**\\n     * A specialized version of `baseProperty` which supports deep paths.\\n     *\\n     * @private\\n     * @param {Array|string} path The path of the property to get.\\n     * @returns {Function} Returns the new function.\\n     */\\n    function basePropertyDeep(path) {\\n      return function(object) {\\n        return baseGet(object, path);\\n      };\\n    }\\n\\n    /**\\n     * The base implementation of `_.pullAllBy` without support for iteratee\\n     * shorthands.\\n     *\\n     * @private\\n     * @param {Array} array The array to modify.\\n     * @param {Array} values The values to remove.\\n     * @param {Function} [iteratee] The iteratee invoked per element.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns `array`.\\n     */\\n    function basePullAll(array, values, iteratee, comparator) {\\n      var indexOf = comparator ? baseIndexOfWith : baseIndexOf,\\n          index = -1,\\n          length = values.length,\\n          seen = array;\\n\\n      if (iteratee) {\\n        seen = arrayMap(array, baseUnary(iteratee));\\n      }\\n      while (++index < length) {\\n        var fromIndex = 0,\\n            value = values[index],\\n            computed = iteratee ? iteratee(value) : value;\\n\\n        while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {\\n          if (seen !== array) {\\n            splice.call(seen, fromIndex, 1);\\n          }\\n          splice.call(array, fromIndex, 1);\\n        }\\n      }\\n      return array;\\n    }\\n\\n    /**\\n     * The base implementation of `_.pullAt` without support for individual\\n     * indexes or capturing the removed elements.\\n     *\\n     * @private\\n     * @param {Array} array The array to modify.\\n     * @param {number[]} indexes The indexes of elements to remove.\\n     * @returns {Array} Returns `array`.\\n     */\\n    function basePullAt(array, indexes) {\\n      var length = array ? indexes.length : 0,\\n          lastIndex = length - 1;\\n\\n      while (length--) {\\n        var index = indexes[length];\\n        if (lastIndex == length || index != previous) {\\n          var previous = index;\\n          if (isIndex(index)) {\\n            splice.call(array, index, 1);\\n          }\\n          else if (!isKey(index, array)) {\\n            var path = castPath(index),\\n                object = parent(array, path);\\n\\n            if (object != null) {\\n              delete object[last(path)];\\n            }\\n          }\\n          else {\\n            delete array[index];\\n          }\\n        }\\n      }\\n      return array;\\n    }\\n\\n    /**\\n     * The base implementation of `_.random` without support for returning\\n     * floating-point numbers.\\n     *\\n     * @private\\n     * @param {number} lower The lower bound.\\n     * @param {number} upper The upper bound.\\n     * @returns {number} Returns the random number.\\n     */\\n    function baseRandom(lower, upper) {\\n      return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\\n    }\\n\\n    /**\\n     * The base implementation of `_.range` and `_.rangeRight` which doesn't\\n     * coerce arguments to numbers.\\n     *\\n     * @private\\n     * @param {number} start The start of the range.\\n     * @param {number} end The end of the range.\\n     * @param {number} step The value to increment or decrement by.\\n     * @param {boolean} [fromRight] Specify iterating from right to left.\\n     * @returns {Array} Returns the new array of numbers.\\n     */\\n    function baseRange(start, end, step, fromRight) {\\n      var index = -1,\\n          length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\\n          result = Array(length);\\n\\n      while (length--) {\\n        result[fromRight ? length : ++index] = start;\\n        start += step;\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.repeat` which doesn't coerce arguments.\\n     *\\n     * @private\\n     * @param {string} string The string to repeat.\\n     * @param {number} n The number of times to repeat the string.\\n     * @returns {string} Returns the repeated string.\\n     */\\n    function baseRepeat(string, n) {\\n      var result = '';\\n      if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\\n        return result;\\n      }\\n      // Leverage the exponentiation by squaring algorithm for a faster repeat.\\n      // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\\n      do {\\n        if (n % 2) {\\n          result += string;\\n        }\\n        n = nativeFloor(n / 2);\\n        if (n) {\\n          string += string;\\n        }\\n      } while (n);\\n\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.set`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path of the property to set.\\n     * @param {*} value The value to set.\\n     * @param {Function} [customizer] The function to customize path creation.\\n     * @returns {Object} Returns `object`.\\n     */\\n    function baseSet(object, path, value, customizer) {\\n      path = isKey(path, object) ? [path] : castPath(path);\\n\\n      var index = -1,\\n          length = path.length,\\n          lastIndex = length - 1,\\n          nested = object;\\n\\n      while (nested != null && ++index < length) {\\n        var key = path[index];\\n        if (isObject(nested)) {\\n          var newValue = value;\\n          if (index != lastIndex) {\\n            var objValue = nested[key];\\n            newValue = customizer ? customizer(objValue, key, nested) : undefined;\\n            if (newValue === undefined) {\\n              newValue = objValue == null\\n                ? (isIndex(path[index + 1]) ? [] : {})\\n                : objValue;\\n            }\\n          }\\n          assignValue(nested, key, newValue);\\n        }\\n        nested = nested[key];\\n      }\\n      return object;\\n    }\\n\\n    /**\\n     * The base implementation of `setData` without support for hot loop detection.\\n     *\\n     * @private\\n     * @param {Function} func The function to associate metadata with.\\n     * @param {*} data The metadata.\\n     * @returns {Function} Returns `func`.\\n     */\\n    var baseSetData = !metaMap ? identity : function(func, data) {\\n      metaMap.set(func, data);\\n      return func;\\n    };\\n\\n    /**\\n     * The base implementation of `_.slice` without an iteratee call guard.\\n     *\\n     * @private\\n     * @param {Array} array The array to slice.\\n     * @param {number} [start=0] The start position.\\n     * @param {number} [end=array.length] The end position.\\n     * @returns {Array} Returns the slice of `array`.\\n     */\\n    function baseSlice(array, start, end) {\\n      var index = -1,\\n          length = array.length;\\n\\n      if (start < 0) {\\n        start = -start > length ? 0 : (length + start);\\n      }\\n      end = end > length ? length : end;\\n      if (end < 0) {\\n        end += length;\\n      }\\n      length = start > end ? 0 : ((end - start) >>> 0);\\n      start >>>= 0;\\n\\n      var result = Array(length);\\n      while (++index < length) {\\n        result[index] = array[index + start];\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.some` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} predicate The function invoked per iteration.\\n     * @returns {boolean} Returns `true` if any element passes the predicate check,\\n     *  else `false`.\\n     */\\n    function baseSome(collection, predicate) {\\n      var result;\\n\\n      baseEach(collection, function(value, index, collection) {\\n        result = predicate(value, index, collection);\\n        return !result;\\n      });\\n      return !!result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which\\n     * performs a binary search of `array` to determine the index at which `value`\\n     * should be inserted into `array` in order to maintain its sort order.\\n     *\\n     * @private\\n     * @param {Array} array The sorted array to inspect.\\n     * @param {*} value The value to evaluate.\\n     * @param {boolean} [retHighest] Specify returning the highest qualified index.\\n     * @returns {number} Returns the index at which `value` should be inserted\\n     *  into `array`.\\n     */\\n    function baseSortedIndex(array, value, retHighest) {\\n      var low = 0,\\n          high = array ? array.length : low;\\n\\n      if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\\n        while (low < high) {\\n          var mid = (low + high) >>> 1,\\n              computed = array[mid];\\n\\n          if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {\\n            low = mid + 1;\\n          } else {\\n            high = mid;\\n          }\\n        }\\n        return high;\\n      }\\n      return baseSortedIndexBy(array, value, identity, retHighest);\\n    }\\n\\n    /**\\n     * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`\\n     * which invokes `iteratee` for `value` and each element of `array` to compute\\n     * their sort ranking. The iteratee is invoked with one argument; (value).\\n     *\\n     * @private\\n     * @param {Array} array The sorted array to inspect.\\n     * @param {*} value The value to evaluate.\\n     * @param {Function} iteratee The iteratee invoked per element.\\n     * @param {boolean} [retHighest] Specify returning the highest qualified index.\\n     * @returns {number} Returns the index at which `value` should be inserted\\n     *  into `array`.\\n     */\\n    function baseSortedIndexBy(array, value, iteratee, retHighest) {\\n      value = iteratee(value);\\n\\n      var low = 0,\\n          high = array ? array.length : 0,\\n          valIsNaN = value !== value,\\n          valIsNull = value === null,\\n          valIsUndef = value === undefined;\\n\\n      while (low < high) {\\n        var mid = nativeFloor((low + high) / 2),\\n            computed = iteratee(array[mid]),\\n            isDef = computed !== undefined,\\n            isReflexive = computed === computed;\\n\\n        if (valIsNaN) {\\n          var setLow = isReflexive || retHighest;\\n        } else if (valIsNull) {\\n          setLow = isReflexive && isDef && (retHighest || computed != null);\\n        } else if (valIsUndef) {\\n          setLow = isReflexive && (retHighest || isDef);\\n        } else if (computed == null) {\\n          setLow = false;\\n        } else {\\n          setLow = retHighest ? (computed <= value) : (computed < value);\\n        }\\n        if (setLow) {\\n          low = mid + 1;\\n        } else {\\n          high = mid;\\n        }\\n      }\\n      return nativeMin(high, MAX_ARRAY_INDEX);\\n    }\\n\\n    /**\\n     * The base implementation of `_.sortedUniq`.\\n     *\\n     * @private\\n     * @param {Array} array The array to inspect.\\n     * @returns {Array} Returns the new duplicate free array.\\n     */\\n    function baseSortedUniq(array) {\\n      return baseSortedUniqBy(array);\\n    }\\n\\n    /**\\n     * The base implementation of `_.sortedUniqBy` without support for iteratee\\n     * shorthands.\\n     *\\n     * @private\\n     * @param {Array} array The array to inspect.\\n     * @param {Function} [iteratee] The iteratee invoked per element.\\n     * @returns {Array} Returns the new duplicate free array.\\n     */\\n    function baseSortedUniqBy(array, iteratee) {\\n      var index = 0,\\n          length = array.length,\\n          value = array[0],\\n          computed = iteratee ? iteratee(value) : value,\\n          seen = computed,\\n          resIndex = 1,\\n          result = [value];\\n\\n      while (++index < length) {\\n        value = array[index],\\n        computed = iteratee ? iteratee(value) : value;\\n\\n        if (!eq(computed, seen)) {\\n          seen = computed;\\n          result[resIndex++] = value;\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.uniqBy` without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array} array The array to inspect.\\n     * @param {Function} [iteratee] The iteratee invoked per element.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new duplicate free array.\\n     */\\n    function baseUniq(array, iteratee, comparator) {\\n      var index = -1,\\n          includes = arrayIncludes,\\n          length = array.length,\\n          isCommon = true,\\n          result = [],\\n          seen = result;\\n\\n      if (comparator) {\\n        isCommon = false;\\n        includes = arrayIncludesWith;\\n      }\\n      else if (length >= LARGE_ARRAY_SIZE) {\\n        var set = iteratee ? null : createSet(array);\\n        if (set) {\\n          return setToArray(set);\\n        }\\n        isCommon = false;\\n        includes = cacheHas;\\n        seen = new SetCache;\\n      }\\n      else {\\n        seen = iteratee ? [] : result;\\n      }\\n      outer:\\n      while (++index < length) {\\n        var value = array[index],\\n            computed = iteratee ? iteratee(value) : value;\\n\\n        if (isCommon && computed === computed) {\\n          var seenIndex = seen.length;\\n          while (seenIndex--) {\\n            if (seen[seenIndex] === computed) {\\n              continue outer;\\n            }\\n          }\\n          if (iteratee) {\\n            seen.push(computed);\\n          }\\n          result.push(value);\\n        }\\n        else if (!includes(seen, computed, comparator)) {\\n          if (seen !== result) {\\n            seen.push(computed);\\n          }\\n          result.push(value);\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The base implementation of `_.unset`.\\n     *\\n     * @private\\n     * @param {Object} object The object to modify.\\n     * @param {Array|string} path The path of the property to unset.\\n     * @returns {boolean} Returns `true` if the property is deleted, else `false`.\\n     */\\n    function baseUnset(object, path) {\\n      path = isKey(path, object) ? [path] : castPath(path);\\n      object = parent(object, path);\\n      var key = last(path);\\n      return (object != null && has(object, key)) ? delete object[key] : true;\\n    }\\n\\n    /**\\n     * The base implementation of `_.update`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path of the property to update.\\n     * @param {Function} updater The function to produce the updated value.\\n     * @param {Function} [customizer] The function to customize path creation.\\n     * @returns {Object} Returns `object`.\\n     */\\n    function baseUpdate(object, path, updater, customizer) {\\n      return baseSet(object, path, updater(baseGet(object, path)), customizer);\\n    }\\n\\n    /**\\n     * The base implementation of methods like `_.dropWhile` and `_.takeWhile`\\n     * without support for iteratee shorthands.\\n     *\\n     * @private\\n     * @param {Array} array The array to query.\\n     * @param {Function} predicate The function invoked per iteration.\\n     * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\\n     * @param {boolean} [fromRight] Specify iterating from right to left.\\n     * @returns {Array} Returns the slice of `array`.\\n     */\\n    function baseWhile(array, predicate, isDrop, fromRight) {\\n      var length = array.length,\\n          index = fromRight ? length : -1;\\n\\n      while ((fromRight ? index-- : ++index < length) &&\\n        predicate(array[index], index, array)) {}\\n\\n      return isDrop\\n        ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\\n        : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\\n    }\\n\\n    /**\\n     * The base implementation of `wrapperValue` which returns the result of\\n     * performing a sequence of actions on the unwrapped `value`, where each\\n     * successive action is supplied the return value of the previous.\\n     *\\n     * @private\\n     * @param {*} value The unwrapped value.\\n     * @param {Array} actions Actions to perform to resolve the unwrapped value.\\n     * @returns {*} Returns the resolved value.\\n     */\\n    function baseWrapperValue(value, actions) {\\n      var result = value;\\n      if (result instanceof LazyWrapper) {\\n        result = result.value();\\n      }\\n      return arrayReduce(actions, function(result, action) {\\n        return action.func.apply(action.thisArg, arrayPush([result], action.args));\\n      }, result);\\n    }\\n\\n    /**\\n     * The base implementation of methods like `_.xor`, without support for\\n     * iteratee shorthands, that accepts an array of arrays to inspect.\\n     *\\n     * @private\\n     * @param {Array} arrays The arrays to inspect.\\n     * @param {Function} [iteratee] The iteratee invoked per element.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new array of values.\\n     */\\n    function baseXor(arrays, iteratee, comparator) {\\n      var index = -1,\\n          length = arrays.length;\\n\\n      while (++index < length) {\\n        var result = result\\n          ? arrayPush(\\n              baseDifference(result, arrays[index], iteratee, comparator),\\n              baseDifference(arrays[index], result, iteratee, comparator)\\n            )\\n          : arrays[index];\\n      }\\n      return (result && result.length) ? baseUniq(result, iteratee, comparator) : [];\\n    }\\n\\n    /**\\n     * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\\n     *\\n     * @private\\n     * @param {Array} props The property identifiers.\\n     * @param {Array} values The property values.\\n     * @param {Function} assignFunc The function to assign values.\\n     * @returns {Object} Returns the new object.\\n     */\\n    function baseZipObject(props, values, assignFunc) {\\n      var index = -1,\\n          length = props.length,\\n          valsLength = values.length,\\n          result = {};\\n\\n      while (++index < length) {\\n        var value = index < valsLength ? values[index] : undefined;\\n        assignFunc(result, props[index], value);\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Casts `value` to an empty array if it's not an array like object.\\n     *\\n     * @private\\n     * @param {*} value The value to inspect.\\n     * @returns {Array|Object} Returns the cast array-like object.\\n     */\\n    function castArrayLikeObject(value) {\\n      return isArrayLikeObject(value) ? value : [];\\n    }\\n\\n    /**\\n     * Casts `value` to `identity` if it's not a function.\\n     *\\n     * @private\\n     * @param {*} value The value to inspect.\\n     * @returns {Function} Returns cast function.\\n     */\\n    function castFunction(value) {\\n      return typeof value == 'function' ? value : identity;\\n    }\\n\\n    /**\\n     * Casts `value` to a path array if it's not one.\\n     *\\n     * @private\\n     * @param {*} value The value to inspect.\\n     * @returns {Array} Returns the cast property path array.\\n     */\\n    function castPath(value) {\\n      return isArray(value) ? value : stringToPath(value);\\n    }\\n\\n    /**\\n     * Casts `array` to a slice if it's needed.\\n     *\\n     * @private\\n     * @param {Array} array The array to inspect.\\n     * @param {number} start The start position.\\n     * @param {number} [end=array.length] The end position.\\n     * @returns {Array} Returns the cast slice.\\n     */\\n    function castSlice(array, start, end) {\\n      var length = array.length;\\n      end = end === undefined ? length : end;\\n      return (!start && end >= length) ? array : baseSlice(array, start, end);\\n    }\\n\\n    /**\\n     * Creates a clone of  `buffer`.\\n     *\\n     * @private\\n     * @param {Buffer} buffer The buffer to clone.\\n     * @param {boolean} [isDeep] Specify a deep clone.\\n     * @returns {Buffer} Returns the cloned buffer.\\n     */\\n    function cloneBuffer(buffer, isDeep) {\\n      if (isDeep) {\\n        return buffer.slice();\\n      }\\n      var result = new buffer.constructor(buffer.length);\\n      buffer.copy(result);\\n      return result;\\n    }\\n\\n    /**\\n     * Creates a clone of `arrayBuffer`.\\n     *\\n     * @private\\n     * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\\n     * @returns {ArrayBuffer} Returns the cloned array buffer.\\n     */\\n    function cloneArrayBuffer(arrayBuffer) {\\n      var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\\n      new Uint8Array(result).set(new Uint8Array(arrayBuffer));\\n      return result;\\n    }\\n\\n    /**\\n     * Creates a clone of `dataView`.\\n     *\\n     * @private\\n     * @param {Object} dataView The data view to clone.\\n     * @param {boolean} [isDeep] Specify a deep clone.\\n     * @returns {Object} Returns the cloned data view.\\n     */\\n    function cloneDataView(dataView, isDeep) {\\n      var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\\n      return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\\n    }\\n\\n    /**\\n     * Creates a clone of `map`.\\n     *\\n     * @private\\n     * @param {Object} map The map to clone.\\n     * @param {Function} cloneFunc The function to clone values.\\n     * @param {boolean} [isDeep] Specify a deep clone.\\n     * @returns {Object} Returns the cloned map.\\n     */\\n    function cloneMap(map, isDeep, cloneFunc) {\\n      var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);\\n      return arrayReduce(array, addMapEntry, new map.constructor);\\n    }\\n\\n    /**\\n     * Creates a clone of `regexp`.\\n     *\\n     * @private\\n     * @param {Object} regexp The regexp to clone.\\n     * @returns {Object} Returns the cloned regexp.\\n     */\\n    function cloneRegExp(regexp) {\\n      var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\\n      result.lastIndex = regexp.lastIndex;\\n      return result;\\n    }\\n\\n    /**\\n     * Creates a clone of `set`.\\n     *\\n     * @private\\n     * @param {Object} set The set to clone.\\n     * @param {Function} cloneFunc The function to clone values.\\n     * @param {boolean} [isDeep] Specify a deep clone.\\n     * @returns {Object} Returns the cloned set.\\n     */\\n    function cloneSet(set, isDeep, cloneFunc) {\\n      var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);\\n      return arrayReduce(array, addSetEntry, new set.constructor);\\n    }\\n\\n    /**\\n     * Creates a clone of the `symbol` object.\\n     *\\n     * @private\\n     * @param {Object} symbol The symbol object to clone.\\n     * @returns {Object} Returns the cloned symbol object.\\n     */\\n    function cloneSymbol(symbol) {\\n      return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\\n    }\\n\\n    /**\\n     * Creates a clone of `typedArray`.\\n     *\\n     * @private\\n     * @param {Object} typedArray The typed array to clone.\\n     * @param {boolean} [isDeep] Specify a deep clone.\\n     * @returns {Object} Returns the cloned typed array.\\n     */\\n    function cloneTypedArray(typedArray, isDeep) {\\n      var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\\n      return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\\n    }\\n\\n    /**\\n     * Creates an array that is the composition of partially applied arguments,\\n     * placeholders, and provided arguments into a single array of arguments.\\n     *\\n     * @private\\n     * @param {Array|Object} args The provided arguments.\\n     * @param {Array} partials The arguments to prepend to those provided.\\n     * @param {Array} holders The `partials` placeholder indexes.\\n     * @params {boolean} [isCurried] Specify composing for a curried function.\\n     * @returns {Array} Returns the new array of composed arguments.\\n     */\\n    function composeArgs(args, partials, holders, isCurried) {\\n      var argsIndex = -1,\\n          argsLength = args.length,\\n          holdersLength = holders.length,\\n          leftIndex = -1,\\n          leftLength = partials.length,\\n          rangeLength = nativeMax(argsLength - holdersLength, 0),\\n          result = Array(leftLength + rangeLength),\\n          isUncurried = !isCurried;\\n\\n      while (++leftIndex < leftLength) {\\n        result[leftIndex] = partials[leftIndex];\\n      }\\n      while (++argsIndex < holdersLength) {\\n        if (isUncurried || argsIndex < argsLength) {\\n          result[holders[argsIndex]] = args[argsIndex];\\n        }\\n      }\\n      while (rangeLength--) {\\n        result[leftIndex++] = args[argsIndex++];\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * This function is like `composeArgs` except that the arguments composition\\n     * is tailored for `_.partialRight`.\\n     *\\n     * @private\\n     * @param {Array|Object} args The provided arguments.\\n     * @param {Array} partials The arguments to append to those provided.\\n     * @param {Array} holders The `partials` placeholder indexes.\\n     * @params {boolean} [isCurried] Specify composing for a curried function.\\n     * @returns {Array} Returns the new array of composed arguments.\\n     */\\n    function composeArgsRight(args, partials, holders, isCurried) {\\n      var argsIndex = -1,\\n          argsLength = args.length,\\n          holdersIndex = -1,\\n          holdersLength = holders.length,\\n          rightIndex = -1,\\n          rightLength = partials.length,\\n          rangeLength = nativeMax(argsLength - holdersLength, 0),\\n          result = Array(rangeLength + rightLength),\\n          isUncurried = !isCurried;\\n\\n      while (++argsIndex < rangeLength) {\\n        result[argsIndex] = args[argsIndex];\\n      }\\n      var offset = argsIndex;\\n      while (++rightIndex < rightLength) {\\n        result[offset + rightIndex] = partials[rightIndex];\\n      }\\n      while (++holdersIndex < holdersLength) {\\n        if (isUncurried || argsIndex < argsLength) {\\n          result[offset + holders[holdersIndex]] = args[argsIndex++];\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Copies the values of `source` to `array`.\\n     *\\n     * @private\\n     * @param {Array} source The array to copy values from.\\n     * @param {Array} [array=[]] The array to copy values to.\\n     * @returns {Array} Returns `array`.\\n     */\\n    function copyArray(source, array) {\\n      var index = -1,\\n          length = source.length;\\n\\n      array || (array = Array(length));\\n      while (++index < length) {\\n        array[index] = source[index];\\n      }\\n      return array;\\n    }\\n\\n    /**\\n     * Copies properties of `source` to `object`.\\n     *\\n     * @private\\n     * @param {Object} source The object to copy properties from.\\n     * @param {Array} props The property identifiers to copy.\\n     * @param {Object} [object={}] The object to copy properties to.\\n     * @param {Function} [customizer] The function to customize copied values.\\n     * @returns {Object} Returns `object`.\\n     */\\n    function copyObject(source, props, object, customizer) {\\n      object || (object = {});\\n\\n      var index = -1,\\n          length = props.length;\\n\\n      while (++index < length) {\\n        var key = props[index];\\n\\n        var newValue = customizer\\n          ? customizer(object[key], source[key], key, object, source)\\n          : source[key];\\n\\n        assignValue(object, key, newValue);\\n      }\\n      return object;\\n    }\\n\\n    /**\\n     * Copies own symbol properties of `source` to `object`.\\n     *\\n     * @private\\n     * @param {Object} source The object to copy symbols from.\\n     * @param {Object} [object={}] The object to copy symbols to.\\n     * @returns {Object} Returns `object`.\\n     */\\n    function copySymbols(source, object) {\\n      return copyObject(source, getSymbols(source), object);\\n    }\\n\\n    /**\\n     * Creates a function like `_.groupBy`.\\n     *\\n     * @private\\n     * @param {Function} setter The function to set accumulator values.\\n     * @param {Function} [initializer] The accumulator object initializer.\\n     * @returns {Function} Returns the new aggregator function.\\n     */\\n    function createAggregator(setter, initializer) {\\n      return function(collection, iteratee) {\\n        var func = isArray(collection) ? arrayAggregator : baseAggregator,\\n            accumulator = initializer ? initializer() : {};\\n\\n        return func(collection, setter, getIteratee(iteratee), accumulator);\\n      };\\n    }\\n\\n    /**\\n     * Creates a function like `_.assign`.\\n     *\\n     * @private\\n     * @param {Function} assigner The function to assign values.\\n     * @returns {Function} Returns the new assigner function.\\n     */\\n    function createAssigner(assigner) {\\n      return rest(function(object, sources) {\\n        var index = -1,\\n            length = sources.length,\\n            customizer = length > 1 ? sources[length - 1] : undefined,\\n            guard = length > 2 ? sources[2] : undefined;\\n\\n        customizer = typeof customizer == 'function'\\n          ? (length--, customizer)\\n          : undefined;\\n\\n        if (guard && isIterateeCall(sources[0], sources[1], guard)) {\\n          customizer = length < 3 ? undefined : customizer;\\n          length = 1;\\n        }\\n        object = Object(object);\\n        while (++index < length) {\\n          var source = sources[index];\\n          if (source) {\\n            assigner(object, source, index, customizer);\\n          }\\n        }\\n        return object;\\n      });\\n    }\\n\\n    /**\\n     * Creates a `baseEach` or `baseEachRight` function.\\n     *\\n     * @private\\n     * @param {Function} eachFunc The function to iterate over a collection.\\n     * @param {boolean} [fromRight] Specify iterating from right to left.\\n     * @returns {Function} Returns the new base function.\\n     */\\n    function createBaseEach(eachFunc, fromRight) {\\n      return function(collection, iteratee) {\\n        if (collection == null) {\\n          return collection;\\n        }\\n        if (!isArrayLike(collection)) {\\n          return eachFunc(collection, iteratee);\\n        }\\n        var length = collection.length,\\n            index = fromRight ? length : -1,\\n            iterable = Object(collection);\\n\\n        while ((fromRight ? index-- : ++index < length)) {\\n          if (iteratee(iterable[index], index, iterable) === false) {\\n            break;\\n          }\\n        }\\n        return collection;\\n      };\\n    }\\n\\n    /**\\n     * Creates a base function for methods like `_.forIn` and `_.forOwn`.\\n     *\\n     * @private\\n     * @param {boolean} [fromRight] Specify iterating from right to left.\\n     * @returns {Function} Returns the new base function.\\n     */\\n    function createBaseFor(fromRight) {\\n      return function(object, iteratee, keysFunc) {\\n        var index = -1,\\n            iterable = Object(object),\\n            props = keysFunc(object),\\n            length = props.length;\\n\\n        while (length--) {\\n          var key = props[fromRight ? length : ++index];\\n          if (iteratee(iterable[key], key, iterable) === false) {\\n            break;\\n          }\\n        }\\n        return object;\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that wraps `func` to invoke it with the optional `this`\\n     * binding of `thisArg`.\\n     *\\n     * @private\\n     * @param {Function} func The function to wrap.\\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\\n     *  for more details.\\n     * @param {*} [thisArg] The `this` binding of `func`.\\n     * @returns {Function} Returns the new wrapped function.\\n     */\\n    function createBaseWrapper(func, bitmask, thisArg) {\\n      var isBind = bitmask & BIND_FLAG,\\n          Ctor = createCtorWrapper(func);\\n\\n      function wrapper() {\\n        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\\n        return fn.apply(isBind ? thisArg : this, arguments);\\n      }\\n      return wrapper;\\n    }\\n\\n    /**\\n     * Creates a function like `_.lowerFirst`.\\n     *\\n     * @private\\n     * @param {string} methodName The name of the `String` case method to use.\\n     * @returns {Function} Returns the new function.\\n     */\\n    function createCaseFirst(methodName) {\\n      return function(string) {\\n        string = toString(string);\\n\\n        var strSymbols = reHasComplexSymbol.test(string)\\n          ? stringToArray(string)\\n          : undefined;\\n\\n        var chr = strSymbols\\n          ? strSymbols[0]\\n          : string.charAt(0);\\n\\n        var trailing = strSymbols\\n          ? castSlice(strSymbols, 1).join('')\\n          : string.slice(1);\\n\\n        return chr[methodName]() + trailing;\\n      };\\n    }\\n\\n    /**\\n     * Creates a function like `_.camelCase`.\\n     *\\n     * @private\\n     * @param {Function} callback The function to combine each word.\\n     * @returns {Function} Returns the new compounder function.\\n     */\\n    function createCompounder(callback) {\\n      return function(string) {\\n        return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that produces an instance of `Ctor` regardless of\\n     * whether it was invoked as part of a `new` expression or by `call` or `apply`.\\n     *\\n     * @private\\n     * @param {Function} Ctor The constructor to wrap.\\n     * @returns {Function} Returns the new wrapped function.\\n     */\\n    function createCtorWrapper(Ctor) {\\n      return function() {\\n        // Use a `switch` statement to work with class constructors. See\\n        // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\\n        // for more details.\\n        var args = arguments;\\n        switch (args.length) {\\n          case 0: return new Ctor;\\n          case 1: return new Ctor(args[0]);\\n          case 2: return new Ctor(args[0], args[1]);\\n          case 3: return new Ctor(args[0], args[1], args[2]);\\n          case 4: return new Ctor(args[0], args[1], args[2], args[3]);\\n          case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\\n          case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\\n          case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\\n        }\\n        var thisBinding = baseCreate(Ctor.prototype),\\n            result = Ctor.apply(thisBinding, args);\\n\\n        // Mimic the constructor's `return` behavior.\\n        // See https://es5.github.io/#x13.2.2 for more details.\\n        return isObject(result) ? result : thisBinding;\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that wraps `func` to enable currying.\\n     *\\n     * @private\\n     * @param {Function} func The function to wrap.\\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\\n     *  for more details.\\n     * @param {number} arity The arity of `func`.\\n     * @returns {Function} Returns the new wrapped function.\\n     */\\n    function createCurryWrapper(func, bitmask, arity) {\\n      var Ctor = createCtorWrapper(func);\\n\\n      function wrapper() {\\n        var length = arguments.length,\\n            args = Array(length),\\n            index = length,\\n            placeholder = getPlaceholder(wrapper);\\n\\n        while (index--) {\\n          args[index] = arguments[index];\\n        }\\n        var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)\\n          ? []\\n          : replaceHolders(args, placeholder);\\n\\n        length -= holders.length;\\n        if (length < arity) {\\n          return createRecurryWrapper(\\n            func, bitmask, createHybridWrapper, wrapper.placeholder, undefined,\\n            args, holders, undefined, undefined, arity - length);\\n        }\\n        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\\n        return apply(fn, this, args);\\n      }\\n      return wrapper;\\n    }\\n\\n    /**\\n     * Creates a `_.flow` or `_.flowRight` function.\\n     *\\n     * @private\\n     * @param {boolean} [fromRight] Specify iterating from right to left.\\n     * @returns {Function} Returns the new flow function.\\n     */\\n    function createFlow(fromRight) {\\n      return rest(function(funcs) {\\n        funcs = baseFlatten(funcs, 1);\\n\\n        var length = funcs.length,\\n            index = length,\\n            prereq = LodashWrapper.prototype.thru;\\n\\n        if (fromRight) {\\n          funcs.reverse();\\n        }\\n        while (index--) {\\n          var func = funcs[index];\\n          if (typeof func != 'function') {\\n            throw new TypeError(FUNC_ERROR_TEXT);\\n          }\\n          if (prereq && !wrapper && getFuncName(func) == 'wrapper') {\\n            var wrapper = new LodashWrapper([], true);\\n          }\\n        }\\n        index = wrapper ? index : length;\\n        while (++index < length) {\\n          func = funcs[index];\\n\\n          var funcName = getFuncName(func),\\n              data = funcName == 'wrapper' ? getData(func) : undefined;\\n\\n          if (data && isLaziable(data[0]) &&\\n                data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) &&\\n                !data[4].length && data[9] == 1\\n              ) {\\n            wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\\n          } else {\\n            wrapper = (func.length == 1 && isLaziable(func))\\n              ? wrapper[funcName]()\\n              : wrapper.thru(func);\\n          }\\n        }\\n        return function() {\\n          var args = arguments,\\n              value = args[0];\\n\\n          if (wrapper && args.length == 1 &&\\n              isArray(value) && value.length >= LARGE_ARRAY_SIZE) {\\n            return wrapper.plant(value).value();\\n          }\\n          var index = 0,\\n              result = length ? funcs[index].apply(this, args) : value;\\n\\n          while (++index < length) {\\n            result = funcs[index].call(this, result);\\n          }\\n          return result;\\n        };\\n      });\\n    }\\n\\n    /**\\n     * Creates a function that wraps `func` to invoke it with optional `this`\\n     * binding of `thisArg`, partial application, and currying.\\n     *\\n     * @private\\n     * @param {Function|string} func The function or method name to wrap.\\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\\n     *  for more details.\\n     * @param {*} [thisArg] The `this` binding of `func`.\\n     * @param {Array} [partials] The arguments to prepend to those provided to\\n     *  the new function.\\n     * @param {Array} [holders] The `partials` placeholder indexes.\\n     * @param {Array} [partialsRight] The arguments to append to those provided\\n     *  to the new function.\\n     * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\\n     * @param {Array} [argPos] The argument positions of the new function.\\n     * @param {number} [ary] The arity cap of `func`.\\n     * @param {number} [arity] The arity of `func`.\\n     * @returns {Function} Returns the new wrapped function.\\n     */\\n    function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\\n      var isAry = bitmask & ARY_FLAG,\\n          isBind = bitmask & BIND_FLAG,\\n          isBindKey = bitmask & BIND_KEY_FLAG,\\n          isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),\\n          isFlip = bitmask & FLIP_FLAG,\\n          Ctor = isBindKey ? undefined : createCtorWrapper(func);\\n\\n      function wrapper() {\\n        var length = arguments.length,\\n            index = length,\\n            args = Array(length);\\n\\n        while (index--) {\\n          args[index] = arguments[index];\\n        }\\n        if (isCurried) {\\n          var placeholder = getPlaceholder(wrapper),\\n              holdersCount = countHolders(args, placeholder);\\n        }\\n        if (partials) {\\n          args = composeArgs(args, partials, holders, isCurried);\\n        }\\n        if (partialsRight) {\\n          args = composeArgsRight(args, partialsRight, holdersRight, isCurried);\\n        }\\n        length -= holdersCount;\\n        if (isCurried && length < arity) {\\n          var newHolders = replaceHolders(args, placeholder);\\n          return createRecurryWrapper(\\n            func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg,\\n            args, newHolders, argPos, ary, arity - length\\n          );\\n        }\\n        var thisBinding = isBind ? thisArg : this,\\n            fn = isBindKey ? thisBinding[func] : func;\\n\\n        length = args.length;\\n        if (argPos) {\\n          args = reorder(args, argPos);\\n        } else if (isFlip && length > 1) {\\n          args.reverse();\\n        }\\n        if (isAry && ary < length) {\\n          args.length = ary;\\n        }\\n        if (this && this !== root && this instanceof wrapper) {\\n          fn = Ctor || createCtorWrapper(fn);\\n        }\\n        return fn.apply(thisBinding, args);\\n      }\\n      return wrapper;\\n    }\\n\\n    /**\\n     * Creates a function like `_.invertBy`.\\n     *\\n     * @private\\n     * @param {Function} setter The function to set accumulator values.\\n     * @param {Function} toIteratee The function to resolve iteratees.\\n     * @returns {Function} Returns the new inverter function.\\n     */\\n    function createInverter(setter, toIteratee) {\\n      return function(object, iteratee) {\\n        return baseInverter(object, setter, toIteratee(iteratee), {});\\n      };\\n    }\\n\\n    /**\\n     * Creates a function like `_.over`.\\n     *\\n     * @private\\n     * @param {Function} arrayFunc The function to iterate over iteratees.\\n     * @returns {Function} Returns the new invoker function.\\n     */\\n    function createOver(arrayFunc) {\\n      return rest(function(iteratees) {\\n        iteratees = (iteratees.length == 1 && isArray(iteratees[0]))\\n          ? arrayMap(iteratees[0], baseUnary(getIteratee()))\\n          : arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(getIteratee()));\\n\\n        return rest(function(args) {\\n          var thisArg = this;\\n          return arrayFunc(iteratees, function(iteratee) {\\n            return apply(iteratee, thisArg, args);\\n          });\\n        });\\n      });\\n    }\\n\\n    /**\\n     * Creates the padding for `string` based on `length`. The `chars` string\\n     * is truncated if the number of characters exceeds `length`.\\n     *\\n     * @private\\n     * @param {number} length The padding length.\\n     * @param {string} [chars=' '] The string used as padding.\\n     * @returns {string} Returns the padding for `string`.\\n     */\\n    function createPadding(length, chars) {\\n      chars = chars === undefined ? ' ' : (chars + '');\\n\\n      var charsLength = chars.length;\\n      if (charsLength < 2) {\\n        return charsLength ? baseRepeat(chars, length) : chars;\\n      }\\n      var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\\n      return reHasComplexSymbol.test(chars)\\n        ? castSlice(stringToArray(result), 0, length).join('')\\n        : result.slice(0, length);\\n    }\\n\\n    /**\\n     * Creates a function that wraps `func` to invoke it with the `this` binding\\n     * of `thisArg` and `partials` prepended to the arguments it receives.\\n     *\\n     * @private\\n     * @param {Function} func The function to wrap.\\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\\n     *  for more details.\\n     * @param {*} thisArg The `this` binding of `func`.\\n     * @param {Array} partials The arguments to prepend to those provided to\\n     *  the new function.\\n     * @returns {Function} Returns the new wrapped function.\\n     */\\n    function createPartialWrapper(func, bitmask, thisArg, partials) {\\n      var isBind = bitmask & BIND_FLAG,\\n          Ctor = createCtorWrapper(func);\\n\\n      function wrapper() {\\n        var argsIndex = -1,\\n            argsLength = arguments.length,\\n            leftIndex = -1,\\n            leftLength = partials.length,\\n            args = Array(leftLength + argsLength),\\n            fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\\n\\n        while (++leftIndex < leftLength) {\\n          args[leftIndex] = partials[leftIndex];\\n        }\\n        while (argsLength--) {\\n          args[leftIndex++] = arguments[++argsIndex];\\n        }\\n        return apply(fn, isBind ? thisArg : this, args);\\n      }\\n      return wrapper;\\n    }\\n\\n    /**\\n     * Creates a `_.range` or `_.rangeRight` function.\\n     *\\n     * @private\\n     * @param {boolean} [fromRight] Specify iterating from right to left.\\n     * @returns {Function} Returns the new range function.\\n     */\\n    function createRange(fromRight) {\\n      return function(start, end, step) {\\n        if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\\n          end = step = undefined;\\n        }\\n        // Ensure the sign of `-0` is preserved.\\n        start = toNumber(start);\\n        start = start === start ? start : 0;\\n        if (end === undefined) {\\n          end = start;\\n          start = 0;\\n        } else {\\n          end = toNumber(end) || 0;\\n        }\\n        step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);\\n        return baseRange(start, end, step, fromRight);\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that wraps `func` to continue currying.\\n     *\\n     * @private\\n     * @param {Function} func The function to wrap.\\n     * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`\\n     *  for more details.\\n     * @param {Function} wrapFunc The function to create the `func` wrapper.\\n     * @param {*} placeholder The placeholder value.\\n     * @param {*} [thisArg] The `this` binding of `func`.\\n     * @param {Array} [partials] The arguments to prepend to those provided to\\n     *  the new function.\\n     * @param {Array} [holders] The `partials` placeholder indexes.\\n     * @param {Array} [argPos] The argument positions of the new function.\\n     * @param {number} [ary] The arity cap of `func`.\\n     * @param {number} [arity] The arity of `func`.\\n     * @returns {Function} Returns the new wrapped function.\\n     */\\n    function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {\\n      var isCurry = bitmask & CURRY_FLAG,\\n          newHolders = isCurry ? holders : undefined,\\n          newHoldersRight = isCurry ? undefined : holders,\\n          newPartials = isCurry ? partials : undefined,\\n          newPartialsRight = isCurry ? undefined : partials;\\n\\n      bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);\\n      bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);\\n\\n      if (!(bitmask & CURRY_BOUND_FLAG)) {\\n        bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);\\n      }\\n      var newData = [\\n        func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,\\n        newHoldersRight, argPos, ary, arity\\n      ];\\n\\n      var result = wrapFunc.apply(undefined, newData);\\n      if (isLaziable(func)) {\\n        setData(result, newData);\\n      }\\n      result.placeholder = placeholder;\\n      return result;\\n    }\\n\\n    /**\\n     * Creates a function like `_.round`.\\n     *\\n     * @private\\n     * @param {string} methodName The name of the `Math` method to use when rounding.\\n     * @returns {Function} Returns the new round function.\\n     */\\n    function createRound(methodName) {\\n      var func = Math[methodName];\\n      return function(number, precision) {\\n        number = toNumber(number);\\n        precision = toInteger(precision);\\n        if (precision) {\\n          // Shift with exponential notation to avoid floating-point issues.\\n          // See [MDN](https://mdn.io/round#Examples) for more details.\\n          var pair = (toString(number) + 'e').split('e'),\\n              value = func(pair[0] + 'e' + (+pair[1] + precision));\\n\\n          pair = (toString(value) + 'e').split('e');\\n          return +(pair[0] + 'e' + (+pair[1] - precision));\\n        }\\n        return func(number);\\n      };\\n    }\\n\\n    /**\\n     * Creates a set of `values`.\\n     *\\n     * @private\\n     * @param {Array} values The values to add to the set.\\n     * @returns {Object} Returns the new set.\\n     */\\n    var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) {\\n      return new Set(values);\\n    };\\n\\n    /**\\n     * Creates a function that either curries or invokes `func` with optional\\n     * `this` binding and partially applied arguments.\\n     *\\n     * @private\\n     * @param {Function|string} func The function or method name to wrap.\\n     * @param {number} bitmask The bitmask of wrapper flags.\\n     *  The bitmask may be composed of the following flags:\\n     *     1 - `_.bind`\\n     *     2 - `_.bindKey`\\n     *     4 - `_.curry` or `_.curryRight` of a bound function\\n     *     8 - `_.curry`\\n     *    16 - `_.curryRight`\\n     *    32 - `_.partial`\\n     *    64 - `_.partialRight`\\n     *   128 - `_.rearg`\\n     *   256 - `_.ary`\\n     * @param {*} [thisArg] The `this` binding of `func`.\\n     * @param {Array} [partials] The arguments to be partially applied.\\n     * @param {Array} [holders] The `partials` placeholder indexes.\\n     * @param {Array} [argPos] The argument positions of the new function.\\n     * @param {number} [ary] The arity cap of `func`.\\n     * @param {number} [arity] The arity of `func`.\\n     * @returns {Function} Returns the new wrapped function.\\n     */\\n    function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\\n      var isBindKey = bitmask & BIND_KEY_FLAG;\\n      if (!isBindKey && typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      var length = partials ? partials.length : 0;\\n      if (!length) {\\n        bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);\\n        partials = holders = undefined;\\n      }\\n      ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);\\n      arity = arity === undefined ? arity : toInteger(arity);\\n      length -= holders ? holders.length : 0;\\n\\n      if (bitmask & PARTIAL_RIGHT_FLAG) {\\n        var partialsRight = partials,\\n            holdersRight = holders;\\n\\n        partials = holders = undefined;\\n      }\\n      var data = isBindKey ? undefined : getData(func);\\n\\n      var newData = [\\n        func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,\\n        argPos, ary, arity\\n      ];\\n\\n      if (data) {\\n        mergeData(newData, data);\\n      }\\n      func = newData[0];\\n      bitmask = newData[1];\\n      thisArg = newData[2];\\n      partials = newData[3];\\n      holders = newData[4];\\n      arity = newData[9] = newData[9] == null\\n        ? (isBindKey ? 0 : func.length)\\n        : nativeMax(newData[9] - length, 0);\\n\\n      if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) {\\n        bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG);\\n      }\\n      if (!bitmask || bitmask == BIND_FLAG) {\\n        var result = createBaseWrapper(func, bitmask, thisArg);\\n      } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) {\\n        result = createCurryWrapper(func, bitmask, arity);\\n      } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {\\n        result = createPartialWrapper(func, bitmask, thisArg, partials);\\n      } else {\\n        result = createHybridWrapper.apply(undefined, newData);\\n      }\\n      var setter = data ? baseSetData : setData;\\n      return setter(result, newData);\\n    }\\n\\n    /**\\n     * A specialized version of `baseIsEqualDeep` for arrays with support for\\n     * partial deep comparisons.\\n     *\\n     * @private\\n     * @param {Array} array The array to compare.\\n     * @param {Array} other The other array to compare.\\n     * @param {Function} equalFunc The function to determine equivalents of values.\\n     * @param {Function} customizer The function to customize comparisons.\\n     * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`\\n     *  for more details.\\n     * @param {Object} stack Tracks traversed `array` and `other` objects.\\n     * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\\n     */\\n    function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {\\n      var index = -1,\\n          isPartial = bitmask & PARTIAL_COMPARE_FLAG,\\n          isUnordered = bitmask & UNORDERED_COMPARE_FLAG,\\n          arrLength = array.length,\\n          othLength = other.length;\\n\\n      if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\\n        return false;\\n      }\\n      // Assume cyclic values are equal.\\n      var stacked = stack.get(array);\\n      if (stacked) {\\n        return stacked == other;\\n      }\\n      var result = true;\\n      stack.set(array, other);\\n\\n      // Ignore non-index properties.\\n      while (++index < arrLength) {\\n        var arrValue = array[index],\\n            othValue = other[index];\\n\\n        if (customizer) {\\n          var compared = isPartial\\n            ? customizer(othValue, arrValue, index, other, array, stack)\\n            : customizer(arrValue, othValue, index, array, other, stack);\\n        }\\n        if (compared !== undefined) {\\n          if (compared) {\\n            continue;\\n          }\\n          result = false;\\n          break;\\n        }\\n        // Recursively compare arrays (susceptible to call stack limits).\\n        if (isUnordered) {\\n          if (!arraySome(other, function(othValue) {\\n                return arrValue === othValue ||\\n                  equalFunc(arrValue, othValue, customizer, bitmask, stack);\\n              })) {\\n            result = false;\\n            break;\\n          }\\n        } else if (!(\\n              arrValue === othValue ||\\n                equalFunc(arrValue, othValue, customizer, bitmask, stack)\\n            )) {\\n          result = false;\\n          break;\\n        }\\n      }\\n      stack['delete'](array);\\n      return result;\\n    }\\n\\n    /**\\n     * A specialized version of `baseIsEqualDeep` for comparing objects of\\n     * the same `toStringTag`.\\n     *\\n     * **Note:** This function only supports comparing values with tags of\\n     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\\n     *\\n     * @private\\n     * @param {Object} object The object to compare.\\n     * @param {Object} other The other object to compare.\\n     * @param {string} tag The `toStringTag` of the objects to compare.\\n     * @param {Function} equalFunc The function to determine equivalents of values.\\n     * @param {Function} customizer The function to customize comparisons.\\n     * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`\\n     *  for more details.\\n     * @param {Object} stack Tracks traversed `object` and `other` objects.\\n     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\\n     */\\n    function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {\\n      switch (tag) {\\n        case dataViewTag:\\n          if ((object.byteLength != other.byteLength) ||\\n              (object.byteOffset != other.byteOffset)) {\\n            return false;\\n          }\\n          object = object.buffer;\\n          other = other.buffer;\\n\\n        case arrayBufferTag:\\n          if ((object.byteLength != other.byteLength) ||\\n              !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\\n            return false;\\n          }\\n          return true;\\n\\n        case boolTag:\\n        case dateTag:\\n          // Coerce dates and booleans to numbers, dates to milliseconds and\\n          // booleans to `1` or `0` treating invalid dates coerced to `NaN` as\\n          // not equal.\\n          return +object == +other;\\n\\n        case errorTag:\\n          return object.name == other.name && object.message == other.message;\\n\\n        case numberTag:\\n          // Treat `NaN` vs. `NaN` as equal.\\n          return (object != +object) ? other != +other : object == +other;\\n\\n        case regexpTag:\\n        case stringTag:\\n          // Coerce regexes to strings and treat strings, primitives and objects,\\n          // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring\\n          // for more details.\\n          return object == (other + '');\\n\\n        case mapTag:\\n          var convert = mapToArray;\\n\\n        case setTag:\\n          var isPartial = bitmask & PARTIAL_COMPARE_FLAG;\\n          convert || (convert = setToArray);\\n\\n          if (object.size != other.size && !isPartial) {\\n            return false;\\n          }\\n          // Assume cyclic values are equal.\\n          var stacked = stack.get(object);\\n          if (stacked) {\\n            return stacked == other;\\n          }\\n          bitmask |= UNORDERED_COMPARE_FLAG;\\n          stack.set(object, other);\\n\\n          // Recursively compare objects (susceptible to call stack limits).\\n          return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);\\n\\n        case symbolTag:\\n          if (symbolValueOf) {\\n            return symbolValueOf.call(object) == symbolValueOf.call(other);\\n          }\\n      }\\n      return false;\\n    }\\n\\n    /**\\n     * A specialized version of `baseIsEqualDeep` for objects with support for\\n     * partial deep comparisons.\\n     *\\n     * @private\\n     * @param {Object} object The object to compare.\\n     * @param {Object} other The other object to compare.\\n     * @param {Function} equalFunc The function to determine equivalents of values.\\n     * @param {Function} customizer The function to customize comparisons.\\n     * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`\\n     *  for more details.\\n     * @param {Object} stack Tracks traversed `object` and `other` objects.\\n     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\\n     */\\n    function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {\\n      var isPartial = bitmask & PARTIAL_COMPARE_FLAG,\\n          objProps = keys(object),\\n          objLength = objProps.length,\\n          othProps = keys(other),\\n          othLength = othProps.length;\\n\\n      if (objLength != othLength && !isPartial) {\\n        return false;\\n      }\\n      var index = objLength;\\n      while (index--) {\\n        var key = objProps[index];\\n        if (!(isPartial ? key in other : baseHas(other, key))) {\\n          return false;\\n        }\\n      }\\n      // Assume cyclic values are equal.\\n      var stacked = stack.get(object);\\n      if (stacked) {\\n        return stacked == other;\\n      }\\n      var result = true;\\n      stack.set(object, other);\\n\\n      var skipCtor = isPartial;\\n      while (++index < objLength) {\\n        key = objProps[index];\\n        var objValue = object[key],\\n            othValue = other[key];\\n\\n        if (customizer) {\\n          var compared = isPartial\\n            ? customizer(othValue, objValue, key, other, object, stack)\\n            : customizer(objValue, othValue, key, object, other, stack);\\n        }\\n        // Recursively compare objects (susceptible to call stack limits).\\n        if (!(compared === undefined\\n              ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))\\n              : compared\\n            )) {\\n          result = false;\\n          break;\\n        }\\n        skipCtor || (skipCtor = key == 'constructor');\\n      }\\n      if (result && !skipCtor) {\\n        var objCtor = object.constructor,\\n            othCtor = other.constructor;\\n\\n        // Non `Object` object instances with different constructors are not equal.\\n        if (objCtor != othCtor &&\\n            ('constructor' in object && 'constructor' in other) &&\\n            !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\\n              typeof othCtor == 'function' && othCtor instanceof othCtor)) {\\n          result = false;\\n        }\\n      }\\n      stack['delete'](object);\\n      return result;\\n    }\\n\\n    /**\\n     * Creates an array of own enumerable property names and symbols of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property names and symbols.\\n     */\\n    function getAllKeys(object) {\\n      return baseGetAllKeys(object, keys, getSymbols);\\n    }\\n\\n    /**\\n     * Creates an array of own and inherited enumerable property names and\\n     * symbols of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property names and symbols.\\n     */\\n    function getAllKeysIn(object) {\\n      return baseGetAllKeys(object, keysIn, getSymbolsIn);\\n    }\\n\\n    /**\\n     * Gets metadata for `func`.\\n     *\\n     * @private\\n     * @param {Function} func The function to query.\\n     * @returns {*} Returns the metadata for `func`.\\n     */\\n    var getData = !metaMap ? noop : function(func) {\\n      return metaMap.get(func);\\n    };\\n\\n    /**\\n     * Gets the name of `func`.\\n     *\\n     * @private\\n     * @param {Function} func The function to query.\\n     * @returns {string} Returns the function name.\\n     */\\n    function getFuncName(func) {\\n      var result = (func.name + ''),\\n          array = realNames[result],\\n          length = hasOwnProperty.call(realNames, result) ? array.length : 0;\\n\\n      while (length--) {\\n        var data = array[length],\\n            otherFunc = data.func;\\n        if (otherFunc == null || otherFunc == func) {\\n          return data.name;\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Gets the appropriate \\\"iteratee\\\" function. If `_.iteratee` is customized,\\n     * this function returns the custom method, otherwise it returns `baseIteratee`.\\n     * If arguments are provided, the chosen function is invoked with them and\\n     * its result is returned.\\n     *\\n     * @private\\n     * @param {*} [value] The value to convert to an iteratee.\\n     * @param {number} [arity] The arity of the created iteratee.\\n     * @returns {Function} Returns the chosen function or its result.\\n     */\\n    function getIteratee() {\\n      var result = lodash.iteratee || iteratee;\\n      result = result === iteratee ? baseIteratee : result;\\n      return arguments.length ? result(arguments[0], arguments[1]) : result;\\n    }\\n\\n    /**\\n     * Gets the \\\"length\\\" property value of `object`.\\n     *\\n     * **Note:** This function is used to avoid a\\n     * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects\\n     * Safari on at least iOS 8.1-8.3 ARM64.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {*} Returns the \\\"length\\\" value.\\n     */\\n    var getLength = baseProperty('length');\\n\\n    /**\\n     * Gets the property names, values, and compare flags of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the match data of `object`.\\n     */\\n    function getMatchData(object) {\\n      var result = toPairs(object),\\n          length = result.length;\\n\\n      while (length--) {\\n        result[length][2] = isStrictComparable(result[length][1]);\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Gets the native function at `key` of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {string} key The key of the method to get.\\n     * @returns {*} Returns the function if it's native, else `undefined`.\\n     */\\n    function getNative(object, key) {\\n      var value = object[key];\\n      return isNative(value) ? value : undefined;\\n    }\\n\\n    /**\\n     * Gets the argument placeholder value for `func`.\\n     *\\n     * @private\\n     * @param {Function} func The function to inspect.\\n     * @returns {*} Returns the placeholder value.\\n     */\\n    function getPlaceholder(func) {\\n      var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;\\n      return object.placeholder;\\n    }\\n\\n    /**\\n     * Gets the `[[Prototype]]` of `value`.\\n     *\\n     * @private\\n     * @param {*} value The value to query.\\n     * @returns {null|Object} Returns the `[[Prototype]]`.\\n     */\\n    function getPrototype(value) {\\n      return nativeGetPrototype(Object(value));\\n    }\\n\\n    /**\\n     * Creates an array of the own enumerable symbol properties of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of symbols.\\n     */\\n    function getSymbols(object) {\\n      // Coerce `object` to an object to avoid non-object errors in V8.\\n      // See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details.\\n      return getOwnPropertySymbols(Object(object));\\n    }\\n\\n    // Fallback for IE < 11.\\n    if (!getOwnPropertySymbols) {\\n      getSymbols = function() {\\n        return [];\\n      };\\n    }\\n\\n    /**\\n     * Creates an array of the own and inherited enumerable symbol properties\\n     * of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of symbols.\\n     */\\n    var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {\\n      var result = [];\\n      while (object) {\\n        arrayPush(result, getSymbols(object));\\n        object = getPrototype(object);\\n      }\\n      return result;\\n    };\\n\\n    /**\\n     * Gets the `toStringTag` of `value`.\\n     *\\n     * @private\\n     * @param {*} value The value to query.\\n     * @returns {string} Returns the `toStringTag`.\\n     */\\n    function getTag(value) {\\n      return objectToString.call(value);\\n    }\\n\\n    // Fallback for data views, maps, sets, and weak maps in IE 11,\\n    // for data views in Edge, and promises in Node.js.\\n    if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\\n        (Map && getTag(new Map) != mapTag) ||\\n        (Promise && getTag(Promise.resolve()) != promiseTag) ||\\n        (Set && getTag(new Set) != setTag) ||\\n        (WeakMap && getTag(new WeakMap) != weakMapTag)) {\\n      getTag = function(value) {\\n        var result = objectToString.call(value),\\n            Ctor = result == objectTag ? value.constructor : undefined,\\n            ctorString = Ctor ? toSource(Ctor) : undefined;\\n\\n        if (ctorString) {\\n          switch (ctorString) {\\n            case dataViewCtorString: return dataViewTag;\\n            case mapCtorString: return mapTag;\\n            case promiseCtorString: return promiseTag;\\n            case setCtorString: return setTag;\\n            case weakMapCtorString: return weakMapTag;\\n          }\\n        }\\n        return result;\\n      };\\n    }\\n\\n    /**\\n     * Gets the view, applying any `transforms` to the `start` and `end` positions.\\n     *\\n     * @private\\n     * @param {number} start The start of the view.\\n     * @param {number} end The end of the view.\\n     * @param {Array} transforms The transformations to apply to the view.\\n     * @returns {Object} Returns an object containing the `start` and `end`\\n     *  positions of the view.\\n     */\\n    function getView(start, end, transforms) {\\n      var index = -1,\\n          length = transforms.length;\\n\\n      while (++index < length) {\\n        var data = transforms[index],\\n            size = data.size;\\n\\n        switch (data.type) {\\n          case 'drop':      start += size; break;\\n          case 'dropRight': end -= size; break;\\n          case 'take':      end = nativeMin(end, start + size); break;\\n          case 'takeRight': start = nativeMax(start, end - size); break;\\n        }\\n      }\\n      return { 'start': start, 'end': end };\\n    }\\n\\n    /**\\n     * Checks if `path` exists on `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path to check.\\n     * @param {Function} hasFunc The function to check properties.\\n     * @returns {boolean} Returns `true` if `path` exists, else `false`.\\n     */\\n    function hasPath(object, path, hasFunc) {\\n      path = isKey(path, object) ? [path] : castPath(path);\\n\\n      var result,\\n          index = -1,\\n          length = path.length;\\n\\n      while (++index < length) {\\n        var key = path[index];\\n        if (!(result = object != null && hasFunc(object, key))) {\\n          break;\\n        }\\n        object = object[key];\\n      }\\n      if (result) {\\n        return result;\\n      }\\n      var length = object ? object.length : 0;\\n      return !!length && isLength(length) && isIndex(key, length) &&\\n        (isArray(object) || isString(object) || isArguments(object));\\n    }\\n\\n    /**\\n     * Initializes an array clone.\\n     *\\n     * @private\\n     * @param {Array} array The array to clone.\\n     * @returns {Array} Returns the initialized clone.\\n     */\\n    function initCloneArray(array) {\\n      var length = array.length,\\n          result = array.constructor(length);\\n\\n      // Add properties assigned by `RegExp#exec`.\\n      if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\\n        result.index = array.index;\\n        result.input = array.input;\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Initializes an object clone.\\n     *\\n     * @private\\n     * @param {Object} object The object to clone.\\n     * @returns {Object} Returns the initialized clone.\\n     */\\n    function initCloneObject(object) {\\n      return (typeof object.constructor == 'function' && !isPrototype(object))\\n        ? baseCreate(getPrototype(object))\\n        : {};\\n    }\\n\\n    /**\\n     * Initializes an object clone based on its `toStringTag`.\\n     *\\n     * **Note:** This function only supports cloning values with tags of\\n     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\\n     *\\n     * @private\\n     * @param {Object} object The object to clone.\\n     * @param {string} tag The `toStringTag` of the object to clone.\\n     * @param {Function} cloneFunc The function to clone values.\\n     * @param {boolean} [isDeep] Specify a deep clone.\\n     * @returns {Object} Returns the initialized clone.\\n     */\\n    function initCloneByTag(object, tag, cloneFunc, isDeep) {\\n      var Ctor = object.constructor;\\n      switch (tag) {\\n        case arrayBufferTag:\\n          return cloneArrayBuffer(object);\\n\\n        case boolTag:\\n        case dateTag:\\n          return new Ctor(+object);\\n\\n        case dataViewTag:\\n          return cloneDataView(object, isDeep);\\n\\n        case float32Tag: case float64Tag:\\n        case int8Tag: case int16Tag: case int32Tag:\\n        case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\\n          return cloneTypedArray(object, isDeep);\\n\\n        case mapTag:\\n          return cloneMap(object, isDeep, cloneFunc);\\n\\n        case numberTag:\\n        case stringTag:\\n          return new Ctor(object);\\n\\n        case regexpTag:\\n          return cloneRegExp(object);\\n\\n        case setTag:\\n          return cloneSet(object, isDeep, cloneFunc);\\n\\n        case symbolTag:\\n          return cloneSymbol(object);\\n      }\\n    }\\n\\n    /**\\n     * Creates an array of index keys for `object` values of arrays,\\n     * `arguments` objects, and strings, otherwise `null` is returned.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @returns {Array|null} Returns index keys, else `null`.\\n     */\\n    function indexKeys(object) {\\n      var length = object ? object.length : undefined;\\n      if (isLength(length) &&\\n          (isArray(object) || isString(object) || isArguments(object))) {\\n        return baseTimes(length, String);\\n      }\\n      return null;\\n    }\\n\\n    /**\\n     * Checks if `value` is a flattenable `arguments` object or array.\\n     *\\n     * @private\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\\n     */\\n    function isFlattenable(value) {\\n      return isArrayLikeObject(value) && (isArray(value) || isArguments(value));\\n    }\\n\\n    /**\\n     * Checks if `value` is a flattenable array and not a `_.matchesProperty`\\n     * iteratee shorthand.\\n     *\\n     * @private\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\\n     */\\n    function isFlattenableIteratee(value) {\\n      return isArray(value) && !(value.length == 2 && !isFunction(value[0]));\\n    }\\n\\n    /**\\n     * Checks if the given arguments are from an iteratee call.\\n     *\\n     * @private\\n     * @param {*} value The potential iteratee value argument.\\n     * @param {*} index The potential iteratee index or key argument.\\n     * @param {*} object The potential iteratee object argument.\\n     * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\\n     *  else `false`.\\n     */\\n    function isIterateeCall(value, index, object) {\\n      if (!isObject(object)) {\\n        return false;\\n      }\\n      var type = typeof index;\\n      if (type == 'number'\\n            ? (isArrayLike(object) && isIndex(index, object.length))\\n            : (type == 'string' && index in object)\\n          ) {\\n        return eq(object[index], value);\\n      }\\n      return false;\\n    }\\n\\n    /**\\n     * Checks if `value` is a property name and not a property path.\\n     *\\n     * @private\\n     * @param {*} value The value to check.\\n     * @param {Object} [object] The object to query keys on.\\n     * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\\n     */\\n    function isKey(value, object) {\\n      var type = typeof value;\\n      if (type == 'number' || type == 'symbol') {\\n        return true;\\n      }\\n      return !isArray(value) &&\\n        (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\\n          (object != null && value in Object(object)));\\n    }\\n\\n    /**\\n     * Checks if `value` is suitable for use as unique object key.\\n     *\\n     * @private\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\\n     */\\n    function isKeyable(value) {\\n      var type = typeof value;\\n      return type == 'number' || type == 'boolean' ||\\n        (type == 'string' && value != '__proto__') || value == null;\\n    }\\n\\n    /**\\n     * Checks if `func` has a lazy counterpart.\\n     *\\n     * @private\\n     * @param {Function} func The function to check.\\n     * @returns {boolean} Returns `true` if `func` has a lazy counterpart,\\n     *  else `false`.\\n     */\\n    function isLaziable(func) {\\n      var funcName = getFuncName(func),\\n          other = lodash[funcName];\\n\\n      if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\\n        return false;\\n      }\\n      if (func === other) {\\n        return true;\\n      }\\n      var data = getData(other);\\n      return !!data && func === data[0];\\n    }\\n\\n    /**\\n     * Checks if `value` is likely a prototype object.\\n     *\\n     * @private\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\\n     */\\n    function isPrototype(value) {\\n      var Ctor = value && value.constructor,\\n          proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\\n\\n      return value === proto;\\n    }\\n\\n    /**\\n     * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\\n     *\\n     * @private\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` if suitable for strict\\n     *  equality comparisons, else `false`.\\n     */\\n    function isStrictComparable(value) {\\n      return value === value && !isObject(value);\\n    }\\n\\n    /**\\n     * A specialized version of `matchesProperty` for source values suitable\\n     * for strict equality comparisons, i.e. `===`.\\n     *\\n     * @private\\n     * @param {string} key The key of the property to get.\\n     * @param {*} srcValue The value to match.\\n     * @returns {Function} Returns the new function.\\n     */\\n    function matchesStrictComparable(key, srcValue) {\\n      return function(object) {\\n        if (object == null) {\\n          return false;\\n        }\\n        return object[key] === srcValue &&\\n          (srcValue !== undefined || (key in Object(object)));\\n      };\\n    }\\n\\n    /**\\n     * Merges the function metadata of `source` into `data`.\\n     *\\n     * Merging metadata reduces the number of wrappers used to invoke a function.\\n     * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\\n     * may be applied regardless of execution order. Methods like `_.ary` and\\n     * `_.rearg` modify function arguments, making the order in which they are\\n     * executed important, preventing the merging of metadata. However, we make\\n     * an exception for a safe combined case where curried functions have `_.ary`\\n     * and or `_.rearg` applied.\\n     *\\n     * @private\\n     * @param {Array} data The destination metadata.\\n     * @param {Array} source The source metadata.\\n     * @returns {Array} Returns `data`.\\n     */\\n    function mergeData(data, source) {\\n      var bitmask = data[1],\\n          srcBitmask = source[1],\\n          newBitmask = bitmask | srcBitmask,\\n          isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG);\\n\\n      var isCombo =\\n        ((srcBitmask == ARY_FLAG) && (bitmask == CURRY_FLAG)) ||\\n        ((srcBitmask == ARY_FLAG) && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) ||\\n        ((srcBitmask == (ARY_FLAG | REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG));\\n\\n      // Exit early if metadata can't be merged.\\n      if (!(isCommon || isCombo)) {\\n        return data;\\n      }\\n      // Use source `thisArg` if available.\\n      if (srcBitmask & BIND_FLAG) {\\n        data[2] = source[2];\\n        // Set when currying a bound function.\\n        newBitmask |= bitmask & BIND_FLAG ? 0 : CURRY_BOUND_FLAG;\\n      }\\n      // Compose partial arguments.\\n      var value = source[3];\\n      if (value) {\\n        var partials = data[3];\\n        data[3] = partials ? composeArgs(partials, value, source[4]) : value;\\n        data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];\\n      }\\n      // Compose partial right arguments.\\n      value = source[5];\\n      if (value) {\\n        partials = data[5];\\n        data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;\\n        data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];\\n      }\\n      // Use source `argPos` if available.\\n      value = source[7];\\n      if (value) {\\n        data[7] = value;\\n      }\\n      // Use source `ary` if it's smaller.\\n      if (srcBitmask & ARY_FLAG) {\\n        data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\\n      }\\n      // Use source `arity` if one is not provided.\\n      if (data[9] == null) {\\n        data[9] = source[9];\\n      }\\n      // Use source `func` and merge bitmasks.\\n      data[0] = source[0];\\n      data[1] = newBitmask;\\n\\n      return data;\\n    }\\n\\n    /**\\n     * Used by `_.defaultsDeep` to customize its `_.merge` use.\\n     *\\n     * @private\\n     * @param {*} objValue The destination value.\\n     * @param {*} srcValue The source value.\\n     * @param {string} key The key of the property to merge.\\n     * @param {Object} object The parent object of `objValue`.\\n     * @param {Object} source The parent object of `srcValue`.\\n     * @param {Object} [stack] Tracks traversed source values and their merged\\n     *  counterparts.\\n     * @returns {*} Returns the value to assign.\\n     */\\n    function mergeDefaults(objValue, srcValue, key, object, source, stack) {\\n      if (isObject(objValue) && isObject(srcValue)) {\\n        baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue));\\n      }\\n      return objValue;\\n    }\\n\\n    /**\\n     * Gets the parent value at `path` of `object`.\\n     *\\n     * @private\\n     * @param {Object} object The object to query.\\n     * @param {Array} path The path to get the parent value of.\\n     * @returns {*} Returns the parent value.\\n     */\\n    function parent(object, path) {\\n      return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\\n    }\\n\\n    /**\\n     * Reorder `array` according to the specified indexes where the element at\\n     * the first index is assigned as the first element, the element at\\n     * the second index is assigned as the second element, and so on.\\n     *\\n     * @private\\n     * @param {Array} array The array to reorder.\\n     * @param {Array} indexes The arranged array indexes.\\n     * @returns {Array} Returns `array`.\\n     */\\n    function reorder(array, indexes) {\\n      var arrLength = array.length,\\n          length = nativeMin(indexes.length, arrLength),\\n          oldArray = copyArray(array);\\n\\n      while (length--) {\\n        var index = indexes[length];\\n        array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\\n      }\\n      return array;\\n    }\\n\\n    /**\\n     * Sets metadata for `func`.\\n     *\\n     * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\\n     * period of time, it will trip its breaker and transition to an identity\\n     * function to avoid garbage collection pauses in V8. See\\n     * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)\\n     * for more details.\\n     *\\n     * @private\\n     * @param {Function} func The function to associate metadata with.\\n     * @param {*} data The metadata.\\n     * @returns {Function} Returns `func`.\\n     */\\n    var setData = (function() {\\n      var count = 0,\\n          lastCalled = 0;\\n\\n      return function(key, value) {\\n        var stamp = now(),\\n            remaining = HOT_SPAN - (stamp - lastCalled);\\n\\n        lastCalled = stamp;\\n        if (remaining > 0) {\\n          if (++count >= HOT_COUNT) {\\n            return key;\\n          }\\n        } else {\\n          count = 0;\\n        }\\n        return baseSetData(key, value);\\n      };\\n    }());\\n\\n    /**\\n     * Converts `string` to a property path array.\\n     *\\n     * @private\\n     * @param {string} string The string to convert.\\n     * @returns {Array} Returns the property path array.\\n     */\\n    var stringToPath = memoize(function(string) {\\n      var result = [];\\n      toString(string).replace(rePropName, function(match, number, quote, string) {\\n        result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\\n      });\\n      return result;\\n    });\\n\\n    /**\\n     * Converts `value` to a string key if it's not a string or symbol.\\n     *\\n     * @private\\n     * @param {*} value The value to inspect.\\n     * @returns {string|symbol} Returns the key.\\n     */\\n    function toKey(key) {\\n      return (typeof key == 'string' || isSymbol(key)) ? key : (key + '');\\n    }\\n\\n    /**\\n     * Converts `func` to its source code.\\n     *\\n     * @private\\n     * @param {Function} func The function to process.\\n     * @returns {string} Returns the source code.\\n     */\\n    function toSource(func) {\\n      if (func != null) {\\n        try {\\n          return funcToString.call(func);\\n        } catch (e) {}\\n        try {\\n          return (func + '');\\n        } catch (e) {}\\n      }\\n      return '';\\n    }\\n\\n    /**\\n     * Creates a clone of `wrapper`.\\n     *\\n     * @private\\n     * @param {Object} wrapper The wrapper to clone.\\n     * @returns {Object} Returns the cloned wrapper.\\n     */\\n    function wrapperClone(wrapper) {\\n      if (wrapper instanceof LazyWrapper) {\\n        return wrapper.clone();\\n      }\\n      var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);\\n      result.__actions__ = copyArray(wrapper.__actions__);\\n      result.__index__  = wrapper.__index__;\\n      result.__values__ = wrapper.__values__;\\n      return result;\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates an array of elements split into groups the length of `size`.\\n     * If `array` can't be split evenly, the final chunk will be the remaining\\n     * elements.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to process.\\n     * @param {number} [size=1] The length of each chunk\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Array} Returns the new array containing chunks.\\n     * @example\\n     *\\n     * _.chunk(['a', 'b', 'c', 'd'], 2);\\n     * // => [['a', 'b'], ['c', 'd']]\\n     *\\n     * _.chunk(['a', 'b', 'c', 'd'], 3);\\n     * // => [['a', 'b', 'c'], ['d']]\\n     */\\n    function chunk(array, size, guard) {\\n      if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {\\n        size = 1;\\n      } else {\\n        size = nativeMax(toInteger(size), 0);\\n      }\\n      var length = array ? array.length : 0;\\n      if (!length || size < 1) {\\n        return [];\\n      }\\n      var index = 0,\\n          resIndex = 0,\\n          result = Array(nativeCeil(length / size));\\n\\n      while (index < length) {\\n        result[resIndex++] = baseSlice(array, index, (index += size));\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Creates an array with all falsey values removed. The values `false`, `null`,\\n     * `0`, `\\\"\\\"`, `undefined`, and `NaN` are falsey.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to compact.\\n     * @returns {Array} Returns the new array of filtered values.\\n     * @example\\n     *\\n     * _.compact([0, 1, false, 2, '', 3]);\\n     * // => [1, 2, 3]\\n     */\\n    function compact(array) {\\n      var index = -1,\\n          length = array ? array.length : 0,\\n          resIndex = 0,\\n          result = [];\\n\\n      while (++index < length) {\\n        var value = array[index];\\n        if (value) {\\n          result[resIndex++] = value;\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Creates a new array concatenating `array` with any additional arrays\\n     * and/or values.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to concatenate.\\n     * @param {...*} [values] The values to concatenate.\\n     * @returns {Array} Returns the new concatenated array.\\n     * @example\\n     *\\n     * var array = [1];\\n     * var other = _.concat(array, 2, [3], [[4]]);\\n     *\\n     * console.log(other);\\n     * // => [1, 2, 3, [4]]\\n     *\\n     * console.log(array);\\n     * // => [1]\\n     */\\n    function concat() {\\n      var length = arguments.length,\\n          array = castArray(arguments[0]);\\n\\n      if (length < 2) {\\n        return length ? copyArray(array) : [];\\n      }\\n      var args = Array(length - 1);\\n      while (length--) {\\n        args[length - 1] = arguments[length];\\n      }\\n      return arrayConcat(array, baseFlatten(args, 1));\\n    }\\n\\n    /**\\n     * Creates an array of unique `array` values not included in the other given\\n     * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons. The order of result values is determined by the\\n     * order they occur in the first array.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @param {...Array} [values] The values to exclude.\\n     * @returns {Array} Returns the new array of filtered values.\\n     * @example\\n     *\\n     * _.difference([3, 2, 1], [4, 2]);\\n     * // => [3, 1]\\n     */\\n    var difference = rest(function(array, values) {\\n      return isArrayLikeObject(array)\\n        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\\n        : [];\\n    });\\n\\n    /**\\n     * This method is like `_.difference` except that it accepts `iteratee` which\\n     * is invoked for each element of `array` and `values` to generate the criterion\\n     * by which they're compared. Result values are chosen from the first array.\\n     * The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @param {...Array} [values] The values to exclude.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {Array} Returns the new array of filtered values.\\n     * @example\\n     *\\n     * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);\\n     * // => [3.1, 1.3]\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\\n     * // => [{ 'x': 2 }]\\n     */\\n    var differenceBy = rest(function(array, values) {\\n      var iteratee = last(values);\\n      if (isArrayLikeObject(iteratee)) {\\n        iteratee = undefined;\\n      }\\n      return isArrayLikeObject(array)\\n        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee))\\n        : [];\\n    });\\n\\n    /**\\n     * This method is like `_.difference` except that it accepts `comparator`\\n     * which is invoked to compare elements of `array` to `values`. Result values\\n     * are chosen from the first array. The comparator is invoked with two arguments:\\n     * (arrVal, othVal).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @param {...Array} [values] The values to exclude.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new array of filtered values.\\n     * @example\\n     *\\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\\n     *\\n     * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\\n     * // => [{ 'x': 2, 'y': 1 }]\\n     */\\n    var differenceWith = rest(function(array, values) {\\n      var comparator = last(values);\\n      if (isArrayLikeObject(comparator)) {\\n        comparator = undefined;\\n      }\\n      return isArrayLikeObject(array)\\n        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)\\n        : [];\\n    });\\n\\n    /**\\n     * Creates a slice of `array` with `n` elements dropped from the beginning.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.5.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {number} [n=1] The number of elements to drop.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * _.drop([1, 2, 3]);\\n     * // => [2, 3]\\n     *\\n     * _.drop([1, 2, 3], 2);\\n     * // => [3]\\n     *\\n     * _.drop([1, 2, 3], 5);\\n     * // => []\\n     *\\n     * _.drop([1, 2, 3], 0);\\n     * // => [1, 2, 3]\\n     */\\n    function drop(array, n, guard) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return [];\\n      }\\n      n = (guard || n === undefined) ? 1 : toInteger(n);\\n      return baseSlice(array, n < 0 ? 0 : n, length);\\n    }\\n\\n    /**\\n     * Creates a slice of `array` with `n` elements dropped from the end.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {number} [n=1] The number of elements to drop.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * _.dropRight([1, 2, 3]);\\n     * // => [1, 2]\\n     *\\n     * _.dropRight([1, 2, 3], 2);\\n     * // => [1]\\n     *\\n     * _.dropRight([1, 2, 3], 5);\\n     * // => []\\n     *\\n     * _.dropRight([1, 2, 3], 0);\\n     * // => [1, 2, 3]\\n     */\\n    function dropRight(array, n, guard) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return [];\\n      }\\n      n = (guard || n === undefined) ? 1 : toInteger(n);\\n      n = length - n;\\n      return baseSlice(array, 0, n < 0 ? 0 : n);\\n    }\\n\\n    /**\\n     * Creates a slice of `array` excluding elements dropped from the end.\\n     * Elements are dropped until `predicate` returns falsey. The predicate is\\n     * invoked with three arguments: (value, index, array).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'active': true },\\n     *   { 'user': 'fred',    'active': false },\\n     *   { 'user': 'pebbles', 'active': false }\\n     * ];\\n     *\\n     * _.dropRightWhile(users, function(o) { return !o.active; });\\n     * // => objects for ['barney']\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });\\n     * // => objects for ['barney', 'fred']\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.dropRightWhile(users, ['active', false]);\\n     * // => objects for ['barney']\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.dropRightWhile(users, 'active');\\n     * // => objects for ['barney', 'fred', 'pebbles']\\n     */\\n    function dropRightWhile(array, predicate) {\\n      return (array && array.length)\\n        ? baseWhile(array, getIteratee(predicate, 3), true, true)\\n        : [];\\n    }\\n\\n    /**\\n     * Creates a slice of `array` excluding elements dropped from the beginning.\\n     * Elements are dropped until `predicate` returns falsey. The predicate is\\n     * invoked with three arguments: (value, index, array).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'active': false },\\n     *   { 'user': 'fred',    'active': false },\\n     *   { 'user': 'pebbles', 'active': true }\\n     * ];\\n     *\\n     * _.dropWhile(users, function(o) { return !o.active; });\\n     * // => objects for ['pebbles']\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.dropWhile(users, { 'user': 'barney', 'active': false });\\n     * // => objects for ['fred', 'pebbles']\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.dropWhile(users, ['active', false]);\\n     * // => objects for ['pebbles']\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.dropWhile(users, 'active');\\n     * // => objects for ['barney', 'fred', 'pebbles']\\n     */\\n    function dropWhile(array, predicate) {\\n      return (array && array.length)\\n        ? baseWhile(array, getIteratee(predicate, 3), true)\\n        : [];\\n    }\\n\\n    /**\\n     * Fills elements of `array` with `value` from `start` up to, but not\\n     * including, `end`.\\n     *\\n     * **Note:** This method mutates `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.2.0\\n     * @category Array\\n     * @param {Array} array The array to fill.\\n     * @param {*} value The value to fill `array` with.\\n     * @param {number} [start=0] The start position.\\n     * @param {number} [end=array.length] The end position.\\n     * @returns {Array} Returns `array`.\\n     * @example\\n     *\\n     * var array = [1, 2, 3];\\n     *\\n     * _.fill(array, 'a');\\n     * console.log(array);\\n     * // => ['a', 'a', 'a']\\n     *\\n     * _.fill(Array(3), 2);\\n     * // => [2, 2, 2]\\n     *\\n     * _.fill([4, 6, 8, 10], '*', 1, 3);\\n     * // => [4, '*', '*', 10]\\n     */\\n    function fill(array, value, start, end) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return [];\\n      }\\n      if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\\n        start = 0;\\n        end = length;\\n      }\\n      return baseFill(array, value, start, end);\\n    }\\n\\n    /**\\n     * This method is like `_.find` except that it returns the index of the first\\n     * element `predicate` returns truthy for instead of the element itself.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.1.0\\n     * @category Array\\n     * @param {Array} array The array to search.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {number} Returns the index of the found element, else `-1`.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'active': false },\\n     *   { 'user': 'fred',    'active': false },\\n     *   { 'user': 'pebbles', 'active': true }\\n     * ];\\n     *\\n     * _.findIndex(users, function(o) { return o.user == 'barney'; });\\n     * // => 0\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.findIndex(users, { 'user': 'fred', 'active': false });\\n     * // => 1\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.findIndex(users, ['active', false]);\\n     * // => 0\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.findIndex(users, 'active');\\n     * // => 2\\n     */\\n    function findIndex(array, predicate) {\\n      return (array && array.length)\\n        ? baseFindIndex(array, getIteratee(predicate, 3))\\n        : -1;\\n    }\\n\\n    /**\\n     * This method is like `_.findIndex` except that it iterates over elements\\n     * of `collection` from right to left.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Array\\n     * @param {Array} array The array to search.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {number} Returns the index of the found element, else `-1`.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'active': true },\\n     *   { 'user': 'fred',    'active': false },\\n     *   { 'user': 'pebbles', 'active': false }\\n     * ];\\n     *\\n     * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });\\n     * // => 2\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.findLastIndex(users, { 'user': 'barney', 'active': true });\\n     * // => 0\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.findLastIndex(users, ['active', false]);\\n     * // => 2\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.findLastIndex(users, 'active');\\n     * // => 0\\n     */\\n    function findLastIndex(array, predicate) {\\n      return (array && array.length)\\n        ? baseFindIndex(array, getIteratee(predicate, 3), true)\\n        : -1;\\n    }\\n\\n    /**\\n     * Flattens `array` a single level deep.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to flatten.\\n     * @returns {Array} Returns the new flattened array.\\n     * @example\\n     *\\n     * _.flatten([1, [2, [3, [4]], 5]]);\\n     * // => [1, 2, [3, [4]], 5]\\n     */\\n    function flatten(array) {\\n      var length = array ? array.length : 0;\\n      return length ? baseFlatten(array, 1) : [];\\n    }\\n\\n    /**\\n     * Recursively flattens `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to flatten.\\n     * @returns {Array} Returns the new flattened array.\\n     * @example\\n     *\\n     * _.flattenDeep([1, [2, [3, [4]], 5]]);\\n     * // => [1, 2, 3, 4, 5]\\n     */\\n    function flattenDeep(array) {\\n      var length = array ? array.length : 0;\\n      return length ? baseFlatten(array, INFINITY) : [];\\n    }\\n\\n    /**\\n     * Recursively flatten `array` up to `depth` times.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.4.0\\n     * @category Array\\n     * @param {Array} array The array to flatten.\\n     * @param {number} [depth=1] The maximum recursion depth.\\n     * @returns {Array} Returns the new flattened array.\\n     * @example\\n     *\\n     * var array = [1, [2, [3, [4]], 5]];\\n     *\\n     * _.flattenDepth(array, 1);\\n     * // => [1, 2, [3, [4]], 5]\\n     *\\n     * _.flattenDepth(array, 2);\\n     * // => [1, 2, 3, [4], 5]\\n     */\\n    function flattenDepth(array, depth) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return [];\\n      }\\n      depth = depth === undefined ? 1 : toInteger(depth);\\n      return baseFlatten(array, depth);\\n    }\\n\\n    /**\\n     * The inverse of `_.toPairs`; this method returns an object composed\\n     * from key-value `pairs`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} pairs The key-value pairs.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * _.fromPairs([['fred', 30], ['barney', 40]]);\\n     * // => { 'fred': 30, 'barney': 40 }\\n     */\\n    function fromPairs(pairs) {\\n      var index = -1,\\n          length = pairs ? pairs.length : 0,\\n          result = {};\\n\\n      while (++index < length) {\\n        var pair = pairs[index];\\n        result[pair[0]] = pair[1];\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Gets the first element of `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @alias first\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @returns {*} Returns the first element of `array`.\\n     * @example\\n     *\\n     * _.head([1, 2, 3]);\\n     * // => 1\\n     *\\n     * _.head([]);\\n     * // => undefined\\n     */\\n    function head(array) {\\n      return (array && array.length) ? array[0] : undefined;\\n    }\\n\\n    /**\\n     * Gets the index at which the first occurrence of `value` is found in `array`\\n     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons. If `fromIndex` is negative, it's used as the\\n     * offset from the end of `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to search.\\n     * @param {*} value The value to search for.\\n     * @param {number} [fromIndex=0] The index to search from.\\n     * @returns {number} Returns the index of the matched value, else `-1`.\\n     * @example\\n     *\\n     * _.indexOf([1, 2, 1, 2], 2);\\n     * // => 1\\n     *\\n     * // Search from the `fromIndex`.\\n     * _.indexOf([1, 2, 1, 2], 2, 2);\\n     * // => 3\\n     */\\n    function indexOf(array, value, fromIndex) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return -1;\\n      }\\n      fromIndex = toInteger(fromIndex);\\n      if (fromIndex < 0) {\\n        fromIndex = nativeMax(length + fromIndex, 0);\\n      }\\n      return baseIndexOf(array, value, fromIndex);\\n    }\\n\\n    /**\\n     * Gets all but the last element of `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * _.initial([1, 2, 3]);\\n     * // => [1, 2]\\n     */\\n    function initial(array) {\\n      return dropRight(array, 1);\\n    }\\n\\n    /**\\n     * Creates an array of unique values that are included in all given arrays\\n     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons. The order of result values is determined by the\\n     * order they occur in the first array.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @returns {Array} Returns the new array of intersecting values.\\n     * @example\\n     *\\n     * _.intersection([2, 1], [4, 2], [1, 2]);\\n     * // => [2]\\n     */\\n    var intersection = rest(function(arrays) {\\n      var mapped = arrayMap(arrays, castArrayLikeObject);\\n      return (mapped.length && mapped[0] === arrays[0])\\n        ? baseIntersection(mapped)\\n        : [];\\n    });\\n\\n    /**\\n     * This method is like `_.intersection` except that it accepts `iteratee`\\n     * which is invoked for each element of each `arrays` to generate the criterion\\n     * by which they're compared. Result values are chosen from the first array.\\n     * The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {Array} Returns the new array of intersecting values.\\n     * @example\\n     *\\n     * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\\n     * // => [2.1]\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\\n     * // => [{ 'x': 1 }]\\n     */\\n    var intersectionBy = rest(function(arrays) {\\n      var iteratee = last(arrays),\\n          mapped = arrayMap(arrays, castArrayLikeObject);\\n\\n      if (iteratee === last(mapped)) {\\n        iteratee = undefined;\\n      } else {\\n        mapped.pop();\\n      }\\n      return (mapped.length && mapped[0] === arrays[0])\\n        ? baseIntersection(mapped, getIteratee(iteratee))\\n        : [];\\n    });\\n\\n    /**\\n     * This method is like `_.intersection` except that it accepts `comparator`\\n     * which is invoked to compare elements of `arrays`. Result values are chosen\\n     * from the first array. The comparator is invoked with two arguments:\\n     * (arrVal, othVal).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new array of intersecting values.\\n     * @example\\n     *\\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\\n     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\\n     *\\n     * _.intersectionWith(objects, others, _.isEqual);\\n     * // => [{ 'x': 1, 'y': 2 }]\\n     */\\n    var intersectionWith = rest(function(arrays) {\\n      var comparator = last(arrays),\\n          mapped = arrayMap(arrays, castArrayLikeObject);\\n\\n      if (comparator === last(mapped)) {\\n        comparator = undefined;\\n      } else {\\n        mapped.pop();\\n      }\\n      return (mapped.length && mapped[0] === arrays[0])\\n        ? baseIntersection(mapped, undefined, comparator)\\n        : [];\\n    });\\n\\n    /**\\n     * Converts all elements in `array` into a string separated by `separator`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to convert.\\n     * @param {string} [separator=','] The element separator.\\n     * @returns {string} Returns the joined string.\\n     * @example\\n     *\\n     * _.join(['a', 'b', 'c'], '~');\\n     * // => 'a~b~c'\\n     */\\n    function join(array, separator) {\\n      return array ? nativeJoin.call(array, separator) : '';\\n    }\\n\\n    /**\\n     * Gets the last element of `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @returns {*} Returns the last element of `array`.\\n     * @example\\n     *\\n     * _.last([1, 2, 3]);\\n     * // => 3\\n     */\\n    function last(array) {\\n      var length = array ? array.length : 0;\\n      return length ? array[length - 1] : undefined;\\n    }\\n\\n    /**\\n     * This method is like `_.indexOf` except that it iterates over elements of\\n     * `array` from right to left.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to search.\\n     * @param {*} value The value to search for.\\n     * @param {number} [fromIndex=array.length-1] The index to search from.\\n     * @returns {number} Returns the index of the matched value, else `-1`.\\n     * @example\\n     *\\n     * _.lastIndexOf([1, 2, 1, 2], 2);\\n     * // => 3\\n     *\\n     * // Search from the `fromIndex`.\\n     * _.lastIndexOf([1, 2, 1, 2], 2, 2);\\n     * // => 1\\n     */\\n    function lastIndexOf(array, value, fromIndex) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return -1;\\n      }\\n      var index = length;\\n      if (fromIndex !== undefined) {\\n        index = toInteger(fromIndex);\\n        index = (\\n          index < 0\\n            ? nativeMax(length + index, 0)\\n            : nativeMin(index, length - 1)\\n        ) + 1;\\n      }\\n      if (value !== value) {\\n        return indexOfNaN(array, index, true);\\n      }\\n      while (index--) {\\n        if (array[index] === value) {\\n          return index;\\n        }\\n      }\\n      return -1;\\n    }\\n\\n    /**\\n     * Gets the nth element of `array`. If `n` is negative, the nth element\\n     * from the end is returned.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.11.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {number} [n=0] The index of the element to return.\\n     * @returns {*} Returns the nth element of `array`.\\n     * @example\\n     *\\n     * var array = ['a', 'b', 'c', 'd'];\\n     *\\n     * _.nth(array, 1);\\n     * // => 'b'\\n     *\\n     * _.nth(array, -2);\\n     * // => 'c';\\n     */\\n    function nth(array, n) {\\n      return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;\\n    }\\n\\n    /**\\n     * Removes all given values from `array` using\\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons.\\n     *\\n     * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`\\n     * to remove elements from an array by predicate.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Array\\n     * @param {Array} array The array to modify.\\n     * @param {...*} [values] The values to remove.\\n     * @returns {Array} Returns `array`.\\n     * @example\\n     *\\n     * var array = [1, 2, 3, 1, 2, 3];\\n     *\\n     * _.pull(array, 2, 3);\\n     * console.log(array);\\n     * // => [1, 1]\\n     */\\n    var pull = rest(pullAll);\\n\\n    /**\\n     * This method is like `_.pull` except that it accepts an array of values to remove.\\n     *\\n     * **Note:** Unlike `_.difference`, this method mutates `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to modify.\\n     * @param {Array} values The values to remove.\\n     * @returns {Array} Returns `array`.\\n     * @example\\n     *\\n     * var array = [1, 2, 3, 1, 2, 3];\\n     *\\n     * _.pullAll(array, [2, 3]);\\n     * console.log(array);\\n     * // => [1, 1]\\n     */\\n    function pullAll(array, values) {\\n      return (array && array.length && values && values.length)\\n        ? basePullAll(array, values)\\n        : array;\\n    }\\n\\n    /**\\n     * This method is like `_.pullAll` except that it accepts `iteratee` which is\\n     * invoked for each element of `array` and `values` to generate the criterion\\n     * by which they're compared. The iteratee is invoked with one argument: (value).\\n     *\\n     * **Note:** Unlike `_.differenceBy`, this method mutates `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to modify.\\n     * @param {Array} values The values to remove.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {Array} Returns `array`.\\n     * @example\\n     *\\n     * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\\n     *\\n     * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\\n     * console.log(array);\\n     * // => [{ 'x': 2 }]\\n     */\\n    function pullAllBy(array, values, iteratee) {\\n      return (array && array.length && values && values.length)\\n        ? basePullAll(array, values, getIteratee(iteratee))\\n        : array;\\n    }\\n\\n    /**\\n     * This method is like `_.pullAll` except that it accepts `comparator` which\\n     * is invoked to compare elements of `array` to `values`. The comparator is\\n     * invoked with two arguments: (arrVal, othVal).\\n     *\\n     * **Note:** Unlike `_.differenceWith`, this method mutates `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.6.0\\n     * @category Array\\n     * @param {Array} array The array to modify.\\n     * @param {Array} values The values to remove.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns `array`.\\n     * @example\\n     *\\n     * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];\\n     *\\n     * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);\\n     * console.log(array);\\n     * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\\n     */\\n    function pullAllWith(array, values, comparator) {\\n      return (array && array.length && values && values.length)\\n        ? basePullAll(array, values, undefined, comparator)\\n        : array;\\n    }\\n\\n    /**\\n     * Removes elements from `array` corresponding to `indexes` and returns an\\n     * array of removed elements.\\n     *\\n     * **Note:** Unlike `_.at`, this method mutates `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to modify.\\n     * @param {...(number|number[])} [indexes] The indexes of elements to remove.\\n     * @returns {Array} Returns the new array of removed elements.\\n     * @example\\n     *\\n     * var array = [5, 10, 15, 20];\\n     * var evens = _.pullAt(array, 1, 3);\\n     *\\n     * console.log(array);\\n     * // => [5, 15]\\n     *\\n     * console.log(evens);\\n     * // => [10, 20]\\n     */\\n    var pullAt = rest(function(array, indexes) {\\n      indexes = arrayMap(baseFlatten(indexes, 1), String);\\n\\n      var result = baseAt(array, indexes);\\n      basePullAt(array, indexes.sort(compareAscending));\\n      return result;\\n    });\\n\\n    /**\\n     * Removes all elements from `array` that `predicate` returns truthy for\\n     * and returns an array of the removed elements. The predicate is invoked\\n     * with three arguments: (value, index, array).\\n     *\\n     * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`\\n     * to pull elements from an array by value.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Array\\n     * @param {Array} array The array to modify.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the new array of removed elements.\\n     * @example\\n     *\\n     * var array = [1, 2, 3, 4];\\n     * var evens = _.remove(array, function(n) {\\n     *   return n % 2 == 0;\\n     * });\\n     *\\n     * console.log(array);\\n     * // => [1, 3]\\n     *\\n     * console.log(evens);\\n     * // => [2, 4]\\n     */\\n    function remove(array, predicate) {\\n      var result = [];\\n      if (!(array && array.length)) {\\n        return result;\\n      }\\n      var index = -1,\\n          indexes = [],\\n          length = array.length;\\n\\n      predicate = getIteratee(predicate, 3);\\n      while (++index < length) {\\n        var value = array[index];\\n        if (predicate(value, index, array)) {\\n          result.push(value);\\n          indexes.push(index);\\n        }\\n      }\\n      basePullAt(array, indexes);\\n      return result;\\n    }\\n\\n    /**\\n     * Reverses `array` so that the first element becomes the last, the second\\n     * element becomes the second to last, and so on.\\n     *\\n     * **Note:** This method mutates `array` and is based on\\n     * [`Array#reverse`](https://mdn.io/Array/reverse).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to modify.\\n     * @returns {Array} Returns `array`.\\n     * @example\\n     *\\n     * var array = [1, 2, 3];\\n     *\\n     * _.reverse(array);\\n     * // => [3, 2, 1]\\n     *\\n     * console.log(array);\\n     * // => [3, 2, 1]\\n     */\\n    function reverse(array) {\\n      return array ? nativeReverse.call(array) : array;\\n    }\\n\\n    /**\\n     * Creates a slice of `array` from `start` up to, but not including, `end`.\\n     *\\n     * **Note:** This method is used instead of\\n     * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\\n     * returned.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to slice.\\n     * @param {number} [start=0] The start position.\\n     * @param {number} [end=array.length] The end position.\\n     * @returns {Array} Returns the slice of `array`.\\n     */\\n    function slice(array, start, end) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return [];\\n      }\\n      if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\\n        start = 0;\\n        end = length;\\n      }\\n      else {\\n        start = start == null ? 0 : toInteger(start);\\n        end = end === undefined ? length : toInteger(end);\\n      }\\n      return baseSlice(array, start, end);\\n    }\\n\\n    /**\\n     * Uses a binary search to determine the lowest index at which `value`\\n     * should be inserted into `array` in order to maintain its sort order.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The sorted array to inspect.\\n     * @param {*} value The value to evaluate.\\n     * @returns {number} Returns the index at which `value` should be inserted\\n     *  into `array`.\\n     * @example\\n     *\\n     * _.sortedIndex([30, 50], 40);\\n     * // => 1\\n     *\\n     * _.sortedIndex([4, 5], 4);\\n     * // => 0\\n     */\\n    function sortedIndex(array, value) {\\n      return baseSortedIndex(array, value);\\n    }\\n\\n    /**\\n     * This method is like `_.sortedIndex` except that it accepts `iteratee`\\n     * which is invoked for `value` and each element of `array` to compute their\\n     * sort ranking. The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The sorted array to inspect.\\n     * @param {*} value The value to evaluate.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {number} Returns the index at which `value` should be inserted\\n     *  into `array`.\\n     * @example\\n     *\\n     * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };\\n     *\\n     * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));\\n     * // => 1\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\\n     * // => 0\\n     */\\n    function sortedIndexBy(array, value, iteratee) {\\n      return baseSortedIndexBy(array, value, getIteratee(iteratee));\\n    }\\n\\n    /**\\n     * This method is like `_.indexOf` except that it performs a binary\\n     * search on a sorted `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to search.\\n     * @param {*} value The value to search for.\\n     * @returns {number} Returns the index of the matched value, else `-1`.\\n     * @example\\n     *\\n     * _.sortedIndexOf([1, 1, 2, 2], 2);\\n     * // => 2\\n     */\\n    function sortedIndexOf(array, value) {\\n      var length = array ? array.length : 0;\\n      if (length) {\\n        var index = baseSortedIndex(array, value);\\n        if (index < length && eq(array[index], value)) {\\n          return index;\\n        }\\n      }\\n      return -1;\\n    }\\n\\n    /**\\n     * This method is like `_.sortedIndex` except that it returns the highest\\n     * index at which `value` should be inserted into `array` in order to\\n     * maintain its sort order.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The sorted array to inspect.\\n     * @param {*} value The value to evaluate.\\n     * @returns {number} Returns the index at which `value` should be inserted\\n     *  into `array`.\\n     * @example\\n     *\\n     * _.sortedLastIndex([4, 5], 4);\\n     * // => 1\\n     */\\n    function sortedLastIndex(array, value) {\\n      return baseSortedIndex(array, value, true);\\n    }\\n\\n    /**\\n     * This method is like `_.sortedLastIndex` except that it accepts `iteratee`\\n     * which is invoked for `value` and each element of `array` to compute their\\n     * sort ranking. The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The sorted array to inspect.\\n     * @param {*} value The value to evaluate.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {number} Returns the index at which `value` should be inserted\\n     *  into `array`.\\n     * @example\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\\n     * // => 1\\n     */\\n    function sortedLastIndexBy(array, value, iteratee) {\\n      return baseSortedIndexBy(array, value, getIteratee(iteratee), true);\\n    }\\n\\n    /**\\n     * This method is like `_.lastIndexOf` except that it performs a binary\\n     * search on a sorted `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to search.\\n     * @param {*} value The value to search for.\\n     * @returns {number} Returns the index of the matched value, else `-1`.\\n     * @example\\n     *\\n     * _.sortedLastIndexOf([1, 1, 2, 2], 2);\\n     * // => 3\\n     */\\n    function sortedLastIndexOf(array, value) {\\n      var length = array ? array.length : 0;\\n      if (length) {\\n        var index = baseSortedIndex(array, value, true) - 1;\\n        if (eq(array[index], value)) {\\n          return index;\\n        }\\n      }\\n      return -1;\\n    }\\n\\n    /**\\n     * This method is like `_.uniq` except that it's designed and optimized\\n     * for sorted arrays.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @returns {Array} Returns the new duplicate free array.\\n     * @example\\n     *\\n     * _.sortedUniq([1, 1, 2]);\\n     * // => [1, 2]\\n     */\\n    function sortedUniq(array) {\\n      return (array && array.length)\\n        ? baseSortedUniq(array)\\n        : [];\\n    }\\n\\n    /**\\n     * This method is like `_.uniqBy` except that it's designed and optimized\\n     * for sorted arrays.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @param {Function} [iteratee] The iteratee invoked per element.\\n     * @returns {Array} Returns the new duplicate free array.\\n     * @example\\n     *\\n     * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\\n     * // => [1.1, 2.3]\\n     */\\n    function sortedUniqBy(array, iteratee) {\\n      return (array && array.length)\\n        ? baseSortedUniqBy(array, getIteratee(iteratee))\\n        : [];\\n    }\\n\\n    /**\\n     * Gets all but the first element of `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * _.tail([1, 2, 3]);\\n     * // => [2, 3]\\n     */\\n    function tail(array) {\\n      return drop(array, 1);\\n    }\\n\\n    /**\\n     * Creates a slice of `array` with `n` elements taken from the beginning.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {number} [n=1] The number of elements to take.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * _.take([1, 2, 3]);\\n     * // => [1]\\n     *\\n     * _.take([1, 2, 3], 2);\\n     * // => [1, 2]\\n     *\\n     * _.take([1, 2, 3], 5);\\n     * // => [1, 2, 3]\\n     *\\n     * _.take([1, 2, 3], 0);\\n     * // => []\\n     */\\n    function take(array, n, guard) {\\n      if (!(array && array.length)) {\\n        return [];\\n      }\\n      n = (guard || n === undefined) ? 1 : toInteger(n);\\n      return baseSlice(array, 0, n < 0 ? 0 : n);\\n    }\\n\\n    /**\\n     * Creates a slice of `array` with `n` elements taken from the end.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {number} [n=1] The number of elements to take.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * _.takeRight([1, 2, 3]);\\n     * // => [3]\\n     *\\n     * _.takeRight([1, 2, 3], 2);\\n     * // => [2, 3]\\n     *\\n     * _.takeRight([1, 2, 3], 5);\\n     * // => [1, 2, 3]\\n     *\\n     * _.takeRight([1, 2, 3], 0);\\n     * // => []\\n     */\\n    function takeRight(array, n, guard) {\\n      var length = array ? array.length : 0;\\n      if (!length) {\\n        return [];\\n      }\\n      n = (guard || n === undefined) ? 1 : toInteger(n);\\n      n = length - n;\\n      return baseSlice(array, n < 0 ? 0 : n, length);\\n    }\\n\\n    /**\\n     * Creates a slice of `array` with elements taken from the end. Elements are\\n     * taken until `predicate` returns falsey. The predicate is invoked with\\n     * three arguments: (value, index, array).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'active': true },\\n     *   { 'user': 'fred',    'active': false },\\n     *   { 'user': 'pebbles', 'active': false }\\n     * ];\\n     *\\n     * _.takeRightWhile(users, function(o) { return !o.active; });\\n     * // => objects for ['fred', 'pebbles']\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });\\n     * // => objects for ['pebbles']\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.takeRightWhile(users, ['active', false]);\\n     * // => objects for ['fred', 'pebbles']\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.takeRightWhile(users, 'active');\\n     * // => []\\n     */\\n    function takeRightWhile(array, predicate) {\\n      return (array && array.length)\\n        ? baseWhile(array, getIteratee(predicate, 3), false, true)\\n        : [];\\n    }\\n\\n    /**\\n     * Creates a slice of `array` with elements taken from the beginning. Elements\\n     * are taken until `predicate` returns falsey. The predicate is invoked with\\n     * three arguments: (value, index, array).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Array\\n     * @param {Array} array The array to query.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the slice of `array`.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'active': false },\\n     *   { 'user': 'fred',    'active': false},\\n     *   { 'user': 'pebbles', 'active': true }\\n     * ];\\n     *\\n     * _.takeWhile(users, function(o) { return !o.active; });\\n     * // => objects for ['barney', 'fred']\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.takeWhile(users, { 'user': 'barney', 'active': false });\\n     * // => objects for ['barney']\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.takeWhile(users, ['active', false]);\\n     * // => objects for ['barney', 'fred']\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.takeWhile(users, 'active');\\n     * // => []\\n     */\\n    function takeWhile(array, predicate) {\\n      return (array && array.length)\\n        ? baseWhile(array, getIteratee(predicate, 3))\\n        : [];\\n    }\\n\\n    /**\\n     * Creates an array of unique values, in order, from all given arrays using\\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @returns {Array} Returns the new array of combined values.\\n     * @example\\n     *\\n     * _.union([2, 1], [4, 2], [1, 2]);\\n     * // => [2, 1, 4]\\n     */\\n    var union = rest(function(arrays) {\\n      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\\n    });\\n\\n    /**\\n     * This method is like `_.union` except that it accepts `iteratee` which is\\n     * invoked for each element of each `arrays` to generate the criterion by\\n     * which uniqueness is computed. The iteratee is invoked with one argument:\\n     * (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {Array} Returns the new array of combined values.\\n     * @example\\n     *\\n     * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\\n     * // => [2.1, 1.2, 4.3]\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\\n     * // => [{ 'x': 1 }, { 'x': 2 }]\\n     */\\n    var unionBy = rest(function(arrays) {\\n      var iteratee = last(arrays);\\n      if (isArrayLikeObject(iteratee)) {\\n        iteratee = undefined;\\n      }\\n      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee));\\n    });\\n\\n    /**\\n     * This method is like `_.union` except that it accepts `comparator` which\\n     * is invoked to compare elements of `arrays`. The comparator is invoked\\n     * with two arguments: (arrVal, othVal).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new array of combined values.\\n     * @example\\n     *\\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\\n     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\\n     *\\n     * _.unionWith(objects, others, _.isEqual);\\n     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\\n     */\\n    var unionWith = rest(function(arrays) {\\n      var comparator = last(arrays);\\n      if (isArrayLikeObject(comparator)) {\\n        comparator = undefined;\\n      }\\n      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);\\n    });\\n\\n    /**\\n     * Creates a duplicate-free version of an array, using\\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons, in which only the first occurrence of each\\n     * element is kept.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @returns {Array} Returns the new duplicate free array.\\n     * @example\\n     *\\n     * _.uniq([2, 1, 2]);\\n     * // => [2, 1]\\n     */\\n    function uniq(array) {\\n      return (array && array.length)\\n        ? baseUniq(array)\\n        : [];\\n    }\\n\\n    /**\\n     * This method is like `_.uniq` except that it accepts `iteratee` which is\\n     * invoked for each element in `array` to generate the criterion by which\\n     * uniqueness is computed. The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {Array} Returns the new duplicate free array.\\n     * @example\\n     *\\n     * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\\n     * // => [2.1, 1.2]\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\\n     * // => [{ 'x': 1 }, { 'x': 2 }]\\n     */\\n    function uniqBy(array, iteratee) {\\n      return (array && array.length)\\n        ? baseUniq(array, getIteratee(iteratee))\\n        : [];\\n    }\\n\\n    /**\\n     * This method is like `_.uniq` except that it accepts `comparator` which\\n     * is invoked to compare elements of `array`. The comparator is invoked with\\n     * two arguments: (arrVal, othVal).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {Array} array The array to inspect.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new duplicate free array.\\n     * @example\\n     *\\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 },  { 'x': 1, 'y': 2 }];\\n     *\\n     * _.uniqWith(objects, _.isEqual);\\n     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\\n     */\\n    function uniqWith(array, comparator) {\\n      return (array && array.length)\\n        ? baseUniq(array, undefined, comparator)\\n        : [];\\n    }\\n\\n    /**\\n     * This method is like `_.zip` except that it accepts an array of grouped\\n     * elements and creates an array regrouping the elements to their pre-zip\\n     * configuration.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.2.0\\n     * @category Array\\n     * @param {Array} array The array of grouped elements to process.\\n     * @returns {Array} Returns the new array of regrouped elements.\\n     * @example\\n     *\\n     * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);\\n     * // => [['fred', 30, true], ['barney', 40, false]]\\n     *\\n     * _.unzip(zipped);\\n     * // => [['fred', 'barney'], [30, 40], [true, false]]\\n     */\\n    function unzip(array) {\\n      if (!(array && array.length)) {\\n        return [];\\n      }\\n      var length = 0;\\n      array = arrayFilter(array, function(group) {\\n        if (isArrayLikeObject(group)) {\\n          length = nativeMax(group.length, length);\\n          return true;\\n        }\\n      });\\n      return baseTimes(length, function(index) {\\n        return arrayMap(array, baseProperty(index));\\n      });\\n    }\\n\\n    /**\\n     * This method is like `_.unzip` except that it accepts `iteratee` to specify\\n     * how regrouped values should be combined. The iteratee is invoked with the\\n     * elements of each group: (...group).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.8.0\\n     * @category Array\\n     * @param {Array} array The array of grouped elements to process.\\n     * @param {Function} [iteratee=_.identity] The function to combine\\n     *  regrouped values.\\n     * @returns {Array} Returns the new array of regrouped elements.\\n     * @example\\n     *\\n     * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\\n     * // => [[1, 10, 100], [2, 20, 200]]\\n     *\\n     * _.unzipWith(zipped, _.add);\\n     * // => [3, 30, 300]\\n     */\\n    function unzipWith(array, iteratee) {\\n      if (!(array && array.length)) {\\n        return [];\\n      }\\n      var result = unzip(array);\\n      if (iteratee == null) {\\n        return result;\\n      }\\n      return arrayMap(result, function(group) {\\n        return apply(iteratee, undefined, group);\\n      });\\n    }\\n\\n    /**\\n     * Creates an array excluding all given values using\\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * for equality comparisons.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {Array} array The array to filter.\\n     * @param {...*} [values] The values to exclude.\\n     * @returns {Array} Returns the new array of filtered values.\\n     * @example\\n     *\\n     * _.without([1, 2, 1, 3], 1, 2);\\n     * // => [3]\\n     */\\n    var without = rest(function(array, values) {\\n      return isArrayLikeObject(array)\\n        ? baseDifference(array, values)\\n        : [];\\n    });\\n\\n    /**\\n     * Creates an array of unique values that is the\\n     * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\\n     * of the given arrays. The order of result values is determined by the order\\n     * they occur in the arrays.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.4.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @returns {Array} Returns the new array of values.\\n     * @example\\n     *\\n     * _.xor([2, 1], [4, 2]);\\n     * // => [1, 4]\\n     */\\n    var xor = rest(function(arrays) {\\n      return baseXor(arrayFilter(arrays, isArrayLikeObject));\\n    });\\n\\n    /**\\n     * This method is like `_.xor` except that it accepts `iteratee` which is\\n     * invoked for each element of each `arrays` to generate the criterion by\\n     * which by which they're compared. The iteratee is invoked with one argument:\\n     * (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {Array} Returns the new array of values.\\n     * @example\\n     *\\n     * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);\\n     * // => [1.2, 4.3]\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\\n     * // => [{ 'x': 2 }]\\n     */\\n    var xorBy = rest(function(arrays) {\\n      var iteratee = last(arrays);\\n      if (isArrayLikeObject(iteratee)) {\\n        iteratee = undefined;\\n      }\\n      return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee));\\n    });\\n\\n    /**\\n     * This method is like `_.xor` except that it accepts `comparator` which is\\n     * invoked to compare elements of `arrays`. The comparator is invoked with\\n     * two arguments: (arrVal, othVal).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to inspect.\\n     * @param {Function} [comparator] The comparator invoked per element.\\n     * @returns {Array} Returns the new array of values.\\n     * @example\\n     *\\n     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\\n     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\\n     *\\n     * _.xorWith(objects, others, _.isEqual);\\n     * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\\n     */\\n    var xorWith = rest(function(arrays) {\\n      var comparator = last(arrays);\\n      if (isArrayLikeObject(comparator)) {\\n        comparator = undefined;\\n      }\\n      return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);\\n    });\\n\\n    /**\\n     * Creates an array of grouped elements, the first of which contains the\\n     * first elements of the given arrays, the second of which contains the\\n     * second elements of the given arrays, and so on.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to process.\\n     * @returns {Array} Returns the new array of grouped elements.\\n     * @example\\n     *\\n     * _.zip(['fred', 'barney'], [30, 40], [true, false]);\\n     * // => [['fred', 30, true], ['barney', 40, false]]\\n     */\\n    var zip = rest(unzip);\\n\\n    /**\\n     * This method is like `_.fromPairs` except that it accepts two arrays,\\n     * one of property identifiers and one of corresponding values.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.4.0\\n     * @category Array\\n     * @param {Array} [props=[]] The property identifiers.\\n     * @param {Array} [values=[]] The property values.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * _.zipObject(['a', 'b'], [1, 2]);\\n     * // => { 'a': 1, 'b': 2 }\\n     */\\n    function zipObject(props, values) {\\n      return baseZipObject(props || [], values || [], assignValue);\\n    }\\n\\n    /**\\n     * This method is like `_.zipObject` except that it supports property paths.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.1.0\\n     * @category Array\\n     * @param {Array} [props=[]] The property identifiers.\\n     * @param {Array} [values=[]] The property values.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);\\n     * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\\n     */\\n    function zipObjectDeep(props, values) {\\n      return baseZipObject(props || [], values || [], baseSet);\\n    }\\n\\n    /**\\n     * This method is like `_.zip` except that it accepts `iteratee` to specify\\n     * how grouped values should be combined. The iteratee is invoked with the\\n     * elements of each group: (...group).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.8.0\\n     * @category Array\\n     * @param {...Array} [arrays] The arrays to process.\\n     * @param {Function} [iteratee=_.identity] The function to combine grouped values.\\n     * @returns {Array} Returns the new array of grouped elements.\\n     * @example\\n     *\\n     * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {\\n     *   return a + b + c;\\n     * });\\n     * // => [111, 222]\\n     */\\n    var zipWith = rest(function(arrays) {\\n      var length = arrays.length,\\n          iteratee = length > 1 ? arrays[length - 1] : undefined;\\n\\n      iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;\\n      return unzipWith(arrays, iteratee);\\n    });\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates a `lodash` wrapper instance that wraps `value` with explicit method\\n     * chain sequences enabled. The result of such sequences must be unwrapped\\n     * with `_#value`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.3.0\\n     * @category Seq\\n     * @param {*} value The value to wrap.\\n     * @returns {Object} Returns the new `lodash` wrapper instance.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'age': 36 },\\n     *   { 'user': 'fred',    'age': 40 },\\n     *   { 'user': 'pebbles', 'age': 1 }\\n     * ];\\n     *\\n     * var youngest = _\\n     *   .chain(users)\\n     *   .sortBy('age')\\n     *   .map(function(o) {\\n     *     return o.user + ' is ' + o.age;\\n     *   })\\n     *   .head()\\n     *   .value();\\n     * // => 'pebbles is 1'\\n     */\\n    function chain(value) {\\n      var result = lodash(value);\\n      result.__chain__ = true;\\n      return result;\\n    }\\n\\n    /**\\n     * This method invokes `interceptor` and returns `value`. The interceptor\\n     * is invoked with one argument; (value). The purpose of this method is to\\n     * \\\"tap into\\\" a method chain sequence in order to modify intermediate results.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Seq\\n     * @param {*} value The value to provide to `interceptor`.\\n     * @param {Function} interceptor The function to invoke.\\n     * @returns {*} Returns `value`.\\n     * @example\\n     *\\n     * _([1, 2, 3])\\n     *  .tap(function(array) {\\n     *    // Mutate input array.\\n     *    array.pop();\\n     *  })\\n     *  .reverse()\\n     *  .value();\\n     * // => [2, 1]\\n     */\\n    function tap(value, interceptor) {\\n      interceptor(value);\\n      return value;\\n    }\\n\\n    /**\\n     * This method is like `_.tap` except that it returns the result of `interceptor`.\\n     * The purpose of this method is to \\\"pass thru\\\" values replacing intermediate\\n     * results in a method chain sequence.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Seq\\n     * @param {*} value The value to provide to `interceptor`.\\n     * @param {Function} interceptor The function to invoke.\\n     * @returns {*} Returns the result of `interceptor`.\\n     * @example\\n     *\\n     * _('  abc  ')\\n     *  .chain()\\n     *  .trim()\\n     *  .thru(function(value) {\\n     *    return [value];\\n     *  })\\n     *  .value();\\n     * // => ['abc']\\n     */\\n    function thru(value, interceptor) {\\n      return interceptor(value);\\n    }\\n\\n    /**\\n     * This method is the wrapper version of `_.at`.\\n     *\\n     * @name at\\n     * @memberOf _\\n     * @since 1.0.0\\n     * @category Seq\\n     * @param {...(string|string[])} [paths] The property paths of elements to pick.\\n     * @returns {Object} Returns the new `lodash` wrapper instance.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\\n     *\\n     * _(object).at(['a[0].b.c', 'a[1]']).value();\\n     * // => [3, 4]\\n     *\\n     * _(['a', 'b', 'c']).at(0, 2).value();\\n     * // => ['a', 'c']\\n     */\\n    var wrapperAt = rest(function(paths) {\\n      paths = baseFlatten(paths, 1);\\n      var length = paths.length,\\n          start = length ? paths[0] : 0,\\n          value = this.__wrapped__,\\n          interceptor = function(object) { return baseAt(object, paths); };\\n\\n      if (length > 1 || this.__actions__.length ||\\n          !(value instanceof LazyWrapper) || !isIndex(start)) {\\n        return this.thru(interceptor);\\n      }\\n      value = value.slice(start, +start + (length ? 1 : 0));\\n      value.__actions__.push({\\n        'func': thru,\\n        'args': [interceptor],\\n        'thisArg': undefined\\n      });\\n      return new LodashWrapper(value, this.__chain__).thru(function(array) {\\n        if (length && !array.length) {\\n          array.push(undefined);\\n        }\\n        return array;\\n      });\\n    });\\n\\n    /**\\n     * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.\\n     *\\n     * @name chain\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Seq\\n     * @returns {Object} Returns the new `lodash` wrapper instance.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'age': 36 },\\n     *   { 'user': 'fred',   'age': 40 }\\n     * ];\\n     *\\n     * // A sequence without explicit chaining.\\n     * _(users).head();\\n     * // => { 'user': 'barney', 'age': 36 }\\n     *\\n     * // A sequence with explicit chaining.\\n     * _(users)\\n     *   .chain()\\n     *   .head()\\n     *   .pick('user')\\n     *   .value();\\n     * // => { 'user': 'barney' }\\n     */\\n    function wrapperChain() {\\n      return chain(this);\\n    }\\n\\n    /**\\n     * Executes the chain sequence and returns the wrapped result.\\n     *\\n     * @name commit\\n     * @memberOf _\\n     * @since 3.2.0\\n     * @category Seq\\n     * @returns {Object} Returns the new `lodash` wrapper instance.\\n     * @example\\n     *\\n     * var array = [1, 2];\\n     * var wrapped = _(array).push(3);\\n     *\\n     * console.log(array);\\n     * // => [1, 2]\\n     *\\n     * wrapped = wrapped.commit();\\n     * console.log(array);\\n     * // => [1, 2, 3]\\n     *\\n     * wrapped.last();\\n     * // => 3\\n     *\\n     * console.log(array);\\n     * // => [1, 2, 3]\\n     */\\n    function wrapperCommit() {\\n      return new LodashWrapper(this.value(), this.__chain__);\\n    }\\n\\n    /**\\n     * Gets the next value on a wrapped object following the\\n     * [iterator protocol](https://mdn.io/iteration_protocols#iterator).\\n     *\\n     * @name next\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Seq\\n     * @returns {Object} Returns the next iterator value.\\n     * @example\\n     *\\n     * var wrapped = _([1, 2]);\\n     *\\n     * wrapped.next();\\n     * // => { 'done': false, 'value': 1 }\\n     *\\n     * wrapped.next();\\n     * // => { 'done': false, 'value': 2 }\\n     *\\n     * wrapped.next();\\n     * // => { 'done': true, 'value': undefined }\\n     */\\n    function wrapperNext() {\\n      if (this.__values__ === undefined) {\\n        this.__values__ = toArray(this.value());\\n      }\\n      var done = this.__index__ >= this.__values__.length,\\n          value = done ? undefined : this.__values__[this.__index__++];\\n\\n      return { 'done': done, 'value': value };\\n    }\\n\\n    /**\\n     * Enables the wrapper to be iterable.\\n     *\\n     * @name Symbol.iterator\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Seq\\n     * @returns {Object} Returns the wrapper object.\\n     * @example\\n     *\\n     * var wrapped = _([1, 2]);\\n     *\\n     * wrapped[Symbol.iterator]() === wrapped;\\n     * // => true\\n     *\\n     * Array.from(wrapped);\\n     * // => [1, 2]\\n     */\\n    function wrapperToIterator() {\\n      return this;\\n    }\\n\\n    /**\\n     * Creates a clone of the chain sequence planting `value` as the wrapped value.\\n     *\\n     * @name plant\\n     * @memberOf _\\n     * @since 3.2.0\\n     * @category Seq\\n     * @param {*} value The value to plant.\\n     * @returns {Object} Returns the new `lodash` wrapper instance.\\n     * @example\\n     *\\n     * function square(n) {\\n     *   return n * n;\\n     * }\\n     *\\n     * var wrapped = _([1, 2]).map(square);\\n     * var other = wrapped.plant([3, 4]);\\n     *\\n     * other.value();\\n     * // => [9, 16]\\n     *\\n     * wrapped.value();\\n     * // => [1, 4]\\n     */\\n    function wrapperPlant(value) {\\n      var result,\\n          parent = this;\\n\\n      while (parent instanceof baseLodash) {\\n        var clone = wrapperClone(parent);\\n        clone.__index__ = 0;\\n        clone.__values__ = undefined;\\n        if (result) {\\n          previous.__wrapped__ = clone;\\n        } else {\\n          result = clone;\\n        }\\n        var previous = clone;\\n        parent = parent.__wrapped__;\\n      }\\n      previous.__wrapped__ = value;\\n      return result;\\n    }\\n\\n    /**\\n     * This method is the wrapper version of `_.reverse`.\\n     *\\n     * **Note:** This method mutates the wrapped array.\\n     *\\n     * @name reverse\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Seq\\n     * @returns {Object} Returns the new `lodash` wrapper instance.\\n     * @example\\n     *\\n     * var array = [1, 2, 3];\\n     *\\n     * _(array).reverse().value()\\n     * // => [3, 2, 1]\\n     *\\n     * console.log(array);\\n     * // => [3, 2, 1]\\n     */\\n    function wrapperReverse() {\\n      var value = this.__wrapped__;\\n      if (value instanceof LazyWrapper) {\\n        var wrapped = value;\\n        if (this.__actions__.length) {\\n          wrapped = new LazyWrapper(this);\\n        }\\n        wrapped = wrapped.reverse();\\n        wrapped.__actions__.push({\\n          'func': thru,\\n          'args': [reverse],\\n          'thisArg': undefined\\n        });\\n        return new LodashWrapper(wrapped, this.__chain__);\\n      }\\n      return this.thru(reverse);\\n    }\\n\\n    /**\\n     * Executes the chain sequence to resolve the unwrapped value.\\n     *\\n     * @name value\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @alias toJSON, valueOf\\n     * @category Seq\\n     * @returns {*} Returns the resolved unwrapped value.\\n     * @example\\n     *\\n     * _([1, 2, 3]).value();\\n     * // => [1, 2, 3]\\n     */\\n    function wrapperValue() {\\n      return baseWrapperValue(this.__wrapped__, this.__actions__);\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Creates an object composed of keys generated from the results of running\\n     * each element of `collection` thru `iteratee`. The corresponding value of\\n     * each key is the number of times the key was returned by `iteratee`. The\\n     * iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.5.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee to transform keys.\\n     * @returns {Object} Returns the composed aggregate object.\\n     * @example\\n     *\\n     * _.countBy([6.1, 4.2, 6.3], Math.floor);\\n     * // => { '4': 1, '6': 2 }\\n     *\\n     * _.countBy(['one', 'two', 'three'], 'length');\\n     * // => { '3': 2, '5': 1 }\\n     */\\n    var countBy = createAggregator(function(result, value, key) {\\n      hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);\\n    });\\n\\n    /**\\n     * Checks if `predicate` returns truthy for **all** elements of `collection`.\\n     * Iteration is stopped once `predicate` returns falsey. The predicate is\\n     * invoked with three arguments: (value, index|key, collection).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {boolean} Returns `true` if all elements pass the predicate check,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.every([true, 1, null, 'yes'], Boolean);\\n     * // => false\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'age': 36, 'active': false },\\n     *   { 'user': 'fred',   'age': 40, 'active': false }\\n     * ];\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.every(users, { 'user': 'barney', 'active': false });\\n     * // => false\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.every(users, ['active', false]);\\n     * // => true\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.every(users, 'active');\\n     * // => false\\n     */\\n    function every(collection, predicate, guard) {\\n      var func = isArray(collection) ? arrayEvery : baseEvery;\\n      if (guard && isIterateeCall(collection, predicate, guard)) {\\n        predicate = undefined;\\n      }\\n      return func(collection, getIteratee(predicate, 3));\\n    }\\n\\n    /**\\n     * Iterates over elements of `collection`, returning an array of all elements\\n     * `predicate` returns truthy for. The predicate is invoked with three\\n     * arguments: (value, index|key, collection).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the new filtered array.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'age': 36, 'active': true },\\n     *   { 'user': 'fred',   'age': 40, 'active': false }\\n     * ];\\n     *\\n     * _.filter(users, function(o) { return !o.active; });\\n     * // => objects for ['fred']\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.filter(users, { 'age': 36, 'active': true });\\n     * // => objects for ['barney']\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.filter(users, ['active', false]);\\n     * // => objects for ['fred']\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.filter(users, 'active');\\n     * // => objects for ['barney']\\n     */\\n    function filter(collection, predicate) {\\n      var func = isArray(collection) ? arrayFilter : baseFilter;\\n      return func(collection, getIteratee(predicate, 3));\\n    }\\n\\n    /**\\n     * Iterates over elements of `collection`, returning the first element\\n     * `predicate` returns truthy for. The predicate is invoked with three\\n     * arguments: (value, index|key, collection).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to search.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {*} Returns the matched element, else `undefined`.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'age': 36, 'active': true },\\n     *   { 'user': 'fred',    'age': 40, 'active': false },\\n     *   { 'user': 'pebbles', 'age': 1,  'active': true }\\n     * ];\\n     *\\n     * _.find(users, function(o) { return o.age < 40; });\\n     * // => object for 'barney'\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.find(users, { 'age': 1, 'active': true });\\n     * // => object for 'pebbles'\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.find(users, ['active', false]);\\n     * // => object for 'fred'\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.find(users, 'active');\\n     * // => object for 'barney'\\n     */\\n    function find(collection, predicate) {\\n      predicate = getIteratee(predicate, 3);\\n      if (isArray(collection)) {\\n        var index = baseFindIndex(collection, predicate);\\n        return index > -1 ? collection[index] : undefined;\\n      }\\n      return baseFind(collection, predicate, baseEach);\\n    }\\n\\n    /**\\n     * This method is like `_.find` except that it iterates over elements of\\n     * `collection` from right to left.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to search.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {*} Returns the matched element, else `undefined`.\\n     * @example\\n     *\\n     * _.findLast([1, 2, 3, 4], function(n) {\\n     *   return n % 2 == 1;\\n     * });\\n     * // => 3\\n     */\\n    function findLast(collection, predicate) {\\n      predicate = getIteratee(predicate, 3);\\n      if (isArray(collection)) {\\n        var index = baseFindIndex(collection, predicate, true);\\n        return index > -1 ? collection[index] : undefined;\\n      }\\n      return baseFind(collection, predicate, baseEachRight);\\n    }\\n\\n    /**\\n     * Creates a flattened array of values by running each element in `collection`\\n     * thru `iteratee` and flattening the mapped results. The iteratee is invoked\\n     * with three arguments: (value, index|key, collection).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the new flattened array.\\n     * @example\\n     *\\n     * function duplicate(n) {\\n     *   return [n, n];\\n     * }\\n     *\\n     * _.flatMap([1, 2], duplicate);\\n     * // => [1, 1, 2, 2]\\n     */\\n    function flatMap(collection, iteratee) {\\n      return baseFlatten(map(collection, iteratee), 1);\\n    }\\n\\n    /**\\n     * This method is like `_.flatMap` except that it recursively flattens the\\n     * mapped results.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.7.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the new flattened array.\\n     * @example\\n     *\\n     * function duplicate(n) {\\n     *   return [[[n, n]]];\\n     * }\\n     *\\n     * _.flatMapDeep([1, 2], duplicate);\\n     * // => [1, 1, 2, 2]\\n     */\\n    function flatMapDeep(collection, iteratee) {\\n      return baseFlatten(map(collection, iteratee), INFINITY);\\n    }\\n\\n    /**\\n     * This method is like `_.flatMap` except that it recursively flattens the\\n     * mapped results up to `depth` times.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.7.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The function invoked per iteration.\\n     * @param {number} [depth=1] The maximum recursion depth.\\n     * @returns {Array} Returns the new flattened array.\\n     * @example\\n     *\\n     * function duplicate(n) {\\n     *   return [[[n, n]]];\\n     * }\\n     *\\n     * _.flatMapDepth([1, 2], duplicate, 2);\\n     * // => [[1, 1], [2, 2]]\\n     */\\n    function flatMapDepth(collection, iteratee, depth) {\\n      depth = depth === undefined ? 1 : toInteger(depth);\\n      return baseFlatten(map(collection, iteratee), depth);\\n    }\\n\\n    /**\\n     * Iterates over elements of `collection` and invokes `iteratee` for each element.\\n     * The iteratee is invoked with three arguments: (value, index|key, collection).\\n     * Iteratee functions may exit iteration early by explicitly returning `false`.\\n     *\\n     * **Note:** As with other \\\"Collections\\\" methods, objects with a \\\"length\\\"\\n     * property are iterated like arrays. To avoid this behavior use `_.forIn`\\n     * or `_.forOwn` for object iteration.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @alias each\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @returns {Array|Object} Returns `collection`.\\n     * @example\\n     *\\n     * _([1, 2]).forEach(function(value) {\\n     *   console.log(value);\\n     * });\\n     * // => Logs `1` then `2`.\\n     *\\n     * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\\n     *   console.log(key);\\n     * });\\n     * // => Logs 'a' then 'b' (iteration order is not guaranteed).\\n     */\\n    function forEach(collection, iteratee) {\\n      return (typeof iteratee == 'function' && isArray(collection))\\n        ? arrayEach(collection, iteratee)\\n        : baseEach(collection, getIteratee(iteratee));\\n    }\\n\\n    /**\\n     * This method is like `_.forEach` except that it iterates over elements of\\n     * `collection` from right to left.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @alias eachRight\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @returns {Array|Object} Returns `collection`.\\n     * @example\\n     *\\n     * _.forEachRight([1, 2], function(value) {\\n     *   console.log(value);\\n     * });\\n     * // => Logs `2` then `1`.\\n     */\\n    function forEachRight(collection, iteratee) {\\n      return (typeof iteratee == 'function' && isArray(collection))\\n        ? arrayEachRight(collection, iteratee)\\n        : baseEachRight(collection, getIteratee(iteratee));\\n    }\\n\\n    /**\\n     * Creates an object composed of keys generated from the results of running\\n     * each element of `collection` thru `iteratee`. The order of grouped values\\n     * is determined by the order they occur in `collection`. The corresponding\\n     * value of each key is an array of elements responsible for generating the\\n     * key. The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee to transform keys.\\n     * @returns {Object} Returns the composed aggregate object.\\n     * @example\\n     *\\n     * _.groupBy([6.1, 4.2, 6.3], Math.floor);\\n     * // => { '4': [4.2], '6': [6.1, 6.3] }\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.groupBy(['one', 'two', 'three'], 'length');\\n     * // => { '3': ['one', 'two'], '5': ['three'] }\\n     */\\n    var groupBy = createAggregator(function(result, value, key) {\\n      if (hasOwnProperty.call(result, key)) {\\n        result[key].push(value);\\n      } else {\\n        result[key] = [value];\\n      }\\n    });\\n\\n    /**\\n     * Checks if `value` is in `collection`. If `collection` is a string, it's\\n     * checked for a substring of `value`, otherwise\\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * is used for equality comparisons. If `fromIndex` is negative, it's used as\\n     * the offset from the end of `collection`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object|string} collection The collection to search.\\n     * @param {*} value The value to search for.\\n     * @param {number} [fromIndex=0] The index to search from.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\\n     * @returns {boolean} Returns `true` if `value` is found, else `false`.\\n     * @example\\n     *\\n     * _.includes([1, 2, 3], 1);\\n     * // => true\\n     *\\n     * _.includes([1, 2, 3], 1, 2);\\n     * // => false\\n     *\\n     * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');\\n     * // => true\\n     *\\n     * _.includes('pebbles', 'eb');\\n     * // => true\\n     */\\n    function includes(collection, value, fromIndex, guard) {\\n      collection = isArrayLike(collection) ? collection : values(collection);\\n      fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\\n\\n      var length = collection.length;\\n      if (fromIndex < 0) {\\n        fromIndex = nativeMax(length + fromIndex, 0);\\n      }\\n      return isString(collection)\\n        ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\\n        : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\\n    }\\n\\n    /**\\n     * Invokes the method at `path` of each element in `collection`, returning\\n     * an array of the results of each invoked method. Any additional arguments\\n     * are provided to each invoked method. If `methodName` is a function, it's\\n     * invoked for and `this` bound to, each element in `collection`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|string} path The path of the method to invoke or\\n     *  the function invoked per iteration.\\n     * @param {...*} [args] The arguments to invoke each method with.\\n     * @returns {Array} Returns the array of results.\\n     * @example\\n     *\\n     * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\\n     * // => [[1, 5, 7], [1, 2, 3]]\\n     *\\n     * _.invokeMap([123, 456], String.prototype.split, '');\\n     * // => [['1', '2', '3'], ['4', '5', '6']]\\n     */\\n    var invokeMap = rest(function(collection, path, args) {\\n      var index = -1,\\n          isFunc = typeof path == 'function',\\n          isProp = isKey(path),\\n          result = isArrayLike(collection) ? Array(collection.length) : [];\\n\\n      baseEach(collection, function(value) {\\n        var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);\\n        result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args);\\n      });\\n      return result;\\n    });\\n\\n    /**\\n     * Creates an object composed of keys generated from the results of running\\n     * each element of `collection` thru `iteratee`. The corresponding value of\\n     * each key is the last element responsible for generating the key. The\\n     * iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee to transform keys.\\n     * @returns {Object} Returns the composed aggregate object.\\n     * @example\\n     *\\n     * var array = [\\n     *   { 'dir': 'left', 'code': 97 },\\n     *   { 'dir': 'right', 'code': 100 }\\n     * ];\\n     *\\n     * _.keyBy(array, function(o) {\\n     *   return String.fromCharCode(o.code);\\n     * });\\n     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\\n     *\\n     * _.keyBy(array, 'dir');\\n     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\\n     */\\n    var keyBy = createAggregator(function(result, value, key) {\\n      result[key] = value;\\n    });\\n\\n    /**\\n     * Creates an array of values by running each element in `collection` thru\\n     * `iteratee`. The iteratee is invoked with three arguments:\\n     * (value, index|key, collection).\\n     *\\n     * Many lodash methods are guarded to work as iteratees for methods like\\n     * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\\n     *\\n     * The guarded methods are:\\n     * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\\n     * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\\n     * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\\n     * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the new mapped array.\\n     * @example\\n     *\\n     * function square(n) {\\n     *   return n * n;\\n     * }\\n     *\\n     * _.map([4, 8], square);\\n     * // => [16, 64]\\n     *\\n     * _.map({ 'a': 4, 'b': 8 }, square);\\n     * // => [16, 64] (iteration order is not guaranteed)\\n     *\\n     * var users = [\\n     *   { 'user': 'barney' },\\n     *   { 'user': 'fred' }\\n     * ];\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.map(users, 'user');\\n     * // => ['barney', 'fred']\\n     */\\n    function map(collection, iteratee) {\\n      var func = isArray(collection) ? arrayMap : baseMap;\\n      return func(collection, getIteratee(iteratee, 3));\\n    }\\n\\n    /**\\n     * This method is like `_.sortBy` except that it allows specifying the sort\\n     * orders of the iteratees to sort by. If `orders` is unspecified, all values\\n     * are sorted in ascending order. Otherwise, specify an order of \\\"desc\\\" for\\n     * descending or \\\"asc\\\" for ascending sort order of corresponding values.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]\\n     *  The iteratees to sort by.\\n     * @param {string[]} [orders] The sort orders of `iteratees`.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\\n     * @returns {Array} Returns the new sorted array.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'fred',   'age': 48 },\\n     *   { 'user': 'barney', 'age': 34 },\\n     *   { 'user': 'fred',   'age': 40 },\\n     *   { 'user': 'barney', 'age': 36 }\\n     * ];\\n     *\\n     * // Sort by `user` in ascending order and by `age` in descending order.\\n     * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);\\n     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\\n     */\\n    function orderBy(collection, iteratees, orders, guard) {\\n      if (collection == null) {\\n        return [];\\n      }\\n      if (!isArray(iteratees)) {\\n        iteratees = iteratees == null ? [] : [iteratees];\\n      }\\n      orders = guard ? undefined : orders;\\n      if (!isArray(orders)) {\\n        orders = orders == null ? [] : [orders];\\n      }\\n      return baseOrderBy(collection, iteratees, orders);\\n    }\\n\\n    /**\\n     * Creates an array of elements split into two groups, the first of which\\n     * contains elements `predicate` returns truthy for, the second of which\\n     * contains elements `predicate` returns falsey for. The predicate is\\n     * invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the array of grouped elements.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney',  'age': 36, 'active': false },\\n     *   { 'user': 'fred',    'age': 40, 'active': true },\\n     *   { 'user': 'pebbles', 'age': 1,  'active': false }\\n     * ];\\n     *\\n     * _.partition(users, function(o) { return o.active; });\\n     * // => objects for [['fred'], ['barney', 'pebbles']]\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.partition(users, { 'age': 1, 'active': false });\\n     * // => objects for [['pebbles'], ['barney', 'fred']]\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.partition(users, ['active', false]);\\n     * // => objects for [['barney', 'pebbles'], ['fred']]\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.partition(users, 'active');\\n     * // => objects for [['fred'], ['barney', 'pebbles']]\\n     */\\n    var partition = createAggregator(function(result, value, key) {\\n      result[key ? 0 : 1].push(value);\\n    }, function() { return [[], []]; });\\n\\n    /**\\n     * Reduces `collection` to a value which is the accumulated result of running\\n     * each element in `collection` thru `iteratee`, where each successive\\n     * invocation is supplied the return value of the previous. If `accumulator`\\n     * is not given, the first element of `collection` is used as the initial\\n     * value. The iteratee is invoked with four arguments:\\n     * (accumulator, value, index|key, collection).\\n     *\\n     * Many lodash methods are guarded to work as iteratees for methods like\\n     * `_.reduce`, `_.reduceRight`, and `_.transform`.\\n     *\\n     * The guarded methods are:\\n     * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\\n     * and `sortBy`\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @param {*} [accumulator] The initial value.\\n     * @returns {*} Returns the accumulated value.\\n     * @example\\n     *\\n     * _.reduce([1, 2], function(sum, n) {\\n     *   return sum + n;\\n     * }, 0);\\n     * // => 3\\n     *\\n     * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\\n     *   (result[value] || (result[value] = [])).push(key);\\n     *   return result;\\n     * }, {});\\n     * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\\n     */\\n    function reduce(collection, iteratee, accumulator) {\\n      var func = isArray(collection) ? arrayReduce : baseReduce,\\n          initAccum = arguments.length < 3;\\n\\n      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);\\n    }\\n\\n    /**\\n     * This method is like `_.reduce` except that it iterates over elements of\\n     * `collection` from right to left.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @param {*} [accumulator] The initial value.\\n     * @returns {*} Returns the accumulated value.\\n     * @example\\n     *\\n     * var array = [[0, 1], [2, 3], [4, 5]];\\n     *\\n     * _.reduceRight(array, function(flattened, other) {\\n     *   return flattened.concat(other);\\n     * }, []);\\n     * // => [4, 5, 2, 3, 0, 1]\\n     */\\n    function reduceRight(collection, iteratee, accumulator) {\\n      var func = isArray(collection) ? arrayReduceRight : baseReduce,\\n          initAccum = arguments.length < 3;\\n\\n      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);\\n    }\\n\\n    /**\\n     * The opposite of `_.filter`; this method returns the elements of `collection`\\n     * that `predicate` does **not** return truthy for.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Array} Returns the new filtered array.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'age': 36, 'active': false },\\n     *   { 'user': 'fred',   'age': 40, 'active': true }\\n     * ];\\n     *\\n     * _.reject(users, function(o) { return !o.active; });\\n     * // => objects for ['fred']\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.reject(users, { 'age': 40, 'active': true });\\n     * // => objects for ['barney']\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.reject(users, ['active', false]);\\n     * // => objects for ['fred']\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.reject(users, 'active');\\n     * // => objects for ['barney']\\n     */\\n    function reject(collection, predicate) {\\n      var func = isArray(collection) ? arrayFilter : baseFilter;\\n      predicate = getIteratee(predicate, 3);\\n      return func(collection, function(value, index, collection) {\\n        return !predicate(value, index, collection);\\n      });\\n    }\\n\\n    /**\\n     * Gets a random element from `collection`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to sample.\\n     * @returns {*} Returns the random element.\\n     * @example\\n     *\\n     * _.sample([1, 2, 3, 4]);\\n     * // => 2\\n     */\\n    function sample(collection) {\\n      var array = isArrayLike(collection) ? collection : values(collection),\\n          length = array.length;\\n\\n      return length > 0 ? array[baseRandom(0, length - 1)] : undefined;\\n    }\\n\\n    /**\\n     * Gets `n` random elements at unique keys from `collection` up to the\\n     * size of `collection`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to sample.\\n     * @param {number} [n=1] The number of elements to sample.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Array} Returns the random elements.\\n     * @example\\n     *\\n     * _.sampleSize([1, 2, 3], 2);\\n     * // => [3, 1]\\n     *\\n     * _.sampleSize([1, 2, 3], 4);\\n     * // => [2, 3, 1]\\n     */\\n    function sampleSize(collection, n, guard) {\\n      var index = -1,\\n          result = toArray(collection),\\n          length = result.length,\\n          lastIndex = length - 1;\\n\\n      if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\\n        n = 1;\\n      } else {\\n        n = baseClamp(toInteger(n), 0, length);\\n      }\\n      while (++index < n) {\\n        var rand = baseRandom(index, lastIndex),\\n            value = result[rand];\\n\\n        result[rand] = result[index];\\n        result[index] = value;\\n      }\\n      result.length = n;\\n      return result;\\n    }\\n\\n    /**\\n     * Creates an array of shuffled values, using a version of the\\n     * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to shuffle.\\n     * @returns {Array} Returns the new shuffled array.\\n     * @example\\n     *\\n     * _.shuffle([1, 2, 3, 4]);\\n     * // => [4, 1, 3, 2]\\n     */\\n    function shuffle(collection) {\\n      return sampleSize(collection, MAX_ARRAY_LENGTH);\\n    }\\n\\n    /**\\n     * Gets the size of `collection` by returning its length for array-like\\n     * values or the number of own enumerable string keyed properties for objects.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to inspect.\\n     * @returns {number} Returns the collection size.\\n     * @example\\n     *\\n     * _.size([1, 2, 3]);\\n     * // => 3\\n     *\\n     * _.size({ 'a': 1, 'b': 2 });\\n     * // => 2\\n     *\\n     * _.size('pebbles');\\n     * // => 7\\n     */\\n    function size(collection) {\\n      if (collection == null) {\\n        return 0;\\n      }\\n      if (isArrayLike(collection)) {\\n        var result = collection.length;\\n        return (result && isString(collection)) ? stringSize(collection) : result;\\n      }\\n      if (isObjectLike(collection)) {\\n        var tag = getTag(collection);\\n        if (tag == mapTag || tag == setTag) {\\n          return collection.size;\\n        }\\n      }\\n      return keys(collection).length;\\n    }\\n\\n    /**\\n     * Checks if `predicate` returns truthy for **any** element of `collection`.\\n     * Iteration is stopped once `predicate` returns truthy. The predicate is\\n     * invoked with three arguments: (value, index|key, collection).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {boolean} Returns `true` if any element passes the predicate check,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.some([null, 0, 'yes', false], Boolean);\\n     * // => true\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'active': true },\\n     *   { 'user': 'fred',   'active': false }\\n     * ];\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.some(users, { 'user': 'barney', 'active': false });\\n     * // => false\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.some(users, ['active', false]);\\n     * // => true\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.some(users, 'active');\\n     * // => true\\n     */\\n    function some(collection, predicate, guard) {\\n      var func = isArray(collection) ? arraySome : baseSome;\\n      if (guard && isIterateeCall(collection, predicate, guard)) {\\n        predicate = undefined;\\n      }\\n      return func(collection, getIteratee(predicate, 3));\\n    }\\n\\n    /**\\n     * Creates an array of elements, sorted in ascending order by the results of\\n     * running each element in a collection thru each iteratee. This method\\n     * performs a stable sort, that is, it preserves the original sort order of\\n     * equal elements. The iteratees are invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Collection\\n     * @param {Array|Object} collection The collection to iterate over.\\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\\n     *  [iteratees=[_.identity]] The iteratees to sort by.\\n     * @returns {Array} Returns the new sorted array.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'fred',   'age': 48 },\\n     *   { 'user': 'barney', 'age': 36 },\\n     *   { 'user': 'fred',   'age': 40 },\\n     *   { 'user': 'barney', 'age': 34 }\\n     * ];\\n     *\\n     * _.sortBy(users, function(o) { return o.user; });\\n     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\\n     *\\n     * _.sortBy(users, ['user', 'age']);\\n     * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]\\n     *\\n     * _.sortBy(users, 'user', function(o) {\\n     *   return Math.floor(o.age / 10);\\n     * });\\n     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\\n     */\\n    var sortBy = rest(function(collection, iteratees) {\\n      if (collection == null) {\\n        return [];\\n      }\\n      var length = iteratees.length;\\n      if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\\n        iteratees = [];\\n      } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\\n        iteratees = [iteratees[0]];\\n      }\\n      iteratees = (iteratees.length == 1 && isArray(iteratees[0]))\\n        ? iteratees[0]\\n        : baseFlatten(iteratees, 1, isFlattenableIteratee);\\n\\n      return baseOrderBy(collection, iteratees, []);\\n    });\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Gets the timestamp of the number of milliseconds that have elapsed since\\n     * the Unix epoch (1 January 1970 00:00:00 UTC).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.4.0\\n     * @type {Function}\\n     * @category Date\\n     * @returns {number} Returns the timestamp.\\n     * @example\\n     *\\n     * _.defer(function(stamp) {\\n     *   console.log(_.now() - stamp);\\n     * }, _.now());\\n     * // => Logs the number of milliseconds it took for the deferred function to be invoked.\\n     */\\n    var now = Date.now;\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * The opposite of `_.before`; this method creates a function that invokes\\n     * `func` once it's called `n` or more times.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {number} n The number of calls before `func` is invoked.\\n     * @param {Function} func The function to restrict.\\n     * @returns {Function} Returns the new restricted function.\\n     * @example\\n     *\\n     * var saves = ['profile', 'settings'];\\n     *\\n     * var done = _.after(saves.length, function() {\\n     *   console.log('done saving!');\\n     * });\\n     *\\n     * _.forEach(saves, function(type) {\\n     *   asyncSave({ 'type': type, 'complete': done });\\n     * });\\n     * // => Logs 'done saving!' after the two async saves have completed.\\n     */\\n    function after(n, func) {\\n      if (typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      n = toInteger(n);\\n      return function() {\\n        if (--n < 1) {\\n          return func.apply(this, arguments);\\n        }\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that invokes `func`, with up to `n` arguments,\\n     * ignoring any additional arguments.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Function\\n     * @param {Function} func The function to cap arguments for.\\n     * @param {number} [n=func.length] The arity cap.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * _.map(['6', '8', '10'], _.ary(parseInt, 1));\\n     * // => [6, 8, 10]\\n     */\\n    function ary(func, n, guard) {\\n      n = guard ? undefined : n;\\n      n = (func && n == null) ? func.length : n;\\n      return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);\\n    }\\n\\n    /**\\n     * Creates a function that invokes `func`, with the `this` binding and arguments\\n     * of the created function, while it's called less than `n` times. Subsequent\\n     * calls to the created function return the result of the last `func` invocation.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Function\\n     * @param {number} n The number of calls at which `func` is no longer invoked.\\n     * @param {Function} func The function to restrict.\\n     * @returns {Function} Returns the new restricted function.\\n     * @example\\n     *\\n     * jQuery(element).on('click', _.before(5, addContactToList));\\n     * // => allows adding up to 4 contacts to the list\\n     */\\n    function before(n, func) {\\n      var result;\\n      if (typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      n = toInteger(n);\\n      return function() {\\n        if (--n > 0) {\\n          result = func.apply(this, arguments);\\n        }\\n        if (n <= 1) {\\n          func = undefined;\\n        }\\n        return result;\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that invokes `func` with the `this` binding of `thisArg`\\n     * and `partials` prepended to the arguments it receives.\\n     *\\n     * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\\n     * may be used as a placeholder for partially applied arguments.\\n     *\\n     * **Note:** Unlike native `Function#bind` this method doesn't set the \\\"length\\\"\\n     * property of bound functions.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {Function} func The function to bind.\\n     * @param {*} thisArg The `this` binding of `func`.\\n     * @param {...*} [partials] The arguments to be partially applied.\\n     * @returns {Function} Returns the new bound function.\\n     * @example\\n     *\\n     * var greet = function(greeting, punctuation) {\\n     *   return greeting + ' ' + this.user + punctuation;\\n     * };\\n     *\\n     * var object = { 'user': 'fred' };\\n     *\\n     * var bound = _.bind(greet, object, 'hi');\\n     * bound('!');\\n     * // => 'hi fred!'\\n     *\\n     * // Bound with placeholders.\\n     * var bound = _.bind(greet, object, _, '!');\\n     * bound('hi');\\n     * // => 'hi fred!'\\n     */\\n    var bind = rest(function(func, thisArg, partials) {\\n      var bitmask = BIND_FLAG;\\n      if (partials.length) {\\n        var holders = replaceHolders(partials, getPlaceholder(bind));\\n        bitmask |= PARTIAL_FLAG;\\n      }\\n      return createWrapper(func, bitmask, thisArg, partials, holders);\\n    });\\n\\n    /**\\n     * Creates a function that invokes the method at `object[key]` with `partials`\\n     * prepended to the arguments it receives.\\n     *\\n     * This method differs from `_.bind` by allowing bound functions to reference\\n     * methods that may be redefined or don't yet exist. See\\n     * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\\n     * for more details.\\n     *\\n     * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\\n     * builds, may be used as a placeholder for partially applied arguments.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.10.0\\n     * @category Function\\n     * @param {Object} object The object to invoke the method on.\\n     * @param {string} key The key of the method.\\n     * @param {...*} [partials] The arguments to be partially applied.\\n     * @returns {Function} Returns the new bound function.\\n     * @example\\n     *\\n     * var object = {\\n     *   'user': 'fred',\\n     *   'greet': function(greeting, punctuation) {\\n     *     return greeting + ' ' + this.user + punctuation;\\n     *   }\\n     * };\\n     *\\n     * var bound = _.bindKey(object, 'greet', 'hi');\\n     * bound('!');\\n     * // => 'hi fred!'\\n     *\\n     * object.greet = function(greeting, punctuation) {\\n     *   return greeting + 'ya ' + this.user + punctuation;\\n     * };\\n     *\\n     * bound('!');\\n     * // => 'hiya fred!'\\n     *\\n     * // Bound with placeholders.\\n     * var bound = _.bindKey(object, 'greet', _, '!');\\n     * bound('hi');\\n     * // => 'hiya fred!'\\n     */\\n    var bindKey = rest(function(object, key, partials) {\\n      var bitmask = BIND_FLAG | BIND_KEY_FLAG;\\n      if (partials.length) {\\n        var holders = replaceHolders(partials, getPlaceholder(bindKey));\\n        bitmask |= PARTIAL_FLAG;\\n      }\\n      return createWrapper(key, bitmask, object, partials, holders);\\n    });\\n\\n    /**\\n     * Creates a function that accepts arguments of `func` and either invokes\\n     * `func` returning its result, if at least `arity` number of arguments have\\n     * been provided, or returns a function that accepts the remaining `func`\\n     * arguments, and so on. The arity of `func` may be specified if `func.length`\\n     * is not sufficient.\\n     *\\n     * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\\n     * may be used as a placeholder for provided arguments.\\n     *\\n     * **Note:** This method doesn't set the \\\"length\\\" property of curried functions.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Function\\n     * @param {Function} func The function to curry.\\n     * @param {number} [arity=func.length] The arity of `func`.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Function} Returns the new curried function.\\n     * @example\\n     *\\n     * var abc = function(a, b, c) {\\n     *   return [a, b, c];\\n     * };\\n     *\\n     * var curried = _.curry(abc);\\n     *\\n     * curried(1)(2)(3);\\n     * // => [1, 2, 3]\\n     *\\n     * curried(1, 2)(3);\\n     * // => [1, 2, 3]\\n     *\\n     * curried(1, 2, 3);\\n     * // => [1, 2, 3]\\n     *\\n     * // Curried with placeholders.\\n     * curried(1)(_, 3)(2);\\n     * // => [1, 2, 3]\\n     */\\n    function curry(func, arity, guard) {\\n      arity = guard ? undefined : arity;\\n      var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\\n      result.placeholder = curry.placeholder;\\n      return result;\\n    }\\n\\n    /**\\n     * This method is like `_.curry` except that arguments are applied to `func`\\n     * in the manner of `_.partialRight` instead of `_.partial`.\\n     *\\n     * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\\n     * builds, may be used as a placeholder for provided arguments.\\n     *\\n     * **Note:** This method doesn't set the \\\"length\\\" property of curried functions.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Function\\n     * @param {Function} func The function to curry.\\n     * @param {number} [arity=func.length] The arity of `func`.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Function} Returns the new curried function.\\n     * @example\\n     *\\n     * var abc = function(a, b, c) {\\n     *   return [a, b, c];\\n     * };\\n     *\\n     * var curried = _.curryRight(abc);\\n     *\\n     * curried(3)(2)(1);\\n     * // => [1, 2, 3]\\n     *\\n     * curried(2, 3)(1);\\n     * // => [1, 2, 3]\\n     *\\n     * curried(1, 2, 3);\\n     * // => [1, 2, 3]\\n     *\\n     * // Curried with placeholders.\\n     * curried(3)(1, _)(2);\\n     * // => [1, 2, 3]\\n     */\\n    function curryRight(func, arity, guard) {\\n      arity = guard ? undefined : arity;\\n      var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\\n      result.placeholder = curryRight.placeholder;\\n      return result;\\n    }\\n\\n    /**\\n     * Creates a debounced function that delays invoking `func` until after `wait`\\n     * milliseconds have elapsed since the last time the debounced function was\\n     * invoked. The debounced function comes with a `cancel` method to cancel\\n     * delayed `func` invocations and a `flush` method to immediately invoke them.\\n     * Provide an options object to indicate whether `func` should be invoked on\\n     * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\\n     * with the last arguments provided to the debounced function. Subsequent calls\\n     * to the debounced function return the result of the last `func` invocation.\\n     *\\n     * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\\n     * on the trailing edge of the timeout only if the debounced function is\\n     * invoked more than once during the `wait` timeout.\\n     *\\n     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\\n     * for details over the differences between `_.debounce` and `_.throttle`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {Function} func The function to debounce.\\n     * @param {number} [wait=0] The number of milliseconds to delay.\\n     * @param {Object} [options={}] The options object.\\n     * @param {boolean} [options.leading=false]\\n     *  Specify invoking on the leading edge of the timeout.\\n     * @param {number} [options.maxWait]\\n     *  The maximum time `func` is allowed to be delayed before it's invoked.\\n     * @param {boolean} [options.trailing=true]\\n     *  Specify invoking on the trailing edge of the timeout.\\n     * @returns {Function} Returns the new debounced function.\\n     * @example\\n     *\\n     * // Avoid costly calculations while the window size is in flux.\\n     * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\\n     *\\n     * // Invoke `sendMail` when clicked, debouncing subsequent calls.\\n     * jQuery(element).on('click', _.debounce(sendMail, 300, {\\n     *   'leading': true,\\n     *   'trailing': false\\n     * }));\\n     *\\n     * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\\n     * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\\n     * var source = new EventSource('/stream');\\n     * jQuery(source).on('message', debounced);\\n     *\\n     * // Cancel the trailing debounced invocation.\\n     * jQuery(window).on('popstate', debounced.cancel);\\n     */\\n    function debounce(func, wait, options) {\\n      var lastArgs,\\n          lastThis,\\n          maxWait,\\n          result,\\n          timerId,\\n          lastCallTime = 0,\\n          lastInvokeTime = 0,\\n          leading = false,\\n          maxing = false,\\n          trailing = true;\\n\\n      if (typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      wait = toNumber(wait) || 0;\\n      if (isObject(options)) {\\n        leading = !!options.leading;\\n        maxing = 'maxWait' in options;\\n        maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\\n        trailing = 'trailing' in options ? !!options.trailing : trailing;\\n      }\\n\\n      function invokeFunc(time) {\\n        var args = lastArgs,\\n            thisArg = lastThis;\\n\\n        lastArgs = lastThis = undefined;\\n        lastInvokeTime = time;\\n        result = func.apply(thisArg, args);\\n        return result;\\n      }\\n\\n      function leadingEdge(time) {\\n        // Reset any `maxWait` timer.\\n        lastInvokeTime = time;\\n        // Start the timer for the trailing edge.\\n        timerId = setTimeout(timerExpired, wait);\\n        // Invoke the leading edge.\\n        return leading ? invokeFunc(time) : result;\\n      }\\n\\n      function remainingWait(time) {\\n        var timeSinceLastCall = time - lastCallTime,\\n            timeSinceLastInvoke = time - lastInvokeTime,\\n            result = wait - timeSinceLastCall;\\n\\n        return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\\n      }\\n\\n      function shouldInvoke(time) {\\n        var timeSinceLastCall = time - lastCallTime,\\n            timeSinceLastInvoke = time - lastInvokeTime;\\n\\n        // Either this is the first call, activity has stopped and we're at the\\n        // trailing edge, the system time has gone backwards and we're treating\\n        // it as the trailing edge, or we've hit the `maxWait` limit.\\n        return (!lastCallTime || (timeSinceLastCall >= wait) ||\\n          (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\\n      }\\n\\n      function timerExpired() {\\n        var time = now();\\n        if (shouldInvoke(time)) {\\n          return trailingEdge(time);\\n        }\\n        // Restart the timer.\\n        timerId = setTimeout(timerExpired, remainingWait(time));\\n      }\\n\\n      function trailingEdge(time) {\\n        clearTimeout(timerId);\\n        timerId = undefined;\\n\\n        // Only invoke if we have `lastArgs` which means `func` has been\\n        // debounced at least once.\\n        if (trailing && lastArgs) {\\n          return invokeFunc(time);\\n        }\\n        lastArgs = lastThis = undefined;\\n        return result;\\n      }\\n\\n      function cancel() {\\n        if (timerId !== undefined) {\\n          clearTimeout(timerId);\\n        }\\n        lastCallTime = lastInvokeTime = 0;\\n        lastArgs = lastThis = timerId = undefined;\\n      }\\n\\n      function flush() {\\n        return timerId === undefined ? result : trailingEdge(now());\\n      }\\n\\n      function debounced() {\\n        var time = now(),\\n            isInvoking = shouldInvoke(time);\\n\\n        lastArgs = arguments;\\n        lastThis = this;\\n        lastCallTime = time;\\n\\n        if (isInvoking) {\\n          if (timerId === undefined) {\\n            return leadingEdge(lastCallTime);\\n          }\\n          if (maxing) {\\n            // Handle invocations in a tight loop.\\n            clearTimeout(timerId);\\n            timerId = setTimeout(timerExpired, wait);\\n            return invokeFunc(lastCallTime);\\n          }\\n        }\\n        if (timerId === undefined) {\\n          timerId = setTimeout(timerExpired, wait);\\n        }\\n        return result;\\n      }\\n      debounced.cancel = cancel;\\n      debounced.flush = flush;\\n      return debounced;\\n    }\\n\\n    /**\\n     * Defers invoking the `func` until the current call stack has cleared. Any\\n     * additional arguments are provided to `func` when it's invoked.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {Function} func The function to defer.\\n     * @param {...*} [args] The arguments to invoke `func` with.\\n     * @returns {number} Returns the timer id.\\n     * @example\\n     *\\n     * _.defer(function(text) {\\n     *   console.log(text);\\n     * }, 'deferred');\\n     * // => Logs 'deferred' after one or more milliseconds.\\n     */\\n    var defer = rest(function(func, args) {\\n      return baseDelay(func, 1, args);\\n    });\\n\\n    /**\\n     * Invokes `func` after `wait` milliseconds. Any additional arguments are\\n     * provided to `func` when it's invoked.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {Function} func The function to delay.\\n     * @param {number} wait The number of milliseconds to delay invocation.\\n     * @param {...*} [args] The arguments to invoke `func` with.\\n     * @returns {number} Returns the timer id.\\n     * @example\\n     *\\n     * _.delay(function(text) {\\n     *   console.log(text);\\n     * }, 1000, 'later');\\n     * // => Logs 'later' after one second.\\n     */\\n    var delay = rest(function(func, wait, args) {\\n      return baseDelay(func, toNumber(wait) || 0, args);\\n    });\\n\\n    /**\\n     * Creates a function that invokes `func` with arguments reversed.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Function\\n     * @param {Function} func The function to flip arguments for.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var flipped = _.flip(function() {\\n     *   return _.toArray(arguments);\\n     * });\\n     *\\n     * flipped('a', 'b', 'c', 'd');\\n     * // => ['d', 'c', 'b', 'a']\\n     */\\n    function flip(func) {\\n      return createWrapper(func, FLIP_FLAG);\\n    }\\n\\n    /**\\n     * Creates a function that memoizes the result of `func`. If `resolver` is\\n     * provided, it determines the cache key for storing the result based on the\\n     * arguments provided to the memoized function. By default, the first argument\\n     * provided to the memoized function is used as the map cache key. The `func`\\n     * is invoked with the `this` binding of the memoized function.\\n     *\\n     * **Note:** The cache is exposed as the `cache` property on the memoized\\n     * function. Its creation may be customized by replacing the `_.memoize.Cache`\\n     * constructor with one whose instances implement the\\n     * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)\\n     * method interface of `delete`, `get`, `has`, and `set`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {Function} func The function to have its output memoized.\\n     * @param {Function} [resolver] The function to resolve the cache key.\\n     * @returns {Function} Returns the new memoizing function.\\n     * @example\\n     *\\n     * var object = { 'a': 1, 'b': 2 };\\n     * var other = { 'c': 3, 'd': 4 };\\n     *\\n     * var values = _.memoize(_.values);\\n     * values(object);\\n     * // => [1, 2]\\n     *\\n     * values(other);\\n     * // => [3, 4]\\n     *\\n     * object.a = 2;\\n     * values(object);\\n     * // => [1, 2]\\n     *\\n     * // Modify the result cache.\\n     * values.cache.set(object, ['a', 'b']);\\n     * values(object);\\n     * // => ['a', 'b']\\n     *\\n     * // Replace `_.memoize.Cache`.\\n     * _.memoize.Cache = WeakMap;\\n     */\\n    function memoize(func, resolver) {\\n      if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      var memoized = function() {\\n        var args = arguments,\\n            key = resolver ? resolver.apply(this, args) : args[0],\\n            cache = memoized.cache;\\n\\n        if (cache.has(key)) {\\n          return cache.get(key);\\n        }\\n        var result = func.apply(this, args);\\n        memoized.cache = cache.set(key, result);\\n        return result;\\n      };\\n      memoized.cache = new (memoize.Cache || MapCache);\\n      return memoized;\\n    }\\n\\n    // Assign cache to `_.memoize`.\\n    memoize.Cache = MapCache;\\n\\n    /**\\n     * Creates a function that negates the result of the predicate `func`. The\\n     * `func` predicate is invoked with the `this` binding and arguments of the\\n     * created function.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Function\\n     * @param {Function} predicate The predicate to negate.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * function isEven(n) {\\n     *   return n % 2 == 0;\\n     * }\\n     *\\n     * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\\n     * // => [1, 3, 5]\\n     */\\n    function negate(predicate) {\\n      if (typeof predicate != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      return function() {\\n        return !predicate.apply(this, arguments);\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that is restricted to invoking `func` once. Repeat calls\\n     * to the function return the value of the first invocation. The `func` is\\n     * invoked with the `this` binding and arguments of the created function.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {Function} func The function to restrict.\\n     * @returns {Function} Returns the new restricted function.\\n     * @example\\n     *\\n     * var initialize = _.once(createApplication);\\n     * initialize();\\n     * initialize();\\n     * // `initialize` invokes `createApplication` once\\n     */\\n    function once(func) {\\n      return before(2, func);\\n    }\\n\\n    /**\\n     * Creates a function that invokes `func` with arguments transformed by\\n     * corresponding `transforms`.\\n     *\\n     * @static\\n     * @since 4.0.0\\n     * @memberOf _\\n     * @category Function\\n     * @param {Function} func The function to wrap.\\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\\n     *  [transforms[_.identity]] The functions to transform.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * function doubled(n) {\\n     *   return n * 2;\\n     * }\\n     *\\n     * function square(n) {\\n     *   return n * n;\\n     * }\\n     *\\n     * var func = _.overArgs(function(x, y) {\\n     *   return [x, y];\\n     * }, square, doubled);\\n     *\\n     * func(9, 3);\\n     * // => [81, 6]\\n     *\\n     * func(10, 5);\\n     * // => [100, 10]\\n     */\\n    var overArgs = rest(function(func, transforms) {\\n      transforms = (transforms.length == 1 && isArray(transforms[0]))\\n        ? arrayMap(transforms[0], baseUnary(getIteratee()))\\n        : arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(getIteratee()));\\n\\n      var funcsLength = transforms.length;\\n      return rest(function(args) {\\n        var index = -1,\\n            length = nativeMin(args.length, funcsLength);\\n\\n        while (++index < length) {\\n          args[index] = transforms[index].call(this, args[index]);\\n        }\\n        return apply(func, this, args);\\n      });\\n    });\\n\\n    /**\\n     * Creates a function that invokes `func` with `partials` prepended to the\\n     * arguments it receives. This method is like `_.bind` except it does **not**\\n     * alter the `this` binding.\\n     *\\n     * The `_.partial.placeholder` value, which defaults to `_` in monolithic\\n     * builds, may be used as a placeholder for partially applied arguments.\\n     *\\n     * **Note:** This method doesn't set the \\\"length\\\" property of partially\\n     * applied functions.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.2.0\\n     * @category Function\\n     * @param {Function} func The function to partially apply arguments to.\\n     * @param {...*} [partials] The arguments to be partially applied.\\n     * @returns {Function} Returns the new partially applied function.\\n     * @example\\n     *\\n     * var greet = function(greeting, name) {\\n     *   return greeting + ' ' + name;\\n     * };\\n     *\\n     * var sayHelloTo = _.partial(greet, 'hello');\\n     * sayHelloTo('fred');\\n     * // => 'hello fred'\\n     *\\n     * // Partially applied with placeholders.\\n     * var greetFred = _.partial(greet, _, 'fred');\\n     * greetFred('hi');\\n     * // => 'hi fred'\\n     */\\n    var partial = rest(function(func, partials) {\\n      var holders = replaceHolders(partials, getPlaceholder(partial));\\n      return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);\\n    });\\n\\n    /**\\n     * This method is like `_.partial` except that partially applied arguments\\n     * are appended to the arguments it receives.\\n     *\\n     * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\\n     * builds, may be used as a placeholder for partially applied arguments.\\n     *\\n     * **Note:** This method doesn't set the \\\"length\\\" property of partially\\n     * applied functions.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.0.0\\n     * @category Function\\n     * @param {Function} func The function to partially apply arguments to.\\n     * @param {...*} [partials] The arguments to be partially applied.\\n     * @returns {Function} Returns the new partially applied function.\\n     * @example\\n     *\\n     * var greet = function(greeting, name) {\\n     *   return greeting + ' ' + name;\\n     * };\\n     *\\n     * var greetFred = _.partialRight(greet, 'fred');\\n     * greetFred('hi');\\n     * // => 'hi fred'\\n     *\\n     * // Partially applied with placeholders.\\n     * var sayHelloTo = _.partialRight(greet, 'hello', _);\\n     * sayHelloTo('fred');\\n     * // => 'hello fred'\\n     */\\n    var partialRight = rest(function(func, partials) {\\n      var holders = replaceHolders(partials, getPlaceholder(partialRight));\\n      return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);\\n    });\\n\\n    /**\\n     * Creates a function that invokes `func` with arguments arranged according\\n     * to the specified `indexes` where the argument value at the first index is\\n     * provided as the first argument, the argument value at the second index is\\n     * provided as the second argument, and so on.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Function\\n     * @param {Function} func The function to rearrange arguments for.\\n     * @param {...(number|number[])} indexes The arranged argument indexes.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var rearged = _.rearg(function(a, b, c) {\\n     *   return [a, b, c];\\n     * }, 2, 0, 1);\\n     *\\n     * rearged('b', 'c', 'a')\\n     * // => ['a', 'b', 'c']\\n     */\\n    var rearg = rest(function(func, indexes) {\\n      return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1));\\n    });\\n\\n    /**\\n     * Creates a function that invokes `func` with the `this` binding of the\\n     * created function and arguments from `start` and beyond provided as\\n     * an array.\\n     *\\n     * **Note:** This method is based on the\\n     * [rest parameter](https://mdn.io/rest_parameters).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Function\\n     * @param {Function} func The function to apply a rest parameter to.\\n     * @param {number} [start=func.length-1] The start position of the rest parameter.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var say = _.rest(function(what, names) {\\n     *   return what + ' ' + _.initial(names).join(', ') +\\n     *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);\\n     * });\\n     *\\n     * say('hello', 'fred', 'barney', 'pebbles');\\n     * // => 'hello fred, barney, & pebbles'\\n     */\\n    function rest(func, start) {\\n      if (typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\\n      return function() {\\n        var args = arguments,\\n            index = -1,\\n            length = nativeMax(args.length - start, 0),\\n            array = Array(length);\\n\\n        while (++index < length) {\\n          array[index] = args[start + index];\\n        }\\n        switch (start) {\\n          case 0: return func.call(this, array);\\n          case 1: return func.call(this, args[0], array);\\n          case 2: return func.call(this, args[0], args[1], array);\\n        }\\n        var otherArgs = Array(start + 1);\\n        index = -1;\\n        while (++index < start) {\\n          otherArgs[index] = args[index];\\n        }\\n        otherArgs[start] = array;\\n        return apply(func, this, otherArgs);\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that invokes `func` with the `this` binding of the\\n     * create function and an array of arguments much like\\n     * [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply).\\n     *\\n     * **Note:** This method is based on the\\n     * [spread operator](https://mdn.io/spread_operator).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.2.0\\n     * @category Function\\n     * @param {Function} func The function to spread arguments over.\\n     * @param {number} [start=0] The start position of the spread.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var say = _.spread(function(who, what) {\\n     *   return who + ' says ' + what;\\n     * });\\n     *\\n     * say(['fred', 'hello']);\\n     * // => 'fred says hello'\\n     *\\n     * var numbers = Promise.all([\\n     *   Promise.resolve(40),\\n     *   Promise.resolve(36)\\n     * ]);\\n     *\\n     * numbers.then(_.spread(function(x, y) {\\n     *   return x + y;\\n     * }));\\n     * // => a Promise of 76\\n     */\\n    function spread(func, start) {\\n      if (typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      start = start === undefined ? 0 : nativeMax(toInteger(start), 0);\\n      return rest(function(args) {\\n        var array = args[start],\\n            otherArgs = castSlice(args, 0, start);\\n\\n        if (array) {\\n          arrayPush(otherArgs, array);\\n        }\\n        return apply(func, this, otherArgs);\\n      });\\n    }\\n\\n    /**\\n     * Creates a throttled function that only invokes `func` at most once per\\n     * every `wait` milliseconds. The throttled function comes with a `cancel`\\n     * method to cancel delayed `func` invocations and a `flush` method to\\n     * immediately invoke them. Provide an options object to indicate whether\\n     * `func` should be invoked on the leading and/or trailing edge of the `wait`\\n     * timeout. The `func` is invoked with the last arguments provided to the\\n     * throttled function. Subsequent calls to the throttled function return the\\n     * result of the last `func` invocation.\\n     *\\n     * **Note:** If `leading` and `trailing` options are `true`, `func` is\\n     * invoked on the trailing edge of the timeout only if the throttled function\\n     * is invoked more than once during the `wait` timeout.\\n     *\\n     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\\n     * for details over the differences between `_.throttle` and `_.debounce`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {Function} func The function to throttle.\\n     * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\\n     * @param {Object} [options={}] The options object.\\n     * @param {boolean} [options.leading=true]\\n     *  Specify invoking on the leading edge of the timeout.\\n     * @param {boolean} [options.trailing=true]\\n     *  Specify invoking on the trailing edge of the timeout.\\n     * @returns {Function} Returns the new throttled function.\\n     * @example\\n     *\\n     * // Avoid excessively updating the position while scrolling.\\n     * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\\n     *\\n     * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\\n     * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\\n     * jQuery(element).on('click', throttled);\\n     *\\n     * // Cancel the trailing throttled invocation.\\n     * jQuery(window).on('popstate', throttled.cancel);\\n     */\\n    function throttle(func, wait, options) {\\n      var leading = true,\\n          trailing = true;\\n\\n      if (typeof func != 'function') {\\n        throw new TypeError(FUNC_ERROR_TEXT);\\n      }\\n      if (isObject(options)) {\\n        leading = 'leading' in options ? !!options.leading : leading;\\n        trailing = 'trailing' in options ? !!options.trailing : trailing;\\n      }\\n      return debounce(func, wait, {\\n        'leading': leading,\\n        'maxWait': wait,\\n        'trailing': trailing\\n      });\\n    }\\n\\n    /**\\n     * Creates a function that accepts up to one argument, ignoring any\\n     * additional arguments.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Function\\n     * @param {Function} func The function to cap arguments for.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * _.map(['6', '8', '10'], _.unary(parseInt));\\n     * // => [6, 8, 10]\\n     */\\n    function unary(func) {\\n      return ary(func, 1);\\n    }\\n\\n    /**\\n     * Creates a function that provides `value` to the wrapper function as its\\n     * first argument. Any additional arguments provided to the function are\\n     * appended to those provided to the wrapper function. The wrapper is invoked\\n     * with the `this` binding of the created function.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Function\\n     * @param {*} value The value to wrap.\\n     * @param {Function} [wrapper=identity] The wrapper function.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var p = _.wrap(_.escape, function(func, text) {\\n     *   return '<p>' + func(text) + '</p>';\\n     * });\\n     *\\n     * p('fred, barney, & pebbles');\\n     * // => '<p>fred, barney, &amp; pebbles</p>'\\n     */\\n    function wrap(value, wrapper) {\\n      wrapper = wrapper == null ? identity : wrapper;\\n      return partial(wrapper, value);\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Casts `value` as an array if it's not one.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.4.0\\n     * @category Lang\\n     * @param {*} value The value to inspect.\\n     * @returns {Array} Returns the cast array.\\n     * @example\\n     *\\n     * _.castArray(1);\\n     * // => [1]\\n     *\\n     * _.castArray({ 'a': 1 });\\n     * // => [{ 'a': 1 }]\\n     *\\n     * _.castArray('abc');\\n     * // => ['abc']\\n     *\\n     * _.castArray(null);\\n     * // => [null]\\n     *\\n     * _.castArray(undefined);\\n     * // => [undefined]\\n     *\\n     * _.castArray();\\n     * // => []\\n     *\\n     * var array = [1, 2, 3];\\n     * console.log(_.castArray(array) === array);\\n     * // => true\\n     */\\n    function castArray() {\\n      if (!arguments.length) {\\n        return [];\\n      }\\n      var value = arguments[0];\\n      return isArray(value) ? value : [value];\\n    }\\n\\n    /**\\n     * Creates a shallow clone of `value`.\\n     *\\n     * **Note:** This method is loosely based on the\\n     * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\\n     * and supports cloning arrays, array buffers, booleans, date objects, maps,\\n     * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\\n     * arrays. The own enumerable properties of `arguments` objects are cloned\\n     * as plain objects. An empty object is returned for uncloneable values such\\n     * as error objects, functions, DOM nodes, and WeakMaps.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to clone.\\n     * @returns {*} Returns the cloned value.\\n     * @example\\n     *\\n     * var objects = [{ 'a': 1 }, { 'b': 2 }];\\n     *\\n     * var shallow = _.clone(objects);\\n     * console.log(shallow[0] === objects[0]);\\n     * // => true\\n     */\\n    function clone(value) {\\n      return baseClone(value, false, true);\\n    }\\n\\n    /**\\n     * This method is like `_.clone` except that it accepts `customizer` which\\n     * is invoked to produce the cloned value. If `customizer` returns `undefined`,\\n     * cloning is handled by the method instead. The `customizer` is invoked with\\n     * up to four arguments; (value [, index|key, object, stack]).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to clone.\\n     * @param {Function} [customizer] The function to customize cloning.\\n     * @returns {*} Returns the cloned value.\\n     * @example\\n     *\\n     * function customizer(value) {\\n     *   if (_.isElement(value)) {\\n     *     return value.cloneNode(false);\\n     *   }\\n     * }\\n     *\\n     * var el = _.cloneWith(document.body, customizer);\\n     *\\n     * console.log(el === document.body);\\n     * // => false\\n     * console.log(el.nodeName);\\n     * // => 'BODY'\\n     * console.log(el.childNodes.length);\\n     * // => 0\\n     */\\n    function cloneWith(value, customizer) {\\n      return baseClone(value, false, true, customizer);\\n    }\\n\\n    /**\\n     * This method is like `_.clone` except that it recursively clones `value`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.0.0\\n     * @category Lang\\n     * @param {*} value The value to recursively clone.\\n     * @returns {*} Returns the deep cloned value.\\n     * @example\\n     *\\n     * var objects = [{ 'a': 1 }, { 'b': 2 }];\\n     *\\n     * var deep = _.cloneDeep(objects);\\n     * console.log(deep[0] === objects[0]);\\n     * // => false\\n     */\\n    function cloneDeep(value) {\\n      return baseClone(value, true, true);\\n    }\\n\\n    /**\\n     * This method is like `_.cloneWith` except that it recursively clones `value`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to recursively clone.\\n     * @param {Function} [customizer] The function to customize cloning.\\n     * @returns {*} Returns the deep cloned value.\\n     * @example\\n     *\\n     * function customizer(value) {\\n     *   if (_.isElement(value)) {\\n     *     return value.cloneNode(true);\\n     *   }\\n     * }\\n     *\\n     * var el = _.cloneDeepWith(document.body, customizer);\\n     *\\n     * console.log(el === document.body);\\n     * // => false\\n     * console.log(el.nodeName);\\n     * // => 'BODY'\\n     * console.log(el.childNodes.length);\\n     * // => 20\\n     */\\n    function cloneDeepWith(value, customizer) {\\n      return baseClone(value, true, true, customizer);\\n    }\\n\\n    /**\\n     * Performs a\\n     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\\n     * comparison between two values to determine if they are equivalent.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\\n     * @example\\n     *\\n     * var object = { 'user': 'fred' };\\n     * var other = { 'user': 'fred' };\\n     *\\n     * _.eq(object, object);\\n     * // => true\\n     *\\n     * _.eq(object, other);\\n     * // => false\\n     *\\n     * _.eq('a', 'a');\\n     * // => true\\n     *\\n     * _.eq('a', Object('a'));\\n     * // => false\\n     *\\n     * _.eq(NaN, NaN);\\n     * // => true\\n     */\\n    function eq(value, other) {\\n      return value === other || (value !== value && other !== other);\\n    }\\n\\n    /**\\n     * Checks if `value` is greater than `other`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.9.0\\n     * @category Lang\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @returns {boolean} Returns `true` if `value` is greater than `other`,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.gt(3, 1);\\n     * // => true\\n     *\\n     * _.gt(3, 3);\\n     * // => false\\n     *\\n     * _.gt(1, 3);\\n     * // => false\\n     */\\n    function gt(value, other) {\\n      return value > other;\\n    }\\n\\n    /**\\n     * Checks if `value` is greater than or equal to `other`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.9.0\\n     * @category Lang\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @returns {boolean} Returns `true` if `value` is greater than or equal to\\n     *  `other`, else `false`.\\n     * @example\\n     *\\n     * _.gte(3, 1);\\n     * // => true\\n     *\\n     * _.gte(3, 3);\\n     * // => true\\n     *\\n     * _.gte(1, 3);\\n     * // => false\\n     */\\n    function gte(value, other) {\\n      return value >= other;\\n    }\\n\\n    /**\\n     * Checks if `value` is likely an `arguments` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isArguments(function() { return arguments; }());\\n     * // => true\\n     *\\n     * _.isArguments([1, 2, 3]);\\n     * // => false\\n     */\\n    function isArguments(value) {\\n      // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\\n      return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\\n        (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as an `Array` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @type {Function}\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isArray([1, 2, 3]);\\n     * // => true\\n     *\\n     * _.isArray(document.body.children);\\n     * // => false\\n     *\\n     * _.isArray('abc');\\n     * // => false\\n     *\\n     * _.isArray(_.noop);\\n     * // => false\\n     */\\n    var isArray = Array.isArray;\\n\\n    /**\\n     * Checks if `value` is classified as an `ArrayBuffer` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.3.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isArrayBuffer(new ArrayBuffer(2));\\n     * // => true\\n     *\\n     * _.isArrayBuffer(new Array(2));\\n     * // => false\\n     */\\n    function isArrayBuffer(value) {\\n      return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;\\n    }\\n\\n    /**\\n     * Checks if `value` is array-like. A value is considered array-like if it's\\n     * not a function and has a `value.length` that's an integer greater than or\\n     * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\\n     * @example\\n     *\\n     * _.isArrayLike([1, 2, 3]);\\n     * // => true\\n     *\\n     * _.isArrayLike(document.body.children);\\n     * // => true\\n     *\\n     * _.isArrayLike('abc');\\n     * // => true\\n     *\\n     * _.isArrayLike(_.noop);\\n     * // => false\\n     */\\n    function isArrayLike(value) {\\n      return value != null && isLength(getLength(value)) && !isFunction(value);\\n    }\\n\\n    /**\\n     * This method is like `_.isArrayLike` except that it also checks if `value`\\n     * is an object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is an array-like object,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isArrayLikeObject([1, 2, 3]);\\n     * // => true\\n     *\\n     * _.isArrayLikeObject(document.body.children);\\n     * // => true\\n     *\\n     * _.isArrayLikeObject('abc');\\n     * // => false\\n     *\\n     * _.isArrayLikeObject(_.noop);\\n     * // => false\\n     */\\n    function isArrayLikeObject(value) {\\n      return isObjectLike(value) && isArrayLike(value);\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a boolean primitive or object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isBoolean(false);\\n     * // => true\\n     *\\n     * _.isBoolean(null);\\n     * // => false\\n     */\\n    function isBoolean(value) {\\n      return value === true || value === false ||\\n        (isObjectLike(value) && objectToString.call(value) == boolTag);\\n    }\\n\\n    /**\\n     * Checks if `value` is a buffer.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.3.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\\n     * @example\\n     *\\n     * _.isBuffer(new Buffer(2));\\n     * // => true\\n     *\\n     * _.isBuffer(new Uint8Array(2));\\n     * // => false\\n     */\\n    var isBuffer = !Buffer ? constant(false) : function(value) {\\n      return value instanceof Buffer;\\n    };\\n\\n    /**\\n     * Checks if `value` is classified as a `Date` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isDate(new Date);\\n     * // => true\\n     *\\n     * _.isDate('Mon April 23 2012');\\n     * // => false\\n     */\\n    function isDate(value) {\\n      return isObjectLike(value) && objectToString.call(value) == dateTag;\\n    }\\n\\n    /**\\n     * Checks if `value` is likely a DOM element.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a DOM element,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isElement(document.body);\\n     * // => true\\n     *\\n     * _.isElement('<body>');\\n     * // => false\\n     */\\n    function isElement(value) {\\n      return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);\\n    }\\n\\n    /**\\n     * Checks if `value` is an empty object, collection, map, or set.\\n     *\\n     * Objects are considered empty if they have no own enumerable string keyed\\n     * properties.\\n     *\\n     * Array-like values such as `arguments` objects, arrays, buffers, strings, or\\n     * jQuery-like collections are considered empty if they have a `length` of `0`.\\n     * Similarly, maps and sets are considered empty if they have a `size` of `0`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is empty, else `false`.\\n     * @example\\n     *\\n     * _.isEmpty(null);\\n     * // => true\\n     *\\n     * _.isEmpty(true);\\n     * // => true\\n     *\\n     * _.isEmpty(1);\\n     * // => true\\n     *\\n     * _.isEmpty([1, 2, 3]);\\n     * // => false\\n     *\\n     * _.isEmpty({ 'a': 1 });\\n     * // => false\\n     */\\n    function isEmpty(value) {\\n      if (isArrayLike(value) &&\\n          (isArray(value) || isString(value) || isFunction(value.splice) ||\\n            isArguments(value) || isBuffer(value))) {\\n        return !value.length;\\n      }\\n      if (isObjectLike(value)) {\\n        var tag = getTag(value);\\n        if (tag == mapTag || tag == setTag) {\\n          return !value.size;\\n        }\\n      }\\n      for (var key in value) {\\n        if (hasOwnProperty.call(value, key)) {\\n          return false;\\n        }\\n      }\\n      return !(nonEnumShadows && keys(value).length);\\n    }\\n\\n    /**\\n     * Performs a deep comparison between two values to determine if they are\\n     * equivalent.\\n     *\\n     * **Note:** This method supports comparing arrays, array buffers, booleans,\\n     * date objects, error objects, maps, numbers, `Object` objects, regexes,\\n     * sets, strings, symbols, and typed arrays. `Object` objects are compared\\n     * by their own, not inherited, enumerable properties. Functions and DOM\\n     * nodes are **not** supported.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @returns {boolean} Returns `true` if the values are equivalent,\\n     *  else `false`.\\n     * @example\\n     *\\n     * var object = { 'user': 'fred' };\\n     * var other = { 'user': 'fred' };\\n     *\\n     * _.isEqual(object, other);\\n     * // => true\\n     *\\n     * object === other;\\n     * // => false\\n     */\\n    function isEqual(value, other) {\\n      return baseIsEqual(value, other);\\n    }\\n\\n    /**\\n     * This method is like `_.isEqual` except that it accepts `customizer` which\\n     * is invoked to compare values. If `customizer` returns `undefined`, comparisons\\n     * are handled by the method instead. The `customizer` is invoked with up to\\n     * six arguments: (objValue, othValue [, index|key, object, other, stack]).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @param {Function} [customizer] The function to customize comparisons.\\n     * @returns {boolean} Returns `true` if the values are equivalent,\\n     *  else `false`.\\n     * @example\\n     *\\n     * function isGreeting(value) {\\n     *   return /^h(?:i|ello)$/.test(value);\\n     * }\\n     *\\n     * function customizer(objValue, othValue) {\\n     *   if (isGreeting(objValue) && isGreeting(othValue)) {\\n     *     return true;\\n     *   }\\n     * }\\n     *\\n     * var array = ['hello', 'goodbye'];\\n     * var other = ['hi', 'goodbye'];\\n     *\\n     * _.isEqualWith(array, other, customizer);\\n     * // => true\\n     */\\n    function isEqualWith(value, other, customizer) {\\n      customizer = typeof customizer == 'function' ? customizer : undefined;\\n      var result = customizer ? customizer(value, other) : undefined;\\n      return result === undefined ? baseIsEqual(value, other, customizer) : !!result;\\n    }\\n\\n    /**\\n     * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\\n     * `SyntaxError`, `TypeError`, or `URIError` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is an error object,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isError(new Error);\\n     * // => true\\n     *\\n     * _.isError(Error);\\n     * // => false\\n     */\\n    function isError(value) {\\n      if (!isObjectLike(value)) {\\n        return false;\\n      }\\n      return (objectToString.call(value) == errorTag) ||\\n        (typeof value.message == 'string' && typeof value.name == 'string');\\n    }\\n\\n    /**\\n     * Checks if `value` is a finite primitive number.\\n     *\\n     * **Note:** This method is based on\\n     * [`Number.isFinite`](https://mdn.io/Number/isFinite).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a finite number,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isFinite(3);\\n     * // => true\\n     *\\n     * _.isFinite(Number.MAX_VALUE);\\n     * // => true\\n     *\\n     * _.isFinite(3.14);\\n     * // => true\\n     *\\n     * _.isFinite(Infinity);\\n     * // => false\\n     */\\n    function isFinite(value) {\\n      return typeof value == 'number' && nativeIsFinite(value);\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `Function` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isFunction(_);\\n     * // => true\\n     *\\n     * _.isFunction(/abc/);\\n     * // => false\\n     */\\n    function isFunction(value) {\\n      // The use of `Object#toString` avoids issues with the `typeof` operator\\n      // in Safari 8 which returns 'object' for typed array and weak map constructors,\\n      // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.\\n      var tag = isObject(value) ? objectToString.call(value) : '';\\n      return tag == funcTag || tag == genTag;\\n    }\\n\\n    /**\\n     * Checks if `value` is an integer.\\n     *\\n     * **Note:** This method is based on\\n     * [`Number.isInteger`](https://mdn.io/Number/isInteger).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\\n     * @example\\n     *\\n     * _.isInteger(3);\\n     * // => true\\n     *\\n     * _.isInteger(Number.MIN_VALUE);\\n     * // => false\\n     *\\n     * _.isInteger(Infinity);\\n     * // => false\\n     *\\n     * _.isInteger('3');\\n     * // => false\\n     */\\n    function isInteger(value) {\\n      return typeof value == 'number' && value == toInteger(value);\\n    }\\n\\n    /**\\n     * Checks if `value` is a valid array-like length.\\n     *\\n     * **Note:** This function is loosely based on\\n     * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a valid length,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isLength(3);\\n     * // => true\\n     *\\n     * _.isLength(Number.MIN_VALUE);\\n     * // => false\\n     *\\n     * _.isLength(Infinity);\\n     * // => false\\n     *\\n     * _.isLength('3');\\n     * // => false\\n     */\\n    function isLength(value) {\\n      return typeof value == 'number' &&\\n        value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\\n    }\\n\\n    /**\\n     * Checks if `value` is the\\n     * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)\\n     * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is an object, else `false`.\\n     * @example\\n     *\\n     * _.isObject({});\\n     * // => true\\n     *\\n     * _.isObject([1, 2, 3]);\\n     * // => true\\n     *\\n     * _.isObject(_.noop);\\n     * // => true\\n     *\\n     * _.isObject(null);\\n     * // => false\\n     */\\n    function isObject(value) {\\n      var type = typeof value;\\n      return !!value && (type == 'object' || type == 'function');\\n    }\\n\\n    /**\\n     * Checks if `value` is object-like. A value is object-like if it's not `null`\\n     * and has a `typeof` result of \\\"object\\\".\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\\n     * @example\\n     *\\n     * _.isObjectLike({});\\n     * // => true\\n     *\\n     * _.isObjectLike([1, 2, 3]);\\n     * // => true\\n     *\\n     * _.isObjectLike(_.noop);\\n     * // => false\\n     *\\n     * _.isObjectLike(null);\\n     * // => false\\n     */\\n    function isObjectLike(value) {\\n      return !!value && typeof value == 'object';\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `Map` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.3.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isMap(new Map);\\n     * // => true\\n     *\\n     * _.isMap(new WeakMap);\\n     * // => false\\n     */\\n    function isMap(value) {\\n      return isObjectLike(value) && getTag(value) == mapTag;\\n    }\\n\\n    /**\\n     * Performs a partial deep comparison between `object` and `source` to\\n     * determine if `object` contains equivalent property values. This method is\\n     * equivalent to a `_.matches` function when `source` is partially applied.\\n     *\\n     * **Note:** This method supports comparing the same values as `_.isEqual`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Lang\\n     * @param {Object} object The object to inspect.\\n     * @param {Object} source The object of property values to match.\\n     * @returns {boolean} Returns `true` if `object` is a match, else `false`.\\n     * @example\\n     *\\n     * var object = { 'user': 'fred', 'age': 40 };\\n     *\\n     * _.isMatch(object, { 'age': 40 });\\n     * // => true\\n     *\\n     * _.isMatch(object, { 'age': 36 });\\n     * // => false\\n     */\\n    function isMatch(object, source) {\\n      return object === source || baseIsMatch(object, source, getMatchData(source));\\n    }\\n\\n    /**\\n     * This method is like `_.isMatch` except that it accepts `customizer` which\\n     * is invoked to compare values. If `customizer` returns `undefined`, comparisons\\n     * are handled by the method instead. The `customizer` is invoked with five\\n     * arguments: (objValue, srcValue, index|key, object, source).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {Object} object The object to inspect.\\n     * @param {Object} source The object of property values to match.\\n     * @param {Function} [customizer] The function to customize comparisons.\\n     * @returns {boolean} Returns `true` if `object` is a match, else `false`.\\n     * @example\\n     *\\n     * function isGreeting(value) {\\n     *   return /^h(?:i|ello)$/.test(value);\\n     * }\\n     *\\n     * function customizer(objValue, srcValue) {\\n     *   if (isGreeting(objValue) && isGreeting(srcValue)) {\\n     *     return true;\\n     *   }\\n     * }\\n     *\\n     * var object = { 'greeting': 'hello' };\\n     * var source = { 'greeting': 'hi' };\\n     *\\n     * _.isMatchWith(object, source, customizer);\\n     * // => true\\n     */\\n    function isMatchWith(object, source, customizer) {\\n      customizer = typeof customizer == 'function' ? customizer : undefined;\\n      return baseIsMatch(object, source, getMatchData(source), customizer);\\n    }\\n\\n    /**\\n     * Checks if `value` is `NaN`.\\n     *\\n     * **Note:** This method is based on\\n     * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\\n     * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\\n     * `undefined` and other non-number values.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\\n     * @example\\n     *\\n     * _.isNaN(NaN);\\n     * // => true\\n     *\\n     * _.isNaN(new Number(NaN));\\n     * // => true\\n     *\\n     * isNaN(undefined);\\n     * // => true\\n     *\\n     * _.isNaN(undefined);\\n     * // => false\\n     */\\n    function isNaN(value) {\\n      // An `NaN` primitive is the only value that is not equal to itself.\\n      // Perform the `toStringTag` check first to avoid errors with some\\n      // ActiveX objects in IE.\\n      return isNumber(value) && value != +value;\\n    }\\n\\n    /**\\n     * Checks if `value` is a native function.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a native function,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isNative(Array.prototype.push);\\n     * // => true\\n     *\\n     * _.isNative(_);\\n     * // => false\\n     */\\n    function isNative(value) {\\n      if (!isObject(value)) {\\n        return false;\\n      }\\n      var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\\n      return pattern.test(toSource(value));\\n    }\\n\\n    /**\\n     * Checks if `value` is `null`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\\n     * @example\\n     *\\n     * _.isNull(null);\\n     * // => true\\n     *\\n     * _.isNull(void 0);\\n     * // => false\\n     */\\n    function isNull(value) {\\n      return value === null;\\n    }\\n\\n    /**\\n     * Checks if `value` is `null` or `undefined`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is nullish, else `false`.\\n     * @example\\n     *\\n     * _.isNil(null);\\n     * // => true\\n     *\\n     * _.isNil(void 0);\\n     * // => true\\n     *\\n     * _.isNil(NaN);\\n     * // => false\\n     */\\n    function isNil(value) {\\n      return value == null;\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `Number` primitive or object.\\n     *\\n     * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\\n     * classified as numbers, use the `_.isFinite` method.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isNumber(3);\\n     * // => true\\n     *\\n     * _.isNumber(Number.MIN_VALUE);\\n     * // => true\\n     *\\n     * _.isNumber(Infinity);\\n     * // => true\\n     *\\n     * _.isNumber('3');\\n     * // => false\\n     */\\n    function isNumber(value) {\\n      return typeof value == 'number' ||\\n        (isObjectLike(value) && objectToString.call(value) == numberTag);\\n    }\\n\\n    /**\\n     * Checks if `value` is a plain object, that is, an object created by the\\n     * `Object` constructor or one with a `[[Prototype]]` of `null`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.8.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a plain object,\\n     *  else `false`.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     * }\\n     *\\n     * _.isPlainObject(new Foo);\\n     * // => false\\n     *\\n     * _.isPlainObject([1, 2, 3]);\\n     * // => false\\n     *\\n     * _.isPlainObject({ 'x': 0, 'y': 0 });\\n     * // => true\\n     *\\n     * _.isPlainObject(Object.create(null));\\n     * // => true\\n     */\\n    function isPlainObject(value) {\\n      if (!isObjectLike(value) ||\\n          objectToString.call(value) != objectTag || isHostObject(value)) {\\n        return false;\\n      }\\n      var proto = getPrototype(value);\\n      if (proto === null) {\\n        return true;\\n      }\\n      var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\\n      return (typeof Ctor == 'function' &&\\n        Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `RegExp` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.1.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isRegExp(/abc/);\\n     * // => true\\n     *\\n     * _.isRegExp('/abc/');\\n     * // => false\\n     */\\n    function isRegExp(value) {\\n      return isObject(value) && objectToString.call(value) == regexpTag;\\n    }\\n\\n    /**\\n     * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754\\n     * double precision number which isn't the result of a rounded unsafe integer.\\n     *\\n     * **Note:** This method is based on\\n     * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is a safe integer,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isSafeInteger(3);\\n     * // => true\\n     *\\n     * _.isSafeInteger(Number.MIN_VALUE);\\n     * // => false\\n     *\\n     * _.isSafeInteger(Infinity);\\n     * // => false\\n     *\\n     * _.isSafeInteger('3');\\n     * // => false\\n     */\\n    function isSafeInteger(value) {\\n      return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `Set` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.3.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isSet(new Set);\\n     * // => true\\n     *\\n     * _.isSet(new WeakSet);\\n     * // => false\\n     */\\n    function isSet(value) {\\n      return isObjectLike(value) && getTag(value) == setTag;\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `String` primitive or object.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isString('abc');\\n     * // => true\\n     *\\n     * _.isString(1);\\n     * // => false\\n     */\\n    function isString(value) {\\n      return typeof value == 'string' ||\\n        (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `Symbol` primitive or object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isSymbol(Symbol.iterator);\\n     * // => true\\n     *\\n     * _.isSymbol('abc');\\n     * // => false\\n     */\\n    function isSymbol(value) {\\n      return typeof value == 'symbol' ||\\n        (isObjectLike(value) && objectToString.call(value) == symbolTag);\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a typed array.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isTypedArray(new Uint8Array);\\n     * // => true\\n     *\\n     * _.isTypedArray([]);\\n     * // => false\\n     */\\n    function isTypedArray(value) {\\n      return isObjectLike(value) &&\\n        isLength(value.length) && !!typedArrayTags[objectToString.call(value)];\\n    }\\n\\n    /**\\n     * Checks if `value` is `undefined`.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\\n     * @example\\n     *\\n     * _.isUndefined(void 0);\\n     * // => true\\n     *\\n     * _.isUndefined(null);\\n     * // => false\\n     */\\n    function isUndefined(value) {\\n      return value === undefined;\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `WeakMap` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.3.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isWeakMap(new WeakMap);\\n     * // => true\\n     *\\n     * _.isWeakMap(new Map);\\n     * // => false\\n     */\\n    function isWeakMap(value) {\\n      return isObjectLike(value) && getTag(value) == weakMapTag;\\n    }\\n\\n    /**\\n     * Checks if `value` is classified as a `WeakSet` object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.3.0\\n     * @category Lang\\n     * @param {*} value The value to check.\\n     * @returns {boolean} Returns `true` if `value` is correctly classified,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.isWeakSet(new WeakSet);\\n     * // => true\\n     *\\n     * _.isWeakSet(new Set);\\n     * // => false\\n     */\\n    function isWeakSet(value) {\\n      return isObjectLike(value) && objectToString.call(value) == weakSetTag;\\n    }\\n\\n    /**\\n     * Checks if `value` is less than `other`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.9.0\\n     * @category Lang\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @returns {boolean} Returns `true` if `value` is less than `other`,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.lt(1, 3);\\n     * // => true\\n     *\\n     * _.lt(3, 3);\\n     * // => false\\n     *\\n     * _.lt(3, 1);\\n     * // => false\\n     */\\n    function lt(value, other) {\\n      return value < other;\\n    }\\n\\n    /**\\n     * Checks if `value` is less than or equal to `other`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.9.0\\n     * @category Lang\\n     * @param {*} value The value to compare.\\n     * @param {*} other The other value to compare.\\n     * @returns {boolean} Returns `true` if `value` is less than or equal to\\n     *  `other`, else `false`.\\n     * @example\\n     *\\n     * _.lte(1, 3);\\n     * // => true\\n     *\\n     * _.lte(3, 3);\\n     * // => true\\n     *\\n     * _.lte(3, 1);\\n     * // => false\\n     */\\n    function lte(value, other) {\\n      return value <= other;\\n    }\\n\\n    /**\\n     * Converts `value` to an array.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Lang\\n     * @param {*} value The value to convert.\\n     * @returns {Array} Returns the converted array.\\n     * @example\\n     *\\n     * _.toArray({ 'a': 1, 'b': 2 });\\n     * // => [1, 2]\\n     *\\n     * _.toArray('abc');\\n     * // => ['a', 'b', 'c']\\n     *\\n     * _.toArray(1);\\n     * // => []\\n     *\\n     * _.toArray(null);\\n     * // => []\\n     */\\n    function toArray(value) {\\n      if (!value) {\\n        return [];\\n      }\\n      if (isArrayLike(value)) {\\n        return isString(value) ? stringToArray(value) : copyArray(value);\\n      }\\n      if (iteratorSymbol && value[iteratorSymbol]) {\\n        return iteratorToArray(value[iteratorSymbol]());\\n      }\\n      var tag = getTag(value),\\n          func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);\\n\\n      return func(value);\\n    }\\n\\n    /**\\n     * Converts `value` to an integer.\\n     *\\n     * **Note:** This function is loosely based on\\n     * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to convert.\\n     * @returns {number} Returns the converted integer.\\n     * @example\\n     *\\n     * _.toInteger(3);\\n     * // => 3\\n     *\\n     * _.toInteger(Number.MIN_VALUE);\\n     * // => 0\\n     *\\n     * _.toInteger(Infinity);\\n     * // => 1.7976931348623157e+308\\n     *\\n     * _.toInteger('3');\\n     * // => 3\\n     */\\n    function toInteger(value) {\\n      if (!value) {\\n        return value === 0 ? value : 0;\\n      }\\n      value = toNumber(value);\\n      if (value === INFINITY || value === -INFINITY) {\\n        var sign = (value < 0 ? -1 : 1);\\n        return sign * MAX_INTEGER;\\n      }\\n      var remainder = value % 1;\\n      return value === value ? (remainder ? value - remainder : value) : 0;\\n    }\\n\\n    /**\\n     * Converts `value` to an integer suitable for use as the length of an\\n     * array-like object.\\n     *\\n     * **Note:** This method is based on\\n     * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to convert.\\n     * @returns {number} Returns the converted integer.\\n     * @example\\n     *\\n     * _.toLength(3);\\n     * // => 3\\n     *\\n     * _.toLength(Number.MIN_VALUE);\\n     * // => 0\\n     *\\n     * _.toLength(Infinity);\\n     * // => 4294967295\\n     *\\n     * _.toLength('3');\\n     * // => 3\\n     */\\n    function toLength(value) {\\n      return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\\n    }\\n\\n    /**\\n     * Converts `value` to a number.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to process.\\n     * @returns {number} Returns the number.\\n     * @example\\n     *\\n     * _.toNumber(3);\\n     * // => 3\\n     *\\n     * _.toNumber(Number.MIN_VALUE);\\n     * // => 5e-324\\n     *\\n     * _.toNumber(Infinity);\\n     * // => Infinity\\n     *\\n     * _.toNumber('3');\\n     * // => 3\\n     */\\n    function toNumber(value) {\\n      if (typeof value == 'number') {\\n        return value;\\n      }\\n      if (isSymbol(value)) {\\n        return NAN;\\n      }\\n      if (isObject(value)) {\\n        var other = isFunction(value.valueOf) ? value.valueOf() : value;\\n        value = isObject(other) ? (other + '') : other;\\n      }\\n      if (typeof value != 'string') {\\n        return value === 0 ? value : +value;\\n      }\\n      value = value.replace(reTrim, '');\\n      var isBinary = reIsBinary.test(value);\\n      return (isBinary || reIsOctal.test(value))\\n        ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\\n        : (reIsBadHex.test(value) ? NAN : +value);\\n    }\\n\\n    /**\\n     * Converts `value` to a plain object flattening inherited enumerable string\\n     * keyed properties of `value` to own properties of the plain object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Lang\\n     * @param {*} value The value to convert.\\n     * @returns {Object} Returns the converted plain object.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.assign({ 'a': 1 }, new Foo);\\n     * // => { 'a': 1, 'b': 2 }\\n     *\\n     * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\\n     * // => { 'a': 1, 'b': 2, 'c': 3 }\\n     */\\n    function toPlainObject(value) {\\n      return copyObject(value, keysIn(value));\\n    }\\n\\n    /**\\n     * Converts `value` to a safe integer. A safe integer can be compared and\\n     * represented correctly.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to convert.\\n     * @returns {number} Returns the converted integer.\\n     * @example\\n     *\\n     * _.toSafeInteger(3);\\n     * // => 3\\n     *\\n     * _.toSafeInteger(Number.MIN_VALUE);\\n     * // => 0\\n     *\\n     * _.toSafeInteger(Infinity);\\n     * // => 9007199254740991\\n     *\\n     * _.toSafeInteger('3');\\n     * // => 3\\n     */\\n    function toSafeInteger(value) {\\n      return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\\n    }\\n\\n    /**\\n     * Converts `value` to a string. An empty string is returned for `null`\\n     * and `undefined` values. The sign of `-0` is preserved.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Lang\\n     * @param {*} value The value to process.\\n     * @returns {string} Returns the string.\\n     * @example\\n     *\\n     * _.toString(null);\\n     * // => ''\\n     *\\n     * _.toString(-0);\\n     * // => '-0'\\n     *\\n     * _.toString([1, 2, 3]);\\n     * // => '1,2,3'\\n     */\\n    function toString(value) {\\n      // Exit early for strings to avoid a performance hit in some environments.\\n      if (typeof value == 'string') {\\n        return value;\\n      }\\n      if (value == null) {\\n        return '';\\n      }\\n      if (isSymbol(value)) {\\n        return symbolToString ? symbolToString.call(value) : '';\\n      }\\n      var result = (value + '');\\n      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Assigns own enumerable string keyed properties of source objects to the\\n     * destination object. Source objects are applied from left to right.\\n     * Subsequent sources overwrite property assignments of previous sources.\\n     *\\n     * **Note:** This method mutates `object` and is loosely based on\\n     * [`Object.assign`](https://mdn.io/Object/assign).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.10.0\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} [sources] The source objects.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.c = 3;\\n     * }\\n     *\\n     * function Bar() {\\n     *   this.e = 5;\\n     * }\\n     *\\n     * Foo.prototype.d = 4;\\n     * Bar.prototype.f = 6;\\n     *\\n     * _.assign({ 'a': 1 }, new Foo, new Bar);\\n     * // => { 'a': 1, 'c': 3, 'e': 5 }\\n     */\\n    var assign = createAssigner(function(object, source) {\\n      if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {\\n        copyObject(source, keys(source), object);\\n        return;\\n      }\\n      for (var key in source) {\\n        if (hasOwnProperty.call(source, key)) {\\n          assignValue(object, key, source[key]);\\n        }\\n      }\\n    });\\n\\n    /**\\n     * This method is like `_.assign` except that it iterates over own and\\n     * inherited source properties.\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @alias extend\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} [sources] The source objects.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.b = 2;\\n     * }\\n     *\\n     * function Bar() {\\n     *   this.d = 4;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     * Bar.prototype.e = 5;\\n     *\\n     * _.assignIn({ 'a': 1 }, new Foo, new Bar);\\n     * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }\\n     */\\n    var assignIn = createAssigner(function(object, source) {\\n      if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {\\n        copyObject(source, keysIn(source), object);\\n        return;\\n      }\\n      for (var key in source) {\\n        assignValue(object, key, source[key]);\\n      }\\n    });\\n\\n    /**\\n     * This method is like `_.assignIn` except that it accepts `customizer`\\n     * which is invoked to produce the assigned values. If `customizer` returns\\n     * `undefined`, assignment is handled by the method instead. The `customizer`\\n     * is invoked with five arguments: (objValue, srcValue, key, object, source).\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @alias extendWith\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} sources The source objects.\\n     * @param {Function} [customizer] The function to customize assigned values.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function customizer(objValue, srcValue) {\\n     *   return _.isUndefined(objValue) ? srcValue : objValue;\\n     * }\\n     *\\n     * var defaults = _.partialRight(_.assignInWith, customizer);\\n     *\\n     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\\n     * // => { 'a': 1, 'b': 2 }\\n     */\\n    var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\\n      copyObject(source, keysIn(source), object, customizer);\\n    });\\n\\n    /**\\n     * This method is like `_.assign` except that it accepts `customizer`\\n     * which is invoked to produce the assigned values. If `customizer` returns\\n     * `undefined`, assignment is handled by the method instead. The `customizer`\\n     * is invoked with five arguments: (objValue, srcValue, key, object, source).\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} sources The source objects.\\n     * @param {Function} [customizer] The function to customize assigned values.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function customizer(objValue, srcValue) {\\n     *   return _.isUndefined(objValue) ? srcValue : objValue;\\n     * }\\n     *\\n     * var defaults = _.partialRight(_.assignWith, customizer);\\n     *\\n     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\\n     * // => { 'a': 1, 'b': 2 }\\n     */\\n    var assignWith = createAssigner(function(object, source, srcIndex, customizer) {\\n      copyObject(source, keys(source), object, customizer);\\n    });\\n\\n    /**\\n     * Creates an array of values corresponding to `paths` of `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.0.0\\n     * @category Object\\n     * @param {Object} object The object to iterate over.\\n     * @param {...(string|string[])} [paths] The property paths of elements to pick.\\n     * @returns {Array} Returns the new array of picked elements.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\\n     *\\n     * _.at(object, ['a[0].b.c', 'a[1]']);\\n     * // => [3, 4]\\n     *\\n     * _.at(['a', 'b', 'c'], 0, 2);\\n     * // => ['a', 'c']\\n     */\\n    var at = rest(function(object, paths) {\\n      return baseAt(object, baseFlatten(paths, 1));\\n    });\\n\\n    /**\\n     * Creates an object that inherits from the `prototype` object. If a\\n     * `properties` object is given, its own enumerable string keyed properties\\n     * are assigned to the created object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.3.0\\n     * @category Object\\n     * @param {Object} prototype The object to inherit from.\\n     * @param {Object} [properties] The properties to assign to the object.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * function Shape() {\\n     *   this.x = 0;\\n     *   this.y = 0;\\n     * }\\n     *\\n     * function Circle() {\\n     *   Shape.call(this);\\n     * }\\n     *\\n     * Circle.prototype = _.create(Shape.prototype, {\\n     *   'constructor': Circle\\n     * });\\n     *\\n     * var circle = new Circle;\\n     * circle instanceof Circle;\\n     * // => true\\n     *\\n     * circle instanceof Shape;\\n     * // => true\\n     */\\n    function create(prototype, properties) {\\n      var result = baseCreate(prototype);\\n      return properties ? baseAssign(result, properties) : result;\\n    }\\n\\n    /**\\n     * Assigns own and inherited enumerable string keyed properties of source\\n     * objects to the destination object for all destination properties that\\n     * resolve to `undefined`. Source objects are applied from left to right.\\n     * Once a property is set, additional values of the same property are ignored.\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} [sources] The source objects.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\\n     * // => { 'user': 'barney', 'age': 36 }\\n     */\\n    var defaults = rest(function(args) {\\n      args.push(undefined, assignInDefaults);\\n      return apply(assignInWith, undefined, args);\\n    });\\n\\n    /**\\n     * This method is like `_.defaults` except that it recursively assigns\\n     * default properties.\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.10.0\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} [sources] The source objects.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });\\n     * // => { 'user': { 'name': 'barney', 'age': 36 } }\\n     *\\n     */\\n    var defaultsDeep = rest(function(args) {\\n      args.push(undefined, mergeDefaults);\\n      return apply(mergeWith, undefined, args);\\n    });\\n\\n    /**\\n     * This method is like `_.find` except that it returns the key of the first\\n     * element `predicate` returns truthy for instead of the element itself.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.1.0\\n     * @category Object\\n     * @param {Object} object The object to search.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {string|undefined} Returns the key of the matched element,\\n     *  else `undefined`.\\n     * @example\\n     *\\n     * var users = {\\n     *   'barney':  { 'age': 36, 'active': true },\\n     *   'fred':    { 'age': 40, 'active': false },\\n     *   'pebbles': { 'age': 1,  'active': true }\\n     * };\\n     *\\n     * _.findKey(users, function(o) { return o.age < 40; });\\n     * // => 'barney' (iteration order is not guaranteed)\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.findKey(users, { 'age': 1, 'active': true });\\n     * // => 'pebbles'\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.findKey(users, ['active', false]);\\n     * // => 'fred'\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.findKey(users, 'active');\\n     * // => 'barney'\\n     */\\n    function findKey(object, predicate) {\\n      return baseFind(object, getIteratee(predicate, 3), baseForOwn, true);\\n    }\\n\\n    /**\\n     * This method is like `_.findKey` except that it iterates over elements of\\n     * a collection in the opposite order.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Object\\n     * @param {Object} object The object to search.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {string|undefined} Returns the key of the matched element,\\n     *  else `undefined`.\\n     * @example\\n     *\\n     * var users = {\\n     *   'barney':  { 'age': 36, 'active': true },\\n     *   'fred':    { 'age': 40, 'active': false },\\n     *   'pebbles': { 'age': 1,  'active': true }\\n     * };\\n     *\\n     * _.findLastKey(users, function(o) { return o.age < 40; });\\n     * // => returns 'pebbles' assuming `_.findKey` returns 'barney'\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.findLastKey(users, { 'age': 36, 'active': true });\\n     * // => 'barney'\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.findLastKey(users, ['active', false]);\\n     * // => 'fred'\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.findLastKey(users, 'active');\\n     * // => 'pebbles'\\n     */\\n    function findLastKey(object, predicate) {\\n      return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true);\\n    }\\n\\n    /**\\n     * Iterates over own and inherited enumerable string keyed properties of an\\n     * object and invokes `iteratee` for each property. The iteratee is invoked\\n     * with three arguments: (value, key, object). Iteratee functions may exit\\n     * iteration early by explicitly returning `false`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.3.0\\n     * @category Object\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.forIn(new Foo, function(value, key) {\\n     *   console.log(key);\\n     * });\\n     * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\\n     */\\n    function forIn(object, iteratee) {\\n      return object == null\\n        ? object\\n        : baseFor(object, getIteratee(iteratee), keysIn);\\n    }\\n\\n    /**\\n     * This method is like `_.forIn` except that it iterates over properties of\\n     * `object` in the opposite order.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Object\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.forInRight(new Foo, function(value, key) {\\n     *   console.log(key);\\n     * });\\n     * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.\\n     */\\n    function forInRight(object, iteratee) {\\n      return object == null\\n        ? object\\n        : baseForRight(object, getIteratee(iteratee), keysIn);\\n    }\\n\\n    /**\\n     * Iterates over own enumerable string keyed properties of an object and\\n     * invokes `iteratee` for each property. The iteratee is invoked with three\\n     * arguments: (value, key, object). Iteratee functions may exit iteration\\n     * early by explicitly returning `false`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.3.0\\n     * @category Object\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.forOwn(new Foo, function(value, key) {\\n     *   console.log(key);\\n     * });\\n     * // => Logs 'a' then 'b' (iteration order is not guaranteed).\\n     */\\n    function forOwn(object, iteratee) {\\n      return object && baseForOwn(object, getIteratee(iteratee));\\n    }\\n\\n    /**\\n     * This method is like `_.forOwn` except that it iterates over properties of\\n     * `object` in the opposite order.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.0.0\\n     * @category Object\\n     * @param {Object} object The object to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.forOwnRight(new Foo, function(value, key) {\\n     *   console.log(key);\\n     * });\\n     * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.\\n     */\\n    function forOwnRight(object, iteratee) {\\n      return object && baseForOwnRight(object, getIteratee(iteratee));\\n    }\\n\\n    /**\\n     * Creates an array of function property names from own enumerable properties\\n     * of `object`.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The object to inspect.\\n     * @returns {Array} Returns the new array of property names.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = _.constant('a');\\n     *   this.b = _.constant('b');\\n     * }\\n     *\\n     * Foo.prototype.c = _.constant('c');\\n     *\\n     * _.functions(new Foo);\\n     * // => ['a', 'b']\\n     */\\n    function functions(object) {\\n      return object == null ? [] : baseFunctions(object, keys(object));\\n    }\\n\\n    /**\\n     * Creates an array of function property names from own and inherited\\n     * enumerable properties of `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The object to inspect.\\n     * @returns {Array} Returns the new array of property names.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = _.constant('a');\\n     *   this.b = _.constant('b');\\n     * }\\n     *\\n     * Foo.prototype.c = _.constant('c');\\n     *\\n     * _.functionsIn(new Foo);\\n     * // => ['a', 'b', 'c']\\n     */\\n    function functionsIn(object) {\\n      return object == null ? [] : baseFunctions(object, keysIn(object));\\n    }\\n\\n    /**\\n     * Gets the value at `path` of `object`. If the resolved value is\\n     * `undefined`, the `defaultValue` is used in its place.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.7.0\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path of the property to get.\\n     * @param {*} [defaultValue] The value returned for `undefined` resolved values.\\n     * @returns {*} Returns the resolved value.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c': 3 } }] };\\n     *\\n     * _.get(object, 'a[0].b.c');\\n     * // => 3\\n     *\\n     * _.get(object, ['a', '0', 'b', 'c']);\\n     * // => 3\\n     *\\n     * _.get(object, 'a.b.c', 'default');\\n     * // => 'default'\\n     */\\n    function get(object, path, defaultValue) {\\n      var result = object == null ? undefined : baseGet(object, path);\\n      return result === undefined ? defaultValue : result;\\n    }\\n\\n    /**\\n     * Checks if `path` is a direct property of `object`.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path to check.\\n     * @returns {boolean} Returns `true` if `path` exists, else `false`.\\n     * @example\\n     *\\n     * var object = { 'a': { 'b': 2 } };\\n     * var other = _.create({ 'a': _.create({ 'b': 2 }) });\\n     *\\n     * _.has(object, 'a');\\n     * // => true\\n     *\\n     * _.has(object, 'a.b');\\n     * // => true\\n     *\\n     * _.has(object, ['a', 'b']);\\n     * // => true\\n     *\\n     * _.has(other, 'a');\\n     * // => false\\n     */\\n    function has(object, path) {\\n      return object != null && hasPath(object, path, baseHas);\\n    }\\n\\n    /**\\n     * Checks if `path` is a direct or inherited property of `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path to check.\\n     * @returns {boolean} Returns `true` if `path` exists, else `false`.\\n     * @example\\n     *\\n     * var object = _.create({ 'a': _.create({ 'b': 2 }) });\\n     *\\n     * _.hasIn(object, 'a');\\n     * // => true\\n     *\\n     * _.hasIn(object, 'a.b');\\n     * // => true\\n     *\\n     * _.hasIn(object, ['a', 'b']);\\n     * // => true\\n     *\\n     * _.hasIn(object, 'b');\\n     * // => false\\n     */\\n    function hasIn(object, path) {\\n      return object != null && hasPath(object, path, baseHasIn);\\n    }\\n\\n    /**\\n     * Creates an object composed of the inverted keys and values of `object`.\\n     * If `object` contains duplicate values, subsequent values overwrite\\n     * property assignments of previous values.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.7.0\\n     * @category Object\\n     * @param {Object} object The object to invert.\\n     * @returns {Object} Returns the new inverted object.\\n     * @example\\n     *\\n     * var object = { 'a': 1, 'b': 2, 'c': 1 };\\n     *\\n     * _.invert(object);\\n     * // => { '1': 'c', '2': 'b' }\\n     */\\n    var invert = createInverter(function(result, value, key) {\\n      result[value] = key;\\n    }, constant(identity));\\n\\n    /**\\n     * This method is like `_.invert` except that the inverted object is generated\\n     * from the results of running each element of `object` thru `iteratee`. The\\n     * corresponding inverted value of each inverted key is an array of keys\\n     * responsible for generating the inverted value. The iteratee is invoked\\n     * with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.1.0\\n     * @category Object\\n     * @param {Object} object The object to invert.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {Object} Returns the new inverted object.\\n     * @example\\n     *\\n     * var object = { 'a': 1, 'b': 2, 'c': 1 };\\n     *\\n     * _.invertBy(object);\\n     * // => { '1': ['a', 'c'], '2': ['b'] }\\n     *\\n     * _.invertBy(object, function(value) {\\n     *   return 'group' + value;\\n     * });\\n     * // => { 'group1': ['a', 'c'], 'group2': ['b'] }\\n     */\\n    var invertBy = createInverter(function(result, value, key) {\\n      if (hasOwnProperty.call(result, value)) {\\n        result[value].push(key);\\n      } else {\\n        result[value] = [key];\\n      }\\n    }, getIteratee);\\n\\n    /**\\n     * Invokes the method at `path` of `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path of the method to invoke.\\n     * @param {...*} [args] The arguments to invoke the method with.\\n     * @returns {*} Returns the result of the invoked method.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\\n     *\\n     * _.invoke(object, 'a[0].b.c.slice', 1, 3);\\n     * // => [2, 3]\\n     */\\n    var invoke = rest(baseInvoke);\\n\\n    /**\\n     * Creates an array of the own enumerable property names of `object`.\\n     *\\n     * **Note:** Non-object values are coerced to objects. See the\\n     * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\\n     * for more details.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property names.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.keys(new Foo);\\n     * // => ['a', 'b'] (iteration order is not guaranteed)\\n     *\\n     * _.keys('hi');\\n     * // => ['0', '1']\\n     */\\n    function keys(object) {\\n      var isProto = isPrototype(object);\\n      if (!(isProto || isArrayLike(object))) {\\n        return baseKeys(object);\\n      }\\n      var indexes = indexKeys(object),\\n          skipIndexes = !!indexes,\\n          result = indexes || [],\\n          length = result.length;\\n\\n      for (var key in object) {\\n        if (baseHas(object, key) &&\\n            !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\\n            !(isProto && key == 'constructor')) {\\n          result.push(key);\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Creates an array of the own and inherited enumerable property names of `object`.\\n     *\\n     * **Note:** Non-object values are coerced to objects.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property names.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.keysIn(new Foo);\\n     * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\\n     */\\n    function keysIn(object) {\\n      var index = -1,\\n          isProto = isPrototype(object),\\n          props = baseKeysIn(object),\\n          propsLength = props.length,\\n          indexes = indexKeys(object),\\n          skipIndexes = !!indexes,\\n          result = indexes || [],\\n          length = result.length;\\n\\n      while (++index < propsLength) {\\n        var key = props[index];\\n        if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&\\n            !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\\n          result.push(key);\\n        }\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * The opposite of `_.mapValues`; this method creates an object with the\\n     * same values as `object` and keys generated by running each own enumerable\\n     * string keyed property of `object` thru `iteratee`. The iteratee is invoked\\n     * with three arguments: (value, key, object).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.8.0\\n     * @category Object\\n     * @param {Object} object The object to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Object} Returns the new mapped object.\\n     * @example\\n     *\\n     * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\\n     *   return key + value;\\n     * });\\n     * // => { 'a1': 1, 'b2': 2 }\\n     */\\n    function mapKeys(object, iteratee) {\\n      var result = {};\\n      iteratee = getIteratee(iteratee, 3);\\n\\n      baseForOwn(object, function(value, key, object) {\\n        result[iteratee(value, key, object)] = value;\\n      });\\n      return result;\\n    }\\n\\n    /**\\n     * Creates an object with the same keys as `object` and values generated\\n     * by running each own enumerable string keyed property of `object` thru\\n     * `iteratee`. The iteratee is invoked with three arguments:\\n     * (value, key, object).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.4.0\\n     * @category Object\\n     * @param {Object} object The object to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The function invoked per iteration.\\n     * @returns {Object} Returns the new mapped object.\\n     * @example\\n     *\\n     * var users = {\\n     *   'fred':    { 'user': 'fred',    'age': 40 },\\n     *   'pebbles': { 'user': 'pebbles', 'age': 1 }\\n     * };\\n     *\\n     * _.mapValues(users, function(o) { return o.age; });\\n     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.mapValues(users, 'age');\\n     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\\n     */\\n    function mapValues(object, iteratee) {\\n      var result = {};\\n      iteratee = getIteratee(iteratee, 3);\\n\\n      baseForOwn(object, function(value, key, object) {\\n        result[key] = iteratee(value, key, object);\\n      });\\n      return result;\\n    }\\n\\n    /**\\n     * This method is like `_.assign` except that it recursively merges own and\\n     * inherited enumerable string keyed properties of source objects into the\\n     * destination object. Source properties that resolve to `undefined` are\\n     * skipped if a destination value exists. Array and plain object properties\\n     * are merged recursively.Other objects and value types are overridden by\\n     * assignment. Source objects are applied from left to right. Subsequent\\n     * sources overwrite property assignments of previous sources.\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.5.0\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} [sources] The source objects.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * var users = {\\n     *   'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\\n     * };\\n     *\\n     * var ages = {\\n     *   'data': [{ 'age': 36 }, { 'age': 40 }]\\n     * };\\n     *\\n     * _.merge(users, ages);\\n     * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\\n     */\\n    var merge = createAssigner(function(object, source, srcIndex) {\\n      baseMerge(object, source, srcIndex);\\n    });\\n\\n    /**\\n     * This method is like `_.merge` except that it accepts `customizer` which\\n     * is invoked to produce the merged values of the destination and source\\n     * properties. If `customizer` returns `undefined`, merging is handled by the\\n     * method instead. The `customizer` is invoked with seven arguments:\\n     * (objValue, srcValue, key, object, source, stack).\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The destination object.\\n     * @param {...Object} sources The source objects.\\n     * @param {Function} customizer The function to customize assigned values.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * function customizer(objValue, srcValue) {\\n     *   if (_.isArray(objValue)) {\\n     *     return objValue.concat(srcValue);\\n     *   }\\n     * }\\n     *\\n     * var object = {\\n     *   'fruits': ['apple'],\\n     *   'vegetables': ['beet']\\n     * };\\n     *\\n     * var other = {\\n     *   'fruits': ['banana'],\\n     *   'vegetables': ['carrot']\\n     * };\\n     *\\n     * _.mergeWith(object, other, customizer);\\n     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\\n     */\\n    var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\\n      baseMerge(object, source, srcIndex, customizer);\\n    });\\n\\n    /**\\n     * The opposite of `_.pick`; this method creates an object composed of the\\n     * own and inherited enumerable string keyed properties of `object` that are\\n     * not omitted.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The source object.\\n     * @param {...(string|string[])} [props] The property identifiers to omit.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\\n     *\\n     * _.omit(object, ['a', 'c']);\\n     * // => { 'b': '2' }\\n     */\\n    var omit = rest(function(object, props) {\\n      if (object == null) {\\n        return {};\\n      }\\n      props = arrayMap(baseFlatten(props, 1), toKey);\\n      return basePick(object, baseDifference(getAllKeysIn(object), props));\\n    });\\n\\n    /**\\n     * The opposite of `_.pickBy`; this method creates an object composed of\\n     * the own and inherited enumerable string keyed properties of `object` that\\n     * `predicate` doesn't return truthy for. The predicate is invoked with two\\n     * arguments: (value, key).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The source object.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per property.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\\n     *\\n     * _.omitBy(object, _.isNumber);\\n     * // => { 'b': '2' }\\n     */\\n    function omitBy(object, predicate) {\\n      predicate = getIteratee(predicate);\\n      return basePickBy(object, function(value, key) {\\n        return !predicate(value, key);\\n      });\\n    }\\n\\n    /**\\n     * Creates an object composed of the picked `object` properties.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The source object.\\n     * @param {...(string|string[])} [props] The property identifiers to pick.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\\n     *\\n     * _.pick(object, ['a', 'c']);\\n     * // => { 'a': 1, 'c': 3 }\\n     */\\n    var pick = rest(function(object, props) {\\n      return object == null ? {} : basePick(object, baseFlatten(props, 1));\\n    });\\n\\n    /**\\n     * Creates an object composed of the `object` properties `predicate` returns\\n     * truthy for. The predicate is invoked with two arguments: (value, key).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The source object.\\n     * @param {Array|Function|Object|string} [predicate=_.identity]\\n     *  The function invoked per property.\\n     * @returns {Object} Returns the new object.\\n     * @example\\n     *\\n     * var object = { 'a': 1, 'b': '2', 'c': 3 };\\n     *\\n     * _.pickBy(object, _.isNumber);\\n     * // => { 'a': 1, 'c': 3 }\\n     */\\n    function pickBy(object, predicate) {\\n      return object == null ? {} : basePickBy(object, getIteratee(predicate));\\n    }\\n\\n    /**\\n     * This method is like `_.get` except that if the resolved value is a\\n     * function it's invoked with the `this` binding of its parent object and\\n     * its result is returned.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @param {Array|string} path The path of the property to resolve.\\n     * @param {*} [defaultValue] The value returned for `undefined` resolved values.\\n     * @returns {*} Returns the resolved value.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\\n     *\\n     * _.result(object, 'a[0].b.c1');\\n     * // => 3\\n     *\\n     * _.result(object, 'a[0].b.c2');\\n     * // => 4\\n     *\\n     * _.result(object, 'a[0].b.c3', 'default');\\n     * // => 'default'\\n     *\\n     * _.result(object, 'a[0].b.c3', _.constant('default'));\\n     * // => 'default'\\n     */\\n    function result(object, path, defaultValue) {\\n      path = isKey(path, object) ? [path] : castPath(path);\\n\\n      var index = -1,\\n          length = path.length;\\n\\n      // Ensure the loop is entered when path is empty.\\n      if (!length) {\\n        object = undefined;\\n        length = 1;\\n      }\\n      while (++index < length) {\\n        var value = object == null ? undefined : object[path[index]];\\n        if (value === undefined) {\\n          index = length;\\n          value = defaultValue;\\n        }\\n        object = isFunction(value) ? value.call(object) : value;\\n      }\\n      return object;\\n    }\\n\\n    /**\\n     * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\\n     * it's created. Arrays are created for missing index properties while objects\\n     * are created for all other missing properties. Use `_.setWith` to customize\\n     * `path` creation.\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.7.0\\n     * @category Object\\n     * @param {Object} object The object to modify.\\n     * @param {Array|string} path The path of the property to set.\\n     * @param {*} value The value to set.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c': 3 } }] };\\n     *\\n     * _.set(object, 'a[0].b.c', 4);\\n     * console.log(object.a[0].b.c);\\n     * // => 4\\n     *\\n     * _.set(object, ['x', '0', 'y', 'z'], 5);\\n     * console.log(object.x[0].y.z);\\n     * // => 5\\n     */\\n    function set(object, path, value) {\\n      return object == null ? object : baseSet(object, path, value);\\n    }\\n\\n    /**\\n     * This method is like `_.set` except that it accepts `customizer` which is\\n     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`\\n     * path creation is handled by the method instead. The `customizer` is invoked\\n     * with three arguments: (nsValue, key, nsObject).\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The object to modify.\\n     * @param {Array|string} path The path of the property to set.\\n     * @param {*} value The value to set.\\n     * @param {Function} [customizer] The function to customize assigned values.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * var object = {};\\n     *\\n     * _.setWith(object, '[0][1]', 'a', Object);\\n     * // => { '0': { '1': 'a' } }\\n     */\\n    function setWith(object, path, value, customizer) {\\n      customizer = typeof customizer == 'function' ? customizer : undefined;\\n      return object == null ? object : baseSet(object, path, value, customizer);\\n    }\\n\\n    /**\\n     * Creates an array of own enumerable string keyed-value pairs for `object`\\n     * which can be consumed by `_.fromPairs`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @alias entries\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the new array of key-value pairs.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.toPairs(new Foo);\\n     * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\\n     */\\n    function toPairs(object) {\\n      return baseToPairs(object, keys(object));\\n    }\\n\\n    /**\\n     * Creates an array of own and inherited enumerable string keyed-value pairs\\n     * for `object` which can be consumed by `_.fromPairs`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @alias entriesIn\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the new array of key-value pairs.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.toPairsIn(new Foo);\\n     * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed)\\n     */\\n    function toPairsIn(object) {\\n      return baseToPairs(object, keysIn(object));\\n    }\\n\\n    /**\\n     * An alternative to `_.reduce`; this method transforms `object` to a new\\n     * `accumulator` object which is the result of running each of its own\\n     * enumerable string keyed properties thru `iteratee`, with each invocation\\n     * potentially mutating the `accumulator` object. The iteratee is invoked\\n     * with four arguments: (accumulator, value, key, object). Iteratee functions\\n     * may exit iteration early by explicitly returning `false`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.3.0\\n     * @category Object\\n     * @param {Array|Object} object The object to iterate over.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @param {*} [accumulator] The custom accumulator value.\\n     * @returns {*} Returns the accumulated value.\\n     * @example\\n     *\\n     * _.transform([2, 3, 4], function(result, n) {\\n     *   result.push(n *= n);\\n     *   return n % 2 == 0;\\n     * }, []);\\n     * // => [4, 9]\\n     *\\n     * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\\n     *   (result[value] || (result[value] = [])).push(key);\\n     * }, {});\\n     * // => { '1': ['a', 'c'], '2': ['b'] }\\n     */\\n    function transform(object, iteratee, accumulator) {\\n      var isArr = isArray(object) || isTypedArray(object);\\n      iteratee = getIteratee(iteratee, 4);\\n\\n      if (accumulator == null) {\\n        if (isArr || isObject(object)) {\\n          var Ctor = object.constructor;\\n          if (isArr) {\\n            accumulator = isArray(object) ? new Ctor : [];\\n          } else {\\n            accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\\n          }\\n        } else {\\n          accumulator = {};\\n        }\\n      }\\n      (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {\\n        return iteratee(accumulator, value, index, object);\\n      });\\n      return accumulator;\\n    }\\n\\n    /**\\n     * Removes the property at `path` of `object`.\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Object\\n     * @param {Object} object The object to modify.\\n     * @param {Array|string} path The path of the property to unset.\\n     * @returns {boolean} Returns `true` if the property is deleted, else `false`.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c': 7 } }] };\\n     * _.unset(object, 'a[0].b.c');\\n     * // => true\\n     *\\n     * console.log(object);\\n     * // => { 'a': [{ 'b': {} }] };\\n     *\\n     * _.unset(object, ['a', '0', 'b', 'c']);\\n     * // => true\\n     *\\n     * console.log(object);\\n     * // => { 'a': [{ 'b': {} }] };\\n     */\\n    function unset(object, path) {\\n      return object == null ? true : baseUnset(object, path);\\n    }\\n\\n    /**\\n     * This method is like `_.set` except that accepts `updater` to produce the\\n     * value to set. Use `_.updateWith` to customize `path` creation. The `updater`\\n     * is invoked with one argument: (value).\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.6.0\\n     * @category Object\\n     * @param {Object} object The object to modify.\\n     * @param {Array|string} path The path of the property to set.\\n     * @param {Function} updater The function to produce the updated value.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * var object = { 'a': [{ 'b': { 'c': 3 } }] };\\n     *\\n     * _.update(object, 'a[0].b.c', function(n) { return n * n; });\\n     * console.log(object.a[0].b.c);\\n     * // => 9\\n     *\\n     * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });\\n     * console.log(object.x[0].y.z);\\n     * // => 0\\n     */\\n    function update(object, path, updater) {\\n      return object == null ? object : baseUpdate(object, path, castFunction(updater));\\n    }\\n\\n    /**\\n     * This method is like `_.update` except that it accepts `customizer` which is\\n     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`\\n     * path creation is handled by the method instead. The `customizer` is invoked\\n     * with three arguments: (nsValue, key, nsObject).\\n     *\\n     * **Note:** This method mutates `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.6.0\\n     * @category Object\\n     * @param {Object} object The object to modify.\\n     * @param {Array|string} path The path of the property to set.\\n     * @param {Function} updater The function to produce the updated value.\\n     * @param {Function} [customizer] The function to customize assigned values.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * var object = {};\\n     *\\n     * _.updateWith(object, '[0][1]', _.constant('a'), Object);\\n     * // => { '0': { '1': 'a' } }\\n     */\\n    function updateWith(object, path, updater, customizer) {\\n      customizer = typeof customizer == 'function' ? customizer : undefined;\\n      return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);\\n    }\\n\\n    /**\\n     * Creates an array of the own enumerable string keyed property values of `object`.\\n     *\\n     * **Note:** Non-object values are coerced to objects.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property values.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.values(new Foo);\\n     * // => [1, 2] (iteration order is not guaranteed)\\n     *\\n     * _.values('hi');\\n     * // => ['h', 'i']\\n     */\\n    function values(object) {\\n      return object ? baseValues(object, keys(object)) : [];\\n    }\\n\\n    /**\\n     * Creates an array of the own and inherited enumerable string keyed property\\n     * values of `object`.\\n     *\\n     * **Note:** Non-object values are coerced to objects.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Object\\n     * @param {Object} object The object to query.\\n     * @returns {Array} Returns the array of property values.\\n     * @example\\n     *\\n     * function Foo() {\\n     *   this.a = 1;\\n     *   this.b = 2;\\n     * }\\n     *\\n     * Foo.prototype.c = 3;\\n     *\\n     * _.valuesIn(new Foo);\\n     * // => [1, 2, 3] (iteration order is not guaranteed)\\n     */\\n    function valuesIn(object) {\\n      return object == null ? [] : baseValues(object, keysIn(object));\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Clamps `number` within the inclusive `lower` and `upper` bounds.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Number\\n     * @param {number} number The number to clamp.\\n     * @param {number} [lower] The lower bound.\\n     * @param {number} upper The upper bound.\\n     * @returns {number} Returns the clamped number.\\n     * @example\\n     *\\n     * _.clamp(-10, -5, 5);\\n     * // => -5\\n     *\\n     * _.clamp(10, -5, 5);\\n     * // => 5\\n     */\\n    function clamp(number, lower, upper) {\\n      if (upper === undefined) {\\n        upper = lower;\\n        lower = undefined;\\n      }\\n      if (upper !== undefined) {\\n        upper = toNumber(upper);\\n        upper = upper === upper ? upper : 0;\\n      }\\n      if (lower !== undefined) {\\n        lower = toNumber(lower);\\n        lower = lower === lower ? lower : 0;\\n      }\\n      return baseClamp(toNumber(number), lower, upper);\\n    }\\n\\n    /**\\n     * Checks if `n` is between `start` and up to but not including, `end`. If\\n     * `end` is not specified, it's set to `start` with `start` then set to `0`.\\n     * If `start` is greater than `end` the params are swapped to support\\n     * negative ranges.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.3.0\\n     * @category Number\\n     * @param {number} number The number to check.\\n     * @param {number} [start=0] The start of the range.\\n     * @param {number} end The end of the range.\\n     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\\n     * @example\\n     *\\n     * _.inRange(3, 2, 4);\\n     * // => true\\n     *\\n     * _.inRange(4, 8);\\n     * // => true\\n     *\\n     * _.inRange(4, 2);\\n     * // => false\\n     *\\n     * _.inRange(2, 2);\\n     * // => false\\n     *\\n     * _.inRange(1.2, 2);\\n     * // => true\\n     *\\n     * _.inRange(5.2, 4);\\n     * // => false\\n     *\\n     * _.inRange(-3, -2, -6);\\n     * // => true\\n     */\\n    function inRange(number, start, end) {\\n      start = toNumber(start) || 0;\\n      if (end === undefined) {\\n        end = start;\\n        start = 0;\\n      } else {\\n        end = toNumber(end) || 0;\\n      }\\n      number = toNumber(number);\\n      return baseInRange(number, start, end);\\n    }\\n\\n    /**\\n     * Produces a random number between the inclusive `lower` and `upper` bounds.\\n     * If only one argument is provided a number between `0` and the given number\\n     * is returned. If `floating` is `true`, or either `lower` or `upper` are\\n     * floats, a floating-point number is returned instead of an integer.\\n     *\\n     * **Note:** JavaScript follows the IEEE-754 standard for resolving\\n     * floating-point values which can produce unexpected results.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.7.0\\n     * @category Number\\n     * @param {number} [lower=0] The lower bound.\\n     * @param {number} [upper=1] The upper bound.\\n     * @param {boolean} [floating] Specify returning a floating-point number.\\n     * @returns {number} Returns the random number.\\n     * @example\\n     *\\n     * _.random(0, 5);\\n     * // => an integer between 0 and 5\\n     *\\n     * _.random(5);\\n     * // => also an integer between 0 and 5\\n     *\\n     * _.random(5, true);\\n     * // => a floating-point number between 0 and 5\\n     *\\n     * _.random(1.2, 5.2);\\n     * // => a floating-point number between 1.2 and 5.2\\n     */\\n    function random(lower, upper, floating) {\\n      if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {\\n        upper = floating = undefined;\\n      }\\n      if (floating === undefined) {\\n        if (typeof upper == 'boolean') {\\n          floating = upper;\\n          upper = undefined;\\n        }\\n        else if (typeof lower == 'boolean') {\\n          floating = lower;\\n          lower = undefined;\\n        }\\n      }\\n      if (lower === undefined && upper === undefined) {\\n        lower = 0;\\n        upper = 1;\\n      }\\n      else {\\n        lower = toNumber(lower) || 0;\\n        if (upper === undefined) {\\n          upper = lower;\\n          lower = 0;\\n        } else {\\n          upper = toNumber(upper) || 0;\\n        }\\n      }\\n      if (lower > upper) {\\n        var temp = lower;\\n        lower = upper;\\n        upper = temp;\\n      }\\n      if (floating || lower % 1 || upper % 1) {\\n        var rand = nativeRandom();\\n        return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);\\n      }\\n      return baseRandom(lower, upper);\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the camel cased string.\\n     * @example\\n     *\\n     * _.camelCase('Foo Bar');\\n     * // => 'fooBar'\\n     *\\n     * _.camelCase('--foo-bar--');\\n     * // => 'fooBar'\\n     *\\n     * _.camelCase('__FOO_BAR__');\\n     * // => 'fooBar'\\n     */\\n    var camelCase = createCompounder(function(result, word, index) {\\n      word = word.toLowerCase();\\n      return result + (index ? capitalize(word) : word);\\n    });\\n\\n    /**\\n     * Converts the first character of `string` to upper case and the remaining\\n     * to lower case.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to capitalize.\\n     * @returns {string} Returns the capitalized string.\\n     * @example\\n     *\\n     * _.capitalize('FRED');\\n     * // => 'Fred'\\n     */\\n    function capitalize(string) {\\n      return upperFirst(toString(string).toLowerCase());\\n    }\\n\\n    /**\\n     * Deburrs `string` by converting\\n     * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\\n     * to basic latin letters and removing\\n     * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to deburr.\\n     * @returns {string} Returns the deburred string.\\n     * @example\\n     *\\n     * _.deburr('déjà vu');\\n     * // => 'deja vu'\\n     */\\n    function deburr(string) {\\n      string = toString(string);\\n      return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');\\n    }\\n\\n    /**\\n     * Checks if `string` ends with the given target string.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to search.\\n     * @param {string} [target] The string to search for.\\n     * @param {number} [position=string.length] The position to search from.\\n     * @returns {boolean} Returns `true` if `string` ends with `target`,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.endsWith('abc', 'c');\\n     * // => true\\n     *\\n     * _.endsWith('abc', 'b');\\n     * // => false\\n     *\\n     * _.endsWith('abc', 'b', 2);\\n     * // => true\\n     */\\n    function endsWith(string, target, position) {\\n      string = toString(string);\\n      target = typeof target == 'string' ? target : (target + '');\\n\\n      var length = string.length;\\n      position = position === undefined\\n        ? length\\n        : baseClamp(toInteger(position), 0, length);\\n\\n      position -= target.length;\\n      return position >= 0 && string.indexOf(target, position) == position;\\n    }\\n\\n    /**\\n     * Converts the characters \\\"&\\\", \\\"<\\\", \\\">\\\", '\\\"', \\\"'\\\", and \\\"\\\\`\\\" in `string` to\\n     * their corresponding HTML entities.\\n     *\\n     * **Note:** No other characters are escaped. To escape additional\\n     * characters use a third-party library like [_he_](https://mths.be/he).\\n     *\\n     * Though the \\\">\\\" character is escaped for symmetry, characters like\\n     * \\\">\\\" and \\\"/\\\" don't need escaping in HTML and have no special meaning\\n     * unless they're part of a tag or unquoted attribute value. See\\n     * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\\n     * (under \\\"semi-related fun fact\\\") for more details.\\n     *\\n     * Backticks are escaped because in IE < 9, they can break out of\\n     * attribute values or HTML comments. See [#59](https://html5sec.org/#59),\\n     * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and\\n     * [#133](https://html5sec.org/#133) of the\\n     * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.\\n     *\\n     * When working with HTML you should always\\n     * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\\n     * XSS vectors.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category String\\n     * @param {string} [string=''] The string to escape.\\n     * @returns {string} Returns the escaped string.\\n     * @example\\n     *\\n     * _.escape('fred, barney, & pebbles');\\n     * // => 'fred, barney, &amp; pebbles'\\n     */\\n    function escape(string) {\\n      string = toString(string);\\n      return (string && reHasUnescapedHtml.test(string))\\n        ? string.replace(reUnescapedHtml, escapeHtmlChar)\\n        : string;\\n    }\\n\\n    /**\\n     * Escapes the `RegExp` special characters \\\"^\\\", \\\"$\\\", \\\"\\\\\\\", \\\".\\\", \\\"*\\\", \\\"+\\\",\\n     * \\\"?\\\", \\\"(\\\", \\\")\\\", \\\"[\\\", \\\"]\\\", \\\"{\\\", \\\"}\\\", and \\\"|\\\" in `string`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to escape.\\n     * @returns {string} Returns the escaped string.\\n     * @example\\n     *\\n     * _.escapeRegExp('[lodash](https://lodash.com/)');\\n     * // => '\\\\[lodash\\\\]\\\\(https://lodash\\\\.com/\\\\)'\\n     */\\n    function escapeRegExp(string) {\\n      string = toString(string);\\n      return (string && reHasRegExpChar.test(string))\\n        ? string.replace(reRegExpChar, '\\\\\\\\$&')\\n        : string;\\n    }\\n\\n    /**\\n     * Converts `string` to\\n     * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the kebab cased string.\\n     * @example\\n     *\\n     * _.kebabCase('Foo Bar');\\n     * // => 'foo-bar'\\n     *\\n     * _.kebabCase('fooBar');\\n     * // => 'foo-bar'\\n     *\\n     * _.kebabCase('__FOO_BAR__');\\n     * // => 'foo-bar'\\n     */\\n    var kebabCase = createCompounder(function(result, word, index) {\\n      return result + (index ? '-' : '') + word.toLowerCase();\\n    });\\n\\n    /**\\n     * Converts `string`, as space separated words, to lower case.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the lower cased string.\\n     * @example\\n     *\\n     * _.lowerCase('--Foo-Bar--');\\n     * // => 'foo bar'\\n     *\\n     * _.lowerCase('fooBar');\\n     * // => 'foo bar'\\n     *\\n     * _.lowerCase('__FOO_BAR__');\\n     * // => 'foo bar'\\n     */\\n    var lowerCase = createCompounder(function(result, word, index) {\\n      return result + (index ? ' ' : '') + word.toLowerCase();\\n    });\\n\\n    /**\\n     * Converts the first character of `string` to lower case.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the converted string.\\n     * @example\\n     *\\n     * _.lowerFirst('Fred');\\n     * // => 'fred'\\n     *\\n     * _.lowerFirst('FRED');\\n     * // => 'fRED'\\n     */\\n    var lowerFirst = createCaseFirst('toLowerCase');\\n\\n    /**\\n     * Pads `string` on the left and right sides if it's shorter than `length`.\\n     * Padding characters are truncated if they can't be evenly divided by `length`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to pad.\\n     * @param {number} [length=0] The padding length.\\n     * @param {string} [chars=' '] The string used as padding.\\n     * @returns {string} Returns the padded string.\\n     * @example\\n     *\\n     * _.pad('abc', 8);\\n     * // => '  abc   '\\n     *\\n     * _.pad('abc', 8, '_-');\\n     * // => '_-abc_-_'\\n     *\\n     * _.pad('abc', 3);\\n     * // => 'abc'\\n     */\\n    function pad(string, length, chars) {\\n      string = toString(string);\\n      length = toInteger(length);\\n\\n      var strLength = length ? stringSize(string) : 0;\\n      if (!length || strLength >= length) {\\n        return string;\\n      }\\n      var mid = (length - strLength) / 2;\\n      return (\\n        createPadding(nativeFloor(mid), chars) +\\n        string +\\n        createPadding(nativeCeil(mid), chars)\\n      );\\n    }\\n\\n    /**\\n     * Pads `string` on the right side if it's shorter than `length`. Padding\\n     * characters are truncated if they exceed `length`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to pad.\\n     * @param {number} [length=0] The padding length.\\n     * @param {string} [chars=' '] The string used as padding.\\n     * @returns {string} Returns the padded string.\\n     * @example\\n     *\\n     * _.padEnd('abc', 6);\\n     * // => 'abc   '\\n     *\\n     * _.padEnd('abc', 6, '_-');\\n     * // => 'abc_-_'\\n     *\\n     * _.padEnd('abc', 3);\\n     * // => 'abc'\\n     */\\n    function padEnd(string, length, chars) {\\n      string = toString(string);\\n      length = toInteger(length);\\n\\n      var strLength = length ? stringSize(string) : 0;\\n      return (length && strLength < length)\\n        ? (string + createPadding(length - strLength, chars))\\n        : string;\\n    }\\n\\n    /**\\n     * Pads `string` on the left side if it's shorter than `length`. Padding\\n     * characters are truncated if they exceed `length`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to pad.\\n     * @param {number} [length=0] The padding length.\\n     * @param {string} [chars=' '] The string used as padding.\\n     * @returns {string} Returns the padded string.\\n     * @example\\n     *\\n     * _.padStart('abc', 6);\\n     * // => '   abc'\\n     *\\n     * _.padStart('abc', 6, '_-');\\n     * // => '_-_abc'\\n     *\\n     * _.padStart('abc', 3);\\n     * // => 'abc'\\n     */\\n    function padStart(string, length, chars) {\\n      string = toString(string);\\n      length = toInteger(length);\\n\\n      var strLength = length ? stringSize(string) : 0;\\n      return (length && strLength < length)\\n        ? (createPadding(length - strLength, chars) + string)\\n        : string;\\n    }\\n\\n    /**\\n     * Converts `string` to an integer of the specified radix. If `radix` is\\n     * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\\n     * hexadecimal, in which case a `radix` of `16` is used.\\n     *\\n     * **Note:** This method aligns with the\\n     * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 1.1.0\\n     * @category String\\n     * @param {string} string The string to convert.\\n     * @param {number} [radix=10] The radix to interpret `value` by.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {number} Returns the converted integer.\\n     * @example\\n     *\\n     * _.parseInt('08');\\n     * // => 8\\n     *\\n     * _.map(['6', '08', '10'], _.parseInt);\\n     * // => [6, 8, 10]\\n     */\\n    function parseInt(string, radix, guard) {\\n      // Chrome fails to trim leading <BOM> whitespace characters.\\n      // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details.\\n      if (guard || radix == null) {\\n        radix = 0;\\n      } else if (radix) {\\n        radix = +radix;\\n      }\\n      string = toString(string).replace(reTrim, '');\\n      return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));\\n    }\\n\\n    /**\\n     * Repeats the given string `n` times.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to repeat.\\n     * @param {number} [n=1] The number of times to repeat the string.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {string} Returns the repeated string.\\n     * @example\\n     *\\n     * _.repeat('*', 3);\\n     * // => '***'\\n     *\\n     * _.repeat('abc', 2);\\n     * // => 'abcabc'\\n     *\\n     * _.repeat('abc', 0);\\n     * // => ''\\n     */\\n    function repeat(string, n, guard) {\\n      if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {\\n        n = 1;\\n      } else {\\n        n = toInteger(n);\\n      }\\n      return baseRepeat(toString(string), n);\\n    }\\n\\n    /**\\n     * Replaces matches for `pattern` in `string` with `replacement`.\\n     *\\n     * **Note:** This method is based on\\n     * [`String#replace`](https://mdn.io/String/replace).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to modify.\\n     * @param {RegExp|string} pattern The pattern to replace.\\n     * @param {Function|string} replacement The match replacement.\\n     * @returns {string} Returns the modified string.\\n     * @example\\n     *\\n     * _.replace('Hi Fred', 'Fred', 'Barney');\\n     * // => 'Hi Barney'\\n     */\\n    function replace() {\\n      var args = arguments,\\n          string = toString(args[0]);\\n\\n      return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);\\n    }\\n\\n    /**\\n     * Converts `string` to\\n     * [snake case](https://en.wikipedia.org/wiki/Snake_case).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the snake cased string.\\n     * @example\\n     *\\n     * _.snakeCase('Foo Bar');\\n     * // => 'foo_bar'\\n     *\\n     * _.snakeCase('fooBar');\\n     * // => 'foo_bar'\\n     *\\n     * _.snakeCase('--FOO-BAR--');\\n     * // => 'foo_bar'\\n     */\\n    var snakeCase = createCompounder(function(result, word, index) {\\n      return result + (index ? '_' : '') + word.toLowerCase();\\n    });\\n\\n    /**\\n     * Splits `string` by `separator`.\\n     *\\n     * **Note:** This method is based on\\n     * [`String#split`](https://mdn.io/String/split).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to split.\\n     * @param {RegExp|string} separator The separator pattern to split by.\\n     * @param {number} [limit] The length to truncate results to.\\n     * @returns {Array} Returns the new array of string segments.\\n     * @example\\n     *\\n     * _.split('a-b-c', '-', 2);\\n     * // => ['a', 'b']\\n     */\\n    function split(string, separator, limit) {\\n      if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {\\n        separator = limit = undefined;\\n      }\\n      limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;\\n      if (!limit) {\\n        return [];\\n      }\\n      string = toString(string);\\n      if (string && (\\n            typeof separator == 'string' ||\\n            (separator != null && !isRegExp(separator))\\n          )) {\\n        separator += '';\\n        if (separator == '' && reHasComplexSymbol.test(string)) {\\n          return castSlice(stringToArray(string), 0, limit);\\n        }\\n      }\\n      return nativeSplit.call(string, separator, limit);\\n    }\\n\\n    /**\\n     * Converts `string` to\\n     * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.1.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the start cased string.\\n     * @example\\n     *\\n     * _.startCase('--foo-bar--');\\n     * // => 'Foo Bar'\\n     *\\n     * _.startCase('fooBar');\\n     * // => 'Foo Bar'\\n     *\\n     * _.startCase('__FOO_BAR__');\\n     * // => 'FOO BAR'\\n     */\\n    var startCase = createCompounder(function(result, word, index) {\\n      return result + (index ? ' ' : '') + upperFirst(word);\\n    });\\n\\n    /**\\n     * Checks if `string` starts with the given target string.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to search.\\n     * @param {string} [target] The string to search for.\\n     * @param {number} [position=0] The position to search from.\\n     * @returns {boolean} Returns `true` if `string` starts with `target`,\\n     *  else `false`.\\n     * @example\\n     *\\n     * _.startsWith('abc', 'a');\\n     * // => true\\n     *\\n     * _.startsWith('abc', 'b');\\n     * // => false\\n     *\\n     * _.startsWith('abc', 'b', 1);\\n     * // => true\\n     */\\n    function startsWith(string, target, position) {\\n      string = toString(string);\\n      position = baseClamp(toInteger(position), 0, string.length);\\n      return string.lastIndexOf(target, position) == position;\\n    }\\n\\n    /**\\n     * Creates a compiled template function that can interpolate data properties\\n     * in \\\"interpolate\\\" delimiters, HTML-escape interpolated data properties in\\n     * \\\"escape\\\" delimiters, and execute JavaScript in \\\"evaluate\\\" delimiters. Data\\n     * properties may be accessed as free variables in the template. If a setting\\n     * object is given, it takes precedence over `_.templateSettings` values.\\n     *\\n     * **Note:** In the development build `_.template` utilizes\\n     * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\\n     * for easier debugging.\\n     *\\n     * For more information on precompiling templates see\\n     * [lodash's custom builds documentation](https://lodash.com/custom-builds).\\n     *\\n     * For more information on Chrome extension sandboxes see\\n     * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category String\\n     * @param {string} [string=''] The template string.\\n     * @param {Object} [options={}] The options object.\\n     * @param {RegExp} [options.escape=_.templateSettings.escape]\\n     *  The HTML \\\"escape\\\" delimiter.\\n     * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\\n     *  The \\\"evaluate\\\" delimiter.\\n     * @param {Object} [options.imports=_.templateSettings.imports]\\n     *  An object to import into the template as free variables.\\n     * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\\n     *  The \\\"interpolate\\\" delimiter.\\n     * @param {string} [options.sourceURL='lodash.templateSources[n]']\\n     *  The sourceURL of the compiled template.\\n     * @param {string} [options.variable='obj']\\n     *  The data object variable name.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Function} Returns the compiled template function.\\n     * @example\\n     *\\n     * // Use the \\\"interpolate\\\" delimiter to create a compiled template.\\n     * var compiled = _.template('hello <%= user %>!');\\n     * compiled({ 'user': 'fred' });\\n     * // => 'hello fred!'\\n     *\\n     * // Use the HTML \\\"escape\\\" delimiter to escape data property values.\\n     * var compiled = _.template('<b><%- value %></b>');\\n     * compiled({ 'value': '<script>' });\\n     * // => '<b>&lt;script&gt;</b>'\\n     *\\n     * // Use the \\\"evaluate\\\" delimiter to execute JavaScript and generate HTML.\\n     * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\\n     * compiled({ 'users': ['fred', 'barney'] });\\n     * // => '<li>fred</li><li>barney</li>'\\n     *\\n     * // Use the internal `print` function in \\\"evaluate\\\" delimiters.\\n     * var compiled = _.template('<% print(\\\"hello \\\" + user); %>!');\\n     * compiled({ 'user': 'barney' });\\n     * // => 'hello barney!'\\n     *\\n     * // Use the ES delimiter as an alternative to the default \\\"interpolate\\\" delimiter.\\n     * var compiled = _.template('hello ${ user }!');\\n     * compiled({ 'user': 'pebbles' });\\n     * // => 'hello pebbles!'\\n     *\\n     * // Use custom template delimiters.\\n     * _.templateSettings.interpolate = /{{([\\\\s\\\\S]+?)}}/g;\\n     * var compiled = _.template('hello {{ user }}!');\\n     * compiled({ 'user': 'mustache' });\\n     * // => 'hello mustache!'\\n     *\\n     * // Use backslashes to treat delimiters as plain text.\\n     * var compiled = _.template('<%= \\\"\\\\\\\\<%- value %\\\\\\\\>\\\" %>');\\n     * compiled({ 'value': 'ignored' });\\n     * // => '<%- value %>'\\n     *\\n     * // Use the `imports` option to import `jQuery` as `jq`.\\n     * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\\n     * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });\\n     * compiled({ 'users': ['fred', 'barney'] });\\n     * // => '<li>fred</li><li>barney</li>'\\n     *\\n     * // Use the `sourceURL` option to specify a custom sourceURL for the template.\\n     * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\\n     * compiled(data);\\n     * // => Find the source of \\\"greeting.jst\\\" under the Sources tab or Resources panel of the web inspector.\\n     *\\n     * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.\\n     * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\\n     * compiled.source;\\n     * // => function(data) {\\n     * //   var __t, __p = '';\\n     * //   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\\n     * //   return __p;\\n     * // }\\n     *\\n     * // Use the `source` property to inline compiled templates for meaningful\\n     * // line numbers in error messages and stack traces.\\n     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\\\\\\n     *   var JST = {\\\\\\n     *     \\\"main\\\": ' + _.template(mainText).source + '\\\\\\n     *   };\\\\\\n     * ');\\n     */\\n    function template(string, options, guard) {\\n      // Based on John Resig's `tmpl` implementation\\n      // (http://ejohn.org/blog/javascript-micro-templating/)\\n      // and Laura Doktorova's doT.js (https://github.com/olado/doT).\\n      var settings = lodash.templateSettings;\\n\\n      if (guard && isIterateeCall(string, options, guard)) {\\n        options = undefined;\\n      }\\n      string = toString(string);\\n      options = assignInWith({}, options, settings, assignInDefaults);\\n\\n      var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults),\\n          importsKeys = keys(imports),\\n          importsValues = baseValues(imports, importsKeys);\\n\\n      var isEscaping,\\n          isEvaluating,\\n          index = 0,\\n          interpolate = options.interpolate || reNoMatch,\\n          source = \\\"__p += '\\\";\\n\\n      // Compile the regexp to match each delimiter.\\n      var reDelimiters = RegExp(\\n        (options.escape || reNoMatch).source + '|' +\\n        interpolate.source + '|' +\\n        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +\\n        (options.evaluate || reNoMatch).source + '|$'\\n      , 'g');\\n\\n      // Use a sourceURL for easier debugging.\\n      var sourceURL = '//# sourceURL=' +\\n        ('sourceURL' in options\\n          ? options.sourceURL\\n          : ('lodash.templateSources[' + (++templateCounter) + ']')\\n        ) + '\\\\n';\\n\\n      string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {\\n        interpolateValue || (interpolateValue = esTemplateValue);\\n\\n        // Escape characters that can't be included in string literals.\\n        source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);\\n\\n        // Replace delimiters with snippets.\\n        if (escapeValue) {\\n          isEscaping = true;\\n          source += \\\"' +\\\\n__e(\\\" + escapeValue + \\\") +\\\\n'\\\";\\n        }\\n        if (evaluateValue) {\\n          isEvaluating = true;\\n          source += \\\"';\\\\n\\\" + evaluateValue + \\\";\\\\n__p += '\\\";\\n        }\\n        if (interpolateValue) {\\n          source += \\\"' +\\\\n((__t = (\\\" + interpolateValue + \\\")) == null ? '' : __t) +\\\\n'\\\";\\n        }\\n        index = offset + match.length;\\n\\n        // The JS engine embedded in Adobe products needs `match` returned in\\n        // order to produce the correct `offset` value.\\n        return match;\\n      });\\n\\n      source += \\\"';\\\\n\\\";\\n\\n      // If `variable` is not specified wrap a with-statement around the generated\\n      // code to add the data object to the top of the scope chain.\\n      var variable = options.variable;\\n      if (!variable) {\\n        source = 'with (obj) {\\\\n' + source + '\\\\n}\\\\n';\\n      }\\n      // Cleanup code by stripping empty strings.\\n      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)\\n        .replace(reEmptyStringMiddle, '$1')\\n        .replace(reEmptyStringTrailing, '$1;');\\n\\n      // Frame code as the function body.\\n      source = 'function(' + (variable || 'obj') + ') {\\\\n' +\\n        (variable\\n          ? ''\\n          : 'obj || (obj = {});\\\\n'\\n        ) +\\n        \\\"var __t, __p = ''\\\" +\\n        (isEscaping\\n           ? ', __e = _.escape'\\n           : ''\\n        ) +\\n        (isEvaluating\\n          ? ', __j = Array.prototype.join;\\\\n' +\\n            \\\"function print() { __p += __j.call(arguments, '') }\\\\n\\\"\\n          : ';\\\\n'\\n        ) +\\n        source +\\n        'return __p\\\\n}';\\n\\n      var result = attempt(function() {\\n        return Function(importsKeys, sourceURL + 'return ' + source)\\n          .apply(undefined, importsValues);\\n      });\\n\\n      // Provide the compiled function's source by its `toString` method or\\n      // the `source` property as a convenience for inlining compiled templates.\\n      result.source = source;\\n      if (isError(result)) {\\n        throw result;\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Converts `string`, as a whole, to lower case just like\\n     * [String#toLowerCase](https://mdn.io/toLowerCase).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the lower cased string.\\n     * @example\\n     *\\n     * _.toLower('--Foo-Bar--');\\n     * // => '--foo-bar--'\\n     *\\n     * _.toLower('fooBar');\\n     * // => 'foobar'\\n     *\\n     * _.toLower('__FOO_BAR__');\\n     * // => '__foo_bar__'\\n     */\\n    function toLower(value) {\\n      return toString(value).toLowerCase();\\n    }\\n\\n    /**\\n     * Converts `string`, as a whole, to upper case just like\\n     * [String#toUpperCase](https://mdn.io/toUpperCase).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the upper cased string.\\n     * @example\\n     *\\n     * _.toUpper('--foo-bar--');\\n     * // => '--FOO-BAR--'\\n     *\\n     * _.toUpper('fooBar');\\n     * // => 'FOOBAR'\\n     *\\n     * _.toUpper('__foo_bar__');\\n     * // => '__FOO_BAR__'\\n     */\\n    function toUpper(value) {\\n      return toString(value).toUpperCase();\\n    }\\n\\n    /**\\n     * Removes leading and trailing whitespace or specified characters from `string`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to trim.\\n     * @param {string} [chars=whitespace] The characters to trim.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {string} Returns the trimmed string.\\n     * @example\\n     *\\n     * _.trim('  abc  ');\\n     * // => 'abc'\\n     *\\n     * _.trim('-_-abc-_-', '_-');\\n     * // => 'abc'\\n     *\\n     * _.map(['  foo  ', '  bar  '], _.trim);\\n     * // => ['foo', 'bar']\\n     */\\n    function trim(string, chars, guard) {\\n      string = toString(string);\\n      if (!string) {\\n        return string;\\n      }\\n      if (guard || chars === undefined) {\\n        return string.replace(reTrim, '');\\n      }\\n      if (!(chars += '')) {\\n        return string;\\n      }\\n      var strSymbols = stringToArray(string),\\n          chrSymbols = stringToArray(chars),\\n          start = charsStartIndex(strSymbols, chrSymbols),\\n          end = charsEndIndex(strSymbols, chrSymbols) + 1;\\n\\n      return castSlice(strSymbols, start, end).join('');\\n    }\\n\\n    /**\\n     * Removes trailing whitespace or specified characters from `string`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to trim.\\n     * @param {string} [chars=whitespace] The characters to trim.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {string} Returns the trimmed string.\\n     * @example\\n     *\\n     * _.trimEnd('  abc  ');\\n     * // => '  abc'\\n     *\\n     * _.trimEnd('-_-abc-_-', '_-');\\n     * // => '-_-abc'\\n     */\\n    function trimEnd(string, chars, guard) {\\n      string = toString(string);\\n      if (!string) {\\n        return string;\\n      }\\n      if (guard || chars === undefined) {\\n        return string.replace(reTrimEnd, '');\\n      }\\n      if (!(chars += '')) {\\n        return string;\\n      }\\n      var strSymbols = stringToArray(string),\\n          end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;\\n\\n      return castSlice(strSymbols, 0, end).join('');\\n    }\\n\\n    /**\\n     * Removes leading whitespace or specified characters from `string`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to trim.\\n     * @param {string} [chars=whitespace] The characters to trim.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {string} Returns the trimmed string.\\n     * @example\\n     *\\n     * _.trimStart('  abc  ');\\n     * // => 'abc  '\\n     *\\n     * _.trimStart('-_-abc-_-', '_-');\\n     * // => 'abc-_-'\\n     */\\n    function trimStart(string, chars, guard) {\\n      string = toString(string);\\n      if (!string) {\\n        return string;\\n      }\\n      if (guard || chars === undefined) {\\n        return string.replace(reTrimStart, '');\\n      }\\n      if (!(chars += '')) {\\n        return string;\\n      }\\n      var strSymbols = stringToArray(string),\\n          start = charsStartIndex(strSymbols, stringToArray(chars));\\n\\n      return castSlice(strSymbols, start).join('');\\n    }\\n\\n    /**\\n     * Truncates `string` if it's longer than the given maximum string length.\\n     * The last characters of the truncated string are replaced with the omission\\n     * string which defaults to \\\"...\\\".\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to truncate.\\n     * @param {Object} [options={}] The options object.\\n     * @param {number} [options.length=30] The maximum string length.\\n     * @param {string} [options.omission='...'] The string to indicate text is omitted.\\n     * @param {RegExp|string} [options.separator] The separator pattern to truncate to.\\n     * @returns {string} Returns the truncated string.\\n     * @example\\n     *\\n     * _.truncate('hi-diddly-ho there, neighborino');\\n     * // => 'hi-diddly-ho there, neighbo...'\\n     *\\n     * _.truncate('hi-diddly-ho there, neighborino', {\\n     *   'length': 24,\\n     *   'separator': ' '\\n     * });\\n     * // => 'hi-diddly-ho there,...'\\n     *\\n     * _.truncate('hi-diddly-ho there, neighborino', {\\n     *   'length': 24,\\n     *   'separator': /,? +/\\n     * });\\n     * // => 'hi-diddly-ho there...'\\n     *\\n     * _.truncate('hi-diddly-ho there, neighborino', {\\n     *   'omission': ' [...]'\\n     * });\\n     * // => 'hi-diddly-ho there, neig [...]'\\n     */\\n    function truncate(string, options) {\\n      var length = DEFAULT_TRUNC_LENGTH,\\n          omission = DEFAULT_TRUNC_OMISSION;\\n\\n      if (isObject(options)) {\\n        var separator = 'separator' in options ? options.separator : separator;\\n        length = 'length' in options ? toInteger(options.length) : length;\\n        omission = 'omission' in options ? toString(options.omission) : omission;\\n      }\\n      string = toString(string);\\n\\n      var strLength = string.length;\\n      if (reHasComplexSymbol.test(string)) {\\n        var strSymbols = stringToArray(string);\\n        strLength = strSymbols.length;\\n      }\\n      if (length >= strLength) {\\n        return string;\\n      }\\n      var end = length - stringSize(omission);\\n      if (end < 1) {\\n        return omission;\\n      }\\n      var result = strSymbols\\n        ? castSlice(strSymbols, 0, end).join('')\\n        : string.slice(0, end);\\n\\n      if (separator === undefined) {\\n        return result + omission;\\n      }\\n      if (strSymbols) {\\n        end += (result.length - end);\\n      }\\n      if (isRegExp(separator)) {\\n        if (string.slice(end).search(separator)) {\\n          var match,\\n              substring = result;\\n\\n          if (!separator.global) {\\n            separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');\\n          }\\n          separator.lastIndex = 0;\\n          while ((match = separator.exec(substring))) {\\n            var newEnd = match.index;\\n          }\\n          result = result.slice(0, newEnd === undefined ? end : newEnd);\\n        }\\n      } else if (string.indexOf(separator, end) != end) {\\n        var index = result.lastIndexOf(separator);\\n        if (index > -1) {\\n          result = result.slice(0, index);\\n        }\\n      }\\n      return result + omission;\\n    }\\n\\n    /**\\n     * The inverse of `_.escape`; this method converts the HTML entities\\n     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to\\n     * their corresponding characters.\\n     *\\n     * **Note:** No other HTML entities are unescaped. To unescape additional\\n     * HTML entities use a third-party library like [_he_](https://mths.be/he).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 0.6.0\\n     * @category String\\n     * @param {string} [string=''] The string to unescape.\\n     * @returns {string} Returns the unescaped string.\\n     * @example\\n     *\\n     * _.unescape('fred, barney, &amp; pebbles');\\n     * // => 'fred, barney, & pebbles'\\n     */\\n    function unescape(string) {\\n      string = toString(string);\\n      return (string && reHasEscapedHtml.test(string))\\n        ? string.replace(reEscapedHtml, unescapeHtmlChar)\\n        : string;\\n    }\\n\\n    /**\\n     * Converts `string`, as space separated words, to upper case.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the upper cased string.\\n     * @example\\n     *\\n     * _.upperCase('--foo-bar');\\n     * // => 'FOO BAR'\\n     *\\n     * _.upperCase('fooBar');\\n     * // => 'FOO BAR'\\n     *\\n     * _.upperCase('__foo_bar__');\\n     * // => 'FOO BAR'\\n     */\\n    var upperCase = createCompounder(function(result, word, index) {\\n      return result + (index ? ' ' : '') + word.toUpperCase();\\n    });\\n\\n    /**\\n     * Converts the first character of `string` to upper case.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to convert.\\n     * @returns {string} Returns the converted string.\\n     * @example\\n     *\\n     * _.upperFirst('fred');\\n     * // => 'Fred'\\n     *\\n     * _.upperFirst('FRED');\\n     * // => 'FRED'\\n     */\\n    var upperFirst = createCaseFirst('toUpperCase');\\n\\n    /**\\n     * Splits `string` into an array of its words.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category String\\n     * @param {string} [string=''] The string to inspect.\\n     * @param {RegExp|string} [pattern] The pattern to match words.\\n     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\\n     * @returns {Array} Returns the words of `string`.\\n     * @example\\n     *\\n     * _.words('fred, barney, & pebbles');\\n     * // => ['fred', 'barney', 'pebbles']\\n     *\\n     * _.words('fred, barney, & pebbles', /[^, ]+/g);\\n     * // => ['fred', 'barney', '&', 'pebbles']\\n     */\\n    function words(string, pattern, guard) {\\n      string = toString(string);\\n      pattern = guard ? undefined : pattern;\\n\\n      if (pattern === undefined) {\\n        pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord;\\n      }\\n      return string.match(pattern) || [];\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Attempts to invoke `func`, returning either the result or the caught error\\n     * object. Any additional arguments are provided to `func` when it's invoked.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Util\\n     * @param {Function} func The function to attempt.\\n     * @param {...*} [args] The arguments to invoke `func` with.\\n     * @returns {*} Returns the `func` result or error object.\\n     * @example\\n     *\\n     * // Avoid throwing errors for invalid selectors.\\n     * var elements = _.attempt(function(selector) {\\n     *   return document.querySelectorAll(selector);\\n     * }, '>_>');\\n     *\\n     * if (_.isError(elements)) {\\n     *   elements = [];\\n     * }\\n     */\\n    var attempt = rest(function(func, args) {\\n      try {\\n        return apply(func, undefined, args);\\n      } catch (e) {\\n        return isError(e) ? e : new Error(e);\\n      }\\n    });\\n\\n    /**\\n     * Binds methods of an object to the object itself, overwriting the existing\\n     * method.\\n     *\\n     * **Note:** This method doesn't set the \\\"length\\\" property of bound functions.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {Object} object The object to bind and assign the bound methods to.\\n     * @param {...(string|string[])} methodNames The object method names to bind.\\n     * @returns {Object} Returns `object`.\\n     * @example\\n     *\\n     * var view = {\\n     *   'label': 'docs',\\n     *   'onClick': function() {\\n     *     console.log('clicked ' + this.label);\\n     *   }\\n     * };\\n     *\\n     * _.bindAll(view, 'onClick');\\n     * jQuery(element).on('click', view.onClick);\\n     * // => Logs 'clicked docs' when clicked.\\n     */\\n    var bindAll = rest(function(object, methodNames) {\\n      arrayEach(baseFlatten(methodNames, 1), function(key) {\\n        object[key] = bind(object[key], object);\\n      });\\n      return object;\\n    });\\n\\n    /**\\n     * Creates a function that iterates over `pairs` and invokes the corresponding\\n     * function of the first predicate to return truthy. The predicate-function\\n     * pairs are invoked with the `this` binding and arguments of the created\\n     * function.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {Array} pairs The predicate-function pairs.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var func = _.cond([\\n     *   [_.matches({ 'a': 1 }),           _.constant('matches A')],\\n     *   [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],\\n     *   [_.constant(true),                _.constant('no match')]\\n     * ]);\\n     *\\n     * func({ 'a': 1, 'b': 2 });\\n     * // => 'matches A'\\n     *\\n     * func({ 'a': 0, 'b': 1 });\\n     * // => 'matches B'\\n     *\\n     * func({ 'a': '1', 'b': '2' });\\n     * // => 'no match'\\n     */\\n    function cond(pairs) {\\n      var length = pairs ? pairs.length : 0,\\n          toIteratee = getIteratee();\\n\\n      pairs = !length ? [] : arrayMap(pairs, function(pair) {\\n        if (typeof pair[1] != 'function') {\\n          throw new TypeError(FUNC_ERROR_TEXT);\\n        }\\n        return [toIteratee(pair[0]), pair[1]];\\n      });\\n\\n      return rest(function(args) {\\n        var index = -1;\\n        while (++index < length) {\\n          var pair = pairs[index];\\n          if (apply(pair[0], this, args)) {\\n            return apply(pair[1], this, args);\\n          }\\n        }\\n      });\\n    }\\n\\n    /**\\n     * Creates a function that invokes the predicate properties of `source` with\\n     * the corresponding property values of a given object, returning `true` if\\n     * all predicates return truthy, else `false`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {Object} source The object of property predicates to conform to.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'age': 36 },\\n     *   { 'user': 'fred',   'age': 40 }\\n     * ];\\n     *\\n     * _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) }));\\n     * // => [{ 'user': 'fred', 'age': 40 }]\\n     */\\n    function conforms(source) {\\n      return baseConforms(baseClone(source, true));\\n    }\\n\\n    /**\\n     * Creates a function that returns `value`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.4.0\\n     * @category Util\\n     * @param {*} value The value to return from the new function.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var object = { 'user': 'fred' };\\n     * var getter = _.constant(object);\\n     *\\n     * getter() === object;\\n     * // => true\\n     */\\n    function constant(value) {\\n      return function() {\\n        return value;\\n      };\\n    }\\n\\n    /**\\n     * Creates a function that returns the result of invoking the given functions\\n     * with the `this` binding of the created function, where each successive\\n     * invocation is supplied the return value of the previous.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Util\\n     * @param {...(Function|Function[])} [funcs] Functions to invoke.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * function square(n) {\\n     *   return n * n;\\n     * }\\n     *\\n     * var addSquare = _.flow(_.add, square);\\n     * addSquare(1, 2);\\n     * // => 9\\n     */\\n    var flow = createFlow();\\n\\n    /**\\n     * This method is like `_.flow` except that it creates a function that\\n     * invokes the given functions from right to left.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {...(Function|Function[])} [funcs] Functions to invoke.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * function square(n) {\\n     *   return n * n;\\n     * }\\n     *\\n     * var addSquare = _.flowRight(square, _.add);\\n     * addSquare(1, 2);\\n     * // => 9\\n     */\\n    var flowRight = createFlow(true);\\n\\n    /**\\n     * This method returns the first argument given to it.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {*} value Any value.\\n     * @returns {*} Returns `value`.\\n     * @example\\n     *\\n     * var object = { 'user': 'fred' };\\n     *\\n     * _.identity(object) === object;\\n     * // => true\\n     */\\n    function identity(value) {\\n      return value;\\n    }\\n\\n    /**\\n     * Creates a function that invokes `func` with the arguments of the created\\n     * function. If `func` is a property name, the created function returns the\\n     * property value for a given element. If `func` is an array or object, the\\n     * created function returns `true` for elements that contain the equivalent\\n     * source properties, otherwise it returns `false`.\\n     *\\n     * @static\\n     * @since 4.0.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {*} [func=_.identity] The value to convert to a callback.\\n     * @returns {Function} Returns the callback.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'age': 36, 'active': true },\\n     *   { 'user': 'fred',   'age': 40, 'active': false }\\n     * ];\\n     *\\n     * // The `_.matches` iteratee shorthand.\\n     * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));\\n     * // => [{ 'user': 'barney', 'age': 36, 'active': true }]\\n     *\\n     * // The `_.matchesProperty` iteratee shorthand.\\n     * _.filter(users, _.iteratee(['user', 'fred']));\\n     * // => [{ 'user': 'fred', 'age': 40 }]\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.map(users, _.iteratee('user'));\\n     * // => ['barney', 'fred']\\n     *\\n     * // Create custom iteratee shorthands.\\n     * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {\\n     *   return !_.isRegExp(func) ? iteratee(func) : function(string) {\\n     *     return func.test(string);\\n     *   };\\n     * });\\n     *\\n     * _.filter(['abc', 'def'], /ef/);\\n     * // => ['def']\\n     */\\n    function iteratee(func) {\\n      return baseIteratee(typeof func == 'function' ? func : baseClone(func, true));\\n    }\\n\\n    /**\\n     * Creates a function that performs a partial deep comparison between a given\\n     * object and `source`, returning `true` if the given object has equivalent\\n     * property values, else `false`. The created function is equivalent to\\n     * `_.isMatch` with a `source` partially applied.\\n     *\\n     * **Note:** This method supports comparing the same values as `_.isEqual`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Util\\n     * @param {Object} source The object of property values to match.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney', 'age': 36, 'active': true },\\n     *   { 'user': 'fred',   'age': 40, 'active': false }\\n     * ];\\n     *\\n     * _.filter(users, _.matches({ 'age': 40, 'active': false }));\\n     * // => [{ 'user': 'fred', 'age': 40, 'active': false }]\\n     */\\n    function matches(source) {\\n      return baseMatches(baseClone(source, true));\\n    }\\n\\n    /**\\n     * Creates a function that performs a partial deep comparison between the\\n     * value at `path` of a given object to `srcValue`, returning `true` if the\\n     * object value is equivalent, else `false`.\\n     *\\n     * **Note:** This method supports comparing the same values as `_.isEqual`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.2.0\\n     * @category Util\\n     * @param {Array|string} path The path of the property to get.\\n     * @param {*} srcValue The value to match.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var users = [\\n     *   { 'user': 'barney' },\\n     *   { 'user': 'fred' }\\n     * ];\\n     *\\n     * _.find(users, _.matchesProperty('user', 'fred'));\\n     * // => { 'user': 'fred' }\\n     */\\n    function matchesProperty(path, srcValue) {\\n      return baseMatchesProperty(path, baseClone(srcValue, true));\\n    }\\n\\n    /**\\n     * Creates a function that invokes the method at `path` of a given object.\\n     * Any additional arguments are provided to the invoked method.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.7.0\\n     * @category Util\\n     * @param {Array|string} path The path of the method to invoke.\\n     * @param {...*} [args] The arguments to invoke the method with.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var objects = [\\n     *   { 'a': { 'b': _.constant(2) } },\\n     *   { 'a': { 'b': _.constant(1) } }\\n     * ];\\n     *\\n     * _.map(objects, _.method('a.b'));\\n     * // => [2, 1]\\n     *\\n     * _.map(objects, _.method(['a', 'b']));\\n     * // => [2, 1]\\n     */\\n    var method = rest(function(path, args) {\\n      return function(object) {\\n        return baseInvoke(object, path, args);\\n      };\\n    });\\n\\n    /**\\n     * The opposite of `_.method`; this method creates a function that invokes\\n     * the method at a given path of `object`. Any additional arguments are\\n     * provided to the invoked method.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.7.0\\n     * @category Util\\n     * @param {Object} object The object to query.\\n     * @param {...*} [args] The arguments to invoke the method with.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var array = _.times(3, _.constant),\\n     *     object = { 'a': array, 'b': array, 'c': array };\\n     *\\n     * _.map(['a[2]', 'c[0]'], _.methodOf(object));\\n     * // => [2, 0]\\n     *\\n     * _.map([['a', '2'], ['c', '0']], _.methodOf(object));\\n     * // => [2, 0]\\n     */\\n    var methodOf = rest(function(object, args) {\\n      return function(path) {\\n        return baseInvoke(object, path, args);\\n      };\\n    });\\n\\n    /**\\n     * Adds all own enumerable string keyed function properties of a source\\n     * object to the destination object. If `object` is a function, then methods\\n     * are added to its prototype as well.\\n     *\\n     * **Note:** Use `_.runInContext` to create a pristine `lodash` function to\\n     * avoid conflicts caused by modifying the original.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {Function|Object} [object=lodash] The destination object.\\n     * @param {Object} source The object of functions to add.\\n     * @param {Object} [options={}] The options object.\\n     * @param {boolean} [options.chain=true] Specify whether mixins are chainable.\\n     * @returns {Function|Object} Returns `object`.\\n     * @example\\n     *\\n     * function vowels(string) {\\n     *   return _.filter(string, function(v) {\\n     *     return /[aeiou]/i.test(v);\\n     *   });\\n     * }\\n     *\\n     * _.mixin({ 'vowels': vowels });\\n     * _.vowels('fred');\\n     * // => ['e']\\n     *\\n     * _('fred').vowels().value();\\n     * // => ['e']\\n     *\\n     * _.mixin({ 'vowels': vowels }, { 'chain': false });\\n     * _('fred').vowels();\\n     * // => ['e']\\n     */\\n    function mixin(object, source, options) {\\n      var props = keys(source),\\n          methodNames = baseFunctions(source, props);\\n\\n      if (options == null &&\\n          !(isObject(source) && (methodNames.length || !props.length))) {\\n        options = source;\\n        source = object;\\n        object = this;\\n        methodNames = baseFunctions(source, keys(source));\\n      }\\n      var chain = !(isObject(options) && 'chain' in options) || !!options.chain,\\n          isFunc = isFunction(object);\\n\\n      arrayEach(methodNames, function(methodName) {\\n        var func = source[methodName];\\n        object[methodName] = func;\\n        if (isFunc) {\\n          object.prototype[methodName] = function() {\\n            var chainAll = this.__chain__;\\n            if (chain || chainAll) {\\n              var result = object(this.__wrapped__),\\n                  actions = result.__actions__ = copyArray(this.__actions__);\\n\\n              actions.push({ 'func': func, 'args': arguments, 'thisArg': object });\\n              result.__chain__ = chainAll;\\n              return result;\\n            }\\n            return func.apply(object, arrayPush([this.value()], arguments));\\n          };\\n        }\\n      });\\n\\n      return object;\\n    }\\n\\n    /**\\n     * Reverts the `_` variable to its previous value and returns a reference to\\n     * the `lodash` function.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @returns {Function} Returns the `lodash` function.\\n     * @example\\n     *\\n     * var lodash = _.noConflict();\\n     */\\n    function noConflict() {\\n      if (root._ === this) {\\n        root._ = oldDash;\\n      }\\n      return this;\\n    }\\n\\n    /**\\n     * A no-operation function that returns `undefined` regardless of the\\n     * arguments it receives.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.3.0\\n     * @category Util\\n     * @example\\n     *\\n     * var object = { 'user': 'fred' };\\n     *\\n     * _.noop(object) === undefined;\\n     * // => true\\n     */\\n    function noop() {\\n      // No operation performed.\\n    }\\n\\n    /**\\n     * Creates a function that returns its nth argument. If `n` is negative,\\n     * the nth argument from the end is returned.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {number} [n=0] The index of the argument to return.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var func = _.nthArg(1);\\n     * func('a', 'b', 'c', 'd');\\n     * // => 'b'\\n     *\\n     * var func = _.nthArg(-2);\\n     * func('a', 'b', 'c', 'd');\\n     * // => 'c'\\n     */\\n    function nthArg(n) {\\n      n = toInteger(n);\\n      return rest(function(args) {\\n        return baseNth(args, n);\\n      });\\n    }\\n\\n    /**\\n     * Creates a function that invokes `iteratees` with the arguments it receives\\n     * and returns their results.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\\n     *  [iteratees=[_.identity]] The iteratees to invoke.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var func = _.over(Math.max, Math.min);\\n     *\\n     * func(1, 2, 3, 4);\\n     * // => [4, 1]\\n     */\\n    var over = createOver(arrayMap);\\n\\n    /**\\n     * Creates a function that checks if **all** of the `predicates` return\\n     * truthy when invoked with the arguments it receives.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\\n     *  [predicates=[_.identity]] The predicates to check.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var func = _.overEvery(Boolean, isFinite);\\n     *\\n     * func('1');\\n     * // => true\\n     *\\n     * func(null);\\n     * // => false\\n     *\\n     * func(NaN);\\n     * // => false\\n     */\\n    var overEvery = createOver(arrayEvery);\\n\\n    /**\\n     * Creates a function that checks if **any** of the `predicates` return\\n     * truthy when invoked with the arguments it receives.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}\\n     *  [predicates=[_.identity]] The predicates to check.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var func = _.overSome(Boolean, isFinite);\\n     *\\n     * func('1');\\n     * // => true\\n     *\\n     * func(null);\\n     * // => true\\n     *\\n     * func(NaN);\\n     * // => false\\n     */\\n    var overSome = createOver(arraySome);\\n\\n    /**\\n     * Creates a function that returns the value at `path` of a given object.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 2.4.0\\n     * @category Util\\n     * @param {Array|string} path The path of the property to get.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var objects = [\\n     *   { 'a': { 'b': 2 } },\\n     *   { 'a': { 'b': 1 } }\\n     * ];\\n     *\\n     * _.map(objects, _.property('a.b'));\\n     * // => [2, 1]\\n     *\\n     * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\\n     * // => [1, 2]\\n     */\\n    function property(path) {\\n      return isKey(path) ? baseProperty(path) : basePropertyDeep(path);\\n    }\\n\\n    /**\\n     * The opposite of `_.property`; this method creates a function that returns\\n     * the value at a given path of `object`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.0.0\\n     * @category Util\\n     * @param {Object} object The object to query.\\n     * @returns {Function} Returns the new function.\\n     * @example\\n     *\\n     * var array = [0, 1, 2],\\n     *     object = { 'a': array, 'b': array, 'c': array };\\n     *\\n     * _.map(['a[2]', 'c[0]'], _.propertyOf(object));\\n     * // => [2, 0]\\n     *\\n     * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));\\n     * // => [2, 0]\\n     */\\n    function propertyOf(object) {\\n      return function(path) {\\n        return object == null ? undefined : baseGet(object, path);\\n      };\\n    }\\n\\n    /**\\n     * Creates an array of numbers (positive and/or negative) progressing from\\n     * `start` up to, but not including, `end`. A step of `-1` is used if a negative\\n     * `start` is specified without an `end` or `step`. If `end` is not specified,\\n     * it's set to `start` with `start` then set to `0`.\\n     *\\n     * **Note:** JavaScript follows the IEEE-754 standard for resolving\\n     * floating-point values which can produce unexpected results.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {number} [start=0] The start of the range.\\n     * @param {number} end The end of the range.\\n     * @param {number} [step=1] The value to increment or decrement by.\\n     * @returns {Array} Returns the new array of numbers.\\n     * @example\\n     *\\n     * _.range(4);\\n     * // => [0, 1, 2, 3]\\n     *\\n     * _.range(-4);\\n     * // => [0, -1, -2, -3]\\n     *\\n     * _.range(1, 5);\\n     * // => [1, 2, 3, 4]\\n     *\\n     * _.range(0, 20, 5);\\n     * // => [0, 5, 10, 15]\\n     *\\n     * _.range(0, -4, -1);\\n     * // => [0, -1, -2, -3]\\n     *\\n     * _.range(1, 4, 0);\\n     * // => [1, 1, 1]\\n     *\\n     * _.range(0);\\n     * // => []\\n     */\\n    var range = createRange();\\n\\n    /**\\n     * This method is like `_.range` except that it populates values in\\n     * descending order.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {number} [start=0] The start of the range.\\n     * @param {number} end The end of the range.\\n     * @param {number} [step=1] The value to increment or decrement by.\\n     * @returns {Array} Returns the new array of numbers.\\n     * @example\\n     *\\n     * _.rangeRight(4);\\n     * // => [3, 2, 1, 0]\\n     *\\n     * _.rangeRight(-4);\\n     * // => [-3, -2, -1, 0]\\n     *\\n     * _.rangeRight(1, 5);\\n     * // => [4, 3, 2, 1]\\n     *\\n     * _.rangeRight(0, 20, 5);\\n     * // => [15, 10, 5, 0]\\n     *\\n     * _.rangeRight(0, -4, -1);\\n     * // => [-3, -2, -1, 0]\\n     *\\n     * _.rangeRight(1, 4, 0);\\n     * // => [1, 1, 1]\\n     *\\n     * _.rangeRight(0);\\n     * // => []\\n     */\\n    var rangeRight = createRange(true);\\n\\n    /**\\n     * Invokes the iteratee `n` times, returning an array of the results of\\n     * each invocation. The iteratee is invoked with one argument; (index).\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {number} n The number of times to invoke `iteratee`.\\n     * @param {Function} [iteratee=_.identity] The function invoked per iteration.\\n     * @returns {Array} Returns the array of results.\\n     * @example\\n     *\\n     * _.times(3, String);\\n     * // => ['0', '1', '2']\\n     *\\n     *  _.times(4, _.constant(true));\\n     * // => [true, true, true, true]\\n     */\\n    function times(n, iteratee) {\\n      n = toInteger(n);\\n      if (n < 1 || n > MAX_SAFE_INTEGER) {\\n        return [];\\n      }\\n      var index = MAX_ARRAY_LENGTH,\\n          length = nativeMin(n, MAX_ARRAY_LENGTH);\\n\\n      iteratee = getIteratee(iteratee);\\n      n -= MAX_ARRAY_LENGTH;\\n\\n      var result = baseTimes(length, iteratee);\\n      while (++index < n) {\\n        iteratee(index);\\n      }\\n      return result;\\n    }\\n\\n    /**\\n     * Converts `value` to a property path array.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Util\\n     * @param {*} value The value to convert.\\n     * @returns {Array} Returns the new property path array.\\n     * @example\\n     *\\n     * _.toPath('a.b.c');\\n     * // => ['a', 'b', 'c']\\n     *\\n     * _.toPath('a[0].b.c');\\n     * // => ['a', '0', 'b', 'c']\\n     *\\n     * var path = ['a', 'b', 'c'],\\n     *     newPath = _.toPath(path);\\n     *\\n     * console.log(newPath);\\n     * // => ['a', 'b', 'c']\\n     *\\n     * console.log(path === newPath);\\n     * // => false\\n     */\\n    function toPath(value) {\\n      if (isArray(value)) {\\n        return arrayMap(value, toKey);\\n      }\\n      return isSymbol(value) ? [value] : copyArray(stringToPath(value));\\n    }\\n\\n    /**\\n     * Generates a unique ID. If `prefix` is given, the ID is appended to it.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Util\\n     * @param {string} [prefix=''] The value to prefix the ID with.\\n     * @returns {string} Returns the unique ID.\\n     * @example\\n     *\\n     * _.uniqueId('contact_');\\n     * // => 'contact_104'\\n     *\\n     * _.uniqueId();\\n     * // => '105'\\n     */\\n    function uniqueId(prefix) {\\n      var id = ++idCounter;\\n      return toString(prefix) + id;\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * Adds two numbers.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.4.0\\n     * @category Math\\n     * @param {number} augend The first number in an addition.\\n     * @param {number} addend The second number in an addition.\\n     * @returns {number} Returns the total.\\n     * @example\\n     *\\n     * _.add(6, 4);\\n     * // => 10\\n     */\\n    var add = createMathOperation(function(augend, addend) {\\n      return augend + addend;\\n    });\\n\\n    /**\\n     * Computes `number` rounded up to `precision`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.10.0\\n     * @category Math\\n     * @param {number} number The number to round up.\\n     * @param {number} [precision=0] The precision to round up to.\\n     * @returns {number} Returns the rounded up number.\\n     * @example\\n     *\\n     * _.ceil(4.006);\\n     * // => 5\\n     *\\n     * _.ceil(6.004, 2);\\n     * // => 6.01\\n     *\\n     * _.ceil(6040, -2);\\n     * // => 6100\\n     */\\n    var ceil = createRound('ceil');\\n\\n    /**\\n     * Divide two numbers.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.7.0\\n     * @category Math\\n     * @param {number} dividend The first number in a division.\\n     * @param {number} divisor The second number in a division.\\n     * @returns {number} Returns the quotient.\\n     * @example\\n     *\\n     * _.divide(6, 4);\\n     * // => 1.5\\n     */\\n    var divide = createMathOperation(function(dividend, divisor) {\\n      return dividend / divisor;\\n    });\\n\\n    /**\\n     * Computes `number` rounded down to `precision`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.10.0\\n     * @category Math\\n     * @param {number} number The number to round down.\\n     * @param {number} [precision=0] The precision to round down to.\\n     * @returns {number} Returns the rounded down number.\\n     * @example\\n     *\\n     * _.floor(4.006);\\n     * // => 4\\n     *\\n     * _.floor(0.046, 2);\\n     * // => 0.04\\n     *\\n     * _.floor(4060, -2);\\n     * // => 4000\\n     */\\n    var floor = createRound('floor');\\n\\n    /**\\n     * Computes the maximum value of `array`. If `array` is empty or falsey,\\n     * `undefined` is returned.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @returns {*} Returns the maximum value.\\n     * @example\\n     *\\n     * _.max([4, 2, 8, 6]);\\n     * // => 8\\n     *\\n     * _.max([]);\\n     * // => undefined\\n     */\\n    function max(array) {\\n      return (array && array.length)\\n        ? baseExtremum(array, identity, gt)\\n        : undefined;\\n    }\\n\\n    /**\\n     * This method is like `_.max` except that it accepts `iteratee` which is\\n     * invoked for each element in `array` to generate the criterion by which\\n     * the value is ranked. The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {*} Returns the maximum value.\\n     * @example\\n     *\\n     * var objects = [{ 'n': 1 }, { 'n': 2 }];\\n     *\\n     * _.maxBy(objects, function(o) { return o.n; });\\n     * // => { 'n': 2 }\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.maxBy(objects, 'n');\\n     * // => { 'n': 2 }\\n     */\\n    function maxBy(array, iteratee) {\\n      return (array && array.length)\\n        ? baseExtremum(array, getIteratee(iteratee), gt)\\n        : undefined;\\n    }\\n\\n    /**\\n     * Computes the mean of the values in `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @returns {number} Returns the mean.\\n     * @example\\n     *\\n     * _.mean([4, 2, 8, 6]);\\n     * // => 5\\n     */\\n    function mean(array) {\\n      return baseMean(array, identity);\\n    }\\n\\n    /**\\n     * This method is like `_.mean` except that it accepts `iteratee` which is\\n     * invoked for each element in `array` to generate the value to be averaged.\\n     * The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.7.0\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {number} Returns the mean.\\n     * @example\\n     *\\n     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\\n     *\\n     * _.meanBy(objects, function(o) { return o.n; });\\n     * // => 5\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.meanBy(objects, 'n');\\n     * // => 5\\n     */\\n    function meanBy(array, iteratee) {\\n      return baseMean(array, getIteratee(iteratee));\\n    }\\n\\n    /**\\n     * Computes the minimum value of `array`. If `array` is empty or falsey,\\n     * `undefined` is returned.\\n     *\\n     * @static\\n     * @since 0.1.0\\n     * @memberOf _\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @returns {*} Returns the minimum value.\\n     * @example\\n     *\\n     * _.min([4, 2, 8, 6]);\\n     * // => 2\\n     *\\n     * _.min([]);\\n     * // => undefined\\n     */\\n    function min(array) {\\n      return (array && array.length)\\n        ? baseExtremum(array, identity, lt)\\n        : undefined;\\n    }\\n\\n    /**\\n     * This method is like `_.min` except that it accepts `iteratee` which is\\n     * invoked for each element in `array` to generate the criterion by which\\n     * the value is ranked. The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {*} Returns the minimum value.\\n     * @example\\n     *\\n     * var objects = [{ 'n': 1 }, { 'n': 2 }];\\n     *\\n     * _.minBy(objects, function(o) { return o.n; });\\n     * // => { 'n': 1 }\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.minBy(objects, 'n');\\n     * // => { 'n': 1 }\\n     */\\n    function minBy(array, iteratee) {\\n      return (array && array.length)\\n        ? baseExtremum(array, getIteratee(iteratee), lt)\\n        : undefined;\\n    }\\n\\n    /**\\n     * Multiply two numbers.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.7.0\\n     * @category Math\\n     * @param {number} multiplier The first number in a multiplication.\\n     * @param {number} multiplicand The second number in a multiplication.\\n     * @returns {number} Returns the product.\\n     * @example\\n     *\\n     * _.multiply(6, 4);\\n     * // => 24\\n     */\\n    var multiply = createMathOperation(function(multiplier, multiplicand) {\\n      return multiplier * multiplicand;\\n    });\\n\\n    /**\\n     * Computes `number` rounded to `precision`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.10.0\\n     * @category Math\\n     * @param {number} number The number to round.\\n     * @param {number} [precision=0] The precision to round to.\\n     * @returns {number} Returns the rounded number.\\n     * @example\\n     *\\n     * _.round(4.006);\\n     * // => 4\\n     *\\n     * _.round(4.006, 2);\\n     * // => 4.01\\n     *\\n     * _.round(4060, -2);\\n     * // => 4100\\n     */\\n    var round = createRound('round');\\n\\n    /**\\n     * Subtract two numbers.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Math\\n     * @param {number} minuend The first number in a subtraction.\\n     * @param {number} subtrahend The second number in a subtraction.\\n     * @returns {number} Returns the difference.\\n     * @example\\n     *\\n     * _.subtract(6, 4);\\n     * // => 2\\n     */\\n    var subtract = createMathOperation(function(minuend, subtrahend) {\\n      return minuend - subtrahend;\\n    });\\n\\n    /**\\n     * Computes the sum of the values in `array`.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 3.4.0\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @returns {number} Returns the sum.\\n     * @example\\n     *\\n     * _.sum([4, 2, 8, 6]);\\n     * // => 20\\n     */\\n    function sum(array) {\\n      return (array && array.length)\\n        ? baseSum(array, identity)\\n        : 0;\\n    }\\n\\n    /**\\n     * This method is like `_.sum` except that it accepts `iteratee` which is\\n     * invoked for each element in `array` to generate the value to be summed.\\n     * The iteratee is invoked with one argument: (value).\\n     *\\n     * @static\\n     * @memberOf _\\n     * @since 4.0.0\\n     * @category Math\\n     * @param {Array} array The array to iterate over.\\n     * @param {Array|Function|Object|string} [iteratee=_.identity]\\n     *  The iteratee invoked per element.\\n     * @returns {number} Returns the sum.\\n     * @example\\n     *\\n     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\\n     *\\n     * _.sumBy(objects, function(o) { return o.n; });\\n     * // => 20\\n     *\\n     * // The `_.property` iteratee shorthand.\\n     * _.sumBy(objects, 'n');\\n     * // => 20\\n     */\\n    function sumBy(array, iteratee) {\\n      return (array && array.length)\\n        ? baseSum(array, getIteratee(iteratee))\\n        : 0;\\n    }\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    // Add methods that return wrapped values in chain sequences.\\n    lodash.after = after;\\n    lodash.ary = ary;\\n    lodash.assign = assign;\\n    lodash.assignIn = assignIn;\\n    lodash.assignInWith = assignInWith;\\n    lodash.assignWith = assignWith;\\n    lodash.at = at;\\n    lodash.before = before;\\n    lodash.bind = bind;\\n    lodash.bindAll = bindAll;\\n    lodash.bindKey = bindKey;\\n    lodash.castArray = castArray;\\n    lodash.chain = chain;\\n    lodash.chunk = chunk;\\n    lodash.compact = compact;\\n    lodash.concat = concat;\\n    lodash.cond = cond;\\n    lodash.conforms = conforms;\\n    lodash.constant = constant;\\n    lodash.countBy = countBy;\\n    lodash.create = create;\\n    lodash.curry = curry;\\n    lodash.curryRight = curryRight;\\n    lodash.debounce = debounce;\\n    lodash.defaults = defaults;\\n    lodash.defaultsDeep = defaultsDeep;\\n    lodash.defer = defer;\\n    lodash.delay = delay;\\n    lodash.difference = difference;\\n    lodash.differenceBy = differenceBy;\\n    lodash.differenceWith = differenceWith;\\n    lodash.drop = drop;\\n    lodash.dropRight = dropRight;\\n    lodash.dropRightWhile = dropRightWhile;\\n    lodash.dropWhile = dropWhile;\\n    lodash.fill = fill;\\n    lodash.filter = filter;\\n    lodash.flatMap = flatMap;\\n    lodash.flatMapDeep = flatMapDeep;\\n    lodash.flatMapDepth = flatMapDepth;\\n    lodash.flatten = flatten;\\n    lodash.flattenDeep = flattenDeep;\\n    lodash.flattenDepth = flattenDepth;\\n    lodash.flip = flip;\\n    lodash.flow = flow;\\n    lodash.flowRight = flowRight;\\n    lodash.fromPairs = fromPairs;\\n    lodash.functions = functions;\\n    lodash.functionsIn = functionsIn;\\n    lodash.groupBy = groupBy;\\n    lodash.initial = initial;\\n    lodash.intersection = intersection;\\n    lodash.intersectionBy = intersectionBy;\\n    lodash.intersectionWith = intersectionWith;\\n    lodash.invert = invert;\\n    lodash.invertBy = invertBy;\\n    lodash.invokeMap = invokeMap;\\n    lodash.iteratee = iteratee;\\n    lodash.keyBy = keyBy;\\n    lodash.keys = keys;\\n    lodash.keysIn = keysIn;\\n    lodash.map = map;\\n    lodash.mapKeys = mapKeys;\\n    lodash.mapValues = mapValues;\\n    lodash.matches = matches;\\n    lodash.matchesProperty = matchesProperty;\\n    lodash.memoize = memoize;\\n    lodash.merge = merge;\\n    lodash.mergeWith = mergeWith;\\n    lodash.method = method;\\n    lodash.methodOf = methodOf;\\n    lodash.mixin = mixin;\\n    lodash.negate = negate;\\n    lodash.nthArg = nthArg;\\n    lodash.omit = omit;\\n    lodash.omitBy = omitBy;\\n    lodash.once = once;\\n    lodash.orderBy = orderBy;\\n    lodash.over = over;\\n    lodash.overArgs = overArgs;\\n    lodash.overEvery = overEvery;\\n    lodash.overSome = overSome;\\n    lodash.partial = partial;\\n    lodash.partialRight = partialRight;\\n    lodash.partition = partition;\\n    lodash.pick = pick;\\n    lodash.pickBy = pickBy;\\n    lodash.property = property;\\n    lodash.propertyOf = propertyOf;\\n    lodash.pull = pull;\\n    lodash.pullAll = pullAll;\\n    lodash.pullAllBy = pullAllBy;\\n    lodash.pullAllWith = pullAllWith;\\n    lodash.pullAt = pullAt;\\n    lodash.range = range;\\n    lodash.rangeRight = rangeRight;\\n    lodash.rearg = rearg;\\n    lodash.reject = reject;\\n    lodash.remove = remove;\\n    lodash.rest = rest;\\n    lodash.reverse = reverse;\\n    lodash.sampleSize = sampleSize;\\n    lodash.set = set;\\n    lodash.setWith = setWith;\\n    lodash.shuffle = shuffle;\\n    lodash.slice = slice;\\n    lodash.sortBy = sortBy;\\n    lodash.sortedUniq = sortedUniq;\\n    lodash.sortedUniqBy = sortedUniqBy;\\n    lodash.split = split;\\n    lodash.spread = spread;\\n    lodash.tail = tail;\\n    lodash.take = take;\\n    lodash.takeRight = takeRight;\\n    lodash.takeRightWhile = takeRightWhile;\\n    lodash.takeWhile = takeWhile;\\n    lodash.tap = tap;\\n    lodash.throttle = throttle;\\n    lodash.thru = thru;\\n    lodash.toArray = toArray;\\n    lodash.toPairs = toPairs;\\n    lodash.toPairsIn = toPairsIn;\\n    lodash.toPath = toPath;\\n    lodash.toPlainObject = toPlainObject;\\n    lodash.transform = transform;\\n    lodash.unary = unary;\\n    lodash.union = union;\\n    lodash.unionBy = unionBy;\\n    lodash.unionWith = unionWith;\\n    lodash.uniq = uniq;\\n    lodash.uniqBy = uniqBy;\\n    lodash.uniqWith = uniqWith;\\n    lodash.unset = unset;\\n    lodash.unzip = unzip;\\n    lodash.unzipWith = unzipWith;\\n    lodash.update = update;\\n    lodash.updateWith = updateWith;\\n    lodash.values = values;\\n    lodash.valuesIn = valuesIn;\\n    lodash.without = without;\\n    lodash.words = words;\\n    lodash.wrap = wrap;\\n    lodash.xor = xor;\\n    lodash.xorBy = xorBy;\\n    lodash.xorWith = xorWith;\\n    lodash.zip = zip;\\n    lodash.zipObject = zipObject;\\n    lodash.zipObjectDeep = zipObjectDeep;\\n    lodash.zipWith = zipWith;\\n\\n    // Add aliases.\\n    lodash.entries = toPairs;\\n    lodash.entriesIn = toPairsIn;\\n    lodash.extend = assignIn;\\n    lodash.extendWith = assignInWith;\\n\\n    // Add methods to `lodash.prototype`.\\n    mixin(lodash, lodash);\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    // Add methods that return unwrapped values in chain sequences.\\n    lodash.add = add;\\n    lodash.attempt = attempt;\\n    lodash.camelCase = camelCase;\\n    lodash.capitalize = capitalize;\\n    lodash.ceil = ceil;\\n    lodash.clamp = clamp;\\n    lodash.clone = clone;\\n    lodash.cloneDeep = cloneDeep;\\n    lodash.cloneDeepWith = cloneDeepWith;\\n    lodash.cloneWith = cloneWith;\\n    lodash.deburr = deburr;\\n    lodash.divide = divide;\\n    lodash.endsWith = endsWith;\\n    lodash.eq = eq;\\n    lodash.escape = escape;\\n    lodash.escapeRegExp = escapeRegExp;\\n    lodash.every = every;\\n    lodash.find = find;\\n    lodash.findIndex = findIndex;\\n    lodash.findKey = findKey;\\n    lodash.findLast = findLast;\\n    lodash.findLastIndex = findLastIndex;\\n    lodash.findLastKey = findLastKey;\\n    lodash.floor = floor;\\n    lodash.forEach = forEach;\\n    lodash.forEachRight = forEachRight;\\n    lodash.forIn = forIn;\\n    lodash.forInRight = forInRight;\\n    lodash.forOwn = forOwn;\\n    lodash.forOwnRight = forOwnRight;\\n    lodash.get = get;\\n    lodash.gt = gt;\\n    lodash.gte = gte;\\n    lodash.has = has;\\n    lodash.hasIn = hasIn;\\n    lodash.head = head;\\n    lodash.identity = identity;\\n    lodash.includes = includes;\\n    lodash.indexOf = indexOf;\\n    lodash.inRange = inRange;\\n    lodash.invoke = invoke;\\n    lodash.isArguments = isArguments;\\n    lodash.isArray = isArray;\\n    lodash.isArrayBuffer = isArrayBuffer;\\n    lodash.isArrayLike = isArrayLike;\\n    lodash.isArrayLikeObject = isArrayLikeObject;\\n    lodash.isBoolean = isBoolean;\\n    lodash.isBuffer = isBuffer;\\n    lodash.isDate = isDate;\\n    lodash.isElement = isElement;\\n    lodash.isEmpty = isEmpty;\\n    lodash.isEqual = isEqual;\\n    lodash.isEqualWith = isEqualWith;\\n    lodash.isError = isError;\\n    lodash.isFinite = isFinite;\\n    lodash.isFunction = isFunction;\\n    lodash.isInteger = isInteger;\\n    lodash.isLength = isLength;\\n    lodash.isMap = isMap;\\n    lodash.isMatch = isMatch;\\n    lodash.isMatchWith = isMatchWith;\\n    lodash.isNaN = isNaN;\\n    lodash.isNative = isNative;\\n    lodash.isNil = isNil;\\n    lodash.isNull = isNull;\\n    lodash.isNumber = isNumber;\\n    lodash.isObject = isObject;\\n    lodash.isObjectLike = isObjectLike;\\n    lodash.isPlainObject = isPlainObject;\\n    lodash.isRegExp = isRegExp;\\n    lodash.isSafeInteger = isSafeInteger;\\n    lodash.isSet = isSet;\\n    lodash.isString = isString;\\n    lodash.isSymbol = isSymbol;\\n    lodash.isTypedArray = isTypedArray;\\n    lodash.isUndefined = isUndefined;\\n    lodash.isWeakMap = isWeakMap;\\n    lodash.isWeakSet = isWeakSet;\\n    lodash.join = join;\\n    lodash.kebabCase = kebabCase;\\n    lodash.last = last;\\n    lodash.lastIndexOf = lastIndexOf;\\n    lodash.lowerCase = lowerCase;\\n    lodash.lowerFirst = lowerFirst;\\n    lodash.lt = lt;\\n    lodash.lte = lte;\\n    lodash.max = max;\\n    lodash.maxBy = maxBy;\\n    lodash.mean = mean;\\n    lodash.meanBy = meanBy;\\n    lodash.min = min;\\n    lodash.minBy = minBy;\\n    lodash.multiply = multiply;\\n    lodash.nth = nth;\\n    lodash.noConflict = noConflict;\\n    lodash.noop = noop;\\n    lodash.now = now;\\n    lodash.pad = pad;\\n    lodash.padEnd = padEnd;\\n    lodash.padStart = padStart;\\n    lodash.parseInt = parseInt;\\n    lodash.random = random;\\n    lodash.reduce = reduce;\\n    lodash.reduceRight = reduceRight;\\n    lodash.repeat = repeat;\\n    lodash.replace = replace;\\n    lodash.result = result;\\n    lodash.round = round;\\n    lodash.runInContext = runInContext;\\n    lodash.sample = sample;\\n    lodash.size = size;\\n    lodash.snakeCase = snakeCase;\\n    lodash.some = some;\\n    lodash.sortedIndex = sortedIndex;\\n    lodash.sortedIndexBy = sortedIndexBy;\\n    lodash.sortedIndexOf = sortedIndexOf;\\n    lodash.sortedLastIndex = sortedLastIndex;\\n    lodash.sortedLastIndexBy = sortedLastIndexBy;\\n    lodash.sortedLastIndexOf = sortedLastIndexOf;\\n    lodash.startCase = startCase;\\n    lodash.startsWith = startsWith;\\n    lodash.subtract = subtract;\\n    lodash.sum = sum;\\n    lodash.sumBy = sumBy;\\n    lodash.template = template;\\n    lodash.times = times;\\n    lodash.toInteger = toInteger;\\n    lodash.toLength = toLength;\\n    lodash.toLower = toLower;\\n    lodash.toNumber = toNumber;\\n    lodash.toSafeInteger = toSafeInteger;\\n    lodash.toString = toString;\\n    lodash.toUpper = toUpper;\\n    lodash.trim = trim;\\n    lodash.trimEnd = trimEnd;\\n    lodash.trimStart = trimStart;\\n    lodash.truncate = truncate;\\n    lodash.unescape = unescape;\\n    lodash.uniqueId = uniqueId;\\n    lodash.upperCase = upperCase;\\n    lodash.upperFirst = upperFirst;\\n\\n    // Add aliases.\\n    lodash.each = forEach;\\n    lodash.eachRight = forEachRight;\\n    lodash.first = head;\\n\\n    mixin(lodash, (function() {\\n      var source = {};\\n      baseForOwn(lodash, function(func, methodName) {\\n        if (!hasOwnProperty.call(lodash.prototype, methodName)) {\\n          source[methodName] = func;\\n        }\\n      });\\n      return source;\\n    }()), { 'chain': false });\\n\\n    /*------------------------------------------------------------------------*/\\n\\n    /**\\n     * The semantic version number.\\n     *\\n     * @static\\n     * @memberOf _\\n     * @type {string}\\n     */\\n    lodash.VERSION = VERSION;\\n\\n    // Assign default placeholders.\\n    arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {\\n      lodash[methodName].placeholder = lodash;\\n    });\\n\\n    // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.\\n    arrayEach(['drop', 'take'], function(methodName, index) {\\n      LazyWrapper.prototype[methodName] = function(n) {\\n        var filtered = this.__filtered__;\\n        if (filtered && !index) {\\n          return new LazyWrapper(this);\\n        }\\n        n = n === undefined ? 1 : nativeMax(toInteger(n), 0);\\n\\n        var result = this.clone();\\n        if (filtered) {\\n          result.__takeCount__ = nativeMin(n, result.__takeCount__);\\n        } else {\\n          result.__views__.push({\\n            'size': nativeMin(n, MAX_ARRAY_LENGTH),\\n            'type': methodName + (result.__dir__ < 0 ? 'Right' : '')\\n          });\\n        }\\n        return result;\\n      };\\n\\n      LazyWrapper.prototype[methodName + 'Right'] = function(n) {\\n        return this.reverse()[methodName](n).reverse();\\n      };\\n    });\\n\\n    // Add `LazyWrapper` methods that accept an `iteratee` value.\\n    arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {\\n      var type = index + 1,\\n          isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;\\n\\n      LazyWrapper.prototype[methodName] = function(iteratee) {\\n        var result = this.clone();\\n        result.__iteratees__.push({\\n          'iteratee': getIteratee(iteratee, 3),\\n          'type': type\\n        });\\n        result.__filtered__ = result.__filtered__ || isFilter;\\n        return result;\\n      };\\n    });\\n\\n    // Add `LazyWrapper` methods for `_.head` and `_.last`.\\n    arrayEach(['head', 'last'], function(methodName, index) {\\n      var takeName = 'take' + (index ? 'Right' : '');\\n\\n      LazyWrapper.prototype[methodName] = function() {\\n        return this[takeName](1).value()[0];\\n      };\\n    });\\n\\n    // Add `LazyWrapper` methods for `_.initial` and `_.tail`.\\n    arrayEach(['initial', 'tail'], function(methodName, index) {\\n      var dropName = 'drop' + (index ? '' : 'Right');\\n\\n      LazyWrapper.prototype[methodName] = function() {\\n        return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);\\n      };\\n    });\\n\\n    LazyWrapper.prototype.compact = function() {\\n      return this.filter(identity);\\n    };\\n\\n    LazyWrapper.prototype.find = function(predicate) {\\n      return this.filter(predicate).head();\\n    };\\n\\n    LazyWrapper.prototype.findLast = function(predicate) {\\n      return this.reverse().find(predicate);\\n    };\\n\\n    LazyWrapper.prototype.invokeMap = rest(function(path, args) {\\n      if (typeof path == 'function') {\\n        return new LazyWrapper(this);\\n      }\\n      return this.map(function(value) {\\n        return baseInvoke(value, path, args);\\n      });\\n    });\\n\\n    LazyWrapper.prototype.reject = function(predicate) {\\n      predicate = getIteratee(predicate, 3);\\n      return this.filter(function(value) {\\n        return !predicate(value);\\n      });\\n    };\\n\\n    LazyWrapper.prototype.slice = function(start, end) {\\n      start = toInteger(start);\\n\\n      var result = this;\\n      if (result.__filtered__ && (start > 0 || end < 0)) {\\n        return new LazyWrapper(result);\\n      }\\n      if (start < 0) {\\n        result = result.takeRight(-start);\\n      } else if (start) {\\n        result = result.drop(start);\\n      }\\n      if (end !== undefined) {\\n        end = toInteger(end);\\n        result = end < 0 ? result.dropRight(-end) : result.take(end - start);\\n      }\\n      return result;\\n    };\\n\\n    LazyWrapper.prototype.takeRightWhile = function(predicate) {\\n      return this.reverse().takeWhile(predicate).reverse();\\n    };\\n\\n    LazyWrapper.prototype.toArray = function() {\\n      return this.take(MAX_ARRAY_LENGTH);\\n    };\\n\\n    // Add `LazyWrapper` methods to `lodash.prototype`.\\n    baseForOwn(LazyWrapper.prototype, function(func, methodName) {\\n      var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),\\n          isTaker = /^(?:head|last)$/.test(methodName),\\n          lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],\\n          retUnwrapped = isTaker || /^find/.test(methodName);\\n\\n      if (!lodashFunc) {\\n        return;\\n      }\\n      lodash.prototype[methodName] = function() {\\n        var value = this.__wrapped__,\\n            args = isTaker ? [1] : arguments,\\n            isLazy = value instanceof LazyWrapper,\\n            iteratee = args[0],\\n            useLazy = isLazy || isArray(value);\\n\\n        var interceptor = function(value) {\\n          var result = lodashFunc.apply(lodash, arrayPush([value], args));\\n          return (isTaker && chainAll) ? result[0] : result;\\n        };\\n\\n        if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {\\n          // Avoid lazy use if the iteratee has a \\\"length\\\" value other than `1`.\\n          isLazy = useLazy = false;\\n        }\\n        var chainAll = this.__chain__,\\n            isHybrid = !!this.__actions__.length,\\n            isUnwrapped = retUnwrapped && !chainAll,\\n            onlyLazy = isLazy && !isHybrid;\\n\\n        if (!retUnwrapped && useLazy) {\\n          value = onlyLazy ? value : new LazyWrapper(this);\\n          var result = func.apply(value, args);\\n          result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });\\n          return new LodashWrapper(result, chainAll);\\n        }\\n        if (isUnwrapped && onlyLazy) {\\n          return func.apply(this, args);\\n        }\\n        result = this.thru(interceptor);\\n        return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;\\n      };\\n    });\\n\\n    // Add `Array` methods to `lodash.prototype`.\\n    arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {\\n      var func = arrayProto[methodName],\\n          chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',\\n          retUnwrapped = /^(?:pop|shift)$/.test(methodName);\\n\\n      lodash.prototype[methodName] = function() {\\n        var args = arguments;\\n        if (retUnwrapped && !this.__chain__) {\\n          var value = this.value();\\n          return func.apply(isArray(value) ? value : [], args);\\n        }\\n        return this[chainName](function(value) {\\n          return func.apply(isArray(value) ? value : [], args);\\n        });\\n      };\\n    });\\n\\n    // Map minified method names to their real names.\\n    baseForOwn(LazyWrapper.prototype, function(func, methodName) {\\n      var lodashFunc = lodash[methodName];\\n      if (lodashFunc) {\\n        var key = (lodashFunc.name + ''),\\n            names = realNames[key] || (realNames[key] = []);\\n\\n        names.push({ 'name': methodName, 'func': lodashFunc });\\n      }\\n    });\\n\\n    realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{\\n      'name': 'wrapper',\\n      'func': undefined\\n    }];\\n\\n    // Add methods to `LazyWrapper`.\\n    LazyWrapper.prototype.clone = lazyClone;\\n    LazyWrapper.prototype.reverse = lazyReverse;\\n    LazyWrapper.prototype.value = lazyValue;\\n\\n    // Add chain sequence methods to the `lodash` wrapper.\\n    lodash.prototype.at = wrapperAt;\\n    lodash.prototype.chain = wrapperChain;\\n    lodash.prototype.commit = wrapperCommit;\\n    lodash.prototype.next = wrapperNext;\\n    lodash.prototype.plant = wrapperPlant;\\n    lodash.prototype.reverse = wrapperReverse;\\n    lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;\\n\\n    if (iteratorSymbol) {\\n      lodash.prototype[iteratorSymbol] = wrapperToIterator;\\n    }\\n    return lodash;\\n  }\\n\\n  /*--------------------------------------------------------------------------*/\\n\\n  // Export lodash.\\n  var _ = runInContext();\\n\\n  // Expose lodash on the free variable `window` or `self` when available. This\\n  // prevents errors in cases where lodash is loaded by a script tag in the presence\\n  // of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch for more details.\\n  (freeWindow || freeSelf || {})._ = _;\\n\\n  // Some AMD build optimizers like r.js check for condition patterns like the following:\\n  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {\\n    // Define as an anonymous module so, through path mapping, it can be\\n    // referenced as the \\\"underscore\\\" module.\\n    define(function() {\\n      return _;\\n    });\\n  }\\n  // Check for `exports` after `define` in case a build optimizer adds an `exports` object.\\n  else if (freeExports && freeModule) {\\n    // Export for Node.js.\\n    if (moduleExports) {\\n      (freeModule.exports = _)._ = _;\\n    }\\n    // Export for CommonJS support.\\n    freeExports._ = _;\\n  }\\n  else {\\n    // Export to the global object.\\n    root._ = _;\\n  }\\n}.call(this));\\n\\n}).call(this,typeof self !== \\\"undefined\\\" ? self : typeof window !== \\\"undefined\\\" ? window : {})\\n},{}],3:[function(require,module,exports){\\n(function (Buffer){\\n'use strict';\\n\\nObject.defineProperty(exports, \\\"__esModule\\\", {\\n    value: true\\n});\\nexports.parseString = exports.parseFile = exports.parseStream = exports.parseLine = exports.GCodeLineStream = undefined;\\n\\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\"value\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\\n\\nvar _lodash = require('lodash');\\n\\nvar _lodash2 = _interopRequireDefault(_lodash);\\n\\nvar _events = require('events');\\n\\nvar _events2 = _interopRequireDefault(_events);\\n\\nvar _fs = require('fs');\\n\\nvar _fs2 = _interopRequireDefault(_fs);\\n\\nvar _timers = require('timers');\\n\\nvar _timers2 = _interopRequireDefault(_timers);\\n\\nvar _stream = require('stream');\\n\\nvar _stream2 = _interopRequireDefault(_stream);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\"Cannot call a class as a function\\\"); } }\\n\\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\\\"this hasn't been initialised - super() hasn't been called\\\"); } return call && (typeof call === \\\"object\\\" || typeof call === \\\"function\\\") ? call : self; }\\n\\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \\\"function\\\" && superClass !== null) { throw new TypeError(\\\"Super expression must either be null or a function, not \\\" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\\n\\nvar noop = function noop() {};\\n\\nvar streamify = function streamify(text) {\\n    var s = new _stream2.default.Readable();\\n    s.push(text);\\n    s.push(null);\\n    return s;\\n};\\n\\nvar stripComments = function stripComments(s) {\\n    var re1 = /\\\\s*[%#;].*/g; // Strip everything after %, #, or ; to the end of the line, including preceding spaces\\n    var re2 = /\\\\s*\\\\(.*\\\\)/g; // Remove anything inside the parentheses\\n    return s.replace(re1, '').replace(re2, '');\\n};\\n\\nvar removeSpaces = function removeSpaces(s) {\\n    return s.replace(/\\\\s+/g, '');\\n};\\n\\nvar containsNewline = function containsNewline(s) {\\n    return !!s.match(/.*(?:\\\\r\\\\n|\\\\r|\\\\n)/g);\\n};\\n\\n// http://reprap.org/wiki/G-code#Special_fields\\n// The checksum \\\"cs\\\" for a GCode string \\\"cmd\\\" (including its line number) is computed\\n// by exor-ing the bytes in the string up to and not including the * character.\\nvar computeChecksum = function computeChecksum(s) {\\n    s = s || '';\\n    if (s.lastIndexOf('*') >= 0) {\\n        s = s.substr(0, s.lastIndexOf('*'));\\n    }\\n\\n    var cs = 0;\\n    for (var i = 0; i < s.length; ++i) {\\n        var c = s[i].charCodeAt(0);\\n        cs = cs ^ c;\\n    }\\n    return cs;\\n};\\n\\n// @param {array} arr The array to iterate over\\n// @param {object} opts The options object\\n// @param {function} iteratee The iteratee invoked per element\\n// @param {function} done The done invoked after the loop has finished\\nvar iterateArray = function iterateArray() {\\n    var arr = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];\\n    var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\\n    var iteratee = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\\n    var done = arguments.length <= 3 || arguments[3] === undefined ? noop : arguments[3];\\n\\n    if (typeof opts === 'function') {\\n        done = iteratee;\\n        iteratee = opts;\\n        opts = {};\\n    }\\n\\n    opts.batchSize = opts.batchSize || 1;\\n\\n    var loop = function loop() {\\n        var i = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];\\n\\n        for (var count = 0; i < arr.length && count < opts.batchSize; ++i, ++count) {\\n            iteratee(arr[i], i, arr);\\n        }\\n        if (i < arr.length) {\\n            _timers2.default.setImmediate(function () {\\n                return loop(i);\\n            });\\n            return;\\n        }\\n        done();\\n    };\\n    loop();\\n};\\n\\n// @param {string} line The G-code line\\nvar parseLine = function parseLine(line) {\\n    var n = undefined; // Line number\\n    var cs = undefined; // Checksum\\n    var words = [];\\n    var list = removeSpaces(stripComments(line)).match(/([a-zA-Z][0-9\\\\+\\\\-\\\\.]*)|(\\\\*[0-9]+)/igm) || [];\\n\\n    _lodash2.default.each(list, function (word) {\\n        var letter = word[0].toUpperCase();\\n        var argument = word.substr(1);\\n\\n        argument = _lodash2.default.isNaN(parseFloat(argument)) ? argument : Number(argument);\\n\\n        //\\n        // Special fields\\n        //\\n\\n        {\\n            // N: Line number\\n            if (letter === 'N' && _lodash2.default.isUndefined(n)) {\\n                // Line (block) number in program\\n                n = Number(argument);\\n                return;\\n            }\\n        }\\n\\n        {\\n            // *: Checksum\\n            if (letter === '*' && _lodash2.default.isUndefined(cs)) {\\n                cs = Number(argument);\\n                return;\\n            }\\n        }\\n\\n        words.push([letter, argument]);\\n    });\\n\\n    var result = {};\\n    result.line = line;\\n    result.words = words;\\n\\n    typeof n !== 'undefined' && (result.N = n); // Line number\\n    typeof cs !== 'undefined' && (result.cs = cs); // Checksum\\n    if (result.cs && computeChecksum(line) !== result.cs) {\\n        result.err = true; // checksum failed\\n    }\\n\\n    return result;\\n};\\n\\n// @param {object} stream The G-code line stream\\n// @param {options} options The options object\\n// @param {function} callback The callback function\\nvar parseStream = function parseStream(stream, options) {\\n    var callback = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\\n\\n    if (typeof options === 'function') {\\n        callback = options;\\n        options = {};\\n    }\\n\\n    var emitter = new _events2.default.EventEmitter();\\n\\n    try {\\n        (function () {\\n            var results = [];\\n            stream.pipe(new GCodeLineStream(options)).on('data', function (data) {\\n                emitter.emit('data', data);\\n                results.push(data);\\n            }).on('finish', function () {\\n              console.log('stuff here')\\n                emitter.emit('end', results);\\n                callback && callback(null, results);\\n            }).on('error', callback);\\n        })();\\n    } catch (err) {\\n        callback(err);\\n    }\\n\\n    return emitter;\\n};\\n\\n// @param {string} file The G-code path name\\n// @param {options} options The options object\\n// @param {function} callback The callback function\\nvar parseFile = function parseFile(file, options) {\\n    var callback = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\\n\\n    if (typeof options === 'function') {\\n        callback = options;\\n        options = {};\\n    }\\n    file = file || '';\\n    var s = _fs2.default.createReadStream(file, { encoding: 'utf8' });\\n    s.on('error', callback);\\n    return parseStream(s, options, callback);\\n};\\n\\n// @param {string} str The G-code text string\\n// @param {options} options The options object\\n// @param {function} callback The callback function\\nvar parseString = function parseString(str, options) {\\n    var callback = arguments.length <= 2 || arguments[2] === undefined ? noop : arguments[2];\\n\\n    if (typeof options === 'function') {\\n        callback = options;\\n        options = {};\\n    }\\n    var s = streamify(str);\\n    return parseStream(s, options, callback);\\n};\\n\\nvar GCodeLineStream = function (_Transform) {\\n    _inherits(GCodeLineStream, _Transform);\\n\\n    // @param {object} [options] The options object\\n    // @param {number} [options.batchSize] The batch size\\n    // @param {number} [options.delay] The delay between iterations (in ms)\\n\\n    function GCodeLineStream() {\\n        var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\\n\\n        _classCallCheck(this, GCodeLineStream);\\n\\n        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GCodeLineStream).call(this, { objectMode: true }));\\n\\n        _this.state = {\\n            lineCount: 0,\\n            lastChunkEndedWithCR: false\\n        };\\n        _this.options = {\\n            batchSize: 1000,\\n            delay: 0\\n        };\\n        _this.lineBuffer = '';\\n\\n\\n        _this.options = _lodash2.default.extend({}, _this.options, options);\\n        return _this;\\n    }\\n\\n    _createClass(GCodeLineStream, [{\\n        key: '_transform',\\n        value: function _transform(chunk, encoding, next) {\\n            var _this2 = this;\\n\\n            // decode binary chunks as UTF-8\\n            encoding = encoding || 'utf8';\\n\\n            if (Buffer.isBuffer(chunk)) {\\n                if (encoding === 'buffer') {\\n                    encoding = 'utf8';\\n                }\\n                chunk = chunk.toString(encoding);\\n            }\\n\\n            this.lineBuffer += chunk;\\n\\n            if (!containsNewline(chunk)) {\\n                next();\\n                return;\\n            }\\n\\n            var lines = this.lineBuffer.match(/.*(?:\\\\r\\\\n|\\\\r|\\\\n)|.+$/g);\\n            if (!lines || lines.length === 0) {\\n                next();\\n                return;\\n            }\\n\\n            // Do not split CRLF which spans chunks\\n            if (this.state.lastChunkEndedWithCR && lines[0] === '\\\\n') {\\n                lines.shift();\\n            }\\n\\n            this.state.lastChunkEndedWithCR = _lodash2.default.endsWith(this.lineBuffer, '\\\\r');\\n\\n            if (_lodash2.default.endsWith(this.lineBuffer, '\\\\r') || _lodash2.default.endsWith(this.lineBuffer, '\\\\n')) {\\n                this.lineBuffer = '';\\n            } else {\\n                var line = lines.pop(lines) || '';\\n                this.lineBuffer = line;\\n            }\\n\\n            iterateArray(lines, function (line, key) {\\n                line = _lodash2.default.trimEnd(line);\\n                if (line.length > 0) {\\n                    var result = parseLine(line);\\n                    _this2.push(result);\\n                }\\n            }, next);\\n        }\\n    }, {\\n        key: '_flush',\\n        value: function _flush(done) {\\n            if (this.lineBuffer) {\\n                var line = _lodash2.default.trimEnd(this.lineBuffer);\\n                if (line.length > 0) {\\n                    var result = parseLine(line);\\n                    this.push(result);\\n                }\\n\\n                this.lineBuffer = '';\\n                this.state.lastChunkEndedWithCR = false;\\n            }\\n\\n            done();\\n        }\\n    }]);\\n\\n    return GCodeLineStream;\\n}(_stream.Transform);\\n\\nexports.GCodeLineStream = GCodeLineStream;\\nexports.parseLine = parseLine;\\nexports.parseStream = parseStream;\\nexports.parseFile = parseFile;\\nexports.parseString = parseString;\\n\\n}).call(this,require(\\\"buffer\\\").Buffer)\\n},{\\\"buffer\\\":8,\\\"events\\\":11,\\\"fs\\\":7,\\\"lodash\\\":4,\\\"stream\\\":15,\\\"timers\\\":22}],4:[function(require,module,exports){\\nmodule.exports=require(2)\\n},{}],5:[function(require,module,exports){\\n'use strict';\\n\\nObject.defineProperty(exports, \\\"__esModule\\\", {\\n    value: true\\n});\\nexports.GCodeToolpath = undefined;\\n\\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\"value\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\\n\\nvar _lodash = require('lodash');\\n\\nvar _lodash2 = _interopRequireDefault(_lodash);\\n\\nvar _gcodeInterpreter = require('gcode-interpreter');\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\"Cannot call a class as a function\\\"); } }\\n\\n// from in to mm\\nvar in2mm = function in2mm() {\\n    var val = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];\\n    return val * 25.4;\\n};\\n\\n// noop\\nvar noop = function noop() {};\\n\\nvar translatePosition = function translatePosition(position, newPosition, relative) {\\n    relative = !!relative;\\n    newPosition = Number(newPosition);\\n    if (_lodash2.default.isNaN(newPosition)) {\\n        return position;\\n    }\\n    return relative ? position + newPosition : newPosition;\\n};\\n\\nvar GCodeToolpath = function () {\\n\\n    // @param {object} [options]\\n    // @param {object} [options.modalState]\\n    // @param {function} [options.addLine]\\n    // @param {function} [options.addArcCurve]\\n\\n\\n    // https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9\\n    // Also see \\\"../constants/modal-groups.js\\\"\\n\\n    function GCodeToolpath(options) {\\n        var _this = this;\\n\\n        _classCallCheck(this, GCodeToolpath);\\n\\n        this.position = {\\n            x: 0,\\n            y: 0,\\n            z: 0\\n        };\\n        this.modalState = {\\n            motion: 'G0', // G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80\\n            coordinate: 'G54', // G54, G55, G56, G57, G58, G59\\n            plane: 'G17', // G17: XY-plane, G18: ZX-plane, G19: YZ-plane\\n            units: 'G21', // G20: Inches, G21: Millimeters\\n            distance: 'G90', // G90: Absolute, G91: Relative\\n            feedrate: 'G94', // G93: Inverse Time Mode, G94: Units Per Minutes\\n            program: 'M0',\\n            spindle: 'M5',\\n            coolant: 'M9'\\n        };\\n        this.handlers = {\\n            // G0: Rapid Linear Move\\n            'G0': function G0(params) {\\n                _this.setModalState({ 'motion': 'G0' });\\n\\n                var v1 = {\\n                    x: _this.position.x,\\n                    y: _this.position.y,\\n                    z: _this.position.z\\n                };\\n                var v2 = {\\n                    x: _this.translateX(params.X),\\n                    y: _this.translateY(params.Y),\\n                    z: _this.translateZ(params.Z)\\n                };\\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\\n\\n                _this.fn.addLine(_this.modalState, v1, v2);\\n\\n                // Update position\\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\\n            },\\n            // G1: Linear Move\\n            // Usage\\n            //   G1 Xnnn Ynnn Znnn Ennn Fnnn Snnn\\n            // Parameters\\n            //   Xnnn The position to move to on the X axis\\n            //   Ynnn The position to move to on the Y axis\\n            //   Znnn The position to move to on the Z axis\\n            //   Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied)\\n            //   Snnn Flag to check if an endstop was hit (S1 to check, S0 to ignore, S2 see note, default is S0)\\n            // Examples\\n            //   G1 X12 (move to 12mm on the X axis)\\n            //   G1 F1500 (Set the feedrate to 1500mm/minute)\\n            //   G1 X90.6 Y13.8 E22.4 (Move to 90.6mm on the X axis and 13.8mm on the Y axis while extruding 22.4mm of material)\\n            //\\n            'G1': function G1(params) {\\n                _this.setModalState({ 'motion': 'G1' });\\n\\n                var v1 = {\\n                    x: _this.position.x,\\n                    y: _this.position.y,\\n                    z: _this.position.z\\n                };\\n                var v2 = {\\n                    x: _this.translateX(params.X),\\n                    y: _this.translateY(params.Y),\\n                    z: _this.translateZ(params.Z)\\n                };\\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\\n\\n                _this.fn.addLine(_this.modalState, v1, v2);\\n\\n                // Update position\\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\\n            },\\n            // G2 & G3: Controlled Arc Move\\n            // Usage\\n            //   G2 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Clockwise Arc)\\n            //   G3 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Counter-Clockwise Arc)\\n            // Parameters\\n            //   Xnnn The position to move to on the X axis\\n            //   Ynnn The position to move to on the Y axis\\n            //   Innn The point in X space from the current X position to maintain a constant distance from\\n            //   Jnnn The point in Y space from the current Y position to maintain a constant distance from\\n            //   Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied)\\n            // Examples\\n            //   G2 X90.6 Y13.8 I5 J10 E22.4 (Move in a Clockwise arc from the current point to point (X=90.6,Y=13.8),\\n            //   with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)\\n            //   G3 X90.6 Y13.8 I5 J10 E22.4 (Move in a Counter-Clockwise arc from the current point to point (X=90.6,Y=13.8),\\n            //   with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)\\n            // Referring\\n            //   http://linuxcnc.org/docs/2.5/html/gcode/gcode.html#sec:G2-G3-Arc\\n            //   https://github.com/grbl/grbl/issues/236\\n            'G2': function G2(params) {\\n                _this.setModalState({ 'motion': 'G2' });\\n\\n                var v1 = {\\n                    x: _this.position.x,\\n                    y: _this.position.y,\\n                    z: _this.position.z\\n                };\\n                var v2 = {\\n                    x: _this.translateX(params.X),\\n                    y: _this.translateY(params.Y),\\n                    z: _this.translateZ(params.Z)\\n                };\\n                var v0 = { // fixed point\\n                    x: _this.translateI(params.I),\\n                    y: _this.translateJ(params.J),\\n                    z: _this.translateK(params.K)\\n                };\\n                var isClockwise = true;\\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\\n\\n                if (_this.isXYPlane()) {\\n                    var _ref = [v1.x, v1.y, v1.z]; // XY-plane\\n\\n                    v1.x = _ref[0];\\n                    v1.y = _ref[1];\\n                    v1.z = _ref[2];\\n                    var _ref2 = [v2.x, v2.y, v2.z];\\n                    v2.x = _ref2[0];\\n                    v2.y = _ref2[1];\\n                    v2.z = _ref2[2];\\n                    var _ref3 = [v0.x, v0.y, v0.z];\\n                    v0.x = _ref3[0];\\n                    v0.y = _ref3[1];\\n                    v0.z = _ref3[2];\\n                } else if (_this.isZXPlane()) {\\n                    var _ref4 = [v1.z, v1.x, v1.y]; // ZX-plane\\n\\n                    v1.x = _ref4[0];\\n                    v1.y = _ref4[1];\\n                    v1.z = _ref4[2];\\n                    var _ref5 = [v2.z, v2.x, v2.y];\\n                    v2.x = _ref5[0];\\n                    v2.y = _ref5[1];\\n                    v2.z = _ref5[2];\\n                    var _ref6 = [v0.z, v0.x, v0.y];\\n                    v0.x = _ref6[0];\\n                    v0.y = _ref6[1];\\n                    v0.z = _ref6[2];\\n                } else if (_this.isYZPlane()) {\\n                    var _ref7 = [v1.y, v1.z, v1.x]; // YZ-plane\\n\\n                    v1.x = _ref7[0];\\n                    v1.y = _ref7[1];\\n                    v1.z = _ref7[2];\\n                    var _ref8 = [v2.y, v2.z, v2.x];\\n                    v2.x = _ref8[0];\\n                    v2.y = _ref8[1];\\n                    v2.z = _ref8[2];\\n                    var _ref9 = [v0.y, v0.z, v0.x];\\n                    v0.x = _ref9[0];\\n                    v0.y = _ref9[1];\\n                    v0.z = _ref9[2];\\n                } else {\\n                    console.error('The plane mode is invalid', _this.modalState.plane);\\n                    return;\\n                }\\n\\n                if (params.R) {\\n                    var radius = _this.translateR(Number(params.R) || 0);\\n                    var x = v2.x - v1.x;\\n                    var y = v2.y - v1.y;\\n                    var distance = Math.sqrt(x * x + y * y);\\n                    var height = Math.sqrt(4 * radius * radius - x * x - y * y) / 2;\\n\\n                    if (isClockwise) {\\n                        height = -height;\\n                    }\\n                    if (radius < 0) {\\n                        height = -height;\\n                    }\\n\\n                    var offsetX = x / 2 - y / distance * height;\\n                    var offsetY = y / 2 + x / distance * height;\\n\\n                    v0.x = v1.x + offsetX;\\n                    v0.y = v1.y + offsetY;\\n                }\\n\\n                _this.fn.addArcCurve(_this.modalState, v1, v2, v0);\\n\\n                // Update position\\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\\n            },\\n            'G3': function G3(params) {\\n                _this.setModalState({ 'motion': 'G3' });\\n\\n                var v1 = {\\n                    x: _this.position.x,\\n                    y: _this.position.y,\\n                    z: _this.position.z\\n                };\\n                var v2 = {\\n                    x: _this.translateX(params.X),\\n                    y: _this.translateY(params.Y),\\n                    z: _this.translateZ(params.Z)\\n                };\\n                var v0 = { // fixed point\\n                    x: _this.translateI(params.I),\\n                    y: _this.translateJ(params.J),\\n                    z: _this.translateK(params.K)\\n                };\\n                var isClockwise = false;\\n                var targetPosition = { x: v2.x, y: v2.y, z: v2.z };\\n\\n                if (_this.isXYPlane()) {\\n                    var _ref10 = [v1.x, v1.y, v1.z]; // XY-plane\\n\\n                    v1.x = _ref10[0];\\n                    v1.y = _ref10[1];\\n                    v1.z = _ref10[2];\\n                    var _ref11 = [v2.x, v2.y, v2.z];\\n                    v2.x = _ref11[0];\\n                    v2.y = _ref11[1];\\n                    v2.z = _ref11[2];\\n                    var _ref12 = [v0.x, v0.y, v0.z];\\n                    v0.x = _ref12[0];\\n                    v0.y = _ref12[1];\\n                    v0.z = _ref12[2];\\n                } else if (_this.isZXPlane()) {\\n                    var _ref13 = [v1.z, v1.x, v1.y]; // ZX-plane\\n\\n                    v1.x = _ref13[0];\\n                    v1.y = _ref13[1];\\n                    v1.z = _ref13[2];\\n                    var _ref14 = [v2.z, v2.x, v2.y];\\n                    v2.x = _ref14[0];\\n                    v2.y = _ref14[1];\\n                    v2.z = _ref14[2];\\n                    var _ref15 = [v0.z, v0.x, v0.y];\\n                    v0.x = _ref15[0];\\n                    v0.y = _ref15[1];\\n                    v0.z = _ref15[2];\\n                } else if (_this.isYZPlane()) {\\n                    var _ref16 = [v1.y, v1.z, v1.x]; // YZ-plane\\n\\n                    v1.x = _ref16[0];\\n                    v1.y = _ref16[1];\\n                    v1.z = _ref16[2];\\n                    var _ref17 = [v2.y, v2.z, v2.x];\\n                    v2.x = _ref17[0];\\n                    v2.y = _ref17[1];\\n                    v2.z = _ref17[2];\\n                    var _ref18 = [v0.y, v0.z, v0.x];\\n                    v0.x = _ref18[0];\\n                    v0.y = _ref18[1];\\n                    v0.z = _ref18[2];\\n                } else {\\n                    console.error('The plane mode is invalid', _this.modalState.plane);\\n                    return;\\n                }\\n\\n                if (params.R) {\\n                    var radius = _this.translateR(Number(params.R) || 0);\\n                    var x = v2.x - v1.x;\\n                    var y = v2.y - v1.y;\\n                    var distance = Math.sqrt(x * x + y * y);\\n                    var height = Math.sqrt(4 * radius * radius - x * x - y * y) / 2;\\n\\n                    if (isClockwise) {\\n                        height = -height;\\n                    }\\n                    if (radius < 0) {\\n                        height = -height;\\n                    }\\n\\n                    var offsetX = x / 2 - y / distance * height;\\n                    var offsetY = y / 2 + x / distance * height;\\n\\n                    v0.x = v1.x + offsetX;\\n                    v0.y = v1.y + offsetY;\\n                }\\n\\n                _this.fn.addArcCurve(_this.modalState, v1, v2, v0);\\n\\n                // Update position\\n                _this.setPosition(targetPosition.x, targetPosition.y, targetPosition.z);\\n            },\\n            // G4: Dwell\\n            // Parameters\\n            //   Pnnn Time to wait, in milliseconds\\n            //   Snnn Time to wait, in seconds (Only on Marlin and Smoothie)\\n            // Example\\n            //   G4 P200\\n            'G4': function G4(params) {\\n                var sleep = 0;\\n\\n                if (params.S !== undefined) {\\n                    sleep = Number(params.S) * 1000; // seconds\\n                }\\n\\n                if (params.P !== undefined) {\\n                    sleep = Number(params.P); // milliseconds\\n                }\\n            },\\n            // G10: Coordinate System Data Tool and Work Offset Tables\\n            'G10': function G10(params) {},\\n            // G17..19: Plane Selection\\n            // G17: XY (default)\\n            'G17': function G17(params) {\\n                _this.setModalState({ 'plane': 'G17' });\\n            },\\n            // G18: XZ\\n            'G18': function G18(params) {\\n                _this.setModalState({ 'plane': 'G18' });\\n            },\\n            // G19: YZ\\n            'G19': function G19(params) {\\n                _this.setModalState({ 'plane': 'G19' });\\n            },\\n            // G20: use inches for length units\\n            'G20': function G20(params) {\\n                _this.setModalState({ 'units': 'G20' });\\n            },\\n            // G21: use millimeters for length units\\n            'G21': function G21(params) {\\n                _this.setModalState({ 'units': 'G21' });\\n            },\\n            // G38.x Straight Probe\\n            // G38.2 probe toward workpiece, stop on contact, signal error if failure\\n            'G38.2': function G382(params) {\\n                _this.setModalState({ 'motion': 'G38.2' });\\n            },\\n            // G38.3 probe toward workpiece, stop on contact\\n            'G38.3': function G383(params) {\\n                _this.setModalState({ 'motion': 'G38.3' });\\n            },\\n            // G38.4 probe away from workpiece, stop on loss of contact, signal error if failure\\n            'G38.4': function G384(params) {\\n                _this.setModalState({ 'motion': 'G38.4' });\\n            },\\n            // G38.5 probe away from workpiece, stop on loss of contact\\n            'G38.5': function G385(params) {\\n                _this.setModalState({ 'motion': 'G38.5' });\\n            },\\n            // G54..59: Coordinate System Select\\n            'G54': function G54() {\\n                _this.setModalState({ 'coordinate': 'G54' });\\n            },\\n            'G55': function G55() {\\n                _this.setModalState({ 'coordinate': 'G55' });\\n            },\\n            'G56': function G56() {\\n                _this.setModalState({ 'coordinate': 'G56' });\\n            },\\n            'G57': function G57() {\\n                _this.setModalState({ 'coordinate': 'G57' });\\n            },\\n            'G58': function G58() {\\n                _this.setModalState({ 'coordinate': 'G58' });\\n            },\\n            'G59': function G59() {\\n                _this.setModalState({ 'coordinate': 'G59' });\\n            },\\n            // G80: Cancel Canned Cycle\\n            'G80': function G80() {\\n                _this.setModalState({ 'motion': 'G80' });\\n            },\\n            // G90: Set to Absolute Positioning\\n            // Example\\n            //   G90\\n            // All coordinates from now on are absolute relative to the origin of the machine.\\n            'G90': function G90() {\\n                _this.setModalState({ 'distance': 'G90' });\\n            },\\n            // G91: Set to Relative Positioning\\n            // Example\\n            //   G91\\n            // All coordinates from now on are relative to the last position.\\n            'G91': function G91() {\\n                _this.setModalState({ 'distance': 'G91' });\\n            },\\n            // G92: Set Position\\n            // Parameters\\n            //   This command can be used without any additional parameters.\\n            //   Xnnn new X axis position\\n            //   Ynnn new Y axis position\\n            //   Znnn new Z axis position\\n            // Example\\n            //   G92 X10\\n            // Allows programming of absolute zero point, by reseting the current position to the params specified.\\n            // This would set the machine's X coordinate to 10. No physical motion will occur.\\n            // A G92 without coordinates will reset all axes to zero.\\n            'G92': function G92(params) {\\n                var v2 = {\\n                    x: _this.translateX(params.X, false),\\n                    y: _this.translateY(params.Y, false),\\n                    z: _this.translateZ(params.Z, false)\\n                };\\n\\n                // A G92 without coordinates will reset all axes to zero.\\n                if (params.X === undefined && params.Y === undefined && params.Z === undefined) {\\n                    v2.x = v2.y = v2.z = 0;\\n                }\\n\\n                // Update position\\n                _this.setPosition(v2.x, v2.y, v2.z);\\n            },\\n            // G93: start the inverse time mode\\n            // In inverse time feed rate mode, an F word means the move should be completed in\\n            // [one divided by the F number] minutes.\\n            // For example, if the F number is 2.0, the move should be completed in half a minute.\\n            'G93': function G93() {\\n                _this.setModalState({ 'feedrate': 'G93' });\\n            },\\n            // G94: start the units per minute mode\\n            // In units per minute feed rate mode, an F word on the line is interpreted to\\n            // mean the controlled point should move at a certain number of inches per minute,\\n            // millimeters per minute or degrees per minute, depending upon what length units\\n            // are being used and which axis or axes are moving.\\n            'G94': function G94() {\\n                _this.setModalState({ 'feedrate': 'G94' });\\n            }\\n        };\\n\\n        options = options || {};\\n\\n        this.setModalState(options.modalState);\\n        this.fn = {\\n            addLine: options.addLine || noop,\\n            addArcCurve: options.addArcCurve || noop\\n        };\\n\\n        return new _gcodeInterpreter.GCodeInterpreter({ handlers: this.handlers });\\n    }\\n\\n    _createClass(GCodeToolpath, [{\\n        key: 'setModalState',\\n        value: function setModalState(modalState) {\\n            modalState = _lodash2.default.pick(modalState, _lodash2.default.keys(this.modalState));\\n            this.modalState = _lodash2.default.merge({}, this.modalState, modalState);\\n            return this.modalState;\\n        }\\n    }, {\\n        key: 'isMetricUnits',\\n        value: function isMetricUnits() {\\n            // mm\\n            return this.modalState.units === 'G21';\\n        }\\n    }, {\\n        key: 'isImperialUnits',\\n        value: function isImperialUnits() {\\n            // inch\\n            return this.modalState.units === 'G20';\\n        }\\n    }, {\\n        key: 'isAbsoluteDistance',\\n        value: function isAbsoluteDistance() {\\n            return this.modalState.distance === 'G90';\\n        }\\n    }, {\\n        key: 'isRelativeDistance',\\n        value: function isRelativeDistance() {\\n            return this.modalState.distance === 'G91';\\n        }\\n    }, {\\n        key: 'isXYPlane',\\n        value: function isXYPlane() {\\n            return this.modalState.plane === 'G17';\\n        }\\n    }, {\\n        key: 'isZXPlane',\\n        value: function isZXPlane() {\\n            return this.modalState.plane === 'G18';\\n        }\\n    }, {\\n        key: 'isYZPlane',\\n        value: function isYZPlane() {\\n            return this.modalState.plane === 'G19';\\n        }\\n    }, {\\n        key: 'isInverseTimeFeedrateMode',\\n        value: function isInverseTimeFeedrateMode() {\\n            return this.modalState.feedrate === 'G93';\\n        }\\n    }, {\\n        key: 'isUnitsPerMinuteFeedrateMode',\\n        value: function isUnitsPerMinuteFeedrateMode() {\\n            return this.modalState.feedrate === 'G94';\\n        }\\n    }, {\\n        key: 'setPosition',\\n        value: function setPosition(x, y, z) {\\n            this.position.x = _lodash2.default.isNumber(x) ? x : this.position.x;\\n            this.position.y = _lodash2.default.isNumber(y) ? y : this.position.y;\\n            this.position.z = _lodash2.default.isNumber(z) ? z : this.position.z;\\n        }\\n    }, {\\n        key: 'translateX',\\n        value: function translateX(x, relative) {\\n            if (x !== undefined) {\\n                x = this.isImperialUnits() ? in2mm(x) : x;\\n            }\\n            if (relative === undefined) {\\n                relative = this.isRelativeDistance();\\n            }\\n            return translatePosition(this.position.x, x, !!relative);\\n        }\\n    }, {\\n        key: 'translateY',\\n        value: function translateY(y, relative) {\\n            if (y !== undefined) {\\n                y = this.isImperialUnits() ? in2mm(y) : y;\\n            }\\n            if (relative === undefined) {\\n                relative = this.isRelativeDistance();\\n            }\\n            return translatePosition(this.position.y, y, !!relative);\\n        }\\n    }, {\\n        key: 'translateZ',\\n        value: function translateZ(z, relative) {\\n            if (z !== undefined) {\\n                z = this.isImperialUnits() ? in2mm(z) : z;\\n            }\\n            if (relative === undefined) {\\n                relative = this.isRelativeDistance();\\n            }\\n            return translatePosition(this.position.z, z, !!relative);\\n        }\\n    }, {\\n        key: 'translateI',\\n        value: function translateI(i) {\\n            return this.translateX(i, true);\\n        }\\n    }, {\\n        key: 'translateJ',\\n        value: function translateJ(j) {\\n            return this.translateY(j, true);\\n        }\\n    }, {\\n        key: 'translateK',\\n        value: function translateK(k) {\\n            return this.translateZ(k, true);\\n        }\\n    }, {\\n        key: 'translateR',\\n        value: function translateR(r) {\\n            r = Number(r);\\n            if (_lodash2.default.isNaN(r)) {\\n                return 0;\\n            }\\n            return this.isImperialUnits() ? in2mm(r) : r;\\n        }\\n    }]);\\n\\n    return GCodeToolpath;\\n}();\\n\\nexports.GCodeToolpath = GCodeToolpath;\\n},{\\\"gcode-interpreter\\\":1,\\\"lodash\\\":6}],6:[function(require,module,exports){\\nmodule.exports=require(2)\\n},{}],7:[function(require,module,exports){\\n\\n},{}],8:[function(require,module,exports){\\n/*!\\n * The buffer module from node.js, for the browser.\\n *\\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\\n * @license  MIT\\n */\\n\\nvar base64 = require('base64-js')\\nvar ieee754 = require('ieee754')\\n\\nexports.Buffer = Buffer\\nexports.SlowBuffer = Buffer\\nexports.INSPECT_MAX_BYTES = 50\\nBuffer.poolSize = 8192\\n\\n/**\\n * If `Buffer._useTypedArrays`:\\n *   === true    Use Uint8Array implementation (fastest)\\n *   === false   Use Object implementation (compatible down to IE6)\\n */\\nBuffer._useTypedArrays = (function () {\\n  // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+,\\n  // Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding\\n  // properties to `Uint8Array` instances, then that's the same as no `Uint8Array` support\\n  // because we need to be able to add all the node Buffer API methods. This is an issue\\n  // in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438\\n  try {\\n    var buf = new ArrayBuffer(0)\\n    var arr = new Uint8Array(buf)\\n    arr.foo = function () { return 42 }\\n    return 42 === arr.foo() &&\\n        typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray`\\n  } catch (e) {\\n    return false\\n  }\\n})()\\n\\n/**\\n * Class: Buffer\\n * =============\\n *\\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\\n * with function properties for all the node `Buffer` API functions. We use\\n * `Uint8Array` so that square bracket notation works as expected -- it returns\\n * a single octet.\\n *\\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\\n * prototype.\\n */\\nfunction Buffer (subject, encoding, noZero) {\\n  if (!(this instanceof Buffer))\\n    return new Buffer(subject, encoding, noZero)\\n\\n  var type = typeof subject\\n\\n  // Workaround: node's base64 implementation allows for non-padded strings\\n  // while base64-js does not.\\n  if (encoding === 'base64' && type === 'string') {\\n    subject = stringtrim(subject)\\n    while (subject.length % 4 !== 0) {\\n      subject = subject + '='\\n    }\\n  }\\n\\n  // Find the length\\n  var length\\n  if (type === 'number')\\n    length = coerce(subject)\\n  else if (type === 'string')\\n    length = Buffer.byteLength(subject, encoding)\\n  else if (type === 'object')\\n    length = coerce(subject.length) // assume that object is array-like\\n  else\\n    throw new Error('First argument needs to be a number, array or string.')\\n\\n  var buf\\n  if (Buffer._useTypedArrays) {\\n    // Preferred: Return an augmented `Uint8Array` instance for best performance\\n    buf = Buffer._augment(new Uint8Array(length))\\n  } else {\\n    // Fallback: Return THIS instance of Buffer (created by `new`)\\n    buf = this\\n    buf.length = length\\n    buf._isBuffer = true\\n  }\\n\\n  var i\\n  if (Buffer._useTypedArrays && typeof subject.byteLength === 'number') {\\n    // Speed optimization -- use set if we're copying from a typed array\\n    buf._set(subject)\\n  } else if (isArrayish(subject)) {\\n    // Treat array-ish objects as a byte array\\n    for (i = 0; i < length; i++) {\\n      if (Buffer.isBuffer(subject))\\n        buf[i] = subject.readUInt8(i)\\n      else\\n        buf[i] = subject[i]\\n    }\\n  } else if (type === 'string') {\\n    buf.write(subject, 0, encoding)\\n  } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) {\\n    for (i = 0; i < length; i++) {\\n      buf[i] = 0\\n    }\\n  }\\n\\n  return buf\\n}\\n\\n// STATIC METHODS\\n// ==============\\n\\nBuffer.isEncoding = function (encoding) {\\n  switch (String(encoding).toLowerCase()) {\\n    case 'hex':\\n    case 'utf8':\\n    case 'utf-8':\\n    case 'ascii':\\n    case 'binary':\\n    case 'base64':\\n    case 'raw':\\n    case 'ucs2':\\n    case 'ucs-2':\\n    case 'utf16le':\\n    case 'utf-16le':\\n      return true\\n    default:\\n      return false\\n  }\\n}\\n\\nBuffer.isBuffer = function (b) {\\n  return !!(b !== null && b !== undefined && b._isBuffer)\\n}\\n\\nBuffer.byteLength = function (str, encoding) {\\n  var ret\\n  str = str + ''\\n  switch (encoding || 'utf8') {\\n    case 'hex':\\n      ret = str.length / 2\\n      break\\n    case 'utf8':\\n    case 'utf-8':\\n      ret = utf8ToBytes(str).length\\n      break\\n    case 'ascii':\\n    case 'binary':\\n    case 'raw':\\n      ret = str.length\\n      break\\n    case 'base64':\\n      ret = base64ToBytes(str).length\\n      break\\n    case 'ucs2':\\n    case 'ucs-2':\\n    case 'utf16le':\\n    case 'utf-16le':\\n      ret = str.length * 2\\n      break\\n    default:\\n      throw new Error('Unknown encoding')\\n  }\\n  return ret\\n}\\n\\nBuffer.concat = function (list, totalLength) {\\n  assert(isArray(list), 'Usage: Buffer.concat(list, [totalLength])\\\\n' +\\n      'list should be an Array.')\\n\\n  if (list.length === 0) {\\n    return new Buffer(0)\\n  } else if (list.length === 1) {\\n    return list[0]\\n  }\\n\\n  var i\\n  if (typeof totalLength !== 'number') {\\n    totalLength = 0\\n    for (i = 0; i < list.length; i++) {\\n      totalLength += list[i].length\\n    }\\n  }\\n\\n  var buf = new Buffer(totalLength)\\n  var pos = 0\\n  for (i = 0; i < list.length; i++) {\\n    var item = list[i]\\n    item.copy(buf, pos)\\n    pos += item.length\\n  }\\n  return buf\\n}\\n\\n// BUFFER INSTANCE METHODS\\n// =======================\\n\\nfunction _hexWrite (buf, string, offset, length) {\\n  offset = Number(offset) || 0\\n  var remaining = buf.length - offset\\n  if (!length) {\\n    length = remaining\\n  } else {\\n    length = Number(length)\\n    if (length > remaining) {\\n      length = remaining\\n    }\\n  }\\n\\n  // must be an even number of digits\\n  var strLen = string.length\\n  assert(strLen % 2 === 0, 'Invalid hex string')\\n\\n  if (length > strLen / 2) {\\n    length = strLen / 2\\n  }\\n  for (var i = 0; i < length; i++) {\\n    var byte = parseInt(string.substr(i * 2, 2), 16)\\n    assert(!isNaN(byte), 'Invalid hex string')\\n    buf[offset + i] = byte\\n  }\\n  Buffer._charsWritten = i * 2\\n  return i\\n}\\n\\nfunction _utf8Write (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(utf8ToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nfunction _asciiWrite (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(asciiToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nfunction _binaryWrite (buf, string, offset, length) {\\n  return _asciiWrite(buf, string, offset, length)\\n}\\n\\nfunction _base64Write (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(base64ToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nfunction _utf16leWrite (buf, string, offset, length) {\\n  var charsWritten = Buffer._charsWritten =\\n    blitBuffer(utf16leToBytes(string), buf, offset, length)\\n  return charsWritten\\n}\\n\\nBuffer.prototype.write = function (string, offset, length, encoding) {\\n  // Support both (string, offset, length, encoding)\\n  // and the legacy (string, encoding, offset, length)\\n  if (isFinite(offset)) {\\n    if (!isFinite(length)) {\\n      encoding = length\\n      length = undefined\\n    }\\n  } else {  // legacy\\n    var swap = encoding\\n    encoding = offset\\n    offset = length\\n    length = swap\\n  }\\n\\n  offset = Number(offset) || 0\\n  var remaining = this.length - offset\\n  if (!length) {\\n    length = remaining\\n  } else {\\n    length = Number(length)\\n    if (length > remaining) {\\n      length = remaining\\n    }\\n  }\\n  encoding = String(encoding || 'utf8').toLowerCase()\\n\\n  var ret\\n  switch (encoding) {\\n    case 'hex':\\n      ret = _hexWrite(this, string, offset, length)\\n      break\\n    case 'utf8':\\n    case 'utf-8':\\n      ret = _utf8Write(this, string, offset, length)\\n      break\\n    case 'ascii':\\n      ret = _asciiWrite(this, string, offset, length)\\n      break\\n    case 'binary':\\n      ret = _binaryWrite(this, string, offset, length)\\n      break\\n    case 'base64':\\n      ret = _base64Write(this, string, offset, length)\\n      break\\n    case 'ucs2':\\n    case 'ucs-2':\\n    case 'utf16le':\\n    case 'utf-16le':\\n      ret = _utf16leWrite(this, string, offset, length)\\n      break\\n    default:\\n      throw new Error('Unknown encoding')\\n  }\\n  return ret\\n}\\n\\nBuffer.prototype.toString = function (encoding, start, end) {\\n  var self = this\\n\\n  encoding = String(encoding || 'utf8').toLowerCase()\\n  start = Number(start) || 0\\n  end = (end !== undefined)\\n    ? Number(end)\\n    : end = self.length\\n\\n  // Fastpath empty strings\\n  if (end === start)\\n    return ''\\n\\n  var ret\\n  switch (encoding) {\\n    case 'hex':\\n      ret = _hexSlice(self, start, end)\\n      break\\n    case 'utf8':\\n    case 'utf-8':\\n      ret = _utf8Slice(self, start, end)\\n      break\\n    case 'ascii':\\n      ret = _asciiSlice(self, start, end)\\n      break\\n    case 'binary':\\n      ret = _binarySlice(self, start, end)\\n      break\\n    case 'base64':\\n      ret = _base64Slice(self, start, end)\\n      break\\n    case 'ucs2':\\n    case 'ucs-2':\\n    case 'utf16le':\\n    case 'utf-16le':\\n      ret = _utf16leSlice(self, start, end)\\n      break\\n    default:\\n      throw new Error('Unknown encoding')\\n  }\\n  return ret\\n}\\n\\nBuffer.prototype.toJSON = function () {\\n  return {\\n    type: 'Buffer',\\n    data: Array.prototype.slice.call(this._arr || this, 0)\\n  }\\n}\\n\\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\\nBuffer.prototype.copy = function (target, target_start, start, end) {\\n  var source = this\\n\\n  if (!start) start = 0\\n  if (!end && end !== 0) end = this.length\\n  if (!target_start) target_start = 0\\n\\n  // Copy 0 bytes; we're done\\n  if (end === start) return\\n  if (target.length === 0 || source.length === 0) return\\n\\n  // Fatal error conditions\\n  assert(end >= start, 'sourceEnd < sourceStart')\\n  assert(target_start >= 0 && target_start < target.length,\\n      'targetStart out of bounds')\\n  assert(start >= 0 && start < source.length, 'sourceStart out of bounds')\\n  assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds')\\n\\n  // Are we oob?\\n  if (end > this.length)\\n    end = this.length\\n  if (target.length - target_start < end - start)\\n    end = target.length - target_start + start\\n\\n  var len = end - start\\n\\n  if (len < 100 || !Buffer._useTypedArrays) {\\n    for (var i = 0; i < len; i++)\\n      target[i + target_start] = this[i + start]\\n  } else {\\n    target._set(this.subarray(start, start + len), target_start)\\n  }\\n}\\n\\nfunction _base64Slice (buf, start, end) {\\n  if (start === 0 && end === buf.length) {\\n    return base64.fromByteArray(buf)\\n  } else {\\n    return base64.fromByteArray(buf.slice(start, end))\\n  }\\n}\\n\\nfunction _utf8Slice (buf, start, end) {\\n  var res = ''\\n  var tmp = ''\\n  end = Math.min(buf.length, end)\\n\\n  for (var i = start; i < end; i++) {\\n    if (buf[i] <= 0x7F) {\\n      res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\\n      tmp = ''\\n    } else {\\n      tmp += '%' + buf[i].toString(16)\\n    }\\n  }\\n\\n  return res + decodeUtf8Char(tmp)\\n}\\n\\nfunction _asciiSlice (buf, start, end) {\\n  var ret = ''\\n  end = Math.min(buf.length, end)\\n\\n  for (var i = start; i < end; i++)\\n    ret += String.fromCharCode(buf[i])\\n  return ret\\n}\\n\\nfunction _binarySlice (buf, start, end) {\\n  return _asciiSlice(buf, start, end)\\n}\\n\\nfunction _hexSlice (buf, start, end) {\\n  var len = buf.length\\n\\n  if (!start || start < 0) start = 0\\n  if (!end || end < 0 || end > len) end = len\\n\\n  var out = ''\\n  for (var i = start; i < end; i++) {\\n    out += toHex(buf[i])\\n  }\\n  return out\\n}\\n\\nfunction _utf16leSlice (buf, start, end) {\\n  var bytes = buf.slice(start, end)\\n  var res = ''\\n  for (var i = 0; i < bytes.length; i += 2) {\\n    res += String.fromCharCode(bytes[i] + bytes[i+1] * 256)\\n  }\\n  return res\\n}\\n\\nBuffer.prototype.slice = function (start, end) {\\n  var len = this.length\\n  start = clamp(start, len, 0)\\n  end = clamp(end, len, len)\\n\\n  if (Buffer._useTypedArrays) {\\n    return Buffer._augment(this.subarray(start, end))\\n  } else {\\n    var sliceLen = end - start\\n    var newBuf = new Buffer(sliceLen, undefined, true)\\n    for (var i = 0; i < sliceLen; i++) {\\n      newBuf[i] = this[i + start]\\n    }\\n    return newBuf\\n  }\\n}\\n\\n// `get` will be removed in Node 0.13+\\nBuffer.prototype.get = function (offset) {\\n  console.log('.get() is deprecated. Access using array indexes instead.')\\n  return this.readUInt8(offset)\\n}\\n\\n// `set` will be removed in Node 0.13+\\nBuffer.prototype.set = function (v, offset) {\\n  console.log('.set() is deprecated. Access using array indexes instead.')\\n  return this.writeUInt8(v, offset)\\n}\\n\\nBuffer.prototype.readUInt8 = function (offset, noAssert) {\\n  if (!noAssert) {\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset < this.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  if (offset >= this.length)\\n    return\\n\\n  return this[offset]\\n}\\n\\nfunction _readUInt16 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val\\n  if (littleEndian) {\\n    val = buf[offset]\\n    if (offset + 1 < len)\\n      val |= buf[offset + 1] << 8\\n  } else {\\n    val = buf[offset] << 8\\n    if (offset + 1 < len)\\n      val |= buf[offset + 1]\\n  }\\n  return val\\n}\\n\\nBuffer.prototype.readUInt16LE = function (offset, noAssert) {\\n  return _readUInt16(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readUInt16BE = function (offset, noAssert) {\\n  return _readUInt16(this, offset, false, noAssert)\\n}\\n\\nfunction _readUInt32 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val\\n  if (littleEndian) {\\n    if (offset + 2 < len)\\n      val = buf[offset + 2] << 16\\n    if (offset + 1 < len)\\n      val |= buf[offset + 1] << 8\\n    val |= buf[offset]\\n    if (offset + 3 < len)\\n      val = val + (buf[offset + 3] << 24 >>> 0)\\n  } else {\\n    if (offset + 1 < len)\\n      val = buf[offset + 1] << 16\\n    if (offset + 2 < len)\\n      val |= buf[offset + 2] << 8\\n    if (offset + 3 < len)\\n      val |= buf[offset + 3]\\n    val = val + (buf[offset] << 24 >>> 0)\\n  }\\n  return val\\n}\\n\\nBuffer.prototype.readUInt32LE = function (offset, noAssert) {\\n  return _readUInt32(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readUInt32BE = function (offset, noAssert) {\\n  return _readUInt32(this, offset, false, noAssert)\\n}\\n\\nBuffer.prototype.readInt8 = function (offset, noAssert) {\\n  if (!noAssert) {\\n    assert(offset !== undefined && offset !== null,\\n        'missing offset')\\n    assert(offset < this.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  if (offset >= this.length)\\n    return\\n\\n  var neg = this[offset] & 0x80\\n  if (neg)\\n    return (0xff - this[offset] + 1) * -1\\n  else\\n    return this[offset]\\n}\\n\\nfunction _readInt16 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val = _readUInt16(buf, offset, littleEndian, true)\\n  var neg = val & 0x8000\\n  if (neg)\\n    return (0xffff - val + 1) * -1\\n  else\\n    return val\\n}\\n\\nBuffer.prototype.readInt16LE = function (offset, noAssert) {\\n  return _readInt16(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readInt16BE = function (offset, noAssert) {\\n  return _readInt16(this, offset, false, noAssert)\\n}\\n\\nfunction _readInt32 (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  var val = _readUInt32(buf, offset, littleEndian, true)\\n  var neg = val & 0x80000000\\n  if (neg)\\n    return (0xffffffff - val + 1) * -1\\n  else\\n    return val\\n}\\n\\nBuffer.prototype.readInt32LE = function (offset, noAssert) {\\n  return _readInt32(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readInt32BE = function (offset, noAssert) {\\n  return _readInt32(this, offset, false, noAssert)\\n}\\n\\nfunction _readFloat (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  return ieee754.read(buf, offset, littleEndian, 23, 4)\\n}\\n\\nBuffer.prototype.readFloatLE = function (offset, noAssert) {\\n  return _readFloat(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readFloatBE = function (offset, noAssert) {\\n  return _readFloat(this, offset, false, noAssert)\\n}\\n\\nfunction _readDouble (buf, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset + 7 < buf.length, 'Trying to read beyond buffer length')\\n  }\\n\\n  return ieee754.read(buf, offset, littleEndian, 52, 8)\\n}\\n\\nBuffer.prototype.readDoubleLE = function (offset, noAssert) {\\n  return _readDouble(this, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.readDoubleBE = function (offset, noAssert) {\\n  return _readDouble(this, offset, false, noAssert)\\n}\\n\\nBuffer.prototype.writeUInt8 = function (value, offset, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset < this.length, 'trying to write beyond buffer length')\\n    verifuint(value, 0xff)\\n  }\\n\\n  if (offset >= this.length) return\\n\\n  this[offset] = value\\n}\\n\\nfunction _writeUInt16 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 1 < buf.length, 'trying to write beyond buffer length')\\n    verifuint(value, 0xffff)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {\\n    buf[offset + i] =\\n        (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\\n            (littleEndian ? i : 1 - i) * 8\\n  }\\n}\\n\\nBuffer.prototype.writeUInt16LE = function (value, offset, noAssert) {\\n  _writeUInt16(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeUInt16BE = function (value, offset, noAssert) {\\n  _writeUInt16(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeUInt32 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 3 < buf.length, 'trying to write beyond buffer length')\\n    verifuint(value, 0xffffffff)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {\\n    buf[offset + i] =\\n        (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\\n  }\\n}\\n\\nBuffer.prototype.writeUInt32LE = function (value, offset, noAssert) {\\n  _writeUInt32(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeUInt32BE = function (value, offset, noAssert) {\\n  _writeUInt32(this, value, offset, false, noAssert)\\n}\\n\\nBuffer.prototype.writeInt8 = function (value, offset, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset < this.length, 'Trying to write beyond buffer length')\\n    verifsint(value, 0x7f, -0x80)\\n  }\\n\\n  if (offset >= this.length)\\n    return\\n\\n  if (value >= 0)\\n    this.writeUInt8(value, offset, noAssert)\\n  else\\n    this.writeUInt8(0xff + value + 1, offset, noAssert)\\n}\\n\\nfunction _writeInt16 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 1 < buf.length, 'Trying to write beyond buffer length')\\n    verifsint(value, 0x7fff, -0x8000)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  if (value >= 0)\\n    _writeUInt16(buf, value, offset, littleEndian, noAssert)\\n  else\\n    _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)\\n}\\n\\nBuffer.prototype.writeInt16LE = function (value, offset, noAssert) {\\n  _writeInt16(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeInt16BE = function (value, offset, noAssert) {\\n  _writeInt16(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeInt32 (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')\\n    verifsint(value, 0x7fffffff, -0x80000000)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  if (value >= 0)\\n    _writeUInt32(buf, value, offset, littleEndian, noAssert)\\n  else\\n    _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)\\n}\\n\\nBuffer.prototype.writeInt32LE = function (value, offset, noAssert) {\\n  _writeInt32(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeInt32BE = function (value, offset, noAssert) {\\n  _writeInt32(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeFloat (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')\\n    verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\\n}\\n\\nBuffer.prototype.writeFloatLE = function (value, offset, noAssert) {\\n  _writeFloat(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeFloatBE = function (value, offset, noAssert) {\\n  _writeFloat(this, value, offset, false, noAssert)\\n}\\n\\nfunction _writeDouble (buf, value, offset, littleEndian, noAssert) {\\n  if (!noAssert) {\\n    assert(value !== undefined && value !== null, 'missing value')\\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\\n    assert(offset !== undefined && offset !== null, 'missing offset')\\n    assert(offset + 7 < buf.length,\\n        'Trying to write beyond buffer length')\\n    verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308)\\n  }\\n\\n  var len = buf.length\\n  if (offset >= len)\\n    return\\n\\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\\n}\\n\\nBuffer.prototype.writeDoubleLE = function (value, offset, noAssert) {\\n  _writeDouble(this, value, offset, true, noAssert)\\n}\\n\\nBuffer.prototype.writeDoubleBE = function (value, offset, noAssert) {\\n  _writeDouble(this, value, offset, false, noAssert)\\n}\\n\\n// fill(value, start=0, end=buffer.length)\\nBuffer.prototype.fill = function (value, start, end) {\\n  if (!value) value = 0\\n  if (!start) start = 0\\n  if (!end) end = this.length\\n\\n  if (typeof value === 'string') {\\n    value = value.charCodeAt(0)\\n  }\\n\\n  assert(typeof value === 'number' && !isNaN(value), 'value is not a number')\\n  assert(end >= start, 'end < start')\\n\\n  // Fill 0 bytes; we're done\\n  if (end === start) return\\n  if (this.length === 0) return\\n\\n  assert(start >= 0 && start < this.length, 'start out of bounds')\\n  assert(end >= 0 && end <= this.length, 'end out of bounds')\\n\\n  for (var i = start; i < end; i++) {\\n    this[i] = value\\n  }\\n}\\n\\nBuffer.prototype.inspect = function () {\\n  var out = []\\n  var len = this.length\\n  for (var i = 0; i < len; i++) {\\n    out[i] = toHex(this[i])\\n    if (i === exports.INSPECT_MAX_BYTES) {\\n      out[i + 1] = '...'\\n      break\\n    }\\n  }\\n  return '<Buffer ' + out.join(' ') + '>'\\n}\\n\\n/**\\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\\n */\\nBuffer.prototype.toArrayBuffer = function () {\\n  if (typeof Uint8Array !== 'undefined') {\\n    if (Buffer._useTypedArrays) {\\n      return (new Buffer(this)).buffer\\n    } else {\\n      var buf = new Uint8Array(this.length)\\n      for (var i = 0, len = buf.length; i < len; i += 1)\\n        buf[i] = this[i]\\n      return buf.buffer\\n    }\\n  } else {\\n    throw new Error('Buffer.toArrayBuffer not supported in this browser')\\n  }\\n}\\n\\n// HELPER FUNCTIONS\\n// ================\\n\\nfunction stringtrim (str) {\\n  if (str.trim) return str.trim()\\n  return str.replace(/^\\\\s+|\\\\s+$/g, '')\\n}\\n\\nvar BP = Buffer.prototype\\n\\n/**\\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\\n */\\nBuffer._augment = function (arr) {\\n  arr._isBuffer = true\\n\\n  // save reference to original Uint8Array get/set methods before overwriting\\n  arr._get = arr.get\\n  arr._set = arr.set\\n\\n  // deprecated, will be removed in node 0.13+\\n  arr.get = BP.get\\n  arr.set = BP.set\\n\\n  arr.write = BP.write\\n  arr.toString = BP.toString\\n  arr.toLocaleString = BP.toString\\n  arr.toJSON = BP.toJSON\\n  arr.copy = BP.copy\\n  arr.slice = BP.slice\\n  arr.readUInt8 = BP.readUInt8\\n  arr.readUInt16LE = BP.readUInt16LE\\n  arr.readUInt16BE = BP.readUInt16BE\\n  arr.readUInt32LE = BP.readUInt32LE\\n  arr.readUInt32BE = BP.readUInt32BE\\n  arr.readInt8 = BP.readInt8\\n  arr.readInt16LE = BP.readInt16LE\\n  arr.readInt16BE = BP.readInt16BE\\n  arr.readInt32LE = BP.readInt32LE\\n  arr.readInt32BE = BP.readInt32BE\\n  arr.readFloatLE = BP.readFloatLE\\n  arr.readFloatBE = BP.readFloatBE\\n  arr.readDoubleLE = BP.readDoubleLE\\n  arr.readDoubleBE = BP.readDoubleBE\\n  arr.writeUInt8 = BP.writeUInt8\\n  arr.writeUInt16LE = BP.writeUInt16LE\\n  arr.writeUInt16BE = BP.writeUInt16BE\\n  arr.writeUInt32LE = BP.writeUInt32LE\\n  arr.writeUInt32BE = BP.writeUInt32BE\\n  arr.writeInt8 = BP.writeInt8\\n  arr.writeInt16LE = BP.writeInt16LE\\n  arr.writeInt16BE = BP.writeInt16BE\\n  arr.writeInt32LE = BP.writeInt32LE\\n  arr.writeInt32BE = BP.writeInt32BE\\n  arr.writeFloatLE = BP.writeFloatLE\\n  arr.writeFloatBE = BP.writeFloatBE\\n  arr.writeDoubleLE = BP.writeDoubleLE\\n  arr.writeDoubleBE = BP.writeDoubleBE\\n  arr.fill = BP.fill\\n  arr.inspect = BP.inspect\\n  arr.toArrayBuffer = BP.toArrayBuffer\\n\\n  return arr\\n}\\n\\n// slice(start, end)\\nfunction clamp (index, len, defaultValue) {\\n  if (typeof index !== 'number') return defaultValue\\n  index = ~~index;  // Coerce to integer.\\n  if (index >= len) return len\\n  if (index >= 0) return index\\n  index += len\\n  if (index >= 0) return index\\n  return 0\\n}\\n\\nfunction coerce (length) {\\n  // Coerce length to a number (possibly NaN), round up\\n  // in case it's fractional (e.g. 123.456) then do a\\n  // double negate to coerce a NaN to 0. Easy, right?\\n  length = ~~Math.ceil(+length)\\n  return length < 0 ? 0 : length\\n}\\n\\nfunction isArray (subject) {\\n  return (Array.isArray || function (subject) {\\n    return Object.prototype.toString.call(subject) === '[object Array]'\\n  })(subject)\\n}\\n\\nfunction isArrayish (subject) {\\n  return isArray(subject) || Buffer.isBuffer(subject) ||\\n      subject && typeof subject === 'object' &&\\n      typeof subject.length === 'number'\\n}\\n\\nfunction toHex (n) {\\n  if (n < 16) return '0' + n.toString(16)\\n  return n.toString(16)\\n}\\n\\nfunction utf8ToBytes (str) {\\n  var byteArray = []\\n  for (var i = 0; i < str.length; i++) {\\n    var b = str.charCodeAt(i)\\n    if (b <= 0x7F)\\n      byteArray.push(str.charCodeAt(i))\\n    else {\\n      var start = i\\n      if (b >= 0xD800 && b <= 0xDFFF) i++\\n      var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%')\\n      for (var j = 0; j < h.length; j++)\\n        byteArray.push(parseInt(h[j], 16))\\n    }\\n  }\\n  return byteArray\\n}\\n\\nfunction asciiToBytes (str) {\\n  var byteArray = []\\n  for (var i = 0; i < str.length; i++) {\\n    // Node's code seems to be doing this and not & 0x7F..\\n    byteArray.push(str.charCodeAt(i) & 0xFF)\\n  }\\n  return byteArray\\n}\\n\\nfunction utf16leToBytes (str) {\\n  var c, hi, lo\\n  var byteArray = []\\n  for (var i = 0; i < str.length; i++) {\\n    c = str.charCodeAt(i)\\n    hi = c >> 8\\n    lo = c % 256\\n    byteArray.push(lo)\\n    byteArray.push(hi)\\n  }\\n\\n  return byteArray\\n}\\n\\nfunction base64ToBytes (str) {\\n  return base64.toByteArray(str)\\n}\\n\\nfunction blitBuffer (src, dst, offset, length) {\\n  var pos\\n  for (var i = 0; i < length; i++) {\\n    if ((i + offset >= dst.length) || (i >= src.length))\\n      break\\n    dst[i + offset] = src[i]\\n  }\\n  return i\\n}\\n\\nfunction decodeUtf8Char (str) {\\n  try {\\n    return decodeURIComponent(str)\\n  } catch (err) {\\n    return String.fromCharCode(0xFFFD) // UTF 8 invalid char\\n  }\\n}\\n\\n/*\\n * We have to make sure that the value is a valid integer. This means that it\\n * is non-negative. It has no fractional component and that it does not\\n * exceed the maximum allowed value.\\n */\\nfunction verifuint (value, max) {\\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\\n  assert(value >= 0, 'specified a negative value for writing an unsigned value')\\n  assert(value <= max, 'value is larger than maximum value for type')\\n  assert(Math.floor(value) === value, 'value has a fractional component')\\n}\\n\\nfunction verifsint (value, max, min) {\\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\\n  assert(value <= max, 'value larger than maximum allowed value')\\n  assert(value >= min, 'value smaller than minimum allowed value')\\n  assert(Math.floor(value) === value, 'value has a fractional component')\\n}\\n\\nfunction verifIEEE754 (value, max, min) {\\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\\n  assert(value <= max, 'value larger than maximum allowed value')\\n  assert(value >= min, 'value smaller than minimum allowed value')\\n}\\n\\nfunction assert (test, message) {\\n  if (!test) throw new Error(message || 'Failed assertion')\\n}\\n\\n},{\\\"base64-js\\\":9,\\\"ieee754\\\":10}],9:[function(require,module,exports){\\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\\n\\n;(function (exports) {\\n\\t'use strict';\\n\\n  var Arr = (typeof Uint8Array !== 'undefined')\\n    ? Uint8Array\\n    : Array\\n\\n\\tvar PLUS   = '+'.charCodeAt(0)\\n\\tvar SLASH  = '/'.charCodeAt(0)\\n\\tvar NUMBER = '0'.charCodeAt(0)\\n\\tvar LOWER  = 'a'.charCodeAt(0)\\n\\tvar UPPER  = 'A'.charCodeAt(0)\\n\\tvar PLUS_URL_SAFE = '-'.charCodeAt(0)\\n\\tvar SLASH_URL_SAFE = '_'.charCodeAt(0)\\n\\n\\tfunction decode (elt) {\\n\\t\\tvar code = elt.charCodeAt(0)\\n\\t\\tif (code === PLUS ||\\n\\t\\t    code === PLUS_URL_SAFE)\\n\\t\\t\\treturn 62 // '+'\\n\\t\\tif (code === SLASH ||\\n\\t\\t    code === SLASH_URL_SAFE)\\n\\t\\t\\treturn 63 // '/'\\n\\t\\tif (code < NUMBER)\\n\\t\\t\\treturn -1 //no match\\n\\t\\tif (code < NUMBER + 10)\\n\\t\\t\\treturn code - NUMBER + 26 + 26\\n\\t\\tif (code < UPPER + 26)\\n\\t\\t\\treturn code - UPPER\\n\\t\\tif (code < LOWER + 26)\\n\\t\\t\\treturn code - LOWER + 26\\n\\t}\\n\\n\\tfunction b64ToByteArray (b64) {\\n\\t\\tvar i, j, l, tmp, placeHolders, arr\\n\\n\\t\\tif (b64.length % 4 > 0) {\\n\\t\\t\\tthrow new Error('Invalid string. Length must be a multiple of 4')\\n\\t\\t}\\n\\n\\t\\t// the number of equal signs (place holders)\\n\\t\\t// if there are two placeholders, than the two characters before it\\n\\t\\t// represent one byte\\n\\t\\t// if there is only one, then the three characters before it represent 2 bytes\\n\\t\\t// this is just a cheap hack to not do indexOf twice\\n\\t\\tvar len = b64.length\\n\\t\\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\\n\\n\\t\\t// base64 is 4/3 + up to two characters of the original data\\n\\t\\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\\n\\n\\t\\t// if there are placeholders, only get up to the last complete 4 chars\\n\\t\\tl = placeHolders > 0 ? b64.length - 4 : b64.length\\n\\n\\t\\tvar L = 0\\n\\n\\t\\tfunction push (v) {\\n\\t\\t\\tarr[L++] = v\\n\\t\\t}\\n\\n\\t\\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\\n\\t\\t\\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\\n\\t\\t\\tpush((tmp & 0xFF0000) >> 16)\\n\\t\\t\\tpush((tmp & 0xFF00) >> 8)\\n\\t\\t\\tpush(tmp & 0xFF)\\n\\t\\t}\\n\\n\\t\\tif (placeHolders === 2) {\\n\\t\\t\\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\\n\\t\\t\\tpush(tmp & 0xFF)\\n\\t\\t} else if (placeHolders === 1) {\\n\\t\\t\\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\\n\\t\\t\\tpush((tmp >> 8) & 0xFF)\\n\\t\\t\\tpush(tmp & 0xFF)\\n\\t\\t}\\n\\n\\t\\treturn arr\\n\\t}\\n\\n\\tfunction uint8ToBase64 (uint8) {\\n\\t\\tvar i,\\n\\t\\t\\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\\n\\t\\t\\toutput = \\\"\\\",\\n\\t\\t\\ttemp, length\\n\\n\\t\\tfunction encode (num) {\\n\\t\\t\\treturn lookup.charAt(num)\\n\\t\\t}\\n\\n\\t\\tfunction tripletToBase64 (num) {\\n\\t\\t\\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\\n\\t\\t}\\n\\n\\t\\t// go through the array every three bytes, we'll deal with trailing stuff later\\n\\t\\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\\n\\t\\t\\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\\n\\t\\t\\toutput += tripletToBase64(temp)\\n\\t\\t}\\n\\n\\t\\t// pad the end with zeros, but make sure to not forget the extra bytes\\n\\t\\tswitch (extraBytes) {\\n\\t\\t\\tcase 1:\\n\\t\\t\\t\\ttemp = uint8[uint8.length - 1]\\n\\t\\t\\t\\toutput += encode(temp >> 2)\\n\\t\\t\\t\\toutput += encode((temp << 4) & 0x3F)\\n\\t\\t\\t\\toutput += '=='\\n\\t\\t\\t\\tbreak\\n\\t\\t\\tcase 2:\\n\\t\\t\\t\\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\\n\\t\\t\\t\\toutput += encode(temp >> 10)\\n\\t\\t\\t\\toutput += encode((temp >> 4) & 0x3F)\\n\\t\\t\\t\\toutput += encode((temp << 2) & 0x3F)\\n\\t\\t\\t\\toutput += '='\\n\\t\\t\\t\\tbreak\\n\\t\\t}\\n\\n\\t\\treturn output\\n\\t}\\n\\n\\texports.toByteArray = b64ToByteArray\\n\\texports.fromByteArray = uint8ToBase64\\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\\n\\n},{}],10:[function(require,module,exports){\\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\\n  var e, m\\n  var eLen = nBytes * 8 - mLen - 1\\n  var eMax = (1 << eLen) - 1\\n  var eBias = eMax >> 1\\n  var nBits = -7\\n  var i = isLE ? (nBytes - 1) : 0\\n  var d = isLE ? -1 : 1\\n  var s = buffer[offset + i]\\n\\n  i += d\\n\\n  e = s & ((1 << (-nBits)) - 1)\\n  s >>= (-nBits)\\n  nBits += eLen\\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\\n\\n  m = e & ((1 << (-nBits)) - 1)\\n  e >>= (-nBits)\\n  nBits += mLen\\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\\n\\n  if (e === 0) {\\n    e = 1 - eBias\\n  } else if (e === eMax) {\\n    return m ? NaN : ((s ? -1 : 1) * Infinity)\\n  } else {\\n    m = m + Math.pow(2, mLen)\\n    e = e - eBias\\n  }\\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\\n}\\n\\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\\n  var e, m, c\\n  var eLen = nBytes * 8 - mLen - 1\\n  var eMax = (1 << eLen) - 1\\n  var eBias = eMax >> 1\\n  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\\n  var i = isLE ? 0 : (nBytes - 1)\\n  var d = isLE ? 1 : -1\\n  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\\n\\n  value = Math.abs(value)\\n\\n  if (isNaN(value) || value === Infinity) {\\n    m = isNaN(value) ? 1 : 0\\n    e = eMax\\n  } else {\\n    e = Math.floor(Math.log(value) / Math.LN2)\\n    if (value * (c = Math.pow(2, -e)) < 1) {\\n      e--\\n      c *= 2\\n    }\\n    if (e + eBias >= 1) {\\n      value += rt / c\\n    } else {\\n      value += rt * Math.pow(2, 1 - eBias)\\n    }\\n    if (value * c >= 2) {\\n      e++\\n      c /= 2\\n    }\\n\\n    if (e + eBias >= eMax) {\\n      m = 0\\n      e = eMax\\n    } else if (e + eBias >= 1) {\\n      m = (value * c - 1) * Math.pow(2, mLen)\\n      e = e + eBias\\n    } else {\\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\\n      e = 0\\n    }\\n  }\\n\\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\\n\\n  e = (e << mLen) | m\\n  eLen += mLen\\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\\n\\n  buffer[offset + i - d] |= s * 128\\n}\\n\\n},{}],11:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nfunction EventEmitter() {\\n  this._events = this._events || {};\\n  this._maxListeners = this._maxListeners || undefined;\\n}\\nmodule.exports = EventEmitter;\\n\\n// Backwards-compat with node 0.10.x\\nEventEmitter.EventEmitter = EventEmitter;\\n\\nEventEmitter.prototype._events = undefined;\\nEventEmitter.prototype._maxListeners = undefined;\\n\\n// By default EventEmitters will print a warning if more than 10 listeners are\\n// added to it. This is a useful default which helps finding memory leaks.\\nEventEmitter.defaultMaxListeners = 10;\\n\\n// Obviously not all Emitters should be limited to 10. This function allows\\n// that to be increased. Set to zero for unlimited.\\nEventEmitter.prototype.setMaxListeners = function(n) {\\n  if (!isNumber(n) || n < 0 || isNaN(n))\\n    throw TypeError('n must be a positive number');\\n  this._maxListeners = n;\\n  return this;\\n};\\n\\nEventEmitter.prototype.emit = function(type) {\\n  var er, handler, len, args, i, listeners;\\n\\n  if (!this._events)\\n    this._events = {};\\n\\n  // If there is no 'error' event listener then throw.\\n  if (type === 'error') {\\n    if (!this._events.error ||\\n        (isObject(this._events.error) && !this._events.error.length)) {\\n      er = arguments[1];\\n      if (er instanceof Error) {\\n        throw er; // Unhandled 'error' event\\n      }\\n      throw TypeError('Uncaught, unspecified \\\"error\\\" event.');\\n    }\\n  }\\n\\n  handler = this._events[type];\\n\\n  if (isUndefined(handler))\\n    return false;\\n\\n  if (isFunction(handler)) {\\n    switch (arguments.length) {\\n      // fast cases\\n      case 1:\\n        handler.call(this);\\n        break;\\n      case 2:\\n        handler.call(this, arguments[1]);\\n        break;\\n      case 3:\\n        handler.call(this, arguments[1], arguments[2]);\\n        break;\\n      // slower\\n      default:\\n        len = arguments.length;\\n        args = new Array(len - 1);\\n        for (i = 1; i < len; i++)\\n          args[i - 1] = arguments[i];\\n        handler.apply(this, args);\\n    }\\n  } else if (isObject(handler)) {\\n    len = arguments.length;\\n    args = new Array(len - 1);\\n    for (i = 1; i < len; i++)\\n      args[i - 1] = arguments[i];\\n\\n    listeners = handler.slice();\\n    len = listeners.length;\\n    for (i = 0; i < len; i++)\\n      listeners[i].apply(this, args);\\n  }\\n\\n  return true;\\n};\\n\\nEventEmitter.prototype.addListener = function(type, listener) {\\n  var m;\\n\\n  if (!isFunction(listener))\\n    throw TypeError('listener must be a function');\\n\\n  if (!this._events)\\n    this._events = {};\\n\\n  // To avoid recursion in the case that type === \\\"newListener\\\"! Before\\n  // adding it to the listeners, first emit \\\"newListener\\\".\\n  if (this._events.newListener)\\n    this.emit('newListener', type,\\n              isFunction(listener.listener) ?\\n              listener.listener : listener);\\n\\n  if (!this._events[type])\\n    // Optimize the case of one listener. Don't need the extra array object.\\n    this._events[type] = listener;\\n  else if (isObject(this._events[type]))\\n    // If we've already got an array, just append.\\n    this._events[type].push(listener);\\n  else\\n    // Adding the second element, need to change to array.\\n    this._events[type] = [this._events[type], listener];\\n\\n  // Check for listener leak\\n  if (isObject(this._events[type]) && !this._events[type].warned) {\\n    var m;\\n    if (!isUndefined(this._maxListeners)) {\\n      m = this._maxListeners;\\n    } else {\\n      m = EventEmitter.defaultMaxListeners;\\n    }\\n\\n    if (m && m > 0 && this._events[type].length > m) {\\n      this._events[type].warned = true;\\n      console.error('(node) warning: possible EventEmitter memory ' +\\n                    'leak detected. %d listeners added. ' +\\n                    'Use emitter.setMaxListeners() to increase limit.',\\n                    this._events[type].length);\\n      if (typeof console.trace === 'function') {\\n        // not supported in IE 10\\n        console.trace();\\n      }\\n    }\\n  }\\n\\n  return this;\\n};\\n\\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\\n\\nEventEmitter.prototype.once = function(type, listener) {\\n  if (!isFunction(listener))\\n    throw TypeError('listener must be a function');\\n\\n  var fired = false;\\n\\n  function g() {\\n    this.removeListener(type, g);\\n\\n    if (!fired) {\\n      fired = true;\\n      listener.apply(this, arguments);\\n    }\\n  }\\n\\n  g.listener = listener;\\n  this.on(type, g);\\n\\n  return this;\\n};\\n\\n// emits a 'removeListener' event iff the listener was removed\\nEventEmitter.prototype.removeListener = function(type, listener) {\\n  var list, position, length, i;\\n\\n  if (!isFunction(listener))\\n    throw TypeError('listener must be a function');\\n\\n  if (!this._events || !this._events[type])\\n    return this;\\n\\n  list = this._events[type];\\n  length = list.length;\\n  position = -1;\\n\\n  if (list === listener ||\\n      (isFunction(list.listener) && list.listener === listener)) {\\n    delete this._events[type];\\n    if (this._events.removeListener)\\n      this.emit('removeListener', type, listener);\\n\\n  } else if (isObject(list)) {\\n    for (i = length; i-- > 0;) {\\n      if (list[i] === listener ||\\n          (list[i].listener && list[i].listener === listener)) {\\n        position = i;\\n        break;\\n      }\\n    }\\n\\n    if (position < 0)\\n      return this;\\n\\n    if (list.length === 1) {\\n      list.length = 0;\\n      delete this._events[type];\\n    } else {\\n      list.splice(position, 1);\\n    }\\n\\n    if (this._events.removeListener)\\n      this.emit('removeListener', type, listener);\\n  }\\n\\n  return this;\\n};\\n\\nEventEmitter.prototype.removeAllListeners = function(type) {\\n  var key, listeners;\\n\\n  if (!this._events)\\n    return this;\\n\\n  // not listening for removeListener, no need to emit\\n  if (!this._events.removeListener) {\\n    if (arguments.length === 0)\\n      this._events = {};\\n    else if (this._events[type])\\n      delete this._events[type];\\n    return this;\\n  }\\n\\n  // emit removeListener for all listeners on all events\\n  if (arguments.length === 0) {\\n    for (key in this._events) {\\n      if (key === 'removeListener') continue;\\n      this.removeAllListeners(key);\\n    }\\n    this.removeAllListeners('removeListener');\\n    this._events = {};\\n    return this;\\n  }\\n\\n  listeners = this._events[type];\\n\\n  if (isFunction(listeners)) {\\n    this.removeListener(type, listeners);\\n  } else {\\n    // LIFO order\\n    while (listeners.length)\\n      this.removeListener(type, listeners[listeners.length - 1]);\\n  }\\n  delete this._events[type];\\n\\n  return this;\\n};\\n\\nEventEmitter.prototype.listeners = function(type) {\\n  var ret;\\n  if (!this._events || !this._events[type])\\n    ret = [];\\n  else if (isFunction(this._events[type]))\\n    ret = [this._events[type]];\\n  else\\n    ret = this._events[type].slice();\\n  return ret;\\n};\\n\\nEventEmitter.listenerCount = function(emitter, type) {\\n  var ret;\\n  if (!emitter._events || !emitter._events[type])\\n    ret = 0;\\n  else if (isFunction(emitter._events[type]))\\n    ret = 1;\\n  else\\n    ret = emitter._events[type].length;\\n  return ret;\\n};\\n\\nfunction isFunction(arg) {\\n  return typeof arg === 'function';\\n}\\n\\nfunction isNumber(arg) {\\n  return typeof arg === 'number';\\n}\\n\\nfunction isObject(arg) {\\n  return typeof arg === 'object' && arg !== null;\\n}\\n\\nfunction isUndefined(arg) {\\n  return arg === void 0;\\n}\\n\\n},{}],12:[function(require,module,exports){\\nif (typeof Object.create === 'function') {\\n  // implementation from standard node.js 'util' module\\n  module.exports = function inherits(ctor, superCtor) {\\n    ctor.super_ = superCtor\\n    ctor.prototype = Object.create(superCtor.prototype, {\\n      constructor: {\\n        value: ctor,\\n        enumerable: false,\\n        writable: true,\\n        configurable: true\\n      }\\n    });\\n  };\\n} else {\\n  // old school shim for old browsers\\n  module.exports = function inherits(ctor, superCtor) {\\n    ctor.super_ = superCtor\\n    var TempCtor = function () {}\\n    TempCtor.prototype = superCtor.prototype\\n    ctor.prototype = new TempCtor()\\n    ctor.prototype.constructor = ctor\\n  }\\n}\\n\\n},{}],13:[function(require,module,exports){\\n// shim for using process in browser\\n\\nvar process = module.exports = {};\\n\\nprocess.nextTick = (function () {\\n    var canSetImmediate = typeof window !== 'undefined'\\n    && window.setImmediate;\\n    var canPost = typeof window !== 'undefined'\\n    && window.postMessage && window.addEventListener\\n    ;\\n\\n    if (canSetImmediate) {\\n        return function (f) { return window.setImmediate(f) };\\n    }\\n\\n    if (canPost) {\\n        var queue = [];\\n        window.addEventListener('message', function (ev) {\\n            var source = ev.source;\\n            if ((source === window || source === null) && ev.data === 'process-tick') {\\n                ev.stopPropagation();\\n                if (queue.length > 0) {\\n                    var fn = queue.shift();\\n                    fn();\\n                }\\n            }\\n        }, true);\\n\\n        return function nextTick(fn) {\\n            queue.push(fn);\\n            window.postMessage('process-tick', '*');\\n        };\\n    }\\n\\n    return function nextTick(fn) {\\n        setTimeout(fn, 0);\\n    };\\n})();\\n\\nprocess.title = 'browser';\\nprocess.browser = true;\\nprocess.env = {};\\nprocess.argv = [];\\n\\nfunction noop() {}\\n\\nprocess.on = noop;\\nprocess.once = noop;\\nprocess.off = noop;\\nprocess.emit = noop;\\n\\nprocess.binding = function (name) {\\n    throw new Error('process.binding is not supported');\\n}\\n\\n// TODO(shtylman)\\nprocess.cwd = function () { return '/' };\\nprocess.chdir = function (dir) {\\n    throw new Error('process.chdir is not supported');\\n};\\n\\n},{}],14:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// a duplex stream is just a stream that is both readable and writable.\\n// Since JS doesn't have multiple prototypal inheritance, this class\\n// prototypally inherits from Readable, and then parasitically from\\n// Writable.\\n\\nmodule.exports = Duplex;\\nvar inherits = require('inherits');\\nvar setImmediate = require('process/browser.js').nextTick;\\nvar Readable = require('./readable.js');\\nvar Writable = require('./writable.js');\\n\\ninherits(Duplex, Readable);\\n\\nDuplex.prototype.write = Writable.prototype.write;\\nDuplex.prototype.end = Writable.prototype.end;\\nDuplex.prototype._write = Writable.prototype._write;\\n\\nfunction Duplex(options) {\\n  if (!(this instanceof Duplex))\\n    return new Duplex(options);\\n\\n  Readable.call(this, options);\\n  Writable.call(this, options);\\n\\n  if (options && options.readable === false)\\n    this.readable = false;\\n\\n  if (options && options.writable === false)\\n    this.writable = false;\\n\\n  this.allowHalfOpen = true;\\n  if (options && options.allowHalfOpen === false)\\n    this.allowHalfOpen = false;\\n\\n  this.once('end', onend);\\n}\\n\\n// the no-half-open enforcer\\nfunction onend() {\\n  // if we allow half-open state, or if the writable side ended,\\n  // then we're ok.\\n  if (this.allowHalfOpen || this._writableState.ended)\\n    return;\\n\\n  // no more data can be written.\\n  // But allow more writes to happen in this tick.\\n  var self = this;\\n  setImmediate(function () {\\n    self.end();\\n  });\\n}\\n\\n},{\\\"./readable.js\\\":18,\\\"./writable.js\\\":20,\\\"inherits\\\":12,\\\"process/browser.js\\\":16}],15:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nmodule.exports = Stream;\\n\\nvar EE = require('events').EventEmitter;\\nvar inherits = require('inherits');\\n\\ninherits(Stream, EE);\\nStream.Readable = require('./readable.js');\\nStream.Writable = require('./writable.js');\\nStream.Duplex = require('./duplex.js');\\nStream.Transform = require('./transform.js');\\nStream.PassThrough = require('./passthrough.js');\\n\\n// Backwards-compat with node 0.4.x\\nStream.Stream = Stream;\\n\\n\\n\\n// old-style streams.  Note that the pipe method (the only relevant\\n// part of this class) is overridden in the Readable class.\\n\\nfunction Stream() {\\n  EE.call(this);\\n}\\n\\nStream.prototype.pipe = function(dest, options) {\\n  var source = this;\\n\\n  function ondata(chunk) {\\n    if (dest.writable) {\\n      if (false === dest.write(chunk) && source.pause) {\\n        source.pause();\\n      }\\n    }\\n  }\\n\\n  source.on('data', ondata);\\n\\n  function ondrain() {\\n    if (source.readable && source.resume) {\\n      source.resume();\\n    }\\n  }\\n\\n  dest.on('drain', ondrain);\\n\\n  // If the 'end' option is not supplied, dest.end() will be called when\\n  // source gets the 'end' or 'close' events.  Only dest.end() once.\\n  if (!dest._isStdio && (!options || options.end !== false)) {\\n    source.on('end', onend);\\n    source.on('close', onclose);\\n  }\\n\\n  var didOnEnd = false;\\n  function onend() {\\n    if (didOnEnd) return;\\n    didOnEnd = true;\\n\\n    dest.end();\\n  }\\n\\n\\n  function onclose() {\\n    if (didOnEnd) return;\\n    didOnEnd = true;\\n\\n    if (typeof dest.destroy === 'function') dest.destroy();\\n  }\\n\\n  // don't leave dangling pipes when there are errors.\\n  function onerror(er) {\\n    cleanup();\\n    if (EE.listenerCount(this, 'error') === 0) {\\n      throw er; // Unhandled stream error in pipe.\\n    }\\n  }\\n\\n  source.on('error', onerror);\\n  dest.on('error', onerror);\\n\\n  // remove all the event listeners that were added.\\n  function cleanup() {\\n    source.removeListener('data', ondata);\\n    dest.removeListener('drain', ondrain);\\n\\n    source.removeListener('end', onend);\\n    source.removeListener('close', onclose);\\n\\n    source.removeListener('error', onerror);\\n    dest.removeListener('error', onerror);\\n\\n    source.removeListener('end', cleanup);\\n    source.removeListener('close', cleanup);\\n\\n    dest.removeListener('close', cleanup);\\n  }\\n\\n  source.on('end', cleanup);\\n  source.on('close', cleanup);\\n\\n  dest.on('close', cleanup);\\n\\n  dest.emit('pipe', source);\\n\\n  // Allow for unix-like usage: A.pipe(B).pipe(C)\\n  return dest;\\n};\\n\\n},{\\\"./duplex.js\\\":14,\\\"./passthrough.js\\\":17,\\\"./readable.js\\\":18,\\\"./transform.js\\\":19,\\\"./writable.js\\\":20,\\\"events\\\":11,\\\"inherits\\\":12}],16:[function(require,module,exports){\\n// shim for using process in browser\\n\\nvar process = module.exports = {};\\n\\nprocess.nextTick = (function () {\\n    var canSetImmediate = typeof window !== 'undefined'\\n    && window.setImmediate;\\n    var canPost = typeof window !== 'undefined'\\n    && window.postMessage && window.addEventListener\\n    ;\\n\\n    if (canSetImmediate) {\\n        return function (f) { return window.setImmediate(f) };\\n    }\\n\\n    if (canPost) {\\n        var queue = [];\\n        window.addEventListener('message', function (ev) {\\n            var source = ev.source;\\n            if ((source === window || source === null) && ev.data === 'process-tick') {\\n                ev.stopPropagation();\\n                if (queue.length > 0) {\\n                    var fn = queue.shift();\\n                    fn();\\n                }\\n            }\\n        }, true);\\n\\n        return function nextTick(fn) {\\n            queue.push(fn);\\n            window.postMessage('process-tick', '*');\\n        };\\n    }\\n\\n    return function nextTick(fn) {\\n        setTimeout(fn, 0);\\n    };\\n})();\\n\\nprocess.title = 'browser';\\nprocess.browser = true;\\nprocess.env = {};\\nprocess.argv = [];\\n\\nprocess.binding = function (name) {\\n    throw new Error('process.binding is not supported');\\n}\\n\\n// TODO(shtylman)\\nprocess.cwd = function () { return '/' };\\nprocess.chdir = function (dir) {\\n    throw new Error('process.chdir is not supported');\\n};\\n\\n},{}],17:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// a passthrough stream.\\n// basically just the most minimal sort of Transform stream.\\n// Every written chunk gets output as-is.\\n\\nmodule.exports = PassThrough;\\n\\nvar Transform = require('./transform.js');\\nvar inherits = require('inherits');\\ninherits(PassThrough, Transform);\\n\\nfunction PassThrough(options) {\\n  if (!(this instanceof PassThrough))\\n    return new PassThrough(options);\\n\\n  Transform.call(this, options);\\n}\\n\\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\\n  cb(null, chunk);\\n};\\n\\n},{\\\"./transform.js\\\":19,\\\"inherits\\\":12}],18:[function(require,module,exports){\\n(function (process){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nmodule.exports = Readable;\\nReadable.ReadableState = ReadableState;\\n\\nvar EE = require('events').EventEmitter;\\nvar Stream = require('./index.js');\\nvar Buffer = require('buffer').Buffer;\\nvar setImmediate = require('process/browser.js').nextTick;\\nvar StringDecoder;\\n\\nvar inherits = require('inherits');\\ninherits(Readable, Stream);\\n\\nfunction ReadableState(options, stream) {\\n  options = options || {};\\n\\n  // the point at which it stops calling _read() to fill the buffer\\n  // Note: 0 is a valid value, means \\\"don't call _read preemptively ever\\\"\\n  var hwm = options.highWaterMark;\\n  this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\\n\\n  // cast to ints.\\n  this.highWaterMark = ~~this.highWaterMark;\\n\\n  this.buffer = [];\\n  this.length = 0;\\n  this.pipes = null;\\n  this.pipesCount = 0;\\n  this.flowing = false;\\n  this.ended = false;\\n  this.endEmitted = false;\\n  this.reading = false;\\n\\n  // In streams that never have any data, and do push(null) right away,\\n  // the consumer can miss the 'end' event if they do some I/O before\\n  // consuming the stream.  So, we don't emit('end') until some reading\\n  // happens.\\n  this.calledRead = false;\\n\\n  // a flag to be able to tell if the onwrite cb is called immediately,\\n  // or on a later tick.  We set this to true at first, becuase any\\n  // actions that shouldn't happen until \\\"later\\\" should generally also\\n  // not happen before the first write call.\\n  this.sync = true;\\n\\n  // whenever we return null, then we set a flag to say\\n  // that we're awaiting a 'readable' event emission.\\n  this.needReadable = false;\\n  this.emittedReadable = false;\\n  this.readableListening = false;\\n\\n\\n  // object stream flag. Used to make read(n) ignore n and to\\n  // make all the buffer merging and length checks go away\\n  this.objectMode = !!options.objectMode;\\n\\n  // Crypto is kind of old and crusty.  Historically, its default string\\n  // encoding is 'binary' so we have to make this configurable.\\n  // Everything else in the universe uses 'utf8', though.\\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\\n\\n  // when piping, we only care about 'readable' events that happen\\n  // after read()ing all the bytes and not getting any pushback.\\n  this.ranOut = false;\\n\\n  // the number of writers that are awaiting a drain event in .pipe()s\\n  this.awaitDrain = 0;\\n\\n  // if true, a maybeReadMore has been scheduled\\n  this.readingMore = false;\\n\\n  this.decoder = null;\\n  this.encoding = null;\\n  if (options.encoding) {\\n    if (!StringDecoder)\\n      StringDecoder = require('string_decoder').StringDecoder;\\n    this.decoder = new StringDecoder(options.encoding);\\n    this.encoding = options.encoding;\\n  }\\n}\\n\\nfunction Readable(options) {\\n  if (!(this instanceof Readable))\\n    return new Readable(options);\\n\\n  this._readableState = new ReadableState(options, this);\\n\\n  // legacy\\n  this.readable = true;\\n\\n  Stream.call(this);\\n}\\n\\n// Manually shove something into the read() buffer.\\n// This returns true if the highWaterMark has not been hit yet,\\n// similar to how Writable.write() returns true if you should\\n// write() some more.\\nReadable.prototype.push = function(chunk, encoding) {\\n  var state = this._readableState;\\n\\n  if (typeof chunk === 'string' && !state.objectMode) {\\n    encoding = encoding || state.defaultEncoding;\\n    if (encoding !== state.encoding) {\\n      chunk = new Buffer(chunk, encoding);\\n      encoding = '';\\n    }\\n  }\\n\\n  return readableAddChunk(this, state, chunk, encoding, false);\\n};\\n\\n// Unshift should *always* be something directly out of read()\\nReadable.prototype.unshift = function(chunk) {\\n  var state = this._readableState;\\n  return readableAddChunk(this, state, chunk, '', true);\\n};\\n\\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\\n  var er = chunkInvalid(state, chunk);\\n  if (er) {\\n    stream.emit('error', er);\\n  } else if (chunk === null || chunk === undefined) {\\n    state.reading = false;\\n    if (!state.ended)\\n      onEofChunk(stream, state);\\n  } else if (state.objectMode || chunk && chunk.length > 0) {\\n    if (state.ended && !addToFront) {\\n      var e = new Error('stream.push() after EOF');\\n      stream.emit('error', e);\\n    } else if (state.endEmitted && addToFront) {\\n      var e = new Error('stream.unshift() after end event');\\n      stream.emit('error', e);\\n    } else {\\n      if (state.decoder && !addToFront && !encoding)\\n        chunk = state.decoder.write(chunk);\\n\\n      // update the buffer info.\\n      state.length += state.objectMode ? 1 : chunk.length;\\n      if (addToFront) {\\n        state.buffer.unshift(chunk);\\n      } else {\\n        state.reading = false;\\n        state.buffer.push(chunk);\\n      }\\n\\n      if (state.needReadable)\\n        emitReadable(stream);\\n\\n      maybeReadMore(stream, state);\\n    }\\n  } else if (!addToFront) {\\n    state.reading = false;\\n  }\\n\\n  return needMoreData(state);\\n}\\n\\n\\n\\n// if it's past the high water mark, we can push in some more.\\n// Also, if we have no data yet, we can stand some\\n// more bytes.  This is to work around cases where hwm=0,\\n// such as the repl.  Also, if the push() triggered a\\n// readable event, and the user called read(largeNumber) such that\\n// needReadable was set, then we ought to push more, so that another\\n// 'readable' event will be triggered.\\nfunction needMoreData(state) {\\n  return !state.ended &&\\n         (state.needReadable ||\\n          state.length < state.highWaterMark ||\\n          state.length === 0);\\n}\\n\\n// backwards compatibility.\\nReadable.prototype.setEncoding = function(enc) {\\n  if (!StringDecoder)\\n    StringDecoder = require('string_decoder').StringDecoder;\\n  this._readableState.decoder = new StringDecoder(enc);\\n  this._readableState.encoding = enc;\\n};\\n\\n// Don't raise the hwm > 128MB\\nvar MAX_HWM = 0x800000;\\nfunction roundUpToNextPowerOf2(n) {\\n  if (n >= MAX_HWM) {\\n    n = MAX_HWM;\\n  } else {\\n    // Get the next highest power of 2\\n    n--;\\n    for (var p = 1; p < 32; p <<= 1) n |= n >> p;\\n    n++;\\n  }\\n  return n;\\n}\\n\\nfunction howMuchToRead(n, state) {\\n  if (state.length === 0 && state.ended)\\n    return 0;\\n\\n  if (state.objectMode)\\n    return n === 0 ? 0 : 1;\\n\\n  if (isNaN(n) || n === null) {\\n    // only flow one buffer at a time\\n    if (state.flowing && state.buffer.length)\\n      return state.buffer[0].length;\\n    else\\n      return state.length;\\n  }\\n\\n  if (n <= 0)\\n    return 0;\\n\\n  // If we're asking for more than the target buffer level,\\n  // then raise the water mark.  Bump up to the next highest\\n  // power of 2, to prevent increasing it excessively in tiny\\n  // amounts.\\n  if (n > state.highWaterMark)\\n    state.highWaterMark = roundUpToNextPowerOf2(n);\\n\\n  // don't have that much.  return null, unless we've ended.\\n  if (n > state.length) {\\n    if (!state.ended) {\\n      state.needReadable = true;\\n      return 0;\\n    } else\\n      return state.length;\\n  }\\n\\n  return n;\\n}\\n\\n// you can override either this method, or the async _read(n) below.\\nReadable.prototype.read = function(n) {\\n  var state = this._readableState;\\n  state.calledRead = true;\\n  var nOrig = n;\\n\\n  if (typeof n !== 'number' || n > 0)\\n    state.emittedReadable = false;\\n\\n  // if we're doing read(0) to trigger a readable event, but we\\n  // already have a bunch of data in the buffer, then just trigger\\n  // the 'readable' event and move on.\\n  if (n === 0 &&\\n      state.needReadable &&\\n      (state.length >= state.highWaterMark || state.ended)) {\\n    emitReadable(this);\\n    return null;\\n  }\\n\\n  n = howMuchToRead(n, state);\\n\\n  // if we've ended, and we're now clear, then finish it up.\\n  if (n === 0 && state.ended) {\\n    if (state.length === 0)\\n      endReadable(this);\\n    return null;\\n  }\\n\\n  // All the actual chunk generation logic needs to be\\n  // *below* the call to _read.  The reason is that in certain\\n  // synthetic stream cases, such as passthrough streams, _read\\n  // may be a completely synchronous operation which may change\\n  // the state of the read buffer, providing enough data when\\n  // before there was *not* enough.\\n  //\\n  // So, the steps are:\\n  // 1. Figure out what the state of things will be after we do\\n  // a read from the buffer.\\n  //\\n  // 2. If that resulting state will trigger a _read, then call _read.\\n  // Note that this may be asynchronous, or synchronous.  Yes, it is\\n  // deeply ugly to write APIs this way, but that still doesn't mean\\n  // that the Readable class should behave improperly, as streams are\\n  // designed to be sync/async agnostic.\\n  // Take note if the _read call is sync or async (ie, if the read call\\n  // has returned yet), so that we know whether or not it's safe to emit\\n  // 'readable' etc.\\n  //\\n  // 3. Actually pull the requested chunks out of the buffer and return.\\n\\n  // if we need a readable event, then we need to do some reading.\\n  var doRead = state.needReadable;\\n\\n  // if we currently have less than the highWaterMark, then also read some\\n  if (state.length - n <= state.highWaterMark)\\n    doRead = true;\\n\\n  // however, if we've ended, then there's no point, and if we're already\\n  // reading, then it's unnecessary.\\n  if (state.ended || state.reading)\\n    doRead = false;\\n\\n  if (doRead) {\\n    state.reading = true;\\n    state.sync = true;\\n    // if the length is currently zero, then we *need* a readable event.\\n    if (state.length === 0)\\n      state.needReadable = true;\\n    // call internal read method\\n    this._read(state.highWaterMark);\\n    state.sync = false;\\n  }\\n\\n  // If _read called its callback synchronously, then `reading`\\n  // will be false, and we need to re-evaluate how much data we\\n  // can return to the user.\\n  if (doRead && !state.reading)\\n    n = howMuchToRead(nOrig, state);\\n\\n  var ret;\\n  if (n > 0)\\n    ret = fromList(n, state);\\n  else\\n    ret = null;\\n\\n  if (ret === null) {\\n    state.needReadable = true;\\n    n = 0;\\n  }\\n\\n  state.length -= n;\\n\\n  // If we have nothing in the buffer, then we want to know\\n  // as soon as we *do* get something into the buffer.\\n  if (state.length === 0 && !state.ended)\\n    state.needReadable = true;\\n\\n  // If we happened to read() exactly the remaining amount in the\\n  // buffer, and the EOF has been seen at this point, then make sure\\n  // that we emit 'end' on the very next tick.\\n  if (state.ended && !state.endEmitted && state.length === 0)\\n    endReadable(this);\\n\\n  return ret;\\n};\\n\\nfunction chunkInvalid(state, chunk) {\\n  var er = null;\\n  if (!Buffer.isBuffer(chunk) &&\\n      'string' !== typeof chunk &&\\n      chunk !== null &&\\n      chunk !== undefined &&\\n      !state.objectMode &&\\n      !er) {\\n    er = new TypeError('Invalid non-string/buffer chunk');\\n  }\\n  return er;\\n}\\n\\n\\nfunction onEofChunk(stream, state) {\\n  if (state.decoder && !state.ended) {\\n    var chunk = state.decoder.end();\\n    if (chunk && chunk.length) {\\n      state.buffer.push(chunk);\\n      state.length += state.objectMode ? 1 : chunk.length;\\n    }\\n  }\\n  state.ended = true;\\n\\n  // if we've ended and we have some data left, then emit\\n  // 'readable' now to make sure it gets picked up.\\n  if (state.length > 0)\\n    emitReadable(stream);\\n  else\\n    endReadable(stream);\\n}\\n\\n// Don't emit readable right away in sync mode, because this can trigger\\n// another read() call => stack overflow.  This way, it might trigger\\n// a nextTick recursion warning, but that's not so bad.\\nfunction emitReadable(stream) {\\n  var state = stream._readableState;\\n  state.needReadable = false;\\n  if (state.emittedReadable)\\n    return;\\n\\n  state.emittedReadable = true;\\n  if (state.sync)\\n    setImmediate(function() {\\n      emitReadable_(stream);\\n    });\\n  else\\n    emitReadable_(stream);\\n}\\n\\nfunction emitReadable_(stream) {\\n  stream.emit('readable');\\n}\\n\\n\\n// at this point, the user has presumably seen the 'readable' event,\\n// and called read() to consume some data.  that may have triggered\\n// in turn another _read(n) call, in which case reading = true if\\n// it's in progress.\\n// However, if we're not ended, or reading, and the length < hwm,\\n// then go ahead and try to read some more preemptively.\\nfunction maybeReadMore(stream, state) {\\n  if (!state.readingMore) {\\n    state.readingMore = true;\\n    setImmediate(function() {\\n      maybeReadMore_(stream, state);\\n    });\\n  }\\n}\\n\\nfunction maybeReadMore_(stream, state) {\\n  var len = state.length;\\n  while (!state.reading && !state.flowing && !state.ended &&\\n         state.length < state.highWaterMark) {\\n    stream.read(0);\\n    if (len === state.length)\\n      // didn't get any data, stop spinning.\\n      break;\\n    else\\n      len = state.length;\\n  }\\n  state.readingMore = false;\\n}\\n\\n// abstract method.  to be overridden in specific implementation classes.\\n// call cb(er, data) where data is <= n in length.\\n// for virtual (non-string, non-buffer) streams, \\\"length\\\" is somewhat\\n// arbitrary, and perhaps not very meaningful.\\nReadable.prototype._read = function(n) {\\n  this.emit('error', new Error('not implemented'));\\n};\\n\\nReadable.prototype.pipe = function(dest, pipeOpts) {\\n  var src = this;\\n  var state = this._readableState;\\n\\n  switch (state.pipesCount) {\\n    case 0:\\n      state.pipes = dest;\\n      break;\\n    case 1:\\n      state.pipes = [state.pipes, dest];\\n      break;\\n    default:\\n      state.pipes.push(dest);\\n      break;\\n  }\\n  state.pipesCount += 1;\\n\\n  var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\\n              dest !== process.stdout &&\\n              dest !== process.stderr;\\n\\n  var endFn = doEnd ? onend : cleanup;\\n  if (state.endEmitted)\\n    setImmediate(endFn);\\n  else\\n    src.once('end', endFn);\\n\\n  dest.on('unpipe', onunpipe);\\n  function onunpipe(readable) {\\n    if (readable !== src) return;\\n    cleanup();\\n  }\\n\\n  function onend() {\\n    dest.end();\\n  }\\n\\n  // when the dest drains, it reduces the awaitDrain counter\\n  // on the source.  This would be more elegant with a .once()\\n  // handler in flow(), but adding and removing repeatedly is\\n  // too slow.\\n  var ondrain = pipeOnDrain(src);\\n  dest.on('drain', ondrain);\\n\\n  function cleanup() {\\n    // cleanup event handlers once the pipe is broken\\n    dest.removeListener('close', onclose);\\n    dest.removeListener('finish', onfinish);\\n    dest.removeListener('drain', ondrain);\\n    dest.removeListener('error', onerror);\\n    dest.removeListener('unpipe', onunpipe);\\n    src.removeListener('end', onend);\\n    src.removeListener('end', cleanup);\\n\\n    // if the reader is waiting for a drain event from this\\n    // specific writer, then it would cause it to never start\\n    // flowing again.\\n    // So, if this is awaiting a drain, then we just call it now.\\n    // If we don't know, then assume that we are waiting for one.\\n    if (!dest._writableState || dest._writableState.needDrain)\\n      ondrain();\\n  }\\n\\n  // if the dest has an error, then stop piping into it.\\n  // however, don't suppress the throwing behavior for this.\\n  // check for listeners before emit removes one-time listeners.\\n  var errListeners = EE.listenerCount(dest, 'error');\\n  function onerror(er) {\\n    unpipe();\\n    if (errListeners === 0 && EE.listenerCount(dest, 'error') === 0)\\n      dest.emit('error', er);\\n  }\\n  dest.once('error', onerror);\\n\\n  // Both close and finish should trigger unpipe, but only once.\\n  function onclose() {\\n    dest.removeListener('finish', onfinish);\\n    unpipe();\\n  }\\n  dest.once('close', onclose);\\n  function onfinish() {\\n    dest.removeListener('close', onclose);\\n    unpipe();\\n  }\\n  dest.once('finish', onfinish);\\n\\n  function unpipe() {\\n    src.unpipe(dest);\\n  }\\n\\n  // tell the dest that it's being piped to\\n  dest.emit('pipe', src);\\n\\n  // start the flow if it hasn't been started already.\\n  if (!state.flowing) {\\n    // the handler that waits for readable events after all\\n    // the data gets sucked out in flow.\\n    // This would be easier to follow with a .once() handler\\n    // in flow(), but that is too slow.\\n    this.on('readable', pipeOnReadable);\\n\\n    state.flowing = true;\\n    setImmediate(function() {\\n      flow(src);\\n    });\\n  }\\n\\n  return dest;\\n};\\n\\nfunction pipeOnDrain(src) {\\n  return function() {\\n    var dest = this;\\n    var state = src._readableState;\\n    state.awaitDrain--;\\n    if (state.awaitDrain === 0)\\n      flow(src);\\n  };\\n}\\n\\nfunction flow(src) {\\n  var state = src._readableState;\\n  var chunk;\\n  state.awaitDrain = 0;\\n\\n  function write(dest, i, list) {\\n    var written = dest.write(chunk);\\n    if (false === written) {\\n      state.awaitDrain++;\\n    }\\n  }\\n\\n  while (state.pipesCount && null !== (chunk = src.read())) {\\n\\n    if (state.pipesCount === 1)\\n      write(state.pipes, 0, null);\\n    else\\n      forEach(state.pipes, write);\\n\\n    src.emit('data', chunk);\\n\\n    // if anyone needs a drain, then we have to wait for that.\\n    if (state.awaitDrain > 0)\\n      return;\\n  }\\n\\n  // if every destination was unpiped, either before entering this\\n  // function, or in the while loop, then stop flowing.\\n  //\\n  // NB: This is a pretty rare edge case.\\n  if (state.pipesCount === 0) {\\n    state.flowing = false;\\n\\n    // if there were data event listeners added, then switch to old mode.\\n    if (EE.listenerCount(src, 'data') > 0)\\n      emitDataEvents(src);\\n    return;\\n  }\\n\\n  // at this point, no one needed a drain, so we just ran out of data\\n  // on the next readable event, start it over again.\\n  state.ranOut = true;\\n}\\n\\nfunction pipeOnReadable() {\\n  if (this._readableState.ranOut) {\\n    this._readableState.ranOut = false;\\n    flow(this);\\n  }\\n}\\n\\n\\nReadable.prototype.unpipe = function(dest) {\\n  var state = this._readableState;\\n\\n  // if we're not piping anywhere, then do nothing.\\n  if (state.pipesCount === 0)\\n    return this;\\n\\n  // just one destination.  most common case.\\n  if (state.pipesCount === 1) {\\n    // passed in one, but it's not the right one.\\n    if (dest && dest !== state.pipes)\\n      return this;\\n\\n    if (!dest)\\n      dest = state.pipes;\\n\\n    // got a match.\\n    state.pipes = null;\\n    state.pipesCount = 0;\\n    this.removeListener('readable', pipeOnReadable);\\n    state.flowing = false;\\n    if (dest)\\n      dest.emit('unpipe', this);\\n    return this;\\n  }\\n\\n  // slow case. multiple pipe destinations.\\n\\n  if (!dest) {\\n    // remove all.\\n    var dests = state.pipes;\\n    var len = state.pipesCount;\\n    state.pipes = null;\\n    state.pipesCount = 0;\\n    this.removeListener('readable', pipeOnReadable);\\n    state.flowing = false;\\n\\n    for (var i = 0; i < len; i++)\\n      dests[i].emit('unpipe', this);\\n    return this;\\n  }\\n\\n  // try to find the right one.\\n  var i = indexOf(state.pipes, dest);\\n  if (i === -1)\\n    return this;\\n\\n  state.pipes.splice(i, 1);\\n  state.pipesCount -= 1;\\n  if (state.pipesCount === 1)\\n    state.pipes = state.pipes[0];\\n\\n  dest.emit('unpipe', this);\\n\\n  return this;\\n};\\n\\n// set up data events if they are asked for\\n// Ensure readable listeners eventually get something\\nReadable.prototype.on = function(ev, fn) {\\n  var res = Stream.prototype.on.call(this, ev, fn);\\n\\n  if (ev === 'data' && !this._readableState.flowing)\\n    emitDataEvents(this);\\n\\n  if (ev === 'readable' && this.readable) {\\n    var state = this._readableState;\\n    if (!state.readableListening) {\\n      state.readableListening = true;\\n      state.emittedReadable = false;\\n      state.needReadable = true;\\n      if (!state.reading) {\\n        this.read(0);\\n      } else if (state.length) {\\n        emitReadable(this, state);\\n      }\\n    }\\n  }\\n\\n  return res;\\n};\\nReadable.prototype.addListener = Readable.prototype.on;\\n\\n// pause() and resume() are remnants of the legacy readable stream API\\n// If the user uses them, then switch into old mode.\\nReadable.prototype.resume = function() {\\n  emitDataEvents(this);\\n  this.read(0);\\n  this.emit('resume');\\n};\\n\\nReadable.prototype.pause = function() {\\n  emitDataEvents(this, true);\\n  this.emit('pause');\\n};\\n\\nfunction emitDataEvents(stream, startPaused) {\\n  var state = stream._readableState;\\n\\n  if (state.flowing) {\\n    // https://github.com/isaacs/readable-stream/issues/16\\n    throw new Error('Cannot switch to old mode now.');\\n  }\\n\\n  var paused = startPaused || false;\\n  var readable = false;\\n\\n  // convert to an old-style stream.\\n  stream.readable = true;\\n  stream.pipe = Stream.prototype.pipe;\\n  stream.on = stream.addListener = Stream.prototype.on;\\n\\n  stream.on('readable', function() {\\n    readable = true;\\n\\n    var c;\\n    while (!paused && (null !== (c = stream.read())))\\n      stream.emit('data', c);\\n\\n    if (c === null) {\\n      readable = false;\\n      stream._readableState.needReadable = true;\\n    }\\n  });\\n\\n  stream.pause = function() {\\n    paused = true;\\n    this.emit('pause');\\n  };\\n\\n  stream.resume = function() {\\n    paused = false;\\n    if (readable)\\n      setImmediate(function() {\\n        stream.emit('readable');\\n      });\\n    else\\n      this.read(0);\\n    this.emit('resume');\\n  };\\n\\n  // now make it start, just in case it hadn't already.\\n  stream.emit('readable');\\n}\\n\\n// wrap an old-style stream as the async data source.\\n// This is *not* part of the readable stream interface.\\n// It is an ugly unfortunate mess of history.\\nReadable.prototype.wrap = function(stream) {\\n  var state = this._readableState;\\n  var paused = false;\\n\\n  var self = this;\\n  stream.on('end', function() {\\n    if (state.decoder && !state.ended) {\\n      var chunk = state.decoder.end();\\n      if (chunk && chunk.length)\\n        self.push(chunk);\\n    }\\n\\n    self.push(null);\\n  });\\n\\n  stream.on('data', function(chunk) {\\n    if (state.decoder)\\n      chunk = state.decoder.write(chunk);\\n    if (!chunk || !state.objectMode && !chunk.length)\\n      return;\\n\\n    var ret = self.push(chunk);\\n    if (!ret) {\\n      paused = true;\\n      stream.pause();\\n    }\\n  });\\n\\n  // proxy all the other methods.\\n  // important when wrapping filters and duplexes.\\n  for (var i in stream) {\\n    if (typeof stream[i] === 'function' &&\\n        typeof this[i] === 'undefined') {\\n      this[i] = function(method) { return function() {\\n        return stream[method].apply(stream, arguments);\\n      }}(i);\\n    }\\n  }\\n\\n  // proxy certain important events.\\n  var events = ['error', 'close', 'destroy', 'pause', 'resume'];\\n  forEach(events, function(ev) {\\n    stream.on(ev, function (x) {\\n      return self.emit.apply(self, ev, x);\\n    });\\n  });\\n\\n  // when we try to consume some more bytes, simply unpause the\\n  // underlying stream.\\n  self._read = function(n) {\\n    if (paused) {\\n      paused = false;\\n      stream.resume();\\n    }\\n  };\\n\\n  return self;\\n};\\n\\n\\n\\n// exposed for testing purposes only.\\nReadable._fromList = fromList;\\n\\n// Pluck off n bytes from an array of buffers.\\n// Length is the combined lengths of all the buffers in the list.\\nfunction fromList(n, state) {\\n  var list = state.buffer;\\n  var length = state.length;\\n  var stringMode = !!state.decoder;\\n  var objectMode = !!state.objectMode;\\n  var ret;\\n\\n  // nothing in the list, definitely empty.\\n  if (list.length === 0)\\n    return null;\\n\\n  if (length === 0)\\n    ret = null;\\n  else if (objectMode)\\n    ret = list.shift();\\n  else if (!n || n >= length) {\\n    // read it all, truncate the array.\\n    if (stringMode)\\n      ret = list.join('');\\n    else\\n      ret = Buffer.concat(list, length);\\n    list.length = 0;\\n  } else {\\n    // read just some of it.\\n    if (n < list[0].length) {\\n      // just take a part of the first list item.\\n      // slice is the same for buffers and strings.\\n      var buf = list[0];\\n      ret = buf.slice(0, n);\\n      list[0] = buf.slice(n);\\n    } else if (n === list[0].length) {\\n      // first list is a perfect match\\n      ret = list.shift();\\n    } else {\\n      // complex case.\\n      // we have enough to cover it, but it spans past the first buffer.\\n      if (stringMode)\\n        ret = '';\\n      else\\n        ret = new Buffer(n);\\n\\n      var c = 0;\\n      for (var i = 0, l = list.length; i < l && c < n; i++) {\\n        var buf = list[0];\\n        var cpy = Math.min(n - c, buf.length);\\n\\n        if (stringMode)\\n          ret += buf.slice(0, cpy);\\n        else\\n          buf.copy(ret, c, 0, cpy);\\n\\n        if (cpy < buf.length)\\n          list[0] = buf.slice(cpy);\\n        else\\n          list.shift();\\n\\n        c += cpy;\\n      }\\n    }\\n  }\\n\\n  return ret;\\n}\\n\\nfunction endReadable(stream) {\\n  var state = stream._readableState;\\n\\n  // If we get here before consuming all the bytes, then that is a\\n  // bug in node.  Should never happen.\\n  if (state.length > 0)\\n    throw new Error('endReadable called on non-empty stream');\\n\\n  if (!state.endEmitted && state.calledRead) {\\n    state.ended = true;\\n    setImmediate(function() {\\n      // Check that we didn't get one last unshift.\\n      if (!state.endEmitted && state.length === 0) {\\n        state.endEmitted = true;\\n        stream.readable = false;\\n        stream.emit('end');\\n      }\\n    });\\n  }\\n}\\n\\nfunction forEach (xs, f) {\\n  for (var i = 0, l = xs.length; i < l; i++) {\\n    f(xs[i], i);\\n  }\\n}\\n\\nfunction indexOf (xs, x) {\\n  for (var i = 0, l = xs.length; i < l; i++) {\\n    if (xs[i] === x) return i;\\n  }\\n  return -1;\\n}\\n\\n}).call(this,require(\\\"/Users/kraftwerk-mb/dev/projects/usco/usco-gcode-parser/node_modules/workerify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js\\\"))\\n},{\\\"./index.js\\\":15,\\\"/Users/kraftwerk-mb/dev/projects/usco/usco-gcode-parser/node_modules/workerify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js\\\":13,\\\"buffer\\\":8,\\\"events\\\":11,\\\"inherits\\\":12,\\\"process/browser.js\\\":16,\\\"string_decoder\\\":21}],19:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// a transform stream is a readable/writable stream where you do\\n// something with the data.  Sometimes it's called a \\\"filter\\\",\\n// but that's not a great name for it, since that implies a thing where\\n// some bits pass through, and others are simply ignored.  (That would\\n// be a valid example of a transform, of course.)\\n//\\n// While the output is causally related to the input, it's not a\\n// necessarily symmetric or synchronous transformation.  For example,\\n// a zlib stream might take multiple plain-text writes(), and then\\n// emit a single compressed chunk some time in the future.\\n//\\n// Here's how this works:\\n//\\n// The Transform stream has all the aspects of the readable and writable\\n// stream classes.  When you write(chunk), that calls _write(chunk,cb)\\n// internally, and returns false if there's a lot of pending writes\\n// buffered up.  When you call read(), that calls _read(n) until\\n// there's enough pending readable data buffered up.\\n//\\n// In a transform stream, the written data is placed in a buffer.  When\\n// _read(n) is called, it transforms the queued up data, calling the\\n// buffered _write cb's as it consumes chunks.  If consuming a single\\n// written chunk would result in multiple output chunks, then the first\\n// outputted bit calls the readcb, and subsequent chunks just go into\\n// the read buffer, and will cause it to emit 'readable' if necessary.\\n//\\n// This way, back-pressure is actually determined by the reading side,\\n// since _read has to be called to start processing a new chunk.  However,\\n// a pathological inflate type of transform can cause excessive buffering\\n// here.  For example, imagine a stream where every byte of input is\\n// interpreted as an integer from 0-255, and then results in that many\\n// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in\\n// 1kb of data being output.  In this case, you could write a very small\\n// amount of input, and end up with a very large amount of output.  In\\n// such a pathological inflating mechanism, there'd be no way to tell\\n// the system to stop doing the transform.  A single 4MB write could\\n// cause the system to run out of memory.\\n//\\n// However, even in such a pathological case, only a single written chunk\\n// would be consumed, and then the rest would wait (un-transformed) until\\n// the results of the previous transformed chunk were consumed.\\n\\nmodule.exports = Transform;\\n\\nvar Duplex = require('./duplex.js');\\nvar inherits = require('inherits');\\ninherits(Transform, Duplex);\\n\\n\\nfunction TransformState(options, stream) {\\n  this.afterTransform = function(er, data) {\\n    return afterTransform(stream, er, data);\\n  };\\n\\n  this.needTransform = false;\\n  this.transforming = false;\\n  this.writecb = null;\\n  this.writechunk = null;\\n}\\n\\nfunction afterTransform(stream, er, data) {\\n  var ts = stream._transformState;\\n  ts.transforming = false;\\n\\n  var cb = ts.writecb;\\n\\n  if (!cb)\\n    return stream.emit('error', new Error('no writecb in Transform class'));\\n\\n  ts.writechunk = null;\\n  ts.writecb = null;\\n\\n  if (data !== null && data !== undefined)\\n    stream.push(data);\\n\\n  if (cb)\\n    cb(er);\\n\\n  var rs = stream._readableState;\\n  rs.reading = false;\\n  if (rs.needReadable || rs.length < rs.highWaterMark) {\\n    stream._read(rs.highWaterMark);\\n  }\\n}\\n\\n\\nfunction Transform(options) {\\n  if (!(this instanceof Transform))\\n    return new Transform(options);\\n\\n  Duplex.call(this, options);\\n\\n  var ts = this._transformState = new TransformState(options, this);\\n\\n  // when the writable side finishes, then flush out anything remaining.\\n  var stream = this;\\n\\n  // start out asking for a readable event once data is transformed.\\n  this._readableState.needReadable = true;\\n\\n  // we have implemented the _read method, and done the other things\\n  // that Readable wants before the first _read call, so unset the\\n  // sync guard flag.\\n  this._readableState.sync = false;\\n\\n  this.once('finish', function() {\\n    if ('function' === typeof this._flush)\\n      this._flush(function(er) {\\n        done(stream, er);\\n      });\\n    else\\n      done(stream);\\n  });\\n}\\n\\nTransform.prototype.push = function(chunk, encoding) {\\n  this._transformState.needTransform = false;\\n  return Duplex.prototype.push.call(this, chunk, encoding);\\n};\\n\\n// This is the part where you do stuff!\\n// override this function in implementation classes.\\n// 'chunk' is an input chunk.\\n//\\n// Call `push(newChunk)` to pass along transformed output\\n// to the readable side.  You may call 'push' zero or more times.\\n//\\n// Call `cb(err)` when you are done with this chunk.  If you pass\\n// an error, then that'll put the hurt on the whole operation.  If you\\n// never call cb(), then you'll never get another chunk.\\nTransform.prototype._transform = function(chunk, encoding, cb) {\\n  throw new Error('not implemented');\\n};\\n\\nTransform.prototype._write = function(chunk, encoding, cb) {\\n  var ts = this._transformState;\\n  ts.writecb = cb;\\n  ts.writechunk = chunk;\\n  ts.writeencoding = encoding;\\n  if (!ts.transforming) {\\n    var rs = this._readableState;\\n    if (ts.needTransform ||\\n        rs.needReadable ||\\n        rs.length < rs.highWaterMark)\\n      this._read(rs.highWaterMark);\\n  }\\n};\\n\\n// Doesn't matter what the args are here.\\n// _transform does all the work.\\n// That we got here means that the readable side wants more data.\\nTransform.prototype._read = function(n) {\\n  var ts = this._transformState;\\n\\n  if (ts.writechunk && ts.writecb && !ts.transforming) {\\n    ts.transforming = true;\\n    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\\n  } else {\\n    // mark that we need a transform, so that any data that comes in\\n    // will get processed, now that we've asked for it.\\n    ts.needTransform = true;\\n  }\\n};\\n\\n\\nfunction done(stream, er) {\\n  if (er)\\n    return stream.emit('error', er);\\n\\n  // if there's nothing in the write buffer, then that means\\n  // that nothing more will ever be provided\\n  var ws = stream._writableState;\\n  var rs = stream._readableState;\\n  var ts = stream._transformState;\\n\\n  if (ws.length)\\n    throw new Error('calling transform done when ws.length != 0');\\n\\n  if (ts.transforming)\\n    throw new Error('calling transform done when still transforming');\\n\\n  return stream.push(null);\\n}\\n\\n},{\\\"./duplex.js\\\":14,\\\"inherits\\\":12}],20:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\n// A bit simpler than readable streams.\\n// Implement an async ._write(chunk, cb), and it'll handle all\\n// the drain event emission and buffering.\\n\\nmodule.exports = Writable;\\nWritable.WritableState = WritableState;\\n\\nvar isUint8Array = typeof Uint8Array !== 'undefined'\\n  ? function (x) { return x instanceof Uint8Array }\\n  : function (x) {\\n    return x && x.constructor && x.constructor.name === 'Uint8Array'\\n  }\\n;\\nvar isArrayBuffer = typeof ArrayBuffer !== 'undefined'\\n  ? function (x) { return x instanceof ArrayBuffer }\\n  : function (x) {\\n    return x && x.constructor && x.constructor.name === 'ArrayBuffer'\\n  }\\n;\\n\\nvar inherits = require('inherits');\\nvar Stream = require('./index.js');\\nvar setImmediate = require('process/browser.js').nextTick;\\nvar Buffer = require('buffer').Buffer;\\n\\ninherits(Writable, Stream);\\n\\nfunction WriteReq(chunk, encoding, cb) {\\n  this.chunk = chunk;\\n  this.encoding = encoding;\\n  this.callback = cb;\\n}\\n\\nfunction WritableState(options, stream) {\\n  options = options || {};\\n\\n  // the point at which write() starts returning false\\n  // Note: 0 is a valid value, means that we always return false if\\n  // the entire buffer is not flushed immediately on write()\\n  var hwm = options.highWaterMark;\\n  this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\\n\\n  // object stream flag to indicate whether or not this stream\\n  // contains buffers or objects.\\n  this.objectMode = !!options.objectMode;\\n\\n  // cast to ints.\\n  this.highWaterMark = ~~this.highWaterMark;\\n\\n  this.needDrain = false;\\n  // at the start of calling end()\\n  this.ending = false;\\n  // when end() has been called, and returned\\n  this.ended = false;\\n  // when 'finish' is emitted\\n  this.finished = false;\\n\\n  // should we decode strings into buffers before passing to _write?\\n  // this is here so that some node-core streams can optimize string\\n  // handling at a lower level.\\n  var noDecode = options.decodeStrings === false;\\n  this.decodeStrings = !noDecode;\\n\\n  // Crypto is kind of old and crusty.  Historically, its default string\\n  // encoding is 'binary' so we have to make this configurable.\\n  // Everything else in the universe uses 'utf8', though.\\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\\n\\n  // not an actual buffer we keep track of, but a measurement\\n  // of how much we're waiting to get pushed to some underlying\\n  // socket or file.\\n  this.length = 0;\\n\\n  // a flag to see when we're in the middle of a write.\\n  this.writing = false;\\n\\n  // a flag to be able to tell if the onwrite cb is called immediately,\\n  // or on a later tick.  We set this to true at first, becuase any\\n  // actions that shouldn't happen until \\\"later\\\" should generally also\\n  // not happen before the first write call.\\n  this.sync = true;\\n\\n  // a flag to know if we're processing previously buffered items, which\\n  // may call the _write() callback in the same tick, so that we don't\\n  // end up in an overlapped onwrite situation.\\n  this.bufferProcessing = false;\\n\\n  // the callback that's passed to _write(chunk,cb)\\n  this.onwrite = function(er) {\\n    onwrite(stream, er);\\n  };\\n\\n  // the callback that the user supplies to write(chunk,encoding,cb)\\n  this.writecb = null;\\n\\n  // the amount that is being written when _write is called.\\n  this.writelen = 0;\\n\\n  this.buffer = [];\\n}\\n\\nfunction Writable(options) {\\n  // Writable ctor is applied to Duplexes, though they're not\\n  // instanceof Writable, they're instanceof Readable.\\n  if (!(this instanceof Writable) && !(this instanceof Stream.Duplex))\\n    return new Writable(options);\\n\\n  this._writableState = new WritableState(options, this);\\n\\n  // legacy.\\n  this.writable = true;\\n\\n  Stream.call(this);\\n}\\n\\n// Otherwise people can pipe Writable streams, which is just wrong.\\nWritable.prototype.pipe = function() {\\n  this.emit('error', new Error('Cannot pipe. Not readable.'));\\n};\\n\\n\\nfunction writeAfterEnd(stream, state, cb) {\\n  var er = new Error('write after end');\\n  // TODO: defer error events consistently everywhere, not just the cb\\n  stream.emit('error', er);\\n  setImmediate(function() {\\n    cb(er);\\n  });\\n}\\n\\n// If we get something that is not a buffer, string, null, or undefined,\\n// and we're not in objectMode, then that's an error.\\n// Otherwise stream chunks are all considered to be of length=1, and the\\n// watermarks determine how many objects to keep in the buffer, rather than\\n// how many bytes or characters.\\nfunction validChunk(stream, state, chunk, cb) {\\n  var valid = true;\\n  if (!Buffer.isBuffer(chunk) &&\\n      'string' !== typeof chunk &&\\n      chunk !== null &&\\n      chunk !== undefined &&\\n      !state.objectMode) {\\n    var er = new TypeError('Invalid non-string/buffer chunk');\\n    stream.emit('error', er);\\n    setImmediate(function() {\\n      cb(er);\\n    });\\n    valid = false;\\n  }\\n  return valid;\\n}\\n\\nWritable.prototype.write = function(chunk, encoding, cb) {\\n  var state = this._writableState;\\n  var ret = false;\\n\\n  if (typeof encoding === 'function') {\\n    cb = encoding;\\n    encoding = null;\\n  }\\n\\n  if (!Buffer.isBuffer(chunk) && isUint8Array(chunk))\\n    chunk = new Buffer(chunk);\\n  if (isArrayBuffer(chunk) && typeof Uint8Array !== 'undefined')\\n    chunk = new Buffer(new Uint8Array(chunk));\\n  \\n  if (Buffer.isBuffer(chunk))\\n    encoding = 'buffer';\\n  else if (!encoding)\\n    encoding = state.defaultEncoding;\\n\\n  if (typeof cb !== 'function')\\n    cb = function() {};\\n\\n  if (state.ended)\\n    writeAfterEnd(this, state, cb);\\n  else if (validChunk(this, state, chunk, cb))\\n    ret = writeOrBuffer(this, state, chunk, encoding, cb);\\n\\n  return ret;\\n};\\n\\nfunction decodeChunk(state, chunk, encoding) {\\n  if (!state.objectMode &&\\n      state.decodeStrings !== false &&\\n      typeof chunk === 'string') {\\n    chunk = new Buffer(chunk, encoding);\\n  }\\n  return chunk;\\n}\\n\\n// if we're already writing something, then just put this\\n// in the queue, and wait our turn.  Otherwise, call _write\\n// If we return false, then we need a drain event, so set that flag.\\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\\n  chunk = decodeChunk(state, chunk, encoding);\\n  var len = state.objectMode ? 1 : chunk.length;\\n\\n  state.length += len;\\n\\n  var ret = state.length < state.highWaterMark;\\n  state.needDrain = !ret;\\n\\n  if (state.writing)\\n    state.buffer.push(new WriteReq(chunk, encoding, cb));\\n  else\\n    doWrite(stream, state, len, chunk, encoding, cb);\\n\\n  return ret;\\n}\\n\\nfunction doWrite(stream, state, len, chunk, encoding, cb) {\\n  state.writelen = len;\\n  state.writecb = cb;\\n  state.writing = true;\\n  state.sync = true;\\n  stream._write(chunk, encoding, state.onwrite);\\n  state.sync = false;\\n}\\n\\nfunction onwriteError(stream, state, sync, er, cb) {\\n  if (sync)\\n    setImmediate(function() {\\n      cb(er);\\n    });\\n  else\\n    cb(er);\\n\\n  stream.emit('error', er);\\n}\\n\\nfunction onwriteStateUpdate(state) {\\n  state.writing = false;\\n  state.writecb = null;\\n  state.length -= state.writelen;\\n  state.writelen = 0;\\n}\\n\\nfunction onwrite(stream, er) {\\n  var state = stream._writableState;\\n  var sync = state.sync;\\n  var cb = state.writecb;\\n\\n  onwriteStateUpdate(state);\\n\\n  if (er)\\n    onwriteError(stream, state, sync, er, cb);\\n  else {\\n    // Check if we're actually ready to finish, but don't emit yet\\n    var finished = needFinish(stream, state);\\n\\n    if (!finished && !state.bufferProcessing && state.buffer.length)\\n      clearBuffer(stream, state);\\n\\n    if (sync) {\\n      setImmediate(function() {\\n        afterWrite(stream, state, finished, cb);\\n      });\\n    } else {\\n      afterWrite(stream, state, finished, cb);\\n    }\\n  }\\n}\\n\\nfunction afterWrite(stream, state, finished, cb) {\\n  if (!finished)\\n    onwriteDrain(stream, state);\\n  cb();\\n  if (finished)\\n    finishMaybe(stream, state);\\n}\\n\\n// Must force callback to be called on nextTick, so that we don't\\n// emit 'drain' before the write() consumer gets the 'false' return\\n// value, and has a chance to attach a 'drain' listener.\\nfunction onwriteDrain(stream, state) {\\n  if (state.length === 0 && state.needDrain) {\\n    state.needDrain = false;\\n    stream.emit('drain');\\n  }\\n}\\n\\n\\n// if there's something in the buffer waiting, then process it\\nfunction clearBuffer(stream, state) {\\n  state.bufferProcessing = true;\\n\\n  for (var c = 0; c < state.buffer.length; c++) {\\n    var entry = state.buffer[c];\\n    var chunk = entry.chunk;\\n    var encoding = entry.encoding;\\n    var cb = entry.callback;\\n    var len = state.objectMode ? 1 : chunk.length;\\n\\n    doWrite(stream, state, len, chunk, encoding, cb);\\n\\n    // if we didn't call the onwrite immediately, then\\n    // it means that we need to wait until it does.\\n    // also, that means that the chunk and cb are currently\\n    // being processed, so move the buffer counter past them.\\n    if (state.writing) {\\n      c++;\\n      break;\\n    }\\n  }\\n\\n  state.bufferProcessing = false;\\n  if (c < state.buffer.length)\\n    state.buffer = state.buffer.slice(c);\\n  else\\n    state.buffer.length = 0;\\n}\\n\\nWritable.prototype._write = function(chunk, encoding, cb) {\\n  cb(new Error('not implemented'));\\n};\\n\\nWritable.prototype.end = function(chunk, encoding, cb) {\\n  var state = this._writableState;\\n\\n  if (typeof chunk === 'function') {\\n    cb = chunk;\\n    chunk = null;\\n    encoding = null;\\n  } else if (typeof encoding === 'function') {\\n    cb = encoding;\\n    encoding = null;\\n  }\\n\\n  if (typeof chunk !== 'undefined' && chunk !== null)\\n    this.write(chunk, encoding);\\n\\n  // ignore unnecessary end() calls.\\n  if (!state.ending && !state.finished)\\n    endWritable(this, state, cb);\\n};\\n\\n\\nfunction needFinish(stream, state) {\\n  return (state.ending &&\\n          state.length === 0 &&\\n          !state.finished &&\\n          !state.writing);\\n}\\n\\nfunction finishMaybe(stream, state) {\\n  var need = needFinish(stream, state);\\n  if (need) {\\n    state.finished = true;\\n    stream.emit('finish');\\n  }\\n  return need;\\n}\\n\\nfunction endWritable(stream, state, cb) {\\n  state.ending = true;\\n  finishMaybe(stream, state);\\n  if (cb) {\\n    if (state.finished)\\n      setImmediate(cb);\\n    else\\n      stream.once('finish', cb);\\n  }\\n  state.ended = true;\\n}\\n\\n},{\\\"./index.js\\\":15,\\\"buffer\\\":8,\\\"inherits\\\":12,\\\"process/browser.js\\\":16}],21:[function(require,module,exports){\\n// Copyright Joyent, Inc. and other Node contributors.\\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a\\n// copy of this software and associated documentation files (the\\n// \\\"Software\\\"), to deal in the Software without restriction, including\\n// without limitation the rights to use, copy, modify, merge, publish,\\n// distribute, sublicense, and/or sell copies of the Software, and to permit\\n// persons to whom the Software is furnished to do so, subject to the\\n// following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included\\n// in all copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\\nvar Buffer = require('buffer').Buffer;\\n\\nfunction assertEncoding(encoding) {\\n  if (encoding && !Buffer.isEncoding(encoding)) {\\n    throw new Error('Unknown encoding: ' + encoding);\\n  }\\n}\\n\\nvar StringDecoder = exports.StringDecoder = function(encoding) {\\n  this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');\\n  assertEncoding(encoding);\\n  switch (this.encoding) {\\n    case 'utf8':\\n      // CESU-8 represents each of Surrogate Pair by 3-bytes\\n      this.surrogateSize = 3;\\n      break;\\n    case 'ucs2':\\n    case 'utf16le':\\n      // UTF-16 represents each of Surrogate Pair by 2-bytes\\n      this.surrogateSize = 2;\\n      this.detectIncompleteChar = utf16DetectIncompleteChar;\\n      break;\\n    case 'base64':\\n      // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\\n      this.surrogateSize = 3;\\n      this.detectIncompleteChar = base64DetectIncompleteChar;\\n      break;\\n    default:\\n      this.write = passThroughWrite;\\n      return;\\n  }\\n\\n  this.charBuffer = new Buffer(6);\\n  this.charReceived = 0;\\n  this.charLength = 0;\\n};\\n\\n\\nStringDecoder.prototype.write = function(buffer) {\\n  var charStr = '';\\n  var offset = 0;\\n\\n  // if our last write ended with an incomplete multibyte character\\n  while (this.charLength) {\\n    // determine how many remaining bytes this buffer has to offer for this char\\n    var i = (buffer.length >= this.charLength - this.charReceived) ?\\n                this.charLength - this.charReceived :\\n                buffer.length;\\n\\n    // add the new bytes to the char buffer\\n    buffer.copy(this.charBuffer, this.charReceived, offset, i);\\n    this.charReceived += (i - offset);\\n    offset = i;\\n\\n    if (this.charReceived < this.charLength) {\\n      // still not enough chars in this buffer? wait for more ...\\n      return '';\\n    }\\n\\n    // get the character that was split\\n    charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\\n\\n    // lead surrogate (D800-DBFF) is also the incomplete character\\n    var charCode = charStr.charCodeAt(charStr.length - 1);\\n    if (charCode >= 0xD800 && charCode <= 0xDBFF) {\\n      this.charLength += this.surrogateSize;\\n      charStr = '';\\n      continue;\\n    }\\n    this.charReceived = this.charLength = 0;\\n\\n    // if there are no more bytes in this buffer, just emit our char\\n    if (i == buffer.length) return charStr;\\n\\n    // otherwise cut off the characters end from the beginning of this buffer\\n    buffer = buffer.slice(i, buffer.length);\\n    break;\\n  }\\n\\n  var lenIncomplete = this.detectIncompleteChar(buffer);\\n\\n  var end = buffer.length;\\n  if (this.charLength) {\\n    // buffer the incomplete character bytes we got\\n    buffer.copy(this.charBuffer, 0, buffer.length - lenIncomplete, end);\\n    this.charReceived = lenIncomplete;\\n    end -= lenIncomplete;\\n  }\\n\\n  charStr += buffer.toString(this.encoding, 0, end);\\n\\n  var end = charStr.length - 1;\\n  var charCode = charStr.charCodeAt(end);\\n  // lead surrogate (D800-DBFF) is also the incomplete character\\n  if (charCode >= 0xD800 && charCode <= 0xDBFF) {\\n    var size = this.surrogateSize;\\n    this.charLength += size;\\n    this.charReceived += size;\\n    this.charBuffer.copy(this.charBuffer, size, 0, size);\\n    this.charBuffer.write(charStr.charAt(charStr.length - 1), this.encoding);\\n    return charStr.substring(0, end);\\n  }\\n\\n  // or just emit the charStr\\n  return charStr;\\n};\\n\\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\\n  // determine how many bytes we have to check at the end of this buffer\\n  var i = (buffer.length >= 3) ? 3 : buffer.length;\\n\\n  // Figure out if one of the last i bytes of our buffer announces an\\n  // incomplete char.\\n  for (; i > 0; i--) {\\n    var c = buffer[buffer.length - i];\\n\\n    // See http://en.wikipedia.org/wiki/UTF-8#Description\\n\\n    // 110XXXXX\\n    if (i == 1 && c >> 5 == 0x06) {\\n      this.charLength = 2;\\n      break;\\n    }\\n\\n    // 1110XXXX\\n    if (i <= 2 && c >> 4 == 0x0E) {\\n      this.charLength = 3;\\n      break;\\n    }\\n\\n    // 11110XXX\\n    if (i <= 3 && c >> 3 == 0x1E) {\\n      this.charLength = 4;\\n      break;\\n    }\\n  }\\n\\n  return i;\\n};\\n\\nStringDecoder.prototype.end = function(buffer) {\\n  var res = '';\\n  if (buffer && buffer.length)\\n    res = this.write(buffer);\\n\\n  if (this.charReceived) {\\n    var cr = this.charReceived;\\n    var buf = this.charBuffer;\\n    var enc = this.encoding;\\n    res += buf.slice(0, cr).toString(enc);\\n  }\\n\\n  return res;\\n};\\n\\nfunction passThroughWrite(buffer) {\\n  return buffer.toString(this.encoding);\\n}\\n\\nfunction utf16DetectIncompleteChar(buffer) {\\n  var incomplete = this.charReceived = buffer.length % 2;\\n  this.charLength = incomplete ? 2 : 0;\\n  return incomplete;\\n}\\n\\nfunction base64DetectIncompleteChar(buffer) {\\n  var incomplete = this.charReceived = buffer.length % 3;\\n  this.charLength = incomplete ? 3 : 0;\\n  return incomplete;\\n}\\n\\n},{\\\"buffer\\\":8}],22:[function(require,module,exports){\\n// DOM APIs, for completeness\\n\\nif (typeof setTimeout !== 'undefined') exports.setTimeout = function() { return setTimeout.apply(window, arguments); };\\nif (typeof clearTimeout !== 'undefined') exports.clearTimeout = function() { clearTimeout.apply(window, arguments); };\\nif (typeof setInterval !== 'undefined') exports.setInterval = function() { return setInterval.apply(window, arguments); };\\nif (typeof clearInterval !== 'undefined') exports.clearInterval = function() { clearInterval.apply(window, arguments); };\\n\\n// TODO: Change to more effiecient list approach used in Node.js\\n// For now, we just implement the APIs using the primitives above.\\n\\nexports.enroll = function(item, delay) {\\n  item._timeoutID = setTimeout(item._onTimeout, delay);\\n};\\n\\nexports.unenroll = function(item) {\\n  clearTimeout(item._timeoutID);\\n};\\n\\nexports.active = function(item) {\\n  // our naive impl doesn't care (correctness is still preserved)\\n};\\n\\nexports.setImmediate = require('process/browser.js').nextTick;\\n\\n},{\\\"process/browser.js\\\":23}],23:[function(require,module,exports){\\nmodule.exports=require(16)\\n},{}],24:[function(require,module,exports){\\n'use strict';\\n\\nObject.defineProperty(exports, \\\"__esModule\\\", {\\n  value: true\\n});\\nexports.parseSteps = parseSteps;\\n\\nvar _gcodeToolpath = require('gcode-toolpath');\\n\\nfunction parseSteps(data, cb) {\\n  var defaultColor = [0, 0, 0, 255];\\n  var motionColor = {\\n    'G0': [255, 158, 2, 255],\\n    'G1': [7, 169, 255, 255],\\n    'G2': [125, 255, 255, 255],\\n    'G3': [125, 255, 125, 255]\\n  };\\n\\n  var group = {};\\n  var geometry = {};\\n  var posArray = [];\\n  var colArray = [];\\n\\n  function _addLine(modalState, v1, v2) {\\n    var motion = modalState.motion;\\n\\n    posArray.push(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z);\\n    var color = (motionColor[motion] || defaultColor).map(function (e) {\\n      return e / 255;\\n    });\\n    colArray.push(color[0], color[1], color[2], color[3], color[0], color[1], color[2], color[3]);\\n  }\\n\\n  function _addArcCurve(modalState, v1, v2, v0) {}\\n\\n  console.log('starting to parse');\\n  var toolpath = new _gcodeToolpath.GCodeToolpath({\\n    modalState: {},\\n    addLine: function addLine(modalState, v1, v2) {\\n      _addLine(modalState, v1, v2);\\n    },\\n    addArcCurve: function addArcCurve(modalState, v1, v2, v0) {\\n      _addArcCurve(modalState, v1, v2, v0);\\n    }\\n  });\\n  toolpath.loadFromString(data, function (err, data) {\\n    //console.log('foo',err, data)\\n    if (err) {\\n      cb(err, undefined);\\n    }\\n  }).on('end', function (results) {\\n    console.log('end');\\n    var positions = new Float32Array(posArray); // posArray.length  )\\n    var colors = new Float32Array(colArray); // posArray.length/3 * 4  )\\n    geometry = { colors: colors, positions: positions };\\n    group = geometry;\\n    geometry = {};\\n\\n    cb(undefined, [group]);\\n  });\\n}\\n\\n},{\\\"gcode-toolpath\\\":5}],25:[function(require,module,exports){\\n'use strict';\\n\\nvar _parse = require('./parse');\\n\\nvar _stream = require('stream');\\n\\nvar _stream2 = _interopRequireDefault(_stream);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nself.onmessage = function (event) {\\n  function cb(err, data) {\\n    if (err) {\\n      throw err;\\n    } else {\\n      self.postMessage({ data: data }); //, [data])\\n      self.close();\\n    }\\n  }\\n\\n  var s = new _stream2.default.Readable();\\n  s.push(event.data.data);\\n  s.push(null);\\n\\n  (0, _parse.parseSteps)(s, cb);\\n};\\n\\n},{\\\"./parse\\\":24,\\\"stream\\\":15}]},{},[25])\"],{type:\"text/javascript\"}))); // browserify\nworker.onmessage = function(event){ //const positions = new Float32Array(event.data.positions)\n//const colors = new Float32Array(event.data.colors)\n//const geometry = {positions, colors}\nconsole.log('worker on message',event.data);var data=event.data.data;obs.onNext({progress:1,total:1});obs.onNext(data);obs.onCompleted();};worker.onerror = function(event){obs.onError('filename:' + event.filename + ' lineno: ' + event.lineno + ' error: ' + event.message);};worker.postMessage({data:data});obs.catch(function(e){return worker.terminate();});})();}else {(0,_parse.parseSteps)(data,function(err,result){if(err){obs.onError(err);}else {obs.onNext({progress:1,total:1});obs.onNext(result);obs.onCompleted();}});}return obs;}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./parse\":37,\"composite-detect\":28,\"fast.js/object/assign\":29}],37:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.parseSteps = parseSteps;\n\nvar _gcodeToolpath = require('gcode-toolpath');\n\nfunction parseSteps(data, cb) {\n  var defaultColor = [0, 0, 0, 255];\n  var motionColor = {\n    'G0': [255, 158, 2, 255],\n    'G1': [7, 169, 255, 255],\n    'G2': [125, 255, 255, 255],\n    'G3': [125, 255, 125, 255]\n  };\n\n  var group = {};\n  var geometry = {};\n  var posArray = [];\n  var colArray = [];\n\n  function _addLine(modalState, v1, v2) {\n    var motion = modalState.motion;\n\n    posArray.push(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z);\n    var color = (motionColor[motion] || defaultColor).map(function (e) {\n      return e / 255;\n    });\n    colArray.push(color[0], color[1], color[2], color[3], color[0], color[1], color[2], color[3]);\n  }\n\n  function _addArcCurve(modalState, v1, v2, v0) {}\n\n  console.log('starting to parse');\n  var toolpath = new _gcodeToolpath.GCodeToolpath({\n    modalState: {},\n    addLine: function addLine(modalState, v1, v2) {\n      _addLine(modalState, v1, v2);\n    },\n    addArcCurve: function addArcCurve(modalState, v1, v2, v0) {\n      _addArcCurve(modalState, v1, v2, v0);\n    }\n  });\n  toolpath.loadFromString(data, function (err, data) {\n    //console.log('foo',err, data)\n    if (err) {\n      cb(err, undefined);\n    }\n  }).on('end', function (results) {\n    console.log('end');\n    var positions = new Float32Array(posArray); // posArray.length  )\n    var colors = new Float32Array(colArray); // posArray.length/3 * 4  )\n    geometry = { colors: colors, positions: positions };\n    group = geometry;\n    geometry = {};\n\n    cb(undefined, [group]);\n  });\n}\n\n},{\"gcode-toolpath\":34}]},{},[36])(36)\n});\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(59).Buffer, __webpack_require__(36).setImmediate, __webpack_require__(36).clearImmediate))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-gcode-parser/lib/browser/gcode-parser.js\n ** module id = 351\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-gcode-parser/lib/browser/gcode-parser.js?");
},function(module,exports,__webpack_require__){eval('var require;var require;/* WEBPACK VAR INJECTION */(function(global) {(function(f){if(true){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.objParser = f()}})(function(){var define,module,exports;return (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 require(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = setTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = \'browser\';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = \'\'; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error(\'process.binding is not supported\');\n};\n\nprocess.cwd = function () { return \'/\' };\nprocess.chdir = function (dir) {\n    throw new Error(\'process.chdir is not supported\');\n};\nprocess.umask = function() { return 0; };\n\n},{}],2:[function(require,module,exports){\n(function (process){\n(function () {\n  // Hueristics.\n  var isNode = typeof process !== \'undefined\' && process.versions && !!process.versions.node;\n  var isBrowser = typeof window !== \'undefined\';\n  var isModule = typeof module !== \'undefined\' && !!module.exports;\n\n  // Export.\n  var detect = (isModule ? exports : (this.detect = {}));\n  detect.isNode = isNode;\n  detect.isBrowser = isBrowser;\n  detect.isModule = isModule;\n}).call(this);\n}).call(this,require(\'_process\'))\n},{"_process":1}],3:[function(require,module,exports){\n\'use strict\';\n\n/**\n * Analogue of Object.assign().\n * Copies properties from one or more source objects to\n * a target object. Existing keys on the target object will be overwritten.\n *\n * > Note: This differs from spec in some important ways:\n * > 1. Will throw if passed non-objects, including `undefined` or `null` values.\n * > 2. Does not support the curious Exception handling behavior, exceptions are thrown immediately.\n * > For more details, see:\n * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n *\n *\n *\n * @param  {Object} target      The target object to copy properties to.\n * @param  {Object} source, ... The source(s) to copy properties from.\n * @return {Object}             The updated target object.\n */\nmodule.exports = function fastAssign (target) {\n  var totalArgs = arguments.length,\n      source, i, totalKeys, keys, key, j;\n\n  for (i = 1; i < totalArgs; i++) {\n    source = arguments[i];\n    keys = Object.keys(source);\n    totalKeys = keys.length;\n    for (j = 0; j < totalKeys; j++) {\n      key = keys[j];\n      target[key] = source[key];\n    }\n  }\n  return target;\n};\n\n},{}],4:[function(require,module,exports){\n(function (global){\n\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.inputDataType = exports.outputs = undefined;\nexports.default = parse;\n\nvar _compositeDetect = require(\'composite-detect\');\n\nvar _compositeDetect2 = _interopRequireDefault(_compositeDetect);\n\nvar _assign = require(\'fast.js/object/assign\');\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _rx = typeof window !== "undefined" ? window[\'Rx\'] : typeof global !== "undefined" ? global[\'Rx\'] : null;\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obj = require(\'./obj\');\n\nvar _obj2 = _interopRequireDefault(_obj);\n\nvar _parseHelpers = require(\'./parseHelpers\');\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\nvar outputs = exports.outputs = [\'geometry\']; // to be able to auto determine data type(s) fetched by parser\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author kaosat-dev\n */\n\nvar inputDataType = exports.inputDataType = \'arrayBuffer\'; // to be able to set required input data type\n\nfunction parse(data) {\n  var parameters = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n  var defaults = {\n    useWorker: _compositeDetect2.default.isBrowser === true,\n    offsets: [0]\n  };\n  parameters = (0, _assign2.default)({}, defaults, parameters);\n\n  var _parameters = parameters;\n  var useWorker = _parameters.useWorker;\n  var offsets = _parameters.offsets;\n\n  var obs = new _rx2.default.ReplaySubject(1);\n\n  if (useWorker) {\n    (function () {\n      var worker = new Worker(window.URL.createObjectURL(new Blob([\'(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);throw new Error("Cannot find module \\\'"+o+"\\\'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\\n"use strict";\\n\\nObject.defineProperty(exports, "__esModule", {\\n\\tvalue: true\\n});\\nvar OBJ = function OBJ() {};\\n\\nOBJ.prototype = {\\n\\tconstructor: OBJ\\n};\\n\\nOBJ.prototype.parseIndex = function (index, type) {\\n\\n\\tindex = parseInt(index);\\n\\tvar dataArray = this.currentObject._attributes[type];\\n\\n\\treturn index >= 0 ? index - 1 : index + dataArray.length;\\n};\\n\\nOBJ.prototype._handle_face_line = function (rawData, rIndices, indices, type) {\\n\\tvar data = [];\\n\\n\\tvar tmpIdx = [];\\n\\tfor (var i = 0; i < rIndices.length; i++) {\\n\\t\\tvar idx = rIndices[i];\\n\\t\\t//console.log(data[ idx ]);\\n\\t\\t//data.push( parseInt( rawData[ idx] ) );\\n\\t\\tdata.push(this.parseIndex(rawData[idx], type));\\n\\t}\\n\\n\\tif (isNaN(data[3])) {\\n\\t\\tindices.push(data[0], data[1], data[2]);\\n\\t\\t//indices.push( this.parseIndex( data[ 0 ], type) , this.parseIndex( data[ 1 ], type) , this.parseIndex( data[ 2 ], type) );\\n\\t} else {\\n\\t\\t\\tindices.push(data[0], data[1], data[3], data[1], data[2], data[3]);\\n\\t\\t}\\n};\\n\\nOBJ.prototype._newObject = function () {\\n\\tvar currentObject = {};\\n\\tcurrentObject._attributes = {};\\n\\tcurrentObject._attributes["position"] = [];\\n\\tcurrentObject._attributes["normal"] = [];\\n\\tcurrentObject._attributes["uv"] = [];\\n\\tcurrentObject._attributes["indices"] = [];\\n\\tcurrentObject.faceCount = 0;\\n\\treturn currentObject;\\n};\\n\\nOBJ.prototype.getData = function (text) {\\n\\tvar vertex_pattern = /v( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)/;\\n\\t// vn float float float\\n\\tvar normal_pattern = /vn( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)/;\\n\\t// vt float float\\n\\tvar uv_pattern = /vt( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)( +[\\\\d|\\\\.|\\\\+|\\\\-|e]+)/;\\n\\t// f vertex vertex vertex ...\\n\\tvar face_pattern1 = /f( +\\\\d+)( +\\\\d+)( +\\\\d+)( +\\\\d+)?/;\\n\\t// f vertex/uv vertex/uv vertex/uv ...\\n\\tvar face_pattern2 = /f( +(\\\\d+)\\\\/(\\\\d+))( +(\\\\d+)\\\\/(\\\\d+))( +(\\\\d+)\\\\/(\\\\d+))( +(\\\\d+)\\\\/(\\\\d+))?/;\\n\\t// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...\\n\\tvar face_pattern3 = /f( +(\\\\d+)\\\\/(\\\\d+)\\\\/(\\\\d+))( +(\\\\d+)\\\\/(\\\\d+)\\\\/(\\\\d+))( +(\\\\d+)\\\\/(\\\\d+)\\\\/(\\\\d+))( +(\\\\d+)\\\\/(\\\\d+)\\\\/(\\\\d+))?/;\\n\\t// f vertex//normal vertex//normal vertex//normal ...\\n\\tvar face_pattern4 = /f( +(\\\\d+)\\\\/\\\\/(\\\\d+))( +(\\\\d+)\\\\/\\\\/(\\\\d+))( +(\\\\d+)\\\\/\\\\/(\\\\d+))( +(\\\\d+)\\\\/\\\\/(\\\\d+))?/;\\n\\n\\ttext = text.replace(/\\\\\\\\\\\\r\\\\n/g, \\\'\\\'); // handles line continuations\\n\\tvar lines = text.split(\\\'\\\\n\\\');\\n\\n\\tvar vertices = [];\\n\\tvar normals = [];\\n\\tvar uvs = [];\\n\\tvar indices = [];\\n\\tvar normIndices = [];\\n\\tvar uvIndices = [];\\n\\n\\tvar faceCount = 0;\\n\\tvar face_offset = 0;\\n\\n\\tvar defaultNormal = [1, 1, 1];\\n\\tvar defaultUv = [0, 0];\\n\\n\\tvar objects = [];\\n\\tvar textures = {};\\n\\tvar materials = {};\\n\\n\\tvar currentObject = this._newObject();\\n\\tthis.currentObject = currentObject;\\n\\tvar currentMaterial = {};\\n\\n\\tvertices = currentObject._attributes["position"];\\n\\tnormals = currentObject._attributes["normal"];\\n\\tuvs = currentObject._attributes["uv"];\\n\\tindices = currentObject._attributes["indices"];\\n\\n\\tfor (var i = 0; i < lines.length; i++) {\\n\\t\\tvar line = lines[i];\\n\\t\\tline = line.trim().toLowerCase(); //needed because of some "exponent" values in upper case\\n\\t\\tvar result;\\n\\n\\t\\t//console.log(line);\\n\\n\\t\\tif (line.length === 0 || line.charAt(0) === \\\'#\\\') {\\n\\t\\t\\tcontinue;\\n\\t\\t} else if ((result = vertex_pattern.exec(line)) !== null) {\\n\\t\\t\\t// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]\\n\\t\\t\\tvertices.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));\\n\\t\\t} else if ((result = normal_pattern.exec(line)) !== null) {\\n\\t\\t\\t// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]\\n\\t\\t\\tnormals.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));\\n\\t\\t} else if ((result = uv_pattern.exec(line)) !== null) {\\n\\t\\t\\t// ["vt 0.1 0.2", "0.1", "0.2"]\\n\\t\\t\\tuvs.push(parseFloat(result[1]), parseFloat(result[2]));\\n\\t\\t} else if ((result = face_pattern1.exec(line)) !== null) {\\n\\t\\t\\t// ["f 1 2 3", "1", "2", "3", undefined]\\n\\t\\t\\t//console.log("result v1");\\n\\t\\t\\tthis._handle_face_line(result, [1, 2, 3, 4], indices, "position");\\n\\t\\t\\t//faces, uvs, normals_inds, geometry,face_offset, normals, uvs\\n\\t\\t} else if ((result = face_pattern2.exec(line)) !== null) {\\n\\t\\t\\t\\t// ["f 1/1 2/2 3/3", " 1/1", "1", "1", " 2/2", "2", "2", " 3/3", "3", "3", undefined, undefined, undefined]\\n\\t\\t\\t\\t//console.log("result v2");\\n\\t\\t\\t\\tthis._handle_face_line(result, [2, 5, 8, 11], indices, "position"); //2,5,8,11//possible winding order change of for some stuff11,8,5,2\\n\\t\\t\\t\\tthis._handle_face_line(result, [3, 6, 9, 12], uvIndices, "uv");\\n\\t\\t\\t} else if ((result = face_pattern3.exec(line)) !== null) {\\n\\t\\t\\t\\t// ["f 1/1/1 2/2/2 3/3/3", " 1/1/1", "1", "1", "1", " 2/2/2", "2", "2", "2", " 3/3/3", "3", "3", "3", undefined, undefined, undefined, undefined]\\n\\t\\t\\t\\t//console.log("result v3");\\n\\t\\t\\t\\t//result[ 2 ], result[ 6 ], result[ 10 ], result[ 14 ]\\n\\t\\t\\t\\tthis._handle_face_line(result, [2, 6, 10, 14], indices, "position"); //2,6,10,14\\n\\t\\t\\t\\tthis._handle_face_line(result, [4, 8, 12, 16], normIndices, "normal");\\n\\t\\t\\t\\tthis._handle_face_line(result, [3, 7, 11, 15], uvIndices, "uv");\\n\\t\\t\\t} else if ((result = face_pattern4.exec(line)) !== null) {\\n\\t\\t\\t\\t//console.log("result v4");\\n\\t\\t\\t\\t// ["f 1//1 2//2 3//3", " 1//1", "1", "1", " 2//2", "2", "2", " 3//3", "3", "3", undefined, undefined, undefined]\\n\\t\\t\\t\\tthis._handle_face_line(result, [2, 5, 8, 11], indices, "position");\\n\\t\\t\\t\\tthis._handle_face_line(result, [3, 6, 9, 12], normIndices, "normal");\\n\\t\\t\\t} else if (/^o /.test(line)) {\\n\\t\\t\\t\\t// object\\n\\t\\t\\t\\t//console.log("object")\\n\\t\\t\\t\\tif (currentObject) {\\n\\t\\t\\t\\t\\t//if (!(geometry === undefined)) {\\n\\t\\t\\t\\t\\tface_offset = face_offset + vertices.length;\\n\\n\\t\\t\\t\\t\\t//console.log("oldobject")\\n\\t\\t\\t\\t\\t//console.log( currentObject)\\n\\t\\t\\t\\t\\tcurrentObject.faceCount = indices.length;\\n\\n\\t\\t\\t\\t\\t//reset all for next object\\n\\t\\t\\t\\t\\tcurrentObject = this._newObject();\\n\\t\\t\\t\\t\\tcurrentObject.name = line.substring(2).trim();\\n\\t\\t\\t\\t\\tvertices = currentObject._attributes["position"];\\n\\t\\t\\t\\t\\tnormals = currentObject._attributes["normal"];\\n\\t\\t\\t\\t\\tuvs = currentObject._attributes["uv"];\\n\\t\\t\\t\\t\\tindices = currentObject._attributes["indices"];\\n\\t\\t\\t\\t\\tnormIndices = currentObject._attributes["normIndices"];\\n\\t\\t\\t\\t\\tuvIndices = currentObject._attributes["uvIndices"];\\n\\n\\t\\t\\t\\t\\tobjects.push(currentObject);\\n\\t\\t\\t\\t}\\n\\t\\t\\t} else if (/^g /.test(line)) {\\n\\t\\t\\t\\t// group\\n\\t\\t\\t\\t//console.log("group");\\n\\t\\t\\t} else if (/^usemtl /.test(line)) {\\n\\t\\t\\t\\t\\t// material\\n\\t\\t\\t\\t\\tcurrentMaterial.name = line.substring(7).trim();\\n\\t\\t\\t\\t} else if (/^mtllib /.test(line)) {\\n\\t\\t\\t\\t\\t// mtl file\\n\\t\\t\\t\\t\\tcurrentMaterial = {};\\n\\t\\t\\t\\t} else if (/^s /.test(line)) {\\n\\t\\t\\t\\t\\t// smooth shading\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\t\\t// console.log( "OBJParser: Unhandled line " + line );\\n\\t\\t\\t\\t\\t}\\n\\t}\\n\\n\\tif (objects.indexOf(currentObject) == -1) {\\n\\t\\tobjects.push(currentObject);\\n\\t}\\n\\tcurrentObject.faceCount = indices.length / 3;\\n\\n\\treturn {\\n\\t\\tobjects: objects\\n\\t};\\n};\\n\\n/*\\n  extracts data based on indices since obj has different indices for normals, uvs etc, while webgl does not\\n*/\\nOBJ.prototype._unindexData = function (object) {\\n\\tvar resultPositions = [];\\n\\tvar resultNormals = [];\\n\\tvar resultUv = [];\\n\\n\\tvar vertices = object._attributes["position"];\\n\\tvar normals = object._attributes["normal"];\\n\\tvar uvs = object._attributes["uv"];\\n\\n\\tfor (var i = 0; i < object.indices.length; i++) {\\n\\t\\t//resultPositions.push( data. );\\n\\t}\\n};\\nexports.default = OBJ;\\n\\n},{}],2:[function(require,module,exports){\\n\\\'use strict\\\';\\n\\nvar _obj = require(\\\'./obj\\\');\\n\\nvar _obj2 = _interopRequireDefault(_obj);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\nself.onmessage = function (event) {\\n\\n  var data = event.data;\\n  data = data.data;\\n\\n  var result = new _obj2.default().getData(data);\\n\\n  self.postMessage({ data: result });\\n  self.close();\\n};\\n\\n},{"./obj":1}]},{},[2])\'], { type: "text/javascript" }))); // browserify\n\n      worker.onmessage = function (event) {\n        if (\'data\' in event.data) {\n          var data = event.data.data;\n          data.objects.forEach(function (modelData, index) {\n            obs.onNext({ progress: (index + 1) / Object.keys(data.objects).length, total: undefined });\n            obs.onNext((0, _parseHelpers.createModelBuffers)(modelData));\n          });\n          obs.onNext({ progress: 1, total: undefined });\n          obs.onCompleted();\n        } else if (\'progress\' in event.data) {\n          // console.log("got progress", event.data.progress)\n          obs.onNext({ progress: event.data.progress, total: Math.NaN });\n        }\n      };\n      worker.onerror = function (event) {\n        obs.onError(\'filename:\' + event.filename + \' lineno: \' + event.lineno + \' error: \' + event.message);\n      };\n      worker.postMessage({ data: data });\n      obs.catch(function (e) {\n        return worker.terminate();\n      });\n    })();\n  } else {\n    data = new _obj2.default().getData(data);\n\n    data.objects.forEach(function (modelData, index) {\n      obs.onNext({ progress: (index + 1) / Object.keys(data.objects).length, total: undefined });\n      obs.onNext((0, _parseHelpers.createModelBuffers)(modelData));\n\n      if (index >= data.objects.length) {\n        // FIXME: not too sure about this implementation\n        obs.onNext({ progress: 1, total: undefined });\n        obs.onCompleted();\n      }\n    });\n  }\n  return obs;\n}\n\n}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})\n},{"./obj":5,"./parseHelpers":6,"composite-detect":2,"fast.js/object/assign":3}],5:[function(require,module,exports){\n"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n	value: true\n});\nvar OBJ = function OBJ() {};\n\nOBJ.prototype = {\n	constructor: OBJ\n};\n\nOBJ.prototype.parseIndex = function (index, type) {\n\n	index = parseInt(index);\n	var dataArray = this.currentObject._attributes[type];\n\n	return index >= 0 ? index - 1 : index + dataArray.length;\n};\n\nOBJ.prototype._handle_face_line = function (rawData, rIndices, indices, type) {\n	var data = [];\n\n	var tmpIdx = [];\n	for (var i = 0; i < rIndices.length; i++) {\n		var idx = rIndices[i];\n		//console.log(data[ idx ]);\n		//data.push( parseInt( rawData[ idx] ) );\n		data.push(this.parseIndex(rawData[idx], type));\n	}\n\n	if (isNaN(data[3])) {\n		indices.push(data[0], data[1], data[2]);\n		//indices.push( this.parseIndex( data[ 0 ], type) , this.parseIndex( data[ 1 ], type) , this.parseIndex( data[ 2 ], type) );\n	} else {\n			indices.push(data[0], data[1], data[3], data[1], data[2], data[3]);\n		}\n};\n\nOBJ.prototype._newObject = function () {\n	var currentObject = {};\n	currentObject._attributes = {};\n	currentObject._attributes["position"] = [];\n	currentObject._attributes["normal"] = [];\n	currentObject._attributes["uv"] = [];\n	currentObject._attributes["indices"] = [];\n	currentObject.faceCount = 0;\n	return currentObject;\n};\n\nOBJ.prototype.getData = function (text) {\n	var vertex_pattern = /v( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)/;\n	// vn float float float\n	var normal_pattern = /vn( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)/;\n	// vt float float\n	var uv_pattern = /vt( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)/;\n	// f vertex vertex vertex ...\n	var face_pattern1 = /f( +\\d+)( +\\d+)( +\\d+)( +\\d+)?/;\n	// f vertex/uv vertex/uv vertex/uv ...\n	var face_pattern2 = /f( +(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+))?/;\n	// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...\n	var face_pattern3 = /f( +(\\d+)\\/(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+)\\/(\\d+))?/;\n	// f vertex//normal vertex//normal vertex//normal ...\n	var face_pattern4 = /f( +(\\d+)\\/\\/(\\d+))( +(\\d+)\\/\\/(\\d+))( +(\\d+)\\/\\/(\\d+))( +(\\d+)\\/\\/(\\d+))?/;\n\n	text = text.replace(/\\\\\\r\\n/g, \'\'); // handles line continuations\n	var lines = text.split(\'\\n\');\n\n	var vertices = [];\n	var normals = [];\n	var uvs = [];\n	var indices = [];\n	var normIndices = [];\n	var uvIndices = [];\n\n	var faceCount = 0;\n	var face_offset = 0;\n\n	var defaultNormal = [1, 1, 1];\n	var defaultUv = [0, 0];\n\n	var objects = [];\n	var textures = {};\n	var materials = {};\n\n	var currentObject = this._newObject();\n	this.currentObject = currentObject;\n	var currentMaterial = {};\n\n	vertices = currentObject._attributes["position"];\n	normals = currentObject._attributes["normal"];\n	uvs = currentObject._attributes["uv"];\n	indices = currentObject._attributes["indices"];\n\n	for (var i = 0; i < lines.length; i++) {\n		var line = lines[i];\n		line = line.trim().toLowerCase(); //needed because of some "exponent" values in upper case\n		var result;\n\n		//console.log(line);\n\n		if (line.length === 0 || line.charAt(0) === \'#\') {\n			continue;\n		} else if ((result = vertex_pattern.exec(line)) !== null) {\n			// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]\n			vertices.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));\n		} else if ((result = normal_pattern.exec(line)) !== null) {\n			// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]\n			normals.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));\n		} else if ((result = uv_pattern.exec(line)) !== null) {\n			// ["vt 0.1 0.2", "0.1", "0.2"]\n			uvs.push(parseFloat(result[1]), parseFloat(result[2]));\n		} else if ((result = face_pattern1.exec(line)) !== null) {\n			// ["f 1 2 3", "1", "2", "3", undefined]\n			//console.log("result v1");\n			this._handle_face_line(result, [1, 2, 3, 4], indices, "position");\n			//faces, uvs, normals_inds, geometry,face_offset, normals, uvs\n		} else if ((result = face_pattern2.exec(line)) !== null) {\n				// ["f 1/1 2/2 3/3", " 1/1", "1", "1", " 2/2", "2", "2", " 3/3", "3", "3", undefined, undefined, undefined]\n				//console.log("result v2");\n				this._handle_face_line(result, [2, 5, 8, 11], indices, "position"); //2,5,8,11//possible winding order change of for some stuff11,8,5,2\n				this._handle_face_line(result, [3, 6, 9, 12], uvIndices, "uv");\n			} else if ((result = face_pattern3.exec(line)) !== null) {\n				// ["f 1/1/1 2/2/2 3/3/3", " 1/1/1", "1", "1", "1", " 2/2/2", "2", "2", "2", " 3/3/3", "3", "3", "3", undefined, undefined, undefined, undefined]\n				//console.log("result v3");\n				//result[ 2 ], result[ 6 ], result[ 10 ], result[ 14 ]\n				this._handle_face_line(result, [2, 6, 10, 14], indices, "position"); //2,6,10,14\n				this._handle_face_line(result, [4, 8, 12, 16], normIndices, "normal");\n				this._handle_face_line(result, [3, 7, 11, 15], uvIndices, "uv");\n			} else if ((result = face_pattern4.exec(line)) !== null) {\n				//console.log("result v4");\n				// ["f 1//1 2//2 3//3", " 1//1", "1", "1", " 2//2", "2", "2", " 3//3", "3", "3", undefined, undefined, undefined]\n				this._handle_face_line(result, [2, 5, 8, 11], indices, "position");\n				this._handle_face_line(result, [3, 6, 9, 12], normIndices, "normal");\n			} else if (/^o /.test(line)) {\n				// object\n				//console.log("object")\n				if (currentObject) {\n					//if (!(geometry === undefined)) {\n					face_offset = face_offset + vertices.length;\n\n					//console.log("oldobject")\n					//console.log( currentObject)\n					currentObject.faceCount = indices.length;\n\n					//reset all for next object\n					currentObject = this._newObject();\n					currentObject.name = line.substring(2).trim();\n					vertices = currentObject._attributes["position"];\n					normals = currentObject._attributes["normal"];\n					uvs = currentObject._attributes["uv"];\n					indices = currentObject._attributes["indices"];\n					normIndices = currentObject._attributes["normIndices"];\n					uvIndices = currentObject._attributes["uvIndices"];\n\n					objects.push(currentObject);\n				}\n			} else if (/^g /.test(line)) {\n				// group\n				//console.log("group");\n			} else if (/^usemtl /.test(line)) {\n					// material\n					currentMaterial.name = line.substring(7).trim();\n				} else if (/^mtllib /.test(line)) {\n					// mtl file\n					currentMaterial = {};\n				} else if (/^s /.test(line)) {\n					// smooth shading\n				} else {\n						// console.log( "OBJParser: Unhandled line " + line );\n					}\n	}\n\n	if (objects.indexOf(currentObject) == -1) {\n		objects.push(currentObject);\n	}\n	currentObject.faceCount = indices.length / 3;\n\n	return {\n		objects: objects\n	};\n};\n\n/*\n  extracts data based on indices since obj has different indices for normals, uvs etc, while webgl does not\n*/\nOBJ.prototype._unindexData = function (object) {\n	var resultPositions = [];\n	var resultNormals = [];\n	var resultUv = [];\n\n	var vertices = object._attributes["position"];\n	var normals = object._attributes["normal"];\n	var uvs = object._attributes["uv"];\n\n	for (var i = 0; i < object.indices.length; i++) {\n		//resultPositions.push( data. );\n	}\n};\nexports.default = OBJ;\n\n},{}],6:[function(require,module,exports){\n"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.createModelBuffers = createModelBuffers;\n//TODO: potential candidate for re-use across parsers with a few changes\nfunction createModelBuffers(modelData) {\n  //console.log("creating model buffers",modelData, modelData._attributes)\n\n  var faces = modelData.faceCount;\n  var colorSize = 3;\n\n  var positions = new Float32Array(faces * 3 * 3);\n  var normals = new Float32Array(faces * 3 * 3);\n  //let colors  = new Float32Array( faces *3 * colorSize )\n  var indices = new Uint32Array(faces * 3);\n\n  //vertices.set( modelData.position );\n  //normals.set( modelData.normal );\n  //indices.set( modelData.indices );\n\n  positions.set(modelData._attributes.position);\n  normals.set(modelData._attributes.normal);\n  indices.set(modelData._attributes.indices);\n\n  //materials = []\n  return { positions: positions, indices: indices, normals: normals };\n}\n\n/*\nOBJParser.prototype._parse = function( text )\n{\n  var object = new THREE.Object3D();\n  var geometry, material, mesh;\n  var face_offset = 0;\n\n  // create mesh if no objects in text\n  if ( /^o /gm.test( text ) === false ) {\n\n    geometry = new THREE.Geometry();\n    material = new THREE.MeshLambertMaterial();\n    mesh = new THREE.Mesh( geometry, material );\n    object.add( mesh );\n\n  }\n\n    var vertices = [];\n    var verticesCount = 0;\n    var normals = [];\n    var uvs = [];\n    // v float float float\n    var vertex_pattern = /v( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)/;\n    // vn float float float\n    var normal_pattern = /vn( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)/;\n    // vt float float\n    var uv_pattern = /vt( +[\\d|\\.|\\+|\\-|e]+)( +[\\d|\\.|\\+|\\-|e]+)/;\n    // f vertex vertex vertex ...\n    var face_pattern1 = /f( +\\d+)( +\\d+)( +\\d+)( +\\d+)?/;\n    // f vertex/uv vertex/uv vertex/uv ...\n    var face_pattern2 = /f( +(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+))?/;\n    // f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...\n    var face_pattern3 = /f( +(\\d+)\\/(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+)\\/(\\d+))( +(\\d+)\\/(\\d+)\\/(\\d+))?/;\n    // f vertex//normal vertex//normal vertex//normal ...\n    var face_pattern4 = /f( +(\\d+)\\/\\/(\\d+))( +(\\d+)\\/\\/(\\d+))( +(\\d+)\\/\\/(\\d+))( +(\\d+)\\/\\/(\\d+))?/\n\n    var lines = text.split( \'\\n\' );\n\n    for ( var i = 0; i < lines.length; i ++ ) {\n      var line = lines[ i ];\n      line = line.trim();\n      var result;\n\n      if ( line.length === 0 || line.charAt( 0 ) === \'#\' ) {\n        continue;\n      } else if ( ( result = vertex_pattern.exec( line ) ) !== null ) {\n        // ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]\n        geometry.vertices.push( vector(\n          parseFloat( result[ 1 ] ),\n          parseFloat( result[ 2 ] ),\n          parseFloat( result[ 3 ] )\n        ) );\n      } else if ( ( result = normal_pattern.exec( line ) ) !== null ) {\n        // ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]\n        normals.push( vector(\n          parseFloat( result[ 1 ] ),\n          parseFloat( result[ 2 ] ),\n          parseFloat( result[ 3 ] )\n        ) );\n      } else if ( ( result = uv_pattern.exec( line ) ) !== null ) {\n        // ["vt 0.1 0.2", "0.1", "0.2"]\n        uvs.push( uv(\n          parseFloat( result[ 1 ] ),\n          parseFloat( result[ 2 ] )\n        ) );\n      } else if ( ( result = face_pattern1.exec( line ) ) !== null ) {\n        // ["f 1 2 3", "1", "2", "3", undefined]\n        handle_face_line([ result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ] ], geometry,face_offset, normals, uvs);\n      } else if ( ( result = face_pattern2.exec( line ) ) !== null ) {\n        // ["f 1/1 2/2 3/3", " 1/1", "1", "1", " 2/2", "2", "2", " 3/3", "3", "3", undefined, undefined, undefined]\n        handle_face_line(\n          [ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces\n          [ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //uv\n          , geometry, face_offset, normals, uvs\n        );\n      } else if ( ( result = face_pattern3.exec( line ) ) !== null ) {\n        // ["f 1/1/1 2/2/2 3/3/3", " 1/1/1", "1", "1", "1", " 2/2/2", "2", "2", "2", " 3/3/3", "3", "3", "3", undefined, undefined, undefined, undefined]\n        handle_face_line(\n          [ result[ 2 ], result[ 6 ], result[ 10 ], result[ 14 ] ], //faces\n          [ result[ 3 ], result[ 7 ], result[ 11 ], result[ 15 ] ], //uv\n          [ result[ 4 ], result[ 8 ], result[ 12 ], result[ 16 ] ] //normal\n          , geometry, face_offset, normals, uvs\n        );\n      } else if ( ( result = face_pattern4.exec( line ) ) !== null ) {\n        // ["f 1//1 2//2 3//3", " 1//1", "1", "1", " 2//2", "2", "2", " 3//3", "3", "3", undefined, undefined, undefined]\n        handle_face_line(\n          [ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces\n          [ ], //uv\n          [ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //normal\n          , geometry, face_offset, normals, uvs\n        );\n\n      } else if ( /^o /.test( line ) ) {\n        // object\n        if (!(geometry === undefined)) {\n          face_offset = face_offset + geometry.vertices.length;\n        }\n\n        geometry = new THREE.Geometry();\n        material = new THREE.MeshLambertMaterial();\n\n        mesh = new THREE.Mesh( geometry, material );\n        mesh.name = line.substring( 2 ).trim();\n        object.add( mesh );\n\n        verticesCount = 0;\n\n      } else if ( /^g /.test( line ) ) {\n        // group\n      } else if ( /^usemtl /.test( line ) ) {\n        // material\n        material.name = line.substring( 7 ).trim();\n      } else if ( /^mtllib /.test( line ) ) {\n        // mtl file\n      } else if ( /^s /.test( line ) ) {\n        // smooth shading\n      } else {\n        // console.log( "OBJParser: Unhandled line " + line );\n      }\n    }\n\n    for ( var i = 0, l = object.children.length; i < l; i ++ ) {\n      var geometry = object.children[ i ].geometry;\n    }\n\n    return object;\n}\n\n\n    function vector( x, y, z ) {\n      return new THREE.Vector3( x, y, z );\n    }\n\n    function uv( u, v ) {\n      return new THREE.Vector2( u, v );\n    }\n\n    function face3( a, b, c, normals ) {\n      return new THREE.Face3( a, b, c, normals );\n    }\n\n\n    function add_face( a, b, c, normals_inds, geometry ,face_offset, normals) {\n      if ( normals_inds === undefined ) {\n        geometry.faces.push( face3(\n          parseInt( a ) - (face_offset + 1),\n          parseInt( b ) - (face_offset + 1),\n          parseInt( c ) - (face_offset + 1)\n        ) );\n      } else {\n        geometry.faces.push( face3(\n          parseInt( a ) - (face_offset + 1),\n          parseInt( b ) - (face_offset + 1),\n          parseInt( c ) - (face_offset + 1),\n          [\n            normals[ parseInt( normals_inds[ 0 ] ) - 1 ].clone(),\n            normals[ parseInt( normals_inds[ 1 ] ) - 1 ].clone(),\n            normals[ parseInt( normals_inds[ 2 ] ) - 1 ].clone()\n          ]\n        ) );\n      }\n    }\n\n    function add_uvs( a, b, c, geometry , uvs) {\n      geometry.faceVertexUvs[ 0 ].push( [\n        uvs[ parseInt( a ) - 1 ].clone(),\n        uvs[ parseInt( b ) - 1 ].clone(),\n        uvs[ parseInt( c ) - 1 ].clone()\n      ] );\n    }\n\n    function handle_face_line(faces, uvs, normals_inds, geometry,face_offset, normals, uvs) {\n      if ( faces[ 3 ] === undefined ) {\n        add_face( faces[ 0 ], faces[ 1 ], faces[ 2 ], normals_inds, geometry,face_offset, normals );\n        if (!(uvs === undefined) && uvs.length > 0) {\n          add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 2 ] , geometry , uvs);\n        }\n      } else {\n        if (!(normals_inds === undefined) && normals_inds.length > 0) {\n          add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ], [ normals_inds[ 0 ], normals_inds[ 1 ], normals_inds[ 3 ] ], geometry,face_offset, normals);\n          add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ], [ normals_inds[ 1 ], normals_inds[ 2 ], normals_inds[ 3 ] ], geometry,face_offset, normals);\n        } else {\n          add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ], geometry,face_offset, normals);\n          add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ], geometry,face_offset, normals);\n        }\n        if (!(uvs === undefined) && uvs.length > 0) {\n          add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] , geometry,face_offset, normals);\n          add_uvs( uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] , geometry,face_offset, normals);\n        }\n      }\n    }*/\n\n},{}]},{},[4])(4)\n});\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-obj-parser/lib/browser/obj-parser.js\n ** module id = 352\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-obj-parser/lib/browser/obj-parser.js?');
},function(module,exports,__webpack_require__){eval("var require;var require;/* WEBPACK VAR INJECTION */(function(global) {(function(f){if(true){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.stlParser = f()}})(function(){var define,module,exports;return (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 require(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = setTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],2:[function(require,module,exports){\n(function (process){\n(function () {\n  // Hueristics.\n  var isNode = typeof process !== 'undefined' && process.versions && !!process.versions.node;\n  var isBrowser = typeof window !== 'undefined';\n  var isModule = typeof module !== 'undefined' && !!module.exports;\n\n  // Export.\n  var detect = (isModule ? exports : (this.detect = {}));\n  detect.isNode = isNode;\n  detect.isBrowser = isBrowser;\n  detect.isModule = isModule;\n}).call(this);\n}).call(this,require('_process'))\n},{\"_process\":1}],3:[function(require,module,exports){\n'use strict';\n\n/**\n * Analogue of Object.assign().\n * Copies properties from one or more source objects to\n * a target object. Existing keys on the target object will be overwritten.\n *\n * > Note: This differs from spec in some important ways:\n * > 1. Will throw if passed non-objects, including `undefined` or `null` values.\n * > 2. Does not support the curious Exception handling behavior, exceptions are thrown immediately.\n * > For more details, see:\n * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n *\n *\n *\n * @param  {Object} target      The target object to copy properties to.\n * @param  {Object} source, ... The source(s) to copy properties from.\n * @return {Object}             The updated target object.\n */\nmodule.exports = function fastAssign (target) {\n  var totalArgs = arguments.length,\n      source, i, totalKeys, keys, key, j;\n\n  for (i = 1; i < totalArgs; i++) {\n    source = arguments[i];\n    keys = Object.keys(source);\n    totalKeys = keys.length;\n    for (j = 0; j < totalKeys; j++) {\n      key = keys[j];\n      target[key] = source[key];\n    }\n  }\n  return target;\n};\n\n},{}],4:[function(require,module,exports){\n(function (global){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.outputs = undefined;\nexports.default = parse;\n\nvar _compositeDetect = require('composite-detect');\n\nvar _compositeDetect2 = _interopRequireDefault(_compositeDetect);\n\nvar _assign = require('fast.js/object/assign');\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _rx = typeof window !== \"undefined\" ? window['Rx'] : typeof global !== \"undefined\" ? global['Rx'] : null;\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _parseHelpers = require('./parseHelpers');\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\n/**\n * @author aleeper / http://adamleeper.com/\n * @author mrdoob / http://mrdoob.com/\n * @author gero3 / https://github.com/gero3\n * @author kaosat-dev / https://github.com/kaosat-dev\n *\n * Description: A THREE parser for STL ASCII files & BINARY, as created by Solidworks and other CAD programs.\n *\n * Supports both binary and ASCII encoded files, with automatic detection of type.\n *\n * Limitations:\n *  Binary decoding ignores header. There doesn't seem to be much of a use for it.\n *  There is perhaps some question as to how valid it is to always assume little-endian-ness.\n *  ASCII decoding assumes file is UTF-8. Seems to work for the examples...\n *\n * Usage:\n *  var parser = new STLParser()\n *  var loader = new THREE.XHRLoader( parser )\n *  loader.addEventListener( 'load', function ( event ) {\n *\n *    var geometry = event.content\n *    scene.add( new THREE.Mesh( geometry ) )\n *\n *  } )\n *  loader.load( './models/stl/slotted_disk.stl' )\n */\n\n// var detectEnv = require(\"composite-detect\")\nvar outputs = exports.outputs = ['geometry']; // to be able to auto determine data type(s) fetched by parser\n\nfunction parse(data) {\n  var parameters = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n  var defaults = {\n    useWorker: _compositeDetect2.default.isBrowser === true\n  };\n  parameters = (0, _assign2.default)({}, defaults, parameters);\n  var _parameters = parameters;\n  var useWorker = _parameters.useWorker;\n\n  var obs = new _rx2.default.ReplaySubject(1);\n\n  if (useWorker) {\n    (function () {\n      // var Worker = require(\"./worker.js\")//Webpack worker!\n      // var worker = new Worker\n\n      // TODO: for node.js side use https://github.com/audreyt/node-webworker-threads for similar speedups\n      var worker = new Worker((window.URL || window.webkitURL || window.mozURL).createObjectURL(new Blob(['(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);throw new Error(\"Cannot find module \\'\"+o+\"\\'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\\n\\'use strict\\';\\n\\nObject.defineProperty(exports, \"__esModule\", {\\n  value: true\\n});\\nexports.parseSteps = parseSteps;\\nexports.parseBinary = parseBinary;\\nexports.parseASCII = parseASCII;\\n\\nvar _utils = require(\\'./utils\\');\\n\\nfunction parseSteps(data) {\\n  data = (0, _utils.ensureBinary)(data);\\n  var isBinary = (0, _utils.isDataBinary)(data);\\n\\n  var result = null;\\n  if (isBinary) {\\n    result = parseBinary(data);\\n  } else {\\n    result = parseASCII((0, _utils.ensureString)(data));\\n  }\\n  return result;\\n}\\n\\nfunction parseBinary(data) {\\n  var reader = new DataView(data);\\n  var faces = reader.getUint32(80, true);\\n  var dataOffset = 84;\\n  var faceLength = 12 * 4 + 2;\\n  var offset = 0;\\n\\n  var positions = new Float32Array(faces * 3 * 3);\\n  var normals = new Float32Array(faces * 3 * 3);\\n\\n  for (var face = 0; face < faces; face++) {\\n    var start = dataOffset + face * faceLength;\\n\\n    for (var i = 1; i <= 3; i++) {\\n      var vertexstart = start + i * 12;\\n\\n      positions[offset] = reader.getFloat32(vertexstart, true);\\n      positions[offset + 1] = reader.getFloat32(vertexstart + 4, true);\\n      positions[offset + 2] = reader.getFloat32(vertexstart + 8, true);\\n\\n      normals[offset] = reader.getFloat32(start, true);\\n      normals[offset + 1] = reader.getFloat32(start + 4, true);\\n      normals[offset + 2] = reader.getFloat32(start + 8, true);\\n      offset += 3;\\n    }\\n  }\\n  return { positions: positions, normals: normals };\\n}\\n\\n// ASCII stl parsing\\nfunction parseASCII(data) {\\n  var normal, patternFace, patternNormal, patternVertex, result, text;\\n  patternFace = /facet([\\\\s\\\\S]*?)endfacet/g;\\n\\n  var posArray = [];\\n  var normArray = [];\\n  // var indicesArray = []\\n  var faces = 0;\\n\\n  while ((result = patternFace.exec(data)) !== null) {\\n    var length = 0;\\n\\n    text = result[0];\\n    patternNormal = /normal[\\\\s]+([\\\\-+]?[0-9]+\\\\.?[0-9]*([eE][\\\\-+]?[0-9]+)?)+[\\\\s]+([\\\\-+]?[0-9]*\\\\.?[0-9]+([eE][\\\\-+]?[0-9]+)?)+[\\\\s]+([\\\\-+]?[0-9]*\\\\.?[0-9]+([eE][\\\\-+]?[0-9]+)?)+/g;\\n\\n    while ((result = patternNormal.exec(text)) !== null) {\\n      normArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\\n      normArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\\n      normArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\\n    }\\n\\n    patternVertex = /vertex[\\\\s]+([\\\\-+]?[0-9]+\\\\.?[0-9]*([eE][\\\\-+]?[0-9]+)?)+[\\\\s]+([\\\\-+]?[0-9]*\\\\.?[0-9]+([eE][\\\\-+]?[0-9]+)?)+[\\\\s]+([\\\\-+]?[0-9]*\\\\.?[0-9]+([eE][\\\\-+]?[0-9]+)?)+/g;\\n\\n    while ((result = patternVertex.exec(text)) !== null) {\\n      posArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\\n      length += 1;\\n    }\\n    faces += 1;\\n  }\\n\\n  var positions = new Float32Array(faces * 3 * 3);\\n  var normals = new Float32Array(faces * 3 * 3);\\n\\n  positions.set(posArray);\\n  normals.set(normArray);\\n\\n  return { positions: positions, normals: normals };\\n}\\n\\n},{\"./utils\":2}],2:[function(require,module,exports){\\n\\'use strict\\';\\n\\nObject.defineProperty(exports, \"__esModule\", {\\n  value: true\\n});\\nexports.ensureString = ensureString;\\nexports.ensureBinary = ensureBinary;\\nexports.isDataBinary = isDataBinary;\\nfunction ensureString(buf) {\\n  if (typeof buf !== \\'string\\') {\\n    var array_buffer = new Uint8Array(buf);\\n    var str = \\'\\';\\n    for (var i = 0; i < buf.byteLength; i++) {\\n      str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian\\n    }\\n    return str;\\n  } else {\\n    return buf;\\n  }\\n}\\n\\nfunction ensureBinary(buf) {\\n  if (typeof buf === \\'string\\') {\\n    var array_buffer = new Uint8Array(buf.length);\\n    for (var i = 0; i < buf.length; i++) {\\n      array_buffer[i] = buf.charCodeAt(i) & 0xff; // implicitly assumes little-endian\\n    }\\n    return array_buffer.buffer || array_buffer;\\n  } else {\\n    return buf;\\n  }\\n}\\n\\nfunction isDataBinary(data) {\\n  var expect, face_size, n_faces, reader;\\n  reader = new DataView(data);\\n  face_size = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8;\\n\\n  n_faces = reader.getUint32(80, true);\\n  expect = 80 + 32 / 8 + n_faces * face_size;\\n  return expect === reader.byteLength;\\n}\\n\\n},{}],3:[function(require,module,exports){\\n\\'use strict\\';\\n\\nvar _parseHelpers = require(\\'./parseHelpers\\');\\n\\nself.onmessage = function (event) {\\n  var result = (0, _parseHelpers.parseSteps)(event.data.data);\\n\\n  var positions = result.positions.buffer;\\n  var normals = result.normals.buffer;\\n  self.postMessage({ positions: positions, normals: normals }, [positions, normals]);\\n  self.close();\\n}; // importScripts(\\'./stl-utils.js\\')\\n\\n},{\"./parseHelpers\":1}]},{},[3])'], { type: \"text/javascript\" }))); //browserify\n      worker.onmessage = function (event) {\n        var positions = new Float32Array(event.data.positions);\n        var normals = new Float32Array(event.data.normals);\n        var geometry = { positions: positions, normals: normals };\n\n        obs.onNext({ progress: 1, total: positions.length });\n        obs.onNext(geometry);\n        obs.onCompleted();\n      };\n      worker.onerror = function (event) {\n        obs.onError('filename:' + event.filename + ' lineno: ' + event.lineno + ' error: ' + event.message);\n      };\n\n      worker.postMessage({ data: data });\n      obs.catch(function (e) {\n        return worker.terminate();\n      });\n    })();\n  } else {\n    try {\n      var result = (0, _parseHelpers.parseSteps)(data);\n      obs.onNext({ progress: 1, total: result.positions.length });\n      obs.onNext(result);\n      obs.onCompleted();\n    } catch (error) {\n      obs.onError(error);\n    }\n  }\n\n  return obs;\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./parseHelpers\":5,\"composite-detect\":2,\"fast.js/object/assign\":3}],5:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.parseSteps = parseSteps;\nexports.parseBinary = parseBinary;\nexports.parseASCII = parseASCII;\n\nvar _utils = require('./utils');\n\nfunction parseSteps(data) {\n  data = (0, _utils.ensureBinary)(data);\n  var isBinary = (0, _utils.isDataBinary)(data);\n\n  var result = null;\n  if (isBinary) {\n    result = parseBinary(data);\n  } else {\n    result = parseASCII((0, _utils.ensureString)(data));\n  }\n  return result;\n}\n\nfunction parseBinary(data) {\n  var reader = new DataView(data);\n  var faces = reader.getUint32(80, true);\n  var dataOffset = 84;\n  var faceLength = 12 * 4 + 2;\n  var offset = 0;\n\n  var positions = new Float32Array(faces * 3 * 3);\n  var normals = new Float32Array(faces * 3 * 3);\n\n  for (var face = 0; face < faces; face++) {\n    var start = dataOffset + face * faceLength;\n\n    for (var i = 1; i <= 3; i++) {\n      var vertexstart = start + i * 12;\n\n      positions[offset] = reader.getFloat32(vertexstart, true);\n      positions[offset + 1] = reader.getFloat32(vertexstart + 4, true);\n      positions[offset + 2] = reader.getFloat32(vertexstart + 8, true);\n\n      normals[offset] = reader.getFloat32(start, true);\n      normals[offset + 1] = reader.getFloat32(start + 4, true);\n      normals[offset + 2] = reader.getFloat32(start + 8, true);\n      offset += 3;\n    }\n  }\n  return { positions: positions, normals: normals };\n}\n\n// ASCII stl parsing\nfunction parseASCII(data) {\n  var normal, patternFace, patternNormal, patternVertex, result, text;\n  patternFace = /facet([\\s\\S]*?)endfacet/g;\n\n  var posArray = [];\n  var normArray = [];\n  // var indicesArray = []\n  var faces = 0;\n\n  while ((result = patternFace.exec(data)) !== null) {\n    var length = 0;\n\n    text = result[0];\n    patternNormal = /normal[\\s]+([\\-+]?[0-9]+\\.?[0-9]*([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+/g;\n\n    while ((result = patternNormal.exec(text)) !== null) {\n      normArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\n      normArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\n      normArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\n    }\n\n    patternVertex = /vertex[\\s]+([\\-+]?[0-9]+\\.?[0-9]*([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+/g;\n\n    while ((result = patternVertex.exec(text)) !== null) {\n      posArray.push(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));\n      length += 1;\n    }\n    faces += 1;\n  }\n\n  var positions = new Float32Array(faces * 3 * 3);\n  var normals = new Float32Array(faces * 3 * 3);\n\n  positions.set(posArray);\n  normals.set(normArray);\n\n  return { positions: positions, normals: normals };\n}\n\n},{\"./utils\":6}],6:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.ensureString = ensureString;\nexports.ensureBinary = ensureBinary;\nexports.isDataBinary = isDataBinary;\nfunction ensureString(buf) {\n  if (typeof buf !== 'string') {\n    var array_buffer = new Uint8Array(buf);\n    var str = '';\n    for (var i = 0; i < buf.byteLength; i++) {\n      str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian\n    }\n    return str;\n  } else {\n    return buf;\n  }\n}\n\nfunction ensureBinary(buf) {\n  if (typeof buf === 'string') {\n    var array_buffer = new Uint8Array(buf.length);\n    for (var i = 0; i < buf.length; i++) {\n      array_buffer[i] = buf.charCodeAt(i) & 0xff; // implicitly assumes little-endian\n    }\n    return array_buffer.buffer || array_buffer;\n  } else {\n    return buf;\n  }\n}\n\nfunction isDataBinary(data) {\n  var expect, face_size, n_faces, reader;\n  reader = new DataView(data);\n  face_size = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8;\n\n  n_faces = reader.getUint32(80, true);\n  expect = 80 + 32 / 8 + n_faces * face_size;\n  return expect === reader.byteLength;\n}\n\n},{}]},{},[4])(4)\n});\n/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-stl-parser/lib/browser/stl-parser.js\n ** module id = 353\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-stl-parser/lib/browser/stl-parser.js?")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(355)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/diffPatchUtils.js\n ** module id = 354\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/diffPatchUtils.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.extractChanges = extractChanges;\nexports.extractChangesBetweenArrays = extractChangesBetweenArrays;\nexports.changesFromObservableArrays = changesFromObservableArrays;\nexports.changesFromObservableArrays2 = changesFromObservableArrays2;\nexports.transformEquals = transformEquals;\nexports.colorsEqual = colorsEqual;\nexports.entityVisualComparer = entityVisualComparer;\n\nvar _utils = __webpack_require__(96);\n\nfunction compareHash(obj) {\n  if (obj.uuid) return obj.uuid;\n  // return JSON.stringify(obj)\n  // return typeof(obj)+obj.name\n}\n\nvar jsondiffpatch = __webpack_require__(18).create({ objectHash: compareHash });\n\nfunction extractChanges(prev, cur) {\n  var delta = jsondiffpatch.diff(prev, cur);\n  // console.log("delta",delta)\n  var result = { added: [], removed: [], changed: [] };\n\n  if (delta && \'_t\' in delta) {\n    (function () {\n      var removed = []; // delta["_0"][0]//delta[0][0]\n      var added = []; // delta[0][0]//delta[0][1]\n\n      Object.keys(delta).map(function (key) {\n        // console.log("AAA",key)\n        // "_t": "a",	Array delta (member names indicate array indices)\n\n        if (key[0] === \'_\') {\n          if (key !== \'_a\' && key !== \'_t\') {\n            removed.push(delta[key][0]);\n          }\n        } else {\n          added.push(delta[key][0]);\n        }\n      });\n\n      result.added = (0, _utils.toArray)(added).filter(function (i) {\n        return i !== undefined;\n      });\n      result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n        return i !== undefined;\n      });\n\n      // console.log("added",result.added)\n      // console.log("removed",result.removed)\n    })();\n  } else if (prev === undefined) {\n      // not handled right in the above case for some reason ??\n      result.added = cur;\n    }\n\n  return result;\n}\n\nvar instance = __webpack_require__(18).create({\n  objectHash: function objectHash(obj, index) {\n    if (typeof obj._id !== \'undefined\') {\n      return obj._id;\n    }\n    if (typeof obj.id !== \'undefined\') {\n      return obj.id;\n    }\n    if (typeof obj.name !== \'undefined\') {\n      return obj.name;\n    }\n    return \'$$index:\' + index;\n  }\n});\n// to ignore functions\ninstance.processor.pipes.diff.before(\'trivial\', function ignoreFunctionDiffFilter(context) {\n  if (typeof context.left === \'function\' || typeof context.right === \'function\') {\n    context.setResult(undefined);\n    context.exit();\n  }\n});\n\nfunction extractChangesBetweenArrays(prev, cur) {\n  var delta = instance.diff(prev, cur);\n  // console.log("delta",delta)\n  // console.log("diff",delta)//JSON.stringify(delta, null, 2))\n\n  var result = { added: [], removed: [], changed: [], upserted: [] };\n\n  if (delta && \'_t\' in delta) {\n    (function () {\n      var removed = []; // delta["_0"][0]//delta[0][0]\n      var added = []; // delta[0][0]//delta[0][1]\n      var upserted = [];\n\n      if (delta[\'_t\'] === \'a\') {\n        // array diff\n        // "_t": "a",	Array delta (member names indicate array indices)\n        Object.keys(delta).map(function (key) {\n          if (key !== \'_t\') {\n            if (key.length > 0 && key.indexOf(\'_\') > -1) {\n              var realKey = parseInt(key.replace(\'_\', \'\'), 10);\n              // console.log("removed",delta, realKey)//,key,delta)\n              removed.push(prev[realKey]);\n            } else {\n              // added or changed\n              // console.log("added or changed",delta, key)\n              var _realKey = parseInt(key, 10);\n              upserted.push(cur[_realKey]);\n            }\n          }\n        });\n      }\n      result.added = (0, _utils.toArray)(added).filter(function (i) {\n        return i !== undefined;\n      });\n      result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n        return i !== undefined;\n      });\n      result.upserted = (0, _utils.toArray)(upserted).filter(function (i) {\n        return i !== undefined;\n      });\n      // console.log("added",result.added)\n      // console.log("removed",result.removed)\n    })();\n  } else if (prev === undefined) {\n      // not handled right in the above case for some reason ??\n      result.upserted = cur;\n    }\n\n  return result;\n}\n\nfunction changesFromObservableArrays(data$) {\n  return data$.scan(function (acc, cur) {\n    return { cur: cur, prev: acc.cur };\n  }, { prev: undefined, cur: undefined }).map(function (typeData) {\n    var cur = typeData.cur;\n    var prev = typeData.prev;\n\n    var changes = extractChangesBetweenArrays(prev, cur);\n    return changes;\n  }).share();\n}\n\nfunction changesFromObservableArrays2(data$) {\n  return data$.scan(function (acc, x) {\n    var cur = x;\n    var prev = acc.cur;\n\n    cur = Object.keys(cur).map(function (key) {\n      return cur[key];\n    });\n    return { cur: cur, prev: prev };\n  }, { prev: undefined, cur: undefined }).map(function (typeData) {\n    var cur = typeData.cur;\n    var prev = typeData.prev;\n    // console.log("diffing",cur,prev)\n\n    var changes = extractChanges(prev, cur);\n    return changes;\n  }).share();\n}\n\nfunction transformEquals(a, b) {\n  if (!a || !b) return true;\n  for (var j = 0; j < a.length; j++) {\n    if (a[j] !== b[j]) {\n      return false;\n    }\n  }\n  return true;\n}\n\nfunction colorsEqual(a, b) {\n  if (!a || !b) return true;\n  return a === b;\n}\n\nfunction entityVisualComparer(prev, cur) {\n  // console.log("prev",prev,"cur",cur)\n\n  if (!cur) {\n    return false;\n  }\n\n  // compare lengths - can save a lot of time\n  if (cur.length !== prev.length) {\n    return false;\n  }\n\n  var sortedCur = cur.sort();\n  var sortedPrev = prev.sort();\n  for (var i = 0; i < cur.length; i++) {\n    if (sortedCur[i].typeUid !== sortedPrev[i].typeUid) {\n      return false;\n    }\n\n    if (sortedCur[i].id !== sortedPrev[i].id) {\n      return false;\n    }\n\n    var curVal = sortedCur[i];\n    var preVal = sortedPrev[i];\n\n    /*\n      sortedCur[i].color === sortedPrev[i].color\n      )*/\n\n    var posEq = transformEquals(curVal.pos, preVal.pos);\n    var rotEq = transformEquals(curVal.rot, preVal.rot);\n    var scaEq = transformEquals(curVal.sca, preVal.sca);\n    var colEq = colorsEqual(curVal.color, preVal.color);\n    var allEqual = posEq && rotEq && scaEq && colEq;\n    if (!allEqual) return false;\n  }\n\n  return true;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/lib/diffPatchUtils.js\n ** module id = 355\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/lib/diffPatchUtils.js?')},6,5,function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(356)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/modelUtils.js\n ** module id = 358\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/modelUtils.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n  value: true\n});\nexports.makeApiStream = makeApiStream;\nexports.spreadRequests = spreadRequests;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar merge = Observable.merge;\n\n// helper function that takes an input source Observable, a mapper function\n// and additional observables to generate a stream of CRUD operations\n\nfunction makeApiStream(source$, outputMapper, design$, authData$, apiEndpoint$) {\n  var upsert$ = source$.map(function (d) {\n    return d.upserted;\n  }).withLatestFrom(design$, authData$, apiEndpoint$, function (_entries, design, authData, apiEndpoint) {\n    return {\n      _entries: _entries,\n      designId: design.id,\n      authToken: authData.token,\n      apiEndpoint: apiEndpoint\n    };\n  }).map(outputMapper.bind(null, \'put\'));\n\n  var delete$ = source$.map(function (d) {\n    return d.removed;\n  }).withLatestFrom(design$, authData$, apiEndpoint$, function (_entries, design, authData, apiEndpoint) {\n    return {\n      _entries: _entries,\n      designId: design.id,\n      authToken: authData.token,\n      apiEndpoint: apiEndpoint\n    };\n  }).map(outputMapper.bind(null, \'delete\'));\n\n  return merge(upsert$, delete$);\n}\n\n// spread out requests with TIME amount of time between each of them\nfunction spreadRequests() {\n  var time = arguments.length <= 0 || arguments[0] === undefined ? 300 : arguments[0];\n  var data$ = arguments[1];\n\n  /* return Rx.Observable.zip(\n    out$,\n    Rx.Observable.timer(0, 2000),\n    function(item, i) { console.log("data",item); return item}\n  ).tap(e=>console.log("api stream",e))*/\n  return data$.flatMap(function (items) {\n    return _rx2.default.Observable.from(items).zip(_rx2.default.Observable.interval(time), function (item, index) {\n      return item;\n    });\n  }); // .tap(e=>console.log("api stream",e))\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-ym-storage/lib/helpers.js\n ** module id = 359\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-ym-storage/lib/helpers.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.makeApiStreamGets = makeApiStreamGets;\nexports.getBom = getBom;\nexports.getParts = getParts;\nexports.getAssemblies = getAssemblies;\nexports.getAssemblyEntries = getAssemblyEntries;\nexports.makeGetStreamForAssemblies = makeGetStreamForAssemblies;\nexports.getAssemblyEntriesNoAssemblyFound = getAssemblyEntriesNoAssemblyFound;\nexports.otherHelper = otherHelper;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _obsUtils = __webpack_require__(97);\n\nvar _utils = __webpack_require__(63);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar just = Observable.just;\nfunction makeApiStreamGets(source$, outputMapper, design$, authData$, apiEndpoint$) {\n  var get$ = source$.withLatestFrom(design$, authData$, apiEndpoint$, function (sourceData, design, authData, apiEndpoint) {\n    return { sourceData: sourceData, designId: design.id, authToken: authData.token, apiEndpoint: apiEndpoint };\n  }).map(outputMapper).filter(_utils.exists);\n\n  return get$;\n}\n\n// ///////All of these create requests from input data\nfunction getBom(data) {\n  var designId = data.designId;\n  var authToken = data.authToken;\n  var apiEndpoint = data.apiEndpoint;\n\n\n  var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n  var designUri = apiEndpoint + '/designs/' + designId;\n  var bomUri = designUri + '/bom' + authTokenStr;\n\n  return {\n    url: bomUri,\n    method: 'get',\n    type: 'ymLoad',\n    typeDetail: 'bom',\n    responseType: 'json',\n    withCredentials: true\n  };\n}\n\nfunction getParts(data) {\n  var designId = data.designId;\n  var authToken = data.authToken;\n  var apiEndpoint = data.apiEndpoint;\n\n\n  var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n  var designUri = apiEndpoint + '/designs/' + designId;\n  var partUri = designUri + '/parts' + authTokenStr;\n\n  return {\n    url: partUri,\n    method: 'get',\n    type: 'ymLoad',\n    typeDetail: 'parts',\n    responseType: 'json',\n    withCredentials: true\n  };\n}\n\nfunction getAssemblies(data) {\n  // FIXME: semi hack\n  var designId = data.designId;\n  var authToken = data.authToken;\n  var apiEndpoint = data.apiEndpoint;\n\n\n  var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n  var designUri = apiEndpoint + '/designs/' + designId;\n  var assembliesUri = designUri + '/assemblies' + authTokenStr;\n\n  /*let request = Rx.DOM.ajax({// FIXME: swap out for something else\n    url: assembliesUri,\n    crossDomain: true,\n    async: true\n  })\n  return request*/\n\n  return {\n    url: assembliesUri,\n    method: 'get',\n    type: 'ymLoad',\n    typeDetail: 'assemblies',\n    responseType: 'json',\n    withCredentials: true\n  };\n}\n\nfunction getAssemblyEntries(data) {\n  var designId = data.designId;\n  var authToken = data.authToken;\n  var sourceData = data.sourceData;\n  var apiEndpoint = data.apiEndpoint;\n\n  //FIXME : UGH pre filter this\n\n  if (sourceData && sourceData.uuid) {\n\n    var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n    var designUri = apiEndpoint + '/designs/' + designId;\n    var assembliesUri = designUri + '/assemblies/' + sourceData.uuid + '/entries' + authTokenStr;\n\n    return {\n      url: assembliesUri,\n      method: 'get',\n      type: 'ymLoad',\n      typeDetail: 'assemblyEntries',\n      responseType: 'json',\n      withCredentials: true,\n      assemblyId: sourceData.uuid // FIXME : temporary, used to know WHICH assembly the further data belongs to\n    };\n  } else {\n      return undefined;\n    }\n}\n\nfunction makeGetStreamForAssemblies(source$, outputMapper, design$, authData$, apiEndpoint$) {\n  return source$.withLatestFrom(design$, authData$, apiEndpoint$, function (_, design, authData, apiEndpoint) {\n    return { designId: design.id, authToken: authData.token, apiEndpoint: apiEndpoint };\n  }).map(getAssemblies);\n}\n\nfunction getAssemblyEntriesNoAssemblyFound(getAssemblies$) {\n  return getAssemblies$.filter(function (data) {\n    return data === undefined;\n  }).map(function (_) {\n    var result = just({\n      response: []\n    });\n    result.request = { type: 'ymLoad', typeDetail: 'assemblyEntries' };\n    return result;\n  });\n}\n\nfunction otherHelper(source$) {\n  return source$.filter(function (d) {\n    return d.request;\n  }).filter(function (res$) {\n    return res$.request.type === 'ymLoad' && res$.request.typeDetail === 'assemblies';\n  }) // handle errors etc\n  .flatMap(function (data) {\n    var responseWrapper$ = data.catch(function (e) {\n      return _rx2.default.Observable.empty();\n    });\n    var request$ = just(data.request);\n    var response$ = responseWrapper$.pluck('response');\n    return (0, _obsUtils.combineLatestObj)({ response$: response$, request$: request$ }); // .materialize()//FIXME: still do not get this one\n  }).pluck('response').map(_ramda.head);\n}\n\n// TODO : experiment with reuseable boilerplate for responses\nfunction reqWithCheck(source$, valid) {\n\n  function valid(req) {\n    req.type === 'ymLoad' && req.typeDetail === 'assemblies';\n  }\n\n  return source$.filter(function (d) {\n    return d.request;\n  }).filter(function (res$) {\n    return valid(res$.request);\n    //res$ => res$.request.type === 'ymLoad' && res$.request.typeDetail === 'assemblies'\n  }) // handle errors etc\n  .flatMap(function (data) {\n    var responseWrapper$ = data.catch(function (e) {\n      return _rx2.default.Observable.empty();\n    });\n    var request$ = just(data.request);\n    var response$ = responseWrapper$.pluck('response');\n    return (0, _obsUtils.combineLatestObj)({ response$: response$, request$: request$ }); // .materialize()//FIXME: still do not get this one\n  });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-ym-storage/lib/loadHelpers.js\n ** module id = 360\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-ym-storage/lib/loadHelpers.js?");
},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.toParts = toParts;\nexports.toBom = toBom;\nexports.toAssemblies = toAssemblies;\nexports.dataFromItems = dataFromItems;\n\nvar _ramda = __webpack_require__(4);\n\nvar _httpUtils = __webpack_require__(362);\n\nvar _modelUtils = __webpack_require__(358);\n\nvar _utils = __webpack_require__(63);\n\nvar _assign = __webpack_require__(8);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// faster object.assign\n\n// helper to generate output data to parts\nfunction toParts() {\n  var method = arguments.length <= 0 || arguments[0] === undefined ? 'put' : arguments[0];\n  var data = arguments[1];\n  var designId = data.designId;\n  var authToken = data.authToken;\n  var apiEndpoint = data.apiEndpoint;\n\n  var entries = data._entries || [];\n\n  var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n  var designUri = apiEndpoint + '/designs/' + designId;\n  var partUri = designUri + '/parts';\n\n  var fieldNames = ['id', 'name', 'description', 'uuid'];\n  var mapping = {\n    'id': 'uuid',\n    'params': 'part_parameters'\n  };\n\n  /* \"binary_document_id\": null,\n  \"binary_document_url\": \"\",\n  \"source_document_id\": null,\n  \"source_document_url\": \"\",]*/\n  var requests = entries.map(function (entry) {\n    var refined = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n    var send = (0, _httpUtils.jsonToFormData)(refined);\n\n    return {\n      url: partUri + '/' + refined.uuid + authTokenStr,\n      method: method,\n      send: send,\n      type: 'ymSave',\n      typeDetail: 'parts',\n      mimeType: null, // 'application/json'\n      responseType: 'json',\n      withCredentials: true\n    };\n  });\n  return requests;\n}\n\n// helper to generate output data to bom\nfunction toBom() {\n  var method = arguments.length <= 0 || arguments[0] === undefined ? 'put' : arguments[0];\n  var data = arguments[1];\n  var designId = data.designId;\n  var authToken = data.authToken;\n  var apiEndpoint = data.apiEndpoint;\n\n  var entries = data._entries || [];\n\n  var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n  var designUri = apiEndpoint + '/designs/' + designId;\n  var bomUri = designUri + '/bom';\n\n  var fieldNames = ['qty', 'phys_qty', 'unit', 'part_uuid', 'part_parameters', 'part_version', 'printable'];\n  var mapping = {\n    'id': 'part_uuid',\n    'params': 'part_parameters',\n    'version': 'part_version'\n  };\n\n  var requests = entries.map(function (entry) {\n    var outEntry = (0, _modelUtils.mergeData)({}, entry);\n    outEntry.qty = outEntry.qty - entry._qtyOffset; // adjust quantity, removing any dynamic counts\n    var refined = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, outEntry));\n    var send = (0, _httpUtils.jsonToFormData)(refined);\n\n    return {\n      url: bomUri + '/' + refined.part_uuid + authTokenStr,\n      method: method,\n      send: send,\n      type: 'ymSave',\n      typeDetail: 'bom',\n      mimeType: null, // 'application/json'\n      responseType: 'json',\n      withCredentials: true\n    };\n  });\n  return requests;\n}\n\n// helper to generate output data to assemblies\nfunction toAssemblies() {\n  var method = arguments.length <= 0 || arguments[0] === undefined ? 'put' : arguments[0];\n  var data = arguments[1];\n  var designId = data.designId;\n  var authToken = data.authToken;\n  var apiEndpoint = data.apiEndpoint;\n\n  var entries = data._entries || [];\n\n  var authTokenStr = authToken ? '/?auth_token=' + authToken : '';\n  var designUri = apiEndpoint + '/designs/' + designId;\n\n  var fieldNames = ['uuid', 'name', 'color', 'pos', 'rot', 'sca', 'part_uuid'];\n  var mapping = { 'id': 'uuid', 'typeUid': 'part_uuid' };\n  var requests = entries.map(function (entry) {\n    var refined = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n    var send = (0, _httpUtils.jsonToFormData)(refined);\n\n    // console.log('assemblies entry', entry)\n    var assemblyId = entry.assemblyId; // head(pluck('assemblyId', entries)) // head(entries).assemblyId\n    var assembliesUri = designUri + '/assemblies/' + assemblyId + '/entries';\n\n    return {\n      url: assembliesUri + '/' + refined.uuid + authTokenStr,\n      method: method,\n      send: send,\n      type: 'ymSave',\n      typeDetail: 'assemblies',\n      withCredentials: true\n    };\n  });\n  return requests;\n}\n\nfunction dataFromItems(items) {\n  // console.log('items', items)\n  return Object.keys(items.transforms).reduce(function (list, key) {\n    var transforms = items['transforms'][key];\n    var metadata = items['metadata'][key];\n\n    if (transforms && metadata) {\n      var entry = (0, _assign2.default)({}, transforms, metadata);\n      list.push(entry);\n    }\n    return list;\n  }, []);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-ym-storage/lib/saveHelpers.js\n ** module id = 361\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-ym-storage/lib/saveHelpers.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(process) {'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.jsonToFormData = jsonToFormData;\n// detect node for conditional import for jsonToFormData\nvar isNode = typeof process !== 'undefined' && process.versions && !!process.versions.node;\nif (isNode) {\n  // TODO : deal with node.js side  for example using https://www.npmjs.com/package/form-data: fake one for now\n}\n\nfunction jsonToFormData(jsonData) {\n  jsonData = JSON.parse(JSON.stringify(jsonData));\n  var formData = void 0;\n  if (isNode) {\n    formData = { append: function append(fieldName, value) {} }; // FIXME: hack for tests/nodes.js\n  } else {\n      formData = new FormData();\n    }\n  for (var fieldName in jsonData) {\n    var value = jsonData[fieldName];\n    // value = encodeURIComponent(JSON.stringify(value))\n    // value = JSON.stringify(value)\n    // value = value.replace(/\\\"/g, '')\n    if (Object.prototype.toString.call(value) === '[object Object]') {\n      value = JSON.stringify(value);\n      // console.log(\"value\",value)\n    }\n    if (Object.prototype.toString.call(value) === '[object Array]') {\n      // value = //JSON.stringify(value)\n      // value = 'arr[]', arr[i]//value.reduce()\n      // console.log(\"value\",value)\n      value = '{ ' + value.join(',') + ' }';\n    }\n    if (typeof value === 'boolean') {\n      value = '' + value;\n    }\n\n    // console.log(\"append\",fieldName, value)\n    formData.append(fieldName, value);\n  }\n  return formData;\n}\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-ym-storage/lib/utils/httpUtils.js\n ** module id = 362\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-ym-storage/lib/utils/httpUtils.js?")},function(module,exports){eval("module.exports = XMLHttpRequest;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/xhr2/lib/browser.js\n ** module id = 363\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/xhr2/lib/browser.js?")},function(module,exports){eval("\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar empty = {};\nfunction noop() { }\nfunction copy(a) {\n    var l = a.length;\n    var b = Array(l);\n    for (var i = 0; i < l; ++i) {\n        b[i] = a[i];\n    }\n    return b;\n}\nexports.emptyIL = {\n    _n: noop,\n    _e: noop,\n    _c: noop,\n};\n// mutates the input\nfunction internalizeProducer(producer) {\n    producer._start =\n        function _start(il) {\n            il.next = il._n;\n            il.error = il._e;\n            il.complete = il._c;\n            this.start(il);\n        };\n    producer._stop = producer.stop;\n}\nfunction compose2(f1, f2) {\n    return function composedFn(arg) {\n        return f1(f2(arg));\n    };\n}\nfunction and(f1, f2) {\n    return function andFn(t) {\n        return f1(t) && f2(t);\n    };\n}\nvar MergeProducer = (function () {\n    function MergeProducer(insArr) {\n        this.insArr = insArr;\n        this.type = 'merge';\n        this.out = null;\n        this.ac = insArr.length;\n    }\n    MergeProducer.prototype._start = function (out) {\n        this.out = out;\n        var s = this.insArr;\n        var L = s.length;\n        for (var i = 0; i < L; i++) {\n            s[i]._add(this);\n        }\n    };\n    MergeProducer.prototype._stop = function () {\n        var s = this.insArr;\n        var L = s.length;\n        for (var i = 0; i < L; i++) {\n            s[i]._remove(this);\n        }\n        this.out = null;\n        this.ac = L;\n    };\n    MergeProducer.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._n(t);\n    };\n    MergeProducer.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    MergeProducer.prototype._c = function () {\n        if (--this.ac === 0) {\n            var u = this.out;\n            if (!u)\n                return;\n            u._c();\n        }\n    };\n    return MergeProducer;\n}());\nexports.MergeProducer = MergeProducer;\nvar CombineListener = (function () {\n    function CombineListener(i, out, p) {\n        this.i = i;\n        this.out = out;\n        this.p = p;\n        p.ils.push(this);\n    }\n    CombineListener.prototype._n = function (t) {\n        var p = this.p, out = this.out;\n        if (!out)\n            return;\n        if (p.up(t, this.i)) {\n            out._n(p.vals);\n        }\n    };\n    CombineListener.prototype._e = function (err) {\n        var out = this.out;\n        if (!out)\n            return;\n        out._e(err);\n    };\n    CombineListener.prototype._c = function () {\n        var p = this.p;\n        if (!p.out)\n            return;\n        if (--p.Nc === 0) {\n            p.out._c();\n        }\n    };\n    return CombineListener;\n}());\nexports.CombineListener = CombineListener;\nvar CombineProducer = (function () {\n    function CombineProducer(insArr) {\n        this.insArr = insArr;\n        this.type = 'combine';\n        this.out = null;\n        this.ils = [];\n        var n = this.Nc = this.Nn = insArr.length;\n        var vals = this.vals = new Array(n);\n        for (var i = 0; i < n; i++) {\n            vals[i] = empty;\n        }\n    }\n    CombineProducer.prototype.up = function (t, i) {\n        var v = this.vals[i];\n        var Nn = !this.Nn ? 0 : v === empty ? --this.Nn : this.Nn;\n        this.vals[i] = t;\n        return Nn === 0;\n    };\n    CombineProducer.prototype._start = function (out) {\n        this.out = out;\n        var s = this.insArr;\n        var n = s.length;\n        if (n === 0) {\n            out._n([]);\n            out._c();\n        }\n        else {\n            for (var i = 0; i < n; i++) {\n                s[i]._add(new CombineListener(i, out, this));\n            }\n        }\n    };\n    CombineProducer.prototype._stop = function () {\n        var s = this.insArr;\n        var n = this.Nc = this.Nn = s.length;\n        var vals = this.vals = new Array(n);\n        for (var i = 0; i < n; i++) {\n            s[i]._remove(this.ils[i]);\n            vals[i] = empty;\n        }\n        this.out = null;\n        this.ils = [];\n    };\n    return CombineProducer;\n}());\nexports.CombineProducer = CombineProducer;\nvar FromArrayProducer = (function () {\n    function FromArrayProducer(a) {\n        this.a = a;\n        this.type = 'fromArray';\n    }\n    FromArrayProducer.prototype._start = function (out) {\n        var a = this.a;\n        for (var i = 0, l = a.length; i < l; i++) {\n            out._n(a[i]);\n        }\n        out._c();\n    };\n    FromArrayProducer.prototype._stop = function () {\n    };\n    return FromArrayProducer;\n}());\nexports.FromArrayProducer = FromArrayProducer;\nvar FromPromiseProducer = (function () {\n    function FromPromiseProducer(p) {\n        this.p = p;\n        this.type = 'fromPromise';\n        this.on = false;\n    }\n    FromPromiseProducer.prototype._start = function (out) {\n        var prod = this;\n        this.on = true;\n        this.p.then(function (v) {\n            if (prod.on) {\n                out._n(v);\n                out._c();\n            }\n        }, function (e) {\n            out._e(e);\n        }).then(null, function (err) {\n            setTimeout(function () { throw err; });\n        });\n    };\n    FromPromiseProducer.prototype._stop = function () {\n        this.on = false;\n    };\n    return FromPromiseProducer;\n}());\nexports.FromPromiseProducer = FromPromiseProducer;\nvar PeriodicProducer = (function () {\n    function PeriodicProducer(period) {\n        this.period = period;\n        this.type = 'periodic';\n        this.intervalID = -1;\n        this.i = 0;\n    }\n    PeriodicProducer.prototype._start = function (stream) {\n        var self = this;\n        function intervalHandler() { stream._n(self.i++); }\n        this.intervalID = setInterval(intervalHandler, this.period);\n    };\n    PeriodicProducer.prototype._stop = function () {\n        if (this.intervalID !== -1)\n            clearInterval(this.intervalID);\n        this.intervalID = -1;\n        this.i = 0;\n    };\n    return PeriodicProducer;\n}());\nexports.PeriodicProducer = PeriodicProducer;\nvar DebugOperator = (function () {\n    function DebugOperator(arg, ins) {\n        this.ins = ins;\n        this.type = 'debug';\n        this.out = null;\n        this.s = null; // spy\n        this.l = null; // label\n        if (typeof arg === 'string') {\n            this.l = arg;\n        }\n        else {\n            this.s = arg;\n        }\n    }\n    DebugOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    DebugOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n    };\n    DebugOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        var s = this.s, l = this.l;\n        if (s) {\n            try {\n                s(t);\n            }\n            catch (e) {\n                u._e(e);\n            }\n        }\n        else if (l) {\n            console.log(l + ':', t);\n        }\n        else {\n            console.log(t);\n        }\n        u._n(t);\n    };\n    DebugOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    DebugOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    return DebugOperator;\n}());\nexports.DebugOperator = DebugOperator;\nvar DropOperator = (function () {\n    function DropOperator(max, ins) {\n        this.max = max;\n        this.ins = ins;\n        this.type = 'drop';\n        this.out = null;\n        this.dropped = 0;\n    }\n    DropOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    DropOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n        this.dropped = 0;\n    };\n    DropOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        if (this.dropped++ >= this.max)\n            u._n(t);\n    };\n    DropOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    DropOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    return DropOperator;\n}());\nexports.DropOperator = DropOperator;\nvar OtherIL = (function () {\n    function OtherIL(out, op) {\n        this.out = out;\n        this.op = op;\n    }\n    OtherIL.prototype._n = function (t) {\n        this.op.end();\n    };\n    OtherIL.prototype._e = function (err) {\n        this.out._e(err);\n    };\n    OtherIL.prototype._c = function () {\n        this.op.end();\n    };\n    return OtherIL;\n}());\nvar EndWhenOperator = (function () {\n    function EndWhenOperator(o, // o = other\n        ins) {\n        this.o = o;\n        this.ins = ins;\n        this.type = 'endWhen';\n        this.out = null;\n        this.oil = exports.emptyIL; // oil = other InternalListener\n    }\n    EndWhenOperator.prototype._start = function (out) {\n        this.out = out;\n        this.o._add(this.oil = new OtherIL(out, this));\n        this.ins._add(this);\n    };\n    EndWhenOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.o._remove(this.oil);\n        this.out = null;\n        this.oil = null;\n    };\n    EndWhenOperator.prototype.end = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    EndWhenOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._n(t);\n    };\n    EndWhenOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    EndWhenOperator.prototype._c = function () {\n        this.end();\n    };\n    return EndWhenOperator;\n}());\nexports.EndWhenOperator = EndWhenOperator;\nvar FilterOperator = (function () {\n    function FilterOperator(passes, ins) {\n        this.passes = passes;\n        this.ins = ins;\n        this.type = 'filter';\n        this.out = null;\n    }\n    FilterOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    FilterOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n    };\n    FilterOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        try {\n            if (this.passes(t))\n                u._n(t);\n        }\n        catch (e) {\n            u._e(e);\n        }\n    };\n    FilterOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    FilterOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    return FilterOperator;\n}());\nexports.FilterOperator = FilterOperator;\nvar FlattenListener = (function () {\n    function FlattenListener(out, op) {\n        this.out = out;\n        this.op = op;\n    }\n    FlattenListener.prototype._n = function (t) {\n        this.out._n(t);\n    };\n    FlattenListener.prototype._e = function (err) {\n        this.out._e(err);\n    };\n    FlattenListener.prototype._c = function () {\n        this.op.inner = null;\n        this.op.less();\n    };\n    return FlattenListener;\n}());\nvar FlattenOperator = (function () {\n    function FlattenOperator(ins) {\n        this.ins = ins;\n        this.type = 'flatten';\n        this.inner = null; // Current inner Stream\n        this.il = null; // Current inner InternalListener\n        this.open = true;\n        this.out = null;\n    }\n    FlattenOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    FlattenOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.inner = null;\n        this.il = null;\n        this.open = true;\n        this.out = null;\n    };\n    FlattenOperator.prototype.less = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        if (!this.open && !this.inner)\n            u._c();\n    };\n    FlattenOperator.prototype._n = function (s) {\n        var u = this.out;\n        if (!u)\n            return;\n        var _a = this, inner = _a.inner, il = _a.il;\n        if (inner && il)\n            inner._remove(il);\n        (this.inner = s)._add(this.il = new FlattenListener(u, this));\n    };\n    FlattenOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    FlattenOperator.prototype._c = function () {\n        this.open = false;\n        this.less();\n    };\n    return FlattenOperator;\n}());\nexports.FlattenOperator = FlattenOperator;\nvar FoldOperator = (function () {\n    function FoldOperator(f, seed, ins) {\n        this.f = f;\n        this.seed = seed;\n        this.ins = ins;\n        this.type = 'fold';\n        this.out = null;\n        this.acc = seed;\n    }\n    FoldOperator.prototype._start = function (out) {\n        this.out = out;\n        out._n(this.acc);\n        this.ins._add(this);\n    };\n    FoldOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n        this.acc = this.seed;\n    };\n    FoldOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        try {\n            u._n(this.acc = this.f(this.acc, t));\n        }\n        catch (e) {\n            u._e(e);\n        }\n    };\n    FoldOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    FoldOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    return FoldOperator;\n}());\nexports.FoldOperator = FoldOperator;\nvar LastOperator = (function () {\n    function LastOperator(ins) {\n        this.ins = ins;\n        this.type = 'last';\n        this.out = null;\n        this.has = false;\n        this.val = empty;\n    }\n    LastOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    LastOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n        this.has = false;\n        this.val = empty;\n    };\n    LastOperator.prototype._n = function (t) {\n        this.has = true;\n        this.val = t;\n    };\n    LastOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    LastOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        if (this.has) {\n            u._n(this.val);\n            u._c();\n        }\n        else {\n            u._e('TODO show proper error');\n        }\n    };\n    return LastOperator;\n}());\nexports.LastOperator = LastOperator;\nvar MapFlattenInner = (function () {\n    function MapFlattenInner(out, op) {\n        this.out = out;\n        this.op = op;\n    }\n    MapFlattenInner.prototype._n = function (r) {\n        this.out._n(r);\n    };\n    MapFlattenInner.prototype._e = function (err) {\n        this.out._e(err);\n    };\n    MapFlattenInner.prototype._c = function () {\n        this.op.inner = null;\n        this.op.less();\n    };\n    return MapFlattenInner;\n}());\nvar MapFlattenOperator = (function () {\n    function MapFlattenOperator(mapOp) {\n        this.mapOp = mapOp;\n        this.inner = null; // Current inner Stream\n        this.il = null; // Current inner InternalListener\n        this.open = true;\n        this.out = null;\n        this.type = mapOp.type + \"+flatten\";\n        this.ins = mapOp.ins;\n    }\n    MapFlattenOperator.prototype._start = function (out) {\n        this.out = out;\n        this.mapOp.ins._add(this);\n    };\n    MapFlattenOperator.prototype._stop = function () {\n        this.mapOp.ins._remove(this);\n        this.inner = null;\n        this.il = null;\n        this.open = true;\n        this.out = null;\n    };\n    MapFlattenOperator.prototype.less = function () {\n        if (!this.open && !this.inner) {\n            var u = this.out;\n            if (!u)\n                return;\n            u._c();\n        }\n    };\n    MapFlattenOperator.prototype._n = function (v) {\n        var u = this.out;\n        if (!u)\n            return;\n        var _a = this, inner = _a.inner, il = _a.il;\n        if (inner && il)\n            inner._remove(il);\n        try {\n            (this.inner = this.mapOp.project(v))._add(this.il = new MapFlattenInner(u, this));\n        }\n        catch (e) {\n            u._e(e);\n        }\n    };\n    MapFlattenOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    MapFlattenOperator.prototype._c = function () {\n        this.open = false;\n        this.less();\n    };\n    return MapFlattenOperator;\n}());\nexports.MapFlattenOperator = MapFlattenOperator;\nvar MapOperator = (function () {\n    function MapOperator(project, ins) {\n        this.project = project;\n        this.ins = ins;\n        this.type = 'map';\n        this.out = null;\n    }\n    MapOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    MapOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n    };\n    MapOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        try {\n            u._n(this.project(t));\n        }\n        catch (e) {\n            u._e(e);\n        }\n    };\n    MapOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    MapOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    return MapOperator;\n}());\nexports.MapOperator = MapOperator;\nvar FilterMapOperator = (function (_super) {\n    __extends(FilterMapOperator, _super);\n    function FilterMapOperator(passes, project, ins) {\n        _super.call(this, project, ins);\n        this.passes = passes;\n        this.type = 'filter+map';\n    }\n    FilterMapOperator.prototype._n = function (v) {\n        if (this.passes(v)) {\n            _super.prototype._n.call(this, v);\n        }\n        ;\n    };\n    return FilterMapOperator;\n}(MapOperator));\nexports.FilterMapOperator = FilterMapOperator;\nvar ReplaceErrorOperator = (function () {\n    function ReplaceErrorOperator(fn, ins) {\n        this.fn = fn;\n        this.ins = ins;\n        this.type = 'replaceError';\n        this.out = empty;\n    }\n    ReplaceErrorOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    ReplaceErrorOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n    };\n    ReplaceErrorOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._n(t);\n    };\n    ReplaceErrorOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        try {\n            this.ins._remove(this);\n            (this.ins = this.fn(err))._add(this);\n        }\n        catch (e) {\n            u._e(e);\n        }\n    };\n    ReplaceErrorOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    return ReplaceErrorOperator;\n}());\nexports.ReplaceErrorOperator = ReplaceErrorOperator;\nvar StartWithOperator = (function () {\n    function StartWithOperator(ins, value) {\n        this.ins = ins;\n        this.value = value;\n        this.type = 'startWith';\n        this.out = exports.emptyIL;\n    }\n    StartWithOperator.prototype._start = function (out) {\n        this.out = out;\n        this.out._n(this.value);\n        this.ins._add(out);\n    };\n    StartWithOperator.prototype._stop = function () {\n        this.ins._remove(this.out);\n        this.out = null;\n    };\n    return StartWithOperator;\n}());\nexports.StartWithOperator = StartWithOperator;\nvar TakeOperator = (function () {\n    function TakeOperator(max, ins) {\n        this.max = max;\n        this.ins = ins;\n        this.type = 'take';\n        this.out = null;\n        this.taken = 0;\n    }\n    TakeOperator.prototype._start = function (out) {\n        this.out = out;\n        this.ins._add(this);\n    };\n    TakeOperator.prototype._stop = function () {\n        this.ins._remove(this);\n        this.out = null;\n        this.taken = 0;\n    };\n    TakeOperator.prototype._n = function (t) {\n        var u = this.out;\n        if (!u)\n            return;\n        if (this.taken++ < this.max - 1) {\n            u._n(t);\n        }\n        else {\n            u._n(t);\n            u._c();\n        }\n    };\n    TakeOperator.prototype._e = function (err) {\n        var u = this.out;\n        if (!u)\n            return;\n        u._e(err);\n    };\n    TakeOperator.prototype._c = function () {\n        var u = this.out;\n        if (!u)\n            return;\n        u._c();\n    };\n    return TakeOperator;\n}());\nexports.TakeOperator = TakeOperator;\nvar Stream = (function () {\n    function Stream(producer) {\n        this._stopID = empty;\n        this._prod = producer;\n        this._ils = [];\n        this._target = null;\n        this._err = null;\n    }\n    Stream.prototype._n = function (t) {\n        var a = this._ils;\n        var L = a.length;\n        if (L == 1)\n            a[0]._n(t);\n        else {\n            var b = copy(a);\n            for (var i = 0; i < L; i++)\n                b[i]._n(t);\n        }\n    };\n    Stream.prototype._e = function (err) {\n        if (this._err)\n            return;\n        this._err = err;\n        var a = this._ils;\n        var L = a.length;\n        if (L == 1)\n            a[0]._e(err);\n        else {\n            var b = copy(a);\n            for (var i = 0; i < L; i++)\n                b[i]._e(err);\n        }\n        this._x();\n    };\n    Stream.prototype._c = function () {\n        var a = this._ils;\n        var L = a.length;\n        if (L == 1)\n            a[0]._c();\n        else {\n            var b = copy(a);\n            for (var i = 0; i < L; i++)\n                b[i]._c();\n        }\n        this._x();\n    };\n    Stream.prototype._x = function () {\n        if (this._ils.length === 0)\n            return;\n        if (this._prod)\n            this._prod._stop();\n        this._err = null;\n        this._ils = [];\n    };\n    /**\n     * Adds a Listener to the Stream.\n     *\n     * @param {Listener<T>} listener\n     */\n    Stream.prototype.addListener = function (listener) {\n        if (typeof listener.next !== 'function'\n            || typeof listener.error !== 'function'\n            || typeof listener.complete !== 'function') {\n            throw new Error('stream.addListener() requires all three next, error, ' +\n                'and complete functions.');\n        }\n        listener._n = listener.next;\n        listener._e = listener.error;\n        listener._c = listener.complete;\n        this._add(listener);\n    };\n    /**\n     * Removes a Listener from the Stream, assuming the Listener was added to it.\n     *\n     * @param {Listener<T>} listener\n     */\n    Stream.prototype.removeListener = function (listener) {\n        this._remove(listener);\n    };\n    Stream.prototype._add = function (il) {\n        var ta = this._target;\n        if (ta)\n            return ta._add(il);\n        var a = this._ils;\n        a.push(il);\n        if (a.length === 1) {\n            if (this._stopID !== empty) {\n                clearTimeout(this._stopID);\n                this._stopID = empty;\n            }\n            var p = this._prod;\n            if (p)\n                p._start(this);\n        }\n    };\n    Stream.prototype._remove = function (il) {\n        var ta = this._target;\n        if (ta)\n            return ta._remove(il);\n        var a = this._ils;\n        var i = a.indexOf(il);\n        if (i > -1) {\n            a.splice(i, 1);\n            var p_1 = this._prod;\n            if (p_1 && a.length <= 0) {\n                this._err = null;\n                this._stopID = setTimeout(function () { return p_1._stop(); });\n            }\n            else if (a.length === 1) {\n                this._pruneCycles();\n            }\n        }\n    };\n    // If all paths stemming from `this` stream eventually end at `this`\n    // stream, then we remove the single listener of `this` stream, to\n    // force it to end its execution and dispose resources. This method\n    // assumes as a precondition that this._ils has just one listener.\n    Stream.prototype._pruneCycles = function () {\n        if (this._hasNoSinks(this, [])) {\n            this._remove(this._ils[0]);\n        }\n    };\n    // Checks whether *there is no* path starting from `x` that leads to an end\n    // listener (sink) in the stream graph, following edges A->B where B is a\n    // listener of A. This means these paths constitute a cycle somehow. Is given\n    // a trace of all visited nodes so far.\n    Stream.prototype._hasNoSinks = function (x, trace) {\n        if (trace.indexOf(x) !== -1) {\n            return true;\n        }\n        else if (x.out === this) {\n            return true;\n        }\n        else if (x.out) {\n            return this._hasNoSinks(x.out, trace.concat(x));\n        }\n        else if (x._ils) {\n            for (var i = 0, N = x._ils.length; i < N; i++) {\n                if (!this._hasNoSinks(x._ils[i], trace.concat(x))) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        else {\n            return false;\n        }\n    };\n    Stream.prototype.ctor = function () {\n        return this instanceof MemoryStream ? MemoryStream : Stream;\n    };\n    /**\n     * Creates a new Stream given a Producer.\n     *\n     * @factory true\n     * @param {Producer} producer An optional Producer that dictates how to\n     * start, generate events, and stop the Stream.\n     * @return {Stream}\n     */\n    Stream.create = function (producer) {\n        if (producer) {\n            if (typeof producer.start !== 'function'\n                || typeof producer.stop !== 'function') {\n                throw new Error('producer requires both start and stop functions');\n            }\n            internalizeProducer(producer); // mutates the input\n        }\n        return new Stream(producer);\n    };\n    /**\n     * Creates a new MemoryStream given a Producer.\n     *\n     * @factory true\n     * @param {Producer} producer An optional Producer that dictates how to\n     * start, generate events, and stop the Stream.\n     * @return {MemoryStream}\n     */\n    Stream.createWithMemory = function (producer) {\n        if (producer) {\n            internalizeProducer(producer); // mutates the input\n        }\n        return new MemoryStream(producer);\n    };\n    /**\n     * Creates a Stream that does nothing when started. It never emits any event.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     *          never\n     * -----------------------\n     * ```\n     *\n     * @factory true\n     * @return {Stream}\n     */\n    Stream.never = function () {\n        return new Stream({ _start: noop, _stop: noop });\n    };\n    /**\n     * Creates a Stream that immediately emits the \"complete\" notification when\n     * started, and that's it.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * empty\n     * -|\n     * ```\n     *\n     * @factory true\n     * @return {Stream}\n     */\n    Stream.empty = function () {\n        return new Stream({\n            _start: function (il) { il._c(); },\n            _stop: noop,\n        });\n    };\n    /**\n     * Creates a Stream that immediately emits an \"error\" notification with the\n     * value you passed as the `error` argument when the stream starts, and that's\n     * it.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * throw(X)\n     * -X\n     * ```\n     *\n     * @factory true\n     * @param error The error event to emit on the created stream.\n     * @return {Stream}\n     */\n    Stream.throw = function (error) {\n        return new Stream({\n            _start: function (il) { il._e(error); },\n            _stop: noop,\n        });\n    };\n    /**\n     * Creates a Stream that immediately emits the arguments that you give to\n     * *of*, then completes.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * of(1,2,3)\n     * 123|\n     * ```\n     *\n     * @factory true\n     * @param a The first value you want to emit as an event on the stream.\n     * @param b The second value you want to emit as an event on the stream. One\n     * or more of these values may be given as arguments.\n     * @return {Stream}\n     */\n    Stream.of = function () {\n        var items = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n            items[_i - 0] = arguments[_i];\n        }\n        return Stream.fromArray(items);\n    };\n    /**\n     * Converts an array to a stream. The returned stream will emit synchronously\n     * all the items in the array, and then complete.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * fromArray([1,2,3])\n     * 123|\n     * ```\n     *\n     * @factory true\n     * @param {Array} array The array to be converted as a stream.\n     * @return {Stream}\n     */\n    Stream.fromArray = function (array) {\n        return new Stream(new FromArrayProducer(array));\n    };\n    /**\n     * Converts a promise to a stream. The returned stream will emit the resolved\n     * value of the promise, and then complete. However, if the promise is\n     * rejected, the stream will emit the corresponding error.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * fromPromise( ----42 )\n     * -----------------42|\n     * ```\n     *\n     * @factory true\n     * @param {Promise} promise The promise to be converted as a stream.\n     * @return {Stream}\n     */\n    Stream.fromPromise = function (promise) {\n        return new Stream(new FromPromiseProducer(promise));\n    };\n    /**\n     * Creates a stream that periodically emits incremental numbers, every\n     * `period` milliseconds.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     *     periodic(1000)\n     * ---0---1---2---3---4---...\n     * ```\n     *\n     * @factory true\n     * @param {number} period The interval in milliseconds to use as a rate of\n     * emission.\n     * @return {Stream}\n     */\n    Stream.periodic = function (period) {\n        return new Stream(new PeriodicProducer(period));\n    };\n    /**\n     * Blends multiple streams together, emitting events from all of them\n     * concurrently.\n     *\n     * *merge* takes multiple streams as arguments, and creates a stream that\n     * behaves like each of the argument streams, in parallel.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --1----2-----3--------4---\n     * ----a-----b----c---d------\n     *            merge\n     * --1-a--2--b--3-c---d--4---\n     * ```\n     *\n     * @factory true\n     * @param {Stream} stream1 A stream to merge together with other streams.\n     * @param {Stream} stream2 A stream to merge together with other streams. Two\n     * or more streams may be given as arguments.\n     * @return {Stream}\n     */\n    Stream.merge = function () {\n        var streams = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n            streams[_i - 0] = arguments[_i];\n        }\n        return new Stream(new MergeProducer(streams));\n    };\n    Stream.prototype._map = function (project) {\n        var p = this._prod;\n        var ctor = this.ctor();\n        if (p instanceof FilterOperator) {\n            return new ctor(new FilterMapOperator(p.passes, project, p.ins));\n        }\n        if (p instanceof FilterMapOperator) {\n            return new ctor(new FilterMapOperator(p.passes, compose2(project, p.project), p.ins));\n        }\n        if (p instanceof MapOperator) {\n            return new ctor(new MapOperator(compose2(project, p.project), p.ins));\n        }\n        return new ctor(new MapOperator(project, this));\n    };\n    /**\n     * Transforms each event from the input Stream through a `project` function,\n     * to get a Stream that emits those transformed events.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --1---3--5-----7------\n     *    map(i => i * 10)\n     * --10--30-50----70-----\n     * ```\n     *\n     * @param {Function} project A function of type `(t: T) => U` that takes event\n     * `t` of type `T` from the input Stream and produces an event of type `U`, to\n     * be emitted on the output Stream.\n     * @return {Stream}\n     */\n    Stream.prototype.map = function (project) {\n        return this._map(project);\n    };\n    /**\n     * It's like `map`, but transforms each input event to always the same\n     * constant value on the output Stream.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --1---3--5-----7-----\n     *       mapTo(10)\n     * --10--10-10----10----\n     * ```\n     *\n     * @param projectedValue A value to emit on the output Stream whenever the\n     * input Stream emits any value.\n     * @return {Stream}\n     */\n    Stream.prototype.mapTo = function (projectedValue) {\n        var s = this.map(function () { return projectedValue; });\n        var op = s._prod;\n        op.type = op.type.replace('map', 'mapTo');\n        return s;\n    };\n    /**\n     * Only allows events that pass the test given by the `passes` argument.\n     *\n     * Each event from the input stream is given to the `passes` function. If the\n     * function returns `true`, the event is forwarded to the output stream,\n     * otherwise it is ignored and not forwarded.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --1---2--3-----4-----5---6--7-8--\n     *     filter(i => i % 2 === 0)\n     * ------2--------4---------6----8--\n     * ```\n     *\n     * @param {Function} passes A function of type `(t: T) +> boolean` that takes\n     * an event from the input stream and checks if it passes, by returning a\n     * boolean.\n     * @return {Stream}\n     */\n    Stream.prototype.filter = function (passes) {\n        var p = this._prod;\n        if (p instanceof FilterOperator) {\n            return new Stream(new FilterOperator(and(passes, p.passes), p.ins));\n        }\n        return new Stream(new FilterOperator(passes, this));\n    };\n    /**\n     * Lets the first `amount` many events from the input stream pass to the\n     * output stream, then makes the output stream complete.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --a---b--c----d---e--\n     *    take(3)\n     * --a---b--c|\n     * ```\n     *\n     * @param {number} amount How many events to allow from the input stream\n     * before completing the output stream.\n     * @return {Stream}\n     */\n    Stream.prototype.take = function (amount) {\n        return new (this.ctor())(new TakeOperator(amount, this));\n    };\n    /**\n     * Ignores the first `amount` many events from the input stream, and then\n     * after that starts forwarding events from the input stream to the output\n     * stream.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --a---b--c----d---e--\n     *       drop(3)\n     * --------------d---e--\n     * ```\n     *\n     * @param {number} amount How many events to ignore from the input stream\n     * before forwarding all events from the input stream to the output stream.\n     * @return {Stream}\n     */\n    Stream.prototype.drop = function (amount) {\n        return new Stream(new DropOperator(amount, this));\n    };\n    /**\n     * When the input stream completes, the output stream will emit the last event\n     * emitted by the input stream, and then will also complete.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --a---b--c--d----|\n     *       last()\n     * -----------------d|\n     * ```\n     *\n     * @return {Stream}\n     */\n    Stream.prototype.last = function () {\n        return new Stream(new LastOperator(this));\n    };\n    /**\n     * Prepends the given `initial` value to the sequence of events emitted by the\n     * input stream. The returned stream is a MemoryStream, which means it is\n     * already `remember()`'d.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * ---1---2-----3---\n     *   startWith(0)\n     * 0--1---2-----3---\n     * ```\n     *\n     * @param initial The value or event to prepend.\n     * @return {MemoryStream}\n     */\n    Stream.prototype.startWith = function (initial) {\n        return new MemoryStream(new StartWithOperator(this, initial));\n    };\n    /**\n     * Uses another stream to determine when to complete the current stream.\n     *\n     * When the given `other` stream emits an event or completes, the output\n     * stream will complete. Before that happens, the output stream will behaves\n     * like the input stream.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * ---1---2-----3--4----5----6---\n     *   endWhen( --------a--b--| )\n     * ---1---2-----3--4--|\n     * ```\n     *\n     * @param other Some other stream that is used to know when should the output\n     * stream of this operator complete.\n     * @return {Stream}\n     */\n    Stream.prototype.endWhen = function (other) {\n        return new (this.ctor())(new EndWhenOperator(other, this));\n    };\n    /**\n     * \"Folds\" the stream onto itself.\n     *\n     * Combines events from the past throughout\n     * the entire execution of the input stream, allowing you to accumulate them\n     * together. It's essentially like `Array.prototype.reduce`. The returned\n     * stream is a MemoryStream, which means it is already `remember()`'d.\n     *\n     * The output stream starts by emitting the `seed` which you give as argument.\n     * Then, when an event happens on the input stream, it is combined with that\n     * seed value through the `accumulate` function, and the output value is\n     * emitted on the output stream. `fold` remembers that output value as `acc`\n     * (\"accumulator\"), and then when a new input event `t` happens, `acc` will be\n     * combined with that to produce the new `acc` and so forth.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * ------1-----1--2----1----1------\n     *   fold((acc, x) => acc + x, 3)\n     * 3-----4-----5--7----8----9------\n     * ```\n     *\n     * @param {Function} accumulate A function of type `(acc: R, t: T) => R` that\n     * takes the previous accumulated value `acc` and the incoming event from the\n     * input stream and produces the new accumulated value.\n     * @param seed The initial accumulated value, of type `R`.\n     * @return {MemoryStream}\n     */\n    Stream.prototype.fold = function (accumulate, seed) {\n        return new MemoryStream(new FoldOperator(accumulate, seed, this));\n    };\n    /**\n     * Replaces an error with another stream.\n     *\n     * When (and if) an error happens on the input stream, instead of forwarding\n     * that error to the output stream, *replaceError* will call the `replace`\n     * function which returns the stream that the output stream will replicate.\n     * And, in case that new stream also emits an error, `replace` will be called\n     * again to get another stream to start replicating.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --1---2-----3--4-----X\n     *   replaceError( () => --10--| )\n     * --1---2-----3--4--------10--|\n     * ```\n     *\n     * @param {Function} replace A function of type `(err) => Stream` that takes\n     * the error that occurred on the input stream or on the previous replacement\n     * stream and returns a new stream. The output stream will behave like the\n     * stream that this function returns.\n     * @return {Stream}\n     */\n    Stream.prototype.replaceError = function (replace) {\n        return new (this.ctor())(new ReplaceErrorOperator(replace, this));\n    };\n    /**\n     * Flattens a \"stream of streams\", handling only one nested stream at a time\n     * (no concurrency).\n     *\n     * If the input stream is a stream that emits streams, then this operator will\n     * return an output stream which is a flat stream: emits regular events. The\n     * flattening happens without concurrency. It works like this: when the input\n     * stream emits a nested stream, *flatten* will start imitating that nested\n     * one. However, as soon as the next nested stream is emitted on the input\n     * stream, *flatten* will forget the previous nested one it was imitating, and\n     * will start imitating the new nested one.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --+--------+---------------\n     *   \\        \\\n     *    \\       ----1----2---3--\n     *    --a--b----c----d--------\n     *           flatten\n     * -----a--b------1----2---3--\n     * ```\n     *\n     * @return {Stream}\n     */\n    Stream.prototype.flatten = function () {\n        var p = this._prod;\n        return new Stream(p instanceof MapOperator && !(p instanceof FilterMapOperator) ?\n            new MapFlattenOperator(p) :\n            new FlattenOperator(this));\n    };\n    /**\n     * Passes the input stream to a custom operator, to produce an output stream.\n     *\n     * *compose* is a handy way of using an existing function in a chained style.\n     * Instead of writing `outStream = f(inStream)` you can write\n     * `outStream = inStream.compose(f)`.\n     *\n     * @param {function} operator A function that takes a stream as input and\n     * returns a stream as well.\n     * @return {Stream}\n     */\n    Stream.prototype.compose = function (operator) {\n        return operator(this);\n    };\n    /**\n     * Returns an output stream that behaves like the input stream, but also\n     * remembers the most recent event that happens on the input stream, so that a\n     * newly added listener will immediately receive that memorised event.\n     *\n     * @return {MemoryStream}\n     */\n    Stream.prototype.remember = function () {\n        var _this = this;\n        return new MemoryStream({\n            _start: function (il) {\n                var p = _this._prod;\n                if (p)\n                    p._start(il);\n            },\n            _stop: function () {\n                var p = _this._prod;\n                if (p)\n                    p._stop();\n            },\n        });\n    };\n    /**\n     * Returns an output stream that identically behaves like the input stream,\n     * but also runs a `spy` function fo each event, to help you debug your app.\n     *\n     * *debug* takes a `spy` function as argument, and runs that for each event\n     * happening on the input stream. If you don't provide the `spy` argument,\n     * then *debug* will just `console.log` each event. This helps you to\n     * understand the flow of events through some operator chain.\n     *\n     * Please note that if the output stream has no listeners, then it will not\n     * start, which means `spy` will never run because no actual event happens in\n     * that case.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --1----2-----3-----4--\n     *         debug\n     * --1----2-----3-----4--\n     * ```\n     *\n     * @param {function} labelOrSpy A string to use as the label when printing\n     * debug information on the console, or a 'spy' function that takes an event\n     * as argument, and does not need to return anything.\n     * @return {Stream}\n     */\n    Stream.prototype.debug = function (labelOrSpy) {\n        return new (this.ctor())(new DebugOperator(labelOrSpy, this));\n    };\n    /**\n     * *imitate* changes this current Stream to emit the same events that the\n     * `other` given Stream does. This method returns nothing.\n     *\n     * This method exists to allow one thing: **circular dependency of streams**.\n     * For instance, let's imagine that for some reason you need to create a\n     * circular dependency where stream `first$` depends on stream `second$`\n     * which in turn depends on `first$`:\n     *\n     * <!-- skip-example -->\n     * ```js\n     * import delay from 'xstream/extra/delay'\n     *\n     * var first$ = second$.map(x => x * 10).take(3);\n     * var second$ = first$.map(x => x + 1).startWith(1).compose(delay(100));\n     * ```\n     *\n     * However, that is invalid JavaScript, because `second$` is undefined\n     * on the first line. This is how *imitate* can help solve it:\n     *\n     * ```js\n     * import delay from 'xstream/extra/delay'\n     *\n     * var secondProxy$ = xs.create();\n     * var first$ = secondProxy$.map(x => x * 10).take(3);\n     * var second$ = first$.map(x => x + 1).startWith(1).compose(delay(100));\n     * secondProxy$.imitate(second$);\n     * ```\n     *\n     * We create `secondProxy$` before the others, so it can be used in the\n     * declaration of `first$`. Then, after both `first$` and `second$` are\n     * defined, we hook `secondProxy$` with `second$` with `imitate()` to tell\n     * that they are \"the same\". `imitate` will not trigger the start of any\n     * stream, it just binds `secondProxy$` and `second$` together.\n     *\n     * The following is an example where `imitate()` is important in Cycle.js\n     * applications. A parent component contains some child components. A child\n     * has an action stream which is given to the parent to define its state:\n     *\n     * <!-- skip-example -->\n     * ```js\n     * const childActionProxy$ = xs.create();\n     * const parent = Parent({...sources, childAction$: childActionProxy$});\n     * const childAction$ = parent.state$.map(s => s.child.action$).flatten();\n     * childActionProxy$.imitate(childAction$);\n     * ```\n     *\n     * Note, though, that **`imitate()` does not support MemoryStreams**. If we\n     * would attempt to imitate a MemoryStream in a circular dependency, we would\n     * either get a race condition (where the symptom would be \"nothing happens\")\n     * or an infinite cyclic emission of values. It's useful to think about\n     * MemoryStreams as cells in a spreadsheet. It doesn't make any sense to\n     * define a spreadsheet cell `A1` with a formula that depends on `B1` and\n     * cell `B1` defined with a formula that depends on `A1`.\n     *\n     * If you find yourself wanting to use `imitate()` with a\n     * MemoryStream, you should rework your code around `imitate()` to use a\n     * Stream instead. Look for the stream in the circular dependency that\n     * represents an event stream, and that would be a candidate for creating a\n     * proxy Stream which then imitates the target Stream.\n     *\n     * @param {Stream} target The other stream to imitate on the current one. Must\n     * not be a MemoryStream.\n     */\n    Stream.prototype.imitate = function (target) {\n        if (target instanceof MemoryStream) {\n            throw new Error('A MemoryStream was given to imitate(), but it only ' +\n                'supports a Stream. Read more about this restriction here: ' +\n                'https://github.com/staltz/xstream#faq');\n        }\n        this._target = target;\n    };\n    /**\n     * Forces the Stream to emit the given value to its listeners.\n     *\n     * As the name indicates, if you use this, you are most likely doing something\n     * The Wrong Way. Please try to understand the reactive way before using this\n     * method. Use it only when you know what you are doing.\n     *\n     * @param value The \"next\" value you want to broadcast to all listeners of\n     * this Stream.\n     */\n    Stream.prototype.shamefullySendNext = function (value) {\n        this._n(value);\n    };\n    /**\n     * Forces the Stream to emit the given error to its listeners.\n     *\n     * As the name indicates, if you use this, you are most likely doing something\n     * The Wrong Way. Please try to understand the reactive way before using this\n     * method. Use it only when you know what you are doing.\n     *\n     * @param {any} error The error you want to broadcast to all the listeners of\n     * this Stream.\n     */\n    Stream.prototype.shamefullySendError = function (error) {\n        this._e(error);\n    };\n    /**\n     * Forces the Stream to emit the \"completed\" event to its listeners.\n     *\n     * As the name indicates, if you use this, you are most likely doing something\n     * The Wrong Way. Please try to understand the reactive way before using this\n     * method. Use it only when you know what you are doing.\n     */\n    Stream.prototype.shamefullySendComplete = function () {\n        this._c();\n    };\n    /**\n     * Combines multiple input streams together to return a stream whose events\n     * are arrays that collect the latest events from each input stream.\n     *\n     * *combine* internally remembers the most recent event from each of the input\n     * streams. When any of the input streams emits an event, that event together\n     * with all the other saved events are combined into an array. That array will\n     * be emitted on the output stream. It's essentially a way of joining together\n     * the events from multiple streams.\n     *\n     * Marble diagram:\n     *\n     * ```text\n     * --1----2-----3--------4---\n     * ----a-----b-----c--d------\n     *          combine\n     * ----1a-2a-2b-3b-3c-3d-4d--\n     * ```\n     *\n     * @factory true\n     * @param {Stream} stream1 A stream to combine together with other streams.\n     * @param {Stream} stream2 A stream to combine together with other streams.\n     * Multiple streams, not just two, may be given as arguments.\n     * @return {Stream}\n     */\n    Stream.combine = function combine() {\n        var streams = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n            streams[_i - 0] = arguments[_i];\n        }\n        return new Stream(new CombineProducer(streams));\n    };\n    return Stream;\n}());\nexports.Stream = Stream;\nvar MemoryStream = (function (_super) {\n    __extends(MemoryStream, _super);\n    function MemoryStream(producer) {\n        _super.call(this, producer);\n        this._has = false;\n    }\n    MemoryStream.prototype._n = function (x) {\n        this._v = x;\n        this._has = true;\n        _super.prototype._n.call(this, x);\n    };\n    MemoryStream.prototype._add = function (il) {\n        if (this._has) {\n            il._n(this._v);\n        }\n        _super.prototype._add.call(this, il);\n    };\n    MemoryStream.prototype._x = function () {\n        this._has = false;\n        _super.prototype._x.call(this);\n    };\n    MemoryStream.prototype.map = function (project) {\n        return this._map(project);\n    };\n    MemoryStream.prototype.mapTo = function (projectedValue) {\n        return _super.prototype.mapTo.call(this, projectedValue);\n    };\n    MemoryStream.prototype.take = function (amount) {\n        return _super.prototype.take.call(this, amount);\n    };\n    MemoryStream.prototype.endWhen = function (other) {\n        return _super.prototype.endWhen.call(this, other);\n    };\n    MemoryStream.prototype.replaceError = function (replace) {\n        return _super.prototype.replaceError.call(this, replace);\n    };\n    MemoryStream.prototype.debug = function (labelOrSpy) {\n        return _super.prototype.debug.call(this, labelOrSpy);\n    };\n    return MemoryStream;\n}(Stream));\nexports.MemoryStream = MemoryStream;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = Stream;\n//# sourceMappingURL=core.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/xstream/core.js\n ** module id = 364\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/xstream/core.js?");
},function(module,exports,__webpack_require__){eval('var map = {\n	"./DOM": 70,\n	"./DOM.js": 70,\n	"./addressbar": 71,\n	"./addressbar.js": 71,\n	"./postMessage": 72,\n	"./postMessage.js": 72,\n	"./utils": 21,\n	"./utils.js": 21\n};\nfunction webpackContext(req) {\n	return __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n	return map[req] || (function() { throw new Error("Cannot find module \'" + req + "\'.") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n	return Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 365;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources ^\\.\\/.*$\n ** module id = 365\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources_^\\.\\/.*$?')},function(module,exports,__webpack_require__,__webpack_module_template_argument_0__){eval("// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = __webpack_require__(__webpack_module_template_argument_0__);\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = __webpack_require__(10)(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(false) {\n	// When the styles change, update the <style> tags\n	if(!content.locals) {\n		module.hot.accept(\"!!./../../../../node_modules/css-loader/index.js!./style.css\", function() {\n			var newContent = require(\"!!./../../../../node_modules/css-loader/index.js!./style.css\");\n			if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n			update(newContent);\n		});\n	}\n	// When the module is disposed, remove the <style> tags\n	module.hot.dispose(function() { update(); });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** template of 344 referencing 10\n ** module id = 366\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///template_of_344_referencing_10?")}]));