X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/b87327ac3a27967ee3d3b21c9cb7eac4e1802b35..07c0462000b1f7cccdc2fc33499940ee6e899c3e:/vendor/assets/iD/iD/mapillary-js/mapillary.min.js diff --git a/vendor/assets/iD/iD/mapillary-js/mapillary.min.js b/vendor/assets/iD/iD/mapillary-js/mapillary.min.js index a70ecede1..47af8c636 100644 --- a/vendor/assets/iD/iD/mapillary-js/mapillary.min.js +++ b/vendor/assets/iD/iD/mapillary-js/mapillary.min.js @@ -1 +1 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Mapillary=t()}}(function(){return function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[s]={exports:{}};e[s][0].call(h.exports,function(t){var r=e[s][1][t];return i(r||t)},h,h.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;sc)&&(c=p[0]),(!l||p[1]>h)&&(h=p[1])}var f=c-n,d=h-s,m=Math.min(f,d),v=m/2,g=new u(null,i);if(0===m)return[n,s];for(var y=n;y_.d&&(_=x);for(var w=g.length;g.length;){var S=g.pop();S.d>_.d&&(_=S,r&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,w)),S.max-_.d<=e||(v=S.h/2,g.push(new o(S.x-v,S.y-v,v,t)),g.push(new o(S.x+v,S.y-v,v,t)),g.push(new o(S.x-v,S.y+v,v,t)),g.push(new o(S.x+v,S.y+v,v,t)),w+=4)}return r&&(console.log("num probes: "+w),console.log("best distance: "+_.d)),[_.x,_.y]}function i(t,e){return e.max-t.max}function o(t,e,r,n){this.x=t,this.y=e,this.h=r,this.d=s(t,e,n),this.max=this.d+this.h*Math.SQRT2}function s(t,e,r){for(var n=!1,i=1/0,o=0;oe!=p[1]>e&&t<(p[0]-l[0])*(e-l[1])/(p[1]-l[1])+l[0]&&(n=!n),i=Math.min(i,c(t,e,l,p))}return(n?1:-1)*Math.sqrt(i)}function a(t){for(var e=0,r=0,n=0,i=t[0],s=0,a=i.length,c=a-1;s1?(i=n[0],o=n[1]):c>0&&(i+=s*c,o+=a*c)}return s=t-i,a=e-o,s*s+a*a}var u=t("tinyqueue");e.exports=n,e.exports.default=n},{tinyqueue:177}],2:[function(t,e,r){function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}e.exports=n,n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){void 0===e&&(e=1e-6);var r,n,i,o,s;for(i=t,s=0;s<8;s++){if(o=this.sampleCurveX(i)-t,Math.abs(o)n)return n;for(;ro?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],3:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function o(t,e,r){for(var n,o=[],s=e;s0?u-4:u;var h=0;for(e=0;e>16&255,s[h++]=i>>8&255,s[h++]=255&i;return 2===o?(i=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,s[h++]=255&i):1===o&&(i=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,s[h++]=i>>8&255,s[h++]=255&i),s},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i="",a=[],c=0,u=r-n;cu?u:c+16383));return 1===n?(e=t[r-1],i+=s[e>>2],i+=s[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=s[e>>10],i+=s[e>>4&63],i+=s[e<<2&63],i+="="),a.push(i),a.join("")};for(var s=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,l=u.length;h>>0:o>>>0;(a=i.exec(n))&&!((c=a.index+a[0].length)>p&&(h.push(n.slice(p,a.index)),!r&&a.length>1&&a[0].replace(s,function(){for(var e=1;e1&&a.index=o));)i.lastIndex===a.index&&i.lastIndex++;return p===n.length?!u&&i.test("")||h.push(""):h.push(n.slice(p)),h.length>o?h.slice(0,o):h}}()},{}],6:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function s(t){if(p===clearTimeout)return clearTimeout(t);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function a(){v&&d&&(v=!1,d.length?m=d.concat(m):g=-1,m.length&&c())}function c(){if(!v){var t=o(a);v=!0;for(var e=m.length;e;){for(d=m,m=[];++g1)for(var r=1;rX)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return o(t,e,r)}function o(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?l(t,e,r):"string"==typeof t?u(t,e):p(t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,e,r){return s(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function c(t){return s(t),n(t<0?0:0|f(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(t,e),o=n(r),s=o.write(t,e);return s!==r&&(o=o.slice(0,s)),o}function h(t){for(var e=t.length<0?0:0|f(t.length),r=n(e),i=0;i=X)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+X.toString(16)+" bytes");return 0|t}function d(t,e){if(i.isBuffer(t))return t.length;if(V(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,H(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(i){var h=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var l=!0,p=0;pi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,u,h,l;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=t[i+1]))&&(l=(31&o)<<6|63&c)>127&&(s=l);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:c=t[i+1],u=t[i+2],h=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return C(n)}function C(t){var e=t.length;if(e<=Y)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return e=+e,r>>>=0,i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function k(t){if((t=t.trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function G(t){return q.toByteArray(k(t))}function $(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function V(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function H(t){return t!==t}var q=t("base64-js"),W=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50;var X=2147483647;r.kMaxLength=X,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return o(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return a(t,e,r)},i.allocUnsafe=function(t){return c(t)},i.allocUnsafeSlow=function(t){return c(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},i.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s80*r){u=p=t[0],h=f=t[1];for(var g=r;gp&&(p=d),m>f&&(f=m);v=Math.max(p-u,f-h)}return s(a,c,r,u,h,v),c}function i(t,e,r,n,i){var o,s;if(i===j(t,e,r,n)>0)for(o=e;o=e;o-=n)s=O(o,t[o],t[o+1],s);return s&&w(s,s.next)&&(P(s),s=s.next),s}function o(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!w(n,n.next)&&0!==x(n.prev,n,n.next))n=n.next;else{if(P(n),(n=e=n.prev)===n.next)return null;r=!0}}while(r||n!==e);return e}function s(t,e,r,n,i,l,p){if(t){!p&&l&&m(t,n,i,l);for(var f,d,v=t;t.prev!==t.next;)if(f=t.prev,d=t.next,l?c(t,n,i,l):a(t))e.push(f.i/r),e.push(t.i/r),e.push(d.i/r),P(t),t=d.next,v=d.next;else if((t=d)===v){p?1===p?s(t=u(t,e,r),e,r,n,i,l,2):2===p&&h(t,e,r,n,i,l):s(o(t),e,r,n,i,l,1);break}}}function a(t){var e=t.prev,r=t,n=t.next;if(x(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(b(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&x(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function c(t,e,r,n){var i=t.prev,o=t,s=t.next;if(x(i,o,s)>=0)return!1;for(var a=i.xo.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,l=g(a,c,e,r,n),p=g(u,h,e,r,n),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&b(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&b(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!w(i,o)&&S(i,n,n.next,o)&&E(i,o)&&E(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),P(n),P(n.next),n=t=o),n=n.next}while(n!==t);return n}function h(t,e,r,n,i,a){var c=t;do{for(var u=c.next.next;u!==c.prev;){if(c.i!==u.i&&_(c,u)){var h=C(c,u);return c=o(c,c.next),h=o(h,h.next),s(c,e,r,n,i,a),void s(h,e,r,n,i,a)}u=u.next}c=c.next}while(c!==t)}function l(t,e,r,n){var s,a,c,u=[];for(s=0,a=e.length;s=n.next.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s){if(s=a,a===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=h&&b(or.x)&&E(n,t)&&(r=n,p=c),n=n.next;return r}function m(t,e,r,n){var i=t;do{null===i.z&&(i.z=g(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,v(i)}function v(t){var e,r,n,i,o,s,a,c,u=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,n=r,a=0,e=0;e0||c>0&&n;)0===a?(i=n,n=n.nextZ,c--):0!==c&&n?r.z<=n.z?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,c--):(i=r,r=r.nextZ,a--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(s>1);return t}function g(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(t){var e=t,r=t;do{e.x=0&&(t-s)*(n-a)-(r-s)*(e-a)>=0&&(r-s)*(o-a)-(i-s)*(n-a)>=0}function _(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!M(t,e)&&E(t,e)&&E(e,t)&&T(t,e)}function x(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function S(t,e,r,n){return!!(w(t,e)&&w(r,n)||w(t,n)&&w(r,e))||x(t,e,r)>0!=x(t,e,n)>0&&x(r,n,t)>0!=x(r,n,e)>0}function M(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&S(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function E(t,e){return x(t.prev,t,t.next)<0?x(t,e,t.next)>=0&&x(t,t.prev,e)>=0:x(t,e,t.prev)<0||x(t,t.next,e)<0}function T(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}function C(t,e){var r=new A(t.i,t.x,t.y),n=new A(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function O(t,e,r,n){var i=new A(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function P(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function j(t,e,r,n){for(var i=0,o=e,s=r-n;o0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],9:[function(t,e,r){"use strict";t("individual/one-version")("ev-store","7");var n="__EV_STORE_KEY@7";e.exports=function(t){var e=t[n];return e||(e=t[n]={}),e}},{"individual/one-version":19}],10:[function(t,e,r){"use strict";function n(t,e){var r;for(r in e)t[r]=e[r];return t}function i(t,e){this._jsongUrl=t,"number"==typeof e&&(e={timeout:e}),this._config=n({timeout:15e3,headers:{}},e||{})}var o=t("./request"),s=t("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:s,get:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:t,method:"get"}),this._config);return o("GET",e,this)},set:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"POST",{jsonGraph:t,method:"set"}),this._config);return e.headers["Content-Type"]="application/x-www-form-urlencoded",o("POST",e,this)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var s=[];s.push("method=call"),s.push("callPath="+encodeURIComponent(JSON.stringify(t))),s.push("arguments="+encodeURIComponent(JSON.stringify(e))),s.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),s.push("paths="+encodeURIComponent(JSON.stringify(i)));var a=n(this.buildQueryObject(this._jsongUrl,"POST",s.join("&")),this._config);return a.headers["Content-Type"]="application/x-www-form-urlencoded",o("POST",a,this)}},i.XMLHttpSource=i,i.default=i,e.exports=i},{"./buildQueryObject":11,"./request":14}],11:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=[],i={url:t},o=-1!==t.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];n.push(t+"="+encodeURIComponent(e))}),"GET"===e?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],12:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e=new t.XMLHttpRequest;if("withCredentials"in e)return e;if(t.XDomainRequest)return new XDomainRequest;throw new Error("CORS is not supported by your browser")}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e,r,n;if(t.XMLHttpRequest)return new t.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;n<3;n++)try{if(e=r[n],new t.ActiveXObject(e))break}catch(t){}return new t.ActiveXObject(e)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e,r){"use strict";function n(){}function i(t,e,r){r||(r=new Error(e)),t.onError(r)}function o(t,e,r){var n,o;if(e&&t){o=e.responseType,n="response"in e?e.response:e.responseText;var s=1223===e.status?204:e.status;if(s>=200&&s<=399){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(t,"invalid json",r)}return t.onNext(n),void t.onCompleted()}return 401===s||403===s||407===s?i(t,n):410===s?i(t,n):408===s||504===s?i(t,n):i(t,n||"Response code "+s)}}function s(t,e,r,n){i(t,r||e.statusText||"request error",n)}var a=t("./getXMLHttpRequest"),c=t("./getCORSRequest"),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(t){var e=new n;return e.subscribe=function(e,r,n){var i,o;return i="function"==typeof e?{onNext:e,onError:r||h,onCompleted:n||h}:e,"function"==typeof(o=t(i))?{dispose:o}:o},e},e.exports=function(t,e,r){return n.create(function(n){var i,h,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)u.call(e,f)&&(d[f]=e[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?c():a()}catch(t){n.onError(t)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,l=d.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(t){if("json"!==d.responseType)throw t}i.onreadystatechange=function(t){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(t){h||(h=!0,s(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{"./getCORSRequest":12,"./getXMLHttpRequest":13}],15:[function(t,e,r){(function(n){!function(t){if("object"==typeof r&&void 0!==e)e.exports=t();else{("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).falcor=t()}}(function(){return function e(r,n,i){function o(a,c){if(!n[a]){if(!r[a]){var u="function"==typeof t&&t;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var l=n[a]={exports:{}};r[a][0].call(l.exports,function(t){var e=r[a][1][t];return o(e||t)},l,l.exports,e,r,n,i)}return n[a].exports}for(var s="function"==typeof t&&t,a=0;a1&&!Array.isArray(n)||0===e&&!Array.isArray(n)&&"string"!==i||1===e&&!Array.isArray(n)&&!x(n))return new a(function(t){t.onError(new Error("Invalid argument"))})}return u.create(this,t)},n.prototype.invalidate=function(){var t,e=-1,r=arguments.length,n=arguments[r-1];for(t=new Array(r);++e0){var r=i.Observable.of(t);return t.get.apply(t,a).catch(i.Observable.empty()).concat(r).last().flatMap(function(){return n(e,c)}).filter(function(t){return t})}return i.Observable.return(t)}if(s>0){var o=a.map(function(t){return c.concat(t)});return e.get.apply(e,o).concat(i.Observable.defer(function(){return n(e,c)})).last().filter(function(t){return t})}return i.Observable.empty()})}},{134:134,159:159}],6:[function(t,e,r){var n=t(134),i=t(13),o=t(8),s=t(118);e.exports=function(t){var e=n.fromPath(t);if(!Array.isArray(e))throw new Error("Model#derefSync must be called with an Array path.");var r=i(this,this._path.concat(e),!1),a=r.path,c=r.value;if(r.found&&void 0!==c&&(c.$type!==s||void 0!==c.value)){if(c.$type)throw new o;return this._clone({_path:a})}}},{118:118,13:13,134:134,8:8}],7:[function(t,e,r){function n(){this.message=n.message,this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="BoundJSONGraphModelError",n.message="It is not legal to use the JSON Graph format from a bound Model. JSON Graph format can only be used from a root model.",e.exports=n},{}],8:[function(t,e,r){function n(t,e){this.message=i,this.stack=(new Error).stack,this.boundPath=t,this.shortedPath=e}var i="The boundPath of the model is not valid since a value or error was found before the path end.";(n.prototype=new Error).name="InvalidModelError",n.message=i,e.exports=n},{}],9:[function(t,e,r){function n(t){this.message="An exception was thrown when making a request.",this.stack=(new Error).stack,this.innerError=t}var i="InvalidSourceError";(n.prototype=new Error).name=i,n.is=function(t){return t&&t.name===i},e.exports=n},{}],10:[function(t,e,r){function n(){this.message="The allowed number of retries have been exceeded.",this.stack=(new Error).stack}var i="MaxRetryExceededError";(n.prototype=new Error).name=i,n.is=function(t){return t&&t.name===i},e.exports=n},{}],11:[function(t,e,r){var n=t(26).create,i=t(22),o=t(27),s=t(120),a=t(33),c=t(29).promote;e.exports=function(t,e,r,u,h,l,p){for(var f,d,m=r,v=h,g=u,y=0;;){if(0===y&&g[a]?(y=v.length,d=g[a]):(f=v[y++],d=m[f]),d){var b=d.$type,_=b&&d.value||d;if(yw;w++)x[w]=v[w];v=x}return[m,v]}},{120:120,22:22,26:26,27:27,29:29,33:33}],12:[function(t,e,r){var n=t(15),i=t(8),o=t(7);e.exports=function(t,e){return function(r,s,a){var c,u,h,l=a[0],p={values:a,optimizedPaths:[]},f=r._root.cache,d=r._path,m=f,v=d.length,g=[];if(v){if(e)return{criticalError:new o};if((m=n(r,d)).$type)return{criticalError:new i(d,d)};for(c=[],u=0;v>u;++u)c[u]=d[u]}else c=[],v=0;for(u=0,h=s.length;h>u;u++)t(r,f,m,s[u],0,l,p,g,c,v,e);return p}}},{15:15,7:7,8:8}],13:[function(t,e,r){var n=t(17),i=t(8);e.exports=function(t,e,r){var o,s,a,c,u,h=e,l=e;for(o=t._boxed,r=t._materialized,s=t._treatErrorsAsValues,t._boxed=!0,t._materialized=void 0===r||r,t._treatErrorsAsValues=!0,a=n(t,h.concat(null),!0),t._boxed=o,t._materialized=r,t._treatErrorsAsValues=s,h=a.optimizedPath,c=a.shorted,u=a.found,a=a.value;h.length&&null===h[h.length-1];)h.pop();if(u&&c)throw new i(l,h);return{path:h,value:a,shorted:c,found:u}}},{17:17,8:8}],14:[function(t,e,r){function n(t){var e,r,n,i={},o=Object.keys(t);for(r=0,n=o.length;n>r;r++)e=o[r],s(e)||(i[e]=t[e]);return i}function i(t,e,r){Object.keys(t).filter(function(e){return!s(e)&&t[e]}).forEach(function(r){var s=t[r],a=e[r];if(a||(a=e[r]={}),s.$type){var c,u=s.value&&"object"==typeof s.value,h=!t[o];return c=u||h?n(s):s.value,void(e[r]=c)}i(s,a,r)})}var o=t(37),s=t(97);e.exports=function(t){var e={};return i(t,e),e}},{37:37,97:97}],15:[function(t,e,r){e.exports=function(t,e){for(var r=t._root.cache,n=-1,i=e.length;++n_;){if(null!==(h=e[_++])&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if((p=x.$type)===c&&void 0===x.value){S=void 0,M=!1,y=v>_;break}if(v>_){if(p===a){if(o(x)){E=!0,S=void 0,M=!1;break}if(f=n(t,m,m,x,x.value),!(d=f[0])){S=void 0,x=void 0,M=!1;break}p=d.$type,x=d,g=f[1].slice(0)}if(p)break}else S=x;w=x}if(v>_&&!E){for(l=_;v>l;++l)if(null!==e[_]){b=!0;break}for(b?(y=!0,S=void 0):S=x,l=_;v>l;++l)null!==e[l]&&(g[g.length]=e[l])}if(S&&p&&(o(S)?S=void 0:s(t,S)),S&&p===u&&!t._treatErrorsAsValues)throw{path:_===v?e:e.slice(0,_),value:S.value};return S&&t._boxed?S=Boolean(p)&&!r?i(S):S:!S&&t._materialized?S={$type:c}:S&&(S=S.value),{value:S,shorted:y,optimizedPath:g,found:M}}},{11:11,118:118,119:119,120:120,25:25,27:27,29:29}],18:[function(t,e,r){var n=t(46);e.exports=function(t,e){var r=t._getValueSync({_boxed:!0,_root:t._root,_treatErrorsAsValues:t._treatErrorsAsValues},e,!0).value,i=r&&r[n];return null==i?-1:i}},{46:46}],19:[function(t,e,r){var n=t(12),i=t(31),o=n(i,!1),s=n(i,!0);e.exports={getValueSync:t(17),getBoundValue:t(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:s}},{12:12,13:13,17:17,31:31}],20:[function(t,e,r){var n=t(29),i=t(25),o=n.promote;e.exports=function(t,e,r,n,s){var a=e.value;s.errors||(s.errors=[]),t._boxed&&(a=i(e)),s.errors.push({path:n.slice(0,r+1),value:a}),o(t,e)}},{25:25,29:29}],21:[function(t,e,r){function n(t,e,r,n,i,o,s){s.requestedMissingPaths.push(n.slice(0,r).concat(e)),s.optimizedMissingPaths.push(i.slice(0,o).concat(e))}var i=t(30).fastCopy;e.exports=function(t,e,r,o,s,a,c){o.requestedMissingPaths||(o.requestedMissingPaths=[],o.optimizedMissingPaths=[]),n(0,rv;v++)b=p[v],_[b]||(_[b]={}),_=_[b];_[b=p[v]]=M?{$type:a}:S,l&&r.paths.push(l.slice(0,n))}else if(0===n)r.json=S;else{for((_=r.json)||(_=r.json={}),v=0;n-1>v;v++)y=l[v],_[y]||(_[y]={}),x=_,w=y,_=_[y];null!==(y=l[v])?_[y]=S:x[w]=S}}}},{118:118,119:119,120:120,25:25,29:29,37:37}],23:[function(t,e,r){var n=t(27),i=t(26),o=t(29),s=i.remove,a=o.splice,c=t(119),u=t(20),h=t(22),l=t(21),p=t(28),f=t(35);e.exports=function(t,e,r,i,o,d,m,v,g,y,b){var _=e&&e.$type,x=e&&void 0===e.value;return e&&_?void(n(e)?(e[f]||(a(t,e),s(e)),l(t,r,i,d,m,v,g)):_===c?(b&&(m[i]=null),y||t._treatErrorsAsValues?h(t,e,o,i,d,m,v,g,y,b):u(t,e,i,m,d)):(b&&(m[i]=null),(!x||x&&t._materialized)&&h(t,e,o,i,d,m,v,g,y,b))):void(p(t)?h(t,e,o,i,d,m,v,g,y,b):l(t,r,i,d,m,v,g))}},{119:119,20:20,21:21,22:22,26:26,27:27,28:28,29:29,35:35}],24:[function(t,e,r){var n=t(134);e.exports=function(t){var e=n.fromPath(t);if(!1===Array.isArray(e))throw new Error("Model#getValueSync must be called with an Array path.");return this._path.length&&(e=this._path.concat(e)),this._syncCheck("getValueSync")&&this._getValueSync(this,e).value}},{134:134}],25:[function(t,e,r){var n=t(40);e.exports=function(t){var e,r,i,o=Object.keys(t);for(e={},r=0,i=o.length;i>r;r++){var s=o[r];s[0]!==n&&(e[s]=t[s])}return e}},{40:40}],26:[function(t,e,r){var n=t(43),i=t(33),o=t(42),s=t(44);e.exports={create:function(t,e){var r=e[s]||0;e[n+r]=t,e[s]=r+1,t[o]=r,t[i]=e},remove:function(t){var e=t[i];if(e){for(var r=t[o],a=e[s];a>r;)e[n+r]=e[n+r+1],++r;e[s]=a-1,t[i]=void 0,t[o]=void 0}}}},{33:33,42:42,43:43,44:44}],27:[function(t,e,r){var n=t(106);e.exports=function(t){var e=void 0===t.$expires&&-1||t.$expires;return-1!==e&&1!==e&&(0===e||er;r++)o[r]=t[r];for(i=0,n=e.length;n>i;i++)o[r++]=e[i];return o},fastCatSkipNulls:function(t,e){var r,n,i,o=[];for(r=0,n=t.length;n>r;r++)o[r]=t[r];for(i=0,n=e.length;n>i;i++)null!==e[i]&&(o[r++]=e[i]);return o},fastCopy:function(t,e){var r,n,i,o=[];for(n=0,i=e||0,r=t.length;r>i;n++,i++)o[n]=t[i];return o}}},{}],31:[function(t,e,r){var n=t(11),i=t(23),o=t(27),s=t(143).iterateKeySet,a=t(120),c=t(29).promote;e.exports=function t(e,r,u,h,l,p,f,d,m,v,g,y){var b=y,_=m;if(!u||u&&u.$type||l===h.length)i(e,u,h,l,p,f,d,_,v,g,b);else{var x,w,S=l+1,M=!1,E=x=h[l];if("object"==typeof x&&(M={},E=s(x,M)),void 0!==E||!M.done){var T=v+1;do{b=!1;var C;null===E?C=u:(C=u[E],_[v]=E,d[l]=E);var O=_,P=T;if(C){var A=C.$type,j=A&&C.value||C;if(Sw;++w)O[w]=L[w]}}t(e,r,C,h,S,p,f,d,O,P,g,b),M&&!M.done&&(E=s(x,M))}while(M&&!M.done)}}}},{11:11,120:120,143:143,23:23,27:27,29:29}],32:[function(t,e,r){"use strict";function n(t){return new n.Model(t)}"function"==typeof Promise?n.Promise=Promise:n.Promise=t(151),e.exports=n,n.Model=t(2)},{151:151,2:2}],33:[function(t,e,r){e.exports=t(40)+"context"},{40:40}],34:[function(t,e,r){e.exports=t(40)+"head"},{40:40}],35:[function(t,e,r){e.exports=t(40)+"invalidated"},{40:40}],36:[function(t,e,r){e.exports=t(40)+"key"},{40:40}],37:[function(t,e,r){e.exports="$modelCreated"},{}],38:[function(t,e,r){e.exports=t(40)+"next"},{40:40}],39:[function(t,e,r){e.exports=t(40)+"parent"},{40:40}],40:[function(t,e,r){e.exports=String.fromCharCode(30)},{}],41:[function(t,e,r){e.exports=t(40)+"prev"},{40:40}],42:[function(t,e,r){e.exports=t(40)+"ref-index"},{40:40}],43:[function(t,e,r){e.exports=t(40)+"ref"},{40:40}],44:[function(t,e,r){e.exports=t(40)+"refs-length"},{40:40}],45:[function(t,e,r){e.exports=t(40)+"tail"},{40:40}],46:[function(t,e,r){e.exports=t(40)+"version"},{40:40}],47:[function(t,e,r){function n(t,e,r,i,s,a,u,h,l,p){if(!w(t)&&!t.$type)for(var f in t)if(f[0]!==c&&"$"!==f[0]&&y(t,f)){var d=t[f],m=b(d)&&!d.$type,v=o(r,i,s,f,d,m,!1,a,u,h,l,p),_=v[0],x=v[1];_&&(m?n(d,e+1,r,x,_,a,u,h,l,p):T(_,x,f,h)&&E(x,g(_),h,a))}}function i(t,e,r,n,i,s,c,l){if(_(r))return S(r,i,s),[void 0,e];v(s,r);var d=r,m=r.value,g=e;if(null!=(r=r[h]))g=r[u]||e;else{var y=0,b=m.length-1;g=r=e;do{var x=o(e,g,r,m[y],t,b>y,!0,n,i,s,c,l);if(r=x[0],w(r))return x;g=x[1]}while(y++d,!0,r,n,i);if(e=y[0],b(e))return y;f=y[1]}while(d++=l){var x=t[s];for(g=x;d>=_&&g;)x=x[c],y=g.$size||0,d-=y,!0===b&&h(g,y,t,f),g=x;t[s]=t[c]=g,null==g?t[o]=t[a]=void 0:g[a]=void 0}}},{108:108,115:115,34:34,36:36,38:38,39:39,41:41,45:45}],50:[function(t,e,r){var n=t(121),i=t(34),o=t(45),s=t(38),a=t(41),c=t(100);e.exports=function(t,e){if(c(e)&&e.$expires!==n){var r=t[i],u=t[o],h=e[s],l=e[a];e!==r&&(null!=h&&"object"==typeof h&&(h[a]=l),null!=l&&"object"==typeof l&&(l[s]=h),h=r,null!=r&&"object"==typeof r&&(r[a]=e),t[i]=t[s]=r=e,r[s]=h,r[a]=void 0),null!=u&&e!==u||(t[o]=t[a]=u=l||e)}return e}},{100:100,121:121,34:34,38:38,41:41,45:45}],51:[function(t,e,r){var n=t(34),i=t(45),o=t(38),s=t(41);e.exports=function(t,e){var r=t[n],a=t[i],c=e[o],u=e[s];null!=c&&"object"==typeof c&&(c[s]=u),null!=u&&"object"==typeof u&&(u[o]=c),e===r&&(t[n]=t[o]=c),e===a&&(t[i]=t[s]=u),e[o]=e[s]=void 0,r=a=c=u=void 0}},{34:34,38:38,41:41,45:45}],52:[function(t,e,r){function n(t,e){var r=!1;return function(){r||t._disposed||(r=!0,t._callbacks[e]=null,t._optimizedPaths[e]=[],t._requestedPaths[e]=[],0!==--t._count||t.sent||(t._disposable.dispose(),t.requestQueue.removeRequest(t)))}}function i(t){for(var e=[],r=-1,n=0,i=t.length;i>n;++n)for(var o=t[n],s=0,a=o.length;a>s;++s)e[++r]=o[s];return e}var o=t(59),s=t(60),a=0,c=t(57).GetRequest,u=t(76),h=t(78),l=t(119),p=[],f=function(t,e){this.sent=!1,this.scheduled=!1,this.requestQueue=e,this.id=++a,this.type=c,this._scheduler=t,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};f.prototype={batch:function(t,e,r){var i=this,o=i._optimizedPaths,a=i._requestedPaths,c=i._callbacks,u=o.length;return o[u]=e,a[u]=t,c[u]=r,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){s(i,o,function(t,e){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(a,t,e);for(var r=0,n=c.length;n>r;++r){var o=c[r];o&&o(t,e)}}})})),n(i,u)},add:function(t,e,r){var i,s,a=this,c=o(t,e,a._pathMap);c?(s=c[2],i=c[1]):(s=t,i=e);var u=!1,h=!1;if(i.lengtho){if(null==u){if(e)return!1;u=a[c]=Object.create(null)}if(!1===this.insertPath(t,e,u,o+1,s))return!1}else a[c]=(u||0)+1,this.length+=1;p.done||(c=l(h,p))}while(!p.done);return!0},n.prototype.removePath=function(t,e,r,n){var i=r||0,o=n||t.length-1,s=e||this.pathmaps[o+1];if(void 0===s||null===s)return!0;var a,c,u=0,h=t[i],p={};a=l(h,p);do{if(void 0!==(c=s[a])&&null!==c){if(o>i){u+=this.removePath(t,c,i+1,o);var f=void 0;for(f in c)break;void 0===f&&delete s[a]}else 0===(c=s[a]=(c||1)-1)&&delete s[a],u+=1,this.length-=1;p.done||(a=l(h,p))}}while(!p.done);return u},n.prototype.getSourceObserver=function(t){var e=this;return o.create(function(r){r.jsonGraph=r.jsonGraph||r.jsong||r.values||r.value,r.index=e.index,t.onNext(r)},function(e){t.onError(e)},function(){t.onCompleted()})},n.prototype._subscribe=function(t){var e=this,r=this.queue;e.pending=!0;var n=!1,i=new c,o=a.create(function(){n||(n=!0,r&&r._remove(e))}),s=new u(i,o);try{i.setDisposable(this.model._source[this.method](this.getSourceArgs()).subscribe(this.getSourceObserver(t)))}catch(t){throw new h(t)}return s},e.exports=n},{143:143,159:159,9:9}],54:[function(t,e,r){function n(t,e){this.total=0,this.model=t,this.requests=[],this.scheduler=e}var i=t(58),o=t(40),s=t(90),a=t(100),c=t(143);n.prototype.set=function(t){return t.paths=c.collapse(t.paths),i.create(this.model,t)},n.prototype._remove=function(t){var e=this.requests,r=e.indexOf(t);-1!==r&&e.splice(r,1)},n.prototype.distributePaths=function(t,e,r){var n,i,o=this.model,s=-1,a=t.length,c=-1,u=e.length,h=[];t:for(;++s-1;){for(var l=n[r-1],p=i[r-1],f=c[r-1]||(c[r-1]=Object.keys(p));f.length>0;){var d=f.pop();if(d[0]!==o)if(l.hasOwnProperty(d)){var m=l[d],v=s(m),g=p[d],y=s(g);if(a(m)&&a(g)&&!v&&!y){n[r]=m,i[r]=g,r+=1;continue t}h>u&&(l[d]=g)}else l[d]=p[d]}r-=1}return t},e.exports=n},{100:100,143:143,40:40,58:58,90:90}],55:[function(t,e,r){function n(t,e){this.model=t,this.scheduler=e,this.requests=this._requests=[]}var i=t(54),o=t(56);n.prototype.get=o.prototype.get,n.prototype.removeRequest=o.prototype.removeRequest,n.prototype.set=i.prototype.set,n.prototype.call=i.prototype.call,e.exports=n},{54:54,56:56}],56:[function(t,e,r){function n(t,e){this.model=t,this.scheduler=e,this.requests=this._requests=[]}var i=t(57),o=t(52);n.prototype={setScheduler:function(t){this.scheduler=t},get:function(t,e,r){function n(){m||0==--l&&r()}var s,a,c,u=this,h=[],l=0,p=u._requests,f=e,d=t,m=!1;for(s=0,a=p.length;a>s;++s)if((c=p[s]).type===i.GetRequest){if(c.sent){var v=c.add(d,f,n);v[0]&&(d=v[1],f=v[2],h[h.length]=v[3],++l)}else c.batch(d,f,n),f=[],d=[],++l;if(!f.length)break}if(f.length){c=new o(u.scheduler,u),p[p.length]=c,++l;var g=c.batch(d,f,n);h[h.length]=g}return function(){if(!m&&0!==l){m=!0;for(var t=h.length,e=0;t>e;++e)h[e]()}}},removeRequest:function(t){for(var e=this._requests,r=e.length;--r>=0;)if(e[r].id===t.id){e.splice(r,1);break}}},e.exports=n},{52:52,57:57}],57:[function(t,e,r){e.exports={GetRequest:"GET"}},{}],58:[function(t,e,r){function n(){o.call(this)}var i=t(159).Observer,o=t(53),s=t(83),a=t(76),c=t(78),u=new Array(0);n.create=function(t,e){var r=new n;return r.model=t,r.jsonGraphEnvelope=e,r},(n.prototype=Object.create(o.prototype)).constructor=n,n.prototype.method="set",n.prototype.insertPath=function(){return!1},n.prototype.removePath=function(){return 0},n.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},n.prototype.getSourceObserver=function(t){var e=this.model,r=e._path,n=this.jsonGraphEnvelope.paths,h=e._root,l=h.errorSelector,p=h.comparator;return o.prototype.getSourceObserver.call(this,i.create(function(i){e._path=u;var o=a(e,[{paths:n,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],e._path=r,t.onNext(i)},function(i){e._path=u,c(e,s(n,function(t){return{path:t,value:i}}),null,l,p),e._path=r,t.onError(i)},function(){t.onCompleted()}))},e.exports=n},{159:159,53:53,76:76,78:78,83:83}],59:[function(t,e,r){var n=t(143).hasIntersection,i=t(84);e.exports=function(t,e,r){for(var o=[],s=[],a=[],c=-1,u=-1,h=!1,l=0,p=e.length;p>l;++l){var f=e[l],d=r[f.length];d&&n(d,f,0)?(!h&&l>0&&(s=i(t,0,l),o=i(e,0,l)),a[++c]=t[l],h=!0):h&&(o[++u]=f,s[u]=t[l])}return h?[a,o,s]:null}},{143:143,84:84}],60:[function(t,e,r){var n=t(143),i=n.toTree,o=n.toPaths;e.exports=function(t,e,r){if(0!==t._count){t.sent=!0,t.scheduled=!1;for(var n=t._pathMap,s=0,a=Object.keys(e).length;a>s;++s)for(var c=e[s],u=0,h=c.length;h>u;++u){var l=c[u],p=l.length;if(n[p]){var f=n[p];f[f.length]=l}else n[p]=[l]}for(var d=Object.keys(n),m=0,v=d.length;v>m;++m){var g=d[m];n[g]=i(n[g])}var y,b=t._collasped=o(n);t.requestQueue.model._source.get(b).subscribe(function(t){y=t},function(t){r(t,y)},function(){r(null,y)})}else t.requestQueue.removeRequest(t)}},{143:143}],61:[function(t,e,r){function n(t){a.call(this,t||o)}function i(t){return s.Observable.defer(function(){return t})}function o(t){function e(t){return b.concat(t)}var r=this.args,n=this.model,o=l.fromPath(r[0]),u=r[1]||[],f=(r[2]||[]).map(l.fromPath),d=(r[3]||[]).map(l.fromPath),m=n._clone({_path:[]}),v=m.withoutDataSource(),g=n._path,y=g.concat(o),b=y.slice(0,-1),_=i(n.withoutDataSource().get(o)).map(function(t){for(var e=t.json,r=-1,n=o.length;e&&++r0?i(v.set.apply(v,e)._toJSONG()).map(function(e){return{results:t,envelope:e}}):a.return({results:t,envelope:{jsonGraph:{},paths:[]}})}).flatMap(function(t){var o=t.envelope,s=t.results,c=s.values,u=s.references,h=s.invalidations,l=c.map(n).map(e),p=u.reduce(r,[]),f=d.map(e),v=p.concat(f);return(v.length>0?i(m.get.apply(m,l.concat(v))._toJSONG()):a.return(o)).doAction(function(t){t.invalidated=h})});return a.return(h)}return a.empty()}).defaultIfEmpty(function(t){return t&&"object"==typeof t?s.Observable.defer(function(){var e;try{e=t.call(y,u,f,d)}catch(t){e=a.throw(new h(t))}return e}).map(function(t){var e=t.invalidated;return e&&e.length&&m.invalidate.apply(m,e),t}):a.empty()}(n._source)).mergeAll().flatMap(function(t){return i(v.set(t)).reduce(function(t){return t},null).map(function(){return{invalidated:t.invalidated,paths:t.paths.map(function(t){return t.slice(g.length)})}})}),x=new c;return x.add(_.subscribe(function(e){var r=e.paths,o=e.invalidated,s=n.get.apply(n,r);"AsJSONG"===t.outputFormat&&(s=i(s._toJSONG()).doAction(function(t){t.invalidated=o})),x.add(s.subscribe(t))},function(e){t.onError(e)})),x}var s=t(159)&&t(158),a=s.Observable,c=s.CompositeDisposable,u=t(64),h=t(9),l=t(134),p=t(120);n.create=u.create,(n.prototype=Object.create(a.prototype)).constructor=n,n.prototype.invokeSourceRequest=function(t){return this},n.prototype.ensureCollect=function(t){return this},n.prototype.initialize=function(){return this},e.exports=n},{120:120,134:134,158:158,159:159,64:64,9:9}],62:[function(t,e,r){function n(t){i.call(this,t)}var i=t(159).Observable,o=t(64),s=t(134),a=t(88),c=t(49),u=t(81),h=t(46),l=Array.isArray,p=t(101),f=t(98),d=t(99);n.create=o.create,(n.prototype=Object.create(i.prototype)).constructor=n,n.prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var t,e,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],a=[],c=this.args,h=-1,m=c.length;++h0&&(0,e["_"+r+c+"AsJSON"])(e,u)}return t.onCompleted(),o.empty}var o=t(159).Disposable,s=t(62);n.create=s.create,(n.prototype=Object.create(s.prototype)).method="invalidate",n.prototype.constructor=n,e.exports=n},{159:159,62:62}],64:[function(t,e,r){function n(t){this._subscribe=t}function i(t){var e=this.model,r=new this.type;return r.model=e,r.args=this.args,r.outputFormat=t.outputFormat||"AsPathMap",r.isProgressive=t.isProgressive||!1,r.subscribeCount=0,r.subscribeLimit=t.retryLimit||10,r.initialize().invokeSourceRequest(e).ensureCollect(e).subscribe(t)}var o=t(32),s=(t(159)&&t(158)).Observable,a=t(84),c=t(105),u={outputFormat:{value:"AsJSONG"}},h={isProgressive:{value:!0}};n.create=function(t,e){var r=new n(i);return r.args=e,r.type=this,r.model=t,r},(n.prototype=Object.create(s.prototype)).constructor=n,n.prototype._mixin=function(){var t=this,e=a(arguments);return new t.constructor(function(r){return t.subscribe(e.reduce(function(t,e){return Object.create(t,e)},r))})},n.prototype._toJSONG=function(){return this._mixin(u)},n.prototype.progressively=function(){return this._mixin(h)},n.prototype.subscribe=function(t,e,r){var n=t;n&&"object"==typeof n||(n={onNext:t||c,onError:e||c,onCompleted:r||c});var i=this._subscribe(n);switch(typeof i){case"function":return{dispose:i};case"object":return i||{dispose:c};default:return{dispose:c}}},n.prototype.then=function(t,e){var r=this;return new o.Promise(function(t,e){var n,i=!1;r.toArray().subscribe(function(t){n=t.length<=1?t[0]:t},function(t){i=!0,e(t)},function(){!1===i&&t(n)})}).then(t,e)},e.exports=n},{105:105,158:158,159:159,32:32,84:84}],65:[function(t,e,r){function n(t){f.call(this,t||i)}function i(t){return this.isCompleted?s.call(this,t):o.call(this,t)}function o(t){if(this.subscribeCount++>this.subscribeLimit)return t.onError("Loop kill switch thrown."),l.empty;for(var e=[],r=[],n=this.model,i=this.isMaster,o=n._root,u=this.outputFormat,h=o.errorSelector,p=this.method,f=this.groups,d=-1,v=f.length;++d0){var _=(0,n["_"+p+y+u])(n,b,null,h);r.push.apply(r,_[1]),"PathValues"===y?e.push.apply(e,b.map(a)):"JSONGs"===y?e.push.apply(e,m(b,c)):e.push.apply(e,_[0])}}return this.requestedPaths=e,i?(this.isCompleted=!0,s.call(this,t)):void t.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}function s(t){var e=new p(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(e=e._toJSONG()),this.isProgressive&&(e=e.progressively()),e.subscribe(t)}function a(t){return t.path}function c(t){return t.paths}var u=t(159),h=u.Observable,l=u.Disposable,p=t(67),f=t(62),d=t(9),m=t(82),v=new Array(0);n.create=f.create,(n.prototype=Object.create(f.prototype)).method="set",n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(t){var e=this,r=this.catch(function(n){var i;if(n&&!0===n.invokeSourceRequest){var o={},s=t._path,a=n.optimizedPaths;t._path=v,t._getPathValuesAsJSONG(t._materialize().withoutDataSource(),a,[o]),t._path=s,i=t._request.set(o).do(function(t){e.isCompleted=a.length===t.paths.length},function(){e.isCompleted=!0}).materialize().flatMap(function(t){if("C"===t.kind)return h.empty();if("E"===t.kind){var e=t.exception;if(d.is(e))return h.throw(t.exception)}return r})}else i=h.throw(n);return i});return new this.constructor(function(t){return r.subscribe(t)})},e.exports=n},{159:159,62:62,67:67,82:82,9:9}],66:[function(t,e,r){var n=function(t){this.disposed=!1,this.currentDisposable=t};n.prototype={dispose:function(){if(!this.disposed&&this.currentDisposable){this.disposed=!0;var t=this.currentDisposable;t.dispose?t.dispose():t()}}},e.exports=n},{}],67:[function(t,e,r){var n=t(64),i=t(68),o=t(69),s={dispose:function(){}},a=t(159).Observable,c=e.exports=function(t,e,r,n){this.model=t,this.currentRemainingPaths=e,this.isJSONGraph=r||!1,this.isProgressive=n||!1};c.prototype=Object.create(a.prototype),c.prototype.subscribe=n.prototype.subscribe,c.prototype.then=n.prototype.then,c.prototype._toJSONG=function(){return new c(this.model,this.currentRemainingPaths,!0,this.isProgressive)},c.prototype.progressively=function(){return new c(this.model,this.currentRemainingPaths,this.isJSONGraph,!0)},c.prototype._subscribe=function(t){var e=[{}],r=[],n=t.isJSONG=this.isJSONGraph,a=this.isProgressive,c=i(this.model,this.currentRemainingPaths,t,a,n,e,r);return c?o(this,this.model,c,t,e,r,1):s}},{159:159,64:64,68:68,69:69}],68:[function(t,e,r){var n=t(19),i=n.getWithPathsAsJSONGraph,o=n.getWithPathsAsPathMap;e.exports=function(t,e,r,n,s,a,c){var u;if((u=s?i(t,e,a):o(t,e,a)).criticalError)return r.onError(u.criticalError),null;var h=u.hasValue,l=!u.requestedMissingPaths||!t._source,p=a[0].json||a[0].jsonGraph;if(u.errors)for(var f=u.errors,d=c.length,m=0,v=f.length;v>m;++m,++d)c[d]=f[m];if(h&&n||p&&l)try{++t._root.syncRefCount,r.onNext(a[0])}catch(t){throw t}finally{--t._root.syncRefCount}return l?(c.length?r.onError(c):r.onCompleted(),null):u}},{19:19}],69:[function(t,e,r){var n=t(68),i=t(10),o=t(30).fastCat,s=t(49),a=t(88),c=t(66),u=t(46);e.exports=function t(e,r,h,l,p,f,d){if(10===d)throw new i;var m=r._request,v=h.requestedMissingPaths,g=h.optimizedMissingPaths,y=new c,b=[],_=r._path;if(_.length)for(var x=0,w=v.length;w>x;++x)b[x]=o(_,v[x]);else b=v;var S=m.get(b,g,function(){var i=n(r,v,l,e.isProgressive,e.isJSONGraph,p,f);if(i)y.currentDisposable=t(e,r,i,l,p,f,d+1);else{var o=r._root,c=o.cache,h=c[u];s(o,o.expired,a(c),r._maxSize,r._collectRatio,h)}});return y.currentDisposable=S,y}},{10:10,30:30,46:46,49:49,66:66,68:68,88:88}],70:[function(t,e,r){var n=t(67);e.exports=function(t){return new n(this,t)}},{67:67}],71:[function(t,e,r){var n=t(134),i=t(64),o=t(72),s=t(116),a=t(67);e.exports=function(){var t=s(arguments,o,"get");if(!0!==t)return new i(function(e){e.onError(t)});var e=n.fromPathsOrPathValues(arguments);return new a(this,e)}},{116:116,134:134,64:64,67:67,72:72}],72:[function(t,e,r){e.exports={path:!0,pathSyntax:!0}},{}],73:[function(t,e,r){function n(){}var i=t(123),o=t(159).Disposable;n.prototype.schedule=function(t){return i(t),o.empty},n.prototype.scheduleWithState=function(t,e){var r=this;return i(function(){e(r,t)}),o.empty},e.exports=n},{123:123,159:159}],74:[function(t,e,r){function n(){}var i=t(159).Disposable;n.prototype.schedule=function(t){return t(),i.empty},n.prototype.scheduleWithState=function(t,e){return e(this,t),i.empty},e.exports=n},{159:159}],75:[function(t,e,r){function n(t){this.delay=t}var i=t(159).Disposable;n.prototype.schedule=function(t){var e=setTimeout(t,this.delay);return i.create(function(){void 0!==e&&(clearTimeout(e),e=void 0)})},n.prototype.scheduleWithState=function(t,e){var r=this,n=setTimeout(function(){e(r,t)},this.delay);return i.create(function(){void 0!==n&&(clearTimeout(n),n=void 0)})},e.exports=n},{159:159}],76:[function(t,e,r){function n(t,e,r,i,s,a,c,u,h,l,p,d,m,v,g,b,_){for(var x={},w=ex,!0,i,s,u,p,m,y,b);if(e=T[0],v(e))return s.index=x,T;M=T[1],n=T[2],E=T[3]}while(x++=x)break;l.index=w}}function i(t,e,r,n,i,s,a,u,p,m){var v=r.value;if(i.splice(0,i.length),i.push.apply(i,v),x(r))return i.index=v.length,M(r,a,u),[void 0,e];y(u,r);var g=r,b=e;if(null!=(r=r[l]))b=r[h]||e,i.index=v.length;else{var _=0,w=v.length-1;b=r=e;do{var E=o(e,b,r,v[_],t,w>_,!0,n,i,s,a,u,p,m);if(r=E[0],S(r))return i.index=_,E;b=E[1]}while(_++S,!0,n,i,s,h,f,d,g);if(r=E[0],y(r))return i.index=S,E;w=E[1]}while(S++o&&(o=0),r>0&&o>r&&(o=r);for(var s=new Array(o);++iL)return}if(O&&j&&!P)return d(v(e,r,t,b,M),t,b);if(P||!j){if(P===s&&l(T)&&(r=T(y(_,b),r)),P&&e===r)null==e[i]&&(e=f(e,O,e.value),t=g(t,-e.$size,M,w),e=d(e,t,b,w));else{var N=!0;!O&&A||(N=c(r)-1);return t}},{39:39,43:43,44:44,46:46}],115:[function(t,e,r){var n=t(36),i=t(46),o=t(39),s=t(108),a=t(114);e.exports=function(t,e,r,c){var u=t;do{var h=u[o];0>=(u.$size=(u.$size||0)-e)&&null!=h?s(u,h,u[n],r):u[i]!==c&&a(u,c),u=h}while(u);return t}},{108:108,114:114,36:36,39:39,46:46}],116:[function(t,e,r){var n=Array.isArray,i=t(101),o=t(99),s=t(98),a=t(134);e.exports=function(t,e,r){for(var c=0,u=t.length;u>c;++c){var h=t[c],l=!1;if(n(h)&&e.path?l=!0:"string"==typeof h&&e.pathSyntax?l=!0:i(h)&&e.pathValue?(h.path=a.fromPath(h.path),l=!0):o(h)&&e.jsonGraph?l=!0:s(h)&&e.json?l=!0:"function"==typeof h&&c+1===u&&e.selector&&(l=!0),!l)return new Error("Unrecognized argument "+typeof h+" ["+String(h)+"] to Model#"+r)}return!0}},{101:101,134:134,98:98,99:99}],117:[function(t,e,r){var n=t(130).atom,i=t(106),o=t(122),s=t(37),a=t(85),c=Array.isArray,u=t(88),h=t(87);e.exports=function(t,e,r){var l=0,p=t,f=e;if(f?(p=a(p),l=u(p),p.$type=f):(p=n(r),f=p.$type,p[s]=!0),null==r)l=51;else if(null==l||0>=l)switch(typeof r){case"object":l=c(r)?50+r.length:51;break;case"string":l=50+r.length;break;default:l=51}var d=h(p);return"number"==typeof d&&o>d&&(p.$expires=i()+-1*d),p.$size=l,p}},{106:106,122:122,130:130,37:37,85:85,87:87,88:88}],118:[function(t,e,r){e.exports="atom"},{}],119:[function(t,e,r){e.exports="error"},{}],120:[function(t,e,r){e.exports="ref"},{}],121:[function(t,e,r){e.exports=1},{}],122:[function(t,e,r){e.exports=0},{}],123:[function(t,e,r){"use strict";function n(t){var e;(e=s.length?s.pop():new i).task=t,o(e)}function i(){this.task=null}var o=t(124),s=[],a=[],c=o.makeRequestCallFromTimer(function(){if(a.length)throw a.shift()});e.exports=n,i.prototype.call=function(){try{this.task.call()}catch(t){n.onerror?n.onerror(t):(a.push(t),c())}finally{this.task=null,s[s.length]=this}}},{124:124}],124:[function(t,e,r){(function(t){"use strict";function r(t){s.length||(o(),a=!0),s[s.length]=t}function n(){for(;cu){for(var e=0,r=s.length-c;r>e;e++)s[e]=s[e+c];s.length-=c,c=0}}s.length=0,c=0,a=!1}function i(t){return function(){function e(){clearTimeout(r),clearInterval(n),t()}var r=setTimeout(e,0),n=setInterval(e,50)}}e.exports=r;var o,s=[],a=!1,c=0,u=1024,h=t.MutationObserver||t.WebKitMutationObserver;o="function"==typeof h?function(t){var e=1,r=new h(t),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){e=-e,n.data=e}}(n):i(n),r.requestFlush=o,r.makeRequestCallFromTimer=i}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(t,e,r){"use strict";function n(t,e){var r;for(r in e)t[r]=e[r];return t}function i(t,e){this._jsongUrl=t,"number"==typeof e&&(e={timeout:e}),this._config=n({timeout:15e3,headers:{}},e||{})}var o=t(129),s=t(126);Array.isArray,i.prototype={constructor:i,buildQueryObject:s,get:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:t,method:"get"}),this._config);return o("GET",e,this)},set:function(t){var e="POST",r=n(this.buildQueryObject(this._jsongUrl,e,{jsonGraph:t,method:"set"}),this._config);return r.headers["Content-Type"]="application/x-www-form-urlencoded",o(e,r,this)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var s="POST",a=[];a.push("method=call"),a.push("callPath="+encodeURIComponent(JSON.stringify(t))),a.push("arguments="+encodeURIComponent(JSON.stringify(e))),a.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),a.push("paths="+encodeURIComponent(JSON.stringify(i)));var c=n(this.buildQueryObject(this._jsongUrl,s,a.join("&")),this._config);return c.headers["Content-Type"]="application/x-www-form-urlencoded",o(s,c,this)}},i.XMLHttpSource=i,i.default=i,e.exports=i},{126:126,129:129}],126:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=[],i={url:t},o=-1!==t.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];n.push(t+"="+encodeURIComponent(e))}),"GET"===e?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],127:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e=new t.XMLHttpRequest;if("withCredentials"in e)return e;if(t.XDomainRequest)return new XDomainRequest;throw new Error("CORS is not supported by your browser")}}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],128:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e,r,n;if(t.XMLHttpRequest)return new t.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;3>n;n++)try{if(e=r[n],new t.ActiveXObject(e))break}catch(t){}return new t.ActiveXObject(e)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(t,e,r){"use strict";function n(){}function i(t,e,r){r||(r=new Error(e)),t.onError(r)}function o(t,e,r){var n,o;if(e&&t){o=e.responseType,n="response"in e?e.response:e.responseText;var s=1223===e.status?204:e.status;if(s>=200&&399>=s){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(t,"invalid json",r)}return t.onNext(n),void t.onCompleted()}return 401===s||403===s||407===s?i(t,n):410===s?i(t,n):408===s||504===s?i(t,n):i(t,n||"Response code "+s)}}function s(t,e,r,n){i(t,r||e.statusText||"request error",n)}var a=t(128),c=t(127),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(t){var e=new n;return e.subscribe=function(e,r,n){var i,o;return i="function"==typeof e?{onNext:e,onError:r||h,onCompleted:n||h}:e,"function"==typeof(o=t(i))?{dispose:o}:o},e},e.exports=function(t,e,r){return n.create(function(n){var i,h,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)u.call(e,f)&&(d[f]=e[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?c():a()}catch(t){n.onError(t)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,l=d.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(t){if("json"!==d.responseType)throw t}i.onreadystatechange=function(t){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(t){h||(h=!0,s(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{127:127,128:128}],130:[function(t,e,r){function n(t,e,r){var n=Object.create(null);if(null!=r){for(var i in r)n[i]=r[i];return n.$type=t,n.value=e,n}return{$type:t,value:e}}var i=t(134);e.exports={ref:function(t,e){return n("ref",i.fromPath(t),e)},atom:function(t,e){return n("atom",t,e)},undefined:function(){return n("atom")},error:function(t,e){return n("error",t,e)},pathValue:function(t,e){return{path:i.fromPath(t),value:e}},pathInvalidation:function(t){return{path:i.fromPath(t),invalidated:!0}}}},{134:134}],131:[function(t,e,r){e.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],132:[function(t,e,r){var n={token:"token",dotSeparator:".",commaSeparator:",",openingBracket:"[",closingBracket:"]",openingBrace:"{",closingBrace:"}",escape:"\\",space:" ",colon:":",quote:"quote",unknown:"unknown"};e.exports=n},{}],133:[function(t,e,r){e.exports={indexer:{nested:"Indexers cannot be nested.",needQuotes:"unquoted indexers must be numeric.",empty:"cannot have empty indexers.",leadingDot:"Indexers cannot have leading dots.",leadingComma:"Indexers cannot have leading comma.",requiresComma:"Indexers require commas between indexer args.",routedTokens:"Only one token can be used per indexer when specifying routed tokens."},range:{precedingNaN:"ranges must be preceded by numbers.",suceedingNaN:"ranges must be suceeded by numbers."},routed:{invalid:"Invalid routed token. only integers|ranges|keys are supported."},quote:{empty:"cannot have empty quoted keys.",illegalEscape:"Invalid escape character. Only quotes are escapable."},unexpectedToken:"Unexpected token.",invalidIdentifier:"Invalid Identifier.",invalidPath:"Please provide a valid path.",throwError:function(t,e,r){if(r)throw t+" -- "+e.parseString+" with next token: "+r;throw t+" -- "+e.parseString}}},{}],134:[function(t,e,r){var n=t(140),i=t(135),o=t(131),s=function(t,e){return i(new n(t,e))};e.exports=s,s.fromPathsOrPathValues=function(t,e){if(!t)return[];for(var r=[],n=0,i=t.length;i>n;n++)"string"==typeof t[n]?r[n]=s(t[n],e):"string"==typeof t[n].path?r[n]={path:s(t[n].path,e),value:t[n].value}:r[n]=t[n];return r},s.fromPath=function(t,e){return t?"string"==typeof t?s(t,e):t:[]},s.RoutedTokens=o},{131:131,135:135,140:140}],135:[function(t,e,r){var n=t(132),i=t(133),o=t(136);e.exports=function(t){for(var e=t.next(),r={},s=[];!e.done;){switch(e.type){case n.token:var a=+e.token[0];isNaN(a)||i.throwError(i.invalidIdentifier,t),s[s.length]=e.token;break;case n.dotSeparator:0===s.length&&i.throwError(i.unexpectedToken,t);break;case n.space:break;case n.openingBracket:o(t,e,r,s);break;default:i.throwError(i.unexpectedToken,t)}e=t.next()}return 0===s.length&&i.throwError(i.invalidPath,t),s}},{132:132,133:133,136:136}],136:[function(t,e,r){var n=t(132),i=t(133),o=i.indexer,s=t(138),a=t(137),c=t(139);e.exports=function(t,e,r,u){var h=t.next(),l=!1,p=1,f=!1;for(r.indexer=[];!h.done;){switch(h.type){case n.token:case n.quote:r.indexer.length===p&&i.throwError(o.requiresComma,t)}switch(h.type){case n.openingBrace:f=!0,c(t,h,r,u);break;case n.token:var d=+h.token;isNaN(d)&&i.throwError(o.needQuotes,t),r.indexer[r.indexer.length]=d;break;case n.dotSeparator:r.indexer.length||i.throwError(o.leadingDot,t),s(t,h,r,u);break;case n.space:break;case n.closingBracket:l=!0;break;case n.quote:a(t,h,r,u);break;case n.openingBracket:i.throwError(o.nested,t);break;case n.commaSeparator:++p;break;default:i.throwError(i.unexpectedToken,t)}if(l)break;h=t.next()}0===r.indexer.length&&i.throwError(o.empty,t),r.indexer.length>1&&f&&i.throwError(o.routedTokens,t),1===r.indexer.length&&(r.indexer=r.indexer[0]),u[u.length]=r.indexer,r.indexer=void 0}},{132:132,133:133,137:137,138:138,139:139}],137:[function(t,e,r){var n=t(132),i=t(133),o=i.quote;e.exports=function(t,e,r,s){for(var a=t.next(),c="",u=e.token,h=!1,l=!1;!a.done;){switch(a.type){case n.token:case n.space:case n.dotSeparator:case n.commaSeparator:case n.openingBracket:case n.closingBracket:case n.openingBrace:case n.closingBrace:h&&i.throwError(o.illegalEscape,t),c+=a.token;break;case n.quote:h?(c+=a.token,h=!1):a.token!==u?c+=a.token:l=!0;break;case n.escape:h=!0;break;default:i.throwError(i.unexpectedToken,t)}if(l)break;a=t.next()}0===c.length&&i.throwError(o.empty,t),r.indexer[r.indexer.length]=c}},{132:132,133:133}],138:[function(t,e,r){var n=t(140),i=t(132),o=t(133);e.exports=function(t,e,r,s){var a,c=t.peek(),u=1,h=!1,l=!0,p=r.indexer.length-1,f=n.toNumber(r.indexer[p]);for(isNaN(f)&&o.throwError(o.range.precedingNaN,t);!h&&!c.done;){switch(c.type){case i.dotSeparator:3===u&&o.throwError(o.unexpectedToken,t),3===++u&&(l=!1);break;case i.token:a=n.toNumber(t.next().token),isNaN(a)&&o.throwError(o.range.suceedingNaN,t),h=!0;break;default:h=!0}if(h)break;t.next(),c=t.peek()}r.indexer[p]={from:f,to:l?a:a-1}}},{132:132,133:133,140:140}],139:[function(t,e,r){var n=t(132),i=t(131),o=t(133),s=o.routed;e.exports=function(t,e,r,a){var c=t.next(),u=!1,h="";switch(c.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(s.invalid,t)}var l=t.next();if(l.type===n.colon&&(u=!0,(l=t.next()).type!==n.token&&o.throwError(s.invalid,t),h=l.token,l=t.next()),l.type===n.closingBrace){var p={type:c.token,named:u,name:h};r.indexer[r.indexer.length]=p}else o.throwError(s.invalid,t)}},{131:131,132:132,133:133}],140:[function(t,e,r){function n(t,e,r){return{token:t,done:r,type:e}}function i(t,e,r){var i,b=!1,_="",x=r?y:g;do{if(i=e+1>=t.length)break;var w=t[e+1];if(void 0===w||-1!==x.indexOf(w)){if(_.length)break;++e;var S;switch(w){case s:S=o.dotSeparator;break;case a:S=o.commaSeparator;break;case c:S=o.openingBracket;break;case u:S=o.closingBracket;break;case h:S=o.openingBrace;break;case l:S=o.closingBrace;break;case v:S=o.space;break;case d:case m:S=o.quote;break;case f:S=o.escape;break;case p:S=o.colon;break;default:S=o.unknown}b=n(w,S,!1);break}_+=w,++e}while(!i);return!b&&_.length&&(b=n(_,o.token,!1)),b||(b={done:!0}),{token:b,idx:e}}var o=t(132),s=".",a=",",c="[",u="]",h="{",l="}",p=":",f="\\",d='"',m="'",v=" ",g="\\'\"[]., ",y="\\{}'\"[]., :",b=e.exports=function(t,e){this._string=t,this._idx=-1,this._extended=e,this.parseString=""};b.prototype={next:function(){var t=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._idx=t.idx,this._nextToken=!1,this.parseString+=t.token.token,t.token},peek:function(){var t=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._nextToken=t,t.token}},b.toNumber=function(t){return isNaN(+t)?NaN:+t}},{132:132}],141:[function(t,e,r){var n=t(147),i=t(148);e.exports=function(t){var e=t.reduce(function(t,e){var r=e.length;return t[r]||(t[r]=[]),t[r].push(e),t},{});return Object.keys(e).forEach(function(t){e[t]=i(e[t])}),n(e)}},{147:147,148:148}],142:[function(t,e,r){var n=t(144);e.exports=function t(e,r,i){for(var o=e,s=!0;s&&in&&(e.empty=!0)}function i(t,e){e.done=!1;var r=e.isObject=!(!t||"object"!=typeof t);e.isArray=r&&o(t),e.arrayOffset=0}var o=Array.isArray;e.exports=function(t,e){if(void 0===e.isArray&&i(t,e),e.isArray){var r;do{if(e.loaded&&e.rangeOffset>e.to&&(++e.arrayOffset,e.loaded=!1),e.arrayOffset>=t.length){e.done=!0;break}var o=t[e.arrayOffset];if("object"===typeof o){if(e.loaded||n(o,e),e.empty)continue;r=e.rangeOffset++}else++e.arrayOffset,r=o}while(void 0===r);return r}return e.isObject?(e.loaded||n(t,e),e.rangeOffset>e.to?void(e.done=!0):e.rangeOffset++):(e.done=!0,t)}},{}],145:[function(t,e,r){var n=t(142);e.exports=function(t,e){for(var r=[],i=-1,o=0,s=t.length;s>o;++o){var a=t[o];n(e[a.length],a,0)||(r[++i]=a)}return r}},{142:142}],146:[function(t,e,r){var n=t(142);e.exports=function(t,e){for(var r=[],i=-1,o=0,s=t.length;s>o;++o)n(e,t[o],0)||(r[++i]=t[o]);return r}},{142:142}],147:[function(t,e,r){function n(t){return null!==t&&typeof t===p}function i(t,e,r){var n,o,s,a,l,p,f,d,m,v,g,y,b,_,x=u(String(e)),w=Object.create(null),S=[],M=-1,E=0,T=[],C=0;if(a=[],l=-1,r-1>e){for(p=c(t,a);++l0)for(f=o.sets,d=-1,m=f.length,b=a[0];++d1&&a||b;++g1?[a]:a;++l0;++e<=r;){var i=t[e];if(!h(i)){n=!1;break}t[e]=parseInt(i,10)}if(!0===n){t.sort(a);var o=t[0],s=t[r];if(r>=s-o)return{from:o,to:s}}return t}function a(t,e){return t-e}function c(t,e,r){var n=0;for(var i in t)e[n++]=i;return n>1&&e.sort(r),n}function u(t){for(var e=5381,r=-1,n=t.length;++r=0}var l=Array.isArray,p="object";e.exports=function(t){var e,r=[],s=0;for(var a in t)if(h(a)&&n(e=t[a]))for(var c=i(e,0,parseInt(a,10)).sets,u=-1,l=c.length;++u1)for(var r=1;r0?e:0);return new n(function(e,n){i.push(function(t,r){t?n(t):e(r)});var o=t.apply(r,i);!o||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then||e(o)})}},n.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),r="function"==typeof e[e.length-1]?e.pop():null,o=this;try{return t.apply(this,arguments).nodeify(r,o)}catch(t){if(null===r||void 0===r)return new n(function(e,r){r(t)});i(function(){r.call(o,t)})}}},n.prototype.nodeify=function(t,e){return"function"!=typeof t?this:void this.then(function(r){i(function(){t.call(e,null,r)})},function(r){i(function(){t.call(e,r)})})}},{123:123,152:152}],158:[function(t,e,r){(function(n){(function(i){var o={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},s=o[typeof window]&&window||this,a=o[typeof r]&&r&&!r.nodeType&&r,c=o[typeof e]&&e&&!e.nodeType&&e,u=(c&&c.exports,o[typeof n]&&n);!u||u.global!==u&&u.window!==u||(s=u),"object"==typeof e&&e&&e.exports===a?e.exports=i(s,e.exports,t(159)):s.Rx=i(s,{},s.Rx)}).call(this,function(t,e,r,n){function i(){try{return f.apply(this,arguments)}catch(t){return I.e=t,I}}function o(t){if(!M(t))throw new TypeError("fn must be a function");return f=t,i}function s(t,e,r){return new g(function(n){var i=!1,o=null,s=[];return t.subscribe(function(t){var a,c;try{c=e(t)}catch(t){return void n.onError(t)}if(a=0,i)try{a=r(c,o)}catch(t){return void n.onError(t)}else i=!0,o=c;a>0&&(o=c,s=[]),a>=0&&s.push(t)},function(t){n.onError(t)},function(){n.onNext(s),n.onCompleted()})},t)}function a(t){if(0===t.length)throw new R;return t[0]}function c(t,e,r,n){if(0>e)throw new N;return new g(function(i){var o=e;return t.subscribe(function(t){0==o--&&(i.onNext(t),i.onCompleted())},function(t){i.onError(t)},function(){r?(i.onNext(n),i.onCompleted()):i.onError(new N)})},t)}function u(t,e,r){return new g(function(n){var i=r,o=!1;return t.subscribe(function(t){o?n.onError(new Error("Sequence contains more than one element")):(i=t,o=!0)},function(t){n.onError(t)},function(){o||e?(n.onNext(i),n.onCompleted()):n.onError(new R)})},t)}function h(t,e,r){return new g(function(n){return t.subscribe(function(t){n.onNext(t),n.onCompleted()},function(t){n.onError(t)},function(){e?(n.onNext(r),n.onCompleted()):n.onError(new R)})},t)}function l(t,e,r){return new g(function(n){var i=r,o=!1;return t.subscribe(function(t){i=t,o=!0},function(t){n.onError(t)},function(){o||e?(n.onNext(i),n.onCompleted()):n.onError(new R)})},t)}function p(t,e,r,i){var o=j(e,r,3);return new g(function(e){var r=0;return t.subscribe(function(n){var s;try{s=o(n,r,t)}catch(t){return void e.onError(t)}s?(e.onNext(i?r:n),e.onCompleted()):r++},function(t){e.onError(t)},function(){e.onNext(i?-1:n),e.onCompleted()})},t)}var f,d=r.Observable,m=d.prototype,v=r.CompositeDisposable,g=r.AnonymousObservable,y=r.Disposable.empty,b=(r.internals.isEqual,r.helpers),_=b.not,x=b.defaultComparer,w=b.identity,S=b.defaultSubComparer,M=b.isFunction,E=b.isPromise,T=b.isArrayLike,C=b.isIterable,O=r.internals.inherits,P=d.fromPromise,A=d.from,j=r.internals.bindCallback,R=r.EmptyError,L=r.ObservableBase,N=r.ArgumentOutOfRangeError,I={e:{}};m.aggregate=function(){var t,e,r=!1,n=this;return 2===arguments.length?(r=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new g(function(i){var o,s,a;return n.subscribe(function(n){!a&&(a=!0);try{o?s=t(s,n):(s=r?t(e,n):n,o=!0)}catch(t){return i.onError(t)}},function(t){i.onError(t)},function(){a&&i.onNext(s),!a&&r&&i.onNext(e),!a&&!r&&i.onError(new R),i.onCompleted()})},n)};var D=function(t){function e(e,r,n,i){this.source=e,this.acc=r,this.hasSeed=n,this.seed=i,t.call(this)}function r(t,e){this.o=t,this.acc=e.acc,this.hasSeed=e.hasSeed,this.seed=e.seed,this.hasAccumulation=!1,this.result=null,this.hasValue=!1,this.isStopped=!1}return O(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this))},r.prototype.onNext=function(t){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=o(this.acc)(this.result,t):(this.result=this.hasSeed?o(this.acc)(this.seed,t):t,this.hasAccumulation=!0),this.result===I&&this.o.onError(this.result.e))},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new R),this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(L);return m.reduce=function(t){var e=!1;if(2===arguments.length){e=!0;var r=arguments[1]}return new D(this,t,e,r)},m.some=function(t,e){var r=this;return t?r.filter(t,e).some():new g(function(t){return r.subscribe(function(){t.onNext(!0),t.onCompleted()},function(e){t.onError(e)},function(){t.onNext(!1),t.onCompleted()})},r)},m.any=function(){return this.some.apply(this,arguments)},m.isEmpty=function(){return this.any().map(_)},m.every=function(t,e){return this.filter(function(e){return!t(e)},e).some().map(_)},m.all=function(){return this.every.apply(this,arguments)},m.includes=function(t,e){function r(t,e){return 0===t&&0===e||t===e||isNaN(t)&&isNaN(e)}var n=this;return new g(function(i){var o=0,s=+e||0;return Math.abs(s)===1/0&&(s=0),0>s?(i.onNext(!1),i.onCompleted(),y):n.subscribe(function(e){o++>=s&&r(e,t)&&(i.onNext(!0),i.onCompleted())},function(t){i.onError(t)},function(){i.onNext(!1),i.onCompleted()})},this)},m.contains=function(t,e){m.includes(t,e)},m.count=function(t,e){return t?this.filter(t,e).count():this.reduce(function(t){return t+1},0)},m.indexOf=function(t,e){var r=this;return new g(function(n){var i=0,o=+e||0;return Math.abs(o)===1/0&&(o=0),0>o?(n.onNext(-1),n.onCompleted(),y):r.subscribe(function(e){i>=o&&e===t&&(n.onNext(i),n.onCompleted()),i++},function(t){n.onError(t)},function(){n.onNext(-1),n.onCompleted()})},r)},m.sum=function(t,e){return t&&M(t)?this.map(t,e).sum():this.reduce(function(t,e){return t+e},0)},m.minBy=function(t,e){return e||(e=S),s(this,t,function(t,r){return-1*e(t,r)})},m.min=function(t){return this.minBy(w,t).map(function(t){return a(t)})},m.maxBy=function(t,e){return e||(e=S),s(this,t,e)},m.max=function(t){return this.maxBy(w,t).map(function(t){return a(t)})},m.average=function(t,e){return t&&M(t)?this.map(t,e).average():this.reduce(function(t,e){return{sum:t.sum+e,count:t.count+1}},{sum:0,count:0}).map(function(t){if(0===t.count)throw new R;return t.sum/t.count})},m.sequenceEqual=function(t,e){var r=this;return e||(e=x),new g(function(n){var i=!1,o=!1,s=[],a=[],c=r.subscribe(function(t){var r,i;if(a.length>0){i=a.shift();try{r=e(i,t)}catch(t){return void n.onError(t)}r||(n.onNext(!1),n.onCompleted())}else o?(n.onNext(!1),n.onCompleted()):s.push(t)},function(t){n.onError(t)},function(){i=!0,0===s.length&&(a.length>0?(n.onNext(!1),n.onCompleted()):o&&(n.onNext(!0),n.onCompleted()))});(T(t)||C(t))&&(t=A(t)),E(t)&&(t=P(t));var u=t.subscribe(function(t){var r;if(s.length>0){var o=s.shift();try{r=e(o,t)}catch(t){return void n.onError(t)}r||(n.onNext(!1),n.onCompleted())}else i?(n.onNext(!1),n.onCompleted()):a.push(t)},function(t){n.onError(t)},function(){o=!0,0===a.length&&(s.length>0?(n.onNext(!1),n.onCompleted()):i&&(n.onNext(!0),n.onCompleted()))});return new v(c,u)},r)},m.elementAt=function(t){return c(this,t,!1)},m.elementAtOrDefault=function(t,e){return c(this,t,!0,e)},m.single=function(t,e){return t&&M(t)?this.where(t,e).single():u(this,!1)},m.singleOrDefault=function(t,e,r){return t&&M(t)?this.filter(t,r).singleOrDefault(null,e):u(this,!0,e)},m.first=function(t,e){return t?this.where(t,e).first():h(this,!1)},m.firstOrDefault=function(t,e,r){return t?this.where(t).firstOrDefault(null,e):h(this,!0,e)},m.last=function(t,e){return t?this.where(t,e).last():l(this,!1)},m.lastOrDefault=function(t,e,r){return t?this.where(t,r).lastOrDefault(null,e):l(this,!0,e)},m.find=function(t,e){return p(this,t,e,!1)},m.findIndex=function(t,e){return p(this,t,e,!0)},m.toSet=function(){if(void 0===t.Set)throw new TypeError;var e=this;return new g(function(r){var n=new t.Set;return e.subscribe(function(t){n.add(t)},function(t){r.onError(t)},function(){r.onNext(n),r.onCompleted()})},e)},m.toMap=function(e,r){if(void 0===t.Map)throw new TypeError;var n=this;return new g(function(i){var o=new t.Map;return n.subscribe(function(t){var n;try{n=e(t)}catch(t){return void i.onError(t)}var s=t;if(r)try{s=r(t)}catch(t){return void i.onError(t)}o.set(n,s)},function(t){i.onError(t)},function(){i.onNext(o),i.onCompleted()})},n)},r})}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(t,e,r){(function(t,n){(function(i){function o(t){for(var e=[],r=0,n=t.length;n>r;r++)e.push(t[r]);return e}function a(t,e){if(ct&&e.stack&&"object"==typeof t&&null!==t&&t.stack&&-1===t.stack.indexOf(lt)){for(var r=[],n=e;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(t.stack);var i=r.join("\n"+lt+"\n");t.stack=c(i)}}function c(t){for(var e=t.split("\n"),r=[],n=0,i=e.length;i>n;n++){var o=e[n];u(o)||h(o)||!o||r.push(o)}return r.join("\n")}function u(t){var e=p(t);if(!e)return!1;var r=e[0],n=e[1];return r===ut&&n>=ht&&jr>=n}function h(t){return-1!==t.indexOf("(module.js:")||-1!==t.indexOf("(node.js:")}function l(){if(ct)try{throw new Error}catch(r){var t=r.stack.split("\n"),e=p(t[0].indexOf("@")>0?t[1]:t[2]);if(!e)return;return ut=e[0],e[1]}}function p(t){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);if(e)return[e[1],Number(e[2])];var r=/at ([^ ]+):(\d+):(?:\d+)$/.exec(t);if(r)return[r[1],Number(r[2])];var n=/.*@(.+):(\d+)$/.exec(t);return n?[n[1],Number(n[2])]:void 0}function f(t){var e=[];if(!$t(t))return e;Gt.nonEnumArgs&&t.length&&Vt(t)&&(t=Wt.call(t));var r=Gt.enumPrototypes&&"function"==typeof t,n=Gt.enumErrorProps&&(t===kt||t instanceof Error);for(var i in t)r&&"prototype"==i||n&&("message"==i||"name"==i)||e.push(i);if(Gt.nonEnumShadows&&t!==Ft){var o=t.constructor,s=-1,a=Mt;if(t===(o&&o.prototype))var c=t===Bt?Lt:t===kt?Pt:Nt.call(t),u=zt[c];for(;++s-1:void 0});return r.pop(),n.pop(),f}function y(t,e){for(var r=new Array(t),n=0;t>n;n++)r[n]=e();return r}function b(){try{return Ht.apply(this,arguments)}catch(t){return Zt.e=t,Zt}}function _(t){if(!at(t))throw new TypeError("fn must be a function");return Ht=t,b}function x(t){throw t}function w(t,e){this.id=t,this.value=e}function S(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function M(t,e){e.isDisposed||(e.isDisposed=!0,e.disposable.dispose())}function E(t){this._s=s}function T(t){this._s=s,this._l=s.length,this._i=0}function C(t){this._a=t}function O(t){this._a=t,this._l=R(t),this._i=0}function P(t){return"number"==typeof t&&X.isFinite(t)}function A(t){var e=t[yt];if(!e&&"string"==typeof t)return new E(t)[yt]();if(!e&&t.length!==i)return new C(t)[yt]();if(!e)throw new TypeError("Object is not iterable");return t[yt]()}function j(t){var e=+t;return 0===e?e:isNaN(e)?e:0>e?-1:1}function R(t){var e=+t.length;return isNaN(e)?0:0!==e&&P(e)?0>=(e=j(e)*Math.floor(Math.abs(e)))?0:e>Ye?Ye:e:e}function L(t,e){this.observer=t,this.parent=e}function N(t,e){return fe(t)||(t=ge),new Ze(e,t)}function I(t,e){this.observer=t,this.parent=e}function D(t,e){this.observer=t,this.parent=e}function k(t,e){return new Tr(function(r){var n=new ae,i=new ce;return i.setDisposable(n),n.setDisposable(t.subscribe(function(t){r.onNext(t)},function(t){try{var n=e(t)}catch(t){return r.onError(t)}st(n)&&(n=$e(n));var o=new ae;i.setDisposable(o),o.setDisposable(n.subscribe(r))},function(t){r.onCompleted(t)})),i},t)}function F(){return!1}function B(t,e){var r=this;return new Tr(function(n){var i=0,o=t.length;return r.subscribe(function(r){if(o>i){var s=t[i++],a=_(e)(r,s);if(a===Zt)return n.onError(a.e);n.onNext(a)}else n.onCompleted()},function(t){n.onError(t)},function(){n.onCompleted()})},r)}function F(){return!1}function U(){return[]}function F(){return!1}function z(){return[]}function G(t,e){this.observer=t,this.accumulator=e.accumulator,this.hasSeed=e.hasSeed,this.seed=e.seed,this.hasAccumulation=!1,this.accumulation=null,this.hasValue=!1,this.isStopped=!1}function $(t,e,r){var n=wt(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i}).concatAll()}function V(t,e,r){for(var n=0,i=t.length;i>n;n++)if(r(t[n],e))return n;return-1}function H(t){this.comparer=t,this.set=[]}function q(t,e,r){var n=wt(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i}).mergeAll()}var W={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},X=W[typeof window]&&window||this,Y=W[typeof r]&&r&&!r.nodeType&&r,K=W[typeof e]&&e&&!e.nodeType&&e,Z=K&&K.exports===Y&&Y,J=W[typeof n]&&n;!J||J.global!==J&&J.window!==J||(X=J);var Q={internals:{},config:{Promise:X.Promise},helpers:{}},tt=Q.helpers.noop=function(){},et=(Q.helpers.notDefined=function(t){return void 0===t},Q.helpers.identity=function(t){return t}),rt=(Q.helpers.pluck=function(t){return function(e){return e[t]}},Q.helpers.just=function(t){return function(){return t}},Q.helpers.defaultNow=Date.now),nt=Q.helpers.defaultComparer=function(t,e){return qt(t,e)},it=Q.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},ot=(Q.helpers.defaultKeySerializer=function(t){return t.toString()},Q.helpers.defaultError=function(t){throw t}),st=Q.helpers.isPromise=function(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then},at=(Q.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},Q.helpers.not=function(t){return!t},Q.helpers.isFunction=function(){var t=function(t){return"function"==typeof t||!1};return t(/x/)&&(t=function(t){return"function"==typeof t&&"[object Function]"==Nt.call(t)}),t}());Q.config.longStackSupport=!1;var ct=!1;try{throw new Error}catch(t){ct=!!t.stack}var ut,ht=l(),lt="From previous event:";(Q.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)}).prototype=Error.prototype;var pt=Q.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};pt.prototype=Error.prototype;var ft=Q.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};ft.prototype=Error.prototype;var dt=Q.NotSupportedError=function(t){this.message=t||"This operation is not supported",Error.call(this)};dt.prototype=Error.prototype;var mt=Q.NotImplementedError=function(t){this.message=t||"This operation is not implemented",Error.call(this)};mt.prototype=Error.prototype;var vt=Q.helpers.notImplemented=function(){throw new mt},gt=Q.helpers.notSupported=function(){throw new dt},yt="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";X.Set&&"function"==typeof(new X.Set)["@@iterator"]&&(yt="@@iterator");var bt=Q.doneEnumerator={done:!0,value:i},_t=Q.helpers.isIterable=function(t){return t[yt]!==i},xt=Q.helpers.isArrayLike=function(t){return t&&t.length!==i};Q.helpers.iterator=yt;var wt=Q.internals.bindCallback=function(t,e,r){if(void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)}}return function(){return t.apply(e,arguments)}},St=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Mt=St.length,Et="[object Arguments]",Tt="[object Array]",Ct="[object Boolean]",Ot="[object Date]",Pt="[object Error]",At="[object Number]",jt="[object Object]",Rt="[object RegExp]",Lt="[object String]",Nt=Object.prototype.toString,It=Object.prototype.hasOwnProperty,Dt=Nt.call(arguments)==Et,kt=Error.prototype,Ft=Object.prototype,Bt=String.prototype,Ut=Ft.propertyIsEnumerable;try{!(Nt.call(document)==jt&&!({toString:0}+""))}catch(t){!0}var zt={};zt[Tt]=zt[Ot]=zt[At]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},zt[Ct]=zt[Lt]={constructor:!0,toString:!0,valueOf:!0},zt[Pt]=zt["[object Function]"]=zt[Rt]={constructor:!0,toString:!0},zt[jt]={constructor:!0};var Gt={};!function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var r in new t)e.push(r);for(r in arguments);Gt.enumErrorProps=Ut.call(kt,"message")||Ut.call(kt,"name"),Gt.enumPrototypes=Ut.call(t,"prototype"),Gt.nonEnumArgs=0!=r,Gt.nonEnumShadows=!/valueOf/.test(e)}(1);var $t=Q.internals.isObject=function(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1},Vt=function(t){return!(!t||"object"!=typeof t)&&Nt.call(t)==Et};Dt||(Vt=function(t){return!(!t||"object"!=typeof t)&&It.call(t,"callee")});var Ht,qt=Q.internals.isEqual=function(t,e){return g(t,e,[],[])},Wt=Array.prototype.slice,Xt=this.inherits=Q.internals.inherits=function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r},Yt=Q.internals.addProperties=function(t){for(var e=[],r=1,n=arguments.length;n>r;r++)e.push(arguments[r]);for(var i=0,o=e.length;o>i;i++){var s=e[i];for(var a in s)t[a]=s[a]}},Kt=Q.internals.addRef=function(t,e){return new Tr(function(r){return new te(e.getDisposable(),t.subscribe(r))})},Zt={e:{}};w.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var Jt=Q.internals.PriorityQueue=function(t){this.items=new Array(t),this.length=0},Qt=Jt.prototype;Qt.isHigherPriority=function(t,e){return this.items[t].compareTo(this.items[e])<0},Qt.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var r=this.items[t];this.items[t]=this.items[e],this.items[e]=r,this.percolate(e)}}},Qt.heapify=function(t){if(+t||(t=0),!(t>=this.length||0>t)){var e=2*t+1,r=2*t+2,n=t;if(et;t++)r[t]=arguments[t];for(t=0;e>t;t++)if(!oe(r[t]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},ee=te.prototype;ee.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ee.remove=function(t){var e=!1;if(!this.isDisposed){var r=this.disposables.indexOf(t);-1!==r&&(e=!0,this.disposables.splice(r,1),this.length--,t.dispose())}return e},ee.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var t=this.disposables.length,e=new Array(t),r=0;t>r;r++)e[r]=this.disposables[r];for(this.disposables=[],this.length=0,r=0;t>r;r++)e[r].dispose()}};var re=Q.Disposable=function(t){this.isDisposed=!1,this.action=t||tt};re.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ne=re.create=function(t){return new re(t)},ie=re.empty={dispose:tt},oe=re.isDisposable=function(t){return t&&at(t.dispose)},se=re.checkDisposed=function(t){if(t.isDisposed)throw new pt},ae=Q.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};ae.prototype.getDisposable=function(){return this.current},ae.prototype.setDisposable=function(t){if(this.current)throw new Error("Disposable has already been assigned");var e=this.isDisposed;!e&&(this.current=t),e&&t&&t.dispose()},ae.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var ce=Q.SerialDisposable=function(){this.isDisposed=!1,this.current=null};ce.prototype.getDisposable=function(){return this.current},ce.prototype.setDisposable=function(t){var e=this.isDisposed;if(!e){var r=this.current;this.current=t}r&&r.dispose(),e&&t&&t.dispose()},ce.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var ue=Q.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,0===--this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ie:new t(this)},e}();S.prototype.dispose=function(){this.scheduler.scheduleWithState(this,M)};var he=Q.internals.ScheduledItem=function(t,e,r,n,i){this.scheduler=t,this.state=e,this.action=r,this.dueTime=n,this.comparer=i||it,this.disposable=new ae};he.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},he.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},he.prototype.isCancelled=function(){return this.disposable.isDisposed},he.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var le=Q.Scheduler=function(){function t(t,e,r,n){this.now=t,this._schedule=e,this._scheduleRelative=r,this._scheduleAbsolute=n}function e(t,e){return e(),ie}t.isScheduler=function(e){return e instanceof t};var r=t.prototype;return r.schedule=function(t){return this._schedule(t,e)},r.scheduleWithState=function(t,e){return this._schedule(t,e)},r.scheduleWithRelative=function(t,r){return this._scheduleRelative(r,t,e)},r.scheduleWithRelativeAndState=function(t,e,r){return this._scheduleRelative(t,e,r)},r.scheduleWithAbsolute=function(t,r){return this._scheduleAbsolute(r,t,e)},r.scheduleWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute(t,e,r)},t.now=rt,t.normalize=function(t){return 0>t&&(t=0),t},t}(),pe=le.normalize,fe=le.isScheduler;!function(t){function e(t,e){function r(e){i(e,function(e){var n=!1,i=!1,s=t.scheduleWithState(e,function(t,e){return n?o.remove(s):i=!0,r(e),ie});i||(o.add(s),n=!0)})}var n=e[0],i=e[1],o=new te;return r(n),o}function r(t,e,r){function n(e){o(e,function(e,i){var o=!1,a=!1,c=t[r](e,i,function(t,e){return o?s.remove(c):a=!0,n(e),ie});a||(s.add(c),o=!0)})}var i=e[0],o=e[1],s=new te;return n(i),s}function n(t,e){t(function(r){e(t,r)})}t.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,n)},t.scheduleRecursiveWithState=function(t,r){return this.scheduleWithState([t,r],e)},t.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,n)},t.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative([t,n],e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},t.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,n)},t.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute([t,n],e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})}}(le.prototype),le.prototype,le.prototype.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,e)},le.prototype.schedulePeriodicWithState=function(t,e,r){if(void 0===X.setInterval)throw new dt;e=pe(e);var n=t,i=X.setInterval(function(){n=r(n)},e);return ne(function(){X.clearInterval(i)})},function(t){t.catchError=t.catch=function(t){return new xe(this,t)}}(le.prototype);var de,me,ve=(Q.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(t){throw this._cancel.dispose(),t}}function e(t,e,r,n){this._scheduler=t,this._state=e,this._period=r,this._action=n}return e.prototype.start=function(){var e=new ae;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}(),le.immediate=function(){return new le(rt,function(t,e){return e(this,t)},gt,gt)}()),ge=le.currentThread=function(){function t(){for(;e.length>0;){var t=e.dequeue();!t.isCancelled()&&t.invoke()}}var e,r=new le(rt,function(r,n){var i=new he(this,r,n,this.now());if(e)e.enqueue(i);else{(e=new Jt(4)).enqueue(i);var o=_(t)();if(e=null,o===Zt)return x(o.e)}return i.disposable},gt,gt);return r.scheduleRequired=function(){return!e},r}(),ye=function(){var t,e=tt;if(X.setTimeout)t=X.setTimeout,e=X.clearTimeout;else{if(!X.WScript)throw new dt;t=function(t,e){X.WScript.Sleep(e),t()}}return{setTimeout:t,clearTimeout:e}}(),be=ye.setTimeout,_e=ye.clearTimeout;!function(){function e(t){if(o)be(function(){e(t)},0);else{var r=i[t];if(r){o=!0;var n=_(r)();if(me(t),o=!1,n===Zt)return x(n.e)}}}function r(t){"string"==typeof t.data&&t.data.substring(0,c.length)===c&&e(t.data.substring(c.length))}var n=1,i={},o=!1;me=function(t){delete i[t]};var s=RegExp("^"+String(Nt).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),a="function"==typeof(a=J&&Z&&J.setImmediate)&&!s.test(a)&&a;if(at(a))de=function(t){var r=n++;return i[r]=t,a(function(){e(r)}),r};else if(void 0!==t&&"[object process]"==={}.toString.call(t))de=function(r){var o=n++;return i[o]=r,t.nextTick(function(){e(o)}),o};else if(function(){if(!X.postMessage||X.importScripts)return!1;var t=!1,e=X.onmessage;return X.onmessage=function(){t=!0},X.postMessage("","*"),X.onmessage=e,t}()){var c="ms.rx.schedule"+Math.random();X.addEventListener?X.addEventListener("message",r,!1):X.attachEvent?X.attachEvent("onmessage",r):X.onmessage=r,de=function(t){var e=n++;return i[e]=t,X.postMessage(c+currentId,"*"),e}}else if(X.MessageChannel){var u=new X.MessageChannel;u.port1.onmessage=function(t){e(t.data)},de=function(t){var e=n++;return i[e]=t,u.port2.postMessage(e),e}}else de="document"in X&&"onreadystatechange"in X.document.createElement("script")?function(t){var r=X.document.createElement("script"),o=n++;return i[o]=t,r.onreadystatechange=function(){e(o),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},X.document.documentElement.appendChild(r),o}:function(t){var r=n++;return i[r]=t,be(function(){e(r)},0),r}}();var xe=(le.timeout=le.default=function(){return new le(rt,function(t,e){var r=this,n=new ae,i=de(function(){!n.isDisposed&&n.setDisposable(e(r,t))});return new te(n,ne(function(){me(i)}))},function(t,e,r){var n=this,i=le.normalize(e),o=new ae;if(0===i)return n.scheduleWithState(t,r);var s=be(function(){!o.isDisposed&&o.setDisposable(r(n,t))},i);return new te(o,ne(function(){_e(s)}))},function(t,e,r){return this.scheduleWithRelativeAndState(t,e-this.now(),r)})}(),function(t){function e(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,r){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(r))}function n(t,e,r){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(r))}function i(i,o){this._scheduler=i,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,this._scheduler.now.bind(this._scheduler),e,r,n)}return Xt(i,t),i.prototype._clone=function(t){return new i(t,this._handler)},i.prototype._wrap=function(t){var e=this;return function(r,n){try{return t(e._getRecursiveWrapper(r),n)}catch(t){if(!e._handler(t))throw t;return ie}}},i.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},i.prototype.schedulePeriodicWithState=function(t,e,r){var n=this,i=!1,o=new ae;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return r(t)}catch(t){if(i=!0,!n._handler(t))throw t;return o.dispose(),null}})),o},i}(le)),we=Q.Notification=function(){function t(t,e,r,n,i,o){this.kind=t,this.value=e,this.exception=r,this._accept=n,this._acceptObservable=i,this.toString=o}return t.prototype.accept=function(t,e,r){return t&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,r)},t.prototype.toObservable=function(t){var e=this;return fe(t)||(t=ve),new Tr(function(r){return t.scheduleWithState(e,function(t,e){e._acceptObservable(r),"N"===e.kind&&r.onCompleted()})})},t}(),Se=we.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function r(){return"OnNext("+this.value+")"}return function(n){return new we("N",n,null,t,e,r)}}(),Me=we.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function r(){return"OnError("+this.exception+")"}return function(n){return new we("E",null,n,t,e,r)}}(),Ee=we.createOnCompleted=function(){function t(t,e,r){return r()}function e(t){return t.onCompleted()}function r(){return"OnCompleted()"}return function(){return new we("C",null,null,t,e,r)}}(),Te=Q.Observer=function(){};Te.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Te.prototype.asObserver=function(){return new Ae(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Te.prototype.checked=function(){return new je(this)};var Ce=Te.create=function(t,e,r){return t||(t=tt),e||(e=ot),r||(r=tt),new Ae(t,e,r)};Te.fromNotifier=function(t,e){return new Ae(function(r){return t.call(e,Se(r))},function(r){return t.call(e,Me(r))},function(){return t.call(e,Ee())})},Te.prototype.notifyOn=function(t){return new Re(t,this)},Te.prototype.makeSafe=function(t){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,t)};var Oe,Pe=Q.internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return Xt(e,t),e.prototype.next=vt,e.prototype.error=vt,e.prototype.completed=vt,e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.error(t),!0)},e}(Te),Ae=Q.AnonymousObserver=function(t){function e(e,r,n){t.call(this),this._onNext=e,this._onError=r,this._onCompleted=n}return Xt(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Pe),je=function(t){function e(e){t.call(this),this._observer=e,this._state=0}Xt(e,t);var r=e.prototype;return r.onNext=function(t){this.checkAccess();var e=_(this._observer.onNext).call(this._observer,t);this._state=0,e===Zt&&x(e.e)},r.onError=function(t){this.checkAccess();var e=_(this._observer.onError).call(this._observer,t);this._state=2,e===Zt&&x(e.e)},r.onCompleted=function(){this.checkAccess();var t=_(this._observer.onCompleted).call(this._observer);this._state=2,t===Zt&&x(t.e)},r.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},e}(Te),Re=function(t){function e(e,r,n){t.call(this,e,r),this._cancel=n}return Xt(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},e}(Q.internals.ScheduledObserver=function(t){function e(e,r){t.call(this),this.scheduler=e,this.observer=r,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ce}return Xt(e,t),e.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},e.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},e.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},e.prototype.ensureActive=function(){var t=!1,e=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(e.queue.length>0){r=e.queue.shift();try{r()}catch(t){throw e.queue=[],e.hasFaulted=!0,t}t()}else e.isAcquired=!1}))},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},e}(Pe)),Le=Q.Observable=function(){function t(t){if(Q.config.longStackSupport&&ct){try{throw new Error}catch(t){this.stack=t.stack.substring(t.stack.indexOf("\n")+1)}var e=this;this._subscribe=function(r){var n=r.onError.bind(r);return r.onError=function(t){a(t,e),n(t)},t.call(e,r)}}else this._subscribe=t}return Oe=t.prototype,Oe.subscribe=Oe.forEach=function(t,e,r){return this._subscribe("object"==typeof t?t:Ce(t,e,r))},Oe.subscribeOnNext=function(t,e){return this._subscribe(Ce(void 0!==e?function(r){t.call(e,r)}:t))},Oe.subscribeOnError=function(t,e){return this._subscribe(Ce(null,void 0!==e?function(r){t.call(e,r)}:t))},Oe.subscribeOnCompleted=function(t,e){return this._subscribe(Ce(null,null,void 0!==e?function(){t.call(e)}:t))},t}(),Ne=Q.ObservableBase=function(t){function e(t){return t&&at(t.dispose)?t:at(t)?ne(t):ie}function r(t,r){var n=r[0],i=r[1],o=_(i.subscribeCore).call(i,n);return o!==Zt||n.fail(Zt.e)?void n.setDisposable(e(o)):x(Zt.e)}function n(t){var e=new Cr(t),n=[e,this];return ge.scheduleRequired()?ge.scheduleWithState(n,r):r(null,n),e}function i(){t.call(this,n)}return Xt(i,t),i.prototype.subscribeCore=vt,i}(Le),Ie=Q.internals.Enumerable=function(){},De=function(t){function e(e){this.sources=e,t.call(this)}function r(t,e,r){this.o=t,this.s=e,this.e=r,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){var e,n=new ce,i=ve.scheduleRecursiveWithState(this.sources[yt](),function(i,o){if(!e){var s=_(i.next).call(i);if(s===Zt)return t.onError(s.e);if(s.done)return t.onCompleted();var a=s.value;st(a)&&(a=$e(a));var c=new ae;n.setDisposable(c),c.setDisposable(a.subscribe(new r(t,o,i)))}});return new te(n,i,ne(function(){e=!0}))},r.prototype.onNext=function(t){this.isStopped||this.o.onNext(t)},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Ie.prototype.concat=function(){return new De(this)};var ke=function(t){function e(e){this.sources=e,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){var e,r=this.sources[yt](),n=new ce,i=ve.scheduleRecursiveWithState(null,function(i,o){if(!e){var s=_(r.next).call(r);if(s===Zt)return t.onError(s.e);if(s.done)return null!==i?t.onError(i):t.onCompleted();var a=s.value;st(a)&&(a=$e(a));var c=new ae;n.setDisposable(c),c.setDisposable(a.subscribe(function(e){t.onNext(e)},o,function(){t.onCompleted()}))}});return new te(n,i,ne(function(){e=!0}))},e}(Ne);Ie.prototype.catchError=function(){return new ke(this)},Ie.prototype.catchErrorWhen=function(t){var e=this;return new Tr(function(r){var n,i=new Pr,o=new Pr,s=t(i).subscribe(o),a=e[yt](),c=new ce,u=ve.scheduleRecursive(function(t){if(!n){var e=_(a.next).call(a);if(e===Zt)return r.onError(e.e);if(e.done)return void r.onCompleted();var s=e.value;st(s)&&(s=$e(s));var u=new ae,h=new ae;c.setDisposable(new te(h,u)),u.setDisposable(s.subscribe(function(t){r.onNext(t)},function(e){h.setDisposable(o.subscribe(t,function(t){r.onError(t)},function(){r.onCompleted()})),i.onNext(e)},function(){r.onCompleted()}))}});return new te(s,c,u,ne(function(){n=!0}))})};var Fe=function(t){function e(t,e){this.v=t,this.c=null==e?-1:e}function r(t){this.v=t.v,this.l=t.c}return Xt(e,Ie),e.prototype[yt]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?bt:(this.l>0&&this.l--,{done:!1,value:this.v})},e}(),Be=Ie.repeat=function(t,e){return new Fe(t,e)},Ue=function(t){function e(t,e,r){this.s=t,this.fn=e?wt(e,r,3):null}function r(t){this.i=-1,this.s=t.s,this.l=this.s.length,this.fn=t.fn}return Xt(e,Ie),e.prototype[yt]=function(){return new r(this)},r.prototype.next=function(){return++this.in?(t.onNext(e[n]),i(n+1)):t.onCompleted()})};var Je=Le.fromArray=function(t,e){return fe(e)||(e=ge),new Ze(t,e)};Le.generate=function(t,e,r,n,i){return fe(i)||(i=ge),new Tr(function(o){var s=!0;return i.scheduleRecursiveWithState(t,function(t,i){var a,c;try{s?s=!1:t=r(t),(a=e(t))&&(c=n(t))}catch(t){return o.onError(t)}a?(o.onNext(c),i(t)):o.onCompleted()})})};var Qe=function(t){function e(){t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return ie},e}(Ne),tr=Le.never=function(){return new Qe};Le.of=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return new Ze(e,ge)},Le.ofWithScheduler=function(t){for(var e=arguments.length,r=new Array(e-1),n=1;e>n;n++)r[n-1]=arguments[n];return new Ze(r,t)};var er=function(t){function e(e,r){this.obj=e,this.keys=Object.keys(e),this.scheduler=r,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new I(t,this).run()},e}(Ne);I.prototype.run=function(){var t=this.observer,e=this.parent.obj,r=this.parent.keys,n=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(i,o){if(n>i){var s=r[i];t.onNext([s,e[s]]),o(i+1)}else t.onCompleted()})},Le.pairs=function(t,e){return e||(e=ge),new er(t,e)};var rr=function(t){function e(e,r,n){this.start=e,this.rangeCount=r,this.scheduler=n,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new nr(t,this).run()},e}(Ne),nr=function(){function t(t,e){this.observer=t,this.parent=e}return t.prototype.run=function(){var t=this.parent.start,e=this.parent.rangeCount,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})},t}();Le.range=function(t,e,r){return fe(r)||(r=ge),new rr(t,e,r)};var ir=function(t){function e(e,r,n){this.value=e,this.repeatCount=null==r?-1:r,this.scheduler=n,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new D(t,this).run()},e}(Ne);D.prototype.run=function(){var t=this.observer,e=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,function(r,n){return(-1===r||r>0)&&(t.onNext(e),r>0&&r--),0===r?t.onCompleted():void n(r)})},Le.repeat=function(t,e,r){return fe(r)||(r=ge),new ir(t,e,r)};var or=function(t){function e(e,r){this.value=e,this.scheduler=r,t.call(this)}function r(t,e){this.observer=t,this.parent=e}function n(t,e){var r=e[0],n=e[1];n.onNext(r),n.onCompleted()}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(t,this).run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],n)},e}(Ne),sr=(Le.return=Le.just=Le.returnValue=function(t,e){return fe(e)||(e=ve),new or(t,e)},function(t){function e(e,r){this.error=e,this.scheduler=r,t.call(this)}function r(t,e){this.o=t,this.p=e}function n(t,e){var r=e[0];e[1].onError(r)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(t,this).run()},r.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],n)},e}(Ne)),ar=Le.throw=Le.throwError=Le.throwException=function(t,e){return fe(e)||(e=ve),new sr(t,e)};Le.using=function(t,e){return new Tr(function(r){var n,i,o=ie;try{(n=t())&&(o=n),i=e(n)}catch(t){return new te(ar(t).subscribe(r),o)}return new te(i.subscribe(r),o)})},Oe.amb=function(t){var e=this;return new Tr(function(r){function n(){o||(o=s,u.dispose())}function i(){o||(o=a,c.dispose())}var o,s="L",a="R",c=new ae,u=new ae;return st(t)&&(t=$e(t)),c.setDisposable(e.subscribe(function(t){n(),o===s&&r.onNext(t)},function(t){n(),o===s&&r.onError(t)},function(){n(),o===s&&r.onCompleted()})),u.setDisposable(t.subscribe(function(t){i(),o===a&&r.onNext(t)},function(t){i(),o===a&&r.onError(t)},function(){i(),o===a&&r.onCompleted()})),new te(c,u)})},Le.amb=function(){var t=tr(),e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var r=0,n=arguments.length;n>r;r++)e.push(arguments[r]);for(var r=0,n=e.length;n>r;r++)t=function(t,e){return t.amb(e)}(t,e[r]);return t},Oe.catch=Oe.catchError=Oe.catchException=function(t){return"function"==typeof t?k(this,t):cr([this,t])};var cr=Le.catchError=Le.catch=Le.catchException=function(){var t=[];if(Array.isArray(arguments[0]))t=arguments[0];else for(var e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return ze(t).catchError()};Oe.combineLatest=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return Array.isArray(e[0])?e[0].unshift(this):e.unshift(this),ur.apply(this,e)};var ur=Le.combineLatest=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new Tr(function(t){function r(e){if(a[e]=!0,c||(c=a.every(et))){try{var r=n.apply(null,h)}catch(e){return t.onError(e)}t.onNext(r)}else u.filter(function(t,r){return r!==e}).every(et)&&t.onCompleted()}function i(e){u[e]=!0,u.every(et)&&t.onCompleted()}for(var o=e.length,s=function(){return!1},a=y(o,s),c=!1,u=y(o,s),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(n){var o=e[n],s=new ae;st(o)&&(o=$e(o)),s.setDisposable(o.subscribe(function(t){h[n]=t,r(n)},function(e){t.onError(e)},function(){i(n)})),l[n]=s}(p);return new te(l)},this)};Oe.concat=function(){for(var t=[],e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return t.unshift(this),lr.apply(null,t)};var hr=function(t){function e(e){this.sources=e,t.call(this)}function r(t,e){this.sources=t,this.o=e}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(this.sources,t).run()},r.prototype.run=function(){var t,e=new ce,r=this.sources,n=r.length,i=this.o,o=ve.scheduleRecursiveWithState(0,function(o,s){if(!t){if(o===n)return i.onCompleted();var a=r[o];st(a)&&(a=$e(a));var c=new ae;e.setDisposable(c),c.setDisposable(a.subscribe(function(t){i.onNext(t)},function(t){i.onError(t)},function(){s(o+1)}))}});return new te(e,o,ne(function(){t=!0}))},e}(Ne),lr=Le.concat=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{t=new Array(arguments.length);for(var e=0,r=arguments.length;r>e;e++)t[e]=arguments[e]}return new hr(t)};Oe.concatAll=Oe.concatObservable=function(){return this.merge(1)};var pr=function(t){function e(e,r){this.source=e,this.maxConcurrent=r,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){var e=new te;return e.add(this.source.subscribe(new fr(t,this.maxConcurrent,e))),e},e}(Ne),fr=function(){function t(t,e,r){this.o=t,this.max=e,this.g=r,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function e(t,e){this.parent=t,this.sad=e,this.isStopped=!1}return t.prototype.handleSubscribe=function(t){var r=new ae;this.g.add(r),st(t)&&(t=$e(t)),r.setDisposable(t.subscribe(new e(this,r)))},t.prototype.onNext=function(t){this.isStopped||(this.activeCount0?t.handleSubscribe(t.q.shift()):(t.activeCount--,t.done&&0===t.activeCount&&t.o.onCompleted())}},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(t),!0)},t}();Oe.merge=function(t){return"number"!=typeof t?dr(this,t):new pr(this,t)};var dr=Le.merge=function(){var t,e,r=[],n=arguments.length;if(arguments[0])if(fe(arguments[0]))for(t=arguments[0],e=1;n>e;e++)r.push(arguments[e]);else for(t=ve,e=0;n>e;e++)r.push(arguments[e]);else for(t=ve,e=1;n>e;e++)r.push(arguments[e]);return Array.isArray(r[0])&&(r=r[0]),N(t,r).mergeAll()},mr=Q.CompositeError=function(t){this.name="NotImplementedError",this.innerErrors=t,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};mr.prototype=Error.prototype,Le.mergeDelayError=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{var e=arguments.length;t=new Array(e);for(var r=0;e>r;r++)t[r]=arguments[r]}var n=N(null,t);return new Tr(function(t){function e(){0===s.length?t.onCompleted():1===s.length?t.onError(s[0]):t.onError(new mr(s))}var r=new te,i=new ae,o=!1,s=[];return r.add(i),i.setDisposable(n.subscribe(function(n){var i=new ae;r.add(i),st(n)&&(n=$e(n)),i.setDisposable(n.subscribe(function(e){t.onNext(e)},function(t){s.push(t),r.remove(i),o&&1===r.length&&e()},function(){r.remove(i),o&&1===r.length&&e()}))},function(t){s.push(t),o=!0,1===r.length&&e()},function(){o=!0,1===r.length&&e()})),r})};var vr=function(t){function e(e){this.source=e,t.call(this)}function r(t,e){this.o=t,this.g=e,this.isStopped=!1,this.done=!1}function n(t,e,r){this.parent=t,this.g=e,this.sad=r,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){var e=new te,n=new ae;return e.add(n),n.setDisposable(this.source.subscribe(new r(t,e))),e},r.prototype.onNext=function(t){if(!this.isStopped){var e=new ae;this.g.add(e),st(t)&&(t=$e(t)),e.setDisposable(t.subscribe(new n(this,this.g,e)))}},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},n.prototype.onNext=function(t){this.isStopped||this.parent.o.onNext(t)},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.parent.o.onError(t))},n.prototype.onCompleted=function(){if(!this.isStopped){var t=this.parent;this.isStopped=!0,t.g.remove(this.sad),t.done&&1===t.g.length&&t.o.onCompleted()}},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(t),!0)},e}(Ne);Oe.mergeAll=Oe.mergeObservable=function(){return new vr(this)},Oe.onErrorResumeNext=function(t){if(!t)throw new Error("Second observable is required");return gr([this,t])};var gr=Le.onErrorResumeNext=function(){var t=[];if(Array.isArray(arguments[0]))t=arguments[0];else for(var e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return new Tr(function(e){var r=0,n=new ce,i=ve.scheduleRecursive(function(i){var o,s;rr;r++)e[r]=arguments[r];var n=e.pop(),i=this;return Array.isArray(e[0])&&(e=e[0]),new Tr(function(t){for(var r=e.length,o=y(r,F),s=!1,a=new Array(r),c=new Array(r+1),u=0;r>u;u++)!function(r){var n=e[r],i=new ae;st(n)&&(n=$e(n)),i.setDisposable(n.subscribe(function(t){a[r]=t,o[r]=!0,s=o.every(et)},function(e){t.onError(e)},tt)),c[r]=i}(u);var h=new ae;return h.setDisposable(i.subscribe(function(e){var r=[e].concat(a);if(s){var i=_(n).apply(null,r);return i===Zt?t.onError(i.e):void t.onNext(i)}},function(e){t.onError(e)},function(){t.onCompleted()})),c[r]=h,new te(c)},this)},Oe.zip=function(){if(Array.isArray(arguments[0]))return B.apply(this,arguments);for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=this,i=e.pop();return e.unshift(n),new Tr(function(t){for(var r=e.length,o=y(r,U),s=y(r,F),a=new Array(r),c=0;r>c;c++)!function(r){var c=e[r],u=new ae;st(c)&&(c=$e(c)),u.setDisposable(c.subscribe(function(e){if(o[r].push(e),o.every(function(t){return t.length>0})){var a=o.map(function(t){return t.shift()}),c=_(i).apply(n,a);if(c===Zt)return t.onError(c.e);t.onNext(c)}else s.filter(function(t,e){return e!==r}).every(et)&&t.onCompleted()},function(e){t.onError(e)},function(){s[r]=!0,s.every(et)&&t.onCompleted()})),a[r]=u}(c);return new te(a)},n)},Le.zip=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.shift();return n.zip.apply(n,e)},Le.zipArray=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{var e=arguments.length;t=new Array(e);for(var r=0;e>r;r++)t[r]=arguments[r]}return new Tr(function(e){for(var r=t.length,n=y(r,z),i=y(r,F),o=new Array(r),s=0;r>s;s++)!function(r){o[r]=new ae,o[r].setDisposable(t[r].subscribe(function(t){if(n[r].push(t),n.every(function(t){return t.length>0})){var o=n.map(function(t){return t.shift()});e.onNext(o)}else if(i.filter(function(t,e){return e!==r}).every(et))return e.onCompleted()},function(t){e.onError(t)},function(){i[r]=!0,i.every(et)&&e.onCompleted()}))}(s);return new te(o)})},Oe.asObservable=function(){var t=this;return new Tr(function(e){return t.subscribe(e)},t)},Oe.bufferWithCount=function(t,e){return"number"!=typeof e&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Oe.dematerialize=function(){var t=this;return new Tr(function(e){return t.subscribe(function(t){return t.accept(e)},function(t){e.onError(t)},function(){e.onCompleted()})},this)},Oe.distinctUntilChanged=function(t,e){var r=this;return e||(e=nt),new Tr(function(n){var i,o=!1;return r.subscribe(function(r){var s=r;if(t&&(s=_(t)(r))===Zt)return n.onError(s.e);if(o){var a=_(e)(i,s);if(a===Zt)return n.onError(a.e)}o&&a||(o=!0,i=s,n.onNext(r))},function(t){n.onError(t)},function(){n.onCompleted()})},this)};var _r=function(t){function e(e,r,n,i){this.source=e,this.t=!r||at(r)?Ce(r||tt,n||tt,i||tt):r,t.call(this)}function r(t,e){this.o=t,this.t=e,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this.t))},r.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.t.onNext).call(this.t,t);e===Zt&&this.o.onError(e.e),this.o.onNext(t)}},r.prototype.onError=function(t){if(!this.isStopped){this.isStopped=!0;var e=_(this.t.onError).call(this.t,t);if(e===Zt)return this.o.onError(e.e);this.o.onError(t)}},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var t=_(this.t.onCompleted).call(this.t);if(t===Zt)return this.o.onError(t.e);this.o.onCompleted()}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.do=Oe.tap=Oe.doAction=function(t,e,r){return new _r(this,t,e,r)},Oe.doOnNext=Oe.tapOnNext=function(t,e){return this.tap(void 0!==e?function(r){t.call(e,r)}:t)},Oe.doOnError=Oe.tapOnError=function(t,e){return this.tap(tt,void 0!==e?function(r){t.call(e,r)}:t)},Oe.doOnCompleted=Oe.tapOnCompleted=function(t,e){return this.tap(tt,null,void 0!==e?function(){t.call(e)}:t)},Oe.finally=Oe.ensure=function(t){var e=this;return new Tr(function(r){var n;try{n=e.subscribe(r)}catch(e){throw t(),e}return ne(function(){try{n.dispose()}catch(t){throw t}finally{t()}})},this)},Oe.finallyAction=function(t){return this.ensure(t)};var xr=function(t){function e(e){this.source=e,t.call(this)}function r(t){this.o=t,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t))},r.prototype.onNext=tt,r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(t),!0)},e}(Ne);Oe.ignoreElements=function(){return new xr(this)},Oe.materialize=function(){var t=this;return new Tr(function(e){return t.subscribe(function(t){e.onNext(Se(t))},function(t){e.onNext(Me(t)),e.onCompleted()},function(){e.onNext(Ee()),e.onCompleted()})},t)},Oe.repeat=function(t){return Be(this,t).concat()},Oe.retry=function(t){return Be(this,t).catchError()},Oe.retryWhen=function(t){return Be(this).catchErrorWhen(t)};var wr=function(t){function e(e,r,n,i){this.source=e,this.accumulator=r,this.hasSeed=n,this.seed=i,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new G(t,this))},e}(Ne);G.prototype.onNext=function(t){if(!this.isStopped){!this.hasValue&&(this.hasValue=!0);try{this.hasAccumulation?this.accumulation=this.accumulator(this.accumulation,t):(this.accumulation=this.hasSeed?this.accumulator(this.seed,t):t,this.hasAccumulation=!0)}catch(t){return this.observer.onError(t)}this.observer.onNext(this.accumulation)}},G.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.observer.onError(t))},G.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},G.prototype.dispose=function(){this.isStopped=!0},G.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(t),!0)},Oe.scan=function(){var t,e,r=!1;return 2===arguments.length?(r=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new wr(this,e,r,t)},Oe.skipLast=function(t){if(0>t)throw new ft;var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&r.onNext(n.shift())},function(t){r.onError(t)},function(){r.onCompleted()})},e)},Oe.startWith=function(){var t,e=0;arguments.length&&fe(arguments[0])?(t=arguments[0],e=1):t=ve;for(var r=[],n=e,i=arguments.length;i>n;n++)r.push(arguments[n]);return ze([Je(r,t),this]).concat()},Oe.takeLast=function(t){if(0>t)throw new ft;var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&n.shift()},function(t){r.onError(t)},function(){for(;n.length>0;)r.onNext(n.shift());r.onCompleted()})},e)},Oe.takeLastBuffer=function(t){var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&n.shift()},function(t){r.onError(t)},function(){r.onNext(n),r.onCompleted()})},e)},Oe.windowWithCount=function(t,e){var r=this;if(+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new ft;if(null==e&&(e=t),+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new ft;return new Tr(function(n){function i(){var t=new Pr;c.push(t),n.onNext(Kt(t,s))}var o=new ae,s=new ue(o),a=0,c=[];return i(),o.setDisposable(r.subscribe(function(r){for(var n=0,o=c.length;o>n;n++)c[n].onNext(r);var s=a-t+1;s>=0&&s%e==0&&c.shift().onCompleted(),++a%e==0&&i()},function(t){for(;c.length>0;)c.shift().onError(t);n.onError(t)},function(){for(;c.length>0;)c.shift().onCompleted();n.onCompleted()})),s},r)},Oe.selectConcat=Oe.concatMap=function(t,e,r){return at(t)&&at(e)?this.concatMap(function(r,n){var i=t(r,n);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i.map(function(t,i){return e(r,t,n,i)})}):at(t)?$(this,t,r):$(this,function(){return t})},Oe.concatMapObserver=Oe.selectConcatObserver=function(t,e,r,n){var i=this,o=wt(t,n,2),s=wt(e,n,1),a=wt(r,n,0);return new Tr(function(t){var e=0;return i.subscribe(function(r){var n;try{n=o(r,e++)}catch(e){return void t.onError(e)}st(n)&&(n=$e(n)),t.onNext(n)},function(e){var r;try{r=s(e)}catch(e){return void t.onError(e)}st(r)&&(r=$e(r)),t.onNext(r),t.onCompleted()},function(){var e;try{e=a()}catch(e){return void t.onError(e)}st(e)&&(e=$e(e)),t.onNext(e),t.onCompleted()})},this).concatAll()},Oe.defaultIfEmpty=function(t){var e=this;return t===i&&(t=null),new Tr(function(r){var n=!1;return e.subscribe(function(t){n=!0,r.onNext(t)},function(t){r.onError(t)},function(){!n&&r.onNext(t),r.onCompleted()})},e)},H.prototype.push=function(t){var e=-1===V(this.set,t,this.comparer);return e&&this.set.push(t),e},Oe.distinct=function(t,e){var r=this;return e||(e=nt),new Tr(function(n){var i=new H(e);return r.subscribe(function(e){var r=e;if(t)try{r=t(e)}catch(t){return void n.onError(t)}i.push(r)&&n.onNext(e)},function(t){n.onError(t)},function(){n.onCompleted()})},this)};var Sr=function(t){function e(e,r,n){this.source=e,this.selector=wt(r,n,3),t.call(this)}function r(t,e){return function(r,n,i){return t.call(this,e.selector(r,n,i),n,i)}}function n(t,e,r){this.o=t,this.selector=e,this.source=r,this.i=0,this.isStopped=!1}return Xt(e,t),e.prototype.internalMap=function(t,n){return new e(this.source,r(t,this),n)},e.prototype.subscribeCore=function(t){return this.source.subscribe(new n(t,this.selector,this))},n.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.selector)(t,this.i++,this.source);return e===Zt?this.o.onError(e.e):void this.o.onNext(e)}},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.map=Oe.select=function(t,e){var r="function"==typeof t?t:function(){return t};return this instanceof Sr?this.internalMap(r,e):new Sr(this,r,e)},Oe.pluck=function(){var t=arguments,e=arguments.length;if(0===e)throw new Error("List of properties cannot be empty.");return this.map(function(r){for(var n=r,o=0;e>o;o++){var s=n[t[o]];if(void 0===s)return i;n=s}return n})},Oe.flatMapObserver=Oe.selectManyObserver=function(t,e,r,n){var i=this;return new Tr(function(o){var s=0;return i.subscribe(function(e){var r;try{r=t.call(n,e,s++)}catch(t){return void o.onError(t)}st(r)&&(r=$e(r)),o.onNext(r)},function(t){var r;try{r=e.call(n,t)}catch(t){return void o.onError(t)}st(r)&&(r=$e(r)),o.onNext(r),o.onCompleted()},function(){var t;try{t=r.call(n)}catch(t){return void o.onError(t)}st(t)&&(t=$e(t)),o.onNext(t),o.onCompleted()})},i).mergeAll()},Oe.selectMany=Oe.flatMap=function(t,e,r){return at(t)&&at(e)?this.flatMap(function(r,n){var i=t(r,n);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i.map(function(t,i){return e(r,t,n,i)})},r):at(t)?q(this,t,r):q(this,function(){return t})},Oe.selectSwitch=Oe.flatMapLatest=Oe.switchMap=function(t,e){return this.select(t,e).switchLatest()};var Mr=function(t){function e(e,r){this.source=e,this.skipCount=r,t.call(this)}function r(t,e){this.c=e,this.r=e,this.o=t,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this.skipCount))},r.prototype.onNext=function(t){this.isStopped||(this.r<=0?this.o.onNext(t):this.r--)},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.skip=function(t){if(0>t)throw new ft;return new Mr(this,t)},Oe.skipWhile=function(t,e){var r=this,n=wt(t,e,3);return new Tr(function(t){var e=0,i=!1;return r.subscribe(function(o){if(!i)try{i=!n(o,e++,r)}catch(e){return void t.onError(e)}i&&t.onNext(o)},function(e){t.onError(e)},function(){t.onCompleted()})},r)},Oe.take=function(t,e){if(0>t)throw new ft;if(0===t)return qe(e);var r=this;return new Tr(function(e){var n=t;return r.subscribe(function(t){n-- >0&&(e.onNext(t),0>=n&&e.onCompleted())},function(t){e.onError(t)},function(){e.onCompleted()})},r)},Oe.takeWhile=function(t,e){var r=this,n=wt(t,e,3);return new Tr(function(t){var e=0,i=!0;return r.subscribe(function(o){if(i){try{i=n(o,e++,r)}catch(e){return void t.onError(e)}i?t.onNext(o):t.onCompleted()}},function(e){t.onError(e)},function(){t.onCompleted()})},r)};var Er=function(t){function e(e,r,n){this.source=e,this.predicate=wt(r,n,3),t.call(this)}function r(t,e){return function(r,n,i){return e.predicate(r,n,i)&&t.call(this,r,n,i)}}function n(t,e,r){this.o=t,this.predicate=e,this.source=r,this.i=0,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new n(t,this.predicate,this))},e.prototype.internalFilter=function(t,n){return new e(this.source,r(t,this),n)},n.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.predicate)(t,this.i++,this.source);return e===Zt?this.o.onError(e.e):void(e&&this.o.onNext(t))}},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.filter=Oe.where=function(t,e){return this instanceof Er?this.internalFilter(t,e):new Er(this,t,e)},Oe.transduce=function(t){function e(t){return{"@@transducer/init":function(){return t},"@@transducer/step":function(t,e){return t.onNext(e)},"@@transducer/result":function(t){return t.onCompleted()}}}var r=this;return new Tr(function(n){var i=t(e(n));return r.subscribe(function(t){try{i["@@transducer/step"](n,t)}catch(t){n.onError(t)}},function(t){n.onError(t)},function(){i["@@transducer/result"](n)})},r)};var Tr=Q.AnonymousObservable=function(t){function e(t){return t&&at(t.dispose)?t:at(t)?ne(t):ie}function r(t,r){var n=r[0],i=_(r[1])(n);return i!==Zt||n.fail(Zt.e)?void n.setDisposable(e(i)):x(Zt.e)}function n(e,n){this.source=n,t.call(this,function(t){var n=new Cr(t),i=[n,e];return ge.scheduleRequired()?ge.scheduleWithState(i,r):r(null,i),n})}return Xt(n,t),n}(Le),Cr=function(t){function e(e){t.call(this),this.observer=e,this.m=new ae}Xt(e,t);var r=e.prototype;return r.next=function(t){var e=_(this.observer.onNext).call(this.observer,t);e===Zt&&(this.dispose(),x(e.e))},r.error=function(t){var e=_(this.observer.onError).call(this.observer,t);this.dispose(),e===Zt&&x(e.e)},r.completed=function(){var t=_(this.observer.onCompleted).call(this.observer);this.dispose(),t===Zt&&x(t.e)},r.setDisposable=function(t){this.m.setDisposable(t)},r.getDisposable=function(){return this.m.getDisposable()},r.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Pe),Or=function(t,e){this.subject=t,this.observer=e};Or.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Pr=Q.Subject=function(t){function e(t){return se(this),this.isStopped?this.hasError?(t.onError(this.error),ie):(t.onCompleted(),ie):(this.observers.push(t),new Or(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Xt(r,t),Yt(r.prototype,Te.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(se(this),!this.isStopped){this.isStopped=!0;for(var t=0,e=o(this.observers),r=e.length;r>t;t++)e[t].onCompleted();this.observers.length=0}},onError:function(t){if(se(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){if(se(this),!this.isStopped)for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new Ar(t,e)},r}(Le),Ar=(Q.AsyncSubject=function(t){function e(t){return se(this),this.isStopped?(this.hasError?t.onError(this.error):this.hasValue?(t.onNext(this.value),t.onCompleted()):t.onCompleted(),ie):(this.observers.push(t),new Or(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Xt(r,t),Yt(r.prototype,Te,{hasObservers:function(){return se(this),this.observers.length>0},onCompleted:function(){var t;if(se(this),!this.isStopped){this.isStopped=!0;var e=o(this.observers),r=e.length;if(this.hasValue)for(t=0;r>t;t++){var n=e[t];n.onNext(this.value),n.onCompleted()}else for(t=0;r>t;t++)e[t].onCompleted();this.observers.length=0}},onError:function(t){if(se(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=t;for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){se(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(Le),Q.AnonymousSubject=function(t){function e(t){return this.observable.subscribe(t)}function r(r,n){this.observer=r,this.observable=n,t.call(this,e)}return Xt(r,t),Yt(r.prototype,Te.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),r}(Le));Y&&K?Z?(K.exports=Q).Rx=Q:Y.Rx=Q:X.Rx=Q;var jr=l()}).call(this)}).call(this,t(150),void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{150:150}]},{},[1])(1)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],16:[function(t,e,r){(function(r){var n,i=void 0!==r?r:"undefined"!=typeof window?window:{},o=t("min-document");"undefined"!=typeof document?n=document:(n=i["__GLOBAL_DOCUMENT_CACHE@4"])||(n=i["__GLOBAL_DOCUMENT_CACHE@4"]=o),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":4}],17:[function(t,e,r){r.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,h=-7,l=r?i-1:0,p=r?-1:1,f=t[e+l];for(l+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=p,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*m}},{}],18:[function(t,e,r){(function(t){"use strict";var r="undefined"!=typeof window?window:void 0!==t?t:{};e.exports=function(t,e){return t in r?r[t]:(r[t]=e,e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e,r){"use strict";var n=t("./index.js");e.exports=function(t,e,r){var i="__INDIVIDUAL_ONE_VERSION_"+t,o=n(i+"_ENFORCE_SINGLETON",e);if(o!==e)throw new Error("Can only have one copy of "+t+".\nYou already have version "+o+" installed.\nThis means you cannot install version "+e);return n(i,r)}},{"./index.js":18}],20:[function(t,e,r){"use strict";e.exports=function(t){return"object"==typeof t&&null!==t}},{}],21:[function(t,e,r){"use strict";var n={};n.base32="0123456789bcdefghjkmnpqrstuvwxyz",n.encode=function(t,e,r){if(void 0===r){for(var i=1;i<=12;i++){var o=n.encode(t,e,i),s=n.decode(o);if(s.lat==t&&s.lon==e)return o}r=12}if(t=Number(t),e=Number(e),r=Number(r),isNaN(t)||isNaN(e)||isNaN(r))throw new Error("Invalid geohash");for(var a=0,c=0,u=!0,h="",l=-90,p=90,f=-180,d=180;h.length=m?(a=2*a+1,f=m):(a*=2,d=m)}else{var v=(l+p)/2;t>=v?(a=2*a+1,l=v):(a*=2,p=v)}u=!u,5==++c&&(h+=n.base32.charAt(a),c=0,a=0)}return h},n.decode=function(t){var e=n.bounds(t),r=e.sw.lat,i=e.sw.lon,o=e.ne.lat,s=e.ne.lon,a=(r+o)/2,c=(i+s)/2;return a=a.toFixed(Math.floor(2-Math.log(o-r)/Math.LN10)),c=c.toFixed(Math.floor(2-Math.log(s-i)/Math.LN10)),{lat:Number(a),lon:Number(c)}},n.bounds=function(t){if(0===t.length)throw new Error("Invalid geohash");t=t.toLowerCase();for(var e=!0,r=-90,i=90,o=-180,s=180,a=0;a=0;h--){var l=u>>h&1;if(e){var p=(o+s)/2;1==l?o=p:s=p}else{var f=(r+i)/2;1==l?r=f:i=f}e=!e}}return{sw:{lat:r,lon:o},ne:{lat:i,lon:s}}},n.adjacent=function(t,e){if(t=t.toLowerCase(),e=e.toLowerCase(),0===t.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(e))throw new Error("Invalid direction");var r={n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]},i={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]},o=t.slice(-1),s=t.slice(0,-1),a=t.length%2;return-1!=i[e][a].indexOf(o)&&""!==s&&(s=n.adjacent(s,e)),s+n.base32.charAt(r[e][a].indexOf(o))},n.neighbours=function(t){return{n:n.adjacent(t,"n"),ne:n.adjacent(n.adjacent(t,"n"),"e"),e:n.adjacent(t,"e"),se:n.adjacent(n.adjacent(t,"s"),"e"),s:n.adjacent(t,"s"),sw:n.adjacent(n.adjacent(t,"s"),"w"),w:n.adjacent(t,"w"),nw:n.adjacent(n.adjacent(t,"n"),"w")}},void 0!==e&&e.exports&&(e.exports=n)},{}],22:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(r=s+"/"+r,i="/"===s.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===s(t,-1);return(t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"))||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),s=Math.min(i.length,o.length),a=s,c=0;c>4,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return s(t,n,e);throw new Error("Expected varint not more than 10 bytes")}function o(t){return t.type===n.Bytes?t.readVarint()+t.pos:t.pos+1}function s(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function a(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),c(r,n,e),u(n,e)}function c(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}function u(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}function h(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function l(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function w(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function S(t,e,r){for(var n="",i=e;i239?4:o>223?3:o>191?2:1;if(i+a>r)break;var c,u,h;1===a?o<128&&(s=o):2===a?128==(192&(c=t[i+1]))&&(s=(31&o)<<6|63&c)<=127&&(s=null):3===a?(c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&((s=(15&o)<<12|(63&c)<<6|63&u)<=2047||s>=55296&&s<=57343)&&(s=null)):4===a&&(c=t[i+1],u=t[i+2],h=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&((s=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)<=65535||s>=1114112)&&(s=null)),null===s?(s=65533,a=1):s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|1023&s),n+=String.fromCharCode(s),i+=a}return n}function M(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}e.exports=n;var E=t("ieee754");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=w(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_(this.buf,this.pos)+4294967296*_(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=_(this.buf,this.pos)+4294967296*w(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=E.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=E.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return r=n[this.pos++],e=127&r,r<128?e:(r=n[this.pos++],e|=(127&r)<<7,r<128?e:(r=n[this.pos++],e|=(127&r)<<14,r<128?e:(r=n[this.pos++],e|=(127&r)<<21,r<128?e:(r=n[this.pos],e|=(15&r)<<28,i(e,t,this)))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=S(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=o(this);for(t=t||[];this.pos127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length);var e=++this.pos;this.pos=M(this.buf,t,this.pos);var r=this.pos-e;r>=128&&h(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),E.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),E.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&h(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){this.writeMessage(t,p,e)},writePackedBoolean:function(t,e){this.writeMessage(t,m,e)},writePackedFloat:function(t,e){this.writeMessage(t,f,e)},writePackedDouble:function(t,e){this.writeMessage(t,d,e)},writePackedFixed32:function(t,e){this.writeMessage(t,v,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,g,e)},writePackedFixed64:function(t,e){this.writeMessage(t,y,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,b,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},{ieee754:17}],24:[function(t,e,r){"use strict";function n(t,e,r,s,a){for(r=r||0,s=s||t.length-1,a=a||o;s>r;){if(s-r>600){var c=s-r+1,u=e-r+1,h=Math.log(c),l=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*l*(c-l)/c)*(u-c/2<0?-1:1);n(t,e,Math.max(r,Math.floor(e-u*l/c+p)),Math.min(s,Math.floor(e+(c-u)*l/c+p)),a)}var f=t[e],d=r,m=s;for(i(t,r,e),a(t[s],f)>0&&i(t,r,s);d0;)m--}0===a(t[r],f)?i(t,r,m):i(t,++m,s),m<=e&&(r=m+1),e<=m&&(s=m-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function o(t,e){return te?1:0}e.exports=n},{}],25:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function i(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function v(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,r,n,i){for(var o,s=[e,r];s.length;)(r=s.pop())-(e=s.pop())<=n||(o=e+Math.ceil((r-e)/n/2)*n,y(t,o,e,r,i),s.push(e,o,o,r))}e.exports=n;var y=t("quickselect");n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!m(t,e))return r;for(var i,o,s,a,c=[];e;){for(i=0,o=e.children.length;i=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var s=this._chooseSplitIndex(r,i,n),a=v(r.children.splice(s,r.children.length-s));a.height=r.height,a.leaf=r.leaf,o(r,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(r,a)},_splitRoot:function(t,e){this.data=v([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,i,o,a,c,u,l,p;for(u=l=1/0,n=e;n<=r-e;n++)a=f(i=s(t,0,n,this.toBBox),o=s(t,n,r,this.toBBox)),c=h(i)+h(o),a=e;i--)o=t.children[i],a(h,t.leaf?c(o):o),p+=l(h);return p},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)a(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():o(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},{quickselect:24}],26:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Subject"),o=t("./util/ObjectUnsubscribedError"),s=function(t){function e(e){t.call(this),this._value=e}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.ObjectUnsubscribedError;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.Subject);r.BehaviorSubject=s},{"./Subject":34,"./util/ObjectUnsubscribedError":160}],27:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r,n){t.call(this),this.parent=e,this.outerValue=r,this.outerIndex=n,this.index=0}return n(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(t("./Subscriber").Subscriber);r.InnerSubscriber=i},{"./Subscriber":36}],28:[function(t,e,r){"use strict";var n=t("./Observable"),i=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){switch(this.kind){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.error);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();r.Notification=i},{"./Observable":29}],29:[function(t,e,r){"use strict";var n=t("./util/root"),i=t("./util/toSubscriber"),o=t("./symbol/observable"),s=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,o=i.toSubscriber(t,e,r);if(n?n.call(o,this.source):o.add(this.source?this._subscribe(o):this._trySubscribe(o)),o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.syncErrorThrown=!0,t.syncErrorValue=e,t.error(e)}},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var i;i=r.subscribe(function(e){if(i)try{t(e)}catch(t){n(t),i.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[o.observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":155,"./util/root":172,"./util/toSubscriber":174}],30:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],31:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(t("./Subscriber").Subscriber);r.OuterSubscriber=i},{"./Subscriber":36}],32:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Subject"),o=t("./scheduler/queue"),s=t("./Subscription"),a=t("./operator/observeOn"),c=t("./util/ObjectUnsubscribedError"),u=t("./SubjectSubscription"),h=function(t){function e(e,r,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY),t.call(this),this.scheduler=n,this._events=[],this._bufferSize=e<1?1:e,this._windowTime=r<1?1:r}return n(e,t),e.prototype.next=function(e){var r=this._getNow();this._events.push(new l(r,e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,r=this._trimBufferThenGetEvents(),n=this.scheduler;if(this.closed)throw new c.ObjectUnsubscribedError;this.hasError?e=s.Subscription.EMPTY:this.isStopped?e=s.Subscription.EMPTY:(this.observers.push(t),e=new u.SubjectSubscription(this,t)),n&&t.add(t=new a.ObserveOnSubscriber(t,n));for(var i=r.length,o=0;oe&&(o=Math.max(o,i-e)),o>0&&n.splice(0,o),n},e}(i.Subject);r.ReplaySubject=h;var l=function(){return function(t,e){this.time=t,this.value=e}}()},{"./Subject":34,"./SubjectSubscription":35,"./Subscription":37,"./operator/observeOn":129,"./scheduler/queue":153,"./util/ObjectUnsubscribedError":160}],33:[function(t,e,r){"use strict";var n=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=Date.now?Date.now:function(){return+new Date},t}();r.Scheduler=n},{}],34:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Observable"),o=t("./Subscriber"),s=t("./Subscription"),a=t("./util/ObjectUnsubscribedError"),c=t("./SubjectSubscription"),u=t("./symbol/rxSubscriber"),h=function(t){function e(e){t.call(this,e),this.destination=e}return n(e,t),e}(o.Subscriber);r.SubjectSubscriber=h;var l=function(t){function e(){t.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return n(e,t),e.prototype[u.rxSubscriber]=function(){return new h(this)},e.prototype.lift=function(t){var e=new p(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new a.ObjectUnsubscribedError;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),i=0;i=n?i.complete():(i.next(e[r]),t.index=r+1,this.schedule(t)))},e.prototype._subscribe=function(t){var r=this,n=r.arrayLike,i=r.scheduler,o=n.length;if(i)return i.schedule(e.dispatch,0,{arrayLike:n,index:0,length:o,subscriber:t});for(var s=0;s1?new e(t,n):1===i?new o.ScalarObservable(t[0],n):new s.EmptyObservable(n)},e.dispatch=function(t){var e=t.array,r=t.index,n=t.count,i=t.subscriber;r>=n?i.complete():(i.next(e[r]),i.closed||(t.index=r+1,this.schedule(t)))},e.prototype._subscribe=function(t){var r=this.array,n=r.length,i=this.scheduler;if(i)return i.schedule(e.dispatch,0,{array:r,index:0,count:n,subscriber:t});for(var o=0;o1)this.connection=null;else{var r=this.connection,n=t._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},e}(s.Subscriber)},{"../Observable":29,"../Subject":34,"../Subscriber":36,"../Subscription":37}],88:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Observable"),o=t("../util/subscribeToResult"),s=t("../OuterSubscriber"),a=function(t){function e(e){t.call(this),this.observableFactory=e}return n(e,t),e.create=function(t){return new e(t)},e.prototype._subscribe=function(t){return new c(t,this.observableFactory)},e}(i.Observable);r.DeferObservable=a;var c=function(t){function e(e,r){t.call(this,e),this.factory=r,this.tryDefer()}return n(e,t),e.prototype.tryDefer=function(){try{this._callFactory()}catch(t){this._error(t)}},e.prototype._callFactory=function(){var t=this.factory();t&&this.add(o.subscribeToResult(this,t))},e}(s.OuterSubscriber)},{"../Observable":29,"../OuterSubscriber":31,"../util/subscribeToResult":173}],89:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e){t.call(this),this.scheduler=e}return n(e,t),e.create=function(t){return new e(t)},e.dispatch=function(t){t.subscriber.complete()},e.prototype._subscribe=function(t){var r=this.scheduler;if(r)return r.schedule(e.dispatch,0,{subscriber:t});t.complete()},e}(t("../Observable").Observable);r.EmptyObservable=i},{"../Observable":29}],90:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this),this.error=e,this.scheduler=r}return n(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.error;t.subscriber.error(e)},e.prototype._subscribe=function(t){var r=this.error,n=this.scheduler;if(t.syncErrorThrowable=!0,n)return n.schedule(e.dispatch,0,{error:r,subscriber:t});t.error(r)},e}(t("../Observable").Observable);r.ErrorObservable=i},{"../Observable":29}],91:[function(t,e,r){"use strict";function n(t){return!!t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}function i(t){return!!t&&"function"==typeof t.on&&"function"==typeof t.off}function o(t){return!!t&&"[object NodeList]"===d.call(t)}function s(t){return!!t&&"[object HTMLCollection]"===d.call(t)}function a(t){return!!t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}var c=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},u=t("../Observable"),h=t("../util/tryCatch"),l=t("../util/isFunction"),p=t("../util/errorObject"),f=t("../Subscription"),d=Object.prototype.toString,m=function(t){function e(e,r,n,i){t.call(this),this.sourceObj=e,this.eventName=r,this.selector=n,this.options=i}return c(e,t),e.create=function(t,r,n,i){return l.isFunction(n)&&(i=n,n=void 0),new e(t,r,i,n)},e.setupSubscription=function(t,r,c,u,h){var l;if(o(t)||s(t))for(var p=0,d=t.length;pd?d:e:e}function o(t){return"number"==typeof t&&c.root.isFinite(t)}function s(t){var e=+t;return 0===e?e:isNaN(e)?e:e<0?-1:1}var a=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},c=t("../util/root"),u=t("../Observable"),h=t("../symbol/iterator"),l=function(t){function e(e,r){if(t.call(this),this.scheduler=r,null==e)throw new Error("iterator cannot be null.");this.iterator=n(e)}return a(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.index,r=t.hasError,n=t.iterator,i=t.subscriber;if(r)i.error(t.error);else{var o=n.next();o.done?i.complete():(i.next(o.value),t.index=e+1,i.closed?"function"==typeof n.return&&n.return():this.schedule(t))}},e.prototype._subscribe=function(t){var r=this,n=r.iterator,i=r.scheduler;if(i)return i.schedule(e.dispatch,0,{index:0,iterator:n,subscriber:t});for(;;){var o=n.next();if(o.done){t.complete();break}if(t.next(o.value),t.closed){"function"==typeof n.return&&n.return();break}}},e}(u.Observable);r.IteratorObservable=l;var p=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length),this.str=t,this.idx=e,this.len=r}return t.prototype[h.iterator]=function(){return this},t.prototype.next=function(){return this.idx0&&this.destination.next(e),t.prototype._complete.call(this)},e}(i.Subscriber),a=function(t){function e(e,r,n){t.call(this,e),this.bufferSize=r,this.startBufferEvery=n,this.buffers=[],this.count=0}return n(e,t),e.prototype._next=function(t){var e=this,r=e.bufferSize,n=e.startBufferEvery,i=e.buffers,o=e.count;this.count++,o%n==0&&i.push([]);for(var s=i.length;s--;){var a=i[s];a.push(t),a.length===r&&(i.splice(s,1),this.destination.next(a))}},e.prototype._complete=function(){for(var e=this,r=e.buffers,n=e.destination;r.length>0;){var i=r.shift();i.length>0&&n.next(i)}t.prototype._complete.call(this)},e}(i.Subscriber)},{"../Subscriber":36}],110:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscription"),o=t("../util/tryCatch"),s=t("../util/errorObject"),a=t("../OuterSubscriber"),c=t("../util/subscribeToResult");r.bufferWhen=function(t){return this.lift(new u(t))};var u=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.closingSelector))},t}(),h=function(t){function e(e,r){t.call(this,e),this.closingSelector=r,this.subscribing=!1,this.openBuffer()}return n(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},e.prototype.notifyNext=function(t,e,r,n,i){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e=this.buffer;this.buffer&&this.destination.next(e),this.buffer=[];var r=o.tryCatch(this.closingSelector)();r===s.errorObject?this.error(s.errorObject.e):(t=new i.Subscription,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(c.subscribeToResult(this,r)),this.subscribing=!1)},e}(a.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscription":37,"../util/errorObject":163,"../util/subscribeToResult":173,"../util/tryCatch":175}],111:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r._catch=function(t){var e=new s(t),r=this.lift(e);return e.caught=r};var s=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.selector,this.caught))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.selector=r,this.caught=n}return n(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=void 0;try{r=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle(),this.add(o.subscribeToResult(this,r))}},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],112:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../observable/ArrayObservable"),o=t("../util/isArray"),s=t("../OuterSubscriber"),a=t("../util/subscribeToResult"),c={};r.combineLatest=function(){for(var t=[],e=0;e0&&r[0].time-n.now()<=0;)r.shift().notification.observe(i);if(r.length>0){var o=Math.max(0,r[0].time-n.now());this.schedule(t,o)}else e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,r=new h(e.now()+this.delay,t);this.queue.push(r),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(a.Notification.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t)},e.prototype._complete=function(){this.scheduleNotification(a.Notification.createComplete())},e}(s.Subscriber),h=function(){return function(t,e){this.time=t,this.notification=e}}()},{"../Notification":28,"../Subscriber":36,"../scheduler/async":152,"../util/isDate":166}],116:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult"),s=t("../util/Set");r.distinct=function(t,e){return this.lift(new a(t,e))};var a=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.keySelector,this.flushes))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.keySelector=r,this.values=new s.Set,n&&this.add(o.subscribeToResult(this,n))}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.values.clear()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,r=this.destination;try{e=this.keySelector(t)}catch(t){return void r.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var r=this.values;r.has(t)||(r.add(t),this.destination.next(e))},e}(i.OuterSubscriber);r.DistinctSubscriber=c},{"../OuterSubscriber":31,"../util/Set":161,"../util/subscribeToResult":173}],117:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/tryCatch"),s=t("../util/errorObject");r.distinctUntilChanged=function(t,e){return this.lift(new a(t,e))};var a=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.compare,this.keySelector))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.keySelector=n,this.hasKey=!1,"function"==typeof r&&(this.compare=r)}return n(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e=t;if(this.keySelector&&(e=o.tryCatch(this.keySelector)(t))===s.errorObject)return this.destination.error(s.errorObject.e);var r=!1;if(this.hasKey){if((r=o.tryCatch(this.compare)(this.key,e))===s.errorObject)return this.destination.error(s.errorObject.e)}else this.hasKey=!0;!1===Boolean(r)&&(this.key=e,this.destination.next(t))},e}(i.Subscriber)},{"../Subscriber":36,"../util/errorObject":163,"../util/tryCatch":175}],118:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r._do=function(t,e,r){return this.lift(new o(t,e,r))};var o=function(){function t(t,e,r){this.nextOrObserver=t,this.error=e,this.complete=r}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.nextOrObserver,this.error,this.complete))},t}(),s=function(t){function e(e,r,n,o){t.call(this,e);var s=new i.Subscriber(r,n,o);s.syncErrorThrowable=!0,this.add(s),this.safeSubscriber=s}return n(e,t),e.prototype._next=function(t){var e=this.safeSubscriber;e.next(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.next(t)},e.prototype._error=function(t){var e=this.safeSubscriber;e.error(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.error(t)},e.prototype._complete=function(){var t=this.safeSubscriber;t.complete(),t.syncErrorThrown?this.destination.error(t.syncErrorValue):this.destination.complete()},e}(i.Subscriber)},{"../Subscriber":36}],119:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/tryCatch"),o=t("../util/errorObject"),s=t("../OuterSubscriber"),a=t("../util/subscribeToResult");r.expand=function(t,e,r){return void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=void 0),e=(e||0)<1?Number.POSITIVE_INFINITY:e,this.lift(new c(t,e,r))};var c=function(){function t(t,e,r){this.project=t,this.concurrent=e,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.concurrent,this.scheduler))},t}();r.ExpandOperator=c;var u=function(t){function e(e,r,n,i){t.call(this,e),this.project=r,this.concurrent=n,this.scheduler=i,this.index=0,this.active=0,this.hasCompleted=!1,n0&&this._next(e.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(s.OuterSubscriber);r.ExpandSubscriber=u},{"../OuterSubscriber":31,"../util/errorObject":163,"../util/subscribeToResult":173,"../util/tryCatch":175}],120:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.filter=function(t,e){return this.lift(new o(t,e))};var o=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.predicate,this.thisArg))},t}(),s=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return n(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":36}],121:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../Subscription");r._finally=function(t){return this.lift(new s(t))};var s=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.callback))},t}(),a=function(t){function e(e,r){t.call(this,e),this.add(new o.Subscription(r))}return n(e,t),e}(i.Subscriber)},{"../Subscriber":36,"../Subscription":37}],122:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/EmptyError");r.first=function(t,e,r){return this.lift(new s(t,e,r,this))};var s=function(){function t(t,e,r,n){this.predicate=t,this.resultSelector=e,this.defaultValue=r,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),a=function(t){function e(e,r,n,i,o){t.call(this,e),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.index=0,this.hasCompleted=!1,this._emitted=!1}return n(e,t),e.prototype._next=function(t){var e=this.index++;this.predicate?this._tryPredicate(t,e):this._emit(t,e)},e.prototype._tryPredicate=function(t,e){var r;try{r=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}r&&this._emit(t,e)},e.prototype._emit=function(t,e){this.resultSelector?this._tryResultSelector(t,e):this._emitFinal(t)},e.prototype._tryResultSelector=function(t,e){var r;try{r=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this._emitFinal(r)},e.prototype._emitFinal=function(t){var e=this.destination;this._emitted||(this._emitted=!0,e.next(t),e.complete(),this.hasCompleted=!0)},e.prototype._complete=function(){var t=this.destination;this.hasCompleted||void 0===this.defaultValue?this.hasCompleted||t.error(new o.EmptyError):(t.next(this.defaultValue),t.complete())},e}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":159}],123:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/EmptyError");r.last=function(t,e,r){return this.lift(new s(t,e,r,this))};var s=function(){function t(t,e,r,n){this.predicate=t,this.resultSelector=e,this.defaultValue=r,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),a=function(t){function e(e,r,n,i,o){t.call(this,e),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.hasValue=!1,this.index=0,void 0!==i&&(this.lastValue=i,this.hasValue=!0)}return n(e,t),e.prototype._next=function(t){var e=this.index++;if(this.predicate)this._tryPredicate(t,e);else{if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},e.prototype._tryPredicate=function(t,e){var r;try{r=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}if(r){if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},e.prototype._tryResultSelector=function(t,e){var r;try{r=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this.lastValue=r,this.hasValue=!0},e.prototype._complete=function(){var t=this.destination;this.hasValue?(t.next(this.lastValue),t.complete()):t.error(new o.EmptyError)},e}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":159}],124:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.map=function(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new o(t,e))};var o=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.project,this.thisArg))},t}();r.MapOperator=o;var s=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return n(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":36}],125:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e1&&"number"==typeof t[t.length-1]&&(r=t.pop())):"number"==typeof c&&(r=t.pop()),null===n&&1===t.length&&t[0]instanceof i.Observable?t[0]:new o.ArrayObservable(t,n).lift(new s.MergeAllOperator(r))}var i=t("../Observable"),o=t("../observable/ArrayObservable"),s=t("./mergeAll"),a=t("../util/isScheduler");r.merge=function(){for(var t=[],e=0;e0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(i.OuterSubscriber);r.MergeAllSubscriber=a},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],127:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/subscribeToResult"),o=t("../OuterSubscriber");r.mergeMap=function(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"number"==typeof e&&(r=e,e=null),this.lift(new s(t,e,r))};var s=function(){function t(t,e,r){void 0===r&&(r=Number.POSITIVE_INFINITY),this.project=t,this.resultSelector=e,this.concurrent=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.resultSelector,this.concurrent))},t}();r.MergeMapOperator=s;var a=function(t){function e(e,r,n,i){void 0===i&&(i=Number.POSITIVE_INFINITY),t.call(this,e),this.project=r,this.resultSelector=n,this.concurrent=i,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}return n(e,t),e.prototype._next=function(t){this.active0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(o.OuterSubscriber);r.MergeMapSubscriber=a},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],128:[function(t,e,r){"use strict";var n=t("../observable/ConnectableObservable");r.multicast=function(t,e){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return this.lift(new i(r,e));var o=Object.create(this,n.connectableObservableDescriptor);return o.source=this,o.subjectFactory=r,o};var i=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var r=this.selector,n=this.subjectFactory(),i=r(n).subscribe(t);return i.add(e.subscribe(n)),i},t}();r.MulticastOperator=i},{"../observable/ConnectableObservable":87}],129:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../Notification");r.observeOn=function(t,e){return void 0===e&&(e=0),this.lift(new s(t,e))};var s=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.scheduler,this.delay))},t}();r.ObserveOnOperator=s;var a=function(t){function e(e,r,n){void 0===n&&(n=0),t.call(this,e),this.scheduler=r,this.delay=n}return n(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination;e.observe(r),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.add(this.scheduler.schedule(e.dispatch,this.delay,new c(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.Notification.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.Notification.createError(t))},e.prototype._complete=function(){this.scheduleMessage(o.Notification.createComplete())},e}(i.Subscriber);r.ObserveOnSubscriber=a;var c=function(){return function(t,e){this.notification=t,this.destination=e}}();r.ObserveOnMessage=c},{"../Notification":28,"../Subscriber":36}],130:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.pairwise=function(){return this.lift(new o)};var o=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new s(t))},t}(),s=function(t){function e(e){t.call(this,e),this.hasPrev=!1}return n(e,t),e.prototype._next=function(t){this.hasPrev?this.destination.next([this.prev,t]):this.hasPrev=!0,this.prev=t},e}(i.Subscriber)},{"../Subscriber":36}],131:[function(t,e,r){"use strict";function n(t,e){return function(r){for(var n=r,i=0;i=2&&(r=!0),this.lift(new o(t,e,r))};var o=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.accumulator,this.seed,this.hasSeed))},t}(),s=function(t){function e(e,r,n,i){t.call(this,e),this.accumulator=r,this._seed=n,this.hasSeed=i,this.index=0}return n(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.accumulator(this.seed,t,r)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":36}],135:[function(t,e,r){"use strict";function n(){return new o.Subject}var i=t("./multicast"),o=t("../Subject");r.share=function(){return i.multicast.call(this,n).refCount()}},{"../Subject":34,"./multicast":128}],136:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.skip=function(t){return this.lift(new o(t))};var o=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.total))},t}(),s=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return n(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":36}],137:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.skipUntil=function(t){return this.lift(new s(t))};var s=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.notifier))},t}(),a=function(t){function e(e,r){t.call(this,e),this.hasValue=!1,this.isInnerStopped=!1,this.add(o.subscribeToResult(this,r))}return n(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype._complete=function(){this.isInnerStopped?t.prototype._complete.call(this):this.unsubscribe()},e.prototype.notifyNext=function(t,e,r,n,i){this.hasValue=!0},e.prototype.notifyComplete=function(){this.isInnerStopped=!0,this.isStopped&&t.prototype._complete.call(this)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],138:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.skipWhile=function(t){return this.lift(new o(t))};var o=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.predicate))},t}(),s=function(t){function e(e,r){t.call(this,e),this.predicate=r,this.skipping=!0,this.index=0}return n(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(i.Subscriber)},{"../Subscriber":36}],139:[function(t,e,r){"use strict";var n=t("../observable/ArrayObservable"),i=t("../observable/ScalarObservable"),o=t("../observable/EmptyObservable"),s=t("./concat"),a=t("../util/isScheduler");r.startWith=function(){for(var t=[],e=0;e1?s.concatStatic(new n.ArrayObservable(t,r),this):s.concatStatic(new o.EmptyObservable(r),this)}},{"../observable/ArrayObservable":86,"../observable/EmptyObservable":89,"../observable/ScalarObservable":95,"../util/isScheduler":171,"./concat":113}],140:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.switchMap=function(t,e){return this.lift(new s(t,e))};var s=function(){function t(t,e){this.project=t,this.resultSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.resultSelector))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.resultSelector=n,this.index=0}return n(e,t),e.prototype._next=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this._innerSub(e,t,r)},e.prototype._innerSub=function(t,e,r){var n=this.innerSubscription;n&&n.unsubscribe(),this.add(this.innerSubscription=o.subscribeToResult(this,t,e,r))},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.innerSubscription=null},e.prototype.notifyComplete=function(e){this.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e,r,n,i){this.resultSelector?this._tryNotifyNext(t,e,r,n):this.destination.next(e)},e.prototype._tryNotifyNext=function(t,e,r,n){var i;try{i=this.resultSelector(t,e,r,n)}catch(t){return void this.destination.error(t)}this.destination.next(i)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],141:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/ArgumentOutOfRangeError"),s=t("../observable/EmptyObservable");r.take=function(t){return 0===t?new s.EmptyObservable:this.lift(new a(t))};var a=function(){function t(t){if(this.total=t,this.total<0)throw new o.ArgumentOutOfRangeError}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.total))},t}(),c=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return n(e,t),e.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},e}(i.Subscriber)},{"../Subscriber":36,"../observable/EmptyObservable":89,"../util/ArgumentOutOfRangeError":158}],142:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.takeUntil=function(t){return this.lift(new s(t))};var s=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.notifier))},t}(),a=function(t){function e(e,r){t.call(this,e),this.notifier=r,this.add(o.subscribeToResult(this,r))}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.complete()},e.prototype.notifyComplete=function(){},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],143:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.defaultThrottleConfig={leading:!0,trailing:!1},r.throttle=function(t,e){return void 0===e&&(e=r.defaultThrottleConfig),this.lift(new s(t,e.leading,e.trailing))};var s=function(){function t(t,e,r){this.durationSelector=t,this.leading=e,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.durationSelector,this.leading,this.trailing))},t}(),a=function(t){function e(e,r,n,i){t.call(this,e),this.destination=e,this.durationSelector=r,this._leading=n,this._trailing=i,this._hasTrailingValue=!1}return n(e,t),e.prototype._next=function(t){if(this.throttled)this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t);else{var e=this.tryDurationSelector(t);e&&this.add(this.throttled=o.subscribeToResult(this,e)),this._leading&&(this.destination.next(t),this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t))}},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype._unsubscribe=function(){var t=this,e=t.throttled;t._trailingValue,t._hasTrailingValue,t._trailing;this._trailingValue=null,this._hasTrailingValue=!1,e&&(this.remove(e),this.throttled=null,e.unsubscribe())},e.prototype._sendTrailing=function(){var t=this,e=t.destination,r=t.throttled,n=t._trailing,i=t._trailingValue,o=t._hasTrailingValue;r&&n&&o&&(e.next(i),this._trailingValue=null,this._hasTrailingValue=!1)},e.prototype.notifyNext=function(t,e,r,n,i){this._sendTrailing(),this._unsubscribe()},e.prototype.notifyComplete=function(){this._sendTrailing(),this._unsubscribe()},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],144:[function(t,e,r){"use strict";function n(t){t.subscriber.clearThrottle()}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber"),s=t("../scheduler/async"),a=t("./throttle");r.throttleTime=function(t,e,r){return void 0===e&&(e=s.async),void 0===r&&(r=a.defaultThrottleConfig),this.lift(new c(t,e,r.leading,r.trailing))};var c=function(){function t(t,e,r,n){this.duration=t,this.scheduler=e,this.leading=r,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),u=function(t){function e(e,r,n,i,o){t.call(this,e),this.duration=r,this.scheduler=n,this.leading=i,this.trailing=o,this._hasTrailingValue=!1,this._trailingValue=null}return i(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(n,this.duration,{subscriber:this})),this.leading&&this.destination.next(t))},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(o.Subscriber)},{"../Subscriber":36,"../scheduler/async":152,"./throttle":143}],145:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.withLatestFrom=function(){for(var t=[],e=0;e0){var s=o.indexOf(r);-1!==s&&o.splice(s,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],146:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;ethis.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),m=function(t){function e(e,r,n){t.call(this,e),this.parent=r,this.observable=n,this.stillUnsubscribed=!0,this.buffer=[],this.isComplete=!1}return i(e,t),e.prototype[h.iterator]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,i){this.buffer.push(e),this.parent.checkIterators()},e.prototype.subscribe=function(t,e){return u.subscribeToResult(this,this.observable,this,e)},e}(c.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscriber":36,"../observable/ArrayObservable":86,"../symbol/iterator":154,"../util/isArray":164,"../util/subscribeToResult":173}],147:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this)}return n(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(t("../Subscription").Subscription);r.Action=i},{"../Subscription":37}],148:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/root"),o=function(t){function e(e,r){t.call(this,e,r),this.scheduler=e,this.work=r,this.pending=!1}return n(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t,this.pending=!0;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,e)),this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),i.root.setInterval(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){return void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending?e:i.root.clearInterval(e)&&void 0||void 0},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r=!1,n=void 0;try{this.work(t)}catch(t){r=!0,n=!!t&&t||new Error(t)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,r=e.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(t("./Action").Action);r.AsyncAction=o},{"../util/root":172,"./Action":147}],149:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments),this.actions=[],this.active=!1,this.scheduled=void 0}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var r;this.active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(t("../Scheduler").Scheduler);r.AsyncScheduler=i},{"../Scheduler":33}],150:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this,e,r),this.scheduler=e,this.work=r}return n(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):e.flush(this)},e}(t("./AsyncAction").AsyncAction);r.QueueAction=i},{"./AsyncAction":148}],151:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e}(t("./AsyncScheduler").AsyncScheduler);r.QueueScheduler=i},{"./AsyncScheduler":149}],152:[function(t,e,r){"use strict";var n=t("./AsyncAction"),i=t("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":148,"./AsyncScheduler":149}],153:[function(t,e,r){"use strict";var n=t("./QueueAction"),i=t("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":150,"./QueueScheduler":151}],154:[function(t,e,r){"use strict";function n(t){var e=t.Symbol;if("function"==typeof e)return e.iterator||(e.iterator=e("iterator polyfill")),e.iterator;var r=t.Set;if(r&&"function"==typeof(new r)["@@iterator"])return"@@iterator";var n=t.Map;if(n)for(var i=Object.getOwnPropertyNames(n.prototype),o=0;o=0}},{"../util/isArray":164}],169:[function(t,e,r){"use strict";r.isObject=function(t){return null!=t&&"object"==typeof t}},{}],170:[function(t,e,r){"use strict";r.isPromise=function(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}},{}],171:[function(t,e,r){"use strict";r.isScheduler=function(t){return t&&"function"==typeof t.schedule}},{}],172:[function(t,e,r){(function(t){"use strict";var e="undefined"!=typeof window&&window,n="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,i=void 0!==t&&t,o=e||i||n;r.root=o,function(){if(!o)throw new Error("RxJS could not find any global context (window, self, global)")}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],173:[function(t,e,r){"use strict";var n=t("./root"),i=t("./isArrayLike"),o=t("./isPromise"),s=t("./isObject"),a=t("../Observable"),c=t("../symbol/iterator"),u=t("../InnerSubscriber"),h=t("../symbol/observable");r.subscribeToResult=function(t,e,r,l){var p=new u.InnerSubscriber(t,r,l);if(p.closed)return null;if(e instanceof a.Observable)return e._isScalar?(p.next(e.value),p.complete(),null):e.subscribe(p);if(i.isArrayLike(e)){for(var f=0,d=e.length;f=n||0 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;\nfogFactor = 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")),C.compileShader(L),C.compileShader(N),C.attachShader(R,L),C.attachShader(R,N),C.linkProgram(R),E=R,x=C.getAttribLocation(E,"position"),w=C.getAttribLocation(E,"uv"),i=C.getUniformLocation(E,"uvOffset"),o=C.getUniformLocation(E,"uvScale"),s=C.getUniformLocation(E,"rotation"),u=C.getUniformLocation(E,"scale"),h=C.getUniformLocation(E,"color"),l=C.getUniformLocation(E,"map"),p=C.getUniformLocation(E,"opacity"),f=C.getUniformLocation(E,"modelViewMatrix"),d=C.getUniformLocation(E,"projectionMatrix"),m=C.getUniformLocation(E,"fogType"),v=C.getUniformLocation(E,"fogDensity"),g=C.getUniformLocation(E,"fogNear"),y=C.getUniformLocation(E,"fogFar"),b=C.getUniformLocation(E,"fogColor"),_=C.getUniformLocation(E,"alphaTest"),(R=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,R.height=8,(L=R.getContext("2d")).fillStyle="white",L.fillRect(0,0,8,8),(T=new n(R)).needsUpdate=!0}C.useProgram(E),O.initAttributes(),O.enableAttribute(x),O.enableAttribute(w),O.disableUnusedAttributes(),O.disable(C.CULL_FACE),O.enable(C.BLEND),C.bindBuffer(C.ARRAY_BUFFER,S),C.vertexAttribPointer(x,2,C.FLOAT,!1,16,0),C.vertexAttribPointer(w,2,C.FLOAT,!1,16,8),C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,M),C.uniformMatrix4fv(d,!1,c.projectionMatrix.elements),O.activeTexture(C.TEXTURE0),C.uniform1i(l,0),L=R=0,(N=a.fog)?(C.uniform3f(b,N.color.r,N.color.g,N.color.b),N.isFog?(C.uniform1f(g,N.near),C.uniform1f(y,N.far),C.uniform1i(m,1),L=R=1):N.isFogExp2&&(C.uniform1f(v,N.density),C.uniform1i(m,2),L=R=2)):(C.uniform1i(m,0),L=R=0);for(var N=0,I=e.length;Ne&&(e=t[r]);return e}function St(){Object.defineProperty(this,"id",{value:ki++}),this.uuid=xi.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}}function Mt(t,e,r,n,i,o){ht.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Et(t,e,r,n,i,o)),this.mergeVertices()}function Et(t,e,r,n,i,o){function s(t,e,r,n,i,o,s,m,v,g,y){var b=o/v,_=s/g,x=o/2,w=s/2,S=m/2;s=v+1;var M,E,T=g+1,C=o=0,O=new c;for(E=0;E/gm,function(t,e){var r=Li[e];if(void 0===r)throw Error("Can not resolve #include <"+e+">");return Qt(r)})}function te(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,n){for(t="",e=parseInt(e);ee||t.height>e){var r=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return n.width=Math.floor(t.width*r),n.height=Math.floor(t.height*r),n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return xi.isPowerOfTwo(t.width)&&xi.isPowerOfTwo(t.height)}function u(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function h(e){return 1003===e||1004===e||1005===e?t.NEAREST:t.LINEAR}function l(e){(e=e.target).removeEventListener("dispose",l);t:{var r=n.get(e);if(e.image&&r.__image__webglTextureCube)t.deleteTexture(r.__image__webglTextureCube);else{if(void 0===r.__webglInit)break t;t.deleteTexture(r.__webglTexture)}n.remove(e)}s.textures--}function p(e){(e=e.target).removeEventListener("dispose",p);var r=n.get(e),i=n.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(i=0;6>i;i++)t.deleteFramebuffer(r.__webglFramebuffer[i]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[i]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}s.textures--}function f(e,h){var p=n.get(e);if(0g;g++)v[g]=f||m?m?e.image[g].image:e.image[g]:a(e.image[g],i.maxCubemapSize);var y=c(v[0]),b=o(e.format),_=o(e.type);for(d(t.TEXTURE_CUBE_MAP,e,y),g=0;6>g;g++)if(f)for(var x,w=v[g].mipmaps,S=0,M=w.length;Sl;l++)i.__webglFramebuffer[l]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(a){for(r.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),d(t.TEXTURE_CUBE_MAP,e.texture,h),l=0;6>l;l++)m(i.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);u(e.texture,h)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),r.bindTexture(t.TEXTURE_CUBE_MAP,null)}else r.bindTexture(t.TEXTURE_2D,o.__webglTexture),d(t.TEXTURE_2D,e.texture,h),m(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),u(e.texture,h)&&t.generateMipmap(t.TEXTURE_2D),r.bindTexture(t.TEXTURE_2D,null);if(e.depthBuffer){if(i=n.get(e),o=!0===e.isWebGLRenderTargetCube,e.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");if(e&&e.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(n.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),f(e.depthTexture,0),i=n.get(e.depthTexture).__webglTexture,1026===e.depthTexture.format)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(1027!==e.depthTexture.format)throw Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}else if(o)for(i.__webglDepthbuffer=[],o=0;6>o;o++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),v(i.__webglDepthbuffer[o],e);else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),v(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var i=e.texture;u(i,c(e))&&(e=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,i=n.get(i).__webglTexture,r.bindTexture(e,i),t.generateMipmap(e),r.bindTexture(e,null))}}function ie(){var t={};return{get:function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},remove:function(e){delete t[e.uuid]},clear:function(){t={}}}}function oe(t,e,r){function n(e,r,n){var i=new Uint8Array(4),o=t.createTexture();for(t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST),e=0;e=gt.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+gt.maxTextures),X+=1,t},this.setTexture2D=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),_t.setTexture2D(e,r)}}(),this.setTexture=function(){var t=!1;return function(e,r){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),_t.setTexture2D(e,r)}}(),this.setTextureCube=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?_t.setTextureCube(e,r):_t.setTextureCubeDynamic(e,r)}}(),this.getRenderTarget=function(){return D},this.setRenderTarget=function(t){(D=t)&&void 0===bt.get(t).__webglFramebuffer&&_t.setupRenderTarget(t);var e,r=t&&t.isWebGLRenderTargetCube;t?(e=bt.get(t),e=r?e.__webglFramebuffer[t.activeCubeFace]:e.__webglFramebuffer,$.copy(t.scissor),V=t.scissorTest,W.copy(t.viewport)):(e=null,$.copy(J).multiplyScalar(Z),V=Q,W.copy(nt).multiplyScalar(Z)),k!==e&&(mt.bindFramebuffer(mt.FRAMEBUFFER,e),k=e),yt.scissor($),yt.setScissorTest(V),yt.viewport(W),r&&(r=bt.get(t.texture),mt.framebufferTexture2D(mt.FRAMEBUFFER,mt.COLOR_ATTACHMENT0,mt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel))},this.readRenderTargetPixels=function(t,e,r,n,i,o){if(t&&t.isWebGLRenderTarget){var s=bt.get(t).__webglFramebuffer;if(s){var a=!1;s!==k&&(mt.bindFramebuffer(mt.FRAMEBUFFER,s),a=!0);try{var c=t.texture,u=c.format,h=c.type;1023!==u&&_(u)!==mt.getParameter(mt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||_(h)===mt.getParameter(mt.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(vt.get("OES_texture_float")||vt.get("WEBGL_color_buffer_float"))||1016===h&&vt.get("EXT_color_buffer_half_float")?mt.checkFramebufferStatus(mt.FRAMEBUFFER)===mt.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=r&&r<=t.height-i&&mt.readPixels(e,r,n,i,_(u),_(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{a&&mt.bindFramebuffer(mt.FRAMEBUFFER,k)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function pe(t,e){this.name="",this.color=new $(t),this.density=void 0!==e?e:25e-5}function fe(t,e,r){this.name="",this.color=new $(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3}function de(){ot.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function me(t,e,r,n,i){ot.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,n,i)}function ve(t){W.call(this),this.type="SpriteMaterial",this.color=new $(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(t)}function ge(t){ot.call(this),this.type="Sprite",this.material=void 0!==t?t:new ve}function ye(){ot.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function be(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var r=0,n=this.bones.length;r=t.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}n.call(this,t,e,r,i,o,s,a,c,u),this.generateMipmaps=!1;var l=this;h()}function Ae(t,e,r,i,o,s,a,c,u,h,l,p){n.call(this,null,s,a,c,u,h,i,o,l,p),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1}function je(t,e,r,i,o,s,a,c,u){n.call(this,t,e,r,i,o,s,a,c,u),this.needsUpdate=!0}function Re(t,e,r,i,o,s,a,c,u,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===h&&(r=1012),void 0===r&&1027===h&&(r=1020),n.call(this,null,i,o,s,a,c,h,r,u),this.image={width:t,height:e},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=this.flipY=!1}function Le(t){St.call(this),this.type="WireframeGeometry";var e,r,n,i,o,s,a=[],u=[0,0],h={},l=["a","b","c"];if(t&&t.isGeometry){var p=t.faces;for(e=0,n=p.length;er;r++)o=f[l[r]],s=f[l[(r+1)%3]],u[0]=Math.min(o,s),u[1]=Math.max(o,s),o=u[0]+","+u[1],void 0===h[o]&&(h[o]={index1:u[0],index2:u[1]})}for(o in h)e=h[o],l=t.vertices[e.index1],a.push(l.x,l.y,l.z),l=t.vertices[e.index2],a.push(l.x,l.y,l.z)}else if(t&&t.isBufferGeometry){var d,l=new c;if(null!==t.index){for(p=t.attributes.position,f=t.index,0===(d=t.groups).length&&(d=[{start:0,count:f.count,materialIndex:0}]),t=0,i=d.length;tr;r++)o=f.getX(e+r),s=f.getX(e+(r+1)%3),u[0]=Math.min(o,s),u[1]=Math.max(o,s),o=u[0]+","+u[1],void 0===h[o]&&(h[o]={index1:u[0],index2:u[1]});for(o in h)e=h[o],l.fromBufferAttribute(p,e.index1),a.push(l.x,l.y,l.z),l.fromBufferAttribute(p,e.index2),a.push(l.x,l.y,l.z)}else for(p=t.attributes.position,e=0,n=p.count/3;er;r++)h=3*e+r,l.fromBufferAttribute(p,h),a.push(l.x,l.y,l.z),h=3*e+(r+1)%3,l.fromBufferAttribute(p,h),a.push(l.x,l.y,l.z)}this.addAttribute("position",new bt(a,3))}function Ne(t,e,r){ht.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r},this.fromBufferGeometry(new Ie(t,e,r)),this.mergeVertices()}function Ie(t,e,r){St.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:r};var n,i,o=[],s=[],a=[],u=[],h=new c,l=new c,p=new c,f=new c,d=new c,m=e+1;for(n=0;n<=r;n++){var v=n/r;for(i=0;i<=e;i++){var g=i/e,l=t(g,v,l);s.push(l.x,l.y,l.z),0<=g-1e-5?(p=t(g-1e-5,v,p),f.subVectors(l,p)):(p=t(g+1e-5,v,p),f.subVectors(p,l)),0<=v-1e-5?(p=t(g,v-1e-5,p),d.subVectors(l,p)):(p=t(g,v+1e-5,p),d.subVectors(p,l)),h.crossVectors(f,d).normalize(),a.push(h.x,h.y,h.z),u.push(g,v)}}for(n=0;nn&&1===t.x&&(h[e]=t.x-1),0===r.x&&0===r.z&&(h[e]=n/2/Math.PI+.5)}St.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},n=n||1;var u=[],h=[];!function(t){for(var r=new c,n=new c,i=new c,a=0;ao&&(.2>e&&(h[t+0]+=1),.2>n&&(h[t+2]+=1),.2>i&&(h[t+4]+=1))}(),this.addAttribute("position",new bt(u,3)),this.addAttribute("normal",new bt(u.slice(),3)),this.addAttribute("uv",new bt(h,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Fe(t,e){ht.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Be(t,e)),this.mergeVertices()}function Be(t,e){ke.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],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ue(t,e){ht.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ze(t,e)),this.mergeVertices()}function ze(t,e){ke.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],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ge(t,e){ht.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new $e(t,e)),this.mergeVertices()}function $e(t,e){var r=(1+Math.sqrt(5))/2;ke.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ve(t,e){ht.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new He(t,e)),this.mergeVertices()}function He(t,e){var r=(1+Math.sqrt(5))/2,n=1/r;ke.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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],[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,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function qe(t,e,r,n,i,o){ht.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:n,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed."),t=new We(t,e,r,n,i),this.tangents=t.tangents,this.normals=t.normals,this.binormals=t.binormals,this.fromBufferGeometry(t),this.mergeVertices()}function We(t,e,n,i,o){function s(r){var o=t.getPointAt(r/e),s=a.normals[r];for(r=a.binormals[r],h=0;h<=i;h++){var c=h/i*Math.PI*2,u=Math.sin(c),c=-Math.cos(c);p.x=c*s.x+u*r.x,p.y=c*s.y+u*r.y,p.z=c*s.z+u*r.z,p.normalize(),m.push(p.x,p.y,p.z),l.x=o.x+n*p.x,l.y=o.y+n*p.y,l.z=o.z+n*p.z,d.push(l.x,l.y,l.z)}}St.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:o},e=e||64,n=n||1,i=i||8,o=o||!1;var a=t.computeFrenetFrames(e,o);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var u,h,l=new c,p=new c,f=new r,d=[],m=[],v=[],g=[];for(u=0;ud;d++)r=f[u[d]],n=f[u[(d+1)%3]],a[0]=Math.min(r,n),a[1]=Math.max(r,n),r=a[0]+","+a[1],void 0===c[r]?c[r]={index1:a[0],index2:a[1],face1:l,face2:void 0}:c[r].face2=l;for(r in c)(void 0===(a=c[r]).face2||i[a.face1].normal.dot(i[a.face2].normal)<=s)&&(u=h[a.index1],o.push(u.x,u.y,u.z),u=h[a.index2],o.push(u.x,u.y,u.z));this.addAttribute("position",new bt(o,3))}function lr(t,e,r,n,i,o,s,a){ht.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new pr(t,e,r,n,i,o,s,a)),this.mergeVertices()}function pr(t,e,n,i,o,s,a,u){function h(n){var o,s,h,g=new r,_=new c,x=0,w=!0===n?t:e,S=!0===n?1:-1;for(s=v,o=1;o<=i;o++)f.push(0,y*S,0),d.push(0,S,0),m.push(.5,.5),v++;for(h=v,o=0;o<=i;o++){var M=o/i*u+a,E=Math.cos(M),M=Math.sin(M);_.x=w*M,_.y=y*S,_.z=w*E,f.push(_.x,_.y,_.z),d.push(0,S,0),g.x=.5*E+.5,g.y=.5*M*S+.5,m.push(g.x,g.y),v++}for(o=0;othis.duration&&this.resetDuration(),this.optimize()}function nn(t){this.manager=void 0!==t?t:$i,this.textures={}}function on(t){this.manager=void 0!==t?t:$i}function sn(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function an(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:$i,this.withCredentials=!1}function cn(t){this.manager=void 0!==t?t:$i,this.texturePath=""}function un(t,e,r,n,i){var o=t*t;return(2*r-2*n+(e=.5*(n-e))+(i=.5*(i-r)))*t*o+(-3*r+3*n-2*e-i)*o+e*t+r}function hn(t,e,r,n){var i=1-t;return i*i*e+2*(1-t)*t*r+t*t*n}function ln(t,e,r,n,i){var o=1-t,s=1-t;return o*o*o*e+3*s*s*t*r+3*(1-t)*t*t*n+t*t*t*i}function pn(){this.arcLengthDivisions=200}function fn(t,e){this.arcLengthDivisions=200,this.v1=t,this.v2=e}function dn(){this.arcLengthDivisions=200,this.curves=[],this.autoClose=!1}function mn(t,e,r,n,i,o,s,a){this.arcLengthDivisions=200,this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=n,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a||0}function vn(t){this.arcLengthDivisions=200,this.points=void 0===t?[]:t}function gn(t,e,r,n){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r,this.v3=n}function yn(t,e,r){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r}function bn(t){dn.call(this),this.currentPoint=new r,t&&this.fromPoints(t)}function _n(){bn.apply(this,arguments),this.holes=[]}function xn(){this.subPaths=[],this.currentPath=null}function wn(t){this.data=t}function Sn(t){this.manager=void 0!==t?t:$i}function Mn(t){this.manager=void 0!==t?t:$i}function En(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ct,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ct,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Tn(t,e,r){ot.call(this),this.type="CubeCamera";var n=new ct(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new c(1,0,0)),this.add(n);var i=new ct(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new c(-1,0,0)),this.add(i);var o=new ct(90,1,t,e);o.up.set(0,0,1),o.lookAt(new c(0,1,0)),this.add(o);var a=new ct(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new c(0,-1,0)),this.add(a);var u=new ct(90,1,t,e);u.up.set(0,-1,0),u.lookAt(new c(0,0,1)),this.add(u);var h=new ct(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new c(0,0,-1)),this.add(h),this.renderTarget=new s(r,r,{format:1022,magFilter:1006,minFilter:1006}),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,s=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,n,r),r.activeCubeFace=1,t.render(e,i,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,a,r),r.activeCubeFace=4,t.render(e,u,r),r.texture.generateMipmaps=s,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)}}function Cn(){ot.call(this),this.type="AudioListener",this.context=Ji.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function On(t){ot.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Pn(t){On.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function An(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function jn(t,e,r){switch(this.binding=t,this.valueSize=r,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*r),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0}function Rn(t,e,r){r=r||Ln.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Ln(t,e,r){this.path=e,this.parsedPath=r||Ln.parseTrackName(e),this.node=Ln.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Nn(t){this.uuid=xi.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function In(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,e=(t=e.tracks).length,r=Array(e);for(var n={endingStart:2400,endingEnd:2400},i=0;i!==e;++i){var o=t[i].createInterpolant(null);r[i]=o,o.settings=n}this._interpolantSettings=n,this._interpolants=r,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Dn(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function kn(t,e){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=e),this.value=t}function Fn(){St.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Bn(t,e,r,n){this.uuid=xi.generateUUID(),this.data=t,this.itemSize=e,this.offset=r,this.normalized=!0===n}function Un(t,e){this.uuid=xi.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function zn(t,e,r){Un.call(this,t,e),this.meshPerAttribute=r||1}function Gn(t,e,r){lt.call(this,t,e),this.meshPerAttribute=r||1}function $n(t,e,r,n){this.ray=new Pt(t,e),this.near=r||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Vn(t,e){return t.distance-e.distance}function Hn(t,e,r,n){if(!1!==t.visible&&(t.raycast(e,r),!0===n)){n=0;for(var i=(t=t.children).length;nr;r++,n++){var i=r/32*Math.PI*2,o=n/32*Math.PI*2;e.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}t.addAttribute("position",new bt(e,3)),e=new we({fog:!1}),this.cone=new Me(t,e),this.add(this.cone),this.update()}function Qn(t){var e=[];t&&t.isBone&&e.push(t);for(var r=0;rt.length&&console.warn("THREE.CatmullRomCurve3: Points array needs at least two entries."),this.points=t||[],this.closed=!1}function di(t,e,r,n){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r,this.v3=n}function mi(t,e,r){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r}function vi(t,e){this.arcLengthDivisions=200,this.v1=t,this.v2=e}function gi(t,e,r,n,i,o){mn.call(this,t,e,r,r,n,i,o)}function yi(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom",this.closed=!0}function bi(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom"}function _i(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0i;i++)8===i||13===i||18===i||23===i?r[i]="-":14===i?r[i]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),t=15&n,n>>=4,r[i]=e[19===i?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,n,i){return n+(t-e)*(i-n)/(r-e)},lerp:function(t,e,r){return(1-r)*t+r*e},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*xi.DEG2RAD},radToDeg:function(t){return t*xi.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.defineProperties(r.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(r.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new r,e=new r;return function(r,n){return t.set(r,r),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return 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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return t=this.y-t.y,e*e+t*t},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*r-o*n+t.x,this.y=i*n+o*r+t.y,this}});var wi=0;n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=300,Object.defineProperty(n.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(n.prototype,e.prototype,{constructor:n,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=xi.generateUUID()),void 0===t.images[r.uuid]){var n,i=t.images,o=r.uuid,s=r.uuid;void 0!==r.toDataURL?n=r:(n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n.width=r.width,n.height=r.height,n.getContext("2d").drawImage(r,0,0,r.width,r.height)),n=2048t.x||1t.x?0:1;break;case 1002:t.x=1===Math.abs(Math.floor(t.x)%2)?Math.ceil(t.x)-t.x:t.x-Math.floor(t.x)}if(0>t.y||1t.y?0:1;break;case 1002:t.y=1===Math.abs(Math.floor(t.y)%2)?Math.ceil(t.y)-t.y:t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(i.prototype,{isVector4:!0,set:function(t,e,r,n){return this.x=t,this.y=e,this.z=r,this.w=n,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*n+t[12]*i,this.y=t[1]*e+t[5]*r+t[9]*n+t[13]*i,this.z=t[2]*e+t[6]*r+t[10]*n+t[14]*i,this.w=t[3]*e+t[7]*r+t[11]*n+t[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,n,i=(t=t.elements)[0];n=t[4];var o=t[8],s=t[1],a=t[5],c=t[9];r=t[2],e=t[6];var u=t[10];return.01>Math.abs(n-s)&&.01>Math.abs(o-r)&&.01>Math.abs(c-e)?.1>Math.abs(n+s)&&.1>Math.abs(o+r)&&.1>Math.abs(c+e)&&.1>Math.abs(i+a+u-3)?(this.set(1,0,0,0),this):(t=Math.PI,i=(i+1)/2,a=(a+1)/2,u=(u+1)/2,n=(n+s)/4,o=(o+r)/4,c=(c+e)/4,i>a&&i>u?.01>i?(e=0,n=r=.707106781):(e=Math.sqrt(i),r=n/e,n=o/e):a>u?.01>a?(e=.707106781,r=0,n=.707106781):(r=Math.sqrt(a),e=n/r,n=c/r):.01>u?(r=e=.707106781,n=0):(n=Math.sqrt(u),e=o/n,r=c/n),this.set(e,r,n,t),this):(t=Math.sqrt((e-c)*(e-c)+(o-r)*(o-r)+(s-n)*(s-n)),.001>Math.abs(t)&&(t=1),this.x=(e-c)/t,this.y=(o-r)/t,this.z=(s-n)/t,this.w=Math.acos((i+a+u-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,n){return void 0===t&&(t=new i,e=new i),t.set(r,r,r,r),e.set(n,n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return 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),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(o.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.isWebGLRenderTargetCube=!0,Object.assign(a,{slerp:function(t,e,r,n){return r.copy(t).slerp(e,n)},slerpFlat:function(t,e,r,n,i,o,s){var a=r[n+0],c=r[n+1],u=r[n+2];r=r[n+3],n=i[o+0];var h=i[o+1],l=i[o+2];if(i=i[o+3],r!==i||a!==n||c!==h||u!==l){o=1-s;var p=a*n+c*h+u*l+r*i,f=0<=p?1:-1,d=1-p*p;d>Number.EPSILON&&(d=Math.sqrt(d),p=Math.atan2(d,p*f),o=Math.sin(o*p)/d,s=Math.sin(s*p)/d),a=a*o+n*(f*=s),c=c*o+h*f,u=u*o+l*f,r=r*o+i*f,o===1-s&&(s=1/Math.sqrt(a*a+c*c+u*u+r*r),a*=s,c*=s,u*=s,r*=s)}t[e]=a,t[e+1]=c,t[e+2]=u,t[e+3]=r}}),Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(a.prototype,{set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=t._x,n=t._y,i=t._z,o=t.order,s=Math.cos,a=Math.sin,c=s(r/2),u=s(n/2),s=s(i/2),r=a(r/2),n=a(n/2),i=a(i/2);return"XYZ"===o?(this._x=r*u*s+c*n*i,this._y=c*n*s-r*u*i,this._z=c*u*i+r*n*s,this._w=c*u*s-r*n*i):"YXZ"===o?(this._x=r*u*s+c*n*i,this._y=c*n*s-r*u*i,this._z=c*u*i-r*n*s,this._w=c*u*s+r*n*i):"ZXY"===o?(this._x=r*u*s-c*n*i,this._y=c*n*s+r*u*i,this._z=c*u*i+r*n*s,this._w=c*u*s-r*n*i):"ZYX"===o?(this._x=r*u*s-c*n*i,this._y=c*n*s+r*u*i,this._z=c*u*i-r*n*s,this._w=c*u*s+r*n*i):"YZX"===o?(this._x=r*u*s+c*n*i,this._y=c*n*s+r*u*i,this._z=c*u*i-r*n*s,this._w=c*u*s-r*n*i):"XZY"===o&&(this._x=r*u*s-c*n*i,this._y=c*n*s-r*u*i,this._z=c*u*i+r*n*s,this._w=c*u*s+r*n*i),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,n=Math.sin(r);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var n=e[8],i=e[1],o=e[5],s=e[9],a=e[2],c=e[6],u=r+o+(e=e[10]);return 0o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(c-s)/r,this._x=.25*r,this._y=(t+i)/r,this._z=(n+a)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(n-a)/r,this._x=(t+i)/r,this._y=.25*r,this._z=(s+c)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(i-t)/r,this._x=(n+a)/r,this._y=(s+c)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new c;return function(r,n){return void 0===e&&(e=new c),1e-6>(t=r.dot(n)+1)?(t=0,Math.abs(r.x)>Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var r=t._x,n=t._y,i=t._z,o=t._w,s=e._x,a=e._y,c=e._z,u=e._w;return this._x=r*u+o*s+n*c-i*a,this._y=n*u+o*a+i*s-r*c,this._z=i*u+o*c+r*a-n*s,this._w=o*u-r*s-n*a-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,n=this._y,i=this._z,o=this._w;if(0>(a=o*t._w+r*t._x+n*t._y+i*t._z)?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=o,this._x=r,this._y=n,this._z=i,this;c=Math.sqrt(1-a*a);if(.001>Math.abs(c))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(n+this._y),this._z=.5*(i+this._z),this;var s=Math.atan2(c,a),a=Math.sin((1-e)*s)/c,c=Math.sin(e*s)/c;return this._w=o*a+this._w*c,this._x=r*a+this._x*c,this._y=n*a+this._y*c,this._z=i*a+this._z*c,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(c.prototype,{isVector3:!0,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new a;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new a;return function(e,r){return this.applyQuaternion(t.setFromAxisAngle(e,r))}}(),applyMatrix3:function(t){var e=this.x,r=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*n,this.y=t[1]*e+t[4]*r+t[7]*n,this.z=t[2]*e+t[5]*r+t[8]*n,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=1/((t=t.elements)[3]*e+t[7]*r+t[11]*n+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*n+t[12])*i,this.y=(t[1]*e+t[5]*r+t[9]*n+t[13])*i,this.z=(t[2]*e+t[6]*r+t[10]*n+t[14])*i,this},applyQuaternion:function(t){var e=this.x,r=this.y,n=this.z,i=t.x,o=t.y,s=t.z,a=(t=t.w)*e+o*n-s*r,c=t*r+s*e-i*n,u=t*n+i*r-o*e,e=-i*e-o*r-s*n;return this.x=a*t+e*-i+c*-s-u*-o,this.y=c*t+e*-o+u*-i-a*-s,this.z=u*t+e*-s+a*-o-c*-i,this},project:function(){var t=new u;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new u;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*n,this.y=t[1]*e+t[5]*r+t[9]*n,this.z=t[2]*e+t[6]*r+t[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new c,e=new c;return function(r,n){return t.set(r,r,r),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return 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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.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()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,n=this.y,i=this.z;return this.x=n*t.z-i*t.y,this.y=i*t.x-r*t.z,this.z=r*t.y-n*t.x,this},crossVectors:function(t,e){var r=t.x,n=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-i*s,this.y=i*o-r*a,this.z=r*s-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new c;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new c;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(xi.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return t=this.z-t.z,e*e+r*r+t*t},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return t=t.elements,this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length();return t=this.setFromMatrixColumn(t,2).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(u.prototype,{isMatrix4:!0,set:function(t,e,r,n,i,o,s,a,c,u,h,l,p,f,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=n,v[1]=i,v[5]=o,v[9]=s,v[13]=a,v[2]=c,v[6]=u,v[10]=h,v[14]=l,v[3]=p,v[7]=f,v[11]=d,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new u).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t=new c;return function(e){var r=this.elements,n=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length();return e=1/t.setFromMatrixColumn(e,2).length(),r[0]=n[0]*i,r[1]=n[1]*i,r[2]=n[2]*i,r[4]=n[4]*o,r[5]=n[5]*o,r[6]=n[6]*o,r[8]=n[8]*e,r[9]=n[9]*e,r[10]=n[10]*e,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,n=t.y,i=t.z,o=Math.cos(r),r=Math.sin(r),s=Math.cos(n),n=Math.sin(n),a=Math.cos(i),i=Math.sin(i);if("XYZ"===t.order){t=o*a;var c=o*i,u=r*a,h=r*i;e[0]=s*a,e[4]=-s*i,e[8]=n,e[1]=c+u*n,e[5]=t-h*n,e[9]=-r*s,e[2]=h-t*n,e[6]=u+c*n,e[10]=o*s}else"YXZ"===t.order?(t=s*a,c=s*i,u=n*a,h=n*i,e[0]=t+h*r,e[4]=u*r-c,e[8]=o*n,e[1]=o*i,e[5]=o*a,e[9]=-r,e[2]=c*r-u,e[6]=h+t*r,e[10]=o*s):"ZXY"===t.order?(t=s*a,c=s*i,u=n*a,h=n*i,e[0]=t-h*r,e[4]=-o*i,e[8]=u+c*r,e[1]=c+u*r,e[5]=o*a,e[9]=h-t*r,e[2]=-o*n,e[6]=r,e[10]=o*s):"ZYX"===t.order?(t=o*a,c=o*i,u=r*a,h=r*i,e[0]=s*a,e[4]=u*n-c,e[8]=t*n+h,e[1]=s*i,e[5]=h*n+t,e[9]=c*n-u,e[2]=-n,e[6]=r*s,e[10]=o*s):"YZX"===t.order?(t=o*s,c=o*n,u=r*s,h=r*n,e[0]=s*a,e[4]=h-t*i,e[8]=u*i+c,e[1]=i,e[5]=o*a,e[9]=-r*a,e[2]=-n*a,e[6]=c*i+u,e[10]=t-h*i):"XZY"===t.order&&(t=o*s,c=o*n,u=r*s,h=r*n,e[0]=s*a,e[4]=-i,e[8]=n*a,e[1]=t*i+h,e[5]=o*a,e[9]=c*i-u,e[2]=u*i-c,e[6]=r*a,e[10]=h*i+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t._x,n=t._y,i=t._z,o=t._w,s=i+i;t=r*(u=r+r);var a=r*(h=n+n),r=r*s,c=n*h,n=n*s,i=i*s,u=o*u,h=o*h,o=o*s;return e[0]=1-(c+i),e[4]=a-o,e[8]=r+h,e[1]=a+o,e[5]=1-(t+i),e[9]=n-u,e[2]=r-h,e[6]=n+u,e[10]=1-(t+c),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new c,e=new c,r=new c;return function(n,i,o){var s=this.elements;return r.subVectors(n,i),0===r.lengthSq()&&(r.z=1),r.normalize(),t.crossVectors(o,r),0===t.lengthSq()&&(1===Math.abs(o.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),t.crossVectors(o,r)),t.normalize(),e.crossVectors(r,t),s[0]=t.x,s[4]=e.x,s[8]=r.x,s[1]=t.y,s[5]=e.y,s[9]=r.y,s[2]=t.z,s[6]=e.z,s[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,o=r[0],s=r[4],a=r[8],c=r[12],u=r[1],h=r[5],l=r[9],p=r[13],f=r[2],d=r[6],m=r[10],v=r[14],g=r[3],y=r[7],b=r[11],r=r[15],_=n[0],x=n[4],w=n[8],S=n[12],M=n[1],E=n[5],T=n[9],C=n[13],O=n[2],P=n[6],A=n[10],j=n[14],R=n[3],L=n[7],N=n[11],n=n[15];return i[0]=o*_+s*M+a*O+c*R,i[4]=o*x+s*E+a*P+c*L,i[8]=o*w+s*T+a*A+c*N,i[12]=o*S+s*C+a*j+c*n,i[1]=u*_+h*M+l*O+p*R,i[5]=u*x+h*E+l*P+p*L,i[9]=u*w+h*T+l*A+p*N,i[13]=u*S+h*C+l*j+p*n,i[2]=f*_+d*M+m*O+v*R,i[6]=f*x+d*E+m*P+v*L,i[10]=f*w+d*T+m*A+v*N,i[14]=f*S+d*C+m*j+v*n,i[3]=g*_+y*M+b*O+r*R,i[7]=g*x+y*E+b*P+r*L,i[11]=g*w+y*T+b*A+r*N,i[15]=g*S+y*C+b*j+r*n,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var r=0,n=e.count;rthis.determinant()&&(s=-s),r.x=o[12],r.y=o[13],r.z=o[14],e.copy(this),r=1/s;var o=1/a,u=1/c;return e.elements[0]*=r,e.elements[1]*=r,e.elements[2]*=r,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=u,e.elements[9]*=u,e.elements[10]*=u,n.setFromRotationMatrix(e),i.x=s,i.y=a,i.z=c,this}}(),makePerspective:function(t,e,r,n,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var s=this.elements;return s[0]=2*i/(e-t),s[4]=0,s[8]=(e+t)/(e-t),s[12]=0,s[1]=0,s[5]=2*i/(r-n),s[9]=(r+n)/(r-n),s[13]=0,s[2]=0,s[6]=0,s[10]=-(o+i)/(o-i),s[14]=-2*o*i/(o-i),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this},makeOrthographic:function(t,e,r,n,i,o){var s=this.elements,a=1/(e-t),c=1/(r-n),u=1/(o-i);return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-(e+t)*a,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-(r+n)*c,s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-(o+i)*u,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;16>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;16>r;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}}),h.prototype=Object.create(n.prototype),h.prototype.constructor=h,h.prototype.isDataTexture=!0,(l.prototype=Object.create(n.prototype)).constructor=l,l.prototype.isCubeTexture=!0,Object.defineProperty(l.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Si=new n,Mi=new l,Ei=[],Ti=[],Ci=new Float32Array(16),Oi=new Float32Array(9);z.prototype.setValue=function(t,e){for(var r=this.seq,n=0,i=r.length;n!==i;++n){var o=r[n];o.setValue(t,e[o.id])}};var Pi=/([\w\d_]+)(\])?(\[|\.)?/g;G.prototype.setValue=function(t,e,r){void 0!==(e=this.map[e])&&e.setValue(t,r,this.renderer)},G.prototype.setOptional=function(t,e,r){void 0!==(e=e[r])&&this.setValue(t,r,e)},G.upload=function(t,e,r,n){for(var i=0,o=e.length;i!==o;++i){var s=e[i],a=r[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,n)}},G.seqWithValue=function(t,e){for(var r=[],n=0,i=t.length;n!==i;++n){var o=t[n];o.id in e&&r.push(o)}return r};var Ai={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,darkolivegreen: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,grey: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,lime: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,palegreen: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,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign($.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.b=this.g=this.r=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return 0>r&&(r+=1),1r?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,n){return e=xi.euclideanModulo(e,1),r=xi.clamp(r,0,1),n=xi.clamp(n,0,1),0===r?this.r=this.g=this.b=n:(r=.5>=n?n*(1+r):n+r-n*r,n=2*n-r,this.r=t(n,r,e+1/3),this.g=t(n,r,e),this.b=t(n,r,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){n=r[2];switch(r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n)){var n=parseFloat(r[1])/360,i=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(n,i,o)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(r=r[1],3===(n=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===n)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0=s?a/(o+c):a/(2-o-c);switch(o){case r:e=(n-i)/a+(n 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\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\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = asin( flipNormal * reflectVec.y ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\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#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\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\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\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\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\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\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\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\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#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\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\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\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\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\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\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},Ni={basic:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.fog]),vertexShader:Li.meshbasic_vert,fragmentShader:Li.meshbasic_frag},lambert:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.fog,ji.lights,{emissive:{value:new $(0)}}]),vertexShader:Li.meshlambert_vert,fragmentShader:Li.meshlambert_frag},phong:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.bumpmap,ji.normalmap,ji.displacementmap,ji.gradientmap,ji.fog,ji.lights,{emissive:{value:new $(0)},specular:{value:new $(1118481)},shininess:{value:30}}]),vertexShader:Li.meshphong_vert,fragmentShader:Li.meshphong_frag},standard:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.bumpmap,ji.normalmap,ji.displacementmap,ji.roughnessmap,ji.metalnessmap,ji.fog,ji.lights,{emissive:{value:new $(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag},points:{uniforms:Ri.merge([ji.points,ji.fog]),vertexShader:Li.points_vert,fragmentShader:Li.points_frag},dashed:{uniforms:Ri.merge([ji.common,ji.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Li.linedashed_vert,fragmentShader:Li.linedashed_frag},depth:{uniforms:Ri.merge([ji.common,ji.displacementmap]),vertexShader:Li.depth_vert,fragmentShader:Li.depth_frag},normal:{uniforms:Ri.merge([ji.common,ji.bumpmap,ji.normalmap,ji.displacementmap,{opacity:{value:1}}]),vertexShader:Li.normal_vert,fragmentShader:Li.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Li.cube_vert,fragmentShader:Li.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Li.equirect_vert,fragmentShader:Li.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new c}},vertexShader:Li.distanceRGBA_vert,fragmentShader:Li.distanceRGBA_frag}};Ni.physical={uniforms:Ri.merge([Ni.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag},Object.assign(V.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new r).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new r).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Ii=0;Object.assign(W.prototype,e.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0===r)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else{var n=this[e];void 0===n?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[e]="overdraw"===e?Number(r):r}}},toJSON:function(t){function e(t){var e,r=[];for(e in t){var n=t[e];delete n.metadata,r.push(n)}return r}var r=void 0===t;r&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};return n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),2!==this.shading&&(n.shading=this.shading),0!==this.side&&(n.side=this.side),0!==this.vertexColors&&(n.vertexColors=this.vertexColors),1>this.opacity&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,0i&&(i=u),h>o&&(o=h),l>s&&(s=l)}return this.min.set(e,r,n),this.max.set(i,o,s),this},setFromBufferAttribute:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-1/0,a=0,c=t.count;ai&&(i=u),h>o&&(o=h),l>s&&(s=l)}return this.min.set(e,r,n),this.max.set(i,o,s),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new c).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t=new c;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return 0=t.constant},clampPoint:function(t,e){return(e||new c).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new c;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new c;return function(e){return e=e||new Z,this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new c,new c,new c,new c,new c,new c,new c,new c];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Z.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new K;return function(e,r){var n=this.center;void 0!==r?n.copy(r):t.setFromPoints(e).getCenter(n);for(var i=0,o=0,s=e.length;o=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),n=e||new c;return n.copy(t),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){return(t=t||new K).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(J.prototype,{isMatrix3:!0,set:function(t,e,r,n,i,o,s,a,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=s,u[3]=e,u[4]=i,u[5]=a,u[6]=r,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},setFromMatrix4:function(t){return t=t.elements,this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var r=0,n=e.count;rr;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;9>r;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}}),Object.assign(Q.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,n){return this.normal.set(t,e,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new c,e=new c;return function(r,n,i){return n=t.subVectors(i,n).cross(e.subVectors(r,n)).normalize(),this.setFromNormalAndCoplanarPoint(n,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new c).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new c;return function(e,r){var n=r||new c,i=e.delta(t),o=this.normal.dot(i);return 0!==o?0>(o=-(e.start.dot(this.normal)+this.constant)/o)||1e&&0t&&0r;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(v=t.elements)[0];var r=v[1],n=v[2],i=v[3],o=v[4],s=v[5],a=v[6],c=v[7],u=v[8],h=v[9],l=v[10],p=v[11],f=v[12],d=v[13],m=v[14],v=v[15];return e[0].setComponents(i-t,c-o,p-u,v-f).normalize(),e[1].setComponents(i+t,c+o,p+u,v+f).normalize(),e[2].setComponents(i+r,c+s,p+h,v+d).normalize(),e[3].setComponents(i-r,c-s,p-h,v-d).normalize(),e[4].setComponents(i-n,c-a,p-l,v-m).normalize(),e[5].setComponents(i+n,c+a,p+l,v+m).normalize(),this},intersectsObject:function(){var t=new Z;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new Z;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var n=0;6>n;n++)if(e[n].distanceToPoint(r)i;i++){s=n[i];t.x=0o&&0>s)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;6>r;r++)if(0>e[r].distanceToPoint(t))return!1;return!0}}),nt.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),nt.DefaultOrder="XYZ",Object.defineProperties(nt.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(nt.prototype,{isEuler:!0,set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var n=xi.clamp;t=(l=t.elements)[0];var i=l[4],o=l[8],s=l[1],a=l[5],c=l[9],u=l[2],h=l[6],l=l[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-c,l),this._z=Math.atan2(-i,t)):(this._x=Math.atan2(h,a),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(c,-1,1)),.99999>Math.abs(c)?(this._y=Math.atan2(o,l),this._z=Math.atan2(s,a)):(this._y=Math.atan2(-u,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(-u,l),this._z=Math.atan2(-i,a)):(this._y=0,this._z=Math.atan2(s,t))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(h,l),this._z=Math.atan2(s,t)):(this._x=0,this._z=Math.atan2(-i,a))):"YZX"===e?(this._z=Math.asin(n(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(-c,a),this._y=Math.atan2(-u,t)):(this._x=0,this._y=Math.atan2(o,l))):"XZY"===e?(this._z=Math.asin(-n(i,-1,1)),.99999>Math.abs(i)?(this._x=Math.atan2(h,a),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-c,l),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new u;return function(e,r,n){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new a;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(it.prototype,{set:function(t){this.mask=1<t;t++)if(s[t]===s[(t+1)%3]){n.push(e);break}for(e=n.length-1;0<=e;e--)for(s=n[e],this.faces.splice(s,1),o=0,r=this.faceVertexUvs.length;on?r.copy(this.origin):r.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new c;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new c,e=new c,r=new c;return function(n,i,o,s){t.copy(n).add(i).multiplyScalar(.5),e.copy(i).sub(n).normalize(),r.copy(this.origin).sub(t);var a,c=.5*n.distanceTo(i),u=-this.direction.dot(e),h=r.dot(this.direction),l=-r.dot(e),p=r.lengthSq(),f=Math.abs(1-u*u);return 0=-a?i<=a?(c=1/f,n*=c,i*=c,u=n*(n+u*i+2*h)+i*(u*n+i+2*l)+p):(i=c,n=Math.max(0,-(u*i+h)),u=-n*n+i*(i+2*l)+p):(i=-c,n=Math.max(0,-(u*i+h)),u=-n*n+i*(i+2*l)+p):i<=-a?(n=Math.max(0,-(-u*c+h)),i=0o?null:(o=Math.sqrt(o-i),i=n-o,n+=o,0>i&&0>n?null:0>i?this.at(n,r):this.at(i,r))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(t.normal)+t.constant)/e)?t:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var r,n,i,o,s;n=1/this.direction.x,o=1/this.direction.y,s=1/this.direction.z;var a=this.origin;return 0<=n?(r=(t.min.x-a.x)*n,n*=t.max.x-a.x):(r=(t.max.x-a.x)*n,n*=t.min.x-a.x),0<=o?(i=(t.min.y-a.y)*o,o*=t.max.y-a.y):(i=(t.max.y-a.y)*o,o*=t.min.y-a.y),r>o||i>n?null:((i>r||r!==r)&&(r=i),(os||i>n?null:((i>r||r!==r)&&(r=i),(sn?null:this.at(0<=r?r:n,e)))},intersectsBox:function(){var t=new c;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new c,e=new c,r=new c,n=new c;return function(i,o,s,a,c){if(e.subVectors(o,i),r.subVectors(s,i),n.crossVectors(e,r),0<(o=this.direction.dot(n))){if(a)return null;a=1}else{if(!(0>o))return null;a=-1,o=-o}return t.subVectors(this.origin,i),0>(i=a*this.direction.dot(r.crossVectors(t,r)))?null:0>(s=a*this.direction.dot(e.cross(t)))||i+s>o?null:0>(i=-a*t.dot(n))?null:this.at(i/o,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(At.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new c).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new c).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new c;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new c,e=new c;return function(r,n){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var i=e.dot(e),i=e.dot(t)/i;return n&&(i=xi.clamp(i,0,1)),i}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new c,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(jt,{normal:function(){var t=new c;return function(e,r,n,i){return(i=i||new c).subVectors(n,r),t.subVectors(e,r),i.cross(t),0<(e=i.lengthSq())?i.multiplyScalar(1/Math.sqrt(e)):i.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new c,e=new c,r=new c;return function(n,i,o,s,a){t.subVectors(s,i),e.subVectors(o,i),r.subVectors(n,i),n=t.dot(t),i=t.dot(e),o=t.dot(r);var u=e.dot(e);s=e.dot(r);var h=n*u-i*i;return a=a||new c,0===h?a.set(-2,-1,-1):(h=1/h,u=(u*o-i*s)*h,n=(n*s-i*o)*h,a.set(1-u-n,n,u))}}(),containsPoint:function(){var t=new c;return function(e,r,n,i){return 0<=(e=jt.barycoordFromPoint(e,r,n,i,t)).x&&0<=e.y&&1>=e.x+e.y}}()}),Object.assign(jt.prototype,{set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,n){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new c,e=new c;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new c).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return jt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new Q).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return jt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return jt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new Q,e=[new At,new At,new At],r=new c,n=new c;return function(i,o){var s=o||new c,a=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,r),!0===this.containsPoint(r))s.copy(r);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;ue.far?null:{distance:r,point:_.clone(),object:t})}function n(r,n,i,o,s,c,u,p){return a.fromBufferAttribute(o,c),h.fromBufferAttribute(o,u),l.fromBufferAttribute(o,p),(r=e(r,n,i,a,h,l,b))&&(s&&(m.fromBufferAttribute(s,c),v.fromBufferAttribute(s,u),g.fromBufferAttribute(s,p),r.uv=t(b,a,h,l,m,v,g)),r.face=new ut(c,u,p,jt.normal(a,h,l)),r.faceIndex=c),r}var i=new u,o=new Pt,s=new Z,a=new c,h=new c,l=new c,p=new c,f=new c,d=new c,m=new r,v=new r,g=new r,y=new c,b=new c,_=new c;return function(r,c){var u=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===u.boundingSphere&&u.computeBoundingSphere(),s.copy(u.boundingSphere),s.applyMatrix4(_),!1!==r.ray.intersectsSphere(s)&&(i.getInverse(_),o.copy(r.ray).applyMatrix4(i),null===u.boundingBox||!1!==o.intersectsBox(u.boundingBox)))){var x;if(u.isBufferGeometry){var w,S,M,E,y=u.index,T=u.attributes.position,_=u.attributes.uv;if(null!==y)for(M=0,E=y.count;Mo||(o=n.ray.origin.distanceTo(t))n.far||i.push({distance:o,point:t.clone(),face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ye.prototype=Object.assign(Object.create(ot.prototype),{constructor:ye,copy:function(t){ot.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e=n[i].distance;i++)n[i-1].object.visible=!1,n[i].object.visible=!0;for(;io||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))n.far||i.push({distance:v,point:a.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else for(s=0,m=d.length/3-1;so||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))n.far||i.push({distance:v,point:a.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else if(s.isGeometry)for(u=s.vertices,h=u.length,s=0;so||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))n.far||i.push({distance:v,point:a.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Me.prototype=Object.assign(Object.create(Se.prototype),{constructor:Me,isLineSegments:!0}),Ee.prototype=Object.assign(Object.create(Se.prototype),{constructor:Ee,isLineLoop:!0}),Te.prototype=Object.create(W.prototype),Te.prototype.constructor=Te,Te.prototype.isPointsMaterial=!0,Te.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Ce.prototype=Object.assign(Object.create(ot.prototype),{constructor:Ce,isPoints:!0,raycast:function(){var t=new u,e=new Pt,r=new Z;return function(n,i){function o(t,r){var o=e.distanceSqToPoint(t);if(on.far||i.push({distance:c,distanceToRay:Math.sqrt(o),point:a.clone(),index:r,face:null,object:s})}}var s=this,a=this.geometry,u=this.matrixWorld,h=n.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(u),r.radius+=h,!1!==n.ray.intersectsSphere(r)){t.getInverse(u),e.copy(n.ray).applyMatrix4(t);var l=(h=h/((this.scale.x+this.scale.y+this.scale.z)/3))*h,h=new c;if(a.isBufferGeometry){var p=a.index,a=a.attributes.position.array;if(null!==p)for(var f=p.array,p=0,d=f.length;pr)return null;var n,i,o,s=[],a=[],c=[];if(0=u--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(n=i)&&(n=0),r<=(i=n+1)&&(i=0),r<=(o=i+1)&&(o=0);var h;t:{var l,p,f,d,m,v,g,y;if(l=t[a[n]].x,p=t[a[n]].y,f=t[a[i]].x,d=t[a[i]].y,m=t[a[o]].x,v=t[a[o]].y,0>=(f-l)*(v-p)-(d-p)*(m-l))h=!1;else{var b,_,x,w,S,M,E,T,C,O;for(b=m-f,_=v-d,x=l-m,w=p-v,S=f-l,M=d-p,h=0;h=-Number.EPSILON&&T>=-Number.EPSILON&&E>=-Number.EPSILON)){h=!1;break t}h=!0}}if(h){for(s.push([t[a[n]],t[a[i]],t[a[o]]]),c.push([a[n],a[i],a[o]]),n=i,o=i+1;oNumber.EPSILON){if(0f||f>p)return[];if(0>(c=u*h-c*l)||c>p)return[]}else{if(0r?[]:c===r?o?[]:[s]:t<=r?[s,a]:[s,u]))}function o(t,e,r,n){var i=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var s=n.x-t.x;return n=n.y-t.y,t=i*r-o*e,i=i*n-o*s,Math.abs(t)>Number.EPSILON?(e=s*r-n*e,0--g){console.log("Infinite Loop! Holes left:"+d.length+", Probably Hole outside Shape!");break}for(s=h;si&&(i=n);var s=t+1;return s>n&&(s=0),!!(n=o(f[t],f[i],f[s],r[e]))&&(n=r.length-1,0>(i=e-1)&&(i=n),(s=e+1)>n&&(s=0),!!(n=o(r[e],r[i],r[s],f[t])))}(s,l)&&!function(t,e){var r,n;for(r=0;rc;c++)h=u[c].x+":"+u[c].y,void 0!==(h=l[h])&&(u[c]=h);return p.concat()},isClockWise:function(t){return 0>Bi.area(t)}};(Je.prototype=Object.create(ht.prototype)).constructor=Je,Qe.prototype=Object.create(St.prototype),Qe.prototype.constructor=Qe,Qe.prototype.getArrays=function(){var t=(t=this.getAttribute("position"))?Array.prototype.slice.call(t.array):[],e=(e=this.getAttribute("uv"))?Array.prototype.slice.call(e.array):[],r=this.index;return{position:t,uv:e,index:r=r?Array.prototype.slice.call(r.array):[]}},Qe.prototype.addShapeList=function(t,e){var r=t.length;e.arrays=this.getArrays();for(var n=0;nNumber.EPSILON){var u=Math.sqrt(c),h=Math.sqrt(i*i+a*a),c=e.x-s/u;if(e=e.y+o/u,a=((n.x-a/h-c)*a-(n.y+i/h-e)*i)/(o*a-s*i),i=c+o*a-t.x,o=e+s*a-t.y,2>=(s=i*i+o*o))return new r(i,o);s=Math.sqrt(s/2)}else t=!1,o>Number.EPSILON?i>Number.EPSILON&&(t=!0):o<-Number.EPSILON?i<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(a)&&(t=!0),t?(i=-s,s=Math.sqrt(c)):(i=o,o=s,s=Math.sqrt(c/2));return new r(i/s,o/s)}function o(t,e){var r,n;for(H=t.length;0<=--H;){r=H,0>(n=H-1)&&(n=t.length-1);var i,o=T+2*S;for(i=0;iMath.abs(a-u)?[new r(t,1-n),new r(c,1-i),new r(h,1-o),new r(p,1-e)]:[new r(a,1-n),new r(u,1-i),new r(l,1-o),new r(f,1-e)]}},(tr.prototype=Object.create(ht.prototype)).constructor=tr,(er.prototype=Object.create(Qe.prototype)).constructor=er,(rr.prototype=Object.create(ht.prototype)).constructor=rr,nr.prototype=Object.create(St.prototype),nr.prototype.constructor=nr,(ir.prototype=Object.create(ht.prototype)).constructor=ir,(or.prototype=Object.create(St.prototype)).constructor=or,(sr.prototype=Object.create(ht.prototype)).constructor=sr,(ar.prototype=Object.create(St.prototype)).constructor=ar,(cr.prototype=Object.create(ht.prototype)).constructor=cr,(ur.prototype=Object.create(St.prototype)).constructor=ur,(hr.prototype=Object.create(St.prototype)).constructor=hr,lr.prototype=Object.create(ht.prototype),lr.prototype.constructor=lr,pr.prototype=Object.create(St.prototype),pr.prototype.constructor=pr,(fr.prototype=Object.create(lr.prototype)).constructor=fr,(dr.prototype=Object.create(pr.prototype)).constructor=dr,(mr.prototype=Object.create(ht.prototype)).constructor=mr,(vr.prototype=Object.create(St.prototype)).constructor=vr;var Ui=Object.freeze({WireframeGeometry:Le,ParametricGeometry:Ne,ParametricBufferGeometry:Ie,TetrahedronGeometry:Fe,TetrahedronBufferGeometry:Be,OctahedronGeometry:Ue,OctahedronBufferGeometry:ze,IcosahedronGeometry:Ge,IcosahedronBufferGeometry:$e,DodecahedronGeometry:Ve,DodecahedronBufferGeometry:He,PolyhedronGeometry:De,PolyhedronBufferGeometry:ke,TubeGeometry:qe,TubeBufferGeometry:We,TorusKnotGeometry:Xe,TorusKnotBufferGeometry:Ye,TorusGeometry:Ke,TorusBufferGeometry:Ze,TextGeometry:tr,TextBufferGeometry:er,SphereGeometry:rr,SphereBufferGeometry:nr,RingGeometry:ir,RingBufferGeometry:or,PlaneGeometry:Tt,PlaneBufferGeometry:Ct,LatheGeometry:sr,LatheBufferGeometry:ar,ShapeGeometry:cr,ShapeBufferGeometry:ur,ExtrudeGeometry:Je,ExtrudeBufferGeometry:Qe,EdgesGeometry:hr,ConeGeometry:fr,ConeBufferGeometry:dr,CylinderGeometry:lr,CylinderBufferGeometry:pr,CircleGeometry:mr,CircleBufferGeometry:vr,BoxGeometry:Mt,BoxBufferGeometry:Et});(gr.prototype=Object.create(X.prototype)).constructor=gr,gr.prototype.isShadowMaterial=!0,(yr.prototype=Object.create(X.prototype)).constructor=yr,yr.prototype.isRawShaderMaterial=!0,br.prototype=Object.create(W.prototype),br.prototype.constructor=br,br.prototype.isMeshStandardMaterial=!0,br.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(_r.prototype=Object.create(br.prototype)).constructor=_r,_r.prototype.isMeshPhysicalMaterial=!0,_r.prototype.copy=function(t){return br.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},xr.prototype=Object.create(W.prototype),xr.prototype.constructor=xr,xr.prototype.isMeshPhongMaterial=!0,xr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(wr.prototype=Object.create(xr.prototype)).constructor=wr,wr.prototype.isMeshToonMaterial=!0,wr.prototype.copy=function(t){return xr.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},(Sr.prototype=Object.create(W.prototype)).constructor=Sr,Sr.prototype.isMeshNormalMaterial=!0,Sr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(Mr.prototype=Object.create(W.prototype)).constructor=Mr,Mr.prototype.isMeshLambertMaterial=!0,Mr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(Er.prototype=Object.create(W.prototype)).constructor=Er,Er.prototype.isLineDashedMaterial=!0,Er.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var zi=Object.freeze({ShadowMaterial:gr,SpriteMaterial:ve,RawShaderMaterial:yr,ShaderMaterial:X,PointsMaterial:Te,MeshPhysicalMaterial:_r,MeshStandardMaterial:br,MeshPhongMaterial:xr,MeshToonMaterial:wr,MeshNormalMaterial:Sr,MeshLambertMaterial:Mr,MeshDepthMaterial:Y,MeshBasicMaterial:Ot,LineDashedMaterial:Er,LineBasicMaterial:we,Material:W}),Gi={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},$i=new Tr;Object.assign(Cr.prototype,{load:function(t,e,r,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,o=Gi.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){e&&e(o),i.manager.itemEnd(t)},0),o;if(c=t.match(/^data:(.*?)(;base64)?,(.*)$/)){var s=c[1],a=!!c[2],c=c[3],c=window.decodeURIComponent(c);a&&(c=window.atob(c));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":u=new ArrayBuffer(c.length);for(var l=new Uint8Array(u),a=0;a=i)break t;for(t<(o=e[1])&&(r=2,i=o),o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(r===o)break;if(n=i,i=e[--r-1],t>=i)break e}n=r,r=0}for(;r>>1,te;)--o;return++o,0===i&&o===n||(i>=o&&(o=Math.max(o,1),i=o-1),n=this.getValueSize(),this.times=Vi.arraySlice(r,i,o),this.values=Vi.arraySlice(this.values,i*n,o*n)),this},validate:function(){var t=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),t=!1);var e=this.times,r=this.values,n=e.length;0===n&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),t=!1);for(var i=null,o=0;o!==n;o++){var s=e[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,o,s),t=!1;break}if(null!==i&&i>s){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,o,s,i),t=!1;break}i=s}if(void 0!==r&&Vi.isTypedArray(r))for(o=0,e=r.length;o!==e;++o)if(n=r[o],isNaN(n)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,o,n),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),n=2302===this.getInterpolation(),i=1,o=t.length-1,s=1;sh.opacity&&(h.transparent=!0),n.setTextures(u),n.parse(h)}}()}),Object.assign(an.prototype,{load:function(t,e,r,n){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:sn.prototype.extractUrlBase(t),s=new Cr(this.manager);s.setWithCredentials(this.withCredentials),s.load(t,function(r){var n=(r=JSON.parse(r)).metadata;if(void 0!==n&&void 0!==(n=n.type)){if("object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}r=i.parse(r,o),e(r.geometry,r.materials)},r,n)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){void 0!==t.data&&(t=t.data),t.scale=void 0!==t.scale?1/t.scale:1;var n,o,s,a,u,h,l,p,f,d,m,v,g,y,b=new ht,_=t,x=_.faces;f=_.vertices;var w=_.normals,S=_.colors;h=_.scale;var M=0;if(void 0!==_.uvs){for(n=0;n<_.uvs.length;n++)_.uvs[n].length&&M++;for(n=0;no;o++)p=x[a++],y=g[2*p],p=g[2*p+1],y=new r(y,p),2!==o&&b.faceVertexUvs[n][s].push(y),0!==o&&b.faceVertexUvs[n][s+1].push(y);if(l&&(l=3*x[a++],d.normal.set(w[l++],w[l++],w[l]),v.normal.copy(d.normal)),m)for(n=0;4>n;n++)l=3*x[a++],m=new c(w[l++],w[l++],w[l]),2!==n&&d.vertexNormals.push(m),0!==n&&v.vertexNormals.push(m);if(h&&(h=x[a++],h=S[h],d.color.setHex(h),v.color.setHex(h)),f)for(n=0;4>n;n++)h=x[a++],h=S[h],2!==n&&d.vertexColors.push(new $(h)),0!==n&&v.vertexColors.push(new $(h));b.faces.push(d),b.faces.push(v)}else{if(d=new ut,d.a=x[a++],d.b=x[a++],d.c=x[a++],s&&(s=x[a++],d.materialIndex=s),s=b.faces.length,n)for(n=0;no;o++)p=x[a++],y=g[2*p],p=g[2*p+1],y=new r(y,p),b.faceVertexUvs[n][s].push(y);if(l&&(l=3*x[a++],d.normal.set(w[l++],w[l++],w[l])),m)for(n=0;3>n;n++)l=3*x[a++],m=new c(w[l++],w[l++],w[l]),d.vertexNormals.push(m);if(h&&(h=x[a++],d.color.setHex(S[h])),f)for(n=0;3>n;n++)h=x[a++],d.vertexColors.push(new $(S[h]));b.faces.push(d)}if(_=t,a=void 0!==_.influencesPerVertex?_.influencesPerVertex:2,_.skinWeights)for(u=0,x=_.skinWeights.length;u(s=i[r]-n))a=r+1;else{if(!(0e&&(e=0),1Number.EPSILON&&(h.normalize(),i=Math.acos(xi.clamp(o[r-1].dot(o[r]),-1,1)),s[r].applyMatrix4(l.makeRotationAxis(h,i))),a[r].crossVectors(o[r],s[r]);if(!0===e)for(i=Math.acos(xi.clamp(s[0].dot(s[t]),-1,1)),i/=t,0=e)return e=r[t]-e,t=this.curves[t],r=t.getLength(),t.getPointAt(0===r?0:1-e/r);t++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,n=this.curves.length;rn;)n+=e;for(;n>e;)n-=e;ns.length-2?s.length-1:t+1],s=s[t>s.length-3?s.length-1:t+2];return new r(un(e,n.x,i.x,o.x,s.x),un(e,n.y,i.y,o.y,s.y))},(gn.prototype=Object.create(pn.prototype)).constructor=gn,gn.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,o=this.v3;return new r(ln(t,e.x,n.x,i.x,o.x),ln(t,e.y,n.y,i.y,o.y))},(yn.prototype=Object.create(pn.prototype)).constructor=yn,yn.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new r(hn(t,e.x,n.x,i.x),hn(t,e.y,n.y,i.y))};var Ki=Object.assign(Object.create(dn.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;eNumber.EPSILON){if(0>u&&(s=e[o],c=-c,a=e[i],u=-u),!(t.ya.y))if(t.y===s.y){if(t.x===s.x)return!0}else{if(0==(i=u*(t.x-s.x)-c*(t.y-s.y)))return!0;0>i||(n=!n)}}else if(t.y===s.y&&(a.x<=t.x&&t.x<=s.x||s.x<=t.x&&t.x<=a.x))return!0}return n})(f.p,l[m].p)&&(n!==m&&s.push({froms:n,tos:m,hole:u}),h?(h=!1,a[m].push(f)):d=!0);h&&a[n].push(f)}0n&&this._mixBufferRegion(r,t,3*e,1-n,e);for(var n=e,o=e+e;n!==o;++n)if(r[n]!==r[n+e]){i.setValue(r,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,r=3*e;this.binding.getValue(t,r);for(var n=e;n!==r;++n)t[n]=t[r+n%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,r,n,i){if(.5<=n)for(n=0;n!==i;++n)t[e+n]=t[r+n]},_slerp:function(t,e,r,n){a.slerpFlat(t,e,t,e,t,r,n)},_lerp:function(t,e,r,n,i){for(var o=1-n,s=0;s!==i;++s){var a=e+s;t[a]=t[a]*o+t[r+s]*n}}}),Object.assign(Rn.prototype,{getValue:function(t,e){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}}),Object.assign(Ln,{Composite:Rn,create:function(t,e,r){return t&&t.isAnimationObjectGroup?new Ln.Composite(t,e,r):new Ln(t,e,r)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var t=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),e=["material","materials","bones"];return function(r){var n=t.exec(r);if(!n)throw Error("PropertyBinding: Cannot parse trackName: "+r);var i=(n={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]}).nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var o=n.nodeName.substring(i+1);-1!==e.indexOf(o)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+r);return n}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r=r){var l=r++,p=e[l];for(n[p.uuid]=h,e[h]=p,n[u]=l,e[l]=c,c=0,u=o;c!==u;++c){var f=(p=i[c])[h];p[h]=p[l],p[l]=f}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,s=o.length,a=0,c=arguments.length;a!==c;++a){var u=arguments[a].uuid,h=i[u];if(void 0!==h)if(delete i[u],h(e=(t-i)*r)||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants;for(var i=this._propertyBindings,o=0,s=e.length;o!==s;++o)e[o].evaluate(r),i[o].accumulate(n,t)}}else this._updateWeight(t)},_updateWeight:function(t){e=0;if(this.enabled){var e=this.weight,r=this._weightInterpolant;if(null!==r){var n=r.evaluate(t)[0],e=e*n;t>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){e=0;if(!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;if(null!==r){e=e*r.evaluate(t)[0];t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e},_updateTime:function(t){o=this.time+t;if(0===t)return o;var e=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r)t:{if(-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1)),o>=e)o=e;else{if(!(0>o))break t;o=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1})}else{if(r=2202===r,-1===n&&(0<=t?(n=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),o>=e||0>o){var i=Math.floor(o/e),o=o-e*i,n=n+Math.abs(i),s=this.repetitions-n;0>s?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,o=0t,this._setEndings(t,!t,r)):this._setEndings(!1,!1,r),this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i}))}if(r&&1==(1&n))return this.time=o,e-o}return this.time=o},_setEndings:function(t,e,r){var n=this._interpolantSettings;r?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(t,e,r){var n=this._mixer,i=n.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=n._lendControlInterpolant()),n=o.parameterPositions,o=o.sampleValues,n[0]=i,o[0]=e,n[1]=i+t,o[1]=r,this}}),Object.assign(Dn.prototype,e.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,n=t._clip.tracks,i=n.length,o=t._propertyBindings,s=t._interpolants,a=r.uuid,c=this._bindingsByRootAndName,u=c[a];for(void 0===u&&(u={},c[a]=u),c=0;c!==i;++c){var h=n[c],l=h.name,p=u[l];if(void 0===p){if(void 0!==(p=o[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,a,l));continue}++(p=new jn(Ln.create(r,l,e&&e._propertyBindings[c].binding.parsedPath),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,a,l)}o[c]=p,s[c].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.uuid,n=this._actionsByClip[r];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,r,e)}for(r=0,n=(e=t._propertyBindings).length;r!==n;++r){var i=e[r];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,n=e.length;r!==n;++r){var i=e[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&ta.end&&(a.end=o),e||(e=c)}}for(c in n)a=n[c],this.createAnimation(c,a.start,a.end,t);this.firstAnimation=e},Yn.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},Yn.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},Yn.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},Yn.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},Yn.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},Yn.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},Yn.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},Yn.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},Yn.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},Yn.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},Yn.prototype.update=function(t){for(var e=0,r=this.animationsList.length;en.duration||0>n.time)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),0>n.time&&(n.time=0,n.directionBackwards=!1)):(n.time%=n.duration,0>n.time&&(n.time+=n.duration));var o=n.start+xi.clamp(Math.floor(n.time/i),0,n.length-1),s=n.weight;o!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*s,this.morphTargetInfluences[o]=0,n.lastFrame=n.currentFrame,n.currentFrame=o),i=n.time%i/i,n.directionBackwards&&(i=1-i),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=i*s,this.morphTargetInfluences[n.lastFrame]=(1-i)*s):this.morphTargetInfluences[n.currentFrame]=s}}},(Kn.prototype=Object.create(ot.prototype)).constructor=Kn,Kn.prototype.isImmediateRenderObject=!0,(Zn.prototype=Object.create(Me.prototype)).constructor=Zn,Zn.prototype.update=function(){var t=new c,e=new c,r=new J;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,s=this.object.geometry;if(s&&s.isGeometry)for(var a=s.vertices,c=s.faces,u=s=0,h=c.length;ur.y?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),hi.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},hi.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},(li.prototype=Object.create(Me.prototype)).constructor=li;var eo=new c,ro=new pi,no=new pi,io=new pi;fi.prototype=Object.create(pn.prototype),fi.prototype.constructor=fi,fi.prototype.getPoint=function(t){var e=this.points;t*=(s=e.length)-(this.closed?0:1),t-=a=Math.floor(t),this.closed?a+=0a&&(a=1),1e-4>s&&(s=a),1e-4>o&&(o=a),ro.initNonuniformCatmullRom(r.x,n.x,i.x,e.x,s,a,o),no.initNonuniformCatmullRom(r.y,n.y,i.y,e.y,s,a,o),io.initNonuniformCatmullRom(r.z,n.z,i.z,e.z,s,a,o)}else"catmullrom"===this.type&&(s=void 0!==this.tension?this.tension:.5,ro.initCatmullRom(r.x,n.x,i.x,e.x,s),no.initCatmullRom(r.y,n.y,i.y,e.y,s),io.initCatmullRom(r.z,n.z,i.z,e.z,s));return new c(ro.calc(t),no.calc(t),io.calc(t))},(di.prototype=Object.create(pn.prototype)).constructor=di,di.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2,i=this.v3;return new c(ln(t,e.x,r.x,n.x,i.x),ln(t,e.y,r.y,n.y,i.y),ln(t,e.z,r.z,n.z,i.z))},(mi.prototype=Object.create(pn.prototype)).constructor=mi,mi.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2;return new c(hn(t,e.x,r.x,n.x),hn(t,e.y,r.y,n.y),hn(t,e.z,r.z,n.z))},(vi.prototype=Object.create(pn.prototype)).constructor=vi,vi.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new c;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},(gi.prototype=Object.create(mn.prototype)).constructor=gi,pn.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(pn.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},yi.prototype=Object.create(fi.prototype),bi.prototype=Object.create(fi.prototype),_i.prototype=Object.create(fi.prototype),Object.assign(_i.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),ii.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},ti.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(V.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(K.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),At.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},xi.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(J.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(u.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new c),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,r,n,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,r,i,o)}}),Q.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},a.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Pt.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(_n.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Je(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new cr(this,t)}}),Object.assign(r.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(c.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,r){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(i.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),ht.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(ot.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(ye.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(be.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(pn.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),ct.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Lr.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(lt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(St.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(St.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(kn.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(W.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new $}}}),Object.defineProperties(xr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(X.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(le.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(le.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(et.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(t){t=1!==t,console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(o.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),On.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Mn).load(t,function(t){e.setBuffer(t)}),this},An.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},t.WebGLRenderTargetCube=s,t.WebGLRenderTarget=o,t.WebGLRenderer=le,t.ShaderLib=Ni,t.UniformsLib=ji,t.UniformsUtils=Ri,t.ShaderChunk=Li,t.FogExp2=pe,t.Fog=fe,t.Scene=de,t.LensFlare=me,t.Sprite=ge,t.LOD=ye,t.SkinnedMesh=xe,t.Skeleton=be,t.Bone=_e,t.Mesh=Rt,t.LineSegments=Me,t.LineLoop=Ee,t.Line=Se,t.Points=Ce,t.Group=Oe,t.VideoTexture=Pe,t.DataTexture=h,t.CompressedTexture=Ae,t.CubeTexture=l,t.CanvasTexture=je,t.DepthTexture=Re,t.Texture=n,t.CompressedTextureLoader=Or,t.DataTextureLoader=Pr,t.CubeTextureLoader=jr,t.TextureLoader=Rr,t.ObjectLoader=cn,t.MaterialLoader=nn,t.BufferGeometryLoader=on,t.DefaultLoadingManager=$i,t.LoadingManager=Tr,t.JSONLoader=an,t.ImageLoader=Ar,t.FontLoader=Sn,t.FileLoader=Cr,t.Loader=sn,t.Cache=Gi,t.AudioLoader=Mn,t.SpotLightShadow=Dr,t.SpotLight=kr,t.PointLight=Fr,t.RectAreaLight=Gr,t.HemisphereLight=Nr,t.DirectionalLightShadow=Br,t.DirectionalLight=Ur,t.AmbientLight=zr,t.LightShadow=Ir,t.Light=Lr,t.StereoCamera=En,t.PerspectiveCamera=ct,t.OrthographicCamera=at,t.CubeCamera=Tn,t.ArrayCamera=ae,t.Camera=st,t.AudioListener=Cn,t.PositionalAudio=Pn,t.AudioContext=Ji,t.AudioAnalyser=An,t.Audio=On,t.VectorKeyframeTrack=Xr,t.StringKeyframeTrack=Jr,t.QuaternionKeyframeTrack=Kr,t.NumberKeyframeTrack=Zr,t.ColorKeyframeTrack=tn,t.BooleanKeyframeTrack=Qr,t.PropertyMixer=jn,t.PropertyBinding=Ln,t.KeyframeTrack=en,t.AnimationUtils=Vi,t.AnimationObjectGroup=Nn,t.AnimationMixer=Dn,t.AnimationClip=rn,t.Uniform=kn,t.InstancedBufferGeometry=Fn,t.BufferGeometry=St,t.GeometryIdCount=function(){return ki++},t.Geometry=ht,t.InterleavedBufferAttribute=Bn,t.InstancedInterleavedBuffer=zn,t.InterleavedBuffer=Un,t.InstancedBufferAttribute=Gn,t.Face3=ut,t.Object3D=ot,t.Raycaster=$n,t.Layers=it,t.EventDispatcher=e,t.Clock=qn,t.QuaternionLinearInterpolant=Yr,t.LinearInterpolant=Hr,t.DiscreteInterpolant=qr,t.CubicInterpolant=Vr,t.Interpolant=$r,t.Triangle=jt,t.Math=xi,t.Spherical=Wn,t.Cylindrical=Xn,t.Plane=Q,t.Frustum=tt,t.Sphere=Z,t.Ray=Pt,t.Matrix4=u,t.Matrix3=J,t.Box3=K,t.Box2=V,t.Line3=At,t.Euler=nt,t.Vector4=i,t.Vector3=c,t.Vector2=r,t.Quaternion=a,t.Color=$,t.MorphBlendMesh=Yn,t.ImmediateRenderObject=Kn,t.VertexNormalsHelper=Zn,t.SpotLightHelper=Jn,t.SkeletonHelper=ti,t.PointLightHelper=ei,t.RectAreaLightHelper=ri,t.HemisphereLightHelper=ni,t.GridHelper=ii,t.PolarGridHelper=oi,t.FaceNormalsHelper=si,t.DirectionalLightHelper=ai,t.CameraHelper=ci,t.BoxHelper=ui,t.ArrowHelper=hi,t.AxisHelper=li,t.CatmullRomCurve3=fi,t.CubicBezierCurve3=di,t.QuadraticBezierCurve3=mi,t.LineCurve3=vi,t.ArcCurve=gi,t.EllipseCurve=mn,t.SplineCurve=vn,t.CubicBezierCurve=gn,t.QuadraticBezierCurve=yn,t.LineCurve=fn,t.Shape=_n,t.Path=bn,t.ShapePath=xn,t.Font=wn,t.CurvePath=dn,t.Curve=pn,t.ShapeUtils=Bi,t.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new Oe,n=0,i=e.length;n0)for(var r=this.length>>1;r>=0;r--)this._down(r)}function i(t,e){return te?1:0}e.exports=n,n.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return--this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length,i=n>>1,o=e[t];t=0)break;e[t]=c,t=s}e[t]=o}}},{}],178:[function(t,e,r){(function(){function t(t){function e(e,r,n,i,o,s){for(;o>=0&&o0?0:a-1;return arguments.length<3&&(i=r[s?s[c]:c],c+=t),e(r,n,i,s,c,a)}}function n(t){return function(e,r,n){r=w(r,n);for(var i=C(e),o=t>0?0:i-1;o>=0&&o0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(r&&o&&a)return o=r(n,i),n[o]===i?o:-1;if(i!==i)return(o=e(p.call(n,s,a),_.isNaN))>=0?o+s:-1;for(o=t>0?s:a-1;o>=0&&o=0&&e<=T};_.each=_.forEach=function(t,e,r){e=x(e,r);var n,i;if(O(t))for(n=0,i=t.length;n=0},_.invoke=function(t,e){var r=p.call(arguments,2),n=_.isFunction(e);return _.map(t,function(t){var i=n?e:t[e];return null==i?i:i.apply(t,r)})},_.pluck=function(t,e){return _.map(t,_.property(e))},_.where=function(t,e){return _.filter(t,_.matcher(e))},_.findWhere=function(t,e){return _.find(t,_.matcher(e))},_.max=function(t,e,r){var n,i,o=-1/0,s=-1/0;if(null==e&&null!=t)for(var a=0,c=(t=O(t)?t:_.values(t)).length;ao&&(o=n);else e=w(e,r),_.each(t,function(t,r,n){((i=e(t,r,n))>s||i===-1/0&&o===-1/0)&&(o=t,s=i)});return o},_.min=function(t,e,r){var n,i,o=1/0,s=1/0;if(null==e&&null!=t)for(var a=0,c=(t=O(t)?t:_.values(t)).length;an||void 0===r)return 1;if(re?(s&&(clearTimeout(s),s=null),a=u,o=t.apply(n,i),s||(n=i=null)):s||!1===r.trailing||(s=setTimeout(c,h)),o}},_.debounce=function(t,e,r){var n,i,o,s,a,c=function(){var u=_.now()-s;u=0?n=setTimeout(c,e-u):(n=null,r||(a=t.apply(o,i),n||(o=i=null)))};return function(){o=this,i=arguments,s=_.now();var u=r&&!n;return n||(n=setTimeout(c,e)),u&&(a=t.apply(o,i),o=i=null),a}},_.wrap=function(t,e){return _.partial(e,t)},_.negate=function(t){return function(){return!t.apply(this,arguments)}},_.compose=function(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}},_.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},_.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},_.once=_.partial(_.before,2);var R=!{toString:null}.propertyIsEnumerable("toString"),L=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];_.keys=function(t){if(!_.isObject(t))return[];if(v)return v(t);var e=[];for(var r in t)_.has(t,r)&&e.push(r);return R&&o(t,e),e},_.allKeys=function(t){if(!_.isObject(t))return[];var e=[];for(var r in t)e.push(r);return R&&o(t,e),e},_.values=function(t){for(var e=_.keys(t),r=e.length,n=Array(r),i=0;i":">",'"':""","'":"'","`":"`"},D=_.invert(I),k=function(t){var e=function(e){return t[e]},r="(?:"+_.keys(t).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(i,e):t}};_.escape=k(I),_.unescape=k(D),_.result=function(t,e,r){var n=null==t?void 0:t[e];return void 0===n&&(n=r),_.isFunction(n)?n.call(t):n};var F=0;_.uniqueId=function(t){var e=++F+"";return t?t+e:e},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var B=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\u2028|\u2029/g,G=function(t){return"\\"+U[t]};_.template=function(t,e,r){!e&&r&&(e=r),e=_.defaults({},e,_.templateSettings);var n=RegExp([(e.escape||B).source,(e.interpolate||B).source,(e.evaluate||B).source].join("|")+"|$","g"),i=0,o="__p+='";t.replace(n,function(e,r,n,s,a){return o+=t.slice(i,a).replace(z,G),i=a+e.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\n__p+='"),e}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var s=new Function(e.variable||"obj","_",o)}catch(t){throw t.source=o,t}var a=function(t){return s.call(this,t,_)},c=e.variable||"obj";return a.source="function("+c+"){\n"+o+"}",a},_.chain=function(t){var e=_(t);return e._chain=!0,e};var $=function(t,e){return t._chain?_(e).chain():e};_.mixin=function(t){_.each(_.functions(t),function(e){var r=_[e]=t[e];_.prototype[e]=function(){var t=[this._wrapped];return l.apply(t,arguments),$(this,r.apply(_,t))}})},_.mixin(_),_.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=c[t];_.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],$(this,r)}}),_.each(["concat","join","slice"],function(t){var e=c[t];_.prototype[t]=function(){return $(this,e.apply(this._wrapped,arguments))}}),_.prototype.value=function(){return this._wrapped},_.prototype.valueOf=_.prototype.toJSON=_.prototype.value,_.prototype.toString=function(){return""+this._wrapped}}).call(this)},{}],179:[function(t,e,r){var n=t("./vdom/create-element.js");e.exports=n},{"./vdom/create-element.js":185}],180:[function(t,e,r){var n=t("./vtree/diff.js");e.exports=n},{"./vtree/diff.js":205}],181:[function(t,e,r){var n=t("./virtual-hyperscript/index.js");e.exports=n},{"./virtual-hyperscript/index.js":192}],182:[function(t,e,r){var n=t("./diff.js"),i=t("./patch.js"),o=t("./h.js"),s=t("./create-element.js"),a=t("./vnode/vnode.js"),c=t("./vnode/vtext.js");e.exports={diff:n,patch:i,h:o,create:s,VNode:a,VText:c}},{"./create-element.js":179,"./diff.js":180,"./h.js":181,"./patch.js":183,"./vnode/vnode.js":201,"./vnode/vtext.js":203}],183:[function(t,e,r){var n=t("./vdom/patch.js");e.exports=n},{"./vdom/patch.js":188}],184:[function(t,e,r){function n(t,e,r,n){if(n){var i=n[e];if(a(i))i.unhook&&i.unhook(t,e,r);else if("attributes"===e)for(var o in i)t.removeAttribute(o);else if("style"===e)for(var s in i)t.style[s]="";else t[e]="string"==typeof i?"":null}}function i(t,e,r,n,i){var a=r?r[n]:void 0;if("attributes"!==n)if(a&&s(a)&&o(a)!==o(i))t[n]=i;else{s(t[n])||(t[n]={});var c="style"===n?"":void 0;for(var u in i){var h=i[u];t[n][u]=void 0===h?c:h}}else for(var l in i){var p=i[l];void 0===p?t.removeAttribute(l):t.setAttribute(l,p)}}function o(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__?t.__proto__:t.constructor?t.constructor.prototype:void 0}var s=t("is-object"),a=t("../vnode/is-vhook.js");e.exports=function(t,e,r){for(var o in e){var c=e[o];void 0===c?n(t,o,c,r):a(c)?(n(t,o,c,r),c.hook&&c.hook(t,o,r?r[o]:void 0)):s(c)?i(t,0,r,o,c):t[o]=c}}},{"../vnode/is-vhook.js":196,"is-object":20}],185:[function(t,e,r){function n(t,e){var r=e?e.document||i:i,h=e?e.warn:null;if(t=u(t).a,c(t))return t.init();if(a(t))return r.createTextNode(t.text);if(!s(t))return h&&h("Item is not a valid virtual dom node",t),null;var l=null===t.namespace?r.createElement(t.tagName):r.createElementNS(t.namespace,t.tagName),p=t.properties;o(l,p);for(var f=t.children,d=0;d>0,i=t[n],o===s)return i>=e&&i<=r;if(ir))return!0;s=n-1}}return!1}function o(t,e){return t>e?1:-1}var s={};e.exports=function(t,e,r,i){return r&&0!==r.length?(r.sort(o),n(t,e,r,i,0)):{}}},{}],187:[function(t,e,r){function n(t,e){var r=t.parentNode;return r&&r.removeChild(t),c(t,e),null}function i(t,e,r){var n=r.render(e,r);return t&&t.appendChild(n),t}function o(t,e,r,n){var i;if(3===t.nodeType)t.replaceData(0,t.length,r.text),i=t;else{var o=t.parentNode;i=n.render(r,n),o&&i!==t&&o.replaceChild(i,t)}return i}function s(t,e,r,n){var i,o=d(e,r);i=o?r.update(e,t)||t:n.render(r,n);var s=t.parentNode;return s&&i!==t&&s.replaceChild(i,t),o||c(t,e),i}function a(t,e,r,n){var i=t.parentNode,o=n.render(r,n);return i&&o!==t&&i.replaceChild(o,t),o}function c(t,e){"function"==typeof e.destroy&&p(e)&&e.destroy(t)}function u(t,e){for(var r,n,i,o=t.childNodes,s={},a=0;a=c++?null:o[i.to])}function h(t,e){return t&&e&&t!==e&&t.parentNode&&t.parentNode.replaceChild(e,t),e}var l=t("./apply-properties"),p=t("../vnode/is-widget.js"),f=t("../vnode/vpatch.js"),d=t("./update-widget");e.exports=function(t,e,r){var c=t.type,p=t.vNode,d=t.patch;switch(c){case f.REMOVE:return n(e,p);case f.INSERT:return i(e,d,r);case f.VTEXT:return o(e,0,d,r);case f.WIDGET:return s(e,p,d,r);case f.VNODE:return a(e,0,d,r);case f.ORDER:return u(e,d),e;case f.PROPS:return l(e,d,p.properties),e;case f.THUNK:return h(e,r.patch(e,d,r));default:return e}}},{"../vnode/is-widget.js":199,"../vnode/vpatch.js":202,"./apply-properties":184,"./update-widget":189}],188:[function(t,e,r){function n(t,e,r){return r=r||{},r.patch=r.patch&&r.patch!==n?r.patch:i,r.render=r.render||u,r.patch(t,e,r)}function i(t,e,r){var n=s(e);if(0===n.length)return t;var i=h(t,e.a,n),c=t.ownerDocument;r.document||c===a||(r.document=c);for(var u=0;uh?u:h,f=0;f=i.length?e.length:i[c],g=0;g=v&&a.push(y)}for(var b,_=a.slice(),x=0,w=[],S=[],M=0;M>>0,a=s,c=[],u=0;u0){o.become(r),t._visitRemaining(e,u,r);break}r.visit(o,function(t){c=null,this.resolve(t)},function(t){this.resolved||(c.push(t),0==--a&&this.reject(c))})}else--a;return 0===a&&o.reject(new RangeError("any(): array must not be empty")),i},t.some=function(e,r){var n,i,o,s=t._defer(),a=s._handler,c=[],u=[],h=e.length>>>0,l=0;for(o=0;o(l=Math.min(r,l))?a.reject(new RangeError("some(): array must contain at least "+r+" item(s), but had "+l)):0===l&&a.resolve(c),o=0;o2?u.call(t,o(e),arguments[2]):u.call(t,o(e))},t.reduceRight=function(t,e){return arguments.length>2?h.call(t,o(e),arguments[2]):h.call(t,o(e))},t.prototype.spread=function(t){return this.then(c).then(function(e){return t.apply(this,e)})},t}})}(function(r){e.exports=r(t)})},{"../apply":209,"../state":222}],211:[function(t,e,r){!function(t){"use strict";t(function(){function t(){throw new TypeError("catch predicate must be a function")}function e(t,e){return r(e)?t instanceof e:e(t)}function r(t){return t===Error||null!=t&&t.prototype instanceof Error}function n(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function i(t){return t}return function(r){function o(t,r){return function(n){return e(n,r)?t.call(this,n):u(n)}}function s(t,e,r,i){var o=t.call(e);return n(o)?a(o,r,i):r(i)}function a(t,e,r){return c(t).then(function(){return e(r)})}var c=r.resolve,u=r.reject,h=r.prototype.catch;return r.prototype.done=function(t,e){this._handler.visit(this._handler.receiver,t,e)},r.prototype.catch=r.prototype.otherwise=function(e){return arguments.length<2?h.call(this,e):"function"!=typeof e?this.ensure(t):h.call(this,o(arguments[1],e))},r.prototype.finally=r.prototype.ensure=function(t){return"function"!=typeof t?this:this.then(function(e){return s(t,this,i,e)},function(e){return s(t,this,u,e)})},r.prototype.else=r.prototype.orElse=function(t){return this.then(void 0,function(){return t})},r.prototype.yield=function(t){return this.then(function(){return t})},r.prototype.tap=function(t){return this.then(t).yield(this)},r}})}(function(t){e.exports=t()})},{}],212:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.fold=function(e,r){var n=this._beget();return this._handler.fold(function(r,n,i){t._handler(r).fold(function(t,r,n){n.resolve(e.call(this,r,t))},n,this,i)},r,n._handler.receiver,n._handler),n},t}})}(function(t){e.exports=t()})},{}],213:[function(t,e,r){!function(t){"use strict";t(function(t){var e=t("../state").inspect;return function(t){return t.prototype.inspect=function(){return e(t._handler(this))},t}})}(function(r){e.exports=r(t)})},{"../state":222}],214:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){function e(t,n,i,o){function s(o,s){return r(i(o)).then(function(){return e(t,n,i,s)})}return r(o).then(function(e){return r(n(e)).then(function(n){return n?e:r(t(e)).spread(s)})})}var r=t.resolve;return t.iterate=function(t,r,n,i){return e(function(e){return[e,t(e)]},r,n,i)},t.unfold=e,t}})}(function(t){e.exports=t()})},{}],215:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.progress=function(t){return this.then(void 0,void 0,t)},t}})}(function(t){e.exports=t()})},{}],216:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t,e,n,i){return r.setTimer(function(){t(n,i,e)},e)}var r=t("../env"),n=t("../TimeoutError");return function(t){function i(t,r,n){e(o,t,r,n)}function o(t,e){e.resolve(t)}function s(t,e,r){var i=void 0===t?new n("timed out after "+r+"ms"):t;e.reject(i)}return t.prototype.delay=function(t){var e=this._beget();return this._handler.fold(i,t,void 0,e._handler),e},t.prototype.timeout=function(t,n){var i=this._beget(),o=i._handler,a=e(s,t,n,i._handler);return this._handler.visit(o,function(t){r.clearTimer(a),this.resolve(t)},function(t){r.clearTimer(a),this.reject(t)},o.notify),i},t}})}(function(r){e.exports=r(t)})},{"../TimeoutError":208,"../env":219}],217:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t){throw t}function r(){}var n=t("../env").setTimer,i=t("../format");return function(t){function o(t){t.handled||(f.push(t),h("Potentially unhandled rejection ["+t.id+"] "+i.formatError(t.value)))}function s(t){var e=f.indexOf(t);e>=0&&(f.splice(e,1),l("Handled previous rejection ["+t.id+"] "+i.formatObject(t.value)))}function a(t,e){p.push(t,e),null===d&&(d=n(c,0))}function c(){for(d=null;p.length>0;)p.shift()(p.shift())}var u,h=r,l=r;"undefined"!=typeof console&&(u=console,h=void 0!==u.error?function(t){u.error(t)}:function(t){u.log(t)},l=void 0!==u.info?function(t){u.info(t)}:function(t){u.log(t)}),t.onPotentiallyUnhandledRejection=function(t){a(o,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){a(s,t)},t.onFatalRejection=function(t){a(e,t.value)};var p=[],f=[],d=null;return t}})}(function(r){e.exports=r(t)})},{"../env":219,"../format":220}],218:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.with=t.prototype.withThis=function(t){var e=this._beget(),r=e._handler;return r.receiver=t,this._handler.chain(r,t),e},t}})}(function(t){e.exports=t()})},{}],219:[function(t,e,r){(function(r){!function(t){"use strict";t(function(t){var e,n="undefined"!=typeof setTimeout&&setTimeout,i=function(t,e){return setTimeout(t,e)},o=function(t){return clearTimeout(t)},s=function(t){return n(t,0)};if(void 0!==r&&"[object process]"===Object.prototype.toString.call(r))s=function(t){return r.nextTick(t)};else if(e="undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver)s=function(t){var e,r=document.createTextNode("");new t(function(){var t=e;e=void 0,t()}).observe(r,{characterData:!0});var n=0;return function(t){e=t,r.data=n^=1}}(e);else if(!n){var a=t("vertx");i=function(t,e){return a.setTimer(e,t)},o=a.cancelTimer,s=a.runOnLoop||a.runOnContext}return{setTimer:i,clearTimer:o,asap:s}})}(function(r){e.exports=r(t)})}).call(this,t("_process"))},{_process:6}],220:[function(t,e,r){!function(t){"use strict";t(function(){function t(t){var r=String(t);return"[object Object]"===r&&"undefined"!=typeof JSON&&(r=e(t,r)),r}function e(t,e){try{return JSON.stringify(t)}catch(t){return e}}return{formatError:function(e){var r="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:t(e);return e instanceof Error?r:r+" (WARNING: non-Error used)"},formatObject:t,tryStringify:e}})}(function(t){e.exports=t()})},{}],221:[function(t,e,r){(function(t){!function(e){"use strict";e(function(){return function(e){function r(t,e){this._handler=t===v?e:n(t)}function n(t){function e(t){r.reject(t)}var r=new y;try{t(function(t){r.resolve(t)},e,function(t){r.notify(t)})}catch(t){e(t)}return r}function i(t){return j(t)?t:new r(v,new b(f(t)))}function o(t){return new r(v,new b(new w(t)))}function s(){return K}function a(t,e){return new e(v,new y(t.receiver,t.join().context))}function c(t,e,n){function i(t,e,r){h[t]=e,0==--c&&r.become(new x(h))}for(var o,s="function"==typeof e?function(r,o,s){s.resolved||u(n,i,r,t(e,o,r),s)}:i,a=new y,c=n.length>>>0,h=new Array(c),l=0;l0?e(r,o.value,i):(i.become(o),h(t,r+1,o))}else e(r,n,i)}function h(t,e,r){for(var n=e;n0||"function"!=typeof e&&i<0)return new this.constructor(v,n);var o=this._beget(),s=o._handler;return n.chain(s,n.receiver,t,e,r),o},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype._beget=function(){return a(this._handler,this.constructor)},r.all=function(t){return c(z,null,t)},r.race=function(t){return"object"!=typeof t||null===t?o(new TypeError("non-iterable passed to race()")):0===t.length?s():1===t.length?i(t[0]):p(t)},r._traverse=function(t,e){return c(D,t,e)},r._visitRemaining=h,v.prototype.when=v.prototype.become=v.prototype.notify=v.prototype.fail=v.prototype._unreport=v.prototype._report=G,v.prototype._state=0,v.prototype.state=function(){return this._state},v.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},v.prototype.chain=function(t,e,r,n,i){this.when({resolver:t,receiver:e,fulfilled:r,rejected:n,progress:i})},v.prototype.visit=function(t,e,r,n){this.chain(X,t,e,r,n)},v.prototype.fold=function(t,e,r,n){this.when(new A(t,e,r,n))},U(v,g),g.prototype.become=function(t){t.fail()};var X=new g;U(v,y),y.prototype._state=0,y.prototype.resolve=function(t){this.become(f(t))},y.prototype.reject=function(t){this.resolved||this.become(new w(t))},y.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if((t=t.handler)===this)return this.handler=E();return t},y.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var r=0;r0?r(n.value):e(n.value)}}})}(function(t){e.exports=t()})},{}],223:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t,e,r,n){var i=m.resolve(t);return arguments.length<2?i:i.then(e,r,n)}function r(t){return function(){for(var e=0,r=arguments.length,n=new Array(r);e0?2*Math.atan(.5*n.basicWidth/(o*n.focal)):0;return[t._spatial.degToRad(r.ca),s]}).distinctUntilChanged(function(e,r){return Math.abs(r[0]-e[0])2*Math.PI-Math.PI/90)return i.h("circle",{attributes:{cx:"0",cy:"0",fill:r,r:"1"},namespace:this._svgNamespace},[]);var n=t-e/2-Math.PI/2,o=n+e,s=Math.cos(n),a=Math.sin(n),c=Math.cos(o),u=Math.sin(o),h="M 0 0 "+s+" "+a+" A 1 1 0 "+(e>=Math.PI?1:0)+" 1 "+c+" "+u;return i.h("path",{attributes:{d:h,fill:r},namespace:this._svgNamespace},[])},e.componentName="bearing",e}(s.Component);r.BearingComponent=c,s.ComponentService.register(c),r.default=c},{"../Component":226,"../Geo":229,"rxjs/Observable":29,"virtual-dom":182}],242:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/from"),t("rxjs/add/observable/merge"),t("rxjs/add/observable/of"),t("rxjs/add/observable/zip"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/distinct"),t("rxjs/add/operator/expand"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/mergeAll"),t("rxjs/add/operator/skip"),t("rxjs/add/operator/switchMap");var o=t("../Edge"),s=t("../Component"),a=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype.setDepth=function(t){this.configure({depth:t})},e.prototype._activate=function(){var t=this;this._sequenceSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}).filter(function(t){return t.cached}),this._configuration$).switchMap(function(e){var r=e[0],n=e[1],s=Math.max(0,Math.min(4,n.depth.sequence)),a=t._cache$(r.edges,o.EdgeDirection.Next,s),c=t._cache$(r.edges,o.EdgeDirection.Prev,s);return i.Observable.merge(a,c).catch(function(t,e){return console.error("Failed to cache sequence edges.",t),i.Observable.empty()})}).subscribe(function(){}),this._spatialSubscription=this._navigator.stateService.currentNode$.switchMap(function(t){return i.Observable.combineLatest(i.Observable.of(t),t.spatialEdges$.filter(function(t){return t.cached}))}).combineLatest(this._configuration$,function(t,e){return[t[0],t[1],e]}).switchMap(function(e){var r=e[0],n=e[1].edges,s=e[2].depth,a=Math.max(0,Math.min(2,s.pano)),c=r.pano?0:Math.max(0,Math.min(3,s.step)),u=r.pano?0:Math.max(0,Math.min(1,s.turn)),h=t._cache$(n,o.EdgeDirection.Pano,a),l=t._cache$(n,o.EdgeDirection.StepForward,c),p=t._cache$(n,o.EdgeDirection.StepBackward,c),f=t._cache$(n,o.EdgeDirection.StepLeft,c),d=t._cache$(n,o.EdgeDirection.StepRight,c),m=t._cache$(n,o.EdgeDirection.TurnLeft,u),v=t._cache$(n,o.EdgeDirection.TurnRight,u),g=t._cache$(n,o.EdgeDirection.TurnU,u);return i.Observable.merge(l,p,f,d,h,m,v,g).catch(function(t,e){return console.error("Failed to cache spatial edges.",t),i.Observable.empty()})}).subscribe(function(){})},e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._spatialSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}},e.prototype._cache$=function(t,e,r){var n=this;return i.Observable.zip(i.Observable.of(t),i.Observable.of(r)).expand(function(t){var r=t[0],o=t[1],s=[];if(o>0)for(var a=0,c=r;a-1?t.sequenceEdges$:t.spatialEdges$).first(function(t){return t.cached}).map(function(t){return t.edges})},e.componentName="cache",e}(s.Component);r.CacheComponent=a,s.ComponentService.register(a),r.default=a},{"../Component":226,"../Edge":227,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/expand":60,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeAll":67,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/skip":75,"rxjs/add/operator/switchMap":79}],243:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/BehaviorSubject"),o=t("rxjs/Subject");t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var s=function(t){function e(e,r,n){var s=t.call(this)||this;return s._activated$=new i.BehaviorSubject(!1),s._configurationSubject$=new o.Subject,s._activated=!1,s._container=r,s._name=e,s._navigator=n,s._configuration$=s._configurationSubject$.startWith(s.defaultConfiguration).scan(function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}).publishReplay(1).refCount(),s._configuration$.subscribe(function(){}),s}return n(e,t),Object.defineProperty(e.prototype,"activated",{get:function(){return this._activated},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activated$",{get:function(){return this._activated$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultConfiguration",{get:function(){return this._getDefaultConfiguration()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),e.prototype.activate=function(t){this._activated||(void 0!==t&&this._configurationSubject$.next(t),this._activated=!0,this._activate(),this._activated$.next(!0))},e.prototype.configure=function(t){this._configurationSubject$.next(t)},e.prototype.deactivate=function(){this._activated&&(this._activated=!1,this._deactivate(),this._container.domRenderer.clear(this._name),this._container.glRenderer.clear(this._name),this._activated$.next(!1))},e.prototype.resize=function(){},e.componentName="not_worthy",e}(t("../Utils").EventEmitter);r.Component=s,r.default=s},{"../Utils":235,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78}],244:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=t("../Error"),o=function(){function t(e,r){this._components={},this._container=e,this._navigator=r;for(var i=0,o=n.values(t.registeredComponents);i0&&t.description?{name:e._name,vnode:e._getRouteAnnotationNode(t.description)}:{name:e._name,vnode:o.h("div",[])}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe(),this._disposableDescription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype.play=function(){this.configure({playing:!0})},e.prototype.stop=function(){this.configure({playing:!1})},e.prototype._getRouteAnnotationNode=function(t){return o.h("div.RouteFrame",{},[o.h("p",{textContent:t},[])])},e.componentName="route",e}(a.Component);r.RouteComponent=l,a.ComponentService.register(l),r.default=l},{"../Component":226,"rxjs/Observable":29,"rxjs/add/observable/fromPromise":43,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":73,underscore:178,"virtual-dom":182}],252:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable");t("rxjs/add/operator/buffer"),t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/scan");var o=t("../Component"),s=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){var t=this;this._sequenceSubscription=this._navigator.stateService.currentNode$.scan(function(t,e){var r=e.sequenceKey;return t.report=[],r in t.reported||(t.report=[r],t.reported[r]=!0),t},{report:[],reported:{}}).filter(function(t){return t.report.length>0}).mergeMap(function(e){return t._navigator.apiV3.sequenceViewAdd$(e.report).catch(function(t,r){return console.error("Failed to report sequence stats ("+e.report+")",t),i.Observable.empty()})}).subscribe(function(){}),this._imageSubscription=this._navigator.stateService.currentNode$.map(function(t){return t.key}).buffer(this._navigator.stateService.currentNode$.debounceTime(5e3)).scan(function(t,e){t.report=[];for(var r=0,n=e;r0}).mergeMap(function(e){return t._navigator.apiV3.imageViewAdd$(e.report).catch(function(t,r){return console.error("Failed to report image stats ("+e.report+")",t),i.Observable.empty()})}).subscribe(function(){})},e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._imageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="stats",e}(o.Component);r.StatsComponent=s,o.ComponentService.register(s),r.default=s},{"../Component":226,"rxjs/Observable":29,"rxjs/add/operator/buffer":49,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":73}],253:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("rxjs/Observable"),s=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/do"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/share");var a=t("../../Component"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._renderer=new a.DirectionDOMRenderer(i.defaultConfiguration,r.element),i._hoveredKeySubject$=new s.Subject,i._hoveredKey$=i._hoveredKeySubject$.share(),i}return n(e,t),Object.defineProperty(e.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),e.prototype.setHighlightKey=function(t){this.configure({highlightKey:t})},e.prototype.setMinWidth=function(t){this.configure({minWidth:t})},e.prototype.setMaxWidth=function(t){this.configure({maxWidth:t})},e.prototype.resize=function(){this._renderer.resize(this._container.element)},e.prototype._activate=function(){var t=this;this._configurationSubscription=this._configuration$.subscribe(function(e){t._renderer.setConfiguration(e)}),this._nodeSubscription=this._navigator.stateService.currentNode$.do(function(e){t._container.domRenderer.render$.next({name:t._name,vnode:i.h("div",{},[])}),t._renderer.setNode(e)}).withLatestFrom(this._configuration$).switchMap(function(e){var r=e[0],n=e[1];return r.spatialEdges$.withLatestFrom(n.distinguishSequence?t._navigator.graphService.cacheSequence$(r.sequenceKey).catch(function(t,e){return console.error("Failed to cache sequence ("+r.sequenceKey+")",t),o.Observable.empty()}):o.Observable.of(null))}).subscribe(function(e){t._renderer.setEdges(e[0],e[1])}),this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.do(function(e){t._renderer.setRenderCamera(e)}).map(function(e){return t._renderer}).filter(function(t){return t.needsRender}).map(function(e){return{name:t._name,vnode:e.render(t._navigator)}}).subscribe(this._container.domRenderer.render$),this._hoveredKeySubscription=o.Observable.combineLatest([this._container.domRenderer.element$,this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$.startWith(null),this._container.mouseService.mouseUp$.startWith(null)],function(t,e,r,n){return t}).map(function(t){for(var e=t.getElementsByClassName("DirectionsPerspective"),r=0;re?t:e},t}();r.DirectionDOMCalculator=i,r.default=i},{"../../Geo":229}],255:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("virtual-dom"),i=t("../../Component"),o=t("../../Edge"),s=t("../../Geo"),a=function(){function t(t,e){this._isEdge=!1,this._spatial=new s.Spatial,this._calculator=new i.DirectionDOMCalculator(t,e),this._node=null,this._rotation={phi:0,theta:0},this._epsilon=.5*Math.PI/180,this._highlightKey=null,this._distinguishSequence=!1,this._needsRender=!1,this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[],this._stepDirections=[o.EdgeDirection.StepForward,o.EdgeDirection.StepBackward,o.EdgeDirection.StepLeft,o.EdgeDirection.StepRight],this._turnDirections=[o.EdgeDirection.TurnLeft,o.EdgeDirection.TurnRight,o.EdgeDirection.TurnU],this._turnNames={},this._turnNames[o.EdgeDirection.TurnLeft]="TurnLeft",this._turnNames[o.EdgeDirection.TurnRight]="TurnRight",this._turnNames[o.EdgeDirection.TurnU]="TurnAround";var r=!!document.documentMode;this._isEdge=!r&&!!window.StyleMedia}return Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.render=function(t){this._needsRender=!1;var e=this._rotation,r=[],n=[];return this._node.pano?r=r.concat(this._createPanoArrows(t,e)):(r=(r=r.concat(this._createPerspectiveToPanoArrows(t,e))).concat(this._createStepArrows(t,e)),n=n.concat(this._createTurnArrows(t))),this._getContainer(r,n,e)},t.prototype.setEdges=function(t,e){this._setEdges(t,e),this._setNeedsRender()},t.prototype.setNode=function(t){this._node=t,this._clearEdges(),this._setNeedsRender()},t.prototype.setRenderCamera=function(t){var e=t.rotation;Math.abs(e.phi-this._rotation.phi)-1?this._stepEdges.push(c):this._turnDirections.indexOf(i)>-1?this._turnEdges.push(c):c.data.direction===o.EdgeDirection.Pano&&this._panoEdges.push(c)}if(this._distinguishSequence&&null!=e)for(var s=0,a=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);s-1&&(c+="Sequence"),this._highlightKey===e&&(c+="Highlight");var u=n.h("div."+r,{},[]);return n.h("div."+c,a,[u])},t.prototype._createVNodeDisabled=function(t,e,r){return this._createVNode(t,e,r,this._calculator.outerRadius,"DirectionsArrowDisabled","DirectionsCircleDisabled")},t.prototype._createVNode=function(t,e,r,i,o,s,a,c){var u=this._calculator.angleToCoordinates(e-r.phi),h=Math.round(-i*u[1]+.5*this._calculator.containerWidth),l=Math.round(-i*u[0]+.5*this._calculator.containerHeight),p=this._calculator.relativeAngleToCoordiantes(e,r.phi),f=this._calculator.shadowOffset,d="drop-shadow("+-f*p[1]+"px "+f*p[0]+"px 1px rgba(0,0,0,0.8))",m={style:{"-webkit-filter":d,filter:d}},v=n.h("div."+o,m,[]),g=-this._spatial.radToDeg(e-r.phi),y=c?"translate("+h+"px, "+l+"px) rotate("+g+"deg) translateZ(-0.01px)":"translate("+h+"px, "+l+"px) rotate("+g+"deg)",b={attributes:{"data-key":t},onclick:a,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:y,width:this._calculator.stepCircleSizeCss}};return this._sequenceEdgeKeys.indexOf(t)>-1&&(s+="Sequence"),this._highlightKey===t&&(s+="Highlight"),n.h("div."+s,b,[v])},t.prototype._getContainer=function(t,e,r){var i=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",o={oncontextmenu:function(t){t.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:i,width:this._calculator.containerWidthCss}};return n.h("div.DirectionsPerspective",o,e.concat(t))},t}();r.DirectionDOMRenderer=a,r.default=a},{"../../Component":226,"../../Edge":227,"../../Geo":229,"virtual-dom":182}],256:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/operator/catch"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/pairwise"),t("rxjs/add/operator/publish"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/skipWhile"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/takeUntil"),t("rxjs/add/operator/withLatestFrom");var s=t("../../Component"),a=t("../../Render"),c=t("../../Tiles"),u=t("../../Utils"),h=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._imageTileLoader=new c.ImageTileLoader(u.Urls.tileScheme,u.Urls.tileDomain,u.Urls.origin),i._roiCalculator=new c.RegionOfInterestCalculator,i._rendererOperation$=new o.Subject,i._rendererCreator$=new o.Subject,i._rendererDisposer$=new o.Subject,i._renderer$=i._rendererOperation$.scan(function(t,e){return e(t)},null).filter(function(t){return null!=t}).distinctUntilChanged(void 0,function(t){return t.frameId}),i._rendererCreator$.map(function(){return function(t){if(null!=t)throw new Error("Multiple image plane states can not be created at the same time");return new s.ImagePlaneGLRenderer}}).subscribe(i._rendererOperation$),i._rendererDisposer$.map(function(){return function(t){return t.dispose(),null}}).subscribe(i._rendererOperation$),i}return n(e,t),e.prototype._activate=function(){var t=this;this._rendererSubscription=this._renderer$.map(function(e){var r={name:t._name,render:{frameId:e.frameId,needsRender:e.needsRender,render:e.render.bind(e),stage:a.GLRenderStage.Background}};return e.clearNeedsRender(),r}).subscribe(this._container.glRenderer.render$),this._rendererCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(t){return function(e){return e.updateFrame(t),e}}).subscribe(this._rendererOperation$);var e=this._navigator.stateService.currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).combineLatest(this._configuration$).filter(function(t){return!0===t[1].imageTiling}).map(function(t){return t[0]}).withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$).map(function(e){var r=e[0].state,n=e[1],i=e[2],o=r.currentNode,s=r.currentTransform,a=Math.max(i.width,i.height)>1024?1024:512;return new c.TextureProvider(o.key,s.basicWidth,s.basicHeight,a,o.image,t._imageTileLoader,new c.ImageTileStore,n)}).publishReplay(1).refCount();this._textureProviderSubscription=e.subscribe(function(){}),this._setTextureProviderSubscription=e.map(function(t){return function(e){return e.setTextureProvider(t.key,t),e}}).subscribe(this._rendererOperation$),this._abortTextureProviderSubscription=e.pairwise().subscribe(function(t){t[0].abort()});var r=this._container.renderService.renderCameraFrame$.map(function(t){return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf()]}).pairwise().skipWhile(function(t){return t[1][2]-t[0][2]<0||0===t[1][2]}).map(function(t){var e=t[0][0].equals(t[1][0]),r=t[0][1].equals(t[1][1]),n=t[0][2]===t[1][2];return e&&r&&n}).distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._container.renderService.renderCameraFrame$.first()}).withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$);this._setRegionOfInterestSubscription=e.switchMap(function(e){return r.map(function(r){return[t._roiCalculator.computeRegionOfInterest(r[0],r[1],r[2]),e]})}).filter(function(t){return!t[1].disposed}).subscribe(function(t){var e=t[0];t[1].setRegionOfInterest(e)});var n=e.switchMap(function(t){return t.hasTexture$}).startWith(!1).publishReplay(1).refCount();this._hasTextureSubscription=n.subscribe(function(){});var o=this._navigator.stateService.currentNode$.debounceTime(1e3).withLatestFrom(n).filter(function(t){return!t[1]}).map(function(t){return t[0]}).filter(function(t){return t.pano?u.Settings.maxImageSize>u.Settings.basePanoramaSize:u.Settings.maxImageSize>u.Settings.baseImageSize}).switchMap(function(t){var e=t.pano?u.Settings.basePanoramaSize:u.Settings.baseImageSize;return Math.max(t.image.width,t.image.height)>e?i.Observable.empty():t.cacheImage$(u.Settings.maxImageSize).map(function(t){return[t.image,t]}).takeUntil(n.filter(function(t){return t})).catch(function(e,r){return console.error("Failed to fetch high res image ("+t.key+")",e),i.Observable.empty()})}).publish().refCount();this._updateBackgroundSubscription=o.withLatestFrom(e).subscribe(function(t){t[0][1].key!==t[1].key||t[1].disposed||t[1].updateBackground(t[0][0])}),this._updateTextureImageSubscription=o.map(function(t){return function(e){return e.updateTextureImage(t[0],t[1]),e}}).subscribe(this._rendererOperation$)},e.prototype._deactivate=function(){this._rendererDisposer$.next(null),this._abortTextureProviderSubscription.unsubscribe(),this._hasTextureSubscription.unsubscribe(),this._rendererSubscription.unsubscribe(),this._setRegionOfInterestSubscription.unsubscribe(),this._setTextureProviderSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._textureProviderSubscription.unsubscribe(),this._updateBackgroundSubscription.unsubscribe(),this._updateTextureImageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{imageTiling:!1}},e.componentName="imagePlane",e}(s.Component);r.ImagePlaneComponent=h,s.ComponentService.register(h),r.default=h},{"../../Component":226,"../../Render":232,"../../Tiles":234,"../../Utils":235,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publish":71,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/skipWhile":77,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/takeUntil":81,"rxjs/add/operator/withLatestFrom":83}],257:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../../Component"),o=function(){function t(t,e){this._imagePlaneDepth=null!=t?t:200,this._imageSphereRadius=null!=e?e:200}return t.prototype.createMesh=function(t,e){return t.pano?this._createImageSphere(t,e):this._createImagePlane(t,e)},t.prototype._createImageSphere=function(t,e){var r=this._createTexture(t.image),i=this._createSphereMaterialParameters(e,r),o=new n.ShaderMaterial(i);return this._useMesh(e,t)?new n.Mesh(this._getImageSphereGeo(e,t),o):new n.Mesh(this._getFlatImageSphereGeo(e),o)},t.prototype._createImagePlane=function(t,e){var r=this._createTexture(t.image),i=this._createPlaneMaterialParameters(e,r),o=new n.ShaderMaterial(i),s=this._useMesh(e,t)?this._getImagePlaneGeo(e,t):this._getFlatImagePlaneGeo(e);return new n.Mesh(s,o)},t.prototype._createSphereMaterialParameters=function(t,e){var r=t.gpano,o=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2,s=2*Math.PI*(r.CroppedAreaLeftPixels-o)/r.FullPanoWidthPixels,a=2*Math.PI*r.CroppedAreaImageWidthPixels/r.FullPanoWidthPixels,c=(r.FullPanoHeightPixels-r.CroppedAreaImageHeightPixels)/2,u=Math.PI*(c-r.CroppedAreaTopPixels)/r.FullPanoHeightPixels,h=Math.PI*r.CroppedAreaImageHeightPixels/r.FullPanoHeightPixels;return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.equirectangular.fragment,side:n.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},phiLength:{type:"f",value:a},phiShift:{type:"f",value:s},projectorMat:{type:"m4",value:t.rt},projectorTex:{type:"t",value:e},thetaLength:{type:"f",value:h},thetaShift:{type:"f",value:u}},vertexShader:i.ImagePlaneShaders.equirectangular.vertex}},t.prototype._createPlaneMaterialParameters=function(t,e){return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.perspective.fragment,side:n.DoubleSide,transparent:!0,uniforms:{bbox:{type:"v4",value:new n.Vector4(0,0,1,1)},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:t.projectorMatrix()},projectorTex:{type:"t",value:e}},vertexShader:i.ImagePlaneShaders.perspective.vertex}},t.prototype._createTexture=function(t){var e=new n.Texture(t);return e.minFilter=n.LinearFilter,e.needsUpdate=!0,e},t.prototype._useMesh=function(t,e){return e.mesh.vertices.length&&t.hasValidScale},t.prototype._getImageSphereGeo=function(t,e){for(var r=(new n.Matrix4).getInverse(t.srt),i=5*t.scale,o=this._imageSphereRadius*t.scale,s=e.mesh.vertices,a=s.length/3,c=new Float32Array(s.length),u=0;u bbox[0] && y > bbox[1] && x < bbox[2] && y < bbox[3]) {\n baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},t}();r.ImagePlaneShaders=n},{path:22}],261:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/fromEvent"),t("rxjs/add/observable/of"),t("rxjs/add/observable/zip"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom"),t("rxjs/add/operator/zip");var s=t("../../State"),a=t("../../Render"),c=t("../../Utils"),u=t("../../Component"),h=function(){function t(){this._imagePlaneFactory=new u.ImagePlaneFactory,this._imagePlaneScene=new u.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._curtain=1}return Object.defineProperty(t.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"curtain",{get:function(){return this._curtain},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"glNeedsRender",{get:function(){return this._glNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domNeedsRender",{get:function(){return this._domNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sliderVisible",{get:function(){return this._sliderVisible},set:function(t){this._sliderVisible=t,this._domNeedsRender=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return null==this._currentKey||null==this._previousKey||this._currentPano},enumerable:!0,configurable:!0}),t.prototype.update=function(t){this._updateFrameId(t.id);var e=this._updateImagePlanes(t.state);this._domNeedsRender=e||this._domNeedsRender,e=this._updateCurtain(t.state.alpha)||e,this._glNeedsRender=e||this._glNeedsRender},t.prototype.updateTexture=function(t,e){var r=e.key===this._currentKey?this._imagePlaneScene.imagePlanes:e.key===this._previousKey?this._imagePlaneScene.imagePlanesOld:[];if(0!==r.length){this._glNeedsRender=!0;for(var n=0,i=r;nc.Settings.basePanoramaSize:c.Settings.maxImageSize>c.Settings.baseImageSize}).mergeMap(function(t){var e=t.pano?c.Settings.basePanoramaSize:c.Settings.baseImageSize;return Math.max(t.image.width,t.image.height)>e?i.Observable.empty():t.cacheImage$(c.Settings.maxImageSize).map(function(t){return[t.image,t]}).catch(function(e,r){return console.error("Failed to fetch high res slider image ("+t.key+")",e),i.Observable.empty()})}).map(function(t){var e=t[0],r=t[1];return function(t){return t.updateTexture(e,r),t}}).subscribe(this._sliderStateOperation$)},e.prototype._deactivate=function(){var t=this;this._navigator.stateService.state$.first().subscribe(function(e){e===s.State.Waiting&&t._navigator.stateService.traverse()}),this._sliderStateDisposer$.next(null),this._setKeysSubscription.unsubscribe(),this._setSliderVisibleSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this.configure({keys:null}),this._sliderControl.removeEventListener("input",this._moveToHandler),this._sliderControl.removeEventListener("change",this._moveToHandler),this._container.element.removeChild(this._sliderContainer),this._moveToHandler=null,this._sliderControl=null,this._sliderWrapper=null,this._sliderContainer=null},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._catchCacheNode$=function(t){return this._navigator.graphService.cacheNode$(t).catch(function(e,r){return console.error("Failed to cache slider node ("+t+")",e),i.Observable.empty()})},e.prototype._createElement=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n},e.componentName="slider",e}(u.Component);r.SliderComponent=l,u.ComponentService.register(l),r.default=l},{"../../Component":226,"../../Render":232,"../../State":233,"../../Utils":235,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/fromEvent":42,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83,"rxjs/add/operator/zip":84}],262:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./MarkerComponent");r.MarkerComponent=n.MarkerComponent;var i=t("./marker/SimpleMarker");r.SimpleMarker=i.SimpleMarker;var o=t("./marker/CircleMarker");r.CircleMarker=o.CircleMarker},{"./MarkerComponent":263,"./marker/CircleMarker":266,"./marker/SimpleMarker":268}],263:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=t("when"),s=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/map");var a=t("../../Component"),c=t("../../Render"),u=t("../../Graph"),h=t("../../Geo"),l=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._relativeGroundAltitude=-2,i._geoCoords=new h.GeoCoords,i._graphCalculator=new u.GraphCalculator,i._markerScene=new a.MarkerScene,i._markerSet=new a.MarkerSet,i._viewportCoords=new h.ViewportCoords,i}return n(e,t),e.prototype.add=function(t){this._markerSet.add(t)},e.prototype.get=function(t){return this._markerSet.get(t)},e.prototype.getAll=function(){return this._markerSet.getAll()},e.prototype.getMarkerIdAt=function(t){var e=this;return o.promise(function(r,n){e._container.renderService.renderCamera$.first().map(function(r){var n=e._viewportCoords.canvasToViewport(t[0],t[1],e._container.element);return e._markerScene.intersectObjects(n,r.perspective)}).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.has=function(t){return this._markerSet.has(t)},e.prototype.remove=function(t){this._markerSet.remove(t)},e.prototype.removeAll=function(){this._markerSet.removeAll()},e.prototype._activate=function(){var t=this,r=this._navigator.stateService.currentState$.map(function(e){return e.state.camera.position.z+t._relativeGroundAltitude}).distinctUntilChanged(function(t,e){return Math.abs(t-e)<.01}).publishReplay(1).refCount(),n=s.Observable.combineLatest(r,this._navigator.stateService.reference$).first().map(function(){}).publishReplay(1).refCount(),o=this._configuration$.map(function(t){return{visibleBBoxSize:Math.max(1,Math.min(200,t.visibleBBoxSize))}}),a=this._navigator.stateService.currentNode$.map(function(t){return t.latLon}).publishReplay(1).refCount(),u=s.Observable.combineLatest(o,a).map(function(e){var r=e[0],n=e[1];return t._graphCalculator.boundingBoxCorners(n,r.visibleBBoxSize/2)}).publishReplay(1).refCount(),h=s.Observable.combineLatest(s.Observable.of(this._markerSet).concat(this._markerSet.changed$),u).map(function(t){var e=t[0],r=t[1];return e.search(r)});this._setChangedSubscription=n.switchMap(function(){return h.withLatestFrom(t._navigator.stateService.reference$,r)}).subscribe(function(e){for(var r=e[0],n=e[1],i=e[2],o=t._geoCoords,s=t._markerScene,a=s.markers,c=Object.assign({},a),u=0,h=r;ui.lat&&p.latLon.lati.lon&&p.latLon.lon50||s.lerpAltitude(h.id,r,Math.min(1,Math.max(0,1.2-1.2*d/50)))}}),this._renderSubscription=this._navigator.stateService.currentState$.map(function(e){var r=t._markerScene;return{name:t._name,render:{frameId:e.id,needsRender:r.needsRender,render:r.render.bind(r),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$);var l=s.Observable.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).map(function(e){var r=e[0],n=e[1],i=t._container.element,o=t._viewportCoords.canvasPosition(n,i),s=o[0],a=o[1],c=t._viewportCoords.canvasToViewport(s,a,i);return t._markerScene.intersectObjects(c,r.perspective)}).publishReplay(1).refCount(),p=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).map(function(t){return!0}),f=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).map(function(t){return!1}),d=s.Observable.merge(p,f).startWith(!1);this._dragEventSubscription=p.withLatestFrom(l).merge(s.Observable.combineLatest(f,s.Observable.of(null))).startWith([!1,null]).pairwise().subscribe(function(r){var n=r[0],i=r[1],o=i[0],s=o?e.dragstart:e.dragend,a=o?i[1]:n[1],c={marker:t._markerScene.get(a),target:t,type:s};t.fire(s,c)}),this._mouseClaimSubscription=s.Observable.combineLatest(this._container.mouseService.active$,l,d).map(function(t){var e=t[0],r=t[1],n=t[2];return!e&&null!=r||n}).distinctUntilChanged().subscribe(function(e){e?t._container.mouseService.claimMouse(t._name,1):t._container.mouseService.unclaimMouse(t._name)});var m=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).withLatestFrom(l,this._container.renderService.renderCamera$).map(function(e){var r=e[0],n=e[1],i=e[2],o=t._markerScene.get(n),s=t._container.element,a=t._viewportCoords.projectToCanvas(o.geometry.position.toArray(),s,i.perspective),c=a[0],u=a[1],h=t._viewportCoords.canvasPosition(r,s);return[o,[h[0]-c,h[1]-u],i]}).publishReplay(1).refCount();this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).withLatestFrom(m,this._navigator.stateService.reference$,o).subscribe(function(r){var n=r[0],o=r[1],s=o[0],a=o[1],c=o[2],u=r[2],h=r[3];if(t._markerScene.has(s.id)){var l=t._container.element,p=t._viewportCoords.canvasPosition(n,l),f=p[0],d=p[1],m=f-a[0],v=d-a[1],g=t._viewportCoords.canvasToViewport(m,v,l),y=g[0],b=g[1],_=new i.Vector3(y,b,1).unproject(c.perspective).sub(c.perspective.position).normalize(),x=Math.min(t._relativeGroundAltitude/_.z,h.visibleBBoxSize/2-.1);if(!(x<0)){var w=_.clone().multiplyScalar(x).add(c.perspective.position);w.z=c.perspective.position.z+t._relativeGroundAltitude;var S=t._geoCoords.enuToGeodetic(w.x,w.y,w.z,u.lat,u.lon,u.alt),M=S[0],E=S[1];t._markerScene.update(s.id,w.toArray(),{lat:M,lon:E}),t._markerSet.update(s);var T={marker:s,target:t,type:e.changed};t.fire(e.changed,T)}}})},e.prototype._deactivate=function(){this._adjustHeightSubscription.unsubscribe(),this._dragEventSubscription.unsubscribe(),this._markersUpdatedSubscription.unsubscribe(),this._mouseClaimSubscription.unsubscribe(),this._referenceSubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._setChangedSubscription.unsubscribe(),this._updateMarkerSubscription.unsubscribe(),this._markerScene.clear()},e.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}},e.componentName="marker",e.changed="changed",e.dragstart="dragstart",e.dragend="dragend",e}(a.Component);r.MarkerComponent=l,a.ComponentService.register(l),r.default=l},{"../../Component":226,"../../Geo":229,"../../Graph":230,"../../Render":232,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/map":65,three:176,when:223}],264:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t,e){this._needsRender=!1,this._interactiveObjects=[],this._markers={},this._objectMarkers={},this._raycaster=e||new n.Raycaster,this._scene=t||new n.Scene}return Object.defineProperty(t.prototype,"markers",{get:function(){return this._markers},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){t.id in this._markers&&this._dispose(t.id),t.createGeometry(e),this._scene.add(t.geometry),this._markers[t.id]=t;for(var r=0,n=t.getInteractiveObjects();r0&&this._updated$.next(e),t.length>e.length&&this._indexChanged$.next(this)},t.prototype.has=function(t){return t in this._hash},t.prototype.get=function(t){return this.has(t)?this._hash[t].marker:void 0},t.prototype.getAll=function(){return this._index.all().map(function(t){return t.marker})},t.prototype.remove=function(t){for(var e=this._hash,r=this._index,n=!1,i=0,o=t;i0&&0===a[3]?c=-h*a[1]:0===a[1]&&a[3]>0?c=h*a[3]:a[1]>0&&a[3]>0&&(c=h*(a[3]-a[1])/2),a[0]>0&&0===a[2]?u=h*a[0]:0===a[0]&&a[2]>0?u=-h*a[2]:a[0]>0&&a[2]>0&&(u=h*(a[0]-a[2])/2);var l=t._basicRotationThreshold;c=t._spatial.clamp(c,-l,l),u=t._spatial.clamp(u,-l,l),t._navigator.stateService.rotateBasicUnbounded([c,u])}}}})},e.prototype._disable=function(){this._bounceSubscription.unsubscribe()},e.prototype._getConfiguration=function(t){return{}},e}(t("../../Component").MouseHandlerBase);r.BounceHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],270:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._enable=function(){var t=this;this._zoomSubscription=i.Observable.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.map(function(t){var e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY,shiftKey:t.shiftKey}})).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,s=t._viewportCoords.canvasPosition(r,o),a=s[0],c=s[1],u=t._viewportCoords.unprojectFromCanvas(a,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.shiftKey?-1:1;t._navigator.stateService.zoomIn(l,h)})},e.prototype._disable=function(){this._zoomSubscription.unsubscribe()},e.prototype._getConfiguration=function(t){return{doubleClickZoom:t}},e}(t("../../Component").MouseHandlerBase);r.DoubleClickZoomHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],271:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=t("rxjs/Observable"),s=function(t){function e(e,r,n,i,o){var s=t.call(this,e,r,n,i)||this;return s._spatial=o,s._basicRotationThreshold=.05,s._forceCoeff=.2,s}return n(e,t),e.prototype._enable=function(){var t=this,e=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).map(function(t){return!0}),r=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).map(function(t){return!1});this._activeMouseSubscription=o.Observable.merge(e,r).subscribe(this._container.mouseService.activate$),this._preventDefaultSubscription=o.Observable.merge(e,r).switchMap(function(e){return e?t._container.mouseService.documentMouseMove$:o.Observable.empty()}).merge(this._container.touchService.touchMove$).subscribe(function(t){t.preventDefault()});var n=this._container.touchService.singleTouchDragStart$.map(function(t){return!0}),s=this._container.touchService.singleTouchDragEnd$.map(function(t){return!1});this._activeTouchSubscription=o.Observable.merge(n,s).subscribe(this._container.touchService.activate$),this._rotateBasicSubscription=this._navigator.stateService.currentState$.map(function(t){return t.state.currentNode.fullPano||t.state.nodesAhead<1}).distinctUntilChanged().switchMap(function(e){if(!e)return o.Observable.empty();var r=o.Observable.merge(t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDragStart$),t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDrag$),t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDragEnd$).map(function(t){return null})).pairwise().filter(function(t){return null!=t[0]&&null!=t[1]}),n=o.Observable.merge(t._container.touchService.singleTouchDragStart$,t._container.touchService.singleTouchDrag$,t._container.touchService.singleTouchDragEnd$.map(function(t){return null})).map(function(t){return null!=t&&t.touches.length>0?t.touches[0]:null}).pairwise().filter(function(t){return null!=t[0]&&null!=t[1]});return o.Observable.merge(r,n)}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,this._navigator.stateService.currentCamera$).map(function(e){var r=e[0],n=e[1],o=e[2],s=e[3].clone(),a=r[0],c=r[1],u=c.clientX-a.clientX,h=c.clientY-a.clientY,l=t._container.element,p=t._viewportCoords.canvasPosition(c,l),f=p[0],d=p[1],m=t._viewportCoords.unprojectFromCanvas(f,d,l,n.perspective).sub(n.perspective.position),v=t._viewportCoords.unprojectFromCanvas(f-u,d,l,n.perspective).sub(n.perspective.position),g=t._viewportCoords.unprojectFromCanvas(f,d-h,l,n.perspective).sub(n.perspective.position),y=(u>0?1:-1)*v.angleTo(m),b=(h>0?-1:1)*g.angleTo(m),_=(new i.Quaternion).setFromUnitVectors(s.up,new i.Vector3(0,0,1)),x=_.clone().inverse(),w=new i.Vector3;w.copy(s.lookat).sub(s.position),w.applyQuaternion(_);var S=w.length(),M=Math.atan2(w.y,w.x);M+=y;var E=Math.atan2(Math.sqrt(w.x*w.x+w.y*w.y),w.z);E+=b,E=Math.max(.01,Math.min(Math.PI-.01,E)),w.x=Math.sin(E)*Math.cos(M),w.y=Math.sin(E)*Math.sin(M),w.z=Math.cos(E),w.applyQuaternion(x);var T=(new i.Vector3).copy(s.position).add(w.multiplyScalar(S)),C=o.projectBasic(T.toArray()),O=o.projectBasic(s.lookat.toArray()),P=C[0]-O[0],A=C[1]-O[1];Math.abs(P)>1?P=0:P>.5?P-=1:P<-.5&&(P+=1);var j=t._basicRotationThreshold;if(P=t._spatial.clamp(P,-j,j),A=t._spatial.clamp(A,-j,j),o.fullPano)return[P,A];var R=t._viewportCoords.getPixelDistances(t._container.element,o,n.perspective),L=t._forceCoeff;return R[0]>0&&A<0&&C[1]<.5&&(A/=Math.max(1,L*R[0])),R[1]>0&&P>0&&C[0]>.5&&(P/=Math.max(1,L*R[1])),R[2]>0&&A>0&&C[1]>.5&&(A/=Math.max(1,L*R[2])),R[3]>0&&P<0&&C[0]<.5&&(P/=Math.max(1,L*R[3])),[P,A]}).subscribe(function(e){t._navigator.stateService.rotateBasic(e)})},e.prototype._disable=function(){this._activeMouseSubscription.unsubscribe(),this._activeTouchSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._rotateBasicSubscription.unsubscribe(),this._activeMouseSubscription=null,this._activeTouchSubscription=null,this._preventDefaultSubscription=null,this._rotateBasicSubscription=null},e.prototype._getConfiguration=function(t){return{dragPan:t}},e}(t("../../Component").MouseHandlerBase);r.DragPanHandler=s,r.default=s},{"../../Component":226,"rxjs/Observable":29,three:176}],272:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),t("rxjs/add/observable/merge"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/withLatestFrom");var i=t("../../Component"),o=t("../../Geo"),s=function(t){function e(e,r,n){var s=t.call(this,e,r,n)||this,a=new o.Spatial,c=new o.ViewportCoords;return s._spatial=a,s._viewportCoords=c,s._bounceHandler=new i.BounceHandler(s,r,n,c,a),s._doubleClickZoomHandler=new i.DoubleClickZoomHandler(s,r,n,c),s._dragPanHandler=new i.DragPanHandler(s,r,n,c,a),s._scrollZoomHandler=new i.ScrollZoomHandler(s,r,n,c),s._touchZoomHandler=new i.TouchZoomHandler(s,r,n,c),s}return n(e,t),Object.defineProperty(e.prototype,"doubleClickZoom",{get:function(){return this._doubleClickZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dragPan",{get:function(){return this._dragPanHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollZoom",{get:function(){return this._scrollZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchZoom",{get:function(){return this._touchZoomHandler},enumerable:!0,configurable:!0}),e.prototype._activate=function(){var t=this;this._bounceHandler.enable(),this._configurationSubscription=this._configuration$.subscribe(function(e){e.doubleClickZoom?t._doubleClickZoomHandler.enable():t._doubleClickZoomHandler.disable(),e.dragPan?t._dragPanHandler.enable():t._dragPanHandler.disable(),e.scrollZoom?t._scrollZoomHandler.enable():t._scrollZoomHandler.disable(),e.touchZoom?t._touchZoomHandler.enable():t._touchZoomHandler.disable()}),this._container.mouseService.claimMouse(this._name,0)},e.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name),this._configurationSubscription.unsubscribe(),this._bounceHandler.disable(),this._doubleClickZoomHandler.disable(),this._dragPanHandler.disable(),this._scrollZoomHandler.disable(),this._touchZoomHandler.disable()},e.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:!0,dragPan:!0,scrollZoom:!0,touchZoom:!0}},e.componentName="mouse",e}(i.Component);r.MouseComponent=s,i.ComponentService.register(s),r.default=s},{"../../Component":226,"../../Geo":229,"rxjs/add/observable/merge":44,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/withLatestFrom":83}],273:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t,e,r,n){this._component=t,this._container=e,this._navigator=r,this._viewportCoords=n,this._enabled=!1}return Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),t.prototype.enable=function(){!this._enabled&&this._component.activated&&(this._enable(),this._enabled=!0,this._component.configure(this._getConfiguration(!0)))},t.prototype.disable=function(){this._enabled&&(this._disable(),this._enabled=!1,this._component.activated&&this._component.configure(this._getConfiguration(!1)))},t}();r.MouseHandlerBase=n,r.default=n},{}],274:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._enable=function(){var t=this;this._preventDefaultSubscription=this._container.mouseService.mouseWheel$.subscribe(function(t){t.preventDefault()}),this._zoomSubscription=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseWheel$).withLatestFrom(this._navigator.stateService.currentState$,function(t,e){return[t,e]}).filter(function(t){var e=t[1].state;return e.currentNode.fullPano||e.nodesAhead<1}).map(function(t){return t[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(t,e,r){return[t,e,r]}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,s=t._viewportCoords.canvasPosition(r,o),a=s[0],c=s[1],u=t._viewportCoords.unprojectFromCanvas(a,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.deltaY;1===r.deltaMode?l*=40:2===r.deltaMode&&(l*=800);var p=-3*l/t._viewportCoords.containerToCanvas(o)[1];t._navigator.stateService.zoomIn(p,h)})},e.prototype._disable=function(){this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(t){return{scrollZoom:t}},e}(t("../../Component").MouseHandlerBase);r.ScrollZoomHandler=i,r.default=i},{"../../Component":226}],275:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._enable=function(){var t=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(t){t.originalEvent.preventDefault()});var e=this._container.touchService.pinchStart$.map(function(t){return!0}),r=this._container.touchService.pinchEnd$.map(function(t){return!1});this._activeSubscription=i.Observable.merge(e,r).subscribe(this._container.touchService.activate$),this._zoomSubscription=this._container.touchService.pinch$.withLatestFrom(this._navigator.stateService.currentState$).filter(function(t){var e=t[1].state;return e.currentNode.fullPano||e.nodesAhead<1}).map(function(t){return t[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,s=t._viewportCoords.canvasPosition(r,o),a=s[0],c=s[1],u=t._viewportCoords.unprojectFromCanvas(a,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=t._viewportCoords.containerToCanvas(o),p=l[0],f=l[1],d=3*r.distanceChange/Math.min(p,f);t._navigator.stateService.zoomIn(d,h)})},e.prototype._disable=function(){this._activeSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(t){return{touchZoom:t}},e}(t("../../Component").MouseHandlerBase);r.TouchZoomHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],276:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./popup/Popup");r.Popup=n.Popup;var i=t("./PopupComponent");r.PopupComponent=i.PopupComponent},{"./PopupComponent":277,"./popup/Popup":278}],277:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject"),s=t("../../Component"),a=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._popups=[],i._added$=new o.Subject,i._popups$=new o.Subject,i}return n(e,t),e.prototype.add=function(t){for(var e=0,r=t;e=0?1:-1)*Math.round(Math.sqrt(.5*Math.pow(h,2))),p={bottom:[0,h],"bottom-left":[-l,l],"bottom-right":[l,l],center:[0,0],left:[-h,0],right:[h,0],top:[0,-h],"top-left":[-l,-l],"top-right":[l,-l]};n=[n[0]+p[s][0],n[1]+p[s][1]]}n=[Math.round(n[0]),Math.round(n[1])];var f={bottom:"translate(-50%,0)","bottom-left":"translate(-100%,0)","bottom-right":"translate(0,0)",center:"translate(-50%,-50%)",left:"translate(-100%,-50%)",right:"translate(0,-50%)",top:"translate(-50%,-100%)","top-left":"translate(-100%,-100%)","top-right":"translate(0,-100%)"},d=this._container.classList;for(var m in f)f.hasOwnProperty(m)&&d.remove("mapillaryjs-popup-float-"+m);d.add("mapillaryjs-popup-float-"+s),this._container.style.transform=f[s]+" translate("+n[0]+"px,"+n[1]+"px)";var v}else this._container.style.visibility="hidden"}},t.prototype._createElement=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n},t.prototype._rectToPixel=function(t,e,r,n,i){if(!e){for(var o=this._container.offsetWidth,s=this._container.offsetHeight,a={bottom:[0,s/2],"bottom-left":[-o/2,s/2],"bottom-right":[o/2,s/2],left:[-o/2,0],right:[o/2,0],top:[0,-s/2],"top-left":[-o/2,-s/2],"top-right":[o/2,-s/2]},c=[0,null,null],u=0,h=["bottom","top","left","right"];u0&&f[0]0&&f[1]c[0]&&(c[0]=_,c[1]=f,c[2]=l)}}if(c[0]>0)return[c[1],c[2]]}var x=this._pointFromRectPosition(t,e);return[this._viewportCoords.basicToCanvasSafe(x[0],x[1],{offsetHeight:n.height,offsetWidth:n.width},i,r.perspective),null!=e?e:"bottom"]},t.prototype._alignmentToPopupAligment=function(t){switch(t){case o.Alignment.Bottom:return"bottom";case o.Alignment.BottomLeft:return"bottom-left";case o.Alignment.BottomRight:return"bottom-right";case o.Alignment.Center:return"center";case o.Alignment.Left:return"left";case o.Alignment.Right:return"right";case o.Alignment.Top:return"top";case o.Alignment.TopLeft:return"top-left";case o.Alignment.TopRight:return"top-right";default:return null}},t.prototype._pixelToFloats=function(t,e,r,n){var i=[];return t[1]e.height-n&&i.push("top"),t[0]e.width-r/2&&i.push("left"),i},t.prototype._pointFromRectPosition=function(t,e){switch(e){case"bottom":return[(t[0]+t[2])/2,t[3]];case"bottom-left":return[t[0],t[3]];case"bottom-right":return[t[2],t[3]];case"center":return[(t[0]+t[2])/2,(t[1]+t[3])/2];case"left":return[t[0],(t[1]+t[3])/2];case"right":return[t[2],(t[1]+t[3])/2];case"top":return[(t[0]+t[2])/2,t[1]];case"top-left":return[t[0],t[1]];case"top-right":return[t[2],t[1]];default:return[(t[0]+t[2])/2,t[3]]}},t}();r.Popup=s,r.default=s},{"../../../Geo":229,"../../../Viewer":236,"rxjs/Subject":34}],279:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/of"),t("rxjs/add/operator/bufferCount"),t("rxjs/add/operator/concat"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/takeUntil"),t("rxjs/add/operator/withLatestFrom");var s=t("../../Component"),a=t("../../Edge"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._nodesAhead=5,i._configurationOperation$=new o.Subject,i._sequenceDOMRenderer=new s.SequenceDOMRenderer(r.element),i._sequenceDOMInteraction=new s.SequenceDOMInteraction,i._containerWidth$=new o.Subject,i._hoveredKeySubject$=new o.Subject,i._hoveredKey$=i._hoveredKeySubject$.share(),i._edgeStatus$=i._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}).publishReplay(1).refCount(),i}return n(e,t),Object.defineProperty(e.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),e.prototype.play=function(){this.configure({playing:!0})},e.prototype.stop=function(){this.configure({playing:!1})},e.prototype.setDirection=function(t){this.configure({direction:t})},e.prototype.setHighlightKey=function(t){this.configure({highlightKey:t})},e.prototype.setMaxWidth=function(t){this.configure({maxWidth:t})},e.prototype.setMinWidth=function(t){this.configure({minWidth:t})},e.prototype.setVisible=function(t){this.configure({visible:t})},e.prototype.resize=function(){var t=this;this._configuration$.first().map(function(e){return t._sequenceDOMRenderer.getContainerWidth(t._container.element,e)}).subscribe(function(e){t._containerWidth$.next(e)})},e.prototype._activate=function(){var t=this;this._renderSubscription=i.Observable.combineLatest(this._edgeStatus$,this._configuration$,this._containerWidth$).map(function(e){var r=e[0],n=e[1],i=e[2],o=t._sequenceDOMRenderer.render(r,n,i,t,t._sequenceDOMInteraction,t._navigator);return{name:t._name,vnode:o}}).subscribe(this._container.domRenderer.render$),this._containerWidthSubscription=this._configuration$.distinctUntilChanged(function(t,e){return t[0]===e[0]&&t[1]===e[1]},function(t){return[t.minWidth,t.maxWidth]}).map(function(e){return t._sequenceDOMRenderer.getContainerWidth(t._container.element,e)}).subscribe(this._containerWidth$),this._configurationSubscription=this._configurationOperation$.scan(function(t,e){return e(t)},{playing:!1}).finally(function(){null!=t._playingSubscription&&(t._navigator.stateService.cutNodes(),t._stop())}).subscribe(function(){}),this._configuration$.map(function(e){return function(r){return e.playing!==r.playing&&(t._navigator.stateService.cutNodes(),e.playing?t._play():t._stop()),r.playing=e.playing,r}}).subscribe(this._configurationOperation$),this._stopSubscription=this._configuration$.switchMap(function(e){var r=e.playing?t._edgeStatus$:i.Observable.empty(),n=i.Observable.of(e.direction);return i.Observable.combineLatest(r,n)}).map(function(t){var e=t[0],r=t[1];if(!e.cached)return!0;for(var n=0,i=e.edges;n-1?t[0].sequenceEdges$:t[0].spatialEdges$).filter(function(t){return t.cached}).zip(i.Observable.of(t[1]),function(t,e){return[t,e]})}).map(function(t){for(var e=t[1],r=0,n=t[0].edges;rn?1:0}),e}).share(),u._tagChanged$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return o.Observable.merge(t.tag.changed$,t.tag.geometryChanged$)})}).share(),u._renderTagGLChanged$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.glObjectsChanged$})}).share(),u._tagInterationInitiated$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$.map(function(t){return t.tag.id})})}).share(),u._tagInteractionAbort$=o.Observable.merge(u._container.mouseService.documentMouseUp$).map(function(t){}).share(),u._activeTag$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$})}).merge(u._tagInteractionAbort$.map(function(){return{offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:null}})).share(),u._createGeometryChanged$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.geometryChanged$:o.Observable.empty()}).share(),u._createGLObjectsChanged$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.glObjectsChanged$:o.Observable.empty()}).share(),u._tagCreated$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.created$:o.Observable.empty()}).share(),u._vertexGeometryCreated$=u._tagCreated$.map(function(t){return t.geometry}).share(),u._pointGeometryCreated$=new s.Subject,u._geometryCreated$=o.Observable.merge(u._vertexGeometryCreated$,u._pointGeometryCreated$).share(),u._basicClick$=u._container.mouseService.staticClick$.withLatestFrom(u._container.renderService.renderCamera$,u._navigator.stateService.currentTransform$,function(t,e,r){return[t,e,r]}).map(function(t){var e=t[0],r=t[1],n=t[2];return u._mouseEventToBasic(e,u._container.element,r,n)}).share(),u._validBasicClick$=u._basicClick$.filter(function(t){var e=t[0],r=t[1];return 0<=e&&e<=1&&0<=r&&r<=1}).share(),u._creatingConfiguration$=u._configuration$.distinctUntilChanged(function(t,e){return t.mode===e.mode},function(t){return{createColor:t.createColor,mode:t.mode}}).publishReplay(1).refCount(),u._creating$=u._creatingConfiguration$.map(function(t){return t.mode!==a.TagMode.Default}).publishReplay(1).refCount(),u._creatingConfiguration$.subscribe(function(t){u.fire(e.modechanged,t.mode)}),u}return n(e,t),e.prototype.add=function(t){var e=this;this._activated?this._navigator.stateService.currentTransform$.first().subscribe(function(r){e._tagSet.add(t,r);var n=t.map(function(t){return e._tagSet.get(t.id)});e._tagScene.add(n)}):this._tagSet.addDeactivated(t)},e.prototype.changeMode=function(t){this.configure({mode:t})},e.prototype.get=function(t){if(this._activated){var e=this._tagSet.get(t);return void 0!==e?e.tag:void 0}return this._tagSet.getDeactivated(t)},e.prototype.getAll=function(){return this.activated?this._tagSet.getAll().map(function(t){return t.tag}):this._tagSet.getAllDeactivated()},e.prototype.getTagIdsAt=function(t){var e=this;return i.promise(function(r,n){e._container.renderService.renderCamera$.first().map(function(r){var n=e._viewportCoords.canvasToViewport(t[0],t[1],e._container.element);return e._tagScene.intersectObjects(n,r.perspective)}).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.has=function(t){return this._activated?this._tagSet.has(t):this._tagSet.hasDeactivated(t)},e.prototype.remove=function(t){this._activated?(this._tagSet.remove(t),this._tagScene.remove(t)):this._tagSet.removeDeactivated(t)},e.prototype.removeAll=function(){this._activated?(this._tagSet.removeAll(),this._tagScene.removeAll()):this._tagSet.removeAllDeactivated()},e.prototype._activate=function(){var t=this;this._preventDefaultSubscription=this._activeTag$.switchMap(function(e){return null!=e.tag?t._container.mouseService.documentMouseMove$:o.Observable.empty()}).subscribe(function(t){t.preventDefault()}),this._geometryCreatedEventSubscription=this._geometryCreated$.subscribe(function(r){t.fire(e.geometrycreated,r)}),this._tagsChangedEventSubscription=this._renderTags$.subscribe(function(r){t.fire(e.tagschanged,t)});var r=this.configuration$.switchMap(function(e){return e.mode!==a.TagMode.Default?t._navigator.stateService.currentTransform$.map(function(t){return null}):o.Observable.empty()}).publishReplay(1).refCount();this._deleteCreatingSubscription=r.skip(1).subscribe(function(){t._tagCreator.delete$.next(null)});var n=this._tagCreator.tag$.switchMap(function(t){return null!=t?t.aborted$.map(function(t){return null}):o.Observable.empty()}),i=this._tagCreated$.map(function(t){return null}),s=this._pointGeometryCreated$.map(function(t){return null});this._stopCreateSubscription=o.Observable.merge(n,i,s).subscribe(function(){t.changeMode(a.TagMode.Default)});var c=o.Observable.combineLatest(this._creatingConfiguration$,r).map(function(t){return t[0]}).publishReplay(1).refCount();this._createSubscription=c.switchMap(function(e){return e.mode===a.TagMode.CreateRect||e.mode===a.TagMode.CreatePolygon?t._validBasicClick$.take(1):o.Observable.empty()}).subscribe(this._tagCreator.create$),this._createPointSubscription=c.switchMap(function(e){return e.mode===a.TagMode.CreatePoint?t._validBasicClick$.take(1):o.Observable.empty()}).map(function(t){return new a.PointGeometry(t)}).subscribe(this._pointGeometryCreated$);var h=o.Observable.merge(this._container.mouseService.mouseMove$,this._container.mouseService.domMouseMove$).share();this._setCreateVertexSubscription=o.Observable.combineLatest(h,this._tagCreator.tag$,this._container.renderService.renderCamera$).filter(function(t){return null!=t[1]}).withLatestFrom(this._navigator.stateService.currentTransform$,function(t,e){return[t[0],t[1],t[2],e]}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=e[3],s=t._mouseEventToBasic(r,t._container.element,i,o);n.geometry instanceof a.RectGeometry?n.geometry.setVertex2d(3,s,o):n.geometry instanceof a.PolygonGeometry&&n.geometry.setVertex2d(n.geometry.polygon.length-2,s,o)}),this._addPointSubscription=c.switchMap(function(e){return e.mode===a.TagMode.CreateRect||e.mode===a.TagMode.CreatePolygon?t._basicClick$.skipUntil(t._validBasicClick$).skip(1):o.Observable.empty()}).withLatestFrom(this._tagCreator.tag$,function(t,e){return[t,e]}).subscribe(function(t){var e=t[0];t[1].addPoint(e)}),this._containerClassListSubscription=this._creating$.subscribe(function(e){e?t._container.element.classList.add("component-tag-create"):t._container.element.classList.remove("component-tag-create")}),this._deleteCreatedSubscription=this._creating$.subscribe(function(e){t._tagCreator.delete$.next(null)}),this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(e){t._tagScene.hasCreateTag()&&t._tagScene.removeCreateTag(),null!=e&&t._tagScene.addCreateTag(e)}),this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(e){t._tagScene.updateCreateTagObjects(e)}),this._claimMouseSubscription=this._tagInterationInitiated$.switchMap(function(e){return h.takeUntil(t._tagInteractionAbort$).take(1)}).subscribe(function(e){t._container.mouseService.claimMouse(t._name,1)}),this._mouseDragSubscription=this._activeTag$.withLatestFrom(h,function(t,e){return[t,e]}).switchMap(function(e){var r=e[0],n=e[1];if(r.operation===a.TagOperation.None)return o.Observable.empty();var i=o.Observable.of(n).concat(t._container.mouseService.filtered$(t._name,t._container.mouseService.domMouseDrag$).filter(function(e){return t._viewportCoords.insideElement(e,t._container.element)}));return o.Observable.combineLatest(i,t._container.renderService.renderCamera$).withLatestFrom(o.Observable.of(r),t._navigator.stateService.currentTransform$,function(t,e,r){return[t[0],t[1],e,r]})}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=e[3];if(i.operation!==a.TagOperation.None){var s=t._mouseEventToBasic(r,t._container.element,n,o,i.offsetX,i.offsetY);i.operation===a.TagOperation.Centroid?i.tag.geometry.setCentroid2d(s,o):i.operation===a.TagOperation.Vertex&&i.tag.geometry.setVertex2d(i.vertexIndex,s,o)}}),this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseDragEnd$).subscribe(function(e){t._container.mouseService.unclaimMouse(t._name)}),this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(e){t._tagScene.updateObjects(e)}),this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(e){t._tagScene.update()}),this._domSubscription=this._renderTags$.startWith([]).do(function(e){t._container.domRenderer.render$.next({name:t._name,vnode:t._tagDomRenderer.clear()})}).combineLatest(this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.startWith(null),this._tagCreator.tag$.merge(this._createGeometryChanged$).startWith(null),function(t,e,r,n,i,o){return[e,r,n,t,i,o]}).map(function(e){return{name:t._name,vnode:t._tagDomRenderer.render(e[3],e[5],e[1],e[0].perspective,e[2])}}).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.map(function(e){var r=t._tagScene;return{name:t._name,render:{frameId:e.id,needsRender:r.needsRender,render:r.render.bind(r),stage:u.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$),this._navigator.stateService.currentTransform$.first().subscribe(function(e){t._tagSet.activate(e),t._tagScene.add(t._tagSet.getAll())})},e.prototype._deactivate=function(){this._tagScene.clear(),this._tagSet.deactivate(),this._tagCreator.delete$.next(null),this._claimMouseSubscription.unsubscribe(),this._mouseDragSubscription.unsubscribe(),this._unclaimMouseSubscription.unsubscribe(),this._updateGLObjectsSubscription.unsubscribe(),this._updateTagSceneSubscription.unsubscribe(),this._stopCreateSubscription.unsubscribe(),this._deleteCreatingSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._createPointSubscription.unsubscribe(),this._setCreateVertexSubscription.unsubscribe(),this._addPointSubscription.unsubscribe(),this._deleteCreatedSubscription.unsubscribe(),this._setGLCreateTagSubscription.unsubscribe(),this._createGLObjectsChangedSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._containerClassListSubscription.unsubscribe(),this._domSubscription.unsubscribe(),this._glSubscription.unsubscribe(),this._geometryCreatedEventSubscription.unsubscribe(),this._tagsChangedEventSubscription.unsubscribe(),this._container.element.classList.remove("component-tag-create")},e.prototype._getDefaultConfiguration=function(){return{createColor:16777215,mode:a.TagMode.Default}},e.prototype._mouseEventToBasic=function(t,e,r,n,i,o){i=null!=i?i:0,o=null!=o?o:0;var s=this._viewportCoords.canvasPosition(t,e),a=s[0],c=s[1];return this._viewportCoords.canvasToBasic(a-i,c-o,e,n,r.perspective)},e.componentName="tag",e.modechanged="modechanged",e.geometrycreated="geometrycreated",e.tagschanged="tagschanged",e}(a.Component);r.TagComponent=h,a.ComponentService.register(h),r.default=h},{"../../Component":226,"../../Geo":229,"../../Render":232,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/empty":40,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/concat":54,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/skip":75,"rxjs/add/operator/skipUntil":76,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/take":80,"rxjs/add/operator/takeUntil":81,"rxjs/add/operator/withLatestFrom":83,when:223}],284:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/withLatestFrom");var i=t("../../Component"),o=function(){function t(t,e){this._component=t,this._navigator=e,this._tagOperation$=new n.Subject,this._create$=new n.Subject,this._delete$=new n.Subject,this._tag$=this._tagOperation$.scan(function(t,e){return e(t)},null).share(),this._create$.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$).map(function(t){var e=t[0],r=t[1],n=t[2];return function(t){if(r.mode===i.TagMode.CreateRect){o=new i.RectGeometry([e[0],e[1],e[0],e[1]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}if(r.mode===i.TagMode.CreatePolygon){var o=new i.PolygonGeometry([[e[0],e[1]],[e[0],e[1]],[e[0],e[1]]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}return null}}).subscribe(this._tagOperation$),this._delete$.map(function(){return function(t){return null}}).subscribe(this._tagOperation$)}return Object.defineProperty(t.prototype,"create$",{get:function(){return this._create$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"delete$",{get:function(){return this._delete$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tag$",{get:function(){return this._tag$},enumerable:!0,configurable:!0}),t}();r.TagCreator=o,r.default=o},{"../../Component":226,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/withLatestFrom":83}],285:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("virtual-dom"),i=function(){function t(){}return t.prototype.render=function(t,e,r,i,o){for(var s=[],a=0,c=t;a1||o<0||o>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].");return r._point=e.slice(),r}return n(e,t),Object.defineProperty(e.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),e.prototype.getCentroid2d=function(){return this._point.slice()},e.prototype.getCentroid3d=function(t){return t.unprojectBasic(this._point,200)},e.prototype.setCentroid2d=function(t,e){var r=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];this._point[0]=r[0],this._point[1]=r[1],this._notifyChanged$.next(this)},e}(i.Geometry);r.PointGeometry=o},{"../../../Component":226}],293:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../../Component"),o=function(t){function e(e,r){var n=t.call(this)||this,o=e.length;if(o<3)throw new i.GeometryTagError("A polygon must have three or more positions.");if(e[0][0]!==e[o-1][0]||e[0][1]!==e[o-1][1])throw new i.GeometryTagError("First and last positions must be equivalent.");n._polygon=[];for(var s=0,a=e;s1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");n._polygon.push(f.slice())}if(n._holes=[],null==r)return n;for(var c=0;c1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");n._holes[c].push(f.slice())}}return n}return n(e,t),Object.defineProperty(e.prototype,"polygon",{get:function(){return this._polygon},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"holes",{get:function(){return this._holes},enumerable:!0,configurable:!0}),e.prototype.addVertex2d=function(t){var e=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];this._polygon.splice(this._polygon.length-1,0,e),this._notifyChanged$.next(this)},e.prototype.getVertex2d=function(t){return this._polygon[t].slice()},e.prototype.removeVertex2d=function(t){if(t<0||t>=this._polygon.length||this._polygon.length<4)throw new i.GeometryTagError("Index for removed vertex must be valid.");if(t>0&&te[3])throw new i.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var n=0,o=e;n1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}return r._rect=e.slice(0,4),r._rect[0]>r._rect[2]&&(r._inverted=!0),r}return n(e,t),Object.defineProperty(e.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),e.prototype.setVertex2d=function(t,e,r){var n=this._rect.slice(),i=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))],o=[];if(0===t?(o[0]=i[0],o[1]=n[1],o[2]=n[2],o[3]=i[1]):1===t?(o[0]=i[0],o[1]=i[1],o[2]=n[2],o[3]=n[3]):2===t?(o[0]=n[0],o[1]=i[1],o[2]=i[0],o[3]=n[3]):3===t&&(o[0]=n[0],o[1]=n[1],o[2]=i[0],o[3]=i[1]),r.gpano){var s=t<2&&i[0]>.75&&n[0]<.25||t>=2&&this._inverted&&i[0]>.75&&n[2]<.25,a=t<2&&this._inverted&&i[0]<.25&&n[0]>.75||t>=2&&i[0]<.25&&n[2]>.75;s||a?this._inverted=!this._inverted:(o[0]-n[0]<-.25&&(o[0]=n[0]),o[2]-n[2]>.25&&(o[2]=n[2])),(!this._inverted&&o[0]>o[2]||this._inverted&&o[0]o[2]&&(o[0]=n[0],o[2]=n[2]);o[1]>o[3]&&(o[1]=n[1],o[3]=n[3]),this._rect[0]=o[0],this._rect[1]=o[1],this._rect[2]=o[2],this._rect[3]=o[3],this._notifyChanged$.next(this)},e.prototype.setCentroid2d=function(t,e){var r=this._rect.slice(),n=r[0],i=this._inverted?r[2]+1:r[2],o=r[1],s=r[3],a=n+(i-n)/2,c=o+(s-o)/2,u=0;if(null!=e.gpano&&e.gpano.CroppedAreaImageWidthPixels===e.gpano.FullPanoWidthPixels)u=this._inverted?t[0]+1-a:t[0]-a;else{var h=-n,l=1-i;u=Math.max(h,Math.min(l,t[0]-a))}var p=-o,f=1-s,d=Math.max(p,Math.min(f,t[1]-c));this._rect[0]=r[0]+u,this._rect[1]=r[1]+d,this._rect[2]=r[2]+u,this._rect[3]=r[3]+d,this._rect[0]<0?(this._rect[0]+=1,this._inverted=!this._inverted):this._rect[0]>1&&(this._rect[0]-=1,this._inverted=!this._inverted),this._rect[2]<0?(this._rect[2]+=1,this._inverted=!this._inverted):this._rect[2]>1&&(this._rect[2]-=1,this._inverted=!this._inverted),this._notifyChanged$.next(this)},e.prototype.getPoints3d=function(t){return this._getPoints2d(t).map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getVertex2d=function(t){return this._rectToVertices2d(this._rect)[t]},e.prototype.getVertex3d=function(t,e){return e.unprojectBasic(this._rectToVertices2d(this._rect)[t],200)},e.prototype.getVertices2d=function(){return this._rectToVertices2d(this._rect)},e.prototype.getVertices3d=function(t){return this._rectToVertices2d(this._rect).map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getCentroid2d=function(){var t=this._rect,e=t[0],r=this._inverted?t[2]+1:t[2],n=t[1];return[e+(r-e)/2,n+(t[3]-n)/2]},e.prototype.getCentroid3d=function(t){var e=this.getCentroid2d();return t.unprojectBasic(e,200)},e.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))},e.prototype.getPoleOfAccessibility3d=function(t){var e=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return t.unprojectBasic(e,200)},e.prototype.getTriangles3d=function(t){return this._triangulate(this._rectToVertices2d(this._rect),this.getVertices3d(t))},e.prototype.validate=function(t){var e=this._rect;return!(!this._inverted&&t[0].25||t[1]4?function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-2),r._created$.next(r)}:a,style:{transform:A=this._canvasToTransform(y)}},b=d.polygon.length>4?"TagCompleter":"TagInteractor";n.push(i.h("div."+b,f,[]))}if(d.polygon.length>3){var _=d.getVertex2d(d.polygon.length-3),x=_[0],w=_[1],S=this._viewportCoords.basicToCanvasSafe(x,w,o,this._transform,t);if(null!=S){f={onclick:function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-3)},style:{transform:A=this._canvasToTransform(S)}};n.push(i.h("div.TagInteractor",f,[]))}}var M=d.polygon.slice();M.splice(-2,2);for(var E=0,T=M;E=1?n._createHoles():[],n._outline=n._tag.lineWidth>=1?n._createOutline():null,n._geometryChangedSubscription=n._tag.geometry.changed$.subscribe(function(t){null!=n._fill&&n._updateFillGeometry(),n._holes.length>0&&n._updateHoleGeometries(),null!=n._outline&&n._updateOulineGeometry()}),n._changedSubscription=n._tag.changed$.subscribe(function(t){var e=!1;null!=n._fill&&n._updateFillMaterial(n._fill.material),null==n._outline?n._tag.lineWidth>=1&&(n._holes=n._createHoles(),n._outline=n._createOutline(),e=!0):(n._updateHoleMaterials(),n._updateOutlineMaterial()),e&&n._glObjectsChanged$.next(n)}),n}return n(e,t),e.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline(),this._changedSubscription.unsubscribe(),this._geometryChangedSubscription.unsubscribe()},e.prototype.getDOMObjects=function(t,e,r){var n=this,i=[],a=this._tag.geometry instanceof s.RectGeometry,c=!this._transform.gpano,u={offsetHeight:r.height,offsetWidth:r.width};if(null!=this._tag.icon&&(a||c)){var h=this._tag.geometry instanceof s.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfAccessibility2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,u,this._transform,e);if(null!=f){var d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:s.TagOperation.None,tag:n._tag})};if(t.loaded){var m=t.getDOMSprite(this._tag.icon,this._tag.iconFloat),v={onclick:function(t){t.stopPropagation(),n._tag.click$.next(n._tag)},onmousedown:d,style:{transform:S="translate("+Math.round(f[0])+"px,"+Math.round(f[1])+"px)"}};i.push(o.h("div.TagSymbol",v,[m]))}}}else if(null!=this._tag.text&&(a||c)){var g=this._tag.geometry instanceof s.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfAccessibility2d(),y=g[0],b=g[1],_=this._viewportCoords.basicToCanvasSafe(y,b,u,this._transform,e);if(null!=_){var x=Math.round(_[0]),w=Math.round(_[1]),S=this._tag.geometry instanceof s.RectGeometry?"translate("+x+"px,"+w+"px)":"translate(-50%, -50%) translate("+x+"px,"+w+"px)",v={onmousedown:d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:s.TagOperation.None,tag:n._tag})},style:{color:this._colorToCss(this._tag.textColor),transform:S},textContent:this._tag.text};i.push(o.h("span.TagSymbol",v,[]))}}if(!this._tag.editable)return i;var M=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof s.RectGeometry){var E=this._tag.geometry.getCentroid2d(),T=E[0],C=E[1],O=this._viewportCoords.basicToCanvasSafe(T,C,u,this._transform,e);if(null!=O){v={onmousedown:d=this._interact(s.TagOperation.Centroid),style:{background:M,transform:S="translate(-50%, -50%) translate("+Math.round(O[0])+"px,"+Math.round(O[1])+"px)"}};i.push(o.h("div.TagMover",v,[]))}}for(var P=this._tag.geometry.getVertices2d(),A=0;A=1&&this._tag.lineOpacity>0,t.opacity=this._tag.lineOpacity,t.transparent=this._tag.lineOpacity<1,t.needsUpdate=!0},e}(s.RenderTag);r.OutlineRenderTag=a},{"../../../Component":226,three:176,"virtual-dom":182}],298:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Subject"),o=t("../../../Component"),s=t("../../../Viewer"),a=function(t){function e(r,n,o){var a=t.call(this,r,n)||this;return o=o||{},a._editable=null!=o.editable&&o.editable,a._fillColor=null==o.fillColor?16777215:o.fillColor,a._fillOpacity=null==o.fillOpacity?0:o.fillOpacity,a._icon=void 0===o.icon?null:o.icon,a._iconFloat=null==o.iconFloat?s.Alignment.Center:o.iconFloat,a._iconIndex=null==o.iconIndex?3:o.iconIndex,a._indicateVertices=null==o.indicateVertices||o.indicateVertices,a._lineColor=null==o.lineColor?16777215:o.lineColor,a._lineOpacity=null==o.lineOpacity?1:o.lineOpacity,a._lineWidth=null==o.lineWidth?1:o.lineWidth,a._text=void 0===o.text?null:o.text,a._textColor=null==o.textColor?16777215:o.textColor,a._click$=new i.Subject,a._click$.subscribe(function(t){a.fire(e.click,a)}),a}return n(e,t),Object.defineProperty(e.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(t){this._editable=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillColor",{get:function(){return this._fillColor},set:function(t){this._fillColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(t){this._fillOpacity=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(t){this._iconFloat=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(t){this._iconIndex=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(t){this._indicateVertices=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineColor",{get:function(){return this._lineColor},set:function(t){this._lineColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(t){this._lineOpacity=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(t){this._textColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),e.prototype.setOptions=function(t){this._editable=null==t.editable?this._editable:t.editable,this._icon=void 0===t.icon?this._icon:t.icon,this._iconFloat=null==t.iconFloat?this._iconFloat:t.iconFloat,this._iconIndex=null==t.iconIndex?this._iconIndex:t.iconIndex,this._indicateVertices=null==t.indicateVertices?this._indicateVertices:t.indicateVertices,this._lineColor=null==t.lineColor?this._lineColor:t.lineColor,this._lineWidth=null==t.lineWidth?this._lineWidth:t.lineWidth,this._fillColor=null==t.fillColor?this._fillColor:t.fillColor,this._fillOpacity=null==t.fillOpacity?this._fillOpacity:t.fillOpacity,this._text=void 0===t.text?this._text:t.text,this._textColor=null==t.textColor?this._textColor:t.textColor,this._notifyChanged$.next(this)},e.click="click",e}(o.Tag);r.OutlineTag=a,r.default=a},{"../../../Component":226,"../../../Viewer":236,"rxjs/Subject":34}],299:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("../../../Geo"),o=function(){function t(t,e,r){this._tag=t,this._transform=e,this._viewportCoords=r||new i.ViewportCoords,this._glObjectsChanged$=new n.Subject,this._interact$=new n.Subject}return Object.defineProperty(t.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"interact$",{get:function(){return this._interact$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tag",{get:function(){return this._tag},enumerable:!0,configurable:!0}),t}();r.RenderTag=o,r.default=o},{"../../../Geo":229,"rxjs/Subject":34}],300:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("../../../Component"),s=t("../../../Viewer"),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.dispose=function(){},e.prototype.getDOMObjects=function(t,e,r){var n=this,a=this._tag,c={offsetHeight:r.height,offsetWidth:r.width},u=[],h=a.geometry.getCentroid2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,c,this._transform,e);if(null!=f){var d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:o.TagOperation.None,tag:a})},m=Math.round(f[0]),v=Math.round(f[1]);if(null!=a.icon){if(t.loaded){var g=t.getDOMSprite(a.icon,s.Alignment.Bottom),y={onmousedown:d,style:{pointerEvents:"all",transform:"translate("+m+"px,"+(v+8)+"px)"}};u.push(i.h("div",y,[g]))}}else if(null!=a.text){var b="translate(-50%,0%) translate("+m+"px,"+(v+8)+"px)",y={onmousedown:d,style:{color:this._colorToCss(a.textColor),transform:b},textContent:a.text};u.push(i.h("span.TagSymbol",y,[]))}var _=this._interact(o.TagOperation.Centroid,a),x=this._colorToCss(a.color),w="translate(-50%,-50%) translate("+m+"px,"+v+"px)";if(a.editable){var S={onmousedown:_,style:{background:x,transform:w}};u.push(i.h("div.TagSpotInteractor",S,[]))}var M={style:{background:x,transform:w}};u.push(i.h("div.TagVertex",M,[]))}return u},e.prototype.getGLObjects=function(){return[]},e.prototype.getRetrievableObjects=function(){return[]},e.prototype._colorToCss=function(t){return"#"+("000000"+t.toString(16)).substr(-6)},e.prototype._interact=function(t,e,r){var n=this;return function(i){var o=i.offsetX-i.target.offsetWidth/2,s=i.offsetY-i.target.offsetHeight/2;n._interact$.next({offsetX:o,offsetY:s,operation:t,tag:e,vertexIndex:r})}},e}(o.RenderTag);r.SpotRenderTag=a},{"../../../Component":226,"../../../Viewer":236,"virtual-dom":182}],301:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e,r,n){var i=t.call(this,e,r)||this;return n=n||{},i._color=null==n.color?16777215:n.color,i._editable=null!=n.editable&&n.editable,i._icon=void 0===n.icon?null:n.icon,i._text=void 0===n.text?null:n.text,i._textColor=null==n.textColor?16777215:n.textColor,i}return n(e,t),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(t){this._editable=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(t){this._textColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),e.prototype.setOptions=function(t){this._color=null==t.color?this._color:t.color,this._editable=null==t.editable?this._editable:t.editable,this._icon=void 0===t.icon?this._icon:t.icon,this._text=void 0===t.text?this._text:t.text,this._textColor=null==t.textColor?this._textColor:t.textColor,this._notifyChanged$.next(this)},e}(t("../../../Component").Tag);r.SpotTag=i,r.default=i},{"../../../Component":226}],302:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/share");var o=function(t){function e(r,n){var o=t.call(this)||this;return o._id=r,o._geometry=n,o._notifyChanged$=new i.Subject,o._notifyChanged$.subscribe(function(t){o.fire(e.changed,o)}),o._geometry.changed$.subscribe(function(t){o.fire(e.geometrychanged,o)}),o}return n(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometryChanged$",{get:function(){var t=this;return this._geometry.changed$.map(function(e){return t}).share()},enumerable:!0,configurable:!0}),e.changed="changed",e.geometrychanged="geometrychanged",e}(t("../../../Utils").EventEmitter);r.Tag=o,r.default=o},{"../../../Utils":235,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/share":74}],303:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,null!=e?e:"The argument is not valid.")||this;return r.name="ArgumentMapillaryError",r}return n(e,t),e}(t("./MapillaryError").MapillaryError);r.ArgumentMapillaryError=i,r.default=i},{"./MapillaryError":305}],304:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,e)||this;return r.name="GraphMapillaryError",r}return n(e,t),e}(t("./MapillaryError").MapillaryError);r.GraphMapillaryError=i,r.default=i},{"./MapillaryError":305}],305:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,e)||this;return r.name="MapillaryError",r}return n(e,t),e}(Error);r.MapillaryError=i,r.default=i},{}],306:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t){null!=t?(this._position=(new n.Vector3).fromArray(t.unprojectSfM([0,0],0)),this._lookat=(new n.Vector3).fromArray(t.unprojectSfM([0,0],10)),this._up=t.upVector(),this._focal=this._getFocal(t)):(this._position=new n.Vector3(0,0,0),this._lookat=new n.Vector3(0,0,1),this._up=new n.Vector3(0,-1,0),this._focal=1)}return Object.defineProperty(t.prototype,"position",{get:function(){return this._position},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lookat",{get:function(){return this._lookat},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"up",{get:function(){return this._up},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"focal",{get:function(){return this._focal},set:function(t){this._focal=t},enumerable:!0,configurable:!0}),t.prototype.lerpCameras=function(t,e,r){this._position.subVectors(e.position,t.position).multiplyScalar(r).add(t.position),this._lookat.subVectors(e.lookat,t.lookat).multiplyScalar(r).add(t.lookat),this._up.subVectors(e.up,t.up).multiplyScalar(r).add(t.up),this._focal=(1-r)*t.focal+r*e.focal},t.prototype.copy=function(t){this._position.copy(t.position),this._lookat.copy(t.lookat),this._up.copy(t.up),this._focal=t.focal},t.prototype.clone=function(){var e=new t;return e.position.copy(this._position),e.lookat.copy(this._lookat),e.up.copy(this._up),e.focal=this._focal,e},t.prototype.diff=function(t){var e=this._position.distanceToSquared(t.position),r=this._lookat.distanceToSquared(t.lookat),n=this._up.distanceToSquared(t.up),i=100*Math.abs(this._focal-t.focal);return Math.max(e,r,n,i)},t.prototype._getFocal=function(t){if(null==t.gpano)return t.focal;var e=Math.PI*t.gpano.CroppedAreaImageHeightPixels/t.gpano.FullPanoHeightPixels,r=.5/Math.tan(e/2);return Math.min(1/(2*(Math.sqrt(2)-1)),Math.max(.5,r))},t}();r.Camera=i},{three:176}],307:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._wgs84a=6378137,this._wgs84b=6356752.31424518}return t.prototype.geodeticToEnu=function(t,e,r,n,i,o){var s=this.geodeticToEcef(t,e,r);return this.ecefToEnu(s[0],s[1],s[2],n,i,o)},t.prototype.enuToGeodetic=function(t,e,r,n,i,o){var s=this.enuToEcef(t,e,r,n,i,o);return this.ecefToGeodetic(s[0],s[1],s[2])},t.prototype.ecefToEnu=function(t,e,r,n,i,o){var s=this.geodeticToEcef(n,i,o),a=[t-s[0],e-s[1],r-s[2]];n=n*Math.PI/180,i=i*Math.PI/180;var c=Math.cos(n),u=Math.sin(n),h=Math.cos(i),l=Math.sin(i);return[-l*a[0]+h*a[1],-u*h*a[0]-u*l*a[1]+c*a[2],c*h*a[0]+c*l*a[1]+u*a[2]]},t.prototype.enuToEcef=function(t,e,r,n,i,o){var s=this.geodeticToEcef(n,i,o);n=n*Math.PI/180,i=i*Math.PI/180;var a=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i);return[-h*t-c*u*e+a*u*r+s[0],u*t-c*h*e+a*h*r+s[1],a*e+c*r+s[2]]},t.prototype.geodeticToEcef=function(t,e,r){var n=this._wgs84a,i=this._wgs84b;t=t*Math.PI/180,e=e*Math.PI/180;var o=Math.cos(t),s=Math.sin(t),a=Math.cos(e),c=Math.sin(e),u=n*n,h=i*i,l=1/Math.sqrt(u*o*o+h*s*s),p=(u*l+r)*o;return[p*a,p*c,(h*l+r)*s]},t.prototype.ecefToGeodetic=function(t,e,r){var n=this._wgs84a,i=this._wgs84b,o=n*n,s=i*i,a=o-s,c=Math.sqrt(a/o),u=Math.sqrt(a/s),h=Math.sqrt(t*t+e*e),l=Math.atan2(r*n,h*i),p=Math.sin(l),f=Math.cos(l),d=Math.atan2(e,t),m=Math.atan2(r+u*u*i*p*p*p,h-c*c*n*f*f*f),v=Math.sin(m),g=h/Math.cos(m)-n/Math.sqrt(1-c*c*v*v);return[180*m/Math.PI,180*d/Math.PI,g]},t}();r.GeoCoords=n,r.default=n},{}],308:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(){this._epsilon=1e-9}return t.prototype.azimuthalToBearing=function(t){return-t+Math.PI/2},t.prototype.degToRad=function(t){return Math.PI*t/180},t.prototype.radToDeg=function(t){return 180*t/Math.PI},t.prototype.rotationMatrix=function(t){var e=new n.Vector3(t[0],t[1],t[2]),r=e.length();return r>0&&e.normalize(),(new n.Matrix4).makeRotationAxis(e,r)},t.prototype.rotate=function(t,e){var r=new n.Vector3(t[0],t[1],t[2]),i=this.rotationMatrix(e);return r.applyMatrix4(i),r},t.prototype.opticalCenter=function(t,e){var r=[-t[0],-t[1],-t[2]],n=[-e[0],-e[1],-e[2]];return this.rotate(n,r)},t.prototype.viewingDirection=function(t){var e=[-t[0],-t[1],-t[2]];return this.rotate([0,0,1],e)},t.prototype.wrap=function(t,e,r){if(rr||tr?t-=n:tr?r:t},t.prototype.angleBetweenVector2=function(t,e,r,n){var i=Math.atan2(n,r)-Math.atan2(e,t);return this.wrapAngle(i)},t.prototype.angleDifference=function(t,e){var r=e-t;return this.wrapAngle(r)},t.prototype.relativeRotationAngle=function(t,e){var r=this.rotationMatrix([-t[0],-t[1],-t[2]]),n=this.rotationMatrix(e),i=r.multiply(n).elements;return Math.acos((i[0]+i[5]+i[10]-1)/2)},t.prototype.angleToPlane=function(t,e){var r=(new n.Vector3).fromArray(t),i=r.length();if(i.01&&this._scale<50},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),t.prototype.upVector=function(){var t=this._rt.elements;switch(this._orientation){case 1:return new n.Vector3(-t[1],-t[5],-t[9]);case 3:return new n.Vector3(t[1],t[5],t[9]);case 6:return new n.Vector3(-t[0],-t[4],-t[8]);case 8:return new n.Vector3(t[0],t[4],t[8]);default:return new n.Vector3(-t[1],-t[5],-t[9])}},t.prototype.projectorMatrix=function(){var t=this._normalizedToTextureMatrix(),e=this._focal,r=(new n.Matrix4).set(e,0,0,0,0,e,0,0,0,0,0,0,0,0,1,0);return t.multiply(r),t.multiply(this._rt),t},t.prototype.projectBasic=function(t){var e=this.projectSfM(t);return this._sfmToBasic(e)},t.prototype.unprojectBasic=function(t,e){var r=this._basicToSfm(t);return this.unprojectSfM(r,e)},t.prototype.projectSfM=function(t){var e=new n.Vector4(t[0],t[1],t[2],1);return e.applyMatrix4(this._rt),this._bearingToSfm([e.x,e.y,e.z])},t.prototype.unprojectSfM=function(t,e){var r=this._sfmToBearing(t),i=new n.Vector4(e*r[0],e*r[1],e*r[2],1);return i.applyMatrix4((new n.Matrix4).getInverse(this._rt)),[i.x/i.w,i.y/i.w,i.z/i.w]},t.prototype._sfmToBearing=function(t){if(this._fullPano()){var e=2*t[0]*Math.PI,r=2*-t[1]*Math.PI;return[s=Math.cos(r)*Math.sin(e),a=-Math.sin(r),c=Math.cos(r)*Math.cos(e)]}if(this._gpano){var i=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),o=[t[0]*i+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,t[1]*i+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels],e=2*Math.PI*(o[0]/this.gpano.FullPanoWidthPixels-.5),r=-Math.PI*(o[1]/this.gpano.FullPanoHeightPixels-.5),s=Math.cos(r)*Math.sin(e),a=-Math.sin(r),c=Math.cos(r)*Math.cos(e);return[s,a,c]}var u=new n.Vector3(t[0],t[1],this._focal);return u.normalize(),[u.x,u.y,u.z]},t.prototype._bearingToSfm=function(t){if(this._fullPano()){var e=t[0],r=t[1],n=t[2],i=Math.atan2(e,n),o=Math.atan2(-r,Math.sqrt(e*e+n*n));return[i/(2*Math.PI),-o/(2*Math.PI)]}if(this._gpano){var e=t[0],r=t[1],n=t[2],i=Math.atan2(e,n),o=Math.atan2(-r,Math.sqrt(e*e+n*n)),s=[(i/(2*Math.PI)+.5)*this.gpano.FullPanoWidthPixels,(-o/Math.PI+.5)*this.gpano.FullPanoHeightPixels],a=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels);return[(s[0]-this.gpano.CroppedAreaLeftPixels-this.gpano.CroppedAreaImageWidthPixels/2)/a,(s[1]-this.gpano.CroppedAreaTopPixels-this.gpano.CroppedAreaImageHeightPixels/2)/a]}return t[2]>0?[t[0]*this._focal/t[2],t[1]*this._focal/t[2]]:[t[0]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,t[1]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY]},t.prototype._basicToSfm=function(t){var e,r;switch(this._orientation){case 1:e=t[0],r=t[1];break;case 3:e=1-t[0],r=1-t[1];break;case 6:e=t[1],r=1-t[0];break;case 8:e=1-t[1],r=t[0];break;default:e=t[0],r=t[1]}var n=this._width,i=this._height,o=Math.max(n,i);return[e*n/o-n/o/2,r*i/o-i/o/2]},t.prototype._sfmToBasic=function(t){var e,r,n=this._width,i=this._height,o=Math.max(n,i),s=(t[0]+n/o/2)/n*o,a=(t[1]+i/o/2)/i*o;switch(this._orientation){case 1:e=s,r=a;break;case 3:e=1-s,r=1-a;break;case 6:e=1-a,r=s;break;case 8:e=a,r=1-s;break;default:e=s,r=a}return[e,r]},t.prototype._fullPano=function(){return null!=this.gpano&&0===this.gpano.CroppedAreaLeftPixels&&0===this.gpano.CroppedAreaTopPixels&&this.gpano.CroppedAreaImageWidthPixels===this.gpano.FullPanoWidthPixels&&this.gpano.CroppedAreaImageHeightPixels===this.gpano.FullPanoHeightPixels},t.prototype._getValue=function(t,e){return null!=t&&t>0?t:e},t.prototype._getRt=function(t,e){var r=new n.Vector3(t[0],t[1],t[2]),i=r.length();i>0&&r.normalize();var o=new n.Matrix4;return o.makeRotationAxis(r,i),o.setPosition(new n.Vector3(e[0],e[1],e[2])),o},t.prototype._getSrt=function(t,e){var r=t.clone(),i=r.elements;return i[12]=e*i[12],i[13]=e*i[13],i[14]=e*i[14],r.scale(new n.Vector3(e,e,e)),r},t.prototype._normalizedToTextureMatrix=function(){var t=Math.max(this._width,this._height),e=t/this._width,r=t/this._height;switch(this._orientation){case 1:return(new n.Matrix4).set(e,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1);case 3:return(new n.Matrix4).set(-e,0,0,.5,0,r,0,.5,0,0,1,0,0,0,0,1);case 6:return(new n.Matrix4).set(0,-r,0,.5,-e,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new n.Matrix4).set(0,r,0,.5,e,0,0,.5,0,0,1,0,0,0,0,1);default:return(new n.Matrix4).set(e,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1)}},t}();r.Transform=i},{three:176}],310:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(){this._unprojectDepth=200}return t.prototype.basicToCanvas=function(t,e,r,n,i){var o=n.unprojectBasic([t,e],this._unprojectDepth);return this.projectToCanvas(o,r,i)},t.prototype.basicToCanvasSafe=function(t,e,r,n,i){var o=n.unprojectBasic([t,e],this._unprojectDepth),s=this.worldToCamera(o,i);if(s[2]>0)return null;var a=this.cameraToViewport(s,i),c=a[0],u=a[1];return this.viewportToCanvas(c,u,r)},t.prototype.basicToViewport=function(t,e,r,n){var i=r.unprojectBasic([t,e],this._unprojectDepth);return this.projectToViewport(i,n)},t.prototype.cameraToViewport=function(t,e){var r=(new n.Vector3).fromArray(t).applyMatrix4(e.projectionMatrix);return[r.x,r.y]},t.prototype.canvasPosition=function(t,e){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]},t.prototype.canvasToBasic=function(t,e,r,n,i){var o=this.unprojectFromCanvas(t,e,r,i).toArray();return n.projectBasic(o)},t.prototype.canvasToViewport=function(t,e,r){var n=this.containerToCanvas(r);return[2*t/n[0]-1,1-2*e/n[1]]},t.prototype.containerToCanvas=function(t){return[t.offsetWidth,t.offsetHeight]},t.prototype.getBasicDistances=function(t,e){var r=this.viewportToBasic(-1,1,t,e),n=this.viewportToBasic(1,1,t,e),i=this.viewportToBasic(1,-1,t,e),o=this.viewportToBasic(-1,-1,t,e),s=0,a=0,c=0,u=0;return r[1]<0&&n[1]<0&&(s=r[1]>n[1]?-r[1]:-n[1]),n[0]>1&&i[0]>1&&(a=n[0]1&&o[1]>1&&(c=i[1]r[0]?-o[0]:-r[0]),[s,a,c,u]},t.prototype.getPixelDistances=function(t,e,r){var n=this.viewportToBasic(-1,1,e,r),i=this.viewportToBasic(1,1,e,r),o=this.viewportToBasic(1,-1,e,r),s=this.viewportToBasic(-1,-1,e,r),a=0,c=0,u=0,h=0,l=this.containerToCanvas(t),p=l[0],f=l[1];if(n[1]<0&&i[1]<0){d=n[1]>i[1]?n[0]:i[0];a=(v=this.basicToCanvas(d,0,t,e,r))[1]>0?v[1]:0}if(i[0]>1&&o[0]>1){m=i[0]1&&s[1]>1){var d=o[1]n[0]?s[1]:n[1],v=this.basicToCanvas(0,m,t,e,r);h=v[0]>0?v[0]:0}return[a,c,u,h]},t.prototype.insideElement=function(t,e){var r=e.getBoundingClientRect(),n=r.left+e.clientLeft,i=n+e.clientWidth,o=r.top+e.clientTop,s=o+e.clientHeight;return t.clientX>n&&t.clientXo&&t.clientY"===e||">="===e||"<"===e||"<="===e?this._compileComparisonOp(e,t[1],t[2],!0):"in"===e?this._compileInOp(t[1],t.slice(2)):"!in"===e?this._compileNegation(this._compileInOp(t[1],t.slice(2))):"all"===e?this._compileLogicalOp(t.slice(1),"&&"):"true")+")"},t.prototype._compare=function(t,e){return te?1:0},t.prototype._compileComparisonOp=function(t,e,r,n){var i=this._compilePropertyReference(e),o=JSON.stringify(r);return(n?"typeof "+i+"===typeof "+o+"&&":"")+i+t+o},t.prototype._compileInOp=function(t,e){var r=this._compare;return JSON.stringify(e.sort(r))+".indexOf("+this._compilePropertyReference(t)+")!==-1"},t.prototype._compileLogicalOp=function(t,e){var r=this._compile.bind(this);return t.map(r).join(e)},t.prototype._compileNegation=function(t){return"!("+t+")"},t.prototype._compilePropertyReference=function(t){return"node["+JSON.stringify(t)+"]"},t}();r.FilterCreator=n,r.default=n},{}],312:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rbush"),i=t("rxjs/Subject");t("rxjs/add/observable/from"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/do"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publish");var o=t("../Edge"),s=t("../Error"),a=t("../Graph"),c=function(){function t(t,e,r,s,c,u){this._apiV3=t,this._cachedNodes={},this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._changed$=new i.Subject,this._defaultAlt=2,this._edgeCalculator=null!=s?s:new o.EdgeCalculator,this._filterCreator=null!=c?c:new a.FilterCreator,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=r?r:new a.GraphCalculator,this._configuration=null!=u?u:{maxSequences:50,maxUnusedNodes:100,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=e?e:n(16,[".lat",".lon",".lat",".lon"]),this._nodeIndexTiles={},this._nodeToTile={},this._preStored={},this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._tilePrecision=7,this._tileThreshold=20}return Object.defineProperty(t.prototype,"changed$",{get:function(){return this._changed$},enumerable:!0,configurable:!0}),t.prototype.cacheFill$=function(t){var e=this;if(t in this._cachingFull$)throw new s.GraphMapillaryError("Cannot fill node while caching full ("+t+").");if(!this.hasNode(t))throw new s.GraphMapillaryError("Cannot fill node that does not exist in graph ("+t+").");if(t in this._cachingFill$)return this._cachingFill$[t];var r=this.getNode(t);if(r.full)throw new s.GraphMapillaryError("Cannot fill node that is already full ("+t+").");return this._cachingFill$[t]=this._apiV3.imageByKeyFill$([t]).do(function(n){r.full||e._makeFull(r,n[t]),delete e._cachingFill$[t]}).map(function(t){return e}).finally(function(){t in e._cachingFill$&&delete e._cachingFill$[t],e._changed$.next(e)}).publish().refCount(),this._cachingFill$[t]},t.prototype.cacheFull$=function(t){var e=this;if(t in this._cachingFull$)return this._cachingFull$[t];if(this.hasNode(t))throw new s.GraphMapillaryError("Cannot cache full node that already exist in graph ("+t+").");return this._cachingFull$[t]=this._apiV3.imageByKeyFull$([t]).do(function(r){var n=r[t];if(e.hasNode(t))(i=e.getNode(t)).full||e._makeFull(i,n);else{if(null==n.sequence||null==n.sequence.key)throw new s.GraphMapillaryError("Node has no sequence ("+t+").");var i=new a.Node(n);e._makeFull(i,n);var o=e._graphCalculator.encodeH(i.originalLatLon,e._tilePrecision);e._preStore(o,i),e._setNode(i),delete e._cachingFull$[t]}}).map(function(t){return e}).finally(function(){t in e._cachingFull$&&delete e._cachingFull$[t],e._changed$.next(e)}).publish().refCount(),this._cachingFull$[t]},t.prototype.cacheNodeSequence$=function(t){if(!this.hasNode(t))throw new s.GraphMapillaryError("Cannot cache sequence edges of node that does not exist in graph ("+t+").");var e=this.getNode(t);if(e.sequenceKey in this._sequences)throw new s.GraphMapillaryError("Sequence already cached ("+t+"), ("+e.sequenceKey+").");return this._cacheSequence$(e.sequenceKey)},t.prototype.cacheSequence$=function(t){if(t in this._sequences)throw new s.GraphMapillaryError("Sequence already cached ("+t+")");return this._cacheSequence$(t)},t.prototype.cacheSequenceEdges=function(t){var e=this.getNode(t);if(!(e.sequenceKey in this._sequences))throw new s.GraphMapillaryError("Sequence is not cached ("+t+"), ("+e.sequenceKey+")");var r=this._sequences[e.sequenceKey].sequence,n=this._edgeCalculator.computeSequenceEdges(e,r);e.cacheSequenceEdges(n)},t.prototype.cacheSpatialArea$=function(t){var e=this;if(!this.hasNode(t))throw new s.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+t+").");if(t in this._cachedSpatialEdges)throw new s.GraphMapillaryError("Node already spatially cached ("+t+").");if(!(t in this._requiredSpatialArea))throw new s.GraphMapillaryError("Spatial area not determined ("+t+").");var r=this._requiredSpatialArea[t];if(0===Object.keys(r.cacheNodes).length)throw new s.GraphMapillaryError("Spatial nodes already cached ("+t+").");if(t in this._cachingSpatialArea$)return this._cachingSpatialArea$[t];for(var n=[];r.cacheKeys.length>0;)n.push(r.cacheKeys.splice(0,200));for(var i=n.length,o=[],a=this,c=0,u=n;c-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete e._requiredNodeTiles[t],e._cachedNodeTiles[t]=!0)}).catch(function(i){var o=r.caching.indexOf(n);throw o>-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete e._requiredNodeTiles[t],e._cachedNodeTiles[t]=!0),i}).finally(function(){e._changed$.next(e)}).publish().refCount())}(u[c]);return i},t.prototype.initializeCache=function(t){if(t in this._cachedNodes)throw new s.GraphMapillaryError("Node already in cache ("+t+").");var e=this.getNode(t);e.initializeCache(new a.NodeCache);var r=(new Date).getTime();this._cachedNodes[t]={accessed:r,node:e},this._updateCachedTileAccess(t,r)},t.prototype.isCachingFill=function(t){return t in this._cachingFill$},t.prototype.isCachingFull=function(t){return t in this._cachingFull$},t.prototype.isCachingNodeSequence=function(t){return this.getNode(t).sequenceKey in this._cachingSequences$},t.prototype.isCachingSequence=function(t){return t in this._cachingSequences$},t.prototype.isCachingTiles=function(t){return t in this._requiredNodeTiles&&0===this._requiredNodeTiles[t].cache.length&&this._requiredNodeTiles[t].caching.length>0},t.prototype.hasInitializedCache=function(t){return t in this._cachedNodes},t.prototype.hasNode=function(t){var e=(new Date).getTime();return this._updateCachedNodeAccess(t,e),this._updateCachedTileAccess(t,e),t in this._nodes},t.prototype.hasNodeSequence=function(t){var e=this.getNode(t).sequenceKey,r=e in this._sequences;return r&&(this._sequences[e].accessed=(new Date).getTime()),r},t.prototype.hasSequence=function(t){var e=t in this._sequences;return e&&(this._sequences[t].accessed=(new Date).getTime()),e},t.prototype.hasSpatialArea=function(t){if(!this.hasNode(t))throw new s.GraphMapillaryError("Spatial area nodes cannot be determined if node not in graph ("+t+").");if(t in this._cachedSpatialEdges)return!0;if(t in this._requiredSpatialArea)return 0===Object.keys(this._requiredSpatialArea[t].cacheNodes).length;for(var e=this.getNode(t),r=this._graphCalculator.boundingBoxCorners(e.latLon,this._tileThreshold),n={all:{},cacheKeys:[],cacheNodes:{}},i=0,o=this._nodeIndex.search({maxX:r[1].lat,maxY:r[1].lon,minX:r[0].lat,minY:r[0].lon});i0&&(this._requiredNodeTiles[t]=r)}return 0===r.cache.length&&0===r.caching.length},t.prototype.getNode=function(t){var e=(new Date).getTime();return this._updateCachedNodeAccess(t,e),this._updateCachedTileAccess(t,e),this._nodes[t]},t.prototype.getSequence=function(t){var e=this._sequences[t];return e.accessed=(new Date).getTime(),e.sequence},t.prototype.resetSpatialEdges=function(){for(var t=0,e=Object.keys(this._cachedSpatialEdges);t0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mergeCC",{get:function(){return this._fill.merge_cc},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mergeVersion",{get:function(){return this._fill.merge_version},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._cache.mesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"orientation",{get:function(){return this._fill.orientation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalCA",{get:function(){return this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalLatLon",{get:function(){return this._core.l},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pano",{get:function(){return null!=this._fill.gpano&&null!=this._fill.gpano.FullPanoWidthPixels},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectKey",{get:function(){return null!=this._fill.project?this._fill.project.key:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._fill.c_rotation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this._fill.atomic_scale},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceKey",{get:function(){return this._core.sequence.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges",{get:function(){return this._cache.sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges$",{get:function(){return this._cache.sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges",{get:function(){return this._cache.spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges$",{get:function(){return this._cache.spatialEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"userKey",{get:function(){return this._fill.user.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"username",{get:function(){return this._fill.user.username},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._fill.width},enumerable:!0,configurable:!0}),t.prototype.cacheAssets$=function(){var t=this;return this._cache.cacheAssets$(this.key,this.pano,this.merged).map(function(e){return t})},t.prototype.cacheImage$=function(t){var e=this;return this._cache.cacheImage$(this.key,t).map(function(t){return e})},t.prototype.cacheSequenceEdges=function(t){this._cache.cacheSequenceEdges(t)},t.prototype.cacheSpatialEdges=function(t){this._cache.cacheSpatialEdges(t)},t.prototype.dispose=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null),this._core=null,this._fill=null},t.prototype.initializeCache=function(t){if(null!=this._cache)throw new Error("Node cache already initialized ("+this.key+").");this._cache=t},t.prototype.makeFull=function(t){if(null==t)throw new Error("Fill can not be null.");this._fill=t},t.prototype.resetSequenceEdges=function(){this._cache.resetSequenceEdges()},t.prototype.resetSpatialEdges=function(){this._cache.resetSpatialEdges()},t.prototype.uncache=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null)},t}();r.Node=n,r.default=n},{"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/map":65}],318:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/publishReplay");var o=t("../Graph"),s=t("../Utils"),a=function(){function t(){this._disposed=!1,this._image=null,this._loadStatus={loaded:0,total:0},this._mesh=null,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$=new n.Subject,this._sequenceEdges$=this._sequenceEdgesChanged$.startWith(this._sequenceEdges).publishReplay(1).refCount(),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){}),this._spatialEdgesChanged$=new n.Subject,this._spatialEdges$=this._spatialEdgesChanged$.startWith(this._spatialEdges).publishReplay(1).refCount(),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){}),this._cachingAssets$=null}return Object.defineProperty(t.prototype,"image",{get:function(){return this._image},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadStatus",{get:function(){return this._loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges",{get:function(){return this._sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges$",{get:function(){return this._sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges",{get:function(){return this._spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges$",{get:function(){return this._spatialEdges$},enumerable:!0,configurable:!0}),t.prototype.cacheAssets$=function(t,e,r){var n=this;if(null!=this._cachingAssets$)return this._cachingAssets$;var o=e?s.Settings.basePanoramaSize:s.Settings.baseImageSize;return this._cachingAssets$=i.Observable.combineLatest(this._cacheImage$(t,o),this._cacheMesh$(t,r),function(t,e){return n._loadStatus.loaded=0,n._loadStatus.total=0,e&&(n._mesh=e.object,n._loadStatus.loaded+=e.loaded.loaded,n._loadStatus.total+=e.loaded.total),t&&(n._image=t.object,n._loadStatus.loaded+=t.loaded.loaded,n._loadStatus.total+=t.loaded.total),n}).finally(function(){n._cachingAssets$=null}).publishReplay(1).refCount(),this._cachingAssets$},t.prototype.cacheImage$=function(t,e){var r=this;return null!=this._image&&e<=Math.max(this._image.width,this._image.height)?i.Observable.of(this):this._cacheImage$(t,e).first(function(t){return null!=t.object}).do(function(t){r._disposeImage(),r._image=t.object}).map(function(t){return r})},t.prototype.cacheSequenceEdges=function(t){this._sequenceEdges={cached:!0,edges:t},this._sequenceEdgesChanged$.next(this._sequenceEdges)},t.prototype.cacheSpatialEdges=function(t){this._spatialEdges={cached:!0,edges:t},this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype.dispose=function(){this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges),this._disposed=!0,null!=this._imageRequest&&this._imageRequest.abort(),null!=this._meshRequest&&this._meshRequest.abort()},t.prototype.resetSequenceEdges=function(){this._sequenceEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges)},t.prototype.resetSpatialEdges=function(){this._spatialEdges={cached:!1,edges:[]},this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype._cacheImage$=function(t,e){var r=this;return i.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",s.Urls.thumbnail(t,e),!0),i.responseType="arraybuffer",i.timeout=15e3,i.onload=function(e){if(200!==i.status)return r._imageRequest=null,void n.error(new Error("Failed to fetch image ("+t+"). Status: "+i.status+", "+i.statusText));var o=new Image;o.crossOrigin="Anonymous",o.onload=function(i){if(r._imageRequest=null,r._disposed)return window.URL.revokeObjectURL(o.src),void n.error(new Error("Image load was aborted ("+t+")"));n.next({loaded:{loaded:e.loaded,total:e.total},object:o}),n.complete()},o.onerror=function(e){r._imageRequest=null,n.error(new Error("Failed to load image ("+t+")"))};var s=new Blob([i.response]);o.src=window.URL.createObjectURL(s)},i.onprogress=function(t){r._disposed||n.next({loaded:{loaded:t.loaded,total:t.total},object:null})},i.onerror=function(e){r._imageRequest=null,n.error(new Error("Failed to fetch image ("+t+")"))},i.ontimeout=function(e){r._imageRequest=null,n.error(new Error("Image request timed out ("+t+")"))},i.onabort=function(e){r._imageRequest=null,n.error(new Error("Image request was aborted ("+t+")"))},r._imageRequest=i,i.send(null)})},t.prototype._cacheMesh$=function(t,r){var n=this;return i.Observable.create(function(i){if(!r)return i.next(n._createEmptyMeshLoadStatus()),void i.complete();var a=new XMLHttpRequest;a.open("GET",s.Urls.protoMesh(t),!0),a.responseType="arraybuffer",a.timeout=15e3,a.onload=function(t){if(n._meshRequest=null,!n._disposed){var r=200===a.status?o.MeshReader.read(new e(a.response)):{faces:[],vertices:[]};i.next({loaded:{loaded:t.loaded,total:t.total},object:r}),i.complete()}},a.onprogress=function(t){n._disposed||i.next({loaded:{loaded:t.loaded,total:t.total},object:null})},a.onerror=function(e){n._meshRequest=null,console.error("Failed to cache mesh ("+t+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},a.ontimeout=function(e){n._meshRequest=null,console.error("Mesh request timed out ("+t+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},a.onabort=function(e){n._meshRequest=null,i.error(new Error("Mesh request was aborted ("+t+")"))},n._meshRequest=a,a.send(null)})},t.prototype._createEmptyMeshLoadStatus=function(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}},t.prototype._disposeImage=function(){null!=this._image&&window.URL.revokeObjectURL(this._image.src),this._image=null},t}();r.NodeCache=a,r.default=a}).call(this,t("buffer").Buffer)},{"../Graph":230,"../Utils":235,buffer:7,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/publishReplay":72}],319:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=function(){function t(t){this._key=t.key,this._keys=t.keys}return Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keys",{get:function(){return this._keys},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._key=null,this._keys=null},t.prototype.findNextKey=function(t){var e=n.indexOf(this._keys,t);return e+1>=this._keys.length||-1===e?null:this._keys[e+1]},t.prototype.findPrevKey=function(t){var e=n.indexOf(this._keys,t);return 0===e||-1===e?null:this._keys[e-1]},t}();r.Sequence=i,r.default=i},{underscore:178}],320:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../../Edge"),o=t("../../Error"),s=t("../../Geo"),a=function(){function t(t,e,r){this._spatial=new s.Spatial,this._geoCoords=new s.GeoCoords,this._settings=null!=t?t:new i.EdgeCalculatorSettings,this._directions=null!=e?e:new i.EdgeCalculatorDirections,this._coefficients=null!=r?r:new i.EdgeCalculatorCoefficients}return t.prototype.getPotentialEdges=function(t,e,r){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(!t.merged)return[];for(var i=this._spatial.viewingDirection(t.rotation),s=this._spatial.angleToPlane(i.toArray(),[0,0,1]),a=[],c=0,u=e;cthis._settings.maxDistance&&r.indexOf(h.key)<0)){var d=this._spatial.angleBetweenVector2(i.x,i.y,p.x,p.y),m=this._spatial.angleToPlane(p.toArray(),[0,0,1]),v=this._spatial.viewingDirection(h.rotation),g=this._spatial.angleBetweenVector2(i.x,i.y,v.x,v.y),y=this._spatial.angleToPlane(v.toArray(),[0,0,1])-s,b=this._spatial.relativeRotationAngle(t.rotation,h.rotation),_=this._spatial.angleBetweenVector2(1,0,p.x,p.y),x=null!=h.sequenceKey&&null!=t.sequenceKey&&h.sequenceKey===t.sequenceKey,w=null==h.mergeCC&&null==t.mergeCC||h.mergeCC===t.mergeCC,S=h.userKey===t.userKey,M={capturedAt:h.capturedAt,croppedPano:h.pano&&!h.fullPano,directionChange:g,distance:f,fullPano:h.fullPano,key:h.key,motionChange:d,rotation:b,sameMergeCC:w,sameSequence:x,sameUser:S,sequenceKey:h.sequenceKey,verticalDirectionChange:y,verticalMotion:m,worldMotionAzimuth:_};a.push(M)}}}return a},t.prototype.computeSequenceEdges=function(t,e){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(t.sequenceKey!==e.key)throw new o.ArgumentMapillaryError("Node and sequence does not correspond.");var r=[],n=e.findNextKey(t.key);null!=n&&r.push({data:{direction:i.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:t.key,to:n});var s=e.findPrevKey(t.key);return null!=s&&r.push({data:{direction:i.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:t.key,to:s}),r},t.prototype.computeSimilarEdges=function(t,e){var r=this;if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");for(var n=t.fullPano,s={},a=0,c=e;athis._settings.similarMaxDirectionChange)continue;v.distance>this._settings.similarMaxDistance||v.sameUser&&Math.abs(v.capturedAt-t.capturedAt)this._settings.stepMaxDirectionChange)){var d=this._spatial.angleDifference(a.motionChange,f.motionChange),m=this._spatial.angleDifference(f.directionChange,d),v=Math.max(Math.abs(d),Math.abs(m));if(!(Math.abs(v)>this._settings.stepMaxDrift)){var g=f.key;if(!a.useFallback||g!==r&&g!==n||(h=f),!(f.distance>this._settings.stepMaxDistance)){d=Math.sqrt(d*d+f.verticalMotion*f.verticalMotion);var y=this._coefficients.stepPreferredDistance*Math.abs(f.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*d/this._settings.stepMaxDrift+this._coefficients.stepRotation*f.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(f.sameSequence?0:1)+this._coefficients.stepMergeCCPenalty*(f.sameMergeCC?0:1);ythis._settings.turnMaxDistance)){var p=s.direction!==i.EdgeDirection.TurnU&&l.distancethis._settings.turnMinRigDirectionChange,f=this._spatial.angleDifference(s.directionChange,l.directionChange),d=void 0;if(p&&l.directionChange*s.directionChange>0&&Math.abs(l.directionChange)this._settings.turnMaxDirectionChange)continue;var m=s.motionChange?this._spatial.angleDifference(s.motionChange,l.motionChange):0;m=Math.sqrt(m*m+l.verticalMotion*l.verticalMotion),d=this._coefficients.turnDistance*l.distance/this._settings.turnMaxDistance+this._coefficients.turnMotion*m/Math.PI+this._coefficients.turnSequencePenalty*(l.sameSequence?0:1)+this._coefficients.turnMergeCCPenalty*(l.sameMergeCC?0:1)}dthis._settings.panoMaxDistance))if(w.fullPano){if(w.distancethis._settings.panoMaxStepTurnChange)){s.push([h.direction,w]);break}}}for(var f=Math.PI/this._settings.panoMaxItems,d=[],m=[],v=0;vf)){for(var M=Number.MAX_VALUE,E=0,T=d;Ef)){for(var F=Number.MAX_VALUE,B=0,U=N;B0&&t.elementWidth>0&&t.elementHeight>0}).map(function(t){var e=t.elementWidth/t.elementHeight,r=t.imageAspect/e,n=0,i=0;return t.renderMode===s.RenderMode.Letterbox?t.imageAspect>e?n=t.elementHeight*(1-1/r)/2:i=t.elementWidth*(1-r)/2:t.imageAspect>e?i=-t.elementWidth*(r-1)/2:n=-t.elementHeight*(1/r-1)/2,{bottom:n,left:i,right:i,top:n}}),this._currentFrame$.filter(function(t){return null!=t.state.currentNode}).distinctUntilChanged(function(t,e){return t===e},function(t){return t.state.currentNode.key}).map(function(t){return t.state.currentTransform.basicAspect}).map(function(t){return function(e){return e.imageAspect=t,e}}).subscribe(this._adaptiveOperation$),this._renderAdaptive$.scan(function(t,e){return null==e.vnode?delete t[e.name]:t[e.name]=e.vnode,t},{}).combineLatest(this._offset$).map(function(t){var e=n.values(t[0]),r=t[1],o={style:{bottom:r.bottom+"px",left:r.left+"px","pointer-events":"none",position:"absolute",right:r.right+"px",top:r.top+"px"}};return{name:"adaptiveDomRenderer",vnode:i.h("div.adaptiveDomRenderer",o,e)}}).subscribe(this._render$),this._vNode$=this._render$.scan(function(t,e){return null==e.vnode?delete t[e.name]:t[e.name]=e.vnode,t},{}).map(function(t){var e=n.values(t);return i.h("div.domRenderer",e)}),this._vPatch$=this._vNode$.scan(function(t,e){return t.vpatch=i.diff(t.vnode,e),t.vnode=e,t},{vnode:i.h("div.domRenderer",[]),vpatch:null}).pluck("vpatch"),this._element$=this._vPatch$.scan(function(t,e){return i.patch(t,e)},a).publishReplay(1).refCount(),this._element$.subscribe(function(){}),this._renderService.size$.map(function(t){return function(e){return e.elementWidth=t.width,e.elementHeight=t.height,e}}).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.map(function(t){return function(e){return e.renderMode=t,e}}).subscribe(this._adaptiveOperation$)}return Object.defineProperty(t.prototype,"element$",{get:function(){return this._element$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderAdaptive$",{get:function(){return this._renderAdaptive$},enumerable:!0,configurable:!0}),t.prototype.clear=function(t){this._renderAdaptive$.next({name:t,vnode:null}),this._render$.next({name:t,vnode:null})},t}();r.DOMRenderer=a,r.default=a},{"../Render":232,"rxjs/Subject":34,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":73,underscore:178,"virtual-dom":182}],326:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Background=0]="Background",t[t.Foreground=1]="Foreground"}(n=r.GLRenderStage||(r.GLRenderStage={})),r.default=n},{}],327:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/startWith");var s=t("../Render"),a=function(){function t(t,e){var r=this;this._renderFrame$=new o.Subject,this._renderCameraOperation$=new o.Subject,this._render$=new o.Subject,this._clear$=new o.Subject,this._renderOperation$=new o.Subject,this._rendererOperation$=new o.Subject,this._eraserOperation$=new o.Subject,this._renderService=e,this._renderer$=this._rendererOperation$.scan(function(t,e){return e(t)},{needsRender:!1,renderer:null}),this._renderCollection$=this._renderOperation$.scan(function(t,e){return e(t)},{}).share(),this._renderCamera$=this._renderCameraOperation$.scan(function(t,e){return e(t)},{frameId:-1,needsRender:!1,perspective:null}),this._eraser$=this._eraserOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},{needsRender:!1}),i.Observable.combineLatest([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],function(t,e,r,n){return{camera:r,eraser:n,renderer:t,renders:Object.keys(e).map(function(t){return e[t]})}}).filter(function(t){for(var e=t.renderer.needsRender||t.camera.needsRender||t.eraser.needsRender,r=t.camera.frameId,n=0,i=t.renders;nr:t1e-9){var i=e.state.currentTransform,o=null!=e.state.previousTransform?e.state.previousTransform:e.state.currentTransform,s=null!=e.state.previousNode?e.state.previousNode:e.state.currentNode;r.currentAspect=i.basicAspect,r.currentPano=e.state.currentNode.pano,r.previousAspect=o.basicAspect,r.previousPano=s.pano,r.alpha=e.state.alpha,r.zoom=e.state.zoom,r.camera.copy(n),r.updatePerspective(n),r.updateRotation(n),r.updateProjection()}r.frameId=e.id}).map(function(t){return t[1]}).publishReplay(1).refCount(),this._renderCamera$=this._renderCameraFrame$.filter(function(t){return t.changed}).publishReplay(1).refCount(),this._bearing$=this._renderCamera$.map(function(t){var e=a._spatial.radToDeg(a._spatial.azimuthalToBearing(t.rotation.phi));return a._spatial.wrap(e,0,360)}).publishReplay(1).refCount(),this._size$.skip(1).map(function(t){return function(e){return e.updateAspect(t.width,t.height),e.updateProjection(),e}}).subscribe(this._renderCameraOperation$),this._renderMode$.skip(1).map(function(t){return function(e){return e.renderMode=t,e.updateProjection(),e}}).subscribe(this._renderCameraOperation$),this._bearing$.subscribe(function(){}),this._renderCameraHolder$.subscribe(function(){}),this._size$.subscribe(function(){}),this._renderMode$.subscribe(function(){}),this._renderCamera$.subscribe(function(){}),this._renderCameraFrame$.subscribe(function(){})}return Object.defineProperty(t.prototype,"bearing$",{get:function(){return this._bearing$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this._element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"resize$",{get:function(){return this._resize$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size$",{get:function(){return this._size$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderMode$",{get:function(){return this._renderMode$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderCameraFrame$",{get:function(){return this._renderCameraFrame$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderCamera$",{get:function(){return this._renderCamera$},enumerable:!0,configurable:!0}),t}();r.RenderService=a,r.default=a},{"../Geo":229,"../Render":232,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/skip":75,"rxjs/add/operator/startWith":78,"rxjs/add/operator/withLatestFrom":83}],331:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Traversing=0]="Traversing",t[t.Waiting=1]="Waiting"}(n=r.State||(r.State={})),r.default=n},{}],332:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../State"),i=t("../Geo"),o=function(){function t(){this._state=new n.TraversingState({alpha:1,camera:new i.Camera,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],zoom:0})}return t.prototype.traverse=function(){this._state=this._state.traverse()},t.prototype.wait=function(){this._state=this._state.wait()},Object.defineProperty(t.prototype,"state",{get:function(){if(this._state instanceof n.TraversingState)return n.State.Traversing;if(this._state instanceof n.WaitingState)return n.State.Waiting;throw new Error("Invalid state")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reference",{get:function(){return this._state.reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._state.alpha},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._state.camera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this._state.zoom},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._state.currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousNode",{get:function(){return this._state.previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera",{get:function(){return this._state.currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform",{get:function(){return this._state.currentTransform},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousTransform",{get:function(){return this._state.previousTransform},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trajectory",{get:function(){return this._state.trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentIndex",{get:function(){return this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastNode",{get:function(){return this._state.trajectory[this._state.trajectory.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodesAhead",{get:function(){return this._state.trajectory.length-1-this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"motionless",{get:function(){return this._state.motionless},enumerable:!0,configurable:!0}),t.prototype.getCenter=function(){return this._state.getCenter()},t.prototype.setCenter=function(t){this._state.setCenter(t)},t.prototype.setZoom=function(t){this._state.setZoom(t)},t.prototype.update=function(t){this._state.update(t)},t.prototype.append=function(t){this._state.append(t)},t.prototype.prepend=function(t){this._state.prepend(t)},t.prototype.remove=function(t){this._state.remove(t)},t.prototype.clear=function(){this._state.clear()},t.prototype.clearPrior=function(){this._state.clearPrior()},t.prototype.cut=function(){this._state.cut()},t.prototype.set=function(t){this._state.set(t)},t.prototype.rotate=function(t){this._state.rotate(t)},t.prototype.rotateBasic=function(t){this._state.rotateBasic(t)},t.prototype.rotateBasicUnbounded=function(t){this._state.rotateBasicUnbounded(t)},t.prototype.rotateToBasic=function(t){this._state.rotateToBasic(t)},t.prototype.move=function(t){this._state.move(t)},t.prototype.moveTo=function(t){this._state.moveTo(t)},t.prototype.zoomIn=function(t,e){this._state.zoomIn(t,e)},t}();r.StateContext=o},{"../Geo":229,"../State":233}],333:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Subject"),o=t("rxjs/util/AnimationFrame");t("rxjs/add/operator/bufferCount"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/do"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/pairwise"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom");var s=t("../State"),a=function(){function t(){var t=this;this._appendNode$=new i.Subject,this._start$=new i.Subject,this._frame$=new i.Subject,this._fpsSampleRate=30,this._contextOperation$=new n.BehaviorSubject(function(t){return t}),this._context$=this._contextOperation$.scan(function(t,e){return e(t)},new s.StateContext).publishReplay(1).refCount(),this._state$=this._context$.map(function(t){return t.state}).distinctUntilChanged().publishReplay(1).refCount(),this._fps$=this._start$.switchMap(function(){return t._frame$.bufferCount(1,t._fpsSampleRate).map(function(t){return(new Date).getTime()}).pairwise().map(function(e){return Math.max(20,1e3*t._fpsSampleRate/(e[1]-e[0]))}).startWith(60)}).share(),this._currentState$=this._frame$.withLatestFrom(this._fps$,this._context$,function(t,e,r){return[t,e,r]}).filter(function(t){return null!=t[2].currentNode}).do(function(t){t[2].update(t[1])}).map(function(t){return{fps:t[1],id:t[0],state:t[2]}}).share(),this._lastState$=this._currentState$.publishReplay(1).refCount();var e=this._currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).publishReplay(1).refCount(),r=new i.Subject;e.subscribe(r),this._currentKey$=new n.BehaviorSubject(null),r.map(function(t){return t.state.currentNode.key}).subscribe(this._currentKey$),this._currentNode$=r.map(function(t){return t.state.currentNode}).publishReplay(1).refCount(),this._currentCamera$=r.map(function(t){return t.state.currentCamera}).publishReplay(1).refCount(),this._currentTransform$=r.map(function(t){return t.state.currentTransform}).publishReplay(1).refCount(),this._reference$=r.map(function(t){return t.state.reference}).distinctUntilChanged(function(t,e){return t.lat===e.lat&&t.lon===e.lon},function(t){return{lat:t.lat,lon:t.lon}}).publishReplay(1).refCount(),this._currentNodeExternal$=e.map(function(t){return t.state.currentNode}).publishReplay(1).refCount(),this._appendNode$.map(function(t){return function(e){return e.append([t]),e}}).subscribe(this._contextOperation$),this._inMotionOperation$=new i.Subject,e.map(function(t){return!0}).subscribe(this._inMotionOperation$),this._inMotionOperation$.distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._currentState$.filter(function(t){return 0===t.state.nodesAhead}).map(function(t){return[t.state.camera.clone(),t.state.zoom]}).pairwise().map(function(t){var e=t[0][0],r=t[1][0],n=t[0][1],i=t[1][1];return e.diff(r)>1e-5||Math.abs(n-i)>1e-5}).first(function(t){return!t})}).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._inTranslationOperation$=new i.Subject,e.map(function(t){return!0}).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._currentState$.filter(function(t){return 0===t.state.nodesAhead}).map(function(t){return t.state.camera.position.clone()}).pairwise().map(function(t){return 0!==t[0].distanceToSquared(t[1])}).first(function(t){return!t})}).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._state$.subscribe(function(){}),this._currentNode$.subscribe(function(){}),this._currentCamera$.subscribe(function(){}),this._currentTransform$.subscribe(function(){}),this._reference$.subscribe(function(){}),this._currentNodeExternal$.subscribe(function(){}),this._lastState$.subscribe(function(){}),this._inMotion$.subscribe(function(){}),this._inTranslation$.subscribe(function(){}),this._frameId=null,this._frameGenerator=new o.RequestAnimationFrameDefinition(window)}return Object.defineProperty(t.prototype,"currentState$",{get:function(){return this._currentState$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode$",{get:function(){return this._currentNode$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentKey$",{get:function(){return this._currentKey$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNodeExternal$",{get:function(){return this._currentNodeExternal$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera$",{get:function(){return this._currentCamera$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform$",{get:function(){return this._currentTransform$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state$",{get:function(){return this._state$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reference$",{get:function(){return this._reference$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inMotion$",{get:function(){return this._inMotion$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inTranslation$",{get:function(){return this._inTranslation$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appendNode$",{get:function(){return this._appendNode$},enumerable:!0,configurable:!0}),t.prototype.traverse=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.traverse()})},t.prototype.wait=function(){this._invokeContextOperation(function(t){t.wait()})},t.prototype.appendNodes=function(t){this._invokeContextOperation(function(e){e.append(t)})},t.prototype.prependNodes=function(t){this._invokeContextOperation(function(e){e.prepend(t)})},t.prototype.removeNodes=function(t){this._invokeContextOperation(function(e){e.remove(t)})},t.prototype.clearNodes=function(){this._invokeContextOperation(function(t){t.clear()})},t.prototype.clearPriorNodes=function(){this._invokeContextOperation(function(t){t.clearPrior()})},t.prototype.cutNodes=function(){this._invokeContextOperation(function(t){t.cut()})},t.prototype.setNodes=function(t){this._invokeContextOperation(function(e){e.set(t)})},t.prototype.rotate=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotate(t)})},t.prototype.rotateBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasic(t)})},t.prototype.rotateBasicUnbounded=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasicUnbounded(t)})},t.prototype.rotateToBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateToBasic(t)})},t.prototype.move=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.move(t)})},t.prototype.moveTo=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.moveTo(t)})},t.prototype.zoomIn=function(t,e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(r){r.zoomIn(t,e)})},t.prototype.getCenter=function(){return this._lastState$.first().map(function(t){return t.state.getCenter()})},t.prototype.getZoom=function(){return this._lastState$.first().map(function(t){return t.state.zoom})},t.prototype.setCenter=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setCenter(t)})},t.prototype.setZoom=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setZoom(t)})},t.prototype.start=function(){null==this._frameId&&(this._start$.next(null),this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId))},t.prototype.stop=function(){null!=this._frameId&&(this._frameGenerator.cancelAnimationFrame(this._frameId),this._frameId=null)},t.prototype._invokeContextOperation=function(t){this._contextOperation$.next(function(e){return t(e),e})},t.prototype._frame=function(t){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)},t}();r.StateService=a},{"../State":233,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/bufferCount":50,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83,"rxjs/util/AnimationFrame":157}],334:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../Error"),i=t("../../Geo"),o=function(){function t(t){this._spatial=new i.Spatial,this._geoCoords=new i.GeoCoords,this._referenceThreshold=.01,this._reference=t.reference,this._alpha=t.alpha,this._camera=t.camera.clone(),this._zoom=t.zoom,this._currentIndex=t.currentIndex,this._trajectory=t.trajectory.slice(),this._trajectoryTransforms=[],this._trajectoryCameras=[];for(var e=0,r=this._trajectory;e0?this._trajectory[this._currentIndex]:null,this._previousNode=this._trajectory.length>1&&this.currentIndex>0?this._trajectory[this._currentIndex-1]:null,this._currentCamera=this._trajectoryCameras.length>0?this._trajectoryCameras[this._currentIndex].clone():new i.Camera,this._previousCamera=this._trajectoryCameras.length>1&&this.currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}return Object.defineProperty(t.prototype,"reference",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._getAlpha()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this._zoom},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trajectory",{get:function(){return this._trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentIndex",{get:function(){return this._currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousNode",{get:function(){return this._previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera",{get:function(){return this._currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform",{get:function(){return this._trajectoryTransforms.length>0?this._trajectoryTransforms[this.currentIndex]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousTransform",{get:function(){return this._trajectoryTransforms.length>1&&this.currentIndex>0?this._trajectoryTransforms[this.currentIndex-1]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"motionless",{get:function(){return this._motionless},enumerable:!0,configurable:!0}),t.prototype.append=function(t){if(t.length<1)throw Error("Trajectory can not be empty");this._currentIndex<0?this.set(t):(this._trajectory=this._trajectory.concat(t),this._appendToTrajectories(t))},t.prototype.prepend=function(t){if(t.length<1)throw Error("Trajectory can not be empty");this._trajectory=t.slice().concat(this._trajectory),this._currentIndex+=t.length,this._setCurrentNode(),this._setReference(this._currentNode)?this._setTrajectories():this._prependToTrajectories(t),this._setCurrentCamera()},t.prototype.remove=function(t){if(t<0)throw Error("n must be a positive integer");if(this._currentIndex-10&&this.remove(this._currentIndex-1)},t.prototype.clear=function(){this.cut(),this._currentIndex>0&&this.remove(this._currentIndex-1)},t.prototype.cut=function(){for(;this._trajectory.length-1>this._currentIndex;)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()},t.prototype.set=function(t){this._setTrajectory(t),this._setCurrentNode(),this._setReference(this._currentNode),this._setTrajectories(),this._setCurrentCamera()},t.prototype.getCenter=function(){return null!=this._currentNode?this.currentTransform.projectBasic(this._camera.lookat.toArray()):[.5,.5]},t.prototype._setCurrent=function(){this._setCurrentNode(),this._setReference(this._currentNode)&&this._setTrajectories(),this._setCurrentCamera()},t.prototype._setCurrentCamera=function(){this._currentCamera=this._trajectoryCameras[this._currentIndex].clone(),this._previousCamera=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()},t.prototype._motionlessTransition=function(){return null!=this._currentNode&&null!=this._previousNode&&!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent())},t.prototype._setReference=function(t){return!(Math.abs(t.latLon.lat-this.reference.lat)0?this._trajectory[this._currentIndex]:null,this._previousNode=this._currentIndex>0?this._trajectory[this._currentIndex-1]:null},t.prototype._setTrajectory=function(t){if(t.length<1)throw new n.ArgumentMapillaryError("Trajectory can not be empty");null!=this._currentNode?(this._trajectory=[this._currentNode].concat(t),this._currentIndex=1):(this._trajectory=t.slice(),this._currentIndex=0)},t.prototype._setTrajectories=function(){this._trajectoryTransforms.length=0,this._trajectoryCameras.length=0,this._appendToTrajectories(this._trajectory)},t.prototype._appendToTrajectories=function(t){for(var e=0,r=t;et?this._phi:0,this._theta=Math.abs(this._theta)>t?this._theta:0},t.prototype.lengthSquared=function(){return this._phi*this._phi+this._theta*this._theta},t.prototype.reset=function(){this._phi=0,this._theta=0},t}(),c=function(t){function e(e){var r=t.call(this,e)||this;return r._adjustCameras(),r._motionless=r._motionlessTransition(),r._baseAlpha=r._alpha,r._animationSpeed=.025,r._unitBezier=new o(.74,.67,.38,.96),r._useBezier=!1,r._rotationDelta=new a(0,0),r._requestedRotationDelta=null,r._basicRotation=[0,0],r._requestedBasicRotation=null,r._requestedBasicRotationUnbounded=null,r._rotationAcceleration=.86,r._rotationIncreaseAlpha=.97,r._rotationDecreaseAlpha=.9,r._rotationThreshold=.001,r._unboundedRotationAlpha=.8,r._desiredZoom=e.zoom,r._minZoom=0,r._maxZoom=3,r._lookatDepth=10,r._desiredLookat=null,r._desiredCenter=null,r}return n(e,t),e.prototype.traverse=function(){throw new Error("Not implemented")},e.prototype.wait=function(){return new s.WaitingState(this)},e.prototype.append=function(e){var r=0===this._trajectory.length;r&&this._resetTransition(),t.prototype.append.call(this,e),r&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.prepend=function(e){var r=0===this._trajectory.length;r&&this._resetTransition(),t.prototype.prepend.call(this,e),r&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.set=function(e){t.prototype.set.call(this,e),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)},e.prototype.move=function(t){throw new Error("Not implemented")},e.prototype.moveTo=function(t){throw new Error("Not implemented")},e.prototype.rotate=function(t){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedBasicRotation=null,null!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+t.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+t.theta):this._requestedRotationDelta=new a(t.phi,t.theta))},e.prototype.rotateBasic=function(t){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,null!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=t[0],this._requestedBasicRotation[1]+=t[1];var e=.05/Math.pow(2,this._zoom);this._requestedBasicRotation[0]=this._spatial.clamp(this._requestedBasicRotation[0],-e,e),this._requestedBasicRotation[1]=this._spatial.clamp(this._requestedBasicRotation[1],-e,e)}else this._requestedBasicRotation=t.slice()},e.prototype.rotateBasicUnbounded=function(t){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=t[0],this._requestedBasicRotationUnbounded[1]+=t[1]):this._requestedBasicRotationUnbounded=t.slice())},e.prototype.rotateToBasic=function(t){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,t[0]=this._spatial.clamp(t[0],0,1),t[1]=this._spatial.clamp(t[1],0,1);var e=this.currentTransform.unprojectBasic(t,this._lookatDepth);this._currentCamera.lookat.fromArray(e)}},e.prototype.zoomIn=function(t,e){if(null!=this._currentNode){this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+t));var r=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray()),n=r[0],o=r[1],s=Math.pow(2,this._zoom),a=Math.pow(2,this._desiredZoom),c=e[0],u=e[1];null!=this.currentTransform.gpano&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels&&(c-n>.5?c-=1:n-c>.5&&(c=1+c));var h=c-s/a*(c-n),l=u-s/a*(u-o),p=this.currentTransform.gpano;this._currentNode.fullPano?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),l=this._spatial.clamp(l+this._basicRotation[1],.05,.95)):null!=p&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),l=this._spatial.clamp(l+this._basicRotation[1],0,1)):(h=this._spatial.clamp(h,0,1),l=this._spatial.clamp(l,0,1)),this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic([h,l],this._lookatDepth))}},e.prototype.setCenter=function(t){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._desiredZoom=this._zoom;var e=[this._spatial.clamp(t[0],0,1),this._spatial.clamp(t[1],0,1)];if(null!=this._currentNode){this._desiredCenter=null;var r=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(e,this._lookatDepth)),n=null!=this.previousTransform?this.previousTransform:this.currentTransform,o=(new i.Vector3).fromArray(n.unprojectBasic(e,this._lookatDepth));this._currentCamera.lookat.copy(r),this._previousCamera.lookat.copy(o)}else this._desiredCenter=e},e.prototype.setZoom=function(t){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._zoom=this._spatial.clamp(t,this._minZoom,this._maxZoom),this._desiredZoom=this._zoom},e.prototype.update=function(t){1===this._alpha&&this._currentIndex+this._alpha0?1:e<0?-1:0;0!==e&&(Math.abs(e)<.002?(this._zoom=this._desiredZoom,null!=this._desiredLookat&&(this._desiredLookat=null)):this._zoom+=r*Math.max(Math.abs(5*t*e),.002))},e.prototype._updateLookat=function(t){if(null!==this._desiredLookat){var e=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(e)<1e-6?(this._currentCamera.lookat.copy(this._desiredLookat),this._desiredLookat=null):this._currentCamera.lookat.lerp(this._desiredLookat,5*t)}},e.prototype._updateRotation=function(){if(null!=this._requestedRotationDelta){var t=this._rotationDelta.lengthSquared();return this._requestedRotationDelta.lengthSquared()>t?this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha):this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha),void(this._requestedRotationDelta=null)}this._rotationDelta.isZero||(this._rotationDelta.multiply(this._rotationAcceleration),this._rotationDelta.threshold(this._rotationThreshold))},e.prototype._updateRotationBasic=function(){if(null!=this._requestedBasicRotation){var t=this._basicRotation[0],e=this._basicRotation[1],r=this._requestedBasicRotation[0],n=this._requestedBasicRotation[1];return Math.abs(r)>Math.abs(t)?this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*t+this._rotationIncreaseAlpha*r:this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*t+this._rotationDecreaseAlpha*r,Math.abs(n)>Math.abs(e)?this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*e+this._rotationIncreaseAlpha*n:this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*e+this._rotationDecreaseAlpha*n,void(this._requestedBasicRotation=null)}if(null!=this._requestedBasicRotationUnbounded){var r=this._requestedBasicRotationUnbounded[0],n=this._requestedBasicRotationUnbounded[1];if(Math.abs(r)>0&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*r),Math.abs(n)>0&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*n),null!=this._desiredLookat){var o=this.currentTransform.projectBasic(this._desiredLookat.toArray());o[0]+=r,o[1]+=n,this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(o,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}0===this._basicRotation[0]&&0===this._basicRotation[1]||(this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0],this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1],Math.abs(this._basicRotation[0])0||this._basicRotation[1]>0)&&(this._basicRotation=[0,0]))},e.prototype._setDesiredCenter=function(){if(null!=this._desiredCenter){var t=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(this._desiredCenter,this._lookatDepth)).sub(this._currentCamera.position);this._currentCamera.lookat.copy(this._currentCamera.position.clone().add(t)),this._previousCamera.lookat.copy(this._previousCamera.position.clone().add(t)),this._desiredCenter=null}},e.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0},e}(s.StateBase);r.TraversingState=c},{"../../State":233,"@mapbox/unitbezier":2,three:176}],336:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../State"),o=function(t){function e(e){var r=t.call(this,e)||this;return r._zoom=0,r._adjustCameras(),r._motionless=r._motionlessTransition(),r}return n(e,t),e.prototype.traverse=function(){return new i.TraversingState(this)},e.prototype.wait=function(){throw new Error("Not implemented")},e.prototype.prepend=function(e){t.prototype.prepend.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.set=function(e){t.prototype.set.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.rotate=function(t){},e.prototype.rotateBasic=function(t){},e.prototype.rotateBasicUnbounded=function(t){},e.prototype.rotateToBasic=function(t){},e.prototype.zoomIn=function(t,e){},e.prototype.move=function(t){this._alpha=Math.max(0,Math.min(1,this._alpha+t))},e.prototype.moveTo=function(t){this._alpha=Math.max(0,Math.min(1,t))},e.prototype.update=function(t){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},e.prototype.setCenter=function(t){},e.prototype.setZoom=function(t){},e.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},e.prototype._setCurrentCamera=function(){t.prototype._setCurrentCamera.call(this),this._adjustCameras()},e.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){t=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(t.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){var t=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(t.clone().add(this._previousCamera.position))}}},e}(i.StateBase);r.WaitingState=o},{"../../State":233}],337:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Observable"),i=function(){function t(t,e,r){this._scheme=t,this._host=e,this._origin=null!=r?"?origin="+r:""}return t.prototype.getTile=function(t,e,r,i,o,s,a){var c="/"+t+"/"+e+","+r+","+i+","+o+"/"+s+","+a+"/0/default.jpg",u=this._scheme+"://"+this._host+c+this._origin,h=null;return[n.Observable.create(function(n){(h=new XMLHttpRequest).open("GET",u,!0),h.responseType="arraybuffer",h.timeout=15e3,h.onload=function(s){if(200===h.status){var a=new Image;a.crossOrigin="Anonymous",a.onload=function(t){n.next(a),n.complete()},a.onerror=function(s){n.error(new Error("Failed to load tile image ("+t+": "+e+","+r+","+i+","+o+")"))};var c=new Blob([h.response]);a.src=window.URL.createObjectURL(c)}else n.error(new Error("Failed to fetch tile ("+t+": "+e+","+r+","+i+","+o+"). Status: "+h.status+", "+h.statusText))},h.onerror=function(s){n.error(new Error("Failed to fetch tile ("+t+": "+e+","+r+","+i+","+o+")"))},h.ontimeout=function(s){n.error(new Error("Tile request timed out ("+t+": "+e+","+r+","+i+","+o+")"))},h.onabort=function(s){n.error(new Error("Tile request was aborted ("+t+": "+e+","+r+","+i+","+o+")"))},h.send(null)}),function(){null!=h&&h.abort()}]},t}();r.ImageTileLoader=i,r.default=i},{"rxjs/Observable":29}],338:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._images={}}return t.prototype.addImage=function(t,e,r){r in this._images||(this._images[r]={}),this._images[r][e]=t},t.prototype.dispose=function(){for(var t=0,e=Object.keys(this._images);te&&(e=i,r=n)}return t[0]+1-t[t.length-1]>e?[t[0],t[t.length-1]]:[t[r+1],t[r]]},t.prototype._clipBoundingBox=function(t){t.minX=Math.max(0,Math.min(1,t.minX)),t.maxX=Math.max(0,Math.min(1,t.maxX)),t.minY=Math.max(0,Math.min(1,t.minY)),t.maxY=Math.max(0,Math.min(1,t.maxY))},t.prototype._sign=function(t){return t>0?1:t<0?-1:0},t}();r.RegionOfInterestCalculator=i,r.default=i},{"../Geo":229}],340:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("rxjs/Subject"),o=function(){function t(t,e,r,n,o,s,a,c){this._disposed=!1,this._key=t,(e<=0||r<=0)&&console.warn("Original image size ("+e+", "+r+") is invalid ("+t+"). Tiles will not be loaded."),this._width=e,this._height=r,this._maxLevel=Math.ceil(Math.log(Math.max(r,e))/Math.log(2)),this._currentLevel=-1,this._tileSize=n,this._updated$=new i.Subject,this._createdSubject$=new i.Subject,this._created$=this._createdSubject$.publishReplay(1).refCount(),this._createdSubscription=this._created$.subscribe(function(){}),this._hasSubject$=new i.Subject,this._has$=this._hasSubject$.startWith(!1).publishReplay(1).refCount(),this._hasSubscription=this._has$.subscribe(function(){}),this._abortFunctions=[],this._tileSubscriptions={},this._renderedCurrentLevelTiles={},this._renderedTiles={},this._background=o,this._camera=null,this._imageTileLoader=s,this._imageTileStore=a,this._renderer=c,this._renderTarget=null,this._roi=null}return Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasTexture$",{get:function(){return this._has$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureUpdated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureCreated$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),t.prototype.abort=function(){for(var t in this._tileSubscriptions)this._tileSubscriptions.hasOwnProperty(t)&&this._tileSubscriptions[t].unsubscribe();this._tileSubscriptions={};for(var e=0,r=this._abortFunctions;ed?1:f/d,v=Math.floor(m*this._width),g=Math.floor(m*this._height);this._renderTarget=new n.WebGLRenderTarget(v,g,{depthBuffer:!1,format:n.RGBFormat,magFilter:n.LinearFilter,minFilter:n.LinearFilter,stencilBuffer:!1}),this._renderToTarget(0,0,this._width,this._height,this._background),this._createdSubject$.next(this._renderTarget.texture),this._hasSubject$.next(!0)}this._fetchTiles(l)}},t.prototype.updateBackground=function(t){this._background=t},t.prototype._fetchTile=function(t,e,r,n,i,o,s,a){var c=this,u=this._imageTileLoader.getTile(this._key,r,n,i,o,s,a),h=u[0],l=u[1];this._abortFunctions.push(l);var p=this._tileKey(t),f=h.subscribe(function(s){c._renderToTarget(r,n,i,o,s),c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),c._setTileRendered(t,c._currentLevel),c._imageTileStore.addImage(s,p,e),c._updated$.next(!0)},function(t){c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),console.error(t)});f.closed||(this._tileSubscriptions[p]=f)},t.prototype._fetchTiles=function(t){for(var e=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=0,n=t;rthis._width?this._width-s:e,u=a+e>this._height?this._height-a:e;if(this._imageTileStore.hasImage(o,this._currentLevel))this._renderToTarget(s,a,c,u,this._imageTileStore.getImage(o,this._currentLevel)),this._setTileRendered(i,this._currentLevel),this._updated$.next(!0);else{var h=Math.floor(c/e*this._tileSize),l=Math.floor(u/e*this._tileSize);this._fetchTile(i,this._currentLevel,s,a,c,u,h,l)}}}},t.prototype._getTileCoords=function(t){var e=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=Math.ceil(this._width/e)-1,n=Math.ceil(this._height/e)-1;return[Math.min(Math.floor(this._width*t[0]/e),r),Math.min(Math.floor(this._height*t[1]/e),n)]},t.prototype._getTiles=function(t,e){var r=[];if(t[0]>e[0]){for(var n=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),i=Math.ceil(this._width/n)-1,o=t[0];o<=i;o++)r.push(o);for(o=0;o<=e[0];o++)r.push(o)}else for(o=t[0];o<=e[0];o++)r.push(o);for(var s=[],a=0,c=r;a=h&&v[0]<=l&&v[1]>=p&&v[1]<=f){var g=this._renderedTiles[i].indexOf(v);this._renderedTiles[i].splice(g,1)}}0===this._renderedTiles[i].length&&delete this._renderedTiles[i]}this._renderedTiles[e].push(t),this._renderedCurrentLevelTiles[this._tileKey(t)]=!0},t.prototype._tileKey=function(t){return t[0]+"-"+t[1]},t}();r.TextureProvider=o,r.default=o},{"rxjs/Subject":34,three:176}],341:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._events={}}return t.prototype.on=function(t,e){this._events[t]=this._events[t]||[],this._events[t].push(e)},t.prototype.off=function(t,e){if(t)if(this._listens(t))delete this._events[t];else{var r=this._events[t].indexOf(e);r>=0&&this._events[t].splice(r,1),this._events[t].length&&delete this._events[t]}else this._events={}},t.prototype.fire=function(t,e){if(this._listens(t))for(var r=0,n=this._events[t];rr&&(r=t[n],e=n);return e}).publishReplay(1).refCount(),this._mouseOwner$.subscribe(function(){})}return Object.defineProperty(t.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentMouseMove$",{get:function(){return this._documentMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentMouseUp$",{get:function(){return this._documentMouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDragStart$",{get:function(){return this._domMouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDrag$",{get:function(){return this._domMouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDragEnd$",{get:function(){return this._domMouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDown$",{get:function(){return this._domMouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseMove$",{get:function(){return this._domMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOwner$",{get:function(){return this._mouseOwner$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDown$",{get:function(){return this._mouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseMove$",{get:function(){return this._mouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseLeave$",{get:function(){return this._mouseLeave$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOut$",{get:function(){return this._mouseOut$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOver$",{get:function(){return this._mouseOver$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseUp$",{get:function(){return this._mouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dblClick$",{get:function(){return this._dblClick$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contextMenu$",{get:function(){return this._consistentContextMenu$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseWheel$",{get:function(){return this._mouseWheel$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDragStart$",{get:function(){return this._mouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDrag$",{get:function(){return this._mouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDragEnd$",{get:function(){return this._mouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"staticClick$",{get:function(){return this._staticClick$},enumerable:!0,configurable:!0}),t.prototype.claimMouse=function(t,e){this._claimMouse$.next({name:t,zindex:e})},t.prototype.unclaimMouse=function(t){this._claimMouse$.next({name:t,zindex:null})},t.prototype.filtered$=function(t,e){return e.withLatestFrom(this.mouseOwner$,function(t,e){return[t,e]}).filter(function(e){return e[1]===t}).map(function(t){return t[0]})},t}();r.MouseService=a,r.default=a},{"../Geo":229,"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/fromEvent":42,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83}],351:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/ReplaySubject");t("rxjs/add/observable/throw"),t("rxjs/add/operator/do"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/mergeMap");var s=t("../API"),a=t("../Graph"),c=t("../Edge"),u=t("../State"),h=t("../Viewer"),l=function(){function t(t,e,r,i,o,c,l,p){this._apiV3=null!=r?r:new s.APIv3(t,e),this._imageLoadingService=null!=o?o:new a.ImageLoadingService,this._graphService=null!=i?i:new a.GraphService(new a.Graph(this.apiV3),this._imageLoadingService),this._loadingService=null!=c?c:new h.LoadingService,this._loadingName="navigator",this._stateService=null!=l?l:new u.StateService,this._cacheService=null!=p?p:new h.CacheService(this._graphService,this._stateService),this._cacheService.start(),this._keyRequested$=new n.BehaviorSubject(null),this._movedToKey$=new n.BehaviorSubject(null),this._request$=null,this._requestSubscription=null,this._nodeRequestSubscription=null}return Object.defineProperty(t.prototype,"apiV3",{get:function(){return this._apiV3},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"graphService",{get:function(){return this._graphService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageLoadingService",{get:function(){return this._imageLoadingService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadingService",{get:function(){return this._loadingService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"movedToKey$",{get:function(){return this._movedToKey$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stateService",{get:function(){return this._stateService},enumerable:!0,configurable:!0}),t.prototype.moveToKey$=function(t){this._abortRequest("to key "+t),this._loadingService.startLoading(this._loadingName);var e=this._moveToKey$(t);return this._makeRequest$(e)},t.prototype.moveDir$=function(t){var e=this;this._abortRequest("in dir "+c.EdgeDirection[t]),this._loadingService.startLoading(this._loadingName);var r=this.stateService.currentNode$.first().mergeMap(function(e){return([c.EdgeDirection.Next,c.EdgeDirection.Prev].indexOf(t)>-1?e.sequenceEdges$:e.spatialEdges$).first().map(function(e){for(var r=0,n=e.edges;r1||i[1]<0||i[1]>1)&&(i=null),i},t.prototype.eventToUnprojection=function(t,e,r,n,i){var o=this._viewportCoords.canvasPosition(t,e);return this.canvasToUnprojection(o,e,r,n,i)},t.prototype.canvasToUnprojection=function(t,e,r,i,o){var s=t[0],a=t[1],c=this._viewportCoords.canvasToViewport(s,a,e),u=c[0],h=c[1],l=new n.Vector3(u,h,1).unproject(r.perspective),p=o.projectBasic(l.toArray());(p[0]<0||p[0]>1||p[1]<0||p[1]>1)&&(p=null);var f=l.clone().sub(r.camera.position).normalize(),d=-2/f.z,m=null;if(d>0&&d<100&&p){var v=f.clone().multiplyScalar(d).add(r.camera.position),g=this._geoCoords.enuToGeodetic(v.x,v.y,v.z,i.lat,i.lon,i.alt).slice(0,2);m={lat:g[0],lon:g[1]}}return{basicPoint:p,latLon:m,pixelPoint:[s,a]}},t}();r.Projection=o,r.default=o},{"../Geo":229,three:176}],354:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("virtual-dom"),o=t("rxjs/Subject");t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var s=t("../Viewer"),a=function(){function t(){}return Object.defineProperty(t.prototype,"json",{set:function(t){this._json=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"image",{set:function(t){this._image=t,this._texture=new n.Texture(this._image),this._texture.minFilter=n.NearestFilter},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return!(!this._image||!this._json)},enumerable:!0,configurable:!0}),t.prototype.getGLSprite=function(t){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");var e=this._json[t];if(!e)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),new n.Object3D;var r=this._texture.clone();r.needsUpdate=!0;var i=this._image.width,o=this._image.height;r.offset.x=e.x/i,r.offset.y=(o-e.y-e.height)/o,r.repeat.x=e.width/i,r.repeat.y=e.height/o;var s=new n.SpriteMaterial({map:r});return new n.Sprite(s)},t.prototype.getDOMSprite=function(t,e){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==e&&(e=s.Alignment.Center);var r=this._json[t];if(!r)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),i.h("div",{},[]);var n=r.y,o=r.x+r.width,a=r.y+r.height,c=r.x,u=-r.x,h=-r.y,l=this._image.height,p=this._image.width;switch(e){case s.Alignment.Bottom:case s.Alignment.Center:case s.Alignment.Top:u-=r.width/2;break;case s.Alignment.BottomLeft:case s.Alignment.Left:case s.Alignment.TopLeft:u-=r.width;break;case s.Alignment.BottomRight:case s.Alignment.Right:case s.Alignment.BottomRight:}switch(e){case s.Alignment.Center:case s.Alignment.Left:case s.Alignment.Right:h-=r.height/2;break;case s.Alignment.Top:case s.Alignment.TopLeft:case s.Alignment.TopRight:h-=r.height;break;case s.Alignment.Bottom:case s.Alignment.BottomLeft:case s.Alignment.BottomRight:}var f=1/r.pixelRatio;n*=f,o*=f,a*=f,c*=f,u*=f,h*=f,l*=f,p*=f;var d={src:this._image.src,style:{clip:"rect("+n+"px, "+o+"px, "+a+"px, "+c+"px)",height:l+"px",left:u+"px",position:"absolute",top:h+"px",width:p+"px"}};return i.h("img",d,[])},t}(),c=function(){function t(t){var e=this;if(this._retina=window.devicePixelRatio>1,this._spriteAtlasOperation$=new o.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},new a).publishReplay(1).refCount(),this._spriteAtlas$.subscribe(function(){}),null!=t){var r=this._retina?"@2x":"",n=new XMLHttpRequest;n.open("GET",t+r+".png",!0),n.responseType="arraybuffer",n.onload=function(){var t=new Image;t.onload=function(){e._spriteAtlasOperation$.next(function(e){return e.image=t,e})};var r=new Blob([n.response]);t.src=window.URL.createObjectURL(r)},n.onerror=function(e){console.error(new Error("Failed to fetch sprite sheet ("+t+r+".png)"))},n.send();var i=new XMLHttpRequest;i.open("GET",t+r+".json",!0),i.responseType="text",i.onload=function(){var t=JSON.parse(i.response);e._spriteAtlasOperation$.next(function(e){return e.json=t,e})},i.onerror=function(e){console.error(new Error("Failed to fetch sheet ("+t+r+".json)"))},i.send()}}return Object.defineProperty(t.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),t}();r.SpriteService=c,r.default=c},{"../Viewer":236,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78,three:176,"virtual-dom":182}],355:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/timer"),t("rxjs/add/operator/bufferWhen"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap");var s=function(){function t(t,e){var r=this;this._canvasContainer=t,this._domContainer=e,this._activeSubject$=new n.BehaviorSubject(!1),this._active$=this._activeSubject$.distinctUntilChanged().publishReplay(1).refCount(),i.Observable.fromEvent(e,"touchmove").subscribe(function(t){t.preventDefault()}),this._touchStart$=i.Observable.fromEvent(t,"touchstart"),this._touchMove$=i.Observable.fromEvent(t,"touchmove"),this._touchEnd$=i.Observable.fromEvent(t,"touchend"),this._touchCancel$=i.Observable.fromEvent(t,"touchcancel");var s=this._touchStart$.filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}).share();this._doubleTap$=s.bufferWhen(function(){return s.first().switchMap(function(t){return i.Observable.timer(300).merge(s).take(1)})}).filter(function(t){return 2===t.length}).map(function(t){return t[t.length-1]}).share(),this._doubleTap$.subscribe(function(t){t.preventDefault()}),this._singleTouchMove$=this._touchMove$.filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}).share();var a=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}),c=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return t.touches.length>=1}),u=i.Observable.merge(this._touchEnd$,this._touchCancel$).filter(function(t){return 0===t.touches.length});this._singleTouchDragStart$=a.mergeMap(function(t){return r._singleTouchMove$.takeUntil(i.Observable.merge(u,c)).take(1)}),this._singleTouchDragEnd$=a.mergeMap(function(t){return i.Observable.merge(u,c).first()}),this._singleTouchDrag$=a.switchMap(function(t){return r._singleTouchMove$.skip(1).takeUntil(i.Observable.merge(c,u))});var h=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=h.filter(function(t){return 2===t.touches.length&&2===t.targetTouches.length}),this._pinchEnd$=h.filter(function(t){return 2!==t.touches.length||2!==t.targetTouches.length}),this._pinchOperation$=new o.Subject,this._pinch$=this._pinchOperation$.scan(function(t,e){return e(t)},{changeX:0,changeY:0,clientX:0,clientY:0,distance:0,distanceChange:0,distanceX:0,distanceY:0,originalEvent:null,pageX:0,pageY:0,screenX:0,screenY:0,touch1:null,touch2:null}),this._touchMove$.filter(function(t){return 2===t.touches.length&&2===t.targetTouches.length}).map(function(t){return function(e){var r=t.touches[0],n=t.touches[1],i=Math.min(r.clientX,n.clientX),o=Math.max(r.clientX,n.clientX),s=Math.min(r.clientY,n.clientY),a=i+(o-i)/2,c=s+(Math.max(r.clientY,n.clientY)-s)/2,u=a+r.pageX-r.clientX,h=c+r.pageY-r.clientY,l=a+r.screenX-r.clientX,p=c+r.screenY-r.clientY,f=Math.abs(r.clientX-n.clientX),d=Math.abs(r.clientY-n.clientY),m=Math.sqrt(f*f+d*d),v=m-e.distance;return{changeX:f-e.distanceX,changeY:d-e.distanceY,clientX:a,clientY:c,distance:m,distanceChange:v,distanceX:f,distanceY:d,originalEvent:t,pageX:u,pageY:h,screenX:l,screenY:p,touch1:r,touch2:n}}}).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.switchMap(function(t){return r._pinch$.skip(1).takeUntil(r._pinchEnd$)})}return Object.defineProperty(t.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doubleTap$",{get:function(){return this._doubleTap$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchStart$",{get:function(){return this._touchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchMove$",{get:function(){return this._touchMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchEnd$",{get:function(){return this._touchEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchCancel$",{get:function(){return this._touchCancel$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDragStart$",{get:function(){return this._singleTouchDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDrag$",{get:function(){return this._singleTouchDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDragEnd$",{get:function(){return this._singleTouchDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchStart$",{get:function(){return this._pinchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchEnd$",{get:function(){return this._pinchEnd$},enumerable:!0,configurable:!0}),t}();r.TouchService=s},{"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/timer":47,"rxjs/add/operator/bufferWhen":51,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79}],356:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("when"),o=t("../Viewer"),s=t("../Utils"),a=function(t){function e(e,r,n,i,a){var c=t.call(this)||this;return i=null!=i?i:{},s.Settings.setOptions(i),c._navigator=new o.Navigator(r,a),c._container=new o.Container(e,c._navigator.stateService,i),c._observer=new o.Observer(c,c._navigator,c._container),c._componentController=new o.ComponentController(c._container,c._navigator,c._observer,n,i.component),c}return n(e,t),e.prototype.activateComponent=function(t){this._componentController.activate(t)},e.prototype.activateCover=function(){this._componentController.activateCover()},e.prototype.deactivateComponent=function(t){this._componentController.deactivate(t)},e.prototype.deactivateCover=function(){this._componentController.deactivateCover()},e.prototype.getBearing=function(){var t=this;return i.promise(function(e,r){t._container.renderService.bearing$.first().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.getCenter=function(){var t=this;return i.promise(function(e,r){t._navigator.stateService.getCenter().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.getComponent=function(t){return this._componentController.get(t)},e.prototype.getContainer=function(){return this._container.element},e.prototype.getZoom=function(){var t=this;return i.promise(function(e,r){t._navigator.stateService.getZoom().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.moveCloseTo=function(t,e){var r=this;return i.promise(function(n,i){r._navigator.moveCloseTo$(t,e).subscribe(function(t){n(t)},function(t){i(t)})})},e.prototype.moveDir=function(t){var e=this;return i.promise(function(r,n){e._navigator.moveDir$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.moveToKey=function(t){var e=this;return i.promise(function(r,n){e._navigator.moveToKey$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.projectFromBasic=function(t){var e=this;return i.promise(function(r,n){e._observer.projectBasic$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},e.prototype.setAuthToken=function(t){var e=this;return i.promise(function(r,n){e._navigator.setToken$(t).subscribe(function(){r(void 0)},function(t){n(t)})})},e.prototype.setCenter=function(t){this._navigator.stateService.setCenter(t)},e.prototype.setFilter=function(t){var e=this;return i.promise(function(r,n){e._navigator.setFilter$(t).subscribe(function(){r(void 0)},function(t){n(t)})})},e.prototype.setRenderMode=function(t){this._container.renderService.renderMode$.next(t)},e.prototype.setZoom=function(t){this._navigator.stateService.setZoom(t)},e.prototype.unproject=function(t){var e=this;return i.promise(function(r,n){e._observer.unproject$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.unprojectToBasic=function(t){var e=this;return i.promise(function(r,n){e._observer.unprojectBasic$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.bearingchanged="bearingchanged",e.click="click",e.contextmenu="contextmenu",e.dblclick="dblclick",e.loadingchanged="loadingchanged",e.mousedown="mousedown",e.mousemove="mousemove",e.mouseout="mouseout",e.mouseover="mouseover",e.mouseup="mouseup",e.moveend="moveend",e.movestart="movestart",e.nodechanged="nodechanged",e.sequenceedgeschanged="sequenceedgeschanged",e.spatialedgeschanged="spatialedgeschanged",e}(s.EventEmitter);r.Viewer=a},{"../Utils":235,"../Viewer":236,when:223}]},{},[231])(231)}); +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Mapillary=t()}}(function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[a]={exports:{}};e[a][0].call(h.exports,function(t){var r=e[a][1][t];return i(r||t)},h,h.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;ac)&&(c=p[0]),(!l||p[1]>h)&&(h=p[1])}var f=c-n,d=h-a,m=Math.min(f,d),v=m/2,g=new u(null,i);if(0===m)return[n,a];for(var y=n;y_.d&&(_=x);for(var w=g.length;g.length;){var S=g.pop();S.d>_.d&&(_=S,r&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,w)),S.max-_.d<=e||(v=S.h/2,g.push(new o(S.x-v,S.y-v,v,t)),g.push(new o(S.x+v,S.y-v,v,t)),g.push(new o(S.x-v,S.y+v,v,t)),g.push(new o(S.x+v,S.y+v,v,t)),w+=4)}return r&&(console.log("num probes: "+w),console.log("best distance: "+_.d)),[_.x,_.y]}function i(t,e){return e.max-t.max}function o(t,e,r,n){this.x=t,this.y=e,this.h=r,this.d=a(t,e,n),this.max=this.d+this.h*Math.SQRT2}function a(t,e,r){for(var n=!1,i=1/0,o=0;oe!=p[1]>e&&t<(p[0]-l[0])*(e-l[1])/(p[1]-l[1])+l[0]&&(n=!n),i=Math.min(i,c(t,e,l,p))}return(n?1:-1)*Math.sqrt(i)}function s(t){for(var e=0,r=0,n=0,i=t[0],a=0,s=i.length,c=s-1;a1?(i=n[0],o=n[1]):c>0&&(i+=a*c,o+=s*c)}return a=t-i,s=e-o,a*a+s*s}var u=t("tinyqueue");e.exports=n,e.exports.default=n},{tinyqueue:177}],2:[function(t,e,r){function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}e.exports=n,n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){void 0===e&&(e=1e-6);var r,n,i,o,a;for(i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)n)return n;for(;ro?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],3:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function o(t,e,r){for(var n,o=[],a=e;a0?u-4:u;var h=0;for(e=0;e>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=s[t.charCodeAt(e)]<<2|s[t.charCodeAt(e+1)]>>4,a[h++]=255&i):1===o&&(i=s[t.charCodeAt(e)]<<10|s[t.charCodeAt(e+1)]<<4|s[t.charCodeAt(e+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i="",s=[],c=0,u=r-n;cu?u:c+16383));return 1===n?(e=t[r-1],i+=a[e>>2],i+=a[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=a[e>>10],i+=a[e>>4&63],i+=a[e<<2&63],i+="="),s.push(i),s.join("")};for(var a=[],s=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,l=u.length;h>>0:o>>>0;(s=i.exec(n))&&!((c=s.index+s[0].length)>p&&(h.push(n.slice(p,s.index)),!r&&s.length>1&&s[0].replace(a,function(){for(var e=1;e1&&s.index=o));)i.lastIndex===s.index&&i.lastIndex++;return p===n.length?!u&&i.test("")||h.push(""):h.push(n.slice(p)),h.length>o?h.slice(0,o):h}}()},{}],6:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function a(t){if(p===clearTimeout)return clearTimeout(t);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function s(){v&&d&&(v=!1,d.length?m=d.concat(m):g=-1,m.length&&c())}function c(){if(!v){var t=o(s);v=!0;for(var e=m.length;e;){for(d=m,m=[];++g1)for(var r=1;rX)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return o(t,e,r)}function o(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?l(t,e,r):"string"==typeof t?u(t,e):p(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return a(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function c(t){return a(t),n(t<0?0:0|f(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(t,e),o=n(r),a=o.write(t,e);return a!==r&&(o=o.slice(0,a)),o}function h(t){for(var e=t.length<0?0:0|f(t.length),r=n(e),i=0;i=X)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+X.toString(16)+" bytes");return 0|t}function d(t,e){if(i.isBuffer(t))return t.length;if(V(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,H(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,c/=2,r/=2}var u;if(i){var h=-1;for(u=r;us&&(r=s-c),u=r;u>=0;u--){for(var l=!0,p=0;pi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=r){var c,u,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:128==(192&(c=t[i+1]))&&(l=(31&o)<<6|63&c)>127&&(a=l);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:c=t[i+1],u=t[i+2],h=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)>65535&&l<1114112&&(a=l)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return C(n)}function C(t){var e=t.length;if(e<=Y)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,o,a){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return e=+e,r>>>=0,i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function k(t){if((t=t.trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function G(t){return q.toByteArray(k(t))}function $(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function V(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function H(t){return t!==t}var q=t("base64-js"),W=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50;var X=2147483647;r.kMaxLength=X,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return o(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return c(t)},i.allocUnsafeSlow=function(t){return c(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,a=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var a=o-n,s=r-e,c=Math.min(a,s),u=this.slice(n,o),h=t.slice(e,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},i.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a80*r){u=p=t[0],h=f=t[1];for(var g=r;gp&&(p=d),m>f&&(f=m);v=Math.max(p-u,f-h)}return a(s,c,r,u,h,v),c}function i(t,e,r,n,i){var o,a;if(i===j(t,e,r,n)>0)for(o=e;o=e;o-=n)a=O(o,t[o],t[o+1],a);return a&&w(a,a.next)&&(P(a),a=a.next),a}function o(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!w(n,n.next)&&0!==x(n.prev,n,n.next))n=n.next;else{if(P(n),(n=e=n.prev)===n.next)return null;r=!0}}while(r||n!==e);return e}function a(t,e,r,n,i,l,p){if(t){!p&&l&&m(t,n,i,l);for(var f,d,v=t;t.prev!==t.next;)if(f=t.prev,d=t.next,l?c(t,n,i,l):s(t))e.push(f.i/r),e.push(t.i/r),e.push(d.i/r),P(t),t=d.next,v=d.next;else if((t=d)===v){p?1===p?a(t=u(t,e,r),e,r,n,i,l,2):2===p&&h(t,e,r,n,i,l):a(o(t),e,r,n,i,l,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(x(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(b(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&x(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function c(t,e,r,n){var i=t.prev,o=t,a=t.next;if(x(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,h=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,l=g(s,c,e,r,n),p=g(u,h,e,r,n),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!w(i,o)&&S(i,n,n.next,o)&&E(i,o)&&E(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),P(n),P(n.next),n=t=o),n=n.next}while(n!==t);return n}function h(t,e,r,n,i,s){var c=t;do{for(var u=c.next.next;u!==c.prev;){if(c.i!==u.i&&_(c,u)){var h=C(c,u);return c=o(c,c.next),h=o(h,h.next),a(c,e,r,n,i,s),void a(h,e,r,n,i,s)}u=u.next}c=c.next}while(c!==t)}function l(t,e,r,n){var a,s,c,u=[];for(a=0,s=e.length;a=n.next.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=h&&b(or.x)&&E(n,t)&&(r=n,p=c),n=n.next;return r}function m(t,e,r,n){var i=t;do{null===i.z&&(i.z=g(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,v(i)}function v(t){var e,r,n,i,o,a,s,c,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e0||c>0&&n;)0===s?(i=n,n=n.nextZ,c--):0!==c&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,c--):(i=r,r=r.nextZ,s--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return t}function g(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(t){var e=t,r=t;do{e.x=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function _(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!M(t,e)&&E(t,e)&&E(e,t)&&T(t,e)}function x(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function S(t,e,r,n){return!!(w(t,e)&&w(r,n)||w(t,n)&&w(r,e))||x(t,e,r)>0!=x(t,e,n)>0&&x(r,n,t)>0!=x(r,n,e)>0}function M(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&S(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function E(t,e){return x(t.prev,t,t.next)<0?x(t,e,t.next)>=0&&x(t,t.prev,e)>=0:x(t,e,t.prev)<0||x(t,t.next,e)<0}function T(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}function C(t,e){var r=new A(t.i,t.x,t.y),n=new A(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function O(t,e,r,n){var i=new A(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function P(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function j(t,e,r,n){for(var i=0,o=e,a=r-n;o0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],9:[function(t,e,r){"use strict";t("individual/one-version")("ev-store","7");var n="__EV_STORE_KEY@7";e.exports=function(t){var e=t[n];return e||(e=t[n]={}),e}},{"individual/one-version":19}],10:[function(t,e,r){"use strict";function n(t,e){var r;for(r in e)t[r]=e[r];return t}function i(t,e){this._jsongUrl=t,"number"==typeof e&&(e={timeout:e}),this._config=n({timeout:15e3,headers:{}},e||{})}var o=t("./request"),a=t("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:a,get:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:t,method:"get"}),this._config);return o("GET",e,this)},set:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"POST",{jsonGraph:t,method:"set"}),this._config);return e.headers["Content-Type"]="application/x-www-form-urlencoded",o("POST",e,this)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var a=[];a.push("method=call"),a.push("callPath="+encodeURIComponent(JSON.stringify(t))),a.push("arguments="+encodeURIComponent(JSON.stringify(e))),a.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),a.push("paths="+encodeURIComponent(JSON.stringify(i)));var s=n(this.buildQueryObject(this._jsongUrl,"POST",a.join("&")),this._config);return s.headers["Content-Type"]="application/x-www-form-urlencoded",o("POST",s,this)}},i.XMLHttpSource=i,i.default=i,e.exports=i},{"./buildQueryObject":11,"./request":14}],11:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=[],i={url:t},o=-1!==t.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];n.push(t+"="+encodeURIComponent(e))}),"GET"===e?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],12:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e=new t.XMLHttpRequest;if("withCredentials"in e)return e;if(t.XDomainRequest)return new XDomainRequest;throw new Error("CORS is not supported by your browser")}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e,r,n;if(t.XMLHttpRequest)return new t.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;n<3;n++)try{if(e=r[n],new t.ActiveXObject(e))break}catch(t){}return new t.ActiveXObject(e)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e,r){"use strict";function n(){}function i(t,e,r){r||(r=new Error(e)),t.onError(r)}function o(t,e,r){var n,o;if(e&&t){o=e.responseType,n="response"in e?e.response:e.responseText;var a=1223===e.status?204:e.status;if(a>=200&&a<=399){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(t,"invalid json",r)}return t.onNext(n),void t.onCompleted()}return 401===a||403===a||407===a?i(t,n):410===a?i(t,n):408===a||504===a?i(t,n):i(t,n||"Response code "+a)}}function a(t,e,r,n){i(t,r||e.statusText||"request error",n)}var s=t("./getXMLHttpRequest"),c=t("./getCORSRequest"),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(t){var e=new n;return e.subscribe=function(e,r,n){var i,o;return i="function"==typeof e?{onNext:e,onError:r||h,onCompleted:n||h}:e,"function"==typeof(o=t(i))?{dispose:o}:o},e},e.exports=function(t,e,r){return n.create(function(n){var i,h,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)u.call(e,f)&&(d[f]=e[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?c():s()}catch(t){n.onError(t)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,l=d.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(t){if("json"!==d.responseType)throw t}i.onreadystatechange=function(t){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(t){h||(h=!0,a(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{"./getCORSRequest":12,"./getXMLHttpRequest":13}],15:[function(t,e,r){(function(n){!function(t){if("object"==typeof r&&void 0!==e)e.exports=t();else{("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).falcor=t()}}(function(){return function e(r,n,i){function o(s,c){if(!n[s]){if(!r[s]){var u="function"==typeof t&&t;if(!c&&u)return u(s,!0);if(a)return a(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var l=n[s]={exports:{}};r[s][0].call(l.exports,function(t){var e=r[s][1][t];return o(e||t)},l,l.exports,e,r,n,i)}return n[s].exports}for(var a="function"==typeof t&&t,s=0;s1&&!Array.isArray(n)||0===e&&!Array.isArray(n)&&"string"!==i||1===e&&!Array.isArray(n)&&!x(n))return new s(function(t){t.onError(new Error("Invalid argument"))})}return u.create(this,t)},n.prototype.invalidate=function(){var t,e=-1,r=arguments.length,n=arguments[r-1];for(t=new Array(r);++e0){var r=i.Observable.of(t);return t.get.apply(t,s).catch(i.Observable.empty()).concat(r).last().flatMap(function(){return n(e,c)}).filter(function(t){return t})}return i.Observable.return(t)}if(a>0){var o=s.map(function(t){return c.concat(t)});return e.get.apply(e,o).concat(i.Observable.defer(function(){return n(e,c)})).last().filter(function(t){return t})}return i.Observable.empty()})}},{134:134,159:159}],6:[function(t,e,r){var n=t(134),i=t(13),o=t(8),a=t(118);e.exports=function(t){var e=n.fromPath(t);if(!Array.isArray(e))throw new Error("Model#derefSync must be called with an Array path.");var r=i(this,this._path.concat(e),!1),s=r.path,c=r.value;if(r.found&&void 0!==c&&(c.$type!==a||void 0!==c.value)){if(c.$type)throw new o;return this._clone({_path:s})}}},{118:118,13:13,134:134,8:8}],7:[function(t,e,r){function n(){this.message=n.message,this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="BoundJSONGraphModelError",n.message="It is not legal to use the JSON Graph format from a bound Model. JSON Graph format can only be used from a root model.",e.exports=n},{}],8:[function(t,e,r){function n(t,e){this.message=i,this.stack=(new Error).stack,this.boundPath=t,this.shortedPath=e}var i="The boundPath of the model is not valid since a value or error was found before the path end.";(n.prototype=new Error).name="InvalidModelError",n.message=i,e.exports=n},{}],9:[function(t,e,r){function n(t){this.message="An exception was thrown when making a request.",this.stack=(new Error).stack,this.innerError=t}var i="InvalidSourceError";(n.prototype=new Error).name=i,n.is=function(t){return t&&t.name===i},e.exports=n},{}],10:[function(t,e,r){function n(){this.message="The allowed number of retries have been exceeded.",this.stack=(new Error).stack}var i="MaxRetryExceededError";(n.prototype=new Error).name=i,n.is=function(t){return t&&t.name===i},e.exports=n},{}],11:[function(t,e,r){var n=t(26).create,i=t(22),o=t(27),a=t(120),s=t(33),c=t(29).promote;e.exports=function(t,e,r,u,h,l,p){for(var f,d,m=r,v=h,g=u,y=0;;){if(0===y&&g[s]?(y=v.length,d=g[s]):(f=v[y++],d=m[f]),d){var b=d.$type,_=b&&d.value||d;if(yw;w++)x[w]=v[w];v=x}return[m,v]}},{120:120,22:22,26:26,27:27,29:29,33:33}],12:[function(t,e,r){var n=t(15),i=t(8),o=t(7);e.exports=function(t,e){return function(r,a,s){var c,u,h,l=s[0],p={values:s,optimizedPaths:[]},f=r._root.cache,d=r._path,m=f,v=d.length,g=[];if(v){if(e)return{criticalError:new o};if((m=n(r,d)).$type)return{criticalError:new i(d,d)};for(c=[],u=0;v>u;++u)c[u]=d[u]}else c=[],v=0;for(u=0,h=a.length;h>u;u++)t(r,f,m,a[u],0,l,p,g,c,v,e);return p}}},{15:15,7:7,8:8}],13:[function(t,e,r){var n=t(17),i=t(8);e.exports=function(t,e,r){var o,a,s,c,u,h=e,l=e;for(o=t._boxed,r=t._materialized,a=t._treatErrorsAsValues,t._boxed=!0,t._materialized=void 0===r||r,t._treatErrorsAsValues=!0,s=n(t,h.concat(null),!0),t._boxed=o,t._materialized=r,t._treatErrorsAsValues=a,h=s.optimizedPath,c=s.shorted,u=s.found,s=s.value;h.length&&null===h[h.length-1];)h.pop();if(u&&c)throw new i(l,h);return{path:h,value:s,shorted:c,found:u}}},{17:17,8:8}],14:[function(t,e,r){function n(t){var e,r,n,i={},o=Object.keys(t);for(r=0,n=o.length;n>r;r++)e=o[r],a(e)||(i[e]=t[e]);return i}function i(t,e,r){Object.keys(t).filter(function(e){return!a(e)&&t[e]}).forEach(function(r){var a=t[r],s=e[r];if(s||(s=e[r]={}),a.$type){var c,u=a.value&&"object"==typeof a.value,h=!t[o];return c=u||h?n(a):a.value,void(e[r]=c)}i(a,s,r)})}var o=t(37),a=t(97);e.exports=function(t){var e={};return i(t,e),e}},{37:37,97:97}],15:[function(t,e,r){e.exports=function(t,e){for(var r=t._root.cache,n=-1,i=e.length;++n_;){if(null!==(h=e[_++])&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if((p=x.$type)===c&&void 0===x.value){S=void 0,M=!1,y=v>_;break}if(v>_){if(p===s){if(o(x)){E=!0,S=void 0,M=!1;break}if(f=n(t,m,m,x,x.value),!(d=f[0])){S=void 0,x=void 0,M=!1;break}p=d.$type,x=d,g=f[1].slice(0)}if(p)break}else S=x;w=x}if(v>_&&!E){for(l=_;v>l;++l)if(null!==e[_]){b=!0;break}for(b?(y=!0,S=void 0):S=x,l=_;v>l;++l)null!==e[l]&&(g[g.length]=e[l])}if(S&&p&&(o(S)?S=void 0:a(t,S)),S&&p===u&&!t._treatErrorsAsValues)throw{path:_===v?e:e.slice(0,_),value:S.value};return S&&t._boxed?S=Boolean(p)&&!r?i(S):S:!S&&t._materialized?S={$type:c}:S&&(S=S.value),{value:S,shorted:y,optimizedPath:g,found:M}}},{11:11,118:118,119:119,120:120,25:25,27:27,29:29}],18:[function(t,e,r){var n=t(46);e.exports=function(t,e){var r=t._getValueSync({_boxed:!0,_root:t._root,_treatErrorsAsValues:t._treatErrorsAsValues},e,!0).value,i=r&&r[n];return null==i?-1:i}},{46:46}],19:[function(t,e,r){var n=t(12),i=t(31),o=n(i,!1),a=n(i,!0);e.exports={getValueSync:t(17),getBoundValue:t(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:a}},{12:12,13:13,17:17,31:31}],20:[function(t,e,r){var n=t(29),i=t(25),o=n.promote;e.exports=function(t,e,r,n,a){var s=e.value;a.errors||(a.errors=[]),t._boxed&&(s=i(e)),a.errors.push({path:n.slice(0,r+1),value:s}),o(t,e)}},{25:25,29:29}],21:[function(t,e,r){function n(t,e,r,n,i,o,a){a.requestedMissingPaths.push(n.slice(0,r).concat(e)),a.optimizedMissingPaths.push(i.slice(0,o).concat(e))}var i=t(30).fastCopy;e.exports=function(t,e,r,o,a,s,c){o.requestedMissingPaths||(o.requestedMissingPaths=[],o.optimizedMissingPaths=[]),n(0,rv;v++)b=p[v],_[b]||(_[b]={}),_=_[b];_[b=p[v]]=M?{$type:s}:S,l&&r.paths.push(l.slice(0,n))}else if(0===n)r.json=S;else{for((_=r.json)||(_=r.json={}),v=0;n-1>v;v++)y=l[v],_[y]||(_[y]={}),x=_,w=y,_=_[y];null!==(y=l[v])?_[y]=S:x[w]=S}}}},{118:118,119:119,120:120,25:25,29:29,37:37}],23:[function(t,e,r){var n=t(27),i=t(26),o=t(29),a=i.remove,s=o.splice,c=t(119),u=t(20),h=t(22),l=t(21),p=t(28),f=t(35);e.exports=function(t,e,r,i,o,d,m,v,g,y,b){var _=e&&e.$type,x=e&&void 0===e.value;return e&&_?void(n(e)?(e[f]||(s(t,e),a(e)),l(t,r,i,d,m,v,g)):_===c?(b&&(m[i]=null),y||t._treatErrorsAsValues?h(t,e,o,i,d,m,v,g,y,b):u(t,e,i,m,d)):(b&&(m[i]=null),(!x||x&&t._materialized)&&h(t,e,o,i,d,m,v,g,y,b))):void(p(t)?h(t,e,o,i,d,m,v,g,y,b):l(t,r,i,d,m,v,g))}},{119:119,20:20,21:21,22:22,26:26,27:27,28:28,29:29,35:35}],24:[function(t,e,r){var n=t(134);e.exports=function(t){var e=n.fromPath(t);if(!1===Array.isArray(e))throw new Error("Model#getValueSync must be called with an Array path.");return this._path.length&&(e=this._path.concat(e)),this._syncCheck("getValueSync")&&this._getValueSync(this,e).value}},{134:134}],25:[function(t,e,r){var n=t(40);e.exports=function(t){var e,r,i,o=Object.keys(t);for(e={},r=0,i=o.length;i>r;r++){var a=o[r];a[0]!==n&&(e[a]=t[a])}return e}},{40:40}],26:[function(t,e,r){var n=t(43),i=t(33),o=t(42),a=t(44);e.exports={create:function(t,e){var r=e[a]||0;e[n+r]=t,e[a]=r+1,t[o]=r,t[i]=e},remove:function(t){var e=t[i];if(e){for(var r=t[o],s=e[a];s>r;)e[n+r]=e[n+r+1],++r;e[a]=s-1,t[i]=void 0,t[o]=void 0}}}},{33:33,42:42,43:43,44:44}],27:[function(t,e,r){var n=t(106);e.exports=function(t){var e=void 0===t.$expires&&-1||t.$expires;return-1!==e&&1!==e&&(0===e||er;r++)o[r]=t[r];for(i=0,n=e.length;n>i;i++)o[r++]=e[i];return o},fastCatSkipNulls:function(t,e){var r,n,i,o=[];for(r=0,n=t.length;n>r;r++)o[r]=t[r];for(i=0,n=e.length;n>i;i++)null!==e[i]&&(o[r++]=e[i]);return o},fastCopy:function(t,e){var r,n,i,o=[];for(n=0,i=e||0,r=t.length;r>i;n++,i++)o[n]=t[i];return o}}},{}],31:[function(t,e,r){var n=t(11),i=t(23),o=t(27),a=t(143).iterateKeySet,s=t(120),c=t(29).promote;e.exports=function t(e,r,u,h,l,p,f,d,m,v,g,y){var b=y,_=m;if(!u||u&&u.$type||l===h.length)i(e,u,h,l,p,f,d,_,v,g,b);else{var x,w,S=l+1,M=!1,E=x=h[l];if("object"==typeof x&&(M={},E=a(x,M)),void 0!==E||!M.done){var T=v+1;do{b=!1;var C;null===E?C=u:(C=u[E],_[v]=E,d[l]=E);var O=_,P=T;if(C){var A=C.$type,j=A&&C.value||C;if(Sw;++w)O[w]=L[w]}}t(e,r,C,h,S,p,f,d,O,P,g,b),M&&!M.done&&(E=a(x,M))}while(M&&!M.done)}}}},{11:11,120:120,143:143,23:23,27:27,29:29}],32:[function(t,e,r){"use strict";function n(t){return new n.Model(t)}"function"==typeof Promise?n.Promise=Promise:n.Promise=t(151),e.exports=n,n.Model=t(2)},{151:151,2:2}],33:[function(t,e,r){e.exports=t(40)+"context"},{40:40}],34:[function(t,e,r){e.exports=t(40)+"head"},{40:40}],35:[function(t,e,r){e.exports=t(40)+"invalidated"},{40:40}],36:[function(t,e,r){e.exports=t(40)+"key"},{40:40}],37:[function(t,e,r){e.exports="$modelCreated"},{}],38:[function(t,e,r){e.exports=t(40)+"next"},{40:40}],39:[function(t,e,r){e.exports=t(40)+"parent"},{40:40}],40:[function(t,e,r){e.exports=String.fromCharCode(30)},{}],41:[function(t,e,r){e.exports=t(40)+"prev"},{40:40}],42:[function(t,e,r){e.exports=t(40)+"ref-index"},{40:40}],43:[function(t,e,r){e.exports=t(40)+"ref"},{40:40}],44:[function(t,e,r){e.exports=t(40)+"refs-length"},{40:40}],45:[function(t,e,r){e.exports=t(40)+"tail"},{40:40}],46:[function(t,e,r){e.exports=t(40)+"version"},{40:40}],47:[function(t,e,r){function n(t,e,r,i,a,s,u,h,l,p){if(!w(t)&&!t.$type)for(var f in t)if(f[0]!==c&&"$"!==f[0]&&y(t,f)){var d=t[f],m=b(d)&&!d.$type,v=o(r,i,a,f,d,m,!1,s,u,h,l,p),_=v[0],x=v[1];_&&(m?n(d,e+1,r,x,_,s,u,h,l,p):T(_,x,f,h)&&E(x,g(_),h,s))}}function i(t,e,r,n,i,a,c,l){if(_(r))return S(r,i,a),[void 0,e];v(a,r);var d=r,m=r.value,g=e;if(null!=(r=r[h]))g=r[u]||e;else{var y=0,b=m.length-1;g=r=e;do{var x=o(e,g,r,m[y],t,b>y,!0,n,i,a,c,l);if(r=x[0],w(r))return x;g=x[1]}while(y++d,!0,r,n,i);if(e=y[0],b(e))return y;f=y[1]}while(d++=l){var x=t[a];for(g=x;d>=_&&g;)x=x[c],y=g.$size||0,d-=y,!0===b&&h(g,y,t,f),g=x;t[a]=t[c]=g,null==g?t[o]=t[s]=void 0:g[s]=void 0}}},{108:108,115:115,34:34,36:36,38:38,39:39,41:41,45:45}],50:[function(t,e,r){var n=t(121),i=t(34),o=t(45),a=t(38),s=t(41),c=t(100);e.exports=function(t,e){if(c(e)&&e.$expires!==n){var r=t[i],u=t[o],h=e[a],l=e[s];e!==r&&(null!=h&&"object"==typeof h&&(h[s]=l),null!=l&&"object"==typeof l&&(l[a]=h),h=r,null!=r&&"object"==typeof r&&(r[s]=e),t[i]=t[a]=r=e,r[a]=h,r[s]=void 0),null!=u&&e!==u||(t[o]=t[s]=u=l||e)}return e}},{100:100,121:121,34:34,38:38,41:41,45:45}],51:[function(t,e,r){var n=t(34),i=t(45),o=t(38),a=t(41);e.exports=function(t,e){var r=t[n],s=t[i],c=e[o],u=e[a];null!=c&&"object"==typeof c&&(c[a]=u),null!=u&&"object"==typeof u&&(u[o]=c),e===r&&(t[n]=t[o]=c),e===s&&(t[i]=t[a]=u),e[o]=e[a]=void 0,r=s=c=u=void 0}},{34:34,38:38,41:41,45:45}],52:[function(t,e,r){function n(t,e){var r=!1;return function(){r||t._disposed||(r=!0,t._callbacks[e]=null,t._optimizedPaths[e]=[],t._requestedPaths[e]=[],0!==--t._count||t.sent||(t._disposable.dispose(),t.requestQueue.removeRequest(t)))}}function i(t){for(var e=[],r=-1,n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)e[++r]=o[a];return e}var o=t(59),a=t(60),s=0,c=t(57).GetRequest,u=t(76),h=t(78),l=t(119),p=[],f=function(t,e){this.sent=!1,this.scheduled=!1,this.requestQueue=e,this.id=++s,this.type=c,this._scheduler=t,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};f.prototype={batch:function(t,e,r){var i=this,o=i._optimizedPaths,s=i._requestedPaths,c=i._callbacks,u=o.length;return o[u]=e,s[u]=t,c[u]=r,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){a(i,o,function(t,e){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(s,t,e);for(var r=0,n=c.length;n>r;++r){var o=c[r];o&&o(t,e)}}})})),n(i,u)},add:function(t,e,r){var i,a,s=this,c=o(t,e,s._pathMap);c?(a=c[2],i=c[1]):(a=t,i=e);var u=!1,h=!1;if(i.lengtho){if(null==u){if(e)return!1;u=s[c]=Object.create(null)}if(!1===this.insertPath(t,e,u,o+1,a))return!1}else s[c]=(u||0)+1,this.length+=1;p.done||(c=l(h,p))}while(!p.done);return!0},n.prototype.removePath=function(t,e,r,n){var i=r||0,o=n||t.length-1,a=e||this.pathmaps[o+1];if(void 0===a||null===a)return!0;var s,c,u=0,h=t[i],p={};s=l(h,p);do{if(void 0!==(c=a[s])&&null!==c){if(o>i){u+=this.removePath(t,c,i+1,o);var f=void 0;for(f in c)break;void 0===f&&delete a[s]}else 0===(c=a[s]=(c||1)-1)&&delete a[s],u+=1,this.length-=1;p.done||(s=l(h,p))}}while(!p.done);return u},n.prototype.getSourceObserver=function(t){var e=this;return o.create(function(r){r.jsonGraph=r.jsonGraph||r.jsong||r.values||r.value,r.index=e.index,t.onNext(r)},function(e){t.onError(e)},function(){t.onCompleted()})},n.prototype._subscribe=function(t){var e=this,r=this.queue;e.pending=!0;var n=!1,i=new c,o=s.create(function(){n||(n=!0,r&&r._remove(e))}),a=new u(i,o);try{i.setDisposable(this.model._source[this.method](this.getSourceArgs()).subscribe(this.getSourceObserver(t)))}catch(t){throw new h(t)}return a},e.exports=n},{143:143,159:159,9:9}],54:[function(t,e,r){function n(t,e){this.total=0,this.model=t,this.requests=[],this.scheduler=e}var i=t(58),o=t(40),a=t(90),s=t(100),c=t(143);n.prototype.set=function(t){return t.paths=c.collapse(t.paths),i.create(this.model,t)},n.prototype._remove=function(t){var e=this.requests,r=e.indexOf(t);-1!==r&&e.splice(r,1)},n.prototype.distributePaths=function(t,e,r){var n,i,o=this.model,a=-1,s=t.length,c=-1,u=e.length,h=[];t:for(;++a-1;){for(var l=n[r-1],p=i[r-1],f=c[r-1]||(c[r-1]=Object.keys(p));f.length>0;){var d=f.pop();if(d[0]!==o)if(l.hasOwnProperty(d)){var m=l[d],v=a(m),g=p[d],y=a(g);if(s(m)&&s(g)&&!v&&!y){n[r]=m,i[r]=g,r+=1;continue t}h>u&&(l[d]=g)}else l[d]=p[d]}r-=1}return t},e.exports=n},{100:100,143:143,40:40,58:58,90:90}],55:[function(t,e,r){function n(t,e){this.model=t,this.scheduler=e,this.requests=this._requests=[]}var i=t(54),o=t(56);n.prototype.get=o.prototype.get,n.prototype.removeRequest=o.prototype.removeRequest,n.prototype.set=i.prototype.set,n.prototype.call=i.prototype.call,e.exports=n},{54:54,56:56}],56:[function(t,e,r){function n(t,e){this.model=t,this.scheduler=e,this.requests=this._requests=[]}var i=t(57),o=t(52);n.prototype={setScheduler:function(t){this.scheduler=t},get:function(t,e,r){function n(){m||0==--l&&r()}var a,s,c,u=this,h=[],l=0,p=u._requests,f=e,d=t,m=!1;for(a=0,s=p.length;s>a;++a)if((c=p[a]).type===i.GetRequest){if(c.sent){var v=c.add(d,f,n);v[0]&&(d=v[1],f=v[2],h[h.length]=v[3],++l)}else c.batch(d,f,n),f=[],d=[],++l;if(!f.length)break}if(f.length){c=new o(u.scheduler,u),p[p.length]=c,++l;var g=c.batch(d,f,n);h[h.length]=g}return function(){if(!m&&0!==l){m=!0;for(var t=h.length,e=0;t>e;++e)h[e]()}}},removeRequest:function(t){for(var e=this._requests,r=e.length;--r>=0;)if(e[r].id===t.id){e.splice(r,1);break}}},e.exports=n},{52:52,57:57}],57:[function(t,e,r){e.exports={GetRequest:"GET"}},{}],58:[function(t,e,r){function n(){o.call(this)}var i=t(159).Observer,o=t(53),a=t(83),s=t(76),c=t(78),u=new Array(0);n.create=function(t,e){var r=new n;return r.model=t,r.jsonGraphEnvelope=e,r},(n.prototype=Object.create(o.prototype)).constructor=n,n.prototype.method="set",n.prototype.insertPath=function(){return!1},n.prototype.removePath=function(){return 0},n.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},n.prototype.getSourceObserver=function(t){var e=this.model,r=e._path,n=this.jsonGraphEnvelope.paths,h=e._root,l=h.errorSelector,p=h.comparator;return o.prototype.getSourceObserver.call(this,i.create(function(i){e._path=u;var o=s(e,[{paths:n,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],e._path=r,t.onNext(i)},function(i){e._path=u,c(e,a(n,function(t){return{path:t,value:i}}),null,l,p),e._path=r,t.onError(i)},function(){t.onCompleted()}))},e.exports=n},{159:159,53:53,76:76,78:78,83:83}],59:[function(t,e,r){var n=t(143).hasIntersection,i=t(84);e.exports=function(t,e,r){for(var o=[],a=[],s=[],c=-1,u=-1,h=!1,l=0,p=e.length;p>l;++l){var f=e[l],d=r[f.length];d&&n(d,f,0)?(!h&&l>0&&(a=i(t,0,l),o=i(e,0,l)),s[++c]=t[l],h=!0):h&&(o[++u]=f,a[u]=t[l])}return h?[s,o,a]:null}},{143:143,84:84}],60:[function(t,e,r){var n=t(143),i=n.toTree,o=n.toPaths;e.exports=function(t,e,r){if(0!==t._count){t.sent=!0,t.scheduled=!1;for(var n=t._pathMap,a=0,s=Object.keys(e).length;s>a;++a)for(var c=e[a],u=0,h=c.length;h>u;++u){var l=c[u],p=l.length;if(n[p]){var f=n[p];f[f.length]=l}else n[p]=[l]}for(var d=Object.keys(n),m=0,v=d.length;v>m;++m){var g=d[m];n[g]=i(n[g])}var y,b=t._collasped=o(n);t.requestQueue.model._source.get(b).subscribe(function(t){y=t},function(t){r(t,y)},function(){r(null,y)})}else t.requestQueue.removeRequest(t)}},{143:143}],61:[function(t,e,r){function n(t){s.call(this,t||o)}function i(t){return a.Observable.defer(function(){return t})}function o(t){function e(t){return b.concat(t)}var r=this.args,n=this.model,o=l.fromPath(r[0]),u=r[1]||[],f=(r[2]||[]).map(l.fromPath),d=(r[3]||[]).map(l.fromPath),m=n._clone({_path:[]}),v=m.withoutDataSource(),g=n._path,y=g.concat(o),b=y.slice(0,-1),_=i(n.withoutDataSource().get(o)).map(function(t){for(var e=t.json,r=-1,n=o.length;e&&++r0?i(v.set.apply(v,e)._toJSONG()).map(function(e){return{results:t,envelope:e}}):s.return({results:t,envelope:{jsonGraph:{},paths:[]}})}).flatMap(function(t){var o=t.envelope,a=t.results,c=a.values,u=a.references,h=a.invalidations,l=c.map(n).map(e),p=u.reduce(r,[]),f=d.map(e),v=p.concat(f);return(v.length>0?i(m.get.apply(m,l.concat(v))._toJSONG()):s.return(o)).doAction(function(t){t.invalidated=h})});return s.return(h)}return s.empty()}).defaultIfEmpty(function(t){return t&&"object"==typeof t?a.Observable.defer(function(){var e;try{e=t.call(y,u,f,d)}catch(t){e=s.throw(new h(t))}return e}).map(function(t){var e=t.invalidated;return e&&e.length&&m.invalidate.apply(m,e),t}):s.empty()}(n._source)).mergeAll().flatMap(function(t){return i(v.set(t)).reduce(function(t){return t},null).map(function(){return{invalidated:t.invalidated,paths:t.paths.map(function(t){return t.slice(g.length)})}})}),x=new c;return x.add(_.subscribe(function(e){var r=e.paths,o=e.invalidated,a=n.get.apply(n,r);"AsJSONG"===t.outputFormat&&(a=i(a._toJSONG()).doAction(function(t){t.invalidated=o})),x.add(a.subscribe(t))},function(e){t.onError(e)})),x}var a=t(159)&&t(158),s=a.Observable,c=a.CompositeDisposable,u=t(64),h=t(9),l=t(134),p=t(120);n.create=u.create,(n.prototype=Object.create(s.prototype)).constructor=n,n.prototype.invokeSourceRequest=function(t){return this},n.prototype.ensureCollect=function(t){return this},n.prototype.initialize=function(){return this},e.exports=n},{120:120,134:134,158:158,159:159,64:64,9:9}],62:[function(t,e,r){function n(t){i.call(this,t)}var i=t(159).Observable,o=t(64),a=t(134),s=t(88),c=t(49),u=t(81),h=t(46),l=Array.isArray,p=t(101),f=t(98),d=t(99);n.create=o.create,(n.prototype=Object.create(i.prototype)).constructor=n,n.prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var t,e,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],s=[],c=this.args,h=-1,m=c.length;++h0&&(0,e["_"+r+c+"AsJSON"])(e,u)}return t.onCompleted(),o.empty}var o=t(159).Disposable,a=t(62);n.create=a.create,(n.prototype=Object.create(a.prototype)).method="invalidate",n.prototype.constructor=n,e.exports=n},{159:159,62:62}],64:[function(t,e,r){function n(t){this._subscribe=t}function i(t){var e=this.model,r=new this.type;return r.model=e,r.args=this.args,r.outputFormat=t.outputFormat||"AsPathMap",r.isProgressive=t.isProgressive||!1,r.subscribeCount=0,r.subscribeLimit=t.retryLimit||10,r.initialize().invokeSourceRequest(e).ensureCollect(e).subscribe(t)}var o=t(32),a=(t(159)&&t(158)).Observable,s=t(84),c=t(105),u={outputFormat:{value:"AsJSONG"}},h={isProgressive:{value:!0}};n.create=function(t,e){var r=new n(i);return r.args=e,r.type=this,r.model=t,r},(n.prototype=Object.create(a.prototype)).constructor=n,n.prototype._mixin=function(){var t=this,e=s(arguments);return new t.constructor(function(r){return t.subscribe(e.reduce(function(t,e){return Object.create(t,e)},r))})},n.prototype._toJSONG=function(){return this._mixin(u)},n.prototype.progressively=function(){return this._mixin(h)},n.prototype.subscribe=function(t,e,r){var n=t;n&&"object"==typeof n||(n={onNext:t||c,onError:e||c,onCompleted:r||c});var i=this._subscribe(n);switch(typeof i){case"function":return{dispose:i};case"object":return i||{dispose:c};default:return{dispose:c}}},n.prototype.then=function(t,e){var r=this;return new o.Promise(function(t,e){var n,i=!1;r.toArray().subscribe(function(t){n=t.length<=1?t[0]:t},function(t){i=!0,e(t)},function(){!1===i&&t(n)})}).then(t,e)},e.exports=n},{105:105,158:158,159:159,32:32,84:84}],65:[function(t,e,r){function n(t){f.call(this,t||i)}function i(t){return this.isCompleted?a.call(this,t):o.call(this,t)}function o(t){if(this.subscribeCount++>this.subscribeLimit)return t.onError("Loop kill switch thrown."),l.empty;for(var e=[],r=[],n=this.model,i=this.isMaster,o=n._root,u=this.outputFormat,h=o.errorSelector,p=this.method,f=this.groups,d=-1,v=f.length;++d0){var _=(0,n["_"+p+y+u])(n,b,null,h);r.push.apply(r,_[1]),"PathValues"===y?e.push.apply(e,b.map(s)):"JSONGs"===y?e.push.apply(e,m(b,c)):e.push.apply(e,_[0])}}return this.requestedPaths=e,i?(this.isCompleted=!0,a.call(this,t)):void t.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}function a(t){var e=new p(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(e=e._toJSONG()),this.isProgressive&&(e=e.progressively()),e.subscribe(t)}function s(t){return t.path}function c(t){return t.paths}var u=t(159),h=u.Observable,l=u.Disposable,p=t(67),f=t(62),d=t(9),m=t(82),v=new Array(0);n.create=f.create,(n.prototype=Object.create(f.prototype)).method="set",n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(t){var e=this,r=this.catch(function(n){var i;if(n&&!0===n.invokeSourceRequest){var o={},a=t._path,s=n.optimizedPaths;t._path=v,t._getPathValuesAsJSONG(t._materialize().withoutDataSource(),s,[o]),t._path=a,i=t._request.set(o).do(function(t){e.isCompleted=s.length===t.paths.length},function(){e.isCompleted=!0}).materialize().flatMap(function(t){if("C"===t.kind)return h.empty();if("E"===t.kind){var e=t.exception;if(d.is(e))return h.throw(t.exception)}return r})}else i=h.throw(n);return i});return new this.constructor(function(t){return r.subscribe(t)})},e.exports=n},{159:159,62:62,67:67,82:82,9:9}],66:[function(t,e,r){var n=function(t){this.disposed=!1,this.currentDisposable=t};n.prototype={dispose:function(){if(!this.disposed&&this.currentDisposable){this.disposed=!0;var t=this.currentDisposable;t.dispose?t.dispose():t()}}},e.exports=n},{}],67:[function(t,e,r){var n=t(64),i=t(68),o=t(69),a={dispose:function(){}},s=t(159).Observable,c=e.exports=function(t,e,r,n){this.model=t,this.currentRemainingPaths=e,this.isJSONGraph=r||!1,this.isProgressive=n||!1};c.prototype=Object.create(s.prototype),c.prototype.subscribe=n.prototype.subscribe,c.prototype.then=n.prototype.then,c.prototype._toJSONG=function(){return new c(this.model,this.currentRemainingPaths,!0,this.isProgressive)},c.prototype.progressively=function(){return new c(this.model,this.currentRemainingPaths,this.isJSONGraph,!0)},c.prototype._subscribe=function(t){var e=[{}],r=[],n=t.isJSONG=this.isJSONGraph,s=this.isProgressive,c=i(this.model,this.currentRemainingPaths,t,s,n,e,r);return c?o(this,this.model,c,t,e,r,1):a}},{159:159,64:64,68:68,69:69}],68:[function(t,e,r){var n=t(19),i=n.getWithPathsAsJSONGraph,o=n.getWithPathsAsPathMap;e.exports=function(t,e,r,n,a,s,c){var u;if((u=a?i(t,e,s):o(t,e,s)).criticalError)return r.onError(u.criticalError),null;var h=u.hasValue,l=!u.requestedMissingPaths||!t._source,p=s[0].json||s[0].jsonGraph;if(u.errors)for(var f=u.errors,d=c.length,m=0,v=f.length;v>m;++m,++d)c[d]=f[m];if(h&&n||p&&l)try{++t._root.syncRefCount,r.onNext(s[0])}catch(t){throw t}finally{--t._root.syncRefCount}return l?(c.length?r.onError(c):r.onCompleted(),null):u}},{19:19}],69:[function(t,e,r){var n=t(68),i=t(10),o=t(30).fastCat,a=t(49),s=t(88),c=t(66),u=t(46);e.exports=function t(e,r,h,l,p,f,d){if(10===d)throw new i;var m=r._request,v=h.requestedMissingPaths,g=h.optimizedMissingPaths,y=new c,b=[],_=r._path;if(_.length)for(var x=0,w=v.length;w>x;++x)b[x]=o(_,v[x]);else b=v;var S=m.get(b,g,function(){var i=n(r,v,l,e.isProgressive,e.isJSONGraph,p,f);if(i)y.currentDisposable=t(e,r,i,l,p,f,d+1);else{var o=r._root,c=o.cache,h=c[u];a(o,o.expired,s(c),r._maxSize,r._collectRatio,h)}});return y.currentDisposable=S,y}},{10:10,30:30,46:46,49:49,66:66,68:68,88:88}],70:[function(t,e,r){var n=t(67);e.exports=function(t){return new n(this,t)}},{67:67}],71:[function(t,e,r){var n=t(134),i=t(64),o=t(72),a=t(116),s=t(67);e.exports=function(){var t=a(arguments,o,"get");if(!0!==t)return new i(function(e){e.onError(t)});var e=n.fromPathsOrPathValues(arguments);return new s(this,e)}},{116:116,134:134,64:64,67:67,72:72}],72:[function(t,e,r){e.exports={path:!0,pathSyntax:!0}},{}],73:[function(t,e,r){function n(){}var i=t(123),o=t(159).Disposable;n.prototype.schedule=function(t){return i(t),o.empty},n.prototype.scheduleWithState=function(t,e){var r=this;return i(function(){e(r,t)}),o.empty},e.exports=n},{123:123,159:159}],74:[function(t,e,r){function n(){}var i=t(159).Disposable;n.prototype.schedule=function(t){return t(),i.empty},n.prototype.scheduleWithState=function(t,e){return e(this,t),i.empty},e.exports=n},{159:159}],75:[function(t,e,r){function n(t){this.delay=t}var i=t(159).Disposable;n.prototype.schedule=function(t){var e=setTimeout(t,this.delay);return i.create(function(){void 0!==e&&(clearTimeout(e),e=void 0)})},n.prototype.scheduleWithState=function(t,e){var r=this,n=setTimeout(function(){e(r,t)},this.delay);return i.create(function(){void 0!==n&&(clearTimeout(n),n=void 0)})},e.exports=n},{159:159}],76:[function(t,e,r){function n(t,e,r,i,a,s,c,u,h,l,p,d,m,v,g,b,_){for(var x={},w=ex,!0,i,a,u,p,m,y,b);if(e=T[0],v(e))return a.index=x,T;M=T[1],n=T[2],E=T[3]}while(x++=x)break;l.index=w}}function i(t,e,r,n,i,a,s,u,p,m){var v=r.value;if(i.splice(0,i.length),i.push.apply(i,v),x(r))return i.index=v.length,M(r,s,u),[void 0,e];y(u,r);var g=r,b=e;if(null!=(r=r[l]))b=r[h]||e,i.index=v.length;else{var _=0,w=v.length-1;b=r=e;do{var E=o(e,b,r,v[_],t,w>_,!0,n,i,a,s,u,p,m);if(r=E[0],S(r))return i.index=_,E;b=E[1]}while(_++S,!0,n,i,a,h,f,d,g);if(r=E[0],y(r))return i.index=S,E;w=E[1]}while(S++o&&(o=0),r>0&&o>r&&(o=r);for(var a=new Array(o);++iL)return}if(O&&j&&!P)return d(v(e,r,t,b,M),t,b);if(P||!j){if(P===a&&l(T)&&(r=T(y(_,b),r)),P&&e===r)null==e[i]&&(e=f(e,O,e.value),t=g(t,-e.$size,M,w),e=d(e,t,b,w));else{var N=!0;!O&&A||(N=c(r)-1);return t}},{39:39,43:43,44:44,46:46}],115:[function(t,e,r){var n=t(36),i=t(46),o=t(39),a=t(108),s=t(114);e.exports=function(t,e,r,c){var u=t;do{var h=u[o];0>=(u.$size=(u.$size||0)-e)&&null!=h?a(u,h,u[n],r):u[i]!==c&&s(u,c),u=h}while(u);return t}},{108:108,114:114,36:36,39:39,46:46}],116:[function(t,e,r){var n=Array.isArray,i=t(101),o=t(99),a=t(98),s=t(134);e.exports=function(t,e,r){for(var c=0,u=t.length;u>c;++c){var h=t[c],l=!1;if(n(h)&&e.path?l=!0:"string"==typeof h&&e.pathSyntax?l=!0:i(h)&&e.pathValue?(h.path=s.fromPath(h.path),l=!0):o(h)&&e.jsonGraph?l=!0:a(h)&&e.json?l=!0:"function"==typeof h&&c+1===u&&e.selector&&(l=!0),!l)return new Error("Unrecognized argument "+typeof h+" ["+String(h)+"] to Model#"+r)}return!0}},{101:101,134:134,98:98,99:99}],117:[function(t,e,r){var n=t(130).atom,i=t(106),o=t(122),a=t(37),s=t(85),c=Array.isArray,u=t(88),h=t(87);e.exports=function(t,e,r){var l=0,p=t,f=e;if(f?(p=s(p),l=u(p),p.$type=f):(p=n(r),f=p.$type,p[a]=!0),null==r)l=51;else if(null==l||0>=l)switch(typeof r){case"object":l=c(r)?50+r.length:51;break;case"string":l=50+r.length;break;default:l=51}var d=h(p);return"number"==typeof d&&o>d&&(p.$expires=i()+-1*d),p.$size=l,p}},{106:106,122:122,130:130,37:37,85:85,87:87,88:88}],118:[function(t,e,r){e.exports="atom"},{}],119:[function(t,e,r){e.exports="error"},{}],120:[function(t,e,r){e.exports="ref"},{}],121:[function(t,e,r){e.exports=1},{}],122:[function(t,e,r){e.exports=0},{}],123:[function(t,e,r){"use strict";function n(t){var e;(e=a.length?a.pop():new i).task=t,o(e)}function i(){this.task=null}var o=t(124),a=[],s=[],c=o.makeRequestCallFromTimer(function(){if(s.length)throw s.shift()});e.exports=n,i.prototype.call=function(){try{this.task.call()}catch(t){n.onerror?n.onerror(t):(s.push(t),c())}finally{this.task=null,a[a.length]=this}}},{124:124}],124:[function(t,e,r){(function(t){"use strict";function r(t){a.length||(o(),s=!0),a[a.length]=t}function n(){for(;cu){for(var e=0,r=a.length-c;r>e;e++)a[e]=a[e+c];a.length-=c,c=0}}a.length=0,c=0,s=!1}function i(t){return function(){function e(){clearTimeout(r),clearInterval(n),t()}var r=setTimeout(e,0),n=setInterval(e,50)}}e.exports=r;var o,a=[],s=!1,c=0,u=1024,h=t.MutationObserver||t.WebKitMutationObserver;o="function"==typeof h?function(t){var e=1,r=new h(t),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){e=-e,n.data=e}}(n):i(n),r.requestFlush=o,r.makeRequestCallFromTimer=i}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(t,e,r){"use strict";function n(t,e){var r;for(r in e)t[r]=e[r];return t}function i(t,e){this._jsongUrl=t,"number"==typeof e&&(e={timeout:e}),this._config=n({timeout:15e3,headers:{}},e||{})}var o=t(129),a=t(126);Array.isArray,i.prototype={constructor:i,buildQueryObject:a,get:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:t,method:"get"}),this._config);return o("GET",e,this)},set:function(t){var e="POST",r=n(this.buildQueryObject(this._jsongUrl,e,{jsonGraph:t,method:"set"}),this._config);return r.headers["Content-Type"]="application/x-www-form-urlencoded",o(e,r,this)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var a="POST",s=[];s.push("method=call"),s.push("callPath="+encodeURIComponent(JSON.stringify(t))),s.push("arguments="+encodeURIComponent(JSON.stringify(e))),s.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),s.push("paths="+encodeURIComponent(JSON.stringify(i)));var c=n(this.buildQueryObject(this._jsongUrl,a,s.join("&")),this._config);return c.headers["Content-Type"]="application/x-www-form-urlencoded",o(a,c,this)}},i.XMLHttpSource=i,i.default=i,e.exports=i},{126:126,129:129}],126:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=[],i={url:t},o=-1!==t.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];n.push(t+"="+encodeURIComponent(e))}),"GET"===e?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],127:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e=new t.XMLHttpRequest;if("withCredentials"in e)return e;if(t.XDomainRequest)return new XDomainRequest;throw new Error("CORS is not supported by your browser")}}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],128:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e,r,n;if(t.XMLHttpRequest)return new t.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;3>n;n++)try{if(e=r[n],new t.ActiveXObject(e))break}catch(t){}return new t.ActiveXObject(e)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(t,e,r){"use strict";function n(){}function i(t,e,r){r||(r=new Error(e)),t.onError(r)}function o(t,e,r){var n,o;if(e&&t){o=e.responseType,n="response"in e?e.response:e.responseText;var a=1223===e.status?204:e.status;if(a>=200&&399>=a){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(t,"invalid json",r)}return t.onNext(n),void t.onCompleted()}return 401===a||403===a||407===a?i(t,n):410===a?i(t,n):408===a||504===a?i(t,n):i(t,n||"Response code "+a)}}function a(t,e,r,n){i(t,r||e.statusText||"request error",n)}var s=t(128),c=t(127),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(t){var e=new n;return e.subscribe=function(e,r,n){var i,o;return i="function"==typeof e?{onNext:e,onError:r||h,onCompleted:n||h}:e,"function"==typeof(o=t(i))?{dispose:o}:o},e},e.exports=function(t,e,r){return n.create(function(n){var i,h,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)u.call(e,f)&&(d[f]=e[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?c():s()}catch(t){n.onError(t)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,l=d.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(t){if("json"!==d.responseType)throw t}i.onreadystatechange=function(t){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(t){h||(h=!0,a(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{127:127,128:128}],130:[function(t,e,r){function n(t,e,r){var n=Object.create(null);if(null!=r){for(var i in r)n[i]=r[i];return n.$type=t,n.value=e,n}return{$type:t,value:e}}var i=t(134);e.exports={ref:function(t,e){return n("ref",i.fromPath(t),e)},atom:function(t,e){return n("atom",t,e)},undefined:function(){return n("atom")},error:function(t,e){return n("error",t,e)},pathValue:function(t,e){return{path:i.fromPath(t),value:e}},pathInvalidation:function(t){return{path:i.fromPath(t),invalidated:!0}}}},{134:134}],131:[function(t,e,r){e.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],132:[function(t,e,r){var n={token:"token",dotSeparator:".",commaSeparator:",",openingBracket:"[",closingBracket:"]",openingBrace:"{",closingBrace:"}",escape:"\\",space:" ",colon:":",quote:"quote",unknown:"unknown"};e.exports=n},{}],133:[function(t,e,r){e.exports={indexer:{nested:"Indexers cannot be nested.",needQuotes:"unquoted indexers must be numeric.",empty:"cannot have empty indexers.",leadingDot:"Indexers cannot have leading dots.",leadingComma:"Indexers cannot have leading comma.",requiresComma:"Indexers require commas between indexer args.",routedTokens:"Only one token can be used per indexer when specifying routed tokens."},range:{precedingNaN:"ranges must be preceded by numbers.",suceedingNaN:"ranges must be suceeded by numbers."},routed:{invalid:"Invalid routed token. only integers|ranges|keys are supported."},quote:{empty:"cannot have empty quoted keys.",illegalEscape:"Invalid escape character. Only quotes are escapable."},unexpectedToken:"Unexpected token.",invalidIdentifier:"Invalid Identifier.",invalidPath:"Please provide a valid path.",throwError:function(t,e,r){if(r)throw t+" -- "+e.parseString+" with next token: "+r;throw t+" -- "+e.parseString}}},{}],134:[function(t,e,r){var n=t(140),i=t(135),o=t(131),a=function(t,e){return i(new n(t,e))};e.exports=a,a.fromPathsOrPathValues=function(t,e){if(!t)return[];for(var r=[],n=0,i=t.length;i>n;n++)"string"==typeof t[n]?r[n]=a(t[n],e):"string"==typeof t[n].path?r[n]={path:a(t[n].path,e),value:t[n].value}:r[n]=t[n];return r},a.fromPath=function(t,e){return t?"string"==typeof t?a(t,e):t:[]},a.RoutedTokens=o},{131:131,135:135,140:140}],135:[function(t,e,r){var n=t(132),i=t(133),o=t(136);e.exports=function(t){for(var e=t.next(),r={},a=[];!e.done;){switch(e.type){case n.token:var s=+e.token[0];isNaN(s)||i.throwError(i.invalidIdentifier,t),a[a.length]=e.token;break;case n.dotSeparator:0===a.length&&i.throwError(i.unexpectedToken,t);break;case n.space:break;case n.openingBracket:o(t,e,r,a);break;default:i.throwError(i.unexpectedToken,t)}e=t.next()}return 0===a.length&&i.throwError(i.invalidPath,t),a}},{132:132,133:133,136:136}],136:[function(t,e,r){var n=t(132),i=t(133),o=i.indexer,a=t(138),s=t(137),c=t(139);e.exports=function(t,e,r,u){var h=t.next(),l=!1,p=1,f=!1;for(r.indexer=[];!h.done;){switch(h.type){case n.token:case n.quote:r.indexer.length===p&&i.throwError(o.requiresComma,t)}switch(h.type){case n.openingBrace:f=!0,c(t,h,r,u);break;case n.token:var d=+h.token;isNaN(d)&&i.throwError(o.needQuotes,t),r.indexer[r.indexer.length]=d;break;case n.dotSeparator:r.indexer.length||i.throwError(o.leadingDot,t),a(t,h,r,u);break;case n.space:break;case n.closingBracket:l=!0;break;case n.quote:s(t,h,r,u);break;case n.openingBracket:i.throwError(o.nested,t);break;case n.commaSeparator:++p;break;default:i.throwError(i.unexpectedToken,t)}if(l)break;h=t.next()}0===r.indexer.length&&i.throwError(o.empty,t),r.indexer.length>1&&f&&i.throwError(o.routedTokens,t),1===r.indexer.length&&(r.indexer=r.indexer[0]),u[u.length]=r.indexer,r.indexer=void 0}},{132:132,133:133,137:137,138:138,139:139}],137:[function(t,e,r){var n=t(132),i=t(133),o=i.quote;e.exports=function(t,e,r,a){for(var s=t.next(),c="",u=e.token,h=!1,l=!1;!s.done;){switch(s.type){case n.token:case n.space:case n.dotSeparator:case n.commaSeparator:case n.openingBracket:case n.closingBracket:case n.openingBrace:case n.closingBrace:h&&i.throwError(o.illegalEscape,t),c+=s.token;break;case n.quote:h?(c+=s.token,h=!1):s.token!==u?c+=s.token:l=!0;break;case n.escape:h=!0;break;default:i.throwError(i.unexpectedToken,t)}if(l)break;s=t.next()}0===c.length&&i.throwError(o.empty,t),r.indexer[r.indexer.length]=c}},{132:132,133:133}],138:[function(t,e,r){var n=t(140),i=t(132),o=t(133);e.exports=function(t,e,r,a){var s,c=t.peek(),u=1,h=!1,l=!0,p=r.indexer.length-1,f=n.toNumber(r.indexer[p]);for(isNaN(f)&&o.throwError(o.range.precedingNaN,t);!h&&!c.done;){switch(c.type){case i.dotSeparator:3===u&&o.throwError(o.unexpectedToken,t),3===++u&&(l=!1);break;case i.token:s=n.toNumber(t.next().token),isNaN(s)&&o.throwError(o.range.suceedingNaN,t),h=!0;break;default:h=!0}if(h)break;t.next(),c=t.peek()}r.indexer[p]={from:f,to:l?s:s-1}}},{132:132,133:133,140:140}],139:[function(t,e,r){var n=t(132),i=t(131),o=t(133),a=o.routed;e.exports=function(t,e,r,s){var c=t.next(),u=!1,h="";switch(c.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(a.invalid,t)}var l=t.next();if(l.type===n.colon&&(u=!0,(l=t.next()).type!==n.token&&o.throwError(a.invalid,t),h=l.token,l=t.next()),l.type===n.closingBrace){var p={type:c.token,named:u,name:h};r.indexer[r.indexer.length]=p}else o.throwError(a.invalid,t)}},{131:131,132:132,133:133}],140:[function(t,e,r){function n(t,e,r){return{token:t,done:r,type:e}}function i(t,e,r){var i,b=!1,_="",x=r?y:g;do{if(i=e+1>=t.length)break;var w=t[e+1];if(void 0===w||-1!==x.indexOf(w)){if(_.length)break;++e;var S;switch(w){case a:S=o.dotSeparator;break;case s:S=o.commaSeparator;break;case c:S=o.openingBracket;break;case u:S=o.closingBracket;break;case h:S=o.openingBrace;break;case l:S=o.closingBrace;break;case v:S=o.space;break;case d:case m:S=o.quote;break;case f:S=o.escape;break;case p:S=o.colon;break;default:S=o.unknown}b=n(w,S,!1);break}_+=w,++e}while(!i);return!b&&_.length&&(b=n(_,o.token,!1)),b||(b={done:!0}),{token:b,idx:e}}var o=t(132),a=".",s=",",c="[",u="]",h="{",l="}",p=":",f="\\",d='"',m="'",v=" ",g="\\'\"[]., ",y="\\{}'\"[]., :",b=e.exports=function(t,e){this._string=t,this._idx=-1,this._extended=e,this.parseString=""};b.prototype={next:function(){var t=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._idx=t.idx,this._nextToken=!1,this.parseString+=t.token.token,t.token},peek:function(){var t=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._nextToken=t,t.token}},b.toNumber=function(t){return isNaN(+t)?NaN:+t}},{132:132}],141:[function(t,e,r){var n=t(147),i=t(148);e.exports=function(t){var e=t.reduce(function(t,e){var r=e.length;return t[r]||(t[r]=[]),t[r].push(e),t},{});return Object.keys(e).forEach(function(t){e[t]=i(e[t])}),n(e)}},{147:147,148:148}],142:[function(t,e,r){var n=t(144);e.exports=function t(e,r,i){for(var o=e,a=!0;a&&in&&(e.empty=!0)}function i(t,e){e.done=!1;var r=e.isObject=!(!t||"object"!=typeof t);e.isArray=r&&o(t),e.arrayOffset=0}var o=Array.isArray;e.exports=function(t,e){if(void 0===e.isArray&&i(t,e),e.isArray){var r;do{if(e.loaded&&e.rangeOffset>e.to&&(++e.arrayOffset,e.loaded=!1),e.arrayOffset>=t.length){e.done=!0;break}var o=t[e.arrayOffset];if("object"===typeof o){if(e.loaded||n(o,e),e.empty)continue;r=e.rangeOffset++}else++e.arrayOffset,r=o}while(void 0===r);return r}return e.isObject?(e.loaded||n(t,e),e.rangeOffset>e.to?void(e.done=!0):e.rangeOffset++):(e.done=!0,t)}},{}],145:[function(t,e,r){var n=t(142);e.exports=function(t,e){for(var r=[],i=-1,o=0,a=t.length;a>o;++o){var s=t[o];n(e[s.length],s,0)||(r[++i]=s)}return r}},{142:142}],146:[function(t,e,r){var n=t(142);e.exports=function(t,e){for(var r=[],i=-1,o=0,a=t.length;a>o;++o)n(e,t[o],0)||(r[++i]=t[o]);return r}},{142:142}],147:[function(t,e,r){function n(t){return null!==t&&typeof t===p}function i(t,e,r){var n,o,a,s,l,p,f,d,m,v,g,y,b,_,x=u(String(e)),w=Object.create(null),S=[],M=-1,E=0,T=[],C=0;if(s=[],l=-1,r-1>e){for(p=c(t,s);++l0)for(f=o.sets,d=-1,m=f.length,b=s[0];++d1&&s||b;++g1?[s]:s;++l0;++e<=r;){var i=t[e];if(!h(i)){n=!1;break}t[e]=parseInt(i,10)}if(!0===n){t.sort(s);var o=t[0],a=t[r];if(r>=a-o)return{from:o,to:a}}return t}function s(t,e){return t-e}function c(t,e,r){var n=0;for(var i in t)e[n++]=i;return n>1&&e.sort(r),n}function u(t){for(var e=5381,r=-1,n=t.length;++r=0}var l=Array.isArray,p="object";e.exports=function(t){var e,r=[],a=0;for(var s in t)if(h(s)&&n(e=t[s]))for(var c=i(e,0,parseInt(s,10)).sets,u=-1,l=c.length;++u1)for(var r=1;r0?e:0);return new n(function(e,n){i.push(function(t,r){t?n(t):e(r)});var o=t.apply(r,i);!o||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then||e(o)})}},n.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),r="function"==typeof e[e.length-1]?e.pop():null,o=this;try{return t.apply(this,arguments).nodeify(r,o)}catch(t){if(null===r||void 0===r)return new n(function(e,r){r(t)});i(function(){r.call(o,t)})}}},n.prototype.nodeify=function(t,e){return"function"!=typeof t?this:void this.then(function(r){i(function(){t.call(e,null,r)})},function(r){i(function(){t.call(e,r)})})}},{123:123,152:152}],158:[function(t,e,r){(function(n){(function(i){var o={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},a=o[typeof window]&&window||this,s=o[typeof r]&&r&&!r.nodeType&&r,c=o[typeof e]&&e&&!e.nodeType&&e,u=(c&&c.exports,o[typeof n]&&n);!u||u.global!==u&&u.window!==u||(a=u),"object"==typeof e&&e&&e.exports===s?e.exports=i(a,e.exports,t(159)):a.Rx=i(a,{},a.Rx)}).call(this,function(t,e,r,n){function i(){try{return f.apply(this,arguments)}catch(t){return I.e=t,I}}function o(t){if(!M(t))throw new TypeError("fn must be a function");return f=t,i}function a(t,e,r){return new g(function(n){var i=!1,o=null,a=[];return t.subscribe(function(t){var s,c;try{c=e(t)}catch(t){return void n.onError(t)}if(s=0,i)try{s=r(c,o)}catch(t){return void n.onError(t)}else i=!0,o=c;s>0&&(o=c,a=[]),s>=0&&a.push(t)},function(t){n.onError(t)},function(){n.onNext(a),n.onCompleted()})},t)}function s(t){if(0===t.length)throw new R;return t[0]}function c(t,e,r,n){if(0>e)throw new N;return new g(function(i){var o=e;return t.subscribe(function(t){0==o--&&(i.onNext(t),i.onCompleted())},function(t){i.onError(t)},function(){r?(i.onNext(n),i.onCompleted()):i.onError(new N)})},t)}function u(t,e,r){return new g(function(n){var i=r,o=!1;return t.subscribe(function(t){o?n.onError(new Error("Sequence contains more than one element")):(i=t,o=!0)},function(t){n.onError(t)},function(){o||e?(n.onNext(i),n.onCompleted()):n.onError(new R)})},t)}function h(t,e,r){return new g(function(n){return t.subscribe(function(t){n.onNext(t),n.onCompleted()},function(t){n.onError(t)},function(){e?(n.onNext(r),n.onCompleted()):n.onError(new R)})},t)}function l(t,e,r){return new g(function(n){var i=r,o=!1;return t.subscribe(function(t){i=t,o=!0},function(t){n.onError(t)},function(){o||e?(n.onNext(i),n.onCompleted()):n.onError(new R)})},t)}function p(t,e,r,i){var o=j(e,r,3);return new g(function(e){var r=0;return t.subscribe(function(n){var a;try{a=o(n,r,t)}catch(t){return void e.onError(t)}a?(e.onNext(i?r:n),e.onCompleted()):r++},function(t){e.onError(t)},function(){e.onNext(i?-1:n),e.onCompleted()})},t)}var f,d=r.Observable,m=d.prototype,v=r.CompositeDisposable,g=r.AnonymousObservable,y=r.Disposable.empty,b=(r.internals.isEqual,r.helpers),_=b.not,x=b.defaultComparer,w=b.identity,S=b.defaultSubComparer,M=b.isFunction,E=b.isPromise,T=b.isArrayLike,C=b.isIterable,O=r.internals.inherits,P=d.fromPromise,A=d.from,j=r.internals.bindCallback,R=r.EmptyError,L=r.ObservableBase,N=r.ArgumentOutOfRangeError,I={e:{}};m.aggregate=function(){var t,e,r=!1,n=this;return 2===arguments.length?(r=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new g(function(i){var o,a,s;return n.subscribe(function(n){!s&&(s=!0);try{o?a=t(a,n):(a=r?t(e,n):n,o=!0)}catch(t){return i.onError(t)}},function(t){i.onError(t)},function(){s&&i.onNext(a),!s&&r&&i.onNext(e),!s&&!r&&i.onError(new R),i.onCompleted()})},n)};var D=function(t){function e(e,r,n,i){this.source=e,this.acc=r,this.hasSeed=n,this.seed=i,t.call(this)}function r(t,e){this.o=t,this.acc=e.acc,this.hasSeed=e.hasSeed,this.seed=e.seed,this.hasAccumulation=!1,this.result=null,this.hasValue=!1,this.isStopped=!1}return O(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this))},r.prototype.onNext=function(t){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=o(this.acc)(this.result,t):(this.result=this.hasSeed?o(this.acc)(this.seed,t):t,this.hasAccumulation=!0),this.result===I&&this.o.onError(this.result.e))},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new R),this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(L);return m.reduce=function(t){var e=!1;if(2===arguments.length){e=!0;var r=arguments[1]}return new D(this,t,e,r)},m.some=function(t,e){var r=this;return t?r.filter(t,e).some():new g(function(t){return r.subscribe(function(){t.onNext(!0),t.onCompleted()},function(e){t.onError(e)},function(){t.onNext(!1),t.onCompleted()})},r)},m.any=function(){return this.some.apply(this,arguments)},m.isEmpty=function(){return this.any().map(_)},m.every=function(t,e){return this.filter(function(e){return!t(e)},e).some().map(_)},m.all=function(){return this.every.apply(this,arguments)},m.includes=function(t,e){function r(t,e){return 0===t&&0===e||t===e||isNaN(t)&&isNaN(e)}var n=this;return new g(function(i){var o=0,a=+e||0;return Math.abs(a)===1/0&&(a=0),0>a?(i.onNext(!1),i.onCompleted(),y):n.subscribe(function(e){o++>=a&&r(e,t)&&(i.onNext(!0),i.onCompleted())},function(t){i.onError(t)},function(){i.onNext(!1),i.onCompleted()})},this)},m.contains=function(t,e){m.includes(t,e)},m.count=function(t,e){return t?this.filter(t,e).count():this.reduce(function(t){return t+1},0)},m.indexOf=function(t,e){var r=this;return new g(function(n){var i=0,o=+e||0;return Math.abs(o)===1/0&&(o=0),0>o?(n.onNext(-1),n.onCompleted(),y):r.subscribe(function(e){i>=o&&e===t&&(n.onNext(i),n.onCompleted()),i++},function(t){n.onError(t)},function(){n.onNext(-1),n.onCompleted()})},r)},m.sum=function(t,e){return t&&M(t)?this.map(t,e).sum():this.reduce(function(t,e){return t+e},0)},m.minBy=function(t,e){return e||(e=S),a(this,t,function(t,r){return-1*e(t,r)})},m.min=function(t){return this.minBy(w,t).map(function(t){return s(t)})},m.maxBy=function(t,e){return e||(e=S),a(this,t,e)},m.max=function(t){return this.maxBy(w,t).map(function(t){return s(t)})},m.average=function(t,e){return t&&M(t)?this.map(t,e).average():this.reduce(function(t,e){return{sum:t.sum+e,count:t.count+1}},{sum:0,count:0}).map(function(t){if(0===t.count)throw new R;return t.sum/t.count})},m.sequenceEqual=function(t,e){var r=this;return e||(e=x),new g(function(n){var i=!1,o=!1,a=[],s=[],c=r.subscribe(function(t){var r,i;if(s.length>0){i=s.shift();try{r=e(i,t)}catch(t){return void n.onError(t)}r||(n.onNext(!1),n.onCompleted())}else o?(n.onNext(!1),n.onCompleted()):a.push(t)},function(t){n.onError(t)},function(){i=!0,0===a.length&&(s.length>0?(n.onNext(!1),n.onCompleted()):o&&(n.onNext(!0),n.onCompleted()))});(T(t)||C(t))&&(t=A(t)),E(t)&&(t=P(t));var u=t.subscribe(function(t){var r;if(a.length>0){var o=a.shift();try{r=e(o,t)}catch(t){return void n.onError(t)}r||(n.onNext(!1),n.onCompleted())}else i?(n.onNext(!1),n.onCompleted()):s.push(t)},function(t){n.onError(t)},function(){o=!0,0===s.length&&(a.length>0?(n.onNext(!1),n.onCompleted()):i&&(n.onNext(!0),n.onCompleted()))});return new v(c,u)},r)},m.elementAt=function(t){return c(this,t,!1)},m.elementAtOrDefault=function(t,e){return c(this,t,!0,e)},m.single=function(t,e){return t&&M(t)?this.where(t,e).single():u(this,!1)},m.singleOrDefault=function(t,e,r){return t&&M(t)?this.filter(t,r).singleOrDefault(null,e):u(this,!0,e)},m.first=function(t,e){return t?this.where(t,e).first():h(this,!1)},m.firstOrDefault=function(t,e,r){return t?this.where(t).firstOrDefault(null,e):h(this,!0,e)},m.last=function(t,e){return t?this.where(t,e).last():l(this,!1)},m.lastOrDefault=function(t,e,r){return t?this.where(t,r).lastOrDefault(null,e):l(this,!0,e)},m.find=function(t,e){return p(this,t,e,!1)},m.findIndex=function(t,e){return p(this,t,e,!0)},m.toSet=function(){if(void 0===t.Set)throw new TypeError;var e=this;return new g(function(r){var n=new t.Set;return e.subscribe(function(t){n.add(t)},function(t){r.onError(t)},function(){r.onNext(n),r.onCompleted()})},e)},m.toMap=function(e,r){if(void 0===t.Map)throw new TypeError;var n=this;return new g(function(i){var o=new t.Map;return n.subscribe(function(t){var n;try{n=e(t)}catch(t){return void i.onError(t)}var a=t;if(r)try{a=r(t)}catch(t){return void i.onError(t)}o.set(n,a)},function(t){i.onError(t)},function(){i.onNext(o),i.onCompleted()})},n)},r})}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(t,e,r){(function(t,n){(function(i){function o(t){for(var e=[],r=0,n=t.length;n>r;r++)e.push(t[r]);return e}function a(t,e){if(ct&&e.stack&&"object"==typeof t&&null!==t&&t.stack&&-1===t.stack.indexOf(lt)){for(var r=[],n=e;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(t.stack);var i=r.join("\n"+lt+"\n");t.stack=c(i)}}function c(t){for(var e=t.split("\n"),r=[],n=0,i=e.length;i>n;n++){var o=e[n];u(o)||h(o)||!o||r.push(o)}return r.join("\n")}function u(t){var e=p(t);if(!e)return!1;var r=e[0],n=e[1];return r===ut&&n>=ht&&jr>=n}function h(t){return-1!==t.indexOf("(module.js:")||-1!==t.indexOf("(node.js:")}function l(){if(ct)try{throw new Error}catch(r){var t=r.stack.split("\n"),e=p(t[0].indexOf("@")>0?t[1]:t[2]);if(!e)return;return ut=e[0],e[1]}}function p(t){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);if(e)return[e[1],Number(e[2])];var r=/at ([^ ]+):(\d+):(?:\d+)$/.exec(t);if(r)return[r[1],Number(r[2])];var n=/.*@(.+):(\d+)$/.exec(t);return n?[n[1],Number(n[2])]:void 0}function f(t){var e=[];if(!$t(t))return e;Gt.nonEnumArgs&&t.length&&Vt(t)&&(t=Wt.call(t));var r=Gt.enumPrototypes&&"function"==typeof t,n=Gt.enumErrorProps&&(t===kt||t instanceof Error);for(var i in t)r&&"prototype"==i||n&&("message"==i||"name"==i)||e.push(i);if(Gt.nonEnumShadows&&t!==Ft){var o=t.constructor,a=-1,s=Mt;if(t===(o&&o.prototype))var c=t===Bt?Lt:t===kt?Pt:Nt.call(t),u=zt[c];for(;++a-1:void 0});return r.pop(),n.pop(),f}function y(t,e){for(var r=new Array(t),n=0;t>n;n++)r[n]=e();return r}function b(){try{return Ht.apply(this,arguments)}catch(t){return Zt.e=t,Zt}}function _(t){if(!st(t))throw new TypeError("fn must be a function");return Ht=t,b}function x(t){throw t}function w(t,e){this.id=t,this.value=e}function S(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function M(t,e){e.isDisposed||(e.isDisposed=!0,e.disposable.dispose())}function E(t){this._s=s}function T(t){this._s=s,this._l=s.length,this._i=0}function C(t){this._a=t}function O(t){this._a=t,this._l=R(t),this._i=0}function P(t){return"number"==typeof t&&X.isFinite(t)}function A(t){var e=t[yt];if(!e&&"string"==typeof t)return new E(t)[yt]();if(!e&&t.length!==i)return new C(t)[yt]();if(!e)throw new TypeError("Object is not iterable");return t[yt]()}function j(t){var e=+t;return 0===e?e:isNaN(e)?e:0>e?-1:1}function R(t){var e=+t.length;return isNaN(e)?0:0!==e&&P(e)?0>=(e=j(e)*Math.floor(Math.abs(e)))?0:e>Ye?Ye:e:e}function L(t,e){this.observer=t,this.parent=e}function N(t,e){return fe(t)||(t=ge),new Ze(e,t)}function I(t,e){this.observer=t,this.parent=e}function D(t,e){this.observer=t,this.parent=e}function k(t,e){return new Tr(function(r){var n=new se,i=new ce;return i.setDisposable(n),n.setDisposable(t.subscribe(function(t){r.onNext(t)},function(t){try{var n=e(t)}catch(t){return r.onError(t)}at(n)&&(n=$e(n));var o=new se;i.setDisposable(o),o.setDisposable(n.subscribe(r))},function(t){r.onCompleted(t)})),i},t)}function F(){return!1}function B(t,e){var r=this;return new Tr(function(n){var i=0,o=t.length;return r.subscribe(function(r){if(o>i){var a=t[i++],s=_(e)(r,a);if(s===Zt)return n.onError(s.e);n.onNext(s)}else n.onCompleted()},function(t){n.onError(t)},function(){n.onCompleted()})},r)}function F(){return!1}function U(){return[]}function F(){return!1}function z(){return[]}function G(t,e){this.observer=t,this.accumulator=e.accumulator,this.hasSeed=e.hasSeed,this.seed=e.seed,this.hasAccumulation=!1,this.accumulation=null,this.hasValue=!1,this.isStopped=!1}function $(t,e,r){var n=wt(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return at(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i}).concatAll()}function V(t,e,r){for(var n=0,i=t.length;i>n;n++)if(r(t[n],e))return n;return-1}function H(t){this.comparer=t,this.set=[]}function q(t,e,r){var n=wt(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return at(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i}).mergeAll()}var W={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},X=W[typeof window]&&window||this,Y=W[typeof r]&&r&&!r.nodeType&&r,K=W[typeof e]&&e&&!e.nodeType&&e,Z=K&&K.exports===Y&&Y,J=W[typeof n]&&n;!J||J.global!==J&&J.window!==J||(X=J);var Q={internals:{},config:{Promise:X.Promise},helpers:{}},tt=Q.helpers.noop=function(){},et=(Q.helpers.notDefined=function(t){return void 0===t},Q.helpers.identity=function(t){return t}),rt=(Q.helpers.pluck=function(t){return function(e){return e[t]}},Q.helpers.just=function(t){return function(){return t}},Q.helpers.defaultNow=Date.now),nt=Q.helpers.defaultComparer=function(t,e){return qt(t,e)},it=Q.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},ot=(Q.helpers.defaultKeySerializer=function(t){return t.toString()},Q.helpers.defaultError=function(t){throw t}),at=Q.helpers.isPromise=function(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then},st=(Q.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},Q.helpers.not=function(t){return!t},Q.helpers.isFunction=function(){var t=function(t){return"function"==typeof t||!1};return t(/x/)&&(t=function(t){return"function"==typeof t&&"[object Function]"==Nt.call(t)}),t}());Q.config.longStackSupport=!1;var ct=!1;try{throw new Error}catch(t){ct=!!t.stack}var ut,ht=l(),lt="From previous event:";(Q.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)}).prototype=Error.prototype;var pt=Q.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};pt.prototype=Error.prototype;var ft=Q.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};ft.prototype=Error.prototype;var dt=Q.NotSupportedError=function(t){this.message=t||"This operation is not supported",Error.call(this)};dt.prototype=Error.prototype;var mt=Q.NotImplementedError=function(t){this.message=t||"This operation is not implemented",Error.call(this)};mt.prototype=Error.prototype;var vt=Q.helpers.notImplemented=function(){throw new mt},gt=Q.helpers.notSupported=function(){throw new dt},yt="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";X.Set&&"function"==typeof(new X.Set)["@@iterator"]&&(yt="@@iterator");var bt=Q.doneEnumerator={done:!0,value:i},_t=Q.helpers.isIterable=function(t){return t[yt]!==i},xt=Q.helpers.isArrayLike=function(t){return t&&t.length!==i};Q.helpers.iterator=yt;var wt=Q.internals.bindCallback=function(t,e,r){if(void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)}}return function(){return t.apply(e,arguments)}},St=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Mt=St.length,Et="[object Arguments]",Tt="[object Array]",Ct="[object Boolean]",Ot="[object Date]",Pt="[object Error]",At="[object Number]",jt="[object Object]",Rt="[object RegExp]",Lt="[object String]",Nt=Object.prototype.toString,It=Object.prototype.hasOwnProperty,Dt=Nt.call(arguments)==Et,kt=Error.prototype,Ft=Object.prototype,Bt=String.prototype,Ut=Ft.propertyIsEnumerable;try{!(Nt.call(document)==jt&&!({toString:0}+""))}catch(t){!0}var zt={};zt[Tt]=zt[Ot]=zt[At]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},zt[Ct]=zt[Lt]={constructor:!0,toString:!0,valueOf:!0},zt[Pt]=zt["[object Function]"]=zt[Rt]={constructor:!0,toString:!0},zt[jt]={constructor:!0};var Gt={};!function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var r in new t)e.push(r);for(r in arguments);Gt.enumErrorProps=Ut.call(kt,"message")||Ut.call(kt,"name"),Gt.enumPrototypes=Ut.call(t,"prototype"),Gt.nonEnumArgs=0!=r,Gt.nonEnumShadows=!/valueOf/.test(e)}(1);var $t=Q.internals.isObject=function(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1},Vt=function(t){return!(!t||"object"!=typeof t)&&Nt.call(t)==Et};Dt||(Vt=function(t){return!(!t||"object"!=typeof t)&&It.call(t,"callee")});var Ht,qt=Q.internals.isEqual=function(t,e){return g(t,e,[],[])},Wt=Array.prototype.slice,Xt=this.inherits=Q.internals.inherits=function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r},Yt=Q.internals.addProperties=function(t){for(var e=[],r=1,n=arguments.length;n>r;r++)e.push(arguments[r]);for(var i=0,o=e.length;o>i;i++){var a=e[i];for(var s in a)t[s]=a[s]}},Kt=Q.internals.addRef=function(t,e){return new Tr(function(r){return new te(e.getDisposable(),t.subscribe(r))})},Zt={e:{}};w.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var Jt=Q.internals.PriorityQueue=function(t){this.items=new Array(t),this.length=0},Qt=Jt.prototype;Qt.isHigherPriority=function(t,e){return this.items[t].compareTo(this.items[e])<0},Qt.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var r=this.items[t];this.items[t]=this.items[e],this.items[e]=r,this.percolate(e)}}},Qt.heapify=function(t){if(+t||(t=0),!(t>=this.length||0>t)){var e=2*t+1,r=2*t+2,n=t;if(et;t++)r[t]=arguments[t];for(t=0;e>t;t++)if(!oe(r[t]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},ee=te.prototype;ee.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ee.remove=function(t){var e=!1;if(!this.isDisposed){var r=this.disposables.indexOf(t);-1!==r&&(e=!0,this.disposables.splice(r,1),this.length--,t.dispose())}return e},ee.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var t=this.disposables.length,e=new Array(t),r=0;t>r;r++)e[r]=this.disposables[r];for(this.disposables=[],this.length=0,r=0;t>r;r++)e[r].dispose()}};var re=Q.Disposable=function(t){this.isDisposed=!1,this.action=t||tt};re.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ne=re.create=function(t){return new re(t)},ie=re.empty={dispose:tt},oe=re.isDisposable=function(t){return t&&st(t.dispose)},ae=re.checkDisposed=function(t){if(t.isDisposed)throw new pt},se=Q.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};se.prototype.getDisposable=function(){return this.current},se.prototype.setDisposable=function(t){if(this.current)throw new Error("Disposable has already been assigned");var e=this.isDisposed;!e&&(this.current=t),e&&t&&t.dispose()},se.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var ce=Q.SerialDisposable=function(){this.isDisposed=!1,this.current=null};ce.prototype.getDisposable=function(){return this.current},ce.prototype.setDisposable=function(t){var e=this.isDisposed;if(!e){var r=this.current;this.current=t}r&&r.dispose(),e&&t&&t.dispose()},ce.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var ue=Q.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,0===--this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ie:new t(this)},e}();S.prototype.dispose=function(){this.scheduler.scheduleWithState(this,M)};var he=Q.internals.ScheduledItem=function(t,e,r,n,i){this.scheduler=t,this.state=e,this.action=r,this.dueTime=n,this.comparer=i||it,this.disposable=new se};he.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},he.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},he.prototype.isCancelled=function(){return this.disposable.isDisposed},he.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var le=Q.Scheduler=function(){function t(t,e,r,n){this.now=t,this._schedule=e,this._scheduleRelative=r,this._scheduleAbsolute=n}function e(t,e){return e(),ie}t.isScheduler=function(e){return e instanceof t};var r=t.prototype;return r.schedule=function(t){return this._schedule(t,e)},r.scheduleWithState=function(t,e){return this._schedule(t,e)},r.scheduleWithRelative=function(t,r){return this._scheduleRelative(r,t,e)},r.scheduleWithRelativeAndState=function(t,e,r){return this._scheduleRelative(t,e,r)},r.scheduleWithAbsolute=function(t,r){return this._scheduleAbsolute(r,t,e)},r.scheduleWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute(t,e,r)},t.now=rt,t.normalize=function(t){return 0>t&&(t=0),t},t}(),pe=le.normalize,fe=le.isScheduler;!function(t){function e(t,e){function r(e){i(e,function(e){var n=!1,i=!1,a=t.scheduleWithState(e,function(t,e){return n?o.remove(a):i=!0,r(e),ie});i||(o.add(a),n=!0)})}var n=e[0],i=e[1],o=new te;return r(n),o}function r(t,e,r){function n(e){o(e,function(e,i){var o=!1,s=!1,c=t[r](e,i,function(t,e){return o?a.remove(c):s=!0,n(e),ie});s||(a.add(c),o=!0)})}var i=e[0],o=e[1],a=new te;return n(i),a}function n(t,e){t(function(r){e(t,r)})}t.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,n)},t.scheduleRecursiveWithState=function(t,r){return this.scheduleWithState([t,r],e)},t.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,n)},t.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative([t,n],e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},t.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,n)},t.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute([t,n],e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})}}(le.prototype),le.prototype,le.prototype.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,e)},le.prototype.schedulePeriodicWithState=function(t,e,r){if(void 0===X.setInterval)throw new dt;e=pe(e);var n=t,i=X.setInterval(function(){n=r(n)},e);return ne(function(){X.clearInterval(i)})},function(t){t.catchError=t.catch=function(t){return new xe(this,t)}}(le.prototype);var de,me,ve=(Q.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(t){throw this._cancel.dispose(),t}}function e(t,e,r,n){this._scheduler=t,this._state=e,this._period=r,this._action=n}return e.prototype.start=function(){var e=new se;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}(),le.immediate=function(){return new le(rt,function(t,e){return e(this,t)},gt,gt)}()),ge=le.currentThread=function(){function t(){for(;e.length>0;){var t=e.dequeue();!t.isCancelled()&&t.invoke()}}var e,r=new le(rt,function(r,n){var i=new he(this,r,n,this.now());if(e)e.enqueue(i);else{(e=new Jt(4)).enqueue(i);var o=_(t)();if(e=null,o===Zt)return x(o.e)}return i.disposable},gt,gt);return r.scheduleRequired=function(){return!e},r}(),ye=function(){var t,e=tt;if(X.setTimeout)t=X.setTimeout,e=X.clearTimeout;else{if(!X.WScript)throw new dt;t=function(t,e){X.WScript.Sleep(e),t()}}return{setTimeout:t,clearTimeout:e}}(),be=ye.setTimeout,_e=ye.clearTimeout;!function(){function e(t){if(o)be(function(){e(t)},0);else{var r=i[t];if(r){o=!0;var n=_(r)();if(me(t),o=!1,n===Zt)return x(n.e)}}}function r(t){"string"==typeof t.data&&t.data.substring(0,c.length)===c&&e(t.data.substring(c.length))}var n=1,i={},o=!1;me=function(t){delete i[t]};var a=RegExp("^"+String(Nt).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),s="function"==typeof(s=J&&Z&&J.setImmediate)&&!a.test(s)&&s;if(st(s))de=function(t){var r=n++;return i[r]=t,s(function(){e(r)}),r};else if(void 0!==t&&"[object process]"==={}.toString.call(t))de=function(r){var o=n++;return i[o]=r,t.nextTick(function(){e(o)}),o};else if(function(){if(!X.postMessage||X.importScripts)return!1;var t=!1,e=X.onmessage;return X.onmessage=function(){t=!0},X.postMessage("","*"),X.onmessage=e,t}()){var c="ms.rx.schedule"+Math.random();X.addEventListener?X.addEventListener("message",r,!1):X.attachEvent?X.attachEvent("onmessage",r):X.onmessage=r,de=function(t){var e=n++;return i[e]=t,X.postMessage(c+currentId,"*"),e}}else if(X.MessageChannel){var u=new X.MessageChannel;u.port1.onmessage=function(t){e(t.data)},de=function(t){var e=n++;return i[e]=t,u.port2.postMessage(e),e}}else de="document"in X&&"onreadystatechange"in X.document.createElement("script")?function(t){var r=X.document.createElement("script"),o=n++;return i[o]=t,r.onreadystatechange=function(){e(o),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},X.document.documentElement.appendChild(r),o}:function(t){var r=n++;return i[r]=t,be(function(){e(r)},0),r}}();var xe=(le.timeout=le.default=function(){return new le(rt,function(t,e){var r=this,n=new se,i=de(function(){!n.isDisposed&&n.setDisposable(e(r,t))});return new te(n,ne(function(){me(i)}))},function(t,e,r){var n=this,i=le.normalize(e),o=new se;if(0===i)return n.scheduleWithState(t,r);var a=be(function(){!o.isDisposed&&o.setDisposable(r(n,t))},i);return new te(o,ne(function(){_e(a)}))},function(t,e,r){return this.scheduleWithRelativeAndState(t,e-this.now(),r)})}(),function(t){function e(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,r){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(r))}function n(t,e,r){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(r))}function i(i,o){this._scheduler=i,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,this._scheduler.now.bind(this._scheduler),e,r,n)}return Xt(i,t),i.prototype._clone=function(t){return new i(t,this._handler)},i.prototype._wrap=function(t){var e=this;return function(r,n){try{return t(e._getRecursiveWrapper(r),n)}catch(t){if(!e._handler(t))throw t;return ie}}},i.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},i.prototype.schedulePeriodicWithState=function(t,e,r){var n=this,i=!1,o=new se;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return r(t)}catch(t){if(i=!0,!n._handler(t))throw t;return o.dispose(),null}})),o},i}(le)),we=Q.Notification=function(){function t(t,e,r,n,i,o){this.kind=t,this.value=e,this.exception=r,this._accept=n,this._acceptObservable=i,this.toString=o}return t.prototype.accept=function(t,e,r){return t&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,r)},t.prototype.toObservable=function(t){var e=this;return fe(t)||(t=ve),new Tr(function(r){return t.scheduleWithState(e,function(t,e){e._acceptObservable(r),"N"===e.kind&&r.onCompleted()})})},t}(),Se=we.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function r(){return"OnNext("+this.value+")"}return function(n){return new we("N",n,null,t,e,r)}}(),Me=we.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function r(){return"OnError("+this.exception+")"}return function(n){return new we("E",null,n,t,e,r)}}(),Ee=we.createOnCompleted=function(){function t(t,e,r){return r()}function e(t){return t.onCompleted()}function r(){return"OnCompleted()"}return function(){return new we("C",null,null,t,e,r)}}(),Te=Q.Observer=function(){};Te.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Te.prototype.asObserver=function(){return new Ae(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Te.prototype.checked=function(){return new je(this)};var Ce=Te.create=function(t,e,r){return t||(t=tt),e||(e=ot),r||(r=tt),new Ae(t,e,r)};Te.fromNotifier=function(t,e){return new Ae(function(r){return t.call(e,Se(r))},function(r){return t.call(e,Me(r))},function(){return t.call(e,Ee())})},Te.prototype.notifyOn=function(t){return new Re(t,this)},Te.prototype.makeSafe=function(t){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,t)};var Oe,Pe=Q.internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return Xt(e,t),e.prototype.next=vt,e.prototype.error=vt,e.prototype.completed=vt,e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.error(t),!0)},e}(Te),Ae=Q.AnonymousObserver=function(t){function e(e,r,n){t.call(this),this._onNext=e,this._onError=r,this._onCompleted=n}return Xt(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Pe),je=function(t){function e(e){t.call(this),this._observer=e,this._state=0}Xt(e,t);var r=e.prototype;return r.onNext=function(t){this.checkAccess();var e=_(this._observer.onNext).call(this._observer,t);this._state=0,e===Zt&&x(e.e)},r.onError=function(t){this.checkAccess();var e=_(this._observer.onError).call(this._observer,t);this._state=2,e===Zt&&x(e.e)},r.onCompleted=function(){this.checkAccess();var t=_(this._observer.onCompleted).call(this._observer);this._state=2,t===Zt&&x(t.e)},r.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},e}(Te),Re=function(t){function e(e,r,n){t.call(this,e,r),this._cancel=n}return Xt(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},e}(Q.internals.ScheduledObserver=function(t){function e(e,r){t.call(this),this.scheduler=e,this.observer=r,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ce}return Xt(e,t),e.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},e.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},e.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},e.prototype.ensureActive=function(){var t=!1,e=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(e.queue.length>0){r=e.queue.shift();try{r()}catch(t){throw e.queue=[],e.hasFaulted=!0,t}t()}else e.isAcquired=!1}))},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},e}(Pe)),Le=Q.Observable=function(){function t(t){if(Q.config.longStackSupport&&ct){try{throw new Error}catch(t){this.stack=t.stack.substring(t.stack.indexOf("\n")+1)}var e=this;this._subscribe=function(r){var n=r.onError.bind(r);return r.onError=function(t){a(t,e),n(t)},t.call(e,r)}}else this._subscribe=t}return Oe=t.prototype,Oe.subscribe=Oe.forEach=function(t,e,r){return this._subscribe("object"==typeof t?t:Ce(t,e,r))},Oe.subscribeOnNext=function(t,e){return this._subscribe(Ce(void 0!==e?function(r){t.call(e,r)}:t))},Oe.subscribeOnError=function(t,e){return this._subscribe(Ce(null,void 0!==e?function(r){t.call(e,r)}:t))},Oe.subscribeOnCompleted=function(t,e){return this._subscribe(Ce(null,null,void 0!==e?function(){t.call(e)}:t))},t}(),Ne=Q.ObservableBase=function(t){function e(t){return t&&st(t.dispose)?t:st(t)?ne(t):ie}function r(t,r){var n=r[0],i=r[1],o=_(i.subscribeCore).call(i,n);return o!==Zt||n.fail(Zt.e)?void n.setDisposable(e(o)):x(Zt.e)}function n(t){var e=new Cr(t),n=[e,this];return ge.scheduleRequired()?ge.scheduleWithState(n,r):r(null,n),e}function i(){t.call(this,n)}return Xt(i,t),i.prototype.subscribeCore=vt,i}(Le),Ie=Q.internals.Enumerable=function(){},De=function(t){function e(e){this.sources=e,t.call(this)}function r(t,e,r){this.o=t,this.s=e,this.e=r,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){var e,n=new ce,i=ve.scheduleRecursiveWithState(this.sources[yt](),function(i,o){if(!e){var a=_(i.next).call(i);if(a===Zt)return t.onError(a.e);if(a.done)return t.onCompleted();var s=a.value;at(s)&&(s=$e(s));var c=new se;n.setDisposable(c),c.setDisposable(s.subscribe(new r(t,o,i)))}});return new te(n,i,ne(function(){e=!0}))},r.prototype.onNext=function(t){this.isStopped||this.o.onNext(t)},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Ie.prototype.concat=function(){return new De(this)};var ke=function(t){function e(e){this.sources=e,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){var e,r=this.sources[yt](),n=new ce,i=ve.scheduleRecursiveWithState(null,function(i,o){if(!e){var a=_(r.next).call(r);if(a===Zt)return t.onError(a.e);if(a.done)return null!==i?t.onError(i):t.onCompleted();var s=a.value;at(s)&&(s=$e(s));var c=new se;n.setDisposable(c),c.setDisposable(s.subscribe(function(e){t.onNext(e)},o,function(){t.onCompleted()}))}});return new te(n,i,ne(function(){e=!0}))},e}(Ne);Ie.prototype.catchError=function(){return new ke(this)},Ie.prototype.catchErrorWhen=function(t){var e=this;return new Tr(function(r){var n,i=new Pr,o=new Pr,a=t(i).subscribe(o),s=e[yt](),c=new ce,u=ve.scheduleRecursive(function(t){if(!n){var e=_(s.next).call(s);if(e===Zt)return r.onError(e.e);if(e.done)return void r.onCompleted();var a=e.value;at(a)&&(a=$e(a));var u=new se,h=new se;c.setDisposable(new te(h,u)),u.setDisposable(a.subscribe(function(t){r.onNext(t)},function(e){h.setDisposable(o.subscribe(t,function(t){r.onError(t)},function(){r.onCompleted()})),i.onNext(e)},function(){r.onCompleted()}))}});return new te(a,c,u,ne(function(){n=!0}))})};var Fe=function(t){function e(t,e){this.v=t,this.c=null==e?-1:e}function r(t){this.v=t.v,this.l=t.c}return Xt(e,Ie),e.prototype[yt]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?bt:(this.l>0&&this.l--,{done:!1,value:this.v})},e}(),Be=Ie.repeat=function(t,e){return new Fe(t,e)},Ue=function(t){function e(t,e,r){this.s=t,this.fn=e?wt(e,r,3):null}function r(t){this.i=-1,this.s=t.s,this.l=this.s.length,this.fn=t.fn}return Xt(e,Ie),e.prototype[yt]=function(){return new r(this)},r.prototype.next=function(){return++this.in?(t.onNext(e[n]),i(n+1)):t.onCompleted()})};var Je=Le.fromArray=function(t,e){return fe(e)||(e=ge),new Ze(t,e)};Le.generate=function(t,e,r,n,i){return fe(i)||(i=ge),new Tr(function(o){var a=!0;return i.scheduleRecursiveWithState(t,function(t,i){var s,c;try{a?a=!1:t=r(t),(s=e(t))&&(c=n(t))}catch(t){return o.onError(t)}s?(o.onNext(c),i(t)):o.onCompleted()})})};var Qe=function(t){function e(){t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return ie},e}(Ne),tr=Le.never=function(){return new Qe};Le.of=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return new Ze(e,ge)},Le.ofWithScheduler=function(t){for(var e=arguments.length,r=new Array(e-1),n=1;e>n;n++)r[n-1]=arguments[n];return new Ze(r,t)};var er=function(t){function e(e,r){this.obj=e,this.keys=Object.keys(e),this.scheduler=r,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new I(t,this).run()},e}(Ne);I.prototype.run=function(){var t=this.observer,e=this.parent.obj,r=this.parent.keys,n=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(i,o){if(n>i){var a=r[i];t.onNext([a,e[a]]),o(i+1)}else t.onCompleted()})},Le.pairs=function(t,e){return e||(e=ge),new er(t,e)};var rr=function(t){function e(e,r,n){this.start=e,this.rangeCount=r,this.scheduler=n,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new nr(t,this).run()},e}(Ne),nr=function(){function t(t,e){this.observer=t,this.parent=e}return t.prototype.run=function(){var t=this.parent.start,e=this.parent.rangeCount,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})},t}();Le.range=function(t,e,r){return fe(r)||(r=ge),new rr(t,e,r)};var ir=function(t){function e(e,r,n){this.value=e,this.repeatCount=null==r?-1:r,this.scheduler=n,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new D(t,this).run()},e}(Ne);D.prototype.run=function(){var t=this.observer,e=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,function(r,n){return(-1===r||r>0)&&(t.onNext(e),r>0&&r--),0===r?t.onCompleted():void n(r)})},Le.repeat=function(t,e,r){return fe(r)||(r=ge),new ir(t,e,r)};var or=function(t){function e(e,r){this.value=e,this.scheduler=r,t.call(this)}function r(t,e){this.observer=t,this.parent=e}function n(t,e){var r=e[0],n=e[1];n.onNext(r),n.onCompleted()}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(t,this).run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],n)},e}(Ne),ar=(Le.return=Le.just=Le.returnValue=function(t,e){return fe(e)||(e=ve),new or(t,e)},function(t){function e(e,r){this.error=e,this.scheduler=r,t.call(this)}function r(t,e){this.o=t,this.p=e}function n(t,e){var r=e[0];e[1].onError(r)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(t,this).run()},r.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],n)},e}(Ne)),sr=Le.throw=Le.throwError=Le.throwException=function(t,e){return fe(e)||(e=ve),new ar(t,e)};Le.using=function(t,e){return new Tr(function(r){var n,i,o=ie;try{(n=t())&&(o=n),i=e(n)}catch(t){return new te(sr(t).subscribe(r),o)}return new te(i.subscribe(r),o)})},Oe.amb=function(t){var e=this;return new Tr(function(r){function n(){o||(o=a,u.dispose())}function i(){o||(o=s,c.dispose())}var o,a="L",s="R",c=new se,u=new se;return at(t)&&(t=$e(t)),c.setDisposable(e.subscribe(function(t){n(),o===a&&r.onNext(t)},function(t){n(),o===a&&r.onError(t)},function(){n(),o===a&&r.onCompleted()})),u.setDisposable(t.subscribe(function(t){i(),o===s&&r.onNext(t)},function(t){i(),o===s&&r.onError(t)},function(){i(),o===s&&r.onCompleted()})),new te(c,u)})},Le.amb=function(){var t=tr(),e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var r=0,n=arguments.length;n>r;r++)e.push(arguments[r]);for(var r=0,n=e.length;n>r;r++)t=function(t,e){return t.amb(e)}(t,e[r]);return t},Oe.catch=Oe.catchError=Oe.catchException=function(t){return"function"==typeof t?k(this,t):cr([this,t])};var cr=Le.catchError=Le.catch=Le.catchException=function(){var t=[];if(Array.isArray(arguments[0]))t=arguments[0];else for(var e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return ze(t).catchError()};Oe.combineLatest=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return Array.isArray(e[0])?e[0].unshift(this):e.unshift(this),ur.apply(this,e)};var ur=Le.combineLatest=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new Tr(function(t){function r(e){if(s[e]=!0,c||(c=s.every(et))){try{var r=n.apply(null,h)}catch(e){return t.onError(e)}t.onNext(r)}else u.filter(function(t,r){return r!==e}).every(et)&&t.onCompleted()}function i(e){u[e]=!0,u.every(et)&&t.onCompleted()}for(var o=e.length,a=function(){return!1},s=y(o,a),c=!1,u=y(o,a),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(n){var o=e[n],a=new se;at(o)&&(o=$e(o)),a.setDisposable(o.subscribe(function(t){h[n]=t,r(n)},function(e){t.onError(e)},function(){i(n)})),l[n]=a}(p);return new te(l)},this)};Oe.concat=function(){for(var t=[],e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return t.unshift(this),lr.apply(null,t)};var hr=function(t){function e(e){this.sources=e,t.call(this)}function r(t,e){this.sources=t,this.o=e}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(this.sources,t).run()},r.prototype.run=function(){var t,e=new ce,r=this.sources,n=r.length,i=this.o,o=ve.scheduleRecursiveWithState(0,function(o,a){if(!t){if(o===n)return i.onCompleted();var s=r[o];at(s)&&(s=$e(s));var c=new se;e.setDisposable(c),c.setDisposable(s.subscribe(function(t){i.onNext(t)},function(t){i.onError(t)},function(){a(o+1)}))}});return new te(e,o,ne(function(){t=!0}))},e}(Ne),lr=Le.concat=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{t=new Array(arguments.length);for(var e=0,r=arguments.length;r>e;e++)t[e]=arguments[e]}return new hr(t)};Oe.concatAll=Oe.concatObservable=function(){return this.merge(1)};var pr=function(t){function e(e,r){this.source=e,this.maxConcurrent=r,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){var e=new te;return e.add(this.source.subscribe(new fr(t,this.maxConcurrent,e))),e},e}(Ne),fr=function(){function t(t,e,r){this.o=t,this.max=e,this.g=r,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function e(t,e){this.parent=t,this.sad=e,this.isStopped=!1}return t.prototype.handleSubscribe=function(t){var r=new se;this.g.add(r),at(t)&&(t=$e(t)),r.setDisposable(t.subscribe(new e(this,r)))},t.prototype.onNext=function(t){this.isStopped||(this.activeCount0?t.handleSubscribe(t.q.shift()):(t.activeCount--,t.done&&0===t.activeCount&&t.o.onCompleted())}},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(t),!0)},t}();Oe.merge=function(t){return"number"!=typeof t?dr(this,t):new pr(this,t)};var dr=Le.merge=function(){var t,e,r=[],n=arguments.length;if(arguments[0])if(fe(arguments[0]))for(t=arguments[0],e=1;n>e;e++)r.push(arguments[e]);else for(t=ve,e=0;n>e;e++)r.push(arguments[e]);else for(t=ve,e=1;n>e;e++)r.push(arguments[e]);return Array.isArray(r[0])&&(r=r[0]),N(t,r).mergeAll()},mr=Q.CompositeError=function(t){this.name="NotImplementedError",this.innerErrors=t,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};mr.prototype=Error.prototype,Le.mergeDelayError=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{var e=arguments.length;t=new Array(e);for(var r=0;e>r;r++)t[r]=arguments[r]}var n=N(null,t);return new Tr(function(t){function e(){0===a.length?t.onCompleted():1===a.length?t.onError(a[0]):t.onError(new mr(a))}var r=new te,i=new se,o=!1,a=[];return r.add(i),i.setDisposable(n.subscribe(function(n){var i=new se;r.add(i),at(n)&&(n=$e(n)),i.setDisposable(n.subscribe(function(e){t.onNext(e)},function(t){a.push(t),r.remove(i),o&&1===r.length&&e()},function(){r.remove(i),o&&1===r.length&&e()}))},function(t){a.push(t),o=!0,1===r.length&&e()},function(){o=!0,1===r.length&&e()})),r})};var vr=function(t){function e(e){this.source=e,t.call(this)}function r(t,e){this.o=t,this.g=e,this.isStopped=!1,this.done=!1}function n(t,e,r){this.parent=t,this.g=e,this.sad=r,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){var e=new te,n=new se;return e.add(n),n.setDisposable(this.source.subscribe(new r(t,e))),e},r.prototype.onNext=function(t){if(!this.isStopped){var e=new se;this.g.add(e),at(t)&&(t=$e(t)),e.setDisposable(t.subscribe(new n(this,this.g,e)))}},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},n.prototype.onNext=function(t){this.isStopped||this.parent.o.onNext(t)},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.parent.o.onError(t))},n.prototype.onCompleted=function(){if(!this.isStopped){var t=this.parent;this.isStopped=!0,t.g.remove(this.sad),t.done&&1===t.g.length&&t.o.onCompleted()}},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(t),!0)},e}(Ne);Oe.mergeAll=Oe.mergeObservable=function(){return new vr(this)},Oe.onErrorResumeNext=function(t){if(!t)throw new Error("Second observable is required");return gr([this,t])};var gr=Le.onErrorResumeNext=function(){var t=[];if(Array.isArray(arguments[0]))t=arguments[0];else for(var e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return new Tr(function(e){var r=0,n=new ce,i=ve.scheduleRecursive(function(i){var o,a;rr;r++)e[r]=arguments[r];var n=e.pop(),i=this;return Array.isArray(e[0])&&(e=e[0]),new Tr(function(t){for(var r=e.length,o=y(r,F),a=!1,s=new Array(r),c=new Array(r+1),u=0;r>u;u++)!function(r){var n=e[r],i=new se;at(n)&&(n=$e(n)),i.setDisposable(n.subscribe(function(t){s[r]=t,o[r]=!0,a=o.every(et)},function(e){t.onError(e)},tt)),c[r]=i}(u);var h=new se;return h.setDisposable(i.subscribe(function(e){var r=[e].concat(s);if(a){var i=_(n).apply(null,r);return i===Zt?t.onError(i.e):void t.onNext(i)}},function(e){t.onError(e)},function(){t.onCompleted()})),c[r]=h,new te(c)},this)},Oe.zip=function(){if(Array.isArray(arguments[0]))return B.apply(this,arguments);for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=this,i=e.pop();return e.unshift(n),new Tr(function(t){for(var r=e.length,o=y(r,U),a=y(r,F),s=new Array(r),c=0;r>c;c++)!function(r){var c=e[r],u=new se;at(c)&&(c=$e(c)),u.setDisposable(c.subscribe(function(e){if(o[r].push(e),o.every(function(t){return t.length>0})){var s=o.map(function(t){return t.shift()}),c=_(i).apply(n,s);if(c===Zt)return t.onError(c.e);t.onNext(c)}else a.filter(function(t,e){return e!==r}).every(et)&&t.onCompleted()},function(e){t.onError(e)},function(){a[r]=!0,a.every(et)&&t.onCompleted()})),s[r]=u}(c);return new te(s)},n)},Le.zip=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.shift();return n.zip.apply(n,e)},Le.zipArray=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{var e=arguments.length;t=new Array(e);for(var r=0;e>r;r++)t[r]=arguments[r]}return new Tr(function(e){for(var r=t.length,n=y(r,z),i=y(r,F),o=new Array(r),a=0;r>a;a++)!function(r){o[r]=new se,o[r].setDisposable(t[r].subscribe(function(t){if(n[r].push(t),n.every(function(t){return t.length>0})){var o=n.map(function(t){return t.shift()});e.onNext(o)}else if(i.filter(function(t,e){return e!==r}).every(et))return e.onCompleted()},function(t){e.onError(t)},function(){i[r]=!0,i.every(et)&&e.onCompleted()}))}(a);return new te(o)})},Oe.asObservable=function(){var t=this;return new Tr(function(e){return t.subscribe(e)},t)},Oe.bufferWithCount=function(t,e){return"number"!=typeof e&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Oe.dematerialize=function(){var t=this;return new Tr(function(e){return t.subscribe(function(t){return t.accept(e)},function(t){e.onError(t)},function(){e.onCompleted()})},this)},Oe.distinctUntilChanged=function(t,e){var r=this;return e||(e=nt),new Tr(function(n){var i,o=!1;return r.subscribe(function(r){var a=r;if(t&&(a=_(t)(r))===Zt)return n.onError(a.e);if(o){var s=_(e)(i,a);if(s===Zt)return n.onError(s.e)}o&&s||(o=!0,i=a,n.onNext(r))},function(t){n.onError(t)},function(){n.onCompleted()})},this)};var _r=function(t){function e(e,r,n,i){this.source=e,this.t=!r||st(r)?Ce(r||tt,n||tt,i||tt):r,t.call(this)}function r(t,e){this.o=t,this.t=e,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this.t))},r.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.t.onNext).call(this.t,t);e===Zt&&this.o.onError(e.e),this.o.onNext(t)}},r.prototype.onError=function(t){if(!this.isStopped){this.isStopped=!0;var e=_(this.t.onError).call(this.t,t);if(e===Zt)return this.o.onError(e.e);this.o.onError(t)}},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var t=_(this.t.onCompleted).call(this.t);if(t===Zt)return this.o.onError(t.e);this.o.onCompleted()}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.do=Oe.tap=Oe.doAction=function(t,e,r){return new _r(this,t,e,r)},Oe.doOnNext=Oe.tapOnNext=function(t,e){return this.tap(void 0!==e?function(r){t.call(e,r)}:t)},Oe.doOnError=Oe.tapOnError=function(t,e){return this.tap(tt,void 0!==e?function(r){t.call(e,r)}:t)},Oe.doOnCompleted=Oe.tapOnCompleted=function(t,e){return this.tap(tt,null,void 0!==e?function(){t.call(e)}:t)},Oe.finally=Oe.ensure=function(t){var e=this;return new Tr(function(r){var n;try{n=e.subscribe(r)}catch(e){throw t(),e}return ne(function(){try{n.dispose()}catch(t){throw t}finally{t()}})},this)},Oe.finallyAction=function(t){return this.ensure(t)};var xr=function(t){function e(e){this.source=e,t.call(this)}function r(t){this.o=t,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t))},r.prototype.onNext=tt,r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(t),!0)},e}(Ne);Oe.ignoreElements=function(){return new xr(this)},Oe.materialize=function(){var t=this;return new Tr(function(e){return t.subscribe(function(t){e.onNext(Se(t))},function(t){e.onNext(Me(t)),e.onCompleted()},function(){e.onNext(Ee()),e.onCompleted()})},t)},Oe.repeat=function(t){return Be(this,t).concat()},Oe.retry=function(t){return Be(this,t).catchError()},Oe.retryWhen=function(t){return Be(this).catchErrorWhen(t)};var wr=function(t){function e(e,r,n,i){this.source=e,this.accumulator=r,this.hasSeed=n,this.seed=i,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new G(t,this))},e}(Ne);G.prototype.onNext=function(t){if(!this.isStopped){!this.hasValue&&(this.hasValue=!0);try{this.hasAccumulation?this.accumulation=this.accumulator(this.accumulation,t):(this.accumulation=this.hasSeed?this.accumulator(this.seed,t):t,this.hasAccumulation=!0)}catch(t){return this.observer.onError(t)}this.observer.onNext(this.accumulation)}},G.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.observer.onError(t))},G.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},G.prototype.dispose=function(){this.isStopped=!0},G.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(t),!0)},Oe.scan=function(){var t,e,r=!1;return 2===arguments.length?(r=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new wr(this,e,r,t)},Oe.skipLast=function(t){if(0>t)throw new ft;var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&r.onNext(n.shift())},function(t){r.onError(t)},function(){r.onCompleted()})},e)},Oe.startWith=function(){var t,e=0;arguments.length&&fe(arguments[0])?(t=arguments[0],e=1):t=ve;for(var r=[],n=e,i=arguments.length;i>n;n++)r.push(arguments[n]);return ze([Je(r,t),this]).concat()},Oe.takeLast=function(t){if(0>t)throw new ft;var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&n.shift()},function(t){r.onError(t)},function(){for(;n.length>0;)r.onNext(n.shift());r.onCompleted()})},e)},Oe.takeLastBuffer=function(t){var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&n.shift()},function(t){r.onError(t)},function(){r.onNext(n),r.onCompleted()})},e)},Oe.windowWithCount=function(t,e){var r=this;if(+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new ft;if(null==e&&(e=t),+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new ft;return new Tr(function(n){function i(){var t=new Pr;c.push(t),n.onNext(Kt(t,a))}var o=new se,a=new ue(o),s=0,c=[];return i(),o.setDisposable(r.subscribe(function(r){for(var n=0,o=c.length;o>n;n++)c[n].onNext(r);var a=s-t+1;a>=0&&a%e==0&&c.shift().onCompleted(),++s%e==0&&i()},function(t){for(;c.length>0;)c.shift().onError(t);n.onError(t)},function(){for(;c.length>0;)c.shift().onCompleted();n.onCompleted()})),a},r)},Oe.selectConcat=Oe.concatMap=function(t,e,r){return st(t)&&st(e)?this.concatMap(function(r,n){var i=t(r,n);return at(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i.map(function(t,i){return e(r,t,n,i)})}):st(t)?$(this,t,r):$(this,function(){return t})},Oe.concatMapObserver=Oe.selectConcatObserver=function(t,e,r,n){var i=this,o=wt(t,n,2),a=wt(e,n,1),s=wt(r,n,0);return new Tr(function(t){var e=0;return i.subscribe(function(r){var n;try{n=o(r,e++)}catch(e){return void t.onError(e)}at(n)&&(n=$e(n)),t.onNext(n)},function(e){var r;try{r=a(e)}catch(e){return void t.onError(e)}at(r)&&(r=$e(r)),t.onNext(r),t.onCompleted()},function(){var e;try{e=s()}catch(e){return void t.onError(e)}at(e)&&(e=$e(e)),t.onNext(e),t.onCompleted()})},this).concatAll()},Oe.defaultIfEmpty=function(t){var e=this;return t===i&&(t=null),new Tr(function(r){var n=!1;return e.subscribe(function(t){n=!0,r.onNext(t)},function(t){r.onError(t)},function(){!n&&r.onNext(t),r.onCompleted()})},e)},H.prototype.push=function(t){var e=-1===V(this.set,t,this.comparer);return e&&this.set.push(t),e},Oe.distinct=function(t,e){var r=this;return e||(e=nt),new Tr(function(n){var i=new H(e);return r.subscribe(function(e){var r=e;if(t)try{r=t(e)}catch(t){return void n.onError(t)}i.push(r)&&n.onNext(e)},function(t){n.onError(t)},function(){n.onCompleted()})},this)};var Sr=function(t){function e(e,r,n){this.source=e,this.selector=wt(r,n,3),t.call(this)}function r(t,e){return function(r,n,i){return t.call(this,e.selector(r,n,i),n,i)}}function n(t,e,r){this.o=t,this.selector=e,this.source=r,this.i=0,this.isStopped=!1}return Xt(e,t),e.prototype.internalMap=function(t,n){return new e(this.source,r(t,this),n)},e.prototype.subscribeCore=function(t){return this.source.subscribe(new n(t,this.selector,this))},n.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.selector)(t,this.i++,this.source);return e===Zt?this.o.onError(e.e):void this.o.onNext(e)}},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.map=Oe.select=function(t,e){var r="function"==typeof t?t:function(){return t};return this instanceof Sr?this.internalMap(r,e):new Sr(this,r,e)},Oe.pluck=function(){var t=arguments,e=arguments.length;if(0===e)throw new Error("List of properties cannot be empty.");return this.map(function(r){for(var n=r,o=0;e>o;o++){var a=n[t[o]];if(void 0===a)return i;n=a}return n})},Oe.flatMapObserver=Oe.selectManyObserver=function(t,e,r,n){var i=this;return new Tr(function(o){var a=0;return i.subscribe(function(e){var r;try{r=t.call(n,e,a++)}catch(t){return void o.onError(t)}at(r)&&(r=$e(r)),o.onNext(r)},function(t){var r;try{r=e.call(n,t)}catch(t){return void o.onError(t)}at(r)&&(r=$e(r)),o.onNext(r),o.onCompleted()},function(){var t;try{t=r.call(n)}catch(t){return void o.onError(t)}at(t)&&(t=$e(t)),o.onNext(t),o.onCompleted()})},i).mergeAll()},Oe.selectMany=Oe.flatMap=function(t,e,r){return st(t)&&st(e)?this.flatMap(function(r,n){var i=t(r,n);return at(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i.map(function(t,i){return e(r,t,n,i)})},r):st(t)?q(this,t,r):q(this,function(){return t})},Oe.selectSwitch=Oe.flatMapLatest=Oe.switchMap=function(t,e){return this.select(t,e).switchLatest()};var Mr=function(t){function e(e,r){this.source=e,this.skipCount=r,t.call(this)}function r(t,e){this.c=e,this.r=e,this.o=t,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this.skipCount))},r.prototype.onNext=function(t){this.isStopped||(this.r<=0?this.o.onNext(t):this.r--)},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.skip=function(t){if(0>t)throw new ft;return new Mr(this,t)},Oe.skipWhile=function(t,e){var r=this,n=wt(t,e,3);return new Tr(function(t){var e=0,i=!1;return r.subscribe(function(o){if(!i)try{i=!n(o,e++,r)}catch(e){return void t.onError(e)}i&&t.onNext(o)},function(e){t.onError(e)},function(){t.onCompleted()})},r)},Oe.take=function(t,e){if(0>t)throw new ft;if(0===t)return qe(e);var r=this;return new Tr(function(e){var n=t;return r.subscribe(function(t){n-- >0&&(e.onNext(t),0>=n&&e.onCompleted())},function(t){e.onError(t)},function(){e.onCompleted()})},r)},Oe.takeWhile=function(t,e){var r=this,n=wt(t,e,3);return new Tr(function(t){var e=0,i=!0;return r.subscribe(function(o){if(i){try{i=n(o,e++,r)}catch(e){return void t.onError(e)}i?t.onNext(o):t.onCompleted()}},function(e){t.onError(e)},function(){t.onCompleted()})},r)};var Er=function(t){function e(e,r,n){this.source=e,this.predicate=wt(r,n,3),t.call(this)}function r(t,e){return function(r,n,i){return e.predicate(r,n,i)&&t.call(this,r,n,i)}}function n(t,e,r){this.o=t,this.predicate=e,this.source=r,this.i=0,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new n(t,this.predicate,this))},e.prototype.internalFilter=function(t,n){return new e(this.source,r(t,this),n)},n.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.predicate)(t,this.i++,this.source);return e===Zt?this.o.onError(e.e):void(e&&this.o.onNext(t))}},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.filter=Oe.where=function(t,e){return this instanceof Er?this.internalFilter(t,e):new Er(this,t,e)},Oe.transduce=function(t){function e(t){return{"@@transducer/init":function(){return t},"@@transducer/step":function(t,e){return t.onNext(e)},"@@transducer/result":function(t){return t.onCompleted()}}}var r=this;return new Tr(function(n){var i=t(e(n));return r.subscribe(function(t){try{i["@@transducer/step"](n,t)}catch(t){n.onError(t)}},function(t){n.onError(t)},function(){i["@@transducer/result"](n)})},r)};var Tr=Q.AnonymousObservable=function(t){function e(t){return t&&st(t.dispose)?t:st(t)?ne(t):ie}function r(t,r){var n=r[0],i=_(r[1])(n);return i!==Zt||n.fail(Zt.e)?void n.setDisposable(e(i)):x(Zt.e)}function n(e,n){this.source=n,t.call(this,function(t){var n=new Cr(t),i=[n,e];return ge.scheduleRequired()?ge.scheduleWithState(i,r):r(null,i),n})}return Xt(n,t),n}(Le),Cr=function(t){function e(e){t.call(this),this.observer=e,this.m=new se}Xt(e,t);var r=e.prototype;return r.next=function(t){var e=_(this.observer.onNext).call(this.observer,t);e===Zt&&(this.dispose(),x(e.e))},r.error=function(t){var e=_(this.observer.onError).call(this.observer,t);this.dispose(),e===Zt&&x(e.e)},r.completed=function(){var t=_(this.observer.onCompleted).call(this.observer);this.dispose(),t===Zt&&x(t.e)},r.setDisposable=function(t){this.m.setDisposable(t)},r.getDisposable=function(){return this.m.getDisposable()},r.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Pe),Or=function(t,e){this.subject=t,this.observer=e};Or.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Pr=Q.Subject=function(t){function e(t){return ae(this),this.isStopped?this.hasError?(t.onError(this.error),ie):(t.onCompleted(),ie):(this.observers.push(t),new Or(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Xt(r,t),Yt(r.prototype,Te.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(ae(this),!this.isStopped){this.isStopped=!0;for(var t=0,e=o(this.observers),r=e.length;r>t;t++)e[t].onCompleted();this.observers.length=0}},onError:function(t){if(ae(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){if(ae(this),!this.isStopped)for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new Ar(t,e)},r}(Le),Ar=(Q.AsyncSubject=function(t){function e(t){return ae(this),this.isStopped?(this.hasError?t.onError(this.error):this.hasValue?(t.onNext(this.value),t.onCompleted()):t.onCompleted(),ie):(this.observers.push(t),new Or(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Xt(r,t),Yt(r.prototype,Te,{hasObservers:function(){return ae(this),this.observers.length>0},onCompleted:function(){var t;if(ae(this),!this.isStopped){this.isStopped=!0;var e=o(this.observers),r=e.length;if(this.hasValue)for(t=0;r>t;t++){var n=e[t];n.onNext(this.value),n.onCompleted()}else for(t=0;r>t;t++)e[t].onCompleted();this.observers.length=0}},onError:function(t){if(ae(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=t;for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){ae(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(Le),Q.AnonymousSubject=function(t){function e(t){return this.observable.subscribe(t)}function r(r,n){this.observer=r,this.observable=n,t.call(this,e)}return Xt(r,t),Yt(r.prototype,Te.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),r}(Le));Y&&K?Z?(K.exports=Q).Rx=Q:Y.Rx=Q:X.Rx=Q;var jr=l()}).call(this)}).call(this,t(150),void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{150:150}]},{},[1])(1)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],16:[function(t,e,r){(function(r){var n,i=void 0!==r?r:"undefined"!=typeof window?window:{},o=t("min-document");"undefined"!=typeof document?n=document:(n=i["__GLOBAL_DOCUMENT_CACHE@4"])||(n=i["__GLOBAL_DOCUMENT_CACHE@4"]=o),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":4}],17:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,c=(1<>1,h=-7,l=r?i-1:0,p=r?-1:1,f=t[e+l];for(l+=p,o=f&(1<<-h)-1,f>>=-h,h+=s;h>0;o=256*o+t[e+l],l+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+l],l+=p,h-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,c,u=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(e*c-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*m}},{}],18:[function(t,e,r){(function(t){"use strict";var r="undefined"!=typeof window?window:void 0!==t?t:{};e.exports=function(t,e){return t in r?r[t]:(r[t]=e,e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e,r){"use strict";var n=t("./index.js");e.exports=function(t,e,r){var i="__INDIVIDUAL_ONE_VERSION_"+t,o=n(i+"_ENFORCE_SINGLETON",e);if(o!==e)throw new Error("Can only have one copy of "+t+".\nYou already have version "+o+" installed.\nThis means you cannot install version "+e);return n(i,r)}},{"./index.js":18}],20:[function(t,e,r){"use strict";e.exports=function(t){return"object"==typeof t&&null!==t}},{}],21:[function(t,e,r){"use strict";var n={};n.base32="0123456789bcdefghjkmnpqrstuvwxyz",n.encode=function(t,e,r){if(void 0===r){for(var i=1;i<=12;i++){var o=n.encode(t,e,i),a=n.decode(o);if(a.lat==t&&a.lon==e)return o}r=12}if(t=Number(t),e=Number(e),r=Number(r),isNaN(t)||isNaN(e)||isNaN(r))throw new Error("Invalid geohash");for(var s=0,c=0,u=!0,h="",l=-90,p=90,f=-180,d=180;h.length=m?(s=2*s+1,f=m):(s*=2,d=m)}else{var v=(l+p)/2;t>=v?(s=2*s+1,l=v):(s*=2,p=v)}u=!u,5==++c&&(h+=n.base32.charAt(s),c=0,s=0)}return h},n.decode=function(t){var e=n.bounds(t),r=e.sw.lat,i=e.sw.lon,o=e.ne.lat,a=e.ne.lon,s=(r+o)/2,c=(i+a)/2;return s=s.toFixed(Math.floor(2-Math.log(o-r)/Math.LN10)),c=c.toFixed(Math.floor(2-Math.log(a-i)/Math.LN10)),{lat:Number(s),lon:Number(c)}},n.bounds=function(t){if(0===t.length)throw new Error("Invalid geohash");t=t.toLowerCase();for(var e=!0,r=-90,i=90,o=-180,a=180,s=0;s=0;h--){var l=u>>h&1;if(e){var p=(o+a)/2;1==l?o=p:a=p}else{var f=(r+i)/2;1==l?r=f:i=f}e=!e}}return{sw:{lat:r,lon:o},ne:{lat:i,lon:a}}},n.adjacent=function(t,e){if(t=t.toLowerCase(),e=e.toLowerCase(),0===t.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(e))throw new Error("Invalid direction");var r={n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]},i={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]},o=t.slice(-1),a=t.slice(0,-1),s=t.length%2;return-1!=i[e][s].indexOf(o)&&""!==a&&(a=n.adjacent(a,e)),a+n.base32.charAt(r[e][s].indexOf(o))},n.neighbours=function(t){return{n:n.adjacent(t,"n"),ne:n.adjacent(n.adjacent(t,"n"),"e"),e:n.adjacent(t,"e"),se:n.adjacent(n.adjacent(t,"s"),"e"),s:n.adjacent(t,"s"),sw:n.adjacent(n.adjacent(t,"s"),"w"),w:n.adjacent(t,"w"),nw:n.adjacent(n.adjacent(t,"n"),"w")}},void 0!==e&&e.exports&&(e.exports=n)},{}],22:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return(t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"))||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,c=0;c>4,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return a(t,n,e);throw new Error("Expected varint not more than 10 bytes")}function o(t){return t.type===n.Bytes?t.readVarint()+t.pos:t.pos+1}function a(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function s(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),c(r,n,e),u(n,e)}function c(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}function u(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}function h(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function l(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function w(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function S(t,e,r){for(var n="",i=e;i239?4:o>223?3:o>191?2:1;if(i+s>r)break;var c,u,h;1===s?o<128&&(a=o):2===s?128==(192&(c=t[i+1]))&&(a=(31&o)<<6|63&c)<=127&&(a=null):3===s?(c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&((a=(15&o)<<12|(63&c)<<6|63&u)<=2047||a>=55296&&a<=57343)&&(a=null)):4===s&&(c=t[i+1],u=t[i+2],h=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&((a=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)<=65535||a>=1114112)&&(a=null)),null===a?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|1023&a),n+=String.fromCharCode(a),i+=s}return n}function M(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}e.exports=n;var E=t("ieee754");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=w(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_(this.buf,this.pos)+4294967296*_(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=_(this.buf,this.pos)+4294967296*w(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=E.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=E.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return r=n[this.pos++],e=127&r,r<128?e:(r=n[this.pos++],e|=(127&r)<<7,r<128?e:(r=n[this.pos++],e|=(127&r)<<14,r<128?e:(r=n[this.pos++],e|=(127&r)<<21,r<128?e:(r=n[this.pos],e|=(15&r)<<28,i(e,t,this)))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=S(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=o(this);for(t=t||[];this.pos127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?s(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length);var e=++this.pos;this.pos=M(this.buf,t,this.pos);var r=this.pos-e;r>=128&&h(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),E.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),E.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&h(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){this.writeMessage(t,p,e)},writePackedBoolean:function(t,e){this.writeMessage(t,m,e)},writePackedFloat:function(t,e){this.writeMessage(t,f,e)},writePackedDouble:function(t,e){this.writeMessage(t,d,e)},writePackedFixed32:function(t,e){this.writeMessage(t,v,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,g,e)},writePackedFixed64:function(t,e){this.writeMessage(t,y,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,b,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},{ieee754:17}],24:[function(t,e,r){"use strict";function n(t,e,r,a,s){for(r=r||0,a=a||t.length-1,s=s||o;a>r;){if(a-r>600){var c=a-r+1,u=e-r+1,h=Math.log(c),l=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*l*(c-l)/c)*(u-c/2<0?-1:1);n(t,e,Math.max(r,Math.floor(e-u*l/c+p)),Math.min(a,Math.floor(e+(c-u)*l/c+p)),s)}var f=t[e],d=r,m=a;for(i(t,r,e),s(t[a],f)>0&&i(t,r,a);d0;)m--}0===s(t[r],f)?i(t,r,m):i(t,++m,a),m<=e&&(r=m+1),e<=m&&(a=m-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function o(t,e){return te?1:0}e.exports=n},{}],25:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function i(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function v(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,r,n,i){for(var o,a=[e,r];a.length;)(r=a.pop())-(e=a.pop())<=n||(o=e+Math.ceil((r-e)/n/2)*n,y(t,o,e,r,i),a.push(e,o,o,r))}e.exports=n;var y=t("quickselect");n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!m(t,e))return r;for(var i,o,a,s,c=[];e;){for(i=0,o=e.children.length;i=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var a=this._chooseSplitIndex(r,i,n),s=v(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,o(r,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},_splitRoot:function(t,e){this.data=v([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,i,o,s,c,u,l,p;for(u=l=1/0,n=e;n<=r-e;n++)s=f(i=a(t,0,n,this.toBBox),o=a(t,n,r,this.toBBox)),c=h(i)+h(o),s=e;i--)o=t.children[i],s(h,t.leaf?c(o):o),p+=l(h);return p},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)s(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():o(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},{quickselect:24}],26:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Subject"),o=t("./util/ObjectUnsubscribedError"),a=function(t){function e(e){t.call(this),this._value=e}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.ObjectUnsubscribedError;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.Subject);r.BehaviorSubject=a},{"./Subject":34,"./util/ObjectUnsubscribedError":160}],27:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r,n){t.call(this),this.parent=e,this.outerValue=r,this.outerIndex=n,this.index=0}return n(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(t("./Subscriber").Subscriber);r.InnerSubscriber=i},{"./Subscriber":36}],28:[function(t,e,r){"use strict";var n=t("./Observable"),i=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){switch(this.kind){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.error);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();r.Notification=i},{"./Observable":29}],29:[function(t,e,r){"use strict";var n=t("./util/root"),i=t("./util/toSubscriber"),o=t("./symbol/observable"),a=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,o=i.toSubscriber(t,e,r);if(n?n.call(o,this.source):o.add(this.source?this._subscribe(o):this._trySubscribe(o)),o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.syncErrorThrown=!0,t.syncErrorValue=e,t.error(e)}},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var i;i=r.subscribe(function(e){if(i)try{t(e)}catch(t){n(t),i.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[o.observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=a},{"./symbol/observable":155,"./util/root":172,"./util/toSubscriber":174}],30:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],31:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(t("./Subscriber").Subscriber);r.OuterSubscriber=i},{"./Subscriber":36}],32:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Subject"),o=t("./scheduler/queue"),a=t("./Subscription"),s=t("./operator/observeOn"),c=t("./util/ObjectUnsubscribedError"),u=t("./SubjectSubscription"),h=function(t){function e(e,r,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY),t.call(this),this.scheduler=n,this._events=[],this._bufferSize=e<1?1:e,this._windowTime=r<1?1:r}return n(e,t),e.prototype.next=function(e){var r=this._getNow();this._events.push(new l(r,e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,r=this._trimBufferThenGetEvents(),n=this.scheduler;if(this.closed)throw new c.ObjectUnsubscribedError;this.hasError?e=a.Subscription.EMPTY:this.isStopped?e=a.Subscription.EMPTY:(this.observers.push(t),e=new u.SubjectSubscription(this,t)),n&&t.add(t=new s.ObserveOnSubscriber(t,n));for(var i=r.length,o=0;oe&&(o=Math.max(o,i-e)),o>0&&n.splice(0,o),n},e}(i.Subject);r.ReplaySubject=h;var l=function(){return function(t,e){this.time=t,this.value=e}}()},{"./Subject":34,"./SubjectSubscription":35,"./Subscription":37,"./operator/observeOn":129,"./scheduler/queue":153,"./util/ObjectUnsubscribedError":160}],33:[function(t,e,r){"use strict";var n=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=Date.now?Date.now:function(){return+new Date},t}();r.Scheduler=n},{}],34:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Observable"),o=t("./Subscriber"),a=t("./Subscription"),s=t("./util/ObjectUnsubscribedError"),c=t("./SubjectSubscription"),u=t("./symbol/rxSubscriber"),h=function(t){function e(e){t.call(this,e),this.destination=e}return n(e,t),e}(o.Subscriber);r.SubjectSubscriber=h;var l=function(t){function e(){t.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return n(e,t),e.prototype[u.rxSubscriber]=function(){return new h(this)},e.prototype.lift=function(t){var e=new p(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new s.ObjectUnsubscribedError;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),i=0;i=n?i.complete():(i.next(e[r]),t.index=r+1,this.schedule(t)))},e.prototype._subscribe=function(t){var r=this,n=r.arrayLike,i=r.scheduler,o=n.length;if(i)return i.schedule(e.dispatch,0,{arrayLike:n,index:0,length:o,subscriber:t});for(var a=0;a1?new e(t,n):1===i?new o.ScalarObservable(t[0],n):new a.EmptyObservable(n)},e.dispatch=function(t){var e=t.array,r=t.index,n=t.count,i=t.subscriber;r>=n?i.complete():(i.next(e[r]),i.closed||(t.index=r+1,this.schedule(t)))},e.prototype._subscribe=function(t){var r=this.array,n=r.length,i=this.scheduler;if(i)return i.schedule(e.dispatch,0,{array:r,index:0,count:n,subscriber:t});for(var o=0;o1)this.connection=null;else{var r=this.connection,n=t._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},e}(a.Subscriber)},{"../Observable":29,"../Subject":34,"../Subscriber":36,"../Subscription":37}],88:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Observable"),o=t("../util/subscribeToResult"),a=t("../OuterSubscriber"),s=function(t){function e(e){t.call(this),this.observableFactory=e}return n(e,t),e.create=function(t){return new e(t)},e.prototype._subscribe=function(t){return new c(t,this.observableFactory)},e}(i.Observable);r.DeferObservable=s;var c=function(t){function e(e,r){t.call(this,e),this.factory=r,this.tryDefer()}return n(e,t),e.prototype.tryDefer=function(){try{this._callFactory()}catch(t){this._error(t)}},e.prototype._callFactory=function(){var t=this.factory();t&&this.add(o.subscribeToResult(this,t))},e}(a.OuterSubscriber)},{"../Observable":29,"../OuterSubscriber":31,"../util/subscribeToResult":173}],89:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e){t.call(this),this.scheduler=e}return n(e,t),e.create=function(t){return new e(t)},e.dispatch=function(t){t.subscriber.complete()},e.prototype._subscribe=function(t){var r=this.scheduler;if(r)return r.schedule(e.dispatch,0,{subscriber:t});t.complete()},e}(t("../Observable").Observable);r.EmptyObservable=i},{"../Observable":29}],90:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this),this.error=e,this.scheduler=r}return n(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.error;t.subscriber.error(e)},e.prototype._subscribe=function(t){var r=this.error,n=this.scheduler;if(t.syncErrorThrowable=!0,n)return n.schedule(e.dispatch,0,{error:r,subscriber:t});t.error(r)},e}(t("../Observable").Observable);r.ErrorObservable=i},{"../Observable":29}],91:[function(t,e,r){"use strict";function n(t){return!!t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}function i(t){return!!t&&"function"==typeof t.on&&"function"==typeof t.off}function o(t){return!!t&&"[object NodeList]"===d.call(t)}function a(t){return!!t&&"[object HTMLCollection]"===d.call(t)}function s(t){return!!t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}var c=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},u=t("../Observable"),h=t("../util/tryCatch"),l=t("../util/isFunction"),p=t("../util/errorObject"),f=t("../Subscription"),d=Object.prototype.toString,m=function(t){function e(e,r,n,i){t.call(this),this.sourceObj=e,this.eventName=r,this.selector=n,this.options=i}return c(e,t),e.create=function(t,r,n,i){return l.isFunction(n)&&(i=n,n=void 0),new e(t,r,i,n)},e.setupSubscription=function(t,r,c,u,h){var l;if(o(t)||a(t))for(var p=0,d=t.length;pd?d:e:e}function o(t){return"number"==typeof t&&c.root.isFinite(t)}function a(t){var e=+t;return 0===e?e:isNaN(e)?e:e<0?-1:1}var s=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},c=t("../util/root"),u=t("../Observable"),h=t("../symbol/iterator"),l=function(t){function e(e,r){if(t.call(this),this.scheduler=r,null==e)throw new Error("iterator cannot be null.");this.iterator=n(e)}return s(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.index,r=t.hasError,n=t.iterator,i=t.subscriber;if(r)i.error(t.error);else{var o=n.next();o.done?i.complete():(i.next(o.value),t.index=e+1,i.closed?"function"==typeof n.return&&n.return():this.schedule(t))}},e.prototype._subscribe=function(t){var r=this,n=r.iterator,i=r.scheduler;if(i)return i.schedule(e.dispatch,0,{index:0,iterator:n,subscriber:t});for(;;){var o=n.next();if(o.done){t.complete();break}if(t.next(o.value),t.closed){"function"==typeof n.return&&n.return();break}}},e}(u.Observable);r.IteratorObservable=l;var p=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length),this.str=t,this.idx=e,this.len=r}return t.prototype[h.iterator]=function(){return this},t.prototype.next=function(){return this.idx0&&this.destination.next(e),t.prototype._complete.call(this)},e}(i.Subscriber),s=function(t){function e(e,r,n){t.call(this,e),this.bufferSize=r,this.startBufferEvery=n,this.buffers=[],this.count=0}return n(e,t),e.prototype._next=function(t){var e=this,r=e.bufferSize,n=e.startBufferEvery,i=e.buffers,o=e.count;this.count++,o%n==0&&i.push([]);for(var a=i.length;a--;){var s=i[a];s.push(t),s.length===r&&(i.splice(a,1),this.destination.next(s))}},e.prototype._complete=function(){for(var e=this,r=e.buffers,n=e.destination;r.length>0;){var i=r.shift();i.length>0&&n.next(i)}t.prototype._complete.call(this)},e}(i.Subscriber)},{"../Subscriber":36}],110:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscription"),o=t("../util/tryCatch"),a=t("../util/errorObject"),s=t("../OuterSubscriber"),c=t("../util/subscribeToResult");r.bufferWhen=function(t){return this.lift(new u(t))};var u=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.closingSelector))},t}(),h=function(t){function e(e,r){t.call(this,e),this.closingSelector=r,this.subscribing=!1,this.openBuffer()}return n(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},e.prototype.notifyNext=function(t,e,r,n,i){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e=this.buffer;this.buffer&&this.destination.next(e),this.buffer=[];var r=o.tryCatch(this.closingSelector)();r===a.errorObject?this.error(a.errorObject.e):(t=new i.Subscription,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(c.subscribeToResult(this,r)),this.subscribing=!1)},e}(s.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscription":37,"../util/errorObject":163,"../util/subscribeToResult":173,"../util/tryCatch":175}],111:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r._catch=function(t){var e=new a(t),r=this.lift(e);return e.caught=r};var a=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.selector,this.caught))},t}(),s=function(t){function e(e,r,n){t.call(this,e),this.selector=r,this.caught=n}return n(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=void 0;try{r=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle(),this.add(o.subscribeToResult(this,r))}},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],112:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../observable/ArrayObservable"),o=t("../util/isArray"),a=t("../OuterSubscriber"),s=t("../util/subscribeToResult"),c={};r.combineLatest=function(){for(var t=[],e=0;e0&&r[0].time-n.now()<=0;)r.shift().notification.observe(i);if(r.length>0){var o=Math.max(0,r[0].time-n.now());this.schedule(t,o)}else e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,r=new h(e.now()+this.delay,t);this.queue.push(r),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(s.Notification.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t)},e.prototype._complete=function(){this.scheduleNotification(s.Notification.createComplete())},e}(a.Subscriber),h=function(){return function(t,e){this.time=t,this.notification=e}}()},{"../Notification":28,"../Subscriber":36,"../scheduler/async":152,"../util/isDate":166}],116:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult"),a=t("../util/Set");r.distinct=function(t,e){return this.lift(new s(t,e))};var s=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.keySelector,this.flushes))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.keySelector=r,this.values=new a.Set,n&&this.add(o.subscribeToResult(this,n))}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.values.clear()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,r=this.destination;try{e=this.keySelector(t)}catch(t){return void r.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var r=this.values;r.has(t)||(r.add(t),this.destination.next(e))},e}(i.OuterSubscriber);r.DistinctSubscriber=c},{"../OuterSubscriber":31,"../util/Set":161,"../util/subscribeToResult":173}],117:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/tryCatch"),a=t("../util/errorObject");r.distinctUntilChanged=function(t,e){return this.lift(new s(t,e))};var s=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.compare,this.keySelector))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.keySelector=n,this.hasKey=!1,"function"==typeof r&&(this.compare=r)}return n(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e=t;if(this.keySelector&&(e=o.tryCatch(this.keySelector)(t))===a.errorObject)return this.destination.error(a.errorObject.e);var r=!1;if(this.hasKey){if((r=o.tryCatch(this.compare)(this.key,e))===a.errorObject)return this.destination.error(a.errorObject.e)}else this.hasKey=!0;!1===Boolean(r)&&(this.key=e,this.destination.next(t))},e}(i.Subscriber)},{"../Subscriber":36,"../util/errorObject":163,"../util/tryCatch":175}],118:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r._do=function(t,e,r){return this.lift(new o(t,e,r))};var o=function(){function t(t,e,r){this.nextOrObserver=t,this.error=e,this.complete=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.nextOrObserver,this.error,this.complete))},t}(),a=function(t){function e(e,r,n,o){t.call(this,e);var a=new i.Subscriber(r,n,o);a.syncErrorThrowable=!0,this.add(a),this.safeSubscriber=a}return n(e,t),e.prototype._next=function(t){var e=this.safeSubscriber;e.next(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.next(t)},e.prototype._error=function(t){var e=this.safeSubscriber;e.error(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.error(t)},e.prototype._complete=function(){var t=this.safeSubscriber;t.complete(),t.syncErrorThrown?this.destination.error(t.syncErrorValue):this.destination.complete()},e}(i.Subscriber)},{"../Subscriber":36}],119:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/tryCatch"),o=t("../util/errorObject"),a=t("../OuterSubscriber"),s=t("../util/subscribeToResult");r.expand=function(t,e,r){return void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=void 0),e=(e||0)<1?Number.POSITIVE_INFINITY:e,this.lift(new c(t,e,r))};var c=function(){function t(t,e,r){this.project=t,this.concurrent=e,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.concurrent,this.scheduler))},t}();r.ExpandOperator=c;var u=function(t){function e(e,r,n,i){t.call(this,e),this.project=r,this.concurrent=n,this.scheduler=i,this.index=0,this.active=0,this.hasCompleted=!1,n0&&this._next(e.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(a.OuterSubscriber);r.ExpandSubscriber=u},{"../OuterSubscriber":31,"../util/errorObject":163,"../util/subscribeToResult":173,"../util/tryCatch":175}],120:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.filter=function(t,e){return this.lift(new o(t,e))};var o=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return n(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":36}],121:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../Subscription");r._finally=function(t){return this.lift(new a(t))};var a=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.callback))},t}(),s=function(t){function e(e,r){t.call(this,e),this.add(new o.Subscription(r))}return n(e,t),e}(i.Subscriber)},{"../Subscriber":36,"../Subscription":37}],122:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/EmptyError");r.first=function(t,e,r){return this.lift(new a(t,e,r,this))};var a=function(){function t(t,e,r,n){this.predicate=t,this.resultSelector=e,this.defaultValue=r,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),s=function(t){function e(e,r,n,i,o){t.call(this,e),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.index=0,this.hasCompleted=!1,this._emitted=!1}return n(e,t),e.prototype._next=function(t){var e=this.index++;this.predicate?this._tryPredicate(t,e):this._emit(t,e)},e.prototype._tryPredicate=function(t,e){var r;try{r=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}r&&this._emit(t,e)},e.prototype._emit=function(t,e){this.resultSelector?this._tryResultSelector(t,e):this._emitFinal(t)},e.prototype._tryResultSelector=function(t,e){var r;try{r=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this._emitFinal(r)},e.prototype._emitFinal=function(t){var e=this.destination;this._emitted||(this._emitted=!0,e.next(t),e.complete(),this.hasCompleted=!0)},e.prototype._complete=function(){var t=this.destination;this.hasCompleted||void 0===this.defaultValue?this.hasCompleted||t.error(new o.EmptyError):(t.next(this.defaultValue),t.complete())},e}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":159}],123:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/EmptyError");r.last=function(t,e,r){return this.lift(new a(t,e,r,this))};var a=function(){function t(t,e,r,n){this.predicate=t,this.resultSelector=e,this.defaultValue=r,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),s=function(t){function e(e,r,n,i,o){t.call(this,e),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.hasValue=!1,this.index=0,void 0!==i&&(this.lastValue=i,this.hasValue=!0)}return n(e,t),e.prototype._next=function(t){var e=this.index++;if(this.predicate)this._tryPredicate(t,e);else{if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},e.prototype._tryPredicate=function(t,e){var r;try{r=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}if(r){if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},e.prototype._tryResultSelector=function(t,e){var r;try{r=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this.lastValue=r,this.hasValue=!0},e.prototype._complete=function(){var t=this.destination;this.hasValue?(t.next(this.lastValue),t.complete()):t.error(new o.EmptyError)},e}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":159}],124:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.map=function(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new o(t,e))};var o=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}();r.MapOperator=o;var a=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return n(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":36}],125:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e1&&"number"==typeof t[t.length-1]&&(r=t.pop())):"number"==typeof c&&(r=t.pop()),null===n&&1===t.length&&t[0]instanceof i.Observable?t[0]:new o.ArrayObservable(t,n).lift(new a.MergeAllOperator(r))}var i=t("../Observable"),o=t("../observable/ArrayObservable"),a=t("./mergeAll"),s=t("../util/isScheduler");r.merge=function(){for(var t=[],e=0;e0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(i.OuterSubscriber);r.MergeAllSubscriber=s},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],127:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/subscribeToResult"),o=t("../OuterSubscriber");r.mergeMap=function(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"number"==typeof e&&(r=e,e=null),this.lift(new a(t,e,r))};var a=function(){function t(t,e,r){void 0===r&&(r=Number.POSITIVE_INFINITY),this.project=t,this.resultSelector=e,this.concurrent=r}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.project,this.resultSelector,this.concurrent))},t}();r.MergeMapOperator=a;var s=function(t){function e(e,r,n,i){void 0===i&&(i=Number.POSITIVE_INFINITY),t.call(this,e),this.project=r,this.resultSelector=n,this.concurrent=i,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}return n(e,t),e.prototype._next=function(t){this.active0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(o.OuterSubscriber);r.MergeMapSubscriber=s},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],128:[function(t,e,r){"use strict";var n=t("../observable/ConnectableObservable");r.multicast=function(t,e){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return this.lift(new i(r,e));var o=Object.create(this,n.connectableObservableDescriptor);return o.source=this,o.subjectFactory=r,o};var i=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var r=this.selector,n=this.subjectFactory(),i=r(n).subscribe(t);return i.add(e.subscribe(n)),i},t}();r.MulticastOperator=i},{"../observable/ConnectableObservable":87}],129:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../Notification");r.observeOn=function(t,e){return void 0===e&&(e=0),this.lift(new a(t,e))};var a=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.scheduler,this.delay))},t}();r.ObserveOnOperator=a;var s=function(t){function e(e,r,n){void 0===n&&(n=0),t.call(this,e),this.scheduler=r,this.delay=n}return n(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination;e.observe(r),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.add(this.scheduler.schedule(e.dispatch,this.delay,new c(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.Notification.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.Notification.createError(t))},e.prototype._complete=function(){this.scheduleMessage(o.Notification.createComplete())},e}(i.Subscriber);r.ObserveOnSubscriber=s;var c=function(){return function(t,e){this.notification=t,this.destination=e}}();r.ObserveOnMessage=c},{"../Notification":28,"../Subscriber":36}],130:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.pairwise=function(){return this.lift(new o)};var o=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new a(t))},t}(),a=function(t){function e(e){t.call(this,e),this.hasPrev=!1}return n(e,t),e.prototype._next=function(t){this.hasPrev?this.destination.next([this.prev,t]):this.hasPrev=!0,this.prev=t},e}(i.Subscriber)},{"../Subscriber":36}],131:[function(t,e,r){"use strict";function n(t,e){return function(r){for(var n=r,i=0;i=2&&(r=!0),this.lift(new o(t,e,r))};var o=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.accumulator,this.seed,this.hasSeed))},t}(),a=function(t){function e(e,r,n,i){t.call(this,e),this.accumulator=r,this._seed=n,this.hasSeed=i,this.index=0}return n(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.accumulator(this.seed,t,r)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":36}],135:[function(t,e,r){"use strict";function n(){return new o.Subject}var i=t("./multicast"),o=t("../Subject");r.share=function(){return i.multicast.call(this,n).refCount()}},{"../Subject":34,"./multicast":128}],136:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.skip=function(t){return this.lift(new o(t))};var o=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.total))},t}(),a=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return n(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":36}],137:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.skipUntil=function(t){return this.lift(new a(t))};var a=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.notifier))},t}(),s=function(t){function e(e,r){t.call(this,e),this.hasValue=!1,this.isInnerStopped=!1,this.add(o.subscribeToResult(this,r))}return n(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype._complete=function(){this.isInnerStopped?t.prototype._complete.call(this):this.unsubscribe()},e.prototype.notifyNext=function(t,e,r,n,i){this.hasValue=!0},e.prototype.notifyComplete=function(){this.isInnerStopped=!0,this.isStopped&&t.prototype._complete.call(this)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],138:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.skipWhile=function(t){return this.lift(new o(t))};var o=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate))},t}(),a=function(t){function e(e,r){t.call(this,e),this.predicate=r,this.skipping=!0,this.index=0}return n(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(i.Subscriber)},{"../Subscriber":36}],139:[function(t,e,r){"use strict";var n=t("../observable/ArrayObservable"),i=t("../observable/ScalarObservable"),o=t("../observable/EmptyObservable"),a=t("./concat"),s=t("../util/isScheduler");r.startWith=function(){for(var t=[],e=0;e1?a.concatStatic(new n.ArrayObservable(t,r),this):a.concatStatic(new o.EmptyObservable(r),this)}},{"../observable/ArrayObservable":86,"../observable/EmptyObservable":89,"../observable/ScalarObservable":95,"../util/isScheduler":171,"./concat":113}],140:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.switchMap=function(t,e){return this.lift(new a(t,e))};var a=function(){function t(t,e){this.project=t,this.resultSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.project,this.resultSelector))},t}(),s=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.resultSelector=n,this.index=0}return n(e,t),e.prototype._next=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this._innerSub(e,t,r)},e.prototype._innerSub=function(t,e,r){var n=this.innerSubscription;n&&n.unsubscribe(),this.add(this.innerSubscription=o.subscribeToResult(this,t,e,r))},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.innerSubscription=null},e.prototype.notifyComplete=function(e){this.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e,r,n,i){this.resultSelector?this._tryNotifyNext(t,e,r,n):this.destination.next(e)},e.prototype._tryNotifyNext=function(t,e,r,n){var i;try{i=this.resultSelector(t,e,r,n)}catch(t){return void this.destination.error(t)}this.destination.next(i)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],141:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/ArgumentOutOfRangeError"),a=t("../observable/EmptyObservable");r.take=function(t){return 0===t?new a.EmptyObservable:this.lift(new s(t))};var s=function(){function t(t){if(this.total=t,this.total<0)throw new o.ArgumentOutOfRangeError}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.total))},t}(),c=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return n(e,t),e.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},e}(i.Subscriber)},{"../Subscriber":36,"../observable/EmptyObservable":89,"../util/ArgumentOutOfRangeError":158}],142:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.takeUntil=function(t){return this.lift(new a(t))};var a=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.notifier))},t}(),s=function(t){function e(e,r){t.call(this,e),this.notifier=r,this.add(o.subscribeToResult(this,r))}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.complete()},e.prototype.notifyComplete=function(){},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],143:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.defaultThrottleConfig={leading:!0,trailing:!1},r.throttle=function(t,e){return void 0===e&&(e=r.defaultThrottleConfig),this.lift(new a(t,e.leading,e.trailing))};var a=function(){function t(t,e,r){this.durationSelector=t,this.leading=e,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.durationSelector,this.leading,this.trailing))},t}(),s=function(t){function e(e,r,n,i){t.call(this,e),this.destination=e,this.durationSelector=r,this._leading=n,this._trailing=i,this._hasTrailingValue=!1}return n(e,t),e.prototype._next=function(t){if(this.throttled)this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t);else{var e=this.tryDurationSelector(t);e&&this.add(this.throttled=o.subscribeToResult(this,e)),this._leading&&(this.destination.next(t),this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t))}},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype._unsubscribe=function(){var t=this,e=t.throttled;t._trailingValue,t._hasTrailingValue,t._trailing;this._trailingValue=null,this._hasTrailingValue=!1,e&&(this.remove(e),this.throttled=null,e.unsubscribe())},e.prototype._sendTrailing=function(){var t=this,e=t.destination,r=t.throttled,n=t._trailing,i=t._trailingValue,o=t._hasTrailingValue;r&&n&&o&&(e.next(i),this._trailingValue=null,this._hasTrailingValue=!1)},e.prototype.notifyNext=function(t,e,r,n,i){this._sendTrailing(),this._unsubscribe()},e.prototype.notifyComplete=function(){this._sendTrailing(),this._unsubscribe()},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],144:[function(t,e,r){"use strict";function n(t){t.subscriber.clearThrottle()}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber"),a=t("../scheduler/async"),s=t("./throttle");r.throttleTime=function(t,e,r){return void 0===e&&(e=a.async),void 0===r&&(r=s.defaultThrottleConfig),this.lift(new c(t,e,r.leading,r.trailing))};var c=function(){function t(t,e,r,n){this.duration=t,this.scheduler=e,this.leading=r,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),u=function(t){function e(e,r,n,i,o){t.call(this,e),this.duration=r,this.scheduler=n,this.leading=i,this.trailing=o,this._hasTrailingValue=!1,this._trailingValue=null}return i(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(n,this.duration,{subscriber:this})),this.leading&&this.destination.next(t))},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(o.Subscriber)},{"../Subscriber":36,"../scheduler/async":152,"./throttle":143}],145:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.withLatestFrom=function(){for(var t=[],e=0;e0){var a=o.indexOf(r);-1!==a&&o.splice(a,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],146:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;ethis.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),m=function(t){function e(e,r,n){t.call(this,e),this.parent=r,this.observable=n,this.stillUnsubscribed=!0,this.buffer=[],this.isComplete=!1}return i(e,t),e.prototype[h.iterator]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,i){this.buffer.push(e),this.parent.checkIterators()},e.prototype.subscribe=function(t,e){return u.subscribeToResult(this,this.observable,this,e)},e}(c.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscriber":36,"../observable/ArrayObservable":86,"../symbol/iterator":154,"../util/isArray":164,"../util/subscribeToResult":173}],147:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this)}return n(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(t("../Subscription").Subscription);r.Action=i},{"../Subscription":37}],148:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/root"),o=function(t){function e(e,r){t.call(this,e,r),this.scheduler=e,this.work=r,this.pending=!1}return n(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t,this.pending=!0;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,e)),this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),i.root.setInterval(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){return void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending?e:i.root.clearInterval(e)&&void 0||void 0},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r=!1,n=void 0;try{this.work(t)}catch(t){r=!0,n=!!t&&t||new Error(t)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,r=e.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(t("./Action").Action);r.AsyncAction=o},{"../util/root":172,"./Action":147}],149:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments),this.actions=[],this.active=!1,this.scheduled=void 0}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var r;this.active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(t("../Scheduler").Scheduler);r.AsyncScheduler=i},{"../Scheduler":33}],150:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this,e,r),this.scheduler=e,this.work=r}return n(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):e.flush(this)},e}(t("./AsyncAction").AsyncAction);r.QueueAction=i},{"./AsyncAction":148}],151:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e}(t("./AsyncScheduler").AsyncScheduler);r.QueueScheduler=i},{"./AsyncScheduler":149}],152:[function(t,e,r){"use strict";var n=t("./AsyncAction"),i=t("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":148,"./AsyncScheduler":149}],153:[function(t,e,r){"use strict";var n=t("./QueueAction"),i=t("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":150,"./QueueScheduler":151}],154:[function(t,e,r){"use strict";function n(t){var e=t.Symbol;if("function"==typeof e)return e.iterator||(e.iterator=e("iterator polyfill")),e.iterator;var r=t.Set;if(r&&"function"==typeof(new r)["@@iterator"])return"@@iterator";var n=t.Map;if(n)for(var i=Object.getOwnPropertyNames(n.prototype),o=0;o=0}},{"../util/isArray":164}],169:[function(t,e,r){"use strict";r.isObject=function(t){return null!=t&&"object"==typeof t}},{}],170:[function(t,e,r){"use strict";r.isPromise=function(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}},{}],171:[function(t,e,r){"use strict";r.isScheduler=function(t){return t&&"function"==typeof t.schedule}},{}],172:[function(t,e,r){(function(t){"use strict";var e="undefined"!=typeof window&&window,n="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,i=void 0!==t&&t,o=e||i||n;r.root=o,function(){if(!o)throw new Error("RxJS could not find any global context (window, self, global)")}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],173:[function(t,e,r){"use strict";var n=t("./root"),i=t("./isArrayLike"),o=t("./isPromise"),a=t("./isObject"),s=t("../Observable"),c=t("../symbol/iterator"),u=t("../InnerSubscriber"),h=t("../symbol/observable");r.subscribeToResult=function(t,e,r,l){var p=new u.InnerSubscriber(t,r,l);if(p.closed)return null;if(e instanceof s.Observable)return e._isScalar?(p.next(e.value),p.complete(),null):e.subscribe(p);if(i.isArrayLike(e)){for(var f=0,d=e.length;f=n||0 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;\nfogFactor = 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")),C.compileShader(L),C.compileShader(N),C.attachShader(R,L),C.attachShader(R,N),C.linkProgram(R),E=R,x=C.getAttribLocation(E,"position"),w=C.getAttribLocation(E,"uv"),i=C.getUniformLocation(E,"uvOffset"),o=C.getUniformLocation(E,"uvScale"),a=C.getUniformLocation(E,"rotation"),u=C.getUniformLocation(E,"scale"),h=C.getUniformLocation(E,"color"),l=C.getUniformLocation(E,"map"),p=C.getUniformLocation(E,"opacity"),f=C.getUniformLocation(E,"modelViewMatrix"),d=C.getUniformLocation(E,"projectionMatrix"),m=C.getUniformLocation(E,"fogType"),v=C.getUniformLocation(E,"fogDensity"),g=C.getUniformLocation(E,"fogNear"),y=C.getUniformLocation(E,"fogFar"),b=C.getUniformLocation(E,"fogColor"),_=C.getUniformLocation(E,"alphaTest"),(R=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,R.height=8,(L=R.getContext("2d")).fillStyle="white",L.fillRect(0,0,8,8),(T=new n(R)).needsUpdate=!0}C.useProgram(E),O.initAttributes(),O.enableAttribute(x),O.enableAttribute(w),O.disableUnusedAttributes(),O.disable(C.CULL_FACE),O.enable(C.BLEND),C.bindBuffer(C.ARRAY_BUFFER,S),C.vertexAttribPointer(x,2,C.FLOAT,!1,16,0),C.vertexAttribPointer(w,2,C.FLOAT,!1,16,8),C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,M),C.uniformMatrix4fv(d,!1,c.projectionMatrix.elements),O.activeTexture(C.TEXTURE0),C.uniform1i(l,0),L=R=0,(N=s.fog)?(C.uniform3f(b,N.color.r,N.color.g,N.color.b),N.isFog?(C.uniform1f(g,N.near),C.uniform1f(y,N.far),C.uniform1i(m,1),L=R=1):N.isFogExp2&&(C.uniform1f(v,N.density),C.uniform1i(m,2),L=R=2)):(C.uniform1i(m,0),L=R=0);for(var N=0,I=e.length;Ne&&(e=t[r]);return e}function St(){Object.defineProperty(this,"id",{value:ki++}),this.uuid=xi.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}}function Mt(t,e,r,n,i,o){ht.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Et(t,e,r,n,i,o)),this.mergeVertices()}function Et(t,e,r,n,i,o){function a(t,e,r,n,i,o,a,m,v,g,y){var b=o/v,_=a/g,x=o/2,w=a/2,S=m/2;a=v+1;var M,E,T=g+1,C=o=0,O=new c;for(E=0;E/gm,function(t,e){var r=Li[e];if(void 0===r)throw Error("Can not resolve #include <"+e+">");return Qt(r)})}function te(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,n){for(t="",e=parseInt(e);ee||t.height>e){var r=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return n.width=Math.floor(t.width*r),n.height=Math.floor(t.height*r),n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return xi.isPowerOfTwo(t.width)&&xi.isPowerOfTwo(t.height)}function u(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function h(e){return 1003===e||1004===e||1005===e?t.NEAREST:t.LINEAR}function l(e){(e=e.target).removeEventListener("dispose",l);t:{var r=n.get(e);if(e.image&&r.__image__webglTextureCube)t.deleteTexture(r.__image__webglTextureCube);else{if(void 0===r.__webglInit)break t;t.deleteTexture(r.__webglTexture)}n.remove(e)}a.textures--}function p(e){(e=e.target).removeEventListener("dispose",p);var r=n.get(e),i=n.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(i=0;6>i;i++)t.deleteFramebuffer(r.__webglFramebuffer[i]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[i]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}a.textures--}function f(e,h){var p=n.get(e);if(0g;g++)v[g]=f||m?m?e.image[g].image:e.image[g]:s(e.image[g],i.maxCubemapSize);var y=c(v[0]),b=o(e.format),_=o(e.type);for(d(t.TEXTURE_CUBE_MAP,e,y),g=0;6>g;g++)if(f)for(var x,w=v[g].mipmaps,S=0,M=w.length;Sl;l++)i.__webglFramebuffer[l]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(s){for(r.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),d(t.TEXTURE_CUBE_MAP,e.texture,h),l=0;6>l;l++)m(i.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);u(e.texture,h)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),r.bindTexture(t.TEXTURE_CUBE_MAP,null)}else r.bindTexture(t.TEXTURE_2D,o.__webglTexture),d(t.TEXTURE_2D,e.texture,h),m(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),u(e.texture,h)&&t.generateMipmap(t.TEXTURE_2D),r.bindTexture(t.TEXTURE_2D,null);if(e.depthBuffer){if(i=n.get(e),o=!0===e.isWebGLRenderTargetCube,e.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");if(e&&e.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(n.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),f(e.depthTexture,0),i=n.get(e.depthTexture).__webglTexture,1026===e.depthTexture.format)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(1027!==e.depthTexture.format)throw Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}else if(o)for(i.__webglDepthbuffer=[],o=0;6>o;o++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),v(i.__webglDepthbuffer[o],e);else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),v(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var i=e.texture;u(i,c(e))&&(e=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,i=n.get(i).__webglTexture,r.bindTexture(e,i),t.generateMipmap(e),r.bindTexture(e,null))}}function ie(){var t={};return{get:function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},remove:function(e){delete t[e.uuid]},clear:function(){t={}}}}function oe(t,e,r){function n(e,r,n){var i=new Uint8Array(4),o=t.createTexture();for(t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST),e=0;e=gt.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+gt.maxTextures),X+=1,t},this.setTexture2D=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),_t.setTexture2D(e,r)}}(),this.setTexture=function(){var t=!1;return function(e,r){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),_t.setTexture2D(e,r)}}(),this.setTextureCube=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?_t.setTextureCube(e,r):_t.setTextureCubeDynamic(e,r)}}(),this.getRenderTarget=function(){return D},this.setRenderTarget=function(t){(D=t)&&void 0===bt.get(t).__webglFramebuffer&&_t.setupRenderTarget(t);var e,r=t&&t.isWebGLRenderTargetCube;t?(e=bt.get(t),e=r?e.__webglFramebuffer[t.activeCubeFace]:e.__webglFramebuffer,$.copy(t.scissor),V=t.scissorTest,W.copy(t.viewport)):(e=null,$.copy(J).multiplyScalar(Z),V=Q,W.copy(nt).multiplyScalar(Z)),k!==e&&(mt.bindFramebuffer(mt.FRAMEBUFFER,e),k=e),yt.scissor($),yt.setScissorTest(V),yt.viewport(W),r&&(r=bt.get(t.texture),mt.framebufferTexture2D(mt.FRAMEBUFFER,mt.COLOR_ATTACHMENT0,mt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel))},this.readRenderTargetPixels=function(t,e,r,n,i,o){if(t&&t.isWebGLRenderTarget){var a=bt.get(t).__webglFramebuffer;if(a){var s=!1;a!==k&&(mt.bindFramebuffer(mt.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,h=c.type;1023!==u&&_(u)!==mt.getParameter(mt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||_(h)===mt.getParameter(mt.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(vt.get("OES_texture_float")||vt.get("WEBGL_color_buffer_float"))||1016===h&&vt.get("EXT_color_buffer_half_float")?mt.checkFramebufferStatus(mt.FRAMEBUFFER)===mt.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=r&&r<=t.height-i&&mt.readPixels(e,r,n,i,_(u),_(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{s&&mt.bindFramebuffer(mt.FRAMEBUFFER,k)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function pe(t,e){this.name="",this.color=new $(t),this.density=void 0!==e?e:25e-5}function fe(t,e,r){this.name="",this.color=new $(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3}function de(){ot.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function me(t,e,r,n,i){ot.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,n,i)}function ve(t){W.call(this),this.type="SpriteMaterial",this.color=new $(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(t)}function ge(t){ot.call(this),this.type="Sprite",this.material=void 0!==t?t:new ve}function ye(){ot.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function be(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var r=0,n=this.bones.length;r=t.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}n.call(this,t,e,r,i,o,a,s,c,u),this.generateMipmaps=!1;var l=this;h()}function Ae(t,e,r,i,o,a,s,c,u,h,l,p){n.call(this,null,a,s,c,u,h,i,o,l,p),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1}function je(t,e,r,i,o,a,s,c,u){n.call(this,t,e,r,i,o,a,s,c,u),this.needsUpdate=!0}function Re(t,e,r,i,o,a,s,c,u,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===h&&(r=1012),void 0===r&&1027===h&&(r=1020),n.call(this,null,i,o,a,s,c,h,r,u),this.image={width:t,height:e},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=this.flipY=!1}function Le(t){St.call(this),this.type="WireframeGeometry";var e,r,n,i,o,a,s=[],u=[0,0],h={},l=["a","b","c"];if(t&&t.isGeometry){var p=t.faces;for(e=0,n=p.length;er;r++)o=f[l[r]],a=f[l[(r+1)%3]],u[0]=Math.min(o,a),u[1]=Math.max(o,a),o=u[0]+","+u[1],void 0===h[o]&&(h[o]={index1:u[0],index2:u[1]})}for(o in h)e=h[o],l=t.vertices[e.index1],s.push(l.x,l.y,l.z),l=t.vertices[e.index2],s.push(l.x,l.y,l.z)}else if(t&&t.isBufferGeometry){var d,l=new c;if(null!==t.index){for(p=t.attributes.position,f=t.index,0===(d=t.groups).length&&(d=[{start:0,count:f.count,materialIndex:0}]),t=0,i=d.length;tr;r++)o=f.getX(e+r),a=f.getX(e+(r+1)%3),u[0]=Math.min(o,a),u[1]=Math.max(o,a),o=u[0]+","+u[1],void 0===h[o]&&(h[o]={index1:u[0],index2:u[1]});for(o in h)e=h[o],l.fromBufferAttribute(p,e.index1),s.push(l.x,l.y,l.z),l.fromBufferAttribute(p,e.index2),s.push(l.x,l.y,l.z)}else for(p=t.attributes.position,e=0,n=p.count/3;er;r++)h=3*e+r,l.fromBufferAttribute(p,h),s.push(l.x,l.y,l.z),h=3*e+(r+1)%3,l.fromBufferAttribute(p,h),s.push(l.x,l.y,l.z)}this.addAttribute("position",new bt(s,3))}function Ne(t,e,r){ht.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r},this.fromBufferGeometry(new Ie(t,e,r)),this.mergeVertices()}function Ie(t,e,r){St.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:r};var n,i,o=[],a=[],s=[],u=[],h=new c,l=new c,p=new c,f=new c,d=new c,m=e+1;for(n=0;n<=r;n++){var v=n/r;for(i=0;i<=e;i++){var g=i/e,l=t(g,v,l);a.push(l.x,l.y,l.z),0<=g-1e-5?(p=t(g-1e-5,v,p),f.subVectors(l,p)):(p=t(g+1e-5,v,p),f.subVectors(p,l)),0<=v-1e-5?(p=t(g,v-1e-5,p),d.subVectors(l,p)):(p=t(g,v+1e-5,p),d.subVectors(p,l)),h.crossVectors(f,d).normalize(),s.push(h.x,h.y,h.z),u.push(g,v)}}for(n=0;nn&&1===t.x&&(h[e]=t.x-1),0===r.x&&0===r.z&&(h[e]=n/2/Math.PI+.5)}St.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},n=n||1;var u=[],h=[];!function(t){for(var r=new c,n=new c,i=new c,s=0;so&&(.2>e&&(h[t+0]+=1),.2>n&&(h[t+2]+=1),.2>i&&(h[t+4]+=1))}(),this.addAttribute("position",new bt(u,3)),this.addAttribute("normal",new bt(u.slice(),3)),this.addAttribute("uv",new bt(h,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Fe(t,e){ht.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Be(t,e)),this.mergeVertices()}function Be(t,e){ke.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],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ue(t,e){ht.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ze(t,e)),this.mergeVertices()}function ze(t,e){ke.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],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ge(t,e){ht.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new $e(t,e)),this.mergeVertices()}function $e(t,e){var r=(1+Math.sqrt(5))/2;ke.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ve(t,e){ht.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new He(t,e)),this.mergeVertices()}function He(t,e){var r=(1+Math.sqrt(5))/2,n=1/r;ke.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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],[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,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function qe(t,e,r,n,i,o){ht.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:n,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed."),t=new We(t,e,r,n,i),this.tangents=t.tangents,this.normals=t.normals,this.binormals=t.binormals,this.fromBufferGeometry(t),this.mergeVertices()}function We(t,e,n,i,o){function a(r){var o=t.getPointAt(r/e),a=s.normals[r];for(r=s.binormals[r],h=0;h<=i;h++){var c=h/i*Math.PI*2,u=Math.sin(c),c=-Math.cos(c);p.x=c*a.x+u*r.x,p.y=c*a.y+u*r.y,p.z=c*a.z+u*r.z,p.normalize(),m.push(p.x,p.y,p.z),l.x=o.x+n*p.x,l.y=o.y+n*p.y,l.z=o.z+n*p.z,d.push(l.x,l.y,l.z)}}St.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:o},e=e||64,n=n||1,i=i||8,o=o||!1;var s=t.computeFrenetFrames(e,o);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;var u,h,l=new c,p=new c,f=new r,d=[],m=[],v=[],g=[];for(u=0;ud;d++)r=f[u[d]],n=f[u[(d+1)%3]],s[0]=Math.min(r,n),s[1]=Math.max(r,n),r=s[0]+","+s[1],void 0===c[r]?c[r]={index1:s[0],index2:s[1],face1:l,face2:void 0}:c[r].face2=l;for(r in c)(void 0===(s=c[r]).face2||i[s.face1].normal.dot(i[s.face2].normal)<=a)&&(u=h[s.index1],o.push(u.x,u.y,u.z),u=h[s.index2],o.push(u.x,u.y,u.z));this.addAttribute("position",new bt(o,3))}function lr(t,e,r,n,i,o,a,s){ht.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new pr(t,e,r,n,i,o,a,s)),this.mergeVertices()}function pr(t,e,n,i,o,a,s,u){function h(n){var o,a,h,g=new r,_=new c,x=0,w=!0===n?t:e,S=!0===n?1:-1;for(a=v,o=1;o<=i;o++)f.push(0,y*S,0),d.push(0,S,0),m.push(.5,.5),v++;for(h=v,o=0;o<=i;o++){var M=o/i*u+s,E=Math.cos(M),M=Math.sin(M);_.x=w*M,_.y=y*S,_.z=w*E,f.push(_.x,_.y,_.z),d.push(0,S,0),g.x=.5*E+.5,g.y=.5*M*S+.5,m.push(g.x,g.y),v++}for(o=0;othis.duration&&this.resetDuration(),this.optimize()}function nn(t){this.manager=void 0!==t?t:$i,this.textures={}}function on(t){this.manager=void 0!==t?t:$i}function an(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function sn(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:$i,this.withCredentials=!1}function cn(t){this.manager=void 0!==t?t:$i,this.texturePath=""}function un(t,e,r,n,i){var o=t*t;return(2*r-2*n+(e=.5*(n-e))+(i=.5*(i-r)))*t*o+(-3*r+3*n-2*e-i)*o+e*t+r}function hn(t,e,r,n){var i=1-t;return i*i*e+2*(1-t)*t*r+t*t*n}function ln(t,e,r,n,i){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*r+3*(1-t)*t*t*n+t*t*t*i}function pn(){this.arcLengthDivisions=200}function fn(t,e){this.arcLengthDivisions=200,this.v1=t,this.v2=e}function dn(){this.arcLengthDivisions=200,this.curves=[],this.autoClose=!1}function mn(t,e,r,n,i,o,a,s){this.arcLengthDivisions=200,this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=n,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function vn(t){this.arcLengthDivisions=200,this.points=void 0===t?[]:t}function gn(t,e,r,n){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r,this.v3=n}function yn(t,e,r){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r}function bn(t){dn.call(this),this.currentPoint=new r,t&&this.fromPoints(t)}function _n(){bn.apply(this,arguments),this.holes=[]}function xn(){this.subPaths=[],this.currentPath=null}function wn(t){this.data=t}function Sn(t){this.manager=void 0!==t?t:$i}function Mn(t){this.manager=void 0!==t?t:$i}function En(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ct,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ct,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Tn(t,e,r){ot.call(this),this.type="CubeCamera";var n=new ct(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new c(1,0,0)),this.add(n);var i=new ct(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new c(-1,0,0)),this.add(i);var o=new ct(90,1,t,e);o.up.set(0,0,1),o.lookAt(new c(0,1,0)),this.add(o);var s=new ct(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new c(0,-1,0)),this.add(s);var u=new ct(90,1,t,e);u.up.set(0,-1,0),u.lookAt(new c(0,0,1)),this.add(u);var h=new ct(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new c(0,0,-1)),this.add(h),this.renderTarget=new a(r,r,{format:1022,magFilter:1006,minFilter:1006}),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,a=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,n,r),r.activeCubeFace=1,t.render(e,i,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,s,r),r.activeCubeFace=4,t.render(e,u,r),r.texture.generateMipmaps=a,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)}}function Cn(){ot.call(this),this.type="AudioListener",this.context=Ji.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function On(t){ot.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Pn(t){On.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function An(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function jn(t,e,r){switch(this.binding=t,this.valueSize=r,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*r),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0}function Rn(t,e,r){r=r||Ln.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Ln(t,e,r){this.path=e,this.parsedPath=r||Ln.parseTrackName(e),this.node=Ln.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Nn(t){this.uuid=xi.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function In(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,e=(t=e.tracks).length,r=Array(e);for(var n={endingStart:2400,endingEnd:2400},i=0;i!==e;++i){var o=t[i].createInterpolant(null);r[i]=o,o.settings=n}this._interpolantSettings=n,this._interpolants=r,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Dn(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function kn(t,e){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=e),this.value=t}function Fn(){St.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Bn(t,e,r,n){this.uuid=xi.generateUUID(),this.data=t,this.itemSize=e,this.offset=r,this.normalized=!0===n}function Un(t,e){this.uuid=xi.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function zn(t,e,r){Un.call(this,t,e),this.meshPerAttribute=r||1}function Gn(t,e,r){lt.call(this,t,e),this.meshPerAttribute=r||1}function $n(t,e,r,n){this.ray=new Pt(t,e),this.near=r||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Vn(t,e){return t.distance-e.distance}function Hn(t,e,r,n){if(!1!==t.visible&&(t.raycast(e,r),!0===n)){n=0;for(var i=(t=t.children).length;nr;r++,n++){var i=r/32*Math.PI*2,o=n/32*Math.PI*2;e.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}t.addAttribute("position",new bt(e,3)),e=new we({fog:!1}),this.cone=new Me(t,e),this.add(this.cone),this.update()}function Qn(t){var e=[];t&&t.isBone&&e.push(t);for(var r=0;rt.length&&console.warn("THREE.CatmullRomCurve3: Points array needs at least two entries."),this.points=t||[],this.closed=!1}function di(t,e,r,n){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r,this.v3=n}function mi(t,e,r){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r}function vi(t,e){this.arcLengthDivisions=200,this.v1=t,this.v2=e}function gi(t,e,r,n,i,o){mn.call(this,t,e,r,r,n,i,o)}function yi(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom",this.closed=!0}function bi(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom"}function _i(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0i;i++)8===i||13===i||18===i||23===i?r[i]="-":14===i?r[i]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),t=15&n,n>>=4,r[i]=e[19===i?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,n,i){return n+(t-e)*(i-n)/(r-e)},lerp:function(t,e,r){return(1-r)*t+r*e},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*xi.DEG2RAD},radToDeg:function(t){return t*xi.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.defineProperties(r.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(r.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new r,e=new r;return function(r,n){return t.set(r,r),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return 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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return t=this.y-t.y,e*e+t*t},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*r-o*n+t.x,this.y=i*n+o*r+t.y,this}});var wi=0;n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=300,Object.defineProperty(n.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(n.prototype,e.prototype,{constructor:n,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=xi.generateUUID()),void 0===t.images[r.uuid]){var n,i=t.images,o=r.uuid,a=r.uuid;void 0!==r.toDataURL?n=r:(n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n.width=r.width,n.height=r.height,n.getContext("2d").drawImage(r,0,0,r.width,r.height)),n=2048t.x||1t.x?0:1;break;case 1002:t.x=1===Math.abs(Math.floor(t.x)%2)?Math.ceil(t.x)-t.x:t.x-Math.floor(t.x)}if(0>t.y||1t.y?0:1;break;case 1002:t.y=1===Math.abs(Math.floor(t.y)%2)?Math.ceil(t.y)-t.y:t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(i.prototype,{isVector4:!0,set:function(t,e,r,n){return this.x=t,this.y=e,this.z=r,this.w=n,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*n+t[12]*i,this.y=t[1]*e+t[5]*r+t[9]*n+t[13]*i,this.z=t[2]*e+t[6]*r+t[10]*n+t[14]*i,this.w=t[3]*e+t[7]*r+t[11]*n+t[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,n,i=(t=t.elements)[0];n=t[4];var o=t[8],a=t[1],s=t[5],c=t[9];r=t[2],e=t[6];var u=t[10];return.01>Math.abs(n-a)&&.01>Math.abs(o-r)&&.01>Math.abs(c-e)?.1>Math.abs(n+a)&&.1>Math.abs(o+r)&&.1>Math.abs(c+e)&&.1>Math.abs(i+s+u-3)?(this.set(1,0,0,0),this):(t=Math.PI,i=(i+1)/2,s=(s+1)/2,u=(u+1)/2,n=(n+a)/4,o=(o+r)/4,c=(c+e)/4,i>s&&i>u?.01>i?(e=0,n=r=.707106781):(e=Math.sqrt(i),r=n/e,n=o/e):s>u?.01>s?(e=.707106781,r=0,n=.707106781):(r=Math.sqrt(s),e=n/r,n=c/r):.01>u?(r=e=.707106781,n=0):(n=Math.sqrt(u),e=o/n,r=c/n),this.set(e,r,n,t),this):(t=Math.sqrt((e-c)*(e-c)+(o-r)*(o-r)+(a-n)*(a-n)),.001>Math.abs(t)&&(t=1),this.x=(e-c)/t,this.y=(o-r)/t,this.z=(a-n)/t,this.w=Math.acos((i+s+u-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,n){return void 0===t&&(t=new i,e=new i),t.set(r,r,r,r),e.set(n,n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return 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),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(o.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.prototype=Object.create(o.prototype),a.prototype.constructor=a,a.prototype.isWebGLRenderTargetCube=!0,Object.assign(s,{slerp:function(t,e,r,n){return r.copy(t).slerp(e,n)},slerpFlat:function(t,e,r,n,i,o,a){var s=r[n+0],c=r[n+1],u=r[n+2];r=r[n+3],n=i[o+0];var h=i[o+1],l=i[o+2];if(i=i[o+3],r!==i||s!==n||c!==h||u!==l){o=1-a;var p=s*n+c*h+u*l+r*i,f=0<=p?1:-1,d=1-p*p;d>Number.EPSILON&&(d=Math.sqrt(d),p=Math.atan2(d,p*f),o=Math.sin(o*p)/d,a=Math.sin(a*p)/d),s=s*o+n*(f*=a),c=c*o+h*f,u=u*o+l*f,r=r*o+i*f,o===1-a&&(a=1/Math.sqrt(s*s+c*c+u*u+r*r),s*=a,c*=a,u*=a,r*=a)}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=r}}),Object.defineProperties(s.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(s.prototype,{set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=t._x,n=t._y,i=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(r/2),u=a(n/2),a=a(i/2),r=s(r/2),n=s(n/2),i=s(i/2);return"XYZ"===o?(this._x=r*u*a+c*n*i,this._y=c*n*a-r*u*i,this._z=c*u*i+r*n*a,this._w=c*u*a-r*n*i):"YXZ"===o?(this._x=r*u*a+c*n*i,this._y=c*n*a-r*u*i,this._z=c*u*i-r*n*a,this._w=c*u*a+r*n*i):"ZXY"===o?(this._x=r*u*a-c*n*i,this._y=c*n*a+r*u*i,this._z=c*u*i+r*n*a,this._w=c*u*a-r*n*i):"ZYX"===o?(this._x=r*u*a-c*n*i,this._y=c*n*a+r*u*i,this._z=c*u*i-r*n*a,this._w=c*u*a+r*n*i):"YZX"===o?(this._x=r*u*a+c*n*i,this._y=c*n*a+r*u*i,this._z=c*u*i-r*n*a,this._w=c*u*a-r*n*i):"XZY"===o&&(this._x=r*u*a-c*n*i,this._y=c*n*a-r*u*i,this._z=c*u*i+r*n*a,this._w=c*u*a+r*n*i),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,n=Math.sin(r);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var n=e[8],i=e[1],o=e[5],a=e[9],s=e[2],c=e[6],u=r+o+(e=e[10]);return 0o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(c-a)/r,this._x=.25*r,this._y=(t+i)/r,this._z=(n+s)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(n-s)/r,this._x=(t+i)/r,this._y=.25*r,this._z=(a+c)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(i-t)/r,this._x=(n+s)/r,this._y=(a+c)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new c;return function(r,n){return void 0===e&&(e=new c),1e-6>(t=r.dot(n)+1)?(t=0,Math.abs(r.x)>Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var r=t._x,n=t._y,i=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=r*u+o*a+n*c-i*s,this._y=n*u+o*s+i*a-r*c,this._z=i*u+o*c+r*s-n*a,this._w=o*u-r*a-n*s-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,n=this._y,i=this._z,o=this._w;if(0>(s=o*t._w+r*t._x+n*t._y+i*t._z)?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),1<=s)return this._w=o,this._x=r,this._y=n,this._z=i,this;c=Math.sqrt(1-s*s);if(.001>Math.abs(c))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(n+this._y),this._z=.5*(i+this._z),this;var a=Math.atan2(c,s),s=Math.sin((1-e)*a)/c,c=Math.sin(e*a)/c;return this._w=o*s+this._w*c,this._x=r*s+this._x*c,this._y=n*s+this._y*c,this._z=i*s+this._z*c,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(c.prototype,{isVector3:!0,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new s;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new s;return function(e,r){return this.applyQuaternion(t.setFromAxisAngle(e,r))}}(),applyMatrix3:function(t){var e=this.x,r=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*n,this.y=t[1]*e+t[4]*r+t[7]*n,this.z=t[2]*e+t[5]*r+t[8]*n,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=1/((t=t.elements)[3]*e+t[7]*r+t[11]*n+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*n+t[12])*i,this.y=(t[1]*e+t[5]*r+t[9]*n+t[13])*i,this.z=(t[2]*e+t[6]*r+t[10]*n+t[14])*i,this},applyQuaternion:function(t){var e=this.x,r=this.y,n=this.z,i=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*n-a*r,c=t*r+a*e-i*n,u=t*n+i*r-o*e,e=-i*e-o*r-a*n;return this.x=s*t+e*-i+c*-a-u*-o,this.y=c*t+e*-o+u*-i-s*-a,this.z=u*t+e*-a+s*-o-c*-i,this},project:function(){var t=new u;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new u;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*n,this.y=t[1]*e+t[5]*r+t[9]*n,this.z=t[2]*e+t[6]*r+t[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new c,e=new c;return function(r,n){return t.set(r,r,r),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return 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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.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()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,n=this.y,i=this.z;return this.x=n*t.z-i*t.y,this.y=i*t.x-r*t.z,this.z=r*t.y-n*t.x,this},crossVectors:function(t,e){var r=t.x,n=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-i*a,this.y=i*o-r*s,this.z=r*a-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new c;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new c;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(xi.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return t=this.z-t.z,e*e+r*r+t*t},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return t=t.elements,this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length();return t=this.setFromMatrixColumn(t,2).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(u.prototype,{isMatrix4:!0,set:function(t,e,r,n,i,o,a,s,c,u,h,l,p,f,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=n,v[1]=i,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=u,v[10]=h,v[14]=l,v[3]=p,v[7]=f,v[11]=d,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new u).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t=new c;return function(e){var r=this.elements,n=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length();return e=1/t.setFromMatrixColumn(e,2).length(),r[0]=n[0]*i,r[1]=n[1]*i,r[2]=n[2]*i,r[4]=n[4]*o,r[5]=n[5]*o,r[6]=n[6]*o,r[8]=n[8]*e,r[9]=n[9]*e,r[10]=n[10]*e,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,n=t.y,i=t.z,o=Math.cos(r),r=Math.sin(r),a=Math.cos(n),n=Math.sin(n),s=Math.cos(i),i=Math.sin(i);if("XYZ"===t.order){t=o*s;var c=o*i,u=r*s,h=r*i;e[0]=a*s,e[4]=-a*i,e[8]=n,e[1]=c+u*n,e[5]=t-h*n,e[9]=-r*a,e[2]=h-t*n,e[6]=u+c*n,e[10]=o*a}else"YXZ"===t.order?(t=a*s,c=a*i,u=n*s,h=n*i,e[0]=t+h*r,e[4]=u*r-c,e[8]=o*n,e[1]=o*i,e[5]=o*s,e[9]=-r,e[2]=c*r-u,e[6]=h+t*r,e[10]=o*a):"ZXY"===t.order?(t=a*s,c=a*i,u=n*s,h=n*i,e[0]=t-h*r,e[4]=-o*i,e[8]=u+c*r,e[1]=c+u*r,e[5]=o*s,e[9]=h-t*r,e[2]=-o*n,e[6]=r,e[10]=o*a):"ZYX"===t.order?(t=o*s,c=o*i,u=r*s,h=r*i,e[0]=a*s,e[4]=u*n-c,e[8]=t*n+h,e[1]=a*i,e[5]=h*n+t,e[9]=c*n-u,e[2]=-n,e[6]=r*a,e[10]=o*a):"YZX"===t.order?(t=o*a,c=o*n,u=r*a,h=r*n,e[0]=a*s,e[4]=h-t*i,e[8]=u*i+c,e[1]=i,e[5]=o*s,e[9]=-r*s,e[2]=-n*s,e[6]=c*i+u,e[10]=t-h*i):"XZY"===t.order&&(t=o*a,c=o*n,u=r*a,h=r*n,e[0]=a*s,e[4]=-i,e[8]=n*s,e[1]=t*i+h,e[5]=o*s,e[9]=c*i-u,e[2]=u*i-c,e[6]=r*s,e[10]=h*i+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t._x,n=t._y,i=t._z,o=t._w,a=i+i;t=r*(u=r+r);var s=r*(h=n+n),r=r*a,c=n*h,n=n*a,i=i*a,u=o*u,h=o*h,o=o*a;return e[0]=1-(c+i),e[4]=s-o,e[8]=r+h,e[1]=s+o,e[5]=1-(t+i),e[9]=n-u,e[2]=r-h,e[6]=n+u,e[10]=1-(t+c),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new c,e=new c,r=new c;return function(n,i,o){var a=this.elements;return r.subVectors(n,i),0===r.lengthSq()&&(r.z=1),r.normalize(),t.crossVectors(o,r),0===t.lengthSq()&&(1===Math.abs(o.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),t.crossVectors(o,r)),t.normalize(),e.crossVectors(r,t),a[0]=t.x,a[4]=e.x,a[8]=r.x,a[1]=t.y,a[5]=e.y,a[9]=r.y,a[2]=t.z,a[6]=e.z,a[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,o=r[0],a=r[4],s=r[8],c=r[12],u=r[1],h=r[5],l=r[9],p=r[13],f=r[2],d=r[6],m=r[10],v=r[14],g=r[3],y=r[7],b=r[11],r=r[15],_=n[0],x=n[4],w=n[8],S=n[12],M=n[1],E=n[5],T=n[9],C=n[13],O=n[2],P=n[6],A=n[10],j=n[14],R=n[3],L=n[7],N=n[11],n=n[15];return i[0]=o*_+a*M+s*O+c*R,i[4]=o*x+a*E+s*P+c*L,i[8]=o*w+a*T+s*A+c*N,i[12]=o*S+a*C+s*j+c*n,i[1]=u*_+h*M+l*O+p*R,i[5]=u*x+h*E+l*P+p*L,i[9]=u*w+h*T+l*A+p*N,i[13]=u*S+h*C+l*j+p*n,i[2]=f*_+d*M+m*O+v*R,i[6]=f*x+d*E+m*P+v*L,i[10]=f*w+d*T+m*A+v*N,i[14]=f*S+d*C+m*j+v*n,i[3]=g*_+y*M+b*O+r*R,i[7]=g*x+y*E+b*P+r*L,i[11]=g*w+y*T+b*A+r*N,i[15]=g*S+y*C+b*j+r*n,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var r=0,n=e.count;rthis.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],e.copy(this),r=1/a;var o=1/s,u=1/c;return e.elements[0]*=r,e.elements[1]*=r,e.elements[2]*=r,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=u,e.elements[9]*=u,e.elements[10]*=u,n.setFromRotationMatrix(e),i.x=a,i.y=s,i.z=c,this}}(),makePerspective:function(t,e,r,n,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements;return a[0]=2*i/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*i/(r-n),a[9]=(r+n)/(r-n),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+i)/(o-i),a[14]=-2*o*i/(o-i),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,r,n,i,o){var a=this.elements,s=1/(e-t),c=1/(r-n),u=1/(o-i);return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-(e+t)*s,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-(r+n)*c,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-(o+i)*u,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;16>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;16>r;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}}),h.prototype=Object.create(n.prototype),h.prototype.constructor=h,h.prototype.isDataTexture=!0,(l.prototype=Object.create(n.prototype)).constructor=l,l.prototype.isCubeTexture=!0,Object.defineProperty(l.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Si=new n,Mi=new l,Ei=[],Ti=[],Ci=new Float32Array(16),Oi=new Float32Array(9);z.prototype.setValue=function(t,e){for(var r=this.seq,n=0,i=r.length;n!==i;++n){var o=r[n];o.setValue(t,e[o.id])}};var Pi=/([\w\d_]+)(\])?(\[|\.)?/g;G.prototype.setValue=function(t,e,r){void 0!==(e=this.map[e])&&e.setValue(t,r,this.renderer)},G.prototype.setOptional=function(t,e,r){void 0!==(e=e[r])&&this.setValue(t,r,e)},G.upload=function(t,e,r,n){for(var i=0,o=e.length;i!==o;++i){var a=e[i],s=r[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,n)}},G.seqWithValue=function(t,e){for(var r=[],n=0,i=t.length;n!==i;++n){var o=t[n];o.id in e&&r.push(o)}return r};var Ai={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,darkolivegreen: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,grey: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,lime: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,palegreen: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,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign($.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.b=this.g=this.r=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return 0>r&&(r+=1),1r?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,n){return e=xi.euclideanModulo(e,1),r=xi.clamp(r,0,1),n=xi.clamp(n,0,1),0===r?this.r=this.g=this.b=n:(r=.5>=n?n*(1+r):n+r-n*r,n=2*n-r,this.r=t(n,r,e+1/3),this.g=t(n,r,e),this.b=t(n,r,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){n=r[2];switch(r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n)){var n=parseFloat(r[1])/360,i=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(n,i,o)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(r=r[1],3===(n=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===n)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0=a?s/(o+c):s/(2-o-c);switch(o){case r:e=(n-i)/s+(n 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\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\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = asin( flipNormal * reflectVec.y ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\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#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\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\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\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\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\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\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\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\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#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\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\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\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\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\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\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},Ni={basic:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.fog]),vertexShader:Li.meshbasic_vert,fragmentShader:Li.meshbasic_frag},lambert:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.fog,ji.lights,{emissive:{value:new $(0)}}]),vertexShader:Li.meshlambert_vert,fragmentShader:Li.meshlambert_frag},phong:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.bumpmap,ji.normalmap,ji.displacementmap,ji.gradientmap,ji.fog,ji.lights,{emissive:{value:new $(0)},specular:{value:new $(1118481)},shininess:{value:30}}]),vertexShader:Li.meshphong_vert,fragmentShader:Li.meshphong_frag},standard:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.bumpmap,ji.normalmap,ji.displacementmap,ji.roughnessmap,ji.metalnessmap,ji.fog,ji.lights,{emissive:{value:new $(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag},points:{uniforms:Ri.merge([ji.points,ji.fog]),vertexShader:Li.points_vert,fragmentShader:Li.points_frag},dashed:{uniforms:Ri.merge([ji.common,ji.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Li.linedashed_vert,fragmentShader:Li.linedashed_frag},depth:{uniforms:Ri.merge([ji.common,ji.displacementmap]),vertexShader:Li.depth_vert,fragmentShader:Li.depth_frag},normal:{uniforms:Ri.merge([ji.common,ji.bumpmap,ji.normalmap,ji.displacementmap,{opacity:{value:1}}]),vertexShader:Li.normal_vert,fragmentShader:Li.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Li.cube_vert,fragmentShader:Li.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Li.equirect_vert,fragmentShader:Li.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new c}},vertexShader:Li.distanceRGBA_vert,fragmentShader:Li.distanceRGBA_frag}};Ni.physical={uniforms:Ri.merge([Ni.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag},Object.assign(V.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new r).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new r).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Ii=0;Object.assign(W.prototype,e.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0===r)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else{var n=this[e];void 0===n?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[e]="overdraw"===e?Number(r):r}}},toJSON:function(t){function e(t){var e,r=[];for(e in t){var n=t[e];delete n.metadata,r.push(n)}return r}var r=void 0===t;r&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};return n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),2!==this.shading&&(n.shading=this.shading),0!==this.side&&(n.side=this.side),0!==this.vertexColors&&(n.vertexColors=this.vertexColors),1>this.opacity&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,0i&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,r,n),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;si&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,r,n),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new c).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t=new c;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return 0=t.constant},clampPoint:function(t,e){return(e||new c).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new c;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new c;return function(e){return e=e||new Z,this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new c,new c,new c,new c,new c,new c,new c,new c];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Z.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new K;return function(e,r){var n=this.center;void 0!==r?n.copy(r):t.setFromPoints(e).getCenter(n);for(var i=0,o=0,a=e.length;o=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),n=e||new c;return n.copy(t),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){return(t=t||new K).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(J.prototype,{isMatrix3:!0,set:function(t,e,r,n,i,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=i,u[5]=s,u[6]=r,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},setFromMatrix4:function(t){return t=t.elements,this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var r=0,n=e.count;rr;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;9>r;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}}),Object.assign(Q.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,n){return this.normal.set(t,e,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new c,e=new c;return function(r,n,i){return n=t.subVectors(i,n).cross(e.subVectors(r,n)).normalize(),this.setFromNormalAndCoplanarPoint(n,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new c).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new c;return function(e,r){var n=r||new c,i=e.delta(t),o=this.normal.dot(i);return 0!==o?0>(o=-(e.start.dot(this.normal)+this.constant)/o)||1e&&0t&&0r;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(v=t.elements)[0];var r=v[1],n=v[2],i=v[3],o=v[4],a=v[5],s=v[6],c=v[7],u=v[8],h=v[9],l=v[10],p=v[11],f=v[12],d=v[13],m=v[14],v=v[15];return e[0].setComponents(i-t,c-o,p-u,v-f).normalize(),e[1].setComponents(i+t,c+o,p+u,v+f).normalize(),e[2].setComponents(i+r,c+a,p+h,v+d).normalize(),e[3].setComponents(i-r,c-a,p-h,v-d).normalize(),e[4].setComponents(i-n,c-s,p-l,v-m).normalize(),e[5].setComponents(i+n,c+s,p+l,v+m).normalize(),this},intersectsObject:function(){var t=new Z;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new Z;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var n=0;6>n;n++)if(e[n].distanceToPoint(r)i;i++){a=n[i];t.x=0o&&0>a)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;6>r;r++)if(0>e[r].distanceToPoint(t))return!1;return!0}}),nt.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),nt.DefaultOrder="XYZ",Object.defineProperties(nt.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(nt.prototype,{isEuler:!0,set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var n=xi.clamp;t=(l=t.elements)[0];var i=l[4],o=l[8],a=l[1],s=l[5],c=l[9],u=l[2],h=l[6],l=l[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-c,l),this._z=Math.atan2(-i,t)):(this._x=Math.atan2(h,s),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(c,-1,1)),.99999>Math.abs(c)?(this._y=Math.atan2(o,l),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-u,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(-u,l),this._z=Math.atan2(-i,s)):(this._y=0,this._z=Math.atan2(a,t))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(h,l),this._z=Math.atan2(a,t)):(this._x=0,this._z=Math.atan2(-i,s))):"YZX"===e?(this._z=Math.asin(n(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-c,s),this._y=Math.atan2(-u,t)):(this._x=0,this._y=Math.atan2(o,l))):"XZY"===e?(this._z=Math.asin(-n(i,-1,1)),.99999>Math.abs(i)?(this._x=Math.atan2(h,s),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-c,l),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new u;return function(e,r,n){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new s;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(it.prototype,{set:function(t){this.mask=1<t;t++)if(a[t]===a[(t+1)%3]){n.push(e);break}for(e=n.length-1;0<=e;e--)for(a=n[e],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;on?r.copy(this.origin):r.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new c;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new c,e=new c,r=new c;return function(n,i,o,a){t.copy(n).add(i).multiplyScalar(.5),e.copy(i).sub(n).normalize(),r.copy(this.origin).sub(t);var s,c=.5*n.distanceTo(i),u=-this.direction.dot(e),h=r.dot(this.direction),l=-r.dot(e),p=r.lengthSq(),f=Math.abs(1-u*u);return 0=-s?i<=s?(c=1/f,n*=c,i*=c,u=n*(n+u*i+2*h)+i*(u*n+i+2*l)+p):(i=c,n=Math.max(0,-(u*i+h)),u=-n*n+i*(i+2*l)+p):(i=-c,n=Math.max(0,-(u*i+h)),u=-n*n+i*(i+2*l)+p):i<=-s?(n=Math.max(0,-(-u*c+h)),i=0o?null:(o=Math.sqrt(o-i),i=n-o,n+=o,0>i&&0>n?null:0>i?this.at(n,r):this.at(i,r))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(t.normal)+t.constant)/e)?t:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var r,n,i,o,a;n=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=n?(r=(t.min.x-s.x)*n,n*=t.max.x-s.x):(r=(t.max.x-s.x)*n,n*=t.min.x-s.x),0<=o?(i=(t.min.y-s.y)*o,o*=t.max.y-s.y):(i=(t.max.y-s.y)*o,o*=t.min.y-s.y),r>o||i>n?null:((i>r||r!==r)&&(r=i),(oa||i>n?null:((i>r||r!==r)&&(r=i),(an?null:this.at(0<=r?r:n,e)))},intersectsBox:function(){var t=new c;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new c,e=new c,r=new c,n=new c;return function(i,o,a,s,c){if(e.subVectors(o,i),r.subVectors(a,i),n.crossVectors(e,r),0<(o=this.direction.dot(n))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,i),0>(i=s*this.direction.dot(r.crossVectors(t,r)))?null:0>(a=s*this.direction.dot(e.cross(t)))||i+a>o?null:0>(i=-s*t.dot(n))?null:this.at(i/o,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(At.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new c).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new c).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new c;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new c,e=new c;return function(r,n){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var i=e.dot(e),i=e.dot(t)/i;return n&&(i=xi.clamp(i,0,1)),i}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new c,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(jt,{normal:function(){var t=new c;return function(e,r,n,i){return(i=i||new c).subVectors(n,r),t.subVectors(e,r),i.cross(t),0<(e=i.lengthSq())?i.multiplyScalar(1/Math.sqrt(e)):i.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new c,e=new c,r=new c;return function(n,i,o,a,s){t.subVectors(a,i),e.subVectors(o,i),r.subVectors(n,i),n=t.dot(t),i=t.dot(e),o=t.dot(r);var u=e.dot(e);a=e.dot(r);var h=n*u-i*i;return s=s||new c,0===h?s.set(-2,-1,-1):(h=1/h,u=(u*o-i*a)*h,n=(n*a-i*o)*h,s.set(1-u-n,n,u))}}(),containsPoint:function(){var t=new c;return function(e,r,n,i){return 0<=(e=jt.barycoordFromPoint(e,r,n,i,t)).x&&0<=e.y&&1>=e.x+e.y}}()}),Object.assign(jt.prototype,{set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,n){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new c,e=new c;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new c).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return jt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new Q).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return jt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return jt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new Q,e=[new At,new At,new At],r=new c,n=new c;return function(i,o){var a=o||new c,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,r),!0===this.containsPoint(r))a.copy(r);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;ue.far?null:{distance:r,point:_.clone(),object:t})}function n(r,n,i,o,a,c,u,p){return s.fromBufferAttribute(o,c),h.fromBufferAttribute(o,u),l.fromBufferAttribute(o,p),(r=e(r,n,i,s,h,l,b))&&(a&&(m.fromBufferAttribute(a,c),v.fromBufferAttribute(a,u),g.fromBufferAttribute(a,p),r.uv=t(b,s,h,l,m,v,g)),r.face=new ut(c,u,p,jt.normal(s,h,l)),r.faceIndex=c),r}var i=new u,o=new Pt,a=new Z,s=new c,h=new c,l=new c,p=new c,f=new c,d=new c,m=new r,v=new r,g=new r,y=new c,b=new c,_=new c;return function(r,c){var u=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===u.boundingSphere&&u.computeBoundingSphere(),a.copy(u.boundingSphere),a.applyMatrix4(_),!1!==r.ray.intersectsSphere(a)&&(i.getInverse(_),o.copy(r.ray).applyMatrix4(i),null===u.boundingBox||!1!==o.intersectsBox(u.boundingBox)))){var x;if(u.isBufferGeometry){var w,S,M,E,y=u.index,T=u.attributes.position,_=u.attributes.uv;if(null!==y)for(M=0,E=y.count;Mo||(o=n.ray.origin.distanceTo(t))n.far||i.push({distance:o,point:t.clone(),face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ye.prototype=Object.assign(Object.create(ot.prototype),{constructor:ye,copy:function(t){ot.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e=n[i].distance;i++)n[i-1].object.visible=!1,n[i].object.visible=!0;for(;io||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))n.far||i.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,m=d.length/3-1;ao||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))n.far||i.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a.isGeometry)for(u=a.vertices,h=u.length,a=0;ao||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))n.far||i.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Me.prototype=Object.assign(Object.create(Se.prototype),{constructor:Me,isLineSegments:!0}),Ee.prototype=Object.assign(Object.create(Se.prototype),{constructor:Ee,isLineLoop:!0}),Te.prototype=Object.create(W.prototype),Te.prototype.constructor=Te,Te.prototype.isPointsMaterial=!0,Te.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Ce.prototype=Object.assign(Object.create(ot.prototype),{constructor:Ce,isPoints:!0,raycast:function(){var t=new u,e=new Pt,r=new Z;return function(n,i){function o(t,r){var o=e.distanceSqToPoint(t);if(on.far||i.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,u=this.matrixWorld,h=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(u),r.radius+=h,!1!==n.ray.intersectsSphere(r)){t.getInverse(u),e.copy(n.ray).applyMatrix4(t);var l=(h=h/((this.scale.x+this.scale.y+this.scale.z)/3))*h,h=new c;if(s.isBufferGeometry){var p=s.index,s=s.attributes.position.array;if(null!==p)for(var f=p.array,p=0,d=f.length;pr)return null;var n,i,o,a=[],s=[],c=[];if(0=u--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(n=i)&&(n=0),r<=(i=n+1)&&(i=0),r<=(o=i+1)&&(o=0);var h;t:{var l,p,f,d,m,v,g,y;if(l=t[s[n]].x,p=t[s[n]].y,f=t[s[i]].x,d=t[s[i]].y,m=t[s[o]].x,v=t[s[o]].y,0>=(f-l)*(v-p)-(d-p)*(m-l))h=!1;else{var b,_,x,w,S,M,E,T,C,O;for(b=m-f,_=v-d,x=l-m,w=p-v,S=f-l,M=d-p,h=0;h=-Number.EPSILON&&T>=-Number.EPSILON&&E>=-Number.EPSILON)){h=!1;break t}h=!0}}if(h){for(a.push([t[s[n]],t[s[i]],t[s[o]]]),c.push([s[n],s[i],s[o]]),n=i,o=i+1;oNumber.EPSILON){if(0f||f>p)return[];if(0>(c=u*h-c*l)||c>p)return[]}else{if(0r?[]:c===r?o?[]:[a]:t<=r?[a,s]:[a,u]))}function o(t,e,r,n){var i=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var a=n.x-t.x;return n=n.y-t.y,t=i*r-o*e,i=i*n-o*a,Math.abs(t)>Number.EPSILON?(e=a*r-n*e,0--g){console.log("Infinite Loop! Holes left:"+d.length+", Probably Hole outside Shape!");break}for(a=h;ai&&(i=n);var a=t+1;return a>n&&(a=0),!!(n=o(f[t],f[i],f[a],r[e]))&&(n=r.length-1,0>(i=e-1)&&(i=n),(a=e+1)>n&&(a=0),!!(n=o(r[e],r[i],r[a],f[t])))}(a,l)&&!function(t,e){var r,n;for(r=0;rc;c++)h=u[c].x+":"+u[c].y,void 0!==(h=l[h])&&(u[c]=h);return p.concat()},isClockWise:function(t){return 0>Bi.area(t)}};(Je.prototype=Object.create(ht.prototype)).constructor=Je,Qe.prototype=Object.create(St.prototype),Qe.prototype.constructor=Qe,Qe.prototype.getArrays=function(){var t=(t=this.getAttribute("position"))?Array.prototype.slice.call(t.array):[],e=(e=this.getAttribute("uv"))?Array.prototype.slice.call(e.array):[],r=this.index;return{position:t,uv:e,index:r=r?Array.prototype.slice.call(r.array):[]}},Qe.prototype.addShapeList=function(t,e){var r=t.length;e.arrays=this.getArrays();for(var n=0;nNumber.EPSILON){var u=Math.sqrt(c),h=Math.sqrt(i*i+s*s),c=e.x-a/u;if(e=e.y+o/u,s=((n.x-s/h-c)*s-(n.y+i/h-e)*i)/(o*s-a*i),i=c+o*s-t.x,o=e+a*s-t.y,2>=(a=i*i+o*o))return new r(i,o);a=Math.sqrt(a/2)}else t=!1,o>Number.EPSILON?i>Number.EPSILON&&(t=!0):o<-Number.EPSILON?i<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(s)&&(t=!0),t?(i=-a,a=Math.sqrt(c)):(i=o,o=a,a=Math.sqrt(c/2));return new r(i/a,o/a)}function o(t,e){var r,n;for(H=t.length;0<=--H;){r=H,0>(n=H-1)&&(n=t.length-1);var i,o=T+2*S;for(i=0;iMath.abs(s-u)?[new r(t,1-n),new r(c,1-i),new r(h,1-o),new r(p,1-e)]:[new r(s,1-n),new r(u,1-i),new r(l,1-o),new r(f,1-e)]}},(tr.prototype=Object.create(ht.prototype)).constructor=tr,(er.prototype=Object.create(Qe.prototype)).constructor=er,(rr.prototype=Object.create(ht.prototype)).constructor=rr,nr.prototype=Object.create(St.prototype),nr.prototype.constructor=nr,(ir.prototype=Object.create(ht.prototype)).constructor=ir,(or.prototype=Object.create(St.prototype)).constructor=or,(ar.prototype=Object.create(ht.prototype)).constructor=ar,(sr.prototype=Object.create(St.prototype)).constructor=sr,(cr.prototype=Object.create(ht.prototype)).constructor=cr,(ur.prototype=Object.create(St.prototype)).constructor=ur,(hr.prototype=Object.create(St.prototype)).constructor=hr,lr.prototype=Object.create(ht.prototype),lr.prototype.constructor=lr,pr.prototype=Object.create(St.prototype),pr.prototype.constructor=pr,(fr.prototype=Object.create(lr.prototype)).constructor=fr,(dr.prototype=Object.create(pr.prototype)).constructor=dr,(mr.prototype=Object.create(ht.prototype)).constructor=mr,(vr.prototype=Object.create(St.prototype)).constructor=vr;var Ui=Object.freeze({WireframeGeometry:Le,ParametricGeometry:Ne,ParametricBufferGeometry:Ie,TetrahedronGeometry:Fe,TetrahedronBufferGeometry:Be,OctahedronGeometry:Ue,OctahedronBufferGeometry:ze,IcosahedronGeometry:Ge,IcosahedronBufferGeometry:$e,DodecahedronGeometry:Ve,DodecahedronBufferGeometry:He,PolyhedronGeometry:De,PolyhedronBufferGeometry:ke,TubeGeometry:qe,TubeBufferGeometry:We,TorusKnotGeometry:Xe,TorusKnotBufferGeometry:Ye,TorusGeometry:Ke,TorusBufferGeometry:Ze,TextGeometry:tr,TextBufferGeometry:er,SphereGeometry:rr,SphereBufferGeometry:nr,RingGeometry:ir,RingBufferGeometry:or,PlaneGeometry:Tt,PlaneBufferGeometry:Ct,LatheGeometry:ar,LatheBufferGeometry:sr,ShapeGeometry:cr,ShapeBufferGeometry:ur,ExtrudeGeometry:Je,ExtrudeBufferGeometry:Qe,EdgesGeometry:hr,ConeGeometry:fr,ConeBufferGeometry:dr,CylinderGeometry:lr,CylinderBufferGeometry:pr,CircleGeometry:mr,CircleBufferGeometry:vr,BoxGeometry:Mt,BoxBufferGeometry:Et});(gr.prototype=Object.create(X.prototype)).constructor=gr,gr.prototype.isShadowMaterial=!0,(yr.prototype=Object.create(X.prototype)).constructor=yr,yr.prototype.isRawShaderMaterial=!0,br.prototype=Object.create(W.prototype),br.prototype.constructor=br,br.prototype.isMeshStandardMaterial=!0,br.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(_r.prototype=Object.create(br.prototype)).constructor=_r,_r.prototype.isMeshPhysicalMaterial=!0,_r.prototype.copy=function(t){return br.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},xr.prototype=Object.create(W.prototype),xr.prototype.constructor=xr,xr.prototype.isMeshPhongMaterial=!0,xr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(wr.prototype=Object.create(xr.prototype)).constructor=wr,wr.prototype.isMeshToonMaterial=!0,wr.prototype.copy=function(t){return xr.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},(Sr.prototype=Object.create(W.prototype)).constructor=Sr,Sr.prototype.isMeshNormalMaterial=!0,Sr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(Mr.prototype=Object.create(W.prototype)).constructor=Mr,Mr.prototype.isMeshLambertMaterial=!0,Mr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(Er.prototype=Object.create(W.prototype)).constructor=Er,Er.prototype.isLineDashedMaterial=!0,Er.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var zi=Object.freeze({ShadowMaterial:gr,SpriteMaterial:ve,RawShaderMaterial:yr,ShaderMaterial:X,PointsMaterial:Te,MeshPhysicalMaterial:_r,MeshStandardMaterial:br,MeshPhongMaterial:xr,MeshToonMaterial:wr,MeshNormalMaterial:Sr,MeshLambertMaterial:Mr,MeshDepthMaterial:Y,MeshBasicMaterial:Ot,LineDashedMaterial:Er,LineBasicMaterial:we,Material:W}),Gi={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},$i=new Tr;Object.assign(Cr.prototype,{load:function(t,e,r,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,o=Gi.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){e&&e(o),i.manager.itemEnd(t)},0),o;if(c=t.match(/^data:(.*?)(;base64)?,(.*)$/)){var a=c[1],s=!!c[2],c=c[3],c=window.decodeURIComponent(c);s&&(c=window.atob(c));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":u=new ArrayBuffer(c.length);for(var l=new Uint8Array(u),s=0;s=i)break t;for(t<(o=e[1])&&(r=2,i=o),o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(r===o)break;if(n=i,i=e[--r-1],t>=i)break e}n=r,r=0}for(;r>>1,te;)--o;return++o,0===i&&o===n||(i>=o&&(o=Math.max(o,1),i=o-1),n=this.getValueSize(),this.times=Vi.arraySlice(r,i,o),this.values=Vi.arraySlice(this.values,i*n,o*n)),this},validate:function(){var t=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),t=!1);var e=this.times,r=this.values,n=e.length;0===n&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),t=!1);for(var i=null,o=0;o!==n;o++){var a=e[o];if("number"==typeof a&&isNaN(a)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,o,a),t=!1;break}if(null!==i&&i>a){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,o,a,i),t=!1;break}i=a}if(void 0!==r&&Vi.isTypedArray(r))for(o=0,e=r.length;o!==e;++o)if(n=r[o],isNaN(n)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,o,n),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),n=2302===this.getInterpolation(),i=1,o=t.length-1,a=1;ah.opacity&&(h.transparent=!0),n.setTextures(u),n.parse(h)}}()}),Object.assign(sn.prototype,{load:function(t,e,r,n){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:an.prototype.extractUrlBase(t),a=new Cr(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(r){var n=(r=JSON.parse(r)).metadata;if(void 0!==n&&void 0!==(n=n.type)){if("object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}r=i.parse(r,o),e(r.geometry,r.materials)},r,n)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){void 0!==t.data&&(t=t.data),t.scale=void 0!==t.scale?1/t.scale:1;var n,o,a,s,u,h,l,p,f,d,m,v,g,y,b=new ht,_=t,x=_.faces;f=_.vertices;var w=_.normals,S=_.colors;h=_.scale;var M=0;if(void 0!==_.uvs){for(n=0;n<_.uvs.length;n++)_.uvs[n].length&&M++;for(n=0;no;o++)p=x[s++],y=g[2*p],p=g[2*p+1],y=new r(y,p),2!==o&&b.faceVertexUvs[n][a].push(y),0!==o&&b.faceVertexUvs[n][a+1].push(y);if(l&&(l=3*x[s++],d.normal.set(w[l++],w[l++],w[l]),v.normal.copy(d.normal)),m)for(n=0;4>n;n++)l=3*x[s++],m=new c(w[l++],w[l++],w[l]),2!==n&&d.vertexNormals.push(m),0!==n&&v.vertexNormals.push(m);if(h&&(h=x[s++],h=S[h],d.color.setHex(h),v.color.setHex(h)),f)for(n=0;4>n;n++)h=x[s++],h=S[h],2!==n&&d.vertexColors.push(new $(h)),0!==n&&v.vertexColors.push(new $(h));b.faces.push(d),b.faces.push(v)}else{if(d=new ut,d.a=x[s++],d.b=x[s++],d.c=x[s++],a&&(a=x[s++],d.materialIndex=a),a=b.faces.length,n)for(n=0;no;o++)p=x[s++],y=g[2*p],p=g[2*p+1],y=new r(y,p),b.faceVertexUvs[n][a].push(y);if(l&&(l=3*x[s++],d.normal.set(w[l++],w[l++],w[l])),m)for(n=0;3>n;n++)l=3*x[s++],m=new c(w[l++],w[l++],w[l]),d.vertexNormals.push(m);if(h&&(h=x[s++],d.color.setHex(S[h])),f)for(n=0;3>n;n++)h=x[s++],d.vertexColors.push(new $(S[h]));b.faces.push(d)}if(_=t,s=void 0!==_.influencesPerVertex?_.influencesPerVertex:2,_.skinWeights)for(u=0,x=_.skinWeights.length;u(a=i[r]-n))s=r+1;else{if(!(0e&&(e=0),1Number.EPSILON&&(h.normalize(),i=Math.acos(xi.clamp(o[r-1].dot(o[r]),-1,1)),a[r].applyMatrix4(l.makeRotationAxis(h,i))),s[r].crossVectors(o[r],a[r]);if(!0===e)for(i=Math.acos(xi.clamp(a[0].dot(a[t]),-1,1)),i/=t,0=e)return e=r[t]-e,t=this.curves[t],r=t.getLength(),t.getPointAt(0===r?0:1-e/r);t++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,n=this.curves.length;rn;)n+=e;for(;n>e;)n-=e;na.length-2?a.length-1:t+1],a=a[t>a.length-3?a.length-1:t+2];return new r(un(e,n.x,i.x,o.x,a.x),un(e,n.y,i.y,o.y,a.y))},(gn.prototype=Object.create(pn.prototype)).constructor=gn,gn.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,o=this.v3;return new r(ln(t,e.x,n.x,i.x,o.x),ln(t,e.y,n.y,i.y,o.y))},(yn.prototype=Object.create(pn.prototype)).constructor=yn,yn.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new r(hn(t,e.x,n.x,i.x),hn(t,e.y,n.y,i.y))};var Ki=Object.assign(Object.create(dn.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;eNumber.EPSILON){if(0>u&&(a=e[o],c=-c,s=e[i],u=-u),!(t.ys.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(0==(i=u*(t.x-a.x)-c*(t.y-a.y)))return!0;0>i||(n=!n)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return n})(f.p,l[m].p)&&(n!==m&&a.push({froms:n,tos:m,hole:u}),h?(h=!1,s[m].push(f)):d=!0);h&&s[n].push(f)}0n&&this._mixBufferRegion(r,t,3*e,1-n,e);for(var n=e,o=e+e;n!==o;++n)if(r[n]!==r[n+e]){i.setValue(r,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,r=3*e;this.binding.getValue(t,r);for(var n=e;n!==r;++n)t[n]=t[r+n%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,r,n,i){if(.5<=n)for(n=0;n!==i;++n)t[e+n]=t[r+n]},_slerp:function(t,e,r,n){s.slerpFlat(t,e,t,e,t,r,n)},_lerp:function(t,e,r,n,i){for(var o=1-n,a=0;a!==i;++a){var s=e+a;t[s]=t[s]*o+t[r+a]*n}}}),Object.assign(Rn.prototype,{getValue:function(t,e){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}}),Object.assign(Ln,{Composite:Rn,create:function(t,e,r){return t&&t.isAnimationObjectGroup?new Ln.Composite(t,e,r):new Ln(t,e,r)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var t=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),e=["material","materials","bones"];return function(r){var n=t.exec(r);if(!n)throw Error("PropertyBinding: Cannot parse trackName: "+r);var i=(n={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]}).nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var o=n.nodeName.substring(i+1);-1!==e.indexOf(o)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+r);return n}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r=r){var l=r++,p=e[l];for(n[p.uuid]=h,e[h]=p,n[u]=l,e[l]=c,c=0,u=o;c!==u;++c){var f=(p=i[c])[h];p[h]=p[l],p[l]=f}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var u=arguments[s].uuid,h=i[u];if(void 0!==h)if(delete i[u],h(e=(t-i)*r)||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants;for(var i=this._propertyBindings,o=0,a=e.length;o!==a;++o)e[o].evaluate(r),i[o].accumulate(n,t)}}else this._updateWeight(t)},_updateWeight:function(t){e=0;if(this.enabled){var e=this.weight,r=this._weightInterpolant;if(null!==r){var n=r.evaluate(t)[0],e=e*n;t>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){e=0;if(!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;if(null!==r){e=e*r.evaluate(t)[0];t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e},_updateTime:function(t){o=this.time+t;if(0===t)return o;var e=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r)t:{if(-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1)),o>=e)o=e;else{if(!(0>o))break t;o=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1})}else{if(r=2202===r,-1===n&&(0<=t?(n=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),o>=e||0>o){var i=Math.floor(o/e),o=o-e*i,n=n+Math.abs(i),a=this.repetitions-n;0>a?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,o=0t,this._setEndings(t,!t,r)):this._setEndings(!1,!1,r),this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i}))}if(r&&1==(1&n))return this.time=o,e-o}return this.time=o},_setEndings:function(t,e,r){var n=this._interpolantSettings;r?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(t,e,r){var n=this._mixer,i=n.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=n._lendControlInterpolant()),n=o.parameterPositions,o=o.sampleValues,n[0]=i,o[0]=e,n[1]=i+t,o[1]=r,this}}),Object.assign(Dn.prototype,e.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,n=t._clip.tracks,i=n.length,o=t._propertyBindings,a=t._interpolants,s=r.uuid,c=this._bindingsByRootAndName,u=c[s];for(void 0===u&&(u={},c[s]=u),c=0;c!==i;++c){var h=n[c],l=h.name,p=u[l];if(void 0===p){if(void 0!==(p=o[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,l));continue}++(p=new jn(Ln.create(r,l,e&&e._propertyBindings[c].binding.parsedPath),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,l)}o[c]=p,a[c].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.uuid,n=this._actionsByClip[r];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,r,e)}for(r=0,n=(e=t._propertyBindings).length;r!==n;++r){var i=e[r];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,n=e.length;r!==n;++r){var i=e[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&ts.end&&(s.end=o),e||(e=c)}}for(c in n)s=n[c],this.createAnimation(c,s.start,s.end,t);this.firstAnimation=e},Yn.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},Yn.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},Yn.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},Yn.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},Yn.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},Yn.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},Yn.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},Yn.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},Yn.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},Yn.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},Yn.prototype.update=function(t){for(var e=0,r=this.animationsList.length;en.duration||0>n.time)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),0>n.time&&(n.time=0,n.directionBackwards=!1)):(n.time%=n.duration,0>n.time&&(n.time+=n.duration));var o=n.start+xi.clamp(Math.floor(n.time/i),0,n.length-1),a=n.weight;o!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*a,this.morphTargetInfluences[o]=0,n.lastFrame=n.currentFrame,n.currentFrame=o),i=n.time%i/i,n.directionBackwards&&(i=1-i),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=i*a,this.morphTargetInfluences[n.lastFrame]=(1-i)*a):this.morphTargetInfluences[n.currentFrame]=a}}},(Kn.prototype=Object.create(ot.prototype)).constructor=Kn,Kn.prototype.isImmediateRenderObject=!0,(Zn.prototype=Object.create(Me.prototype)).constructor=Zn,Zn.prototype.update=function(){var t=new c,e=new c,r=new J;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,u=a=0,h=c.length;ur.y?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),hi.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},hi.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},(li.prototype=Object.create(Me.prototype)).constructor=li;var eo=new c,ro=new pi,no=new pi,io=new pi;fi.prototype=Object.create(pn.prototype),fi.prototype.constructor=fi,fi.prototype.getPoint=function(t){var e=this.points;t*=(a=e.length)-(this.closed?0:1),t-=s=Math.floor(t),this.closed?s+=0s&&(s=1),1e-4>a&&(a=s),1e-4>o&&(o=s),ro.initNonuniformCatmullRom(r.x,n.x,i.x,e.x,a,s,o),no.initNonuniformCatmullRom(r.y,n.y,i.y,e.y,a,s,o),io.initNonuniformCatmullRom(r.z,n.z,i.z,e.z,a,s,o)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,ro.initCatmullRom(r.x,n.x,i.x,e.x,a),no.initCatmullRom(r.y,n.y,i.y,e.y,a),io.initCatmullRom(r.z,n.z,i.z,e.z,a));return new c(ro.calc(t),no.calc(t),io.calc(t))},(di.prototype=Object.create(pn.prototype)).constructor=di,di.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2,i=this.v3;return new c(ln(t,e.x,r.x,n.x,i.x),ln(t,e.y,r.y,n.y,i.y),ln(t,e.z,r.z,n.z,i.z))},(mi.prototype=Object.create(pn.prototype)).constructor=mi,mi.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2;return new c(hn(t,e.x,r.x,n.x),hn(t,e.y,r.y,n.y),hn(t,e.z,r.z,n.z))},(vi.prototype=Object.create(pn.prototype)).constructor=vi,vi.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new c;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},(gi.prototype=Object.create(mn.prototype)).constructor=gi,pn.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(pn.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},yi.prototype=Object.create(fi.prototype),bi.prototype=Object.create(fi.prototype),_i.prototype=Object.create(fi.prototype),Object.assign(_i.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),ii.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},ti.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(V.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(K.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),At.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},xi.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(J.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(u.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new c),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,r,n,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,r,i,o)}}),Q.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},s.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Pt.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(_n.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Je(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new cr(this,t)}}),Object.assign(r.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(c.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,r){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(i.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),ht.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(ot.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(ye.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(be.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(pn.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),ct.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Lr.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(lt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(St.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(St.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(kn.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(W.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new $}}}),Object.defineProperties(xr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(X.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(le.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(le.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(et.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(t){t=1!==t,console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(o.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),On.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Mn).load(t,function(t){e.setBuffer(t)}),this},An.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},t.WebGLRenderTargetCube=a,t.WebGLRenderTarget=o,t.WebGLRenderer=le,t.ShaderLib=Ni,t.UniformsLib=ji,t.UniformsUtils=Ri,t.ShaderChunk=Li,t.FogExp2=pe,t.Fog=fe,t.Scene=de,t.LensFlare=me,t.Sprite=ge,t.LOD=ye,t.SkinnedMesh=xe,t.Skeleton=be,t.Bone=_e,t.Mesh=Rt,t.LineSegments=Me,t.LineLoop=Ee,t.Line=Se,t.Points=Ce,t.Group=Oe,t.VideoTexture=Pe,t.DataTexture=h,t.CompressedTexture=Ae,t.CubeTexture=l,t.CanvasTexture=je,t.DepthTexture=Re,t.Texture=n,t.CompressedTextureLoader=Or,t.DataTextureLoader=Pr,t.CubeTextureLoader=jr,t.TextureLoader=Rr,t.ObjectLoader=cn,t.MaterialLoader=nn,t.BufferGeometryLoader=on,t.DefaultLoadingManager=$i,t.LoadingManager=Tr,t.JSONLoader=sn,t.ImageLoader=Ar,t.FontLoader=Sn,t.FileLoader=Cr,t.Loader=an,t.Cache=Gi,t.AudioLoader=Mn,t.SpotLightShadow=Dr,t.SpotLight=kr,t.PointLight=Fr,t.RectAreaLight=Gr,t.HemisphereLight=Nr,t.DirectionalLightShadow=Br,t.DirectionalLight=Ur,t.AmbientLight=zr,t.LightShadow=Ir,t.Light=Lr,t.StereoCamera=En,t.PerspectiveCamera=ct,t.OrthographicCamera=st,t.CubeCamera=Tn,t.ArrayCamera=se,t.Camera=at,t.AudioListener=Cn,t.PositionalAudio=Pn,t.AudioContext=Ji,t.AudioAnalyser=An,t.Audio=On,t.VectorKeyframeTrack=Xr,t.StringKeyframeTrack=Jr,t.QuaternionKeyframeTrack=Kr,t.NumberKeyframeTrack=Zr,t.ColorKeyframeTrack=tn,t.BooleanKeyframeTrack=Qr,t.PropertyMixer=jn,t.PropertyBinding=Ln,t.KeyframeTrack=en,t.AnimationUtils=Vi,t.AnimationObjectGroup=Nn,t.AnimationMixer=Dn,t.AnimationClip=rn,t.Uniform=kn,t.InstancedBufferGeometry=Fn,t.BufferGeometry=St,t.GeometryIdCount=function(){return ki++},t.Geometry=ht,t.InterleavedBufferAttribute=Bn,t.InstancedInterleavedBuffer=zn,t.InterleavedBuffer=Un,t.InstancedBufferAttribute=Gn,t.Face3=ut,t.Object3D=ot,t.Raycaster=$n,t.Layers=it,t.EventDispatcher=e,t.Clock=qn,t.QuaternionLinearInterpolant=Yr,t.LinearInterpolant=Hr,t.DiscreteInterpolant=qr,t.CubicInterpolant=Vr,t.Interpolant=$r,t.Triangle=jt,t.Math=xi,t.Spherical=Wn,t.Cylindrical=Xn,t.Plane=Q,t.Frustum=tt,t.Sphere=Z,t.Ray=Pt,t.Matrix4=u,t.Matrix3=J,t.Box3=K,t.Box2=V,t.Line3=At,t.Euler=nt,t.Vector4=i,t.Vector3=c,t.Vector2=r,t.Quaternion=s,t.Color=$,t.MorphBlendMesh=Yn,t.ImmediateRenderObject=Kn,t.VertexNormalsHelper=Zn,t.SpotLightHelper=Jn,t.SkeletonHelper=ti,t.PointLightHelper=ei,t.RectAreaLightHelper=ri,t.HemisphereLightHelper=ni,t.GridHelper=ii,t.PolarGridHelper=oi,t.FaceNormalsHelper=ai,t.DirectionalLightHelper=si,t.CameraHelper=ci,t.BoxHelper=ui,t.ArrowHelper=hi,t.AxisHelper=li,t.CatmullRomCurve3=fi,t.CubicBezierCurve3=di,t.QuadraticBezierCurve3=mi,t.LineCurve3=vi,t.ArcCurve=gi,t.EllipseCurve=mn,t.SplineCurve=vn,t.CubicBezierCurve=gn,t.QuadraticBezierCurve=yn,t.LineCurve=fn,t.Shape=_n,t.Path=bn,t.ShapePath=xn,t.Font=wn,t.CurvePath=dn,t.Curve=pn,t.ShapeUtils=Bi,t.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new Oe,n=0,i=e.length;n0)for(var r=this.length>>1;r>=0;r--)this._down(r)}function i(t,e){return te?1:0}e.exports=n,n.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return--this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length,i=n>>1,o=e[t];t=0)break;e[t]=c,t=a}e[t]=o}}},{}],178:[function(t,e,r){(function(){function t(t){function e(e,r,n,i,o,a){for(;o>=0&&o0?0:s-1;return arguments.length<3&&(i=r[a?a[c]:c],c+=t),e(r,n,i,a,c,s)}}function n(t){return function(e,r,n){r=w(r,n);for(var i=C(e),o=t>0?0:i-1;o>=0&&o0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(r&&o&&s)return o=r(n,i),n[o]===i?o:-1;if(i!==i)return(o=e(p.call(n,a,s),_.isNaN))>=0?o+a:-1;for(o=t>0?a:s-1;o>=0&&o=0&&e<=T};_.each=_.forEach=function(t,e,r){e=x(e,r);var n,i;if(O(t))for(n=0,i=t.length;n=0},_.invoke=function(t,e){var r=p.call(arguments,2),n=_.isFunction(e);return _.map(t,function(t){var i=n?e:t[e];return null==i?i:i.apply(t,r)})},_.pluck=function(t,e){return _.map(t,_.property(e))},_.where=function(t,e){return _.filter(t,_.matcher(e))},_.findWhere=function(t,e){return _.find(t,_.matcher(e))},_.max=function(t,e,r){var n,i,o=-1/0,a=-1/0;if(null==e&&null!=t)for(var s=0,c=(t=O(t)?t:_.values(t)).length;so&&(o=n);else e=w(e,r),_.each(t,function(t,r,n){((i=e(t,r,n))>a||i===-1/0&&o===-1/0)&&(o=t,a=i)});return o},_.min=function(t,e,r){var n,i,o=1/0,a=1/0;if(null==e&&null!=t)for(var s=0,c=(t=O(t)?t:_.values(t)).length;sn||void 0===r)return 1;if(re?(a&&(clearTimeout(a),a=null),s=u,o=t.apply(n,i),a||(n=i=null)):a||!1===r.trailing||(a=setTimeout(c,h)),o}},_.debounce=function(t,e,r){var n,i,o,a,s,c=function(){var u=_.now()-a;u=0?n=setTimeout(c,e-u):(n=null,r||(s=t.apply(o,i),n||(o=i=null)))};return function(){o=this,i=arguments,a=_.now();var u=r&&!n;return n||(n=setTimeout(c,e)),u&&(s=t.apply(o,i),o=i=null),s}},_.wrap=function(t,e){return _.partial(e,t)},_.negate=function(t){return function(){return!t.apply(this,arguments)}},_.compose=function(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}},_.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},_.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},_.once=_.partial(_.before,2);var R=!{toString:null}.propertyIsEnumerable("toString"),L=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];_.keys=function(t){if(!_.isObject(t))return[];if(v)return v(t);var e=[];for(var r in t)_.has(t,r)&&e.push(r);return R&&o(t,e),e},_.allKeys=function(t){if(!_.isObject(t))return[];var e=[];for(var r in t)e.push(r);return R&&o(t,e),e},_.values=function(t){for(var e=_.keys(t),r=e.length,n=Array(r),i=0;i":">",'"':""","'":"'","`":"`"},D=_.invert(I),k=function(t){var e=function(e){return t[e]},r="(?:"+_.keys(t).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(i,e):t}};_.escape=k(I),_.unescape=k(D),_.result=function(t,e,r){var n=null==t?void 0:t[e];return void 0===n&&(n=r),_.isFunction(n)?n.call(t):n};var F=0;_.uniqueId=function(t){var e=++F+"";return t?t+e:e},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var B=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\u2028|\u2029/g,G=function(t){return"\\"+U[t]};_.template=function(t,e,r){!e&&r&&(e=r),e=_.defaults({},e,_.templateSettings);var n=RegExp([(e.escape||B).source,(e.interpolate||B).source,(e.evaluate||B).source].join("|")+"|$","g"),i=0,o="__p+='";t.replace(n,function(e,r,n,a,s){return o+=t.slice(i,s).replace(z,G),i=s+e.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),e}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(e.variable||"obj","_",o)}catch(t){throw t.source=o,t}var s=function(t){return a.call(this,t,_)},c=e.variable||"obj";return s.source="function("+c+"){\n"+o+"}",s},_.chain=function(t){var e=_(t);return e._chain=!0,e};var $=function(t,e){return t._chain?_(e).chain():e};_.mixin=function(t){_.each(_.functions(t),function(e){var r=_[e]=t[e];_.prototype[e]=function(){var t=[this._wrapped];return l.apply(t,arguments),$(this,r.apply(_,t))}})},_.mixin(_),_.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=c[t];_.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],$(this,r)}}),_.each(["concat","join","slice"],function(t){var e=c[t];_.prototype[t]=function(){return $(this,e.apply(this._wrapped,arguments))}}),_.prototype.value=function(){return this._wrapped},_.prototype.valueOf=_.prototype.toJSON=_.prototype.value,_.prototype.toString=function(){return""+this._wrapped}}).call(this)},{}],179:[function(t,e,r){var n=t("./vdom/create-element.js");e.exports=n},{"./vdom/create-element.js":185}],180:[function(t,e,r){var n=t("./vtree/diff.js");e.exports=n},{"./vtree/diff.js":205}],181:[function(t,e,r){var n=t("./virtual-hyperscript/index.js");e.exports=n},{"./virtual-hyperscript/index.js":192}],182:[function(t,e,r){var n=t("./diff.js"),i=t("./patch.js"),o=t("./h.js"),a=t("./create-element.js"),s=t("./vnode/vnode.js"),c=t("./vnode/vtext.js");e.exports={diff:n,patch:i,h:o,create:a,VNode:s,VText:c}},{"./create-element.js":179,"./diff.js":180,"./h.js":181,"./patch.js":183,"./vnode/vnode.js":201,"./vnode/vtext.js":203}],183:[function(t,e,r){var n=t("./vdom/patch.js");e.exports=n},{"./vdom/patch.js":188}],184:[function(t,e,r){function n(t,e,r,n){if(n){var i=n[e];if(s(i))i.unhook&&i.unhook(t,e,r);else if("attributes"===e)for(var o in i)t.removeAttribute(o);else if("style"===e)for(var a in i)t.style[a]="";else t[e]="string"==typeof i?"":null}}function i(t,e,r,n,i){var s=r?r[n]:void 0;if("attributes"!==n)if(s&&a(s)&&o(s)!==o(i))t[n]=i;else{a(t[n])||(t[n]={});var c="style"===n?"":void 0;for(var u in i){var h=i[u];t[n][u]=void 0===h?c:h}}else for(var l in i){var p=i[l];void 0===p?t.removeAttribute(l):t.setAttribute(l,p)}}function o(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__?t.__proto__:t.constructor?t.constructor.prototype:void 0}var a=t("is-object"),s=t("../vnode/is-vhook.js");e.exports=function(t,e,r){for(var o in e){var c=e[o];void 0===c?n(t,o,c,r):s(c)?(n(t,o,c,r),c.hook&&c.hook(t,o,r?r[o]:void 0)):a(c)?i(t,0,r,o,c):t[o]=c}}},{"../vnode/is-vhook.js":196,"is-object":20}],185:[function(t,e,r){function n(t,e){var r=e?e.document||i:i,h=e?e.warn:null;if(t=u(t).a,c(t))return t.init();if(s(t))return r.createTextNode(t.text);if(!a(t))return h&&h("Item is not a valid virtual dom node",t),null;var l=null===t.namespace?r.createElement(t.tagName):r.createElementNS(t.namespace,t.tagName),p=t.properties;o(l,p);for(var f=t.children,d=0;d>0,i=t[n],o===a)return i>=e&&i<=r;if(ir))return!0;a=n-1}}return!1}function o(t,e){return t>e?1:-1}var a={};e.exports=function(t,e,r,i){return r&&0!==r.length?(r.sort(o),n(t,e,r,i,0)):{}}},{}],187:[function(t,e,r){function n(t,e){var r=t.parentNode;return r&&r.removeChild(t),c(t,e),null}function i(t,e,r){var n=r.render(e,r);return t&&t.appendChild(n),t}function o(t,e,r,n){var i;if(3===t.nodeType)t.replaceData(0,t.length,r.text),i=t;else{var o=t.parentNode;i=n.render(r,n),o&&i!==t&&o.replaceChild(i,t)}return i}function a(t,e,r,n){var i,o=d(e,r);i=o?r.update(e,t)||t:n.render(r,n);var a=t.parentNode;return a&&i!==t&&a.replaceChild(i,t),o||c(t,e),i}function s(t,e,r,n){var i=t.parentNode,o=n.render(r,n);return i&&o!==t&&i.replaceChild(o,t),o}function c(t,e){"function"==typeof e.destroy&&p(e)&&e.destroy(t)}function u(t,e){for(var r,n,i,o=t.childNodes,a={},s=0;s=c++?null:o[i.to])}function h(t,e){return t&&e&&t!==e&&t.parentNode&&t.parentNode.replaceChild(e,t),e}var l=t("./apply-properties"),p=t("../vnode/is-widget.js"),f=t("../vnode/vpatch.js"),d=t("./update-widget");e.exports=function(t,e,r){var c=t.type,p=t.vNode,d=t.patch;switch(c){case f.REMOVE:return n(e,p);case f.INSERT:return i(e,d,r);case f.VTEXT:return o(e,0,d,r);case f.WIDGET:return a(e,p,d,r);case f.VNODE:return s(e,0,d,r);case f.ORDER:return u(e,d),e;case f.PROPS:return l(e,d,p.properties),e;case f.THUNK:return h(e,r.patch(e,d,r));default:return e}}},{"../vnode/is-widget.js":199,"../vnode/vpatch.js":202,"./apply-properties":184,"./update-widget":189}],188:[function(t,e,r){function n(t,e,r){return r=r||{},r.patch=r.patch&&r.patch!==n?r.patch:i,r.render=r.render||u,r.patch(t,e,r)}function i(t,e,r){var n=a(e);if(0===n.length)return t;var i=h(t,e.a,n),c=t.ownerDocument;r.document||c===s||(r.document=c);for(var u=0;uh?u:h,f=0;f=i.length?e.length:i[c],g=0;g=v&&s.push(y)}for(var b,_=s.slice(),x=0,w=[],S=[],M=0;M>>0,s=a,c=[],u=0;u0){o.become(r),t._visitRemaining(e,u,r);break}r.visit(o,function(t){c=null,this.resolve(t)},function(t){this.resolved||(c.push(t),0==--s&&this.reject(c))})}else--s;return 0===s&&o.reject(new RangeError("any(): array must not be empty")),i},t.some=function(e,r){var n,i,o,a=t._defer(),s=a._handler,c=[],u=[],h=e.length>>>0,l=0;for(o=0;o(l=Math.min(r,l))?s.reject(new RangeError("some(): array must contain at least "+r+" item(s), but had "+l)):0===l&&s.resolve(c),o=0;o2?u.call(t,o(e),arguments[2]):u.call(t,o(e))},t.reduceRight=function(t,e){return arguments.length>2?h.call(t,o(e),arguments[2]):h.call(t,o(e))},t.prototype.spread=function(t){return this.then(c).then(function(e){return t.apply(this,e)})},t}})}(function(r){e.exports=r(t)})},{"../apply":209,"../state":222}],211:[function(t,e,r){!function(t){"use strict";t(function(){function t(){throw new TypeError("catch predicate must be a function")}function e(t,e){return r(e)?t instanceof e:e(t)}function r(t){return t===Error||null!=t&&t.prototype instanceof Error}function n(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function i(t){return t}return function(r){function o(t,r){return function(n){return e(n,r)?t.call(this,n):u(n)}}function a(t,e,r,i){var o=t.call(e);return n(o)?s(o,r,i):r(i)}function s(t,e,r){return c(t).then(function(){return e(r)})}var c=r.resolve,u=r.reject,h=r.prototype.catch;return r.prototype.done=function(t,e){this._handler.visit(this._handler.receiver,t,e)},r.prototype.catch=r.prototype.otherwise=function(e){return arguments.length<2?h.call(this,e):"function"!=typeof e?this.ensure(t):h.call(this,o(arguments[1],e))},r.prototype.finally=r.prototype.ensure=function(t){return"function"!=typeof t?this:this.then(function(e){return a(t,this,i,e)},function(e){return a(t,this,u,e)})},r.prototype.else=r.prototype.orElse=function(t){return this.then(void 0,function(){return t})},r.prototype.yield=function(t){return this.then(function(){return t})},r.prototype.tap=function(t){return this.then(t).yield(this)},r}})}(function(t){e.exports=t()})},{}],212:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.fold=function(e,r){var n=this._beget();return this._handler.fold(function(r,n,i){t._handler(r).fold(function(t,r,n){n.resolve(e.call(this,r,t))},n,this,i)},r,n._handler.receiver,n._handler),n},t}})}(function(t){e.exports=t()})},{}],213:[function(t,e,r){!function(t){"use strict";t(function(t){var e=t("../state").inspect;return function(t){return t.prototype.inspect=function(){return e(t._handler(this))},t}})}(function(r){e.exports=r(t)})},{"../state":222}],214:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){function e(t,n,i,o){function a(o,a){return r(i(o)).then(function(){return e(t,n,i,a)})}return r(o).then(function(e){return r(n(e)).then(function(n){return n?e:r(t(e)).spread(a)})})}var r=t.resolve;return t.iterate=function(t,r,n,i){return e(function(e){return[e,t(e)]},r,n,i)},t.unfold=e,t}})}(function(t){e.exports=t()})},{}],215:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.progress=function(t){return this.then(void 0,void 0,t)},t}})}(function(t){e.exports=t()})},{}],216:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t,e,n,i){return r.setTimer(function(){t(n,i,e)},e)}var r=t("../env"),n=t("../TimeoutError");return function(t){function i(t,r,n){e(o,t,r,n)}function o(t,e){e.resolve(t)}function a(t,e,r){var i=void 0===t?new n("timed out after "+r+"ms"):t;e.reject(i)}return t.prototype.delay=function(t){var e=this._beget();return this._handler.fold(i,t,void 0,e._handler),e},t.prototype.timeout=function(t,n){var i=this._beget(),o=i._handler,s=e(a,t,n,i._handler);return this._handler.visit(o,function(t){r.clearTimer(s),this.resolve(t)},function(t){r.clearTimer(s),this.reject(t)},o.notify),i},t}})}(function(r){e.exports=r(t)})},{"../TimeoutError":208,"../env":219}],217:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t){throw t}function r(){}var n=t("../env").setTimer,i=t("../format");return function(t){function o(t){t.handled||(f.push(t),h("Potentially unhandled rejection ["+t.id+"] "+i.formatError(t.value)))}function a(t){var e=f.indexOf(t);e>=0&&(f.splice(e,1),l("Handled previous rejection ["+t.id+"] "+i.formatObject(t.value)))}function s(t,e){p.push(t,e),null===d&&(d=n(c,0))}function c(){for(d=null;p.length>0;)p.shift()(p.shift())}var u,h=r,l=r;"undefined"!=typeof console&&(u=console,h=void 0!==u.error?function(t){u.error(t)}:function(t){u.log(t)},l=void 0!==u.info?function(t){u.info(t)}:function(t){u.log(t)}),t.onPotentiallyUnhandledRejection=function(t){s(o,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){s(a,t)},t.onFatalRejection=function(t){s(e,t.value)};var p=[],f=[],d=null;return t}})}(function(r){e.exports=r(t)})},{"../env":219,"../format":220}],218:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.with=t.prototype.withThis=function(t){var e=this._beget(),r=e._handler;return r.receiver=t,this._handler.chain(r,t),e},t}})}(function(t){e.exports=t()})},{}],219:[function(t,e,r){(function(r){!function(t){"use strict";t(function(t){var e,n="undefined"!=typeof setTimeout&&setTimeout,i=function(t,e){return setTimeout(t,e)},o=function(t){return clearTimeout(t)},a=function(t){return n(t,0)};if(void 0!==r&&"[object process]"===Object.prototype.toString.call(r))a=function(t){return r.nextTick(t)};else if(e="undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver)a=function(t){var e,r=document.createTextNode("");new t(function(){var t=e;e=void 0,t()}).observe(r,{characterData:!0});var n=0;return function(t){e=t,r.data=n^=1}}(e);else if(!n){var s=t("vertx");i=function(t,e){return s.setTimer(e,t)},o=s.cancelTimer,a=s.runOnLoop||s.runOnContext}return{setTimer:i,clearTimer:o,asap:a}})}(function(r){e.exports=r(t)})}).call(this,t("_process"))},{_process:6}],220:[function(t,e,r){!function(t){"use strict";t(function(){function t(t){var r=String(t);return"[object Object]"===r&&"undefined"!=typeof JSON&&(r=e(t,r)),r}function e(t,e){try{return JSON.stringify(t)}catch(t){return e}}return{formatError:function(e){var r="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:t(e);return e instanceof Error?r:r+" (WARNING: non-Error used)"},formatObject:t,tryStringify:e}})}(function(t){e.exports=t()})},{}],221:[function(t,e,r){(function(t){!function(e){"use strict";e(function(){return function(e){function r(t,e){this._handler=t===v?e:n(t)}function n(t){function e(t){r.reject(t)}var r=new y;try{t(function(t){r.resolve(t)},e,function(t){r.notify(t)})}catch(t){e(t)}return r}function i(t){return j(t)?t:new r(v,new b(f(t)))}function o(t){return new r(v,new b(new w(t)))}function a(){return K}function s(t,e){return new e(v,new y(t.receiver,t.join().context))}function c(t,e,n){function i(t,e,r){h[t]=e,0==--c&&r.become(new x(h))}for(var o,a="function"==typeof e?function(r,o,a){a.resolved||u(n,i,r,t(e,o,r),a)}:i,s=new y,c=n.length>>>0,h=new Array(c),l=0;l0?e(r,o.value,i):(i.become(o),h(t,r+1,o))}else e(r,n,i)}function h(t,e,r){for(var n=e;n0||"function"!=typeof e&&i<0)return new this.constructor(v,n);var o=this._beget(),a=o._handler;return n.chain(a,n.receiver,t,e,r),o},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype._beget=function(){return s(this._handler,this.constructor)},r.all=function(t){return c(z,null,t)},r.race=function(t){return"object"!=typeof t||null===t?o(new TypeError("non-iterable passed to race()")):0===t.length?a():1===t.length?i(t[0]):p(t)},r._traverse=function(t,e){return c(D,t,e)},r._visitRemaining=h,v.prototype.when=v.prototype.become=v.prototype.notify=v.prototype.fail=v.prototype._unreport=v.prototype._report=G,v.prototype._state=0,v.prototype.state=function(){return this._state},v.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},v.prototype.chain=function(t,e,r,n,i){this.when({resolver:t,receiver:e,fulfilled:r,rejected:n,progress:i})},v.prototype.visit=function(t,e,r,n){this.chain(X,t,e,r,n)},v.prototype.fold=function(t,e,r,n){this.when(new A(t,e,r,n))},U(v,g),g.prototype.become=function(t){t.fail()};var X=new g;U(v,y),y.prototype._state=0,y.prototype.resolve=function(t){this.become(f(t))},y.prototype.reject=function(t){this.resolved||this.become(new w(t))},y.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if((t=t.handler)===this)return this.handler=E();return t},y.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var r=0;r0?r(n.value):e(n.value)}}})}(function(t){e.exports=t()})},{}],223:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t,e,r,n){var i=m.resolve(t);return arguments.length<2?i:i.then(e,r,n)}function r(t){return function(){for(var e=0,r=arguments.length,n=new Array(r);e0?2*Math.atan(.5*n.basicWidth/(o*n.focal)):0;return[t._spatial.degToRad(r.ca),a]}).distinctUntilChanged(function(e,r){return Math.abs(r[0]-e[0])2*Math.PI-Math.PI/90)return i.h("circle",{attributes:{cx:"0",cy:"0",fill:r,r:"1"},namespace:this._svgNamespace},[]);var n=t-e/2-Math.PI/2,o=n+e,a=Math.cos(n),s=Math.sin(n),c=Math.cos(o),u=Math.sin(o),h="M 0 0 "+a+" "+s+" A 1 1 0 "+(e>=Math.PI?1:0)+" 1 "+c+" "+u;return i.h("path",{attributes:{d:h,fill:r},namespace:this._svgNamespace},[])},e.componentName="bearing",e}(a.Component);r.BearingComponent=c,a.ComponentService.register(c),r.default=c},{"../Component":226,"../Geo":229,"rxjs/Observable":29,"virtual-dom":182}],243:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/from"),t("rxjs/add/observable/merge"),t("rxjs/add/observable/of"),t("rxjs/add/observable/zip"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/distinct"),t("rxjs/add/operator/expand"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/mergeAll"),t("rxjs/add/operator/skip"),t("rxjs/add/operator/switchMap");var o=t("../Edge"),a=t("../Component"),s=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype.setDepth=function(t){this.configure({depth:t})},e.prototype._activate=function(){var t=this;this._sequenceSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}).filter(function(t){return t.cached}),this._configuration$).switchMap(function(e){var r=e[0],n=e[1],a=Math.max(0,Math.min(4,n.depth.sequence)),s=t._cache$(r.edges,o.EdgeDirection.Next,a),c=t._cache$(r.edges,o.EdgeDirection.Prev,a);return i.Observable.merge(s,c).catch(function(t,e){return console.error("Failed to cache sequence edges.",t),i.Observable.empty()})}).subscribe(function(){}),this._spatialSubscription=this._navigator.stateService.currentNode$.switchMap(function(t){return i.Observable.combineLatest(i.Observable.of(t),t.spatialEdges$.filter(function(t){return t.cached}))}).combineLatest(this._configuration$,function(t,e){return[t[0],t[1],e]}).switchMap(function(e){var r=e[0],n=e[1].edges,a=e[2].depth,s=Math.max(0,Math.min(2,a.pano)),c=r.pano?0:Math.max(0,Math.min(3,a.step)),u=r.pano?0:Math.max(0,Math.min(1,a.turn)),h=t._cache$(n,o.EdgeDirection.Pano,s),l=t._cache$(n,o.EdgeDirection.StepForward,c),p=t._cache$(n,o.EdgeDirection.StepBackward,c),f=t._cache$(n,o.EdgeDirection.StepLeft,c),d=t._cache$(n,o.EdgeDirection.StepRight,c),m=t._cache$(n,o.EdgeDirection.TurnLeft,u),v=t._cache$(n,o.EdgeDirection.TurnRight,u),g=t._cache$(n,o.EdgeDirection.TurnU,u);return i.Observable.merge(l,p,f,d,h,m,v,g).catch(function(t,e){return console.error("Failed to cache spatial edges.",t),i.Observable.empty()})}).subscribe(function(){})},e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._spatialSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}},e.prototype._cache$=function(t,e,r){var n=this;return i.Observable.zip(i.Observable.of(t),i.Observable.of(r)).expand(function(t){var r=t[0],o=t[1],a=[];if(o>0)for(var s=0,c=r;s-1?t.sequenceEdges$:t.spatialEdges$).first(function(t){return t.cached}).map(function(t){return t.edges})},e.componentName="cache",e}(a.Component);r.CacheComponent=s,a.ComponentService.register(s),r.default=s},{"../Component":226,"../Edge":227,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/expand":60,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeAll":67,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/skip":75,"rxjs/add/operator/switchMap":79}],244:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/BehaviorSubject"),o=t("rxjs/Subject");t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var a=function(t){function e(e,r,n){var a=t.call(this)||this;return a._activated$=new i.BehaviorSubject(!1),a._configurationSubject$=new o.Subject,a._activated=!1,a._container=r,a._name=e,a._navigator=n,a._configuration$=a._configurationSubject$.startWith(a.defaultConfiguration).scan(function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}).publishReplay(1).refCount(),a._configuration$.subscribe(function(){}),a}return n(e,t),Object.defineProperty(e.prototype,"activated",{get:function(){return this._activated},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activated$",{get:function(){return this._activated$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultConfiguration",{get:function(){return this._getDefaultConfiguration()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),e.prototype.activate=function(t){this._activated||(void 0!==t&&this._configurationSubject$.next(t),this._activated=!0,this._activate(),this._activated$.next(!0))},e.prototype.configure=function(t){this._configurationSubject$.next(t)},e.prototype.deactivate=function(){this._activated&&(this._activated=!1,this._deactivate(),this._container.domRenderer.clear(this._name),this._container.glRenderer.clear(this._name),this._activated$.next(!1))},e.prototype.resize=function(){},e.componentName="not_worthy",e}(t("../Utils").EventEmitter);r.Component=a,r.default=a},{"../Utils":236,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78}],245:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=t("../Error"),o=function(){function t(e,r){this._components={},this._container=e,this._navigator=r;for(var i=0,o=n.values(t.registeredComponents);i0&&t.description?{name:e._name,vnode:e._getRouteAnnotationNode(t.description)}:{name:e._name,vnode:o.h("div",[])}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe(),this._disposableDescription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype.play=function(){this.configure({playing:!0})},e.prototype.stop=function(){this.configure({playing:!1})},e.prototype._getRouteAnnotationNode=function(t){return o.h("div.RouteFrame",{},[o.h("p",{textContent:t},[])])},e.componentName="route",e}(s.Component);r.RouteComponent=l,s.ComponentService.register(l),r.default=l},{"../Component":226,"rxjs/Observable":29,"rxjs/add/observable/fromPromise":43,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":73,underscore:178,"virtual-dom":182}],252:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable");t("rxjs/add/operator/buffer"),t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/scan");var o=t("../Component"),a=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){var t=this;this._sequenceSubscription=this._navigator.stateService.currentNode$.scan(function(t,e){var r=e.sequenceKey;return t.report=[],r in t.reported||(t.report=[r],t.reported[r]=!0),t},{report:[],reported:{}}).filter(function(t){return t.report.length>0}).mergeMap(function(e){return t._navigator.apiV3.sequenceViewAdd$(e.report).catch(function(t,r){return console.error("Failed to report sequence stats ("+e.report+")",t),i.Observable.empty()})}).subscribe(function(){}),this._imageSubscription=this._navigator.stateService.currentNode$.map(function(t){return t.key}).buffer(this._navigator.stateService.currentNode$.debounceTime(5e3)).scan(function(t,e){t.report=[];for(var r=0,n=e;r0}).mergeMap(function(e){return t._navigator.apiV3.imageViewAdd$(e.report).catch(function(t,r){return console.error("Failed to report image stats ("+e.report+")",t),i.Observable.empty()})}).subscribe(function(){})},e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._imageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="stats",e}(o.Component);r.StatsComponent=a,o.ComponentService.register(a),r.default=a},{"../Component":226,"rxjs/Observable":29,"rxjs/add/operator/buffer":49,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":73}],253:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("rxjs/Observable"),a=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/do"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/share");var s=t("../../Component"),c=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n)||this;return o._renderer=i||new s.DirectionDOMRenderer(o.defaultConfiguration,r.element),o._hoveredKeySubject$=new a.Subject,o._hoveredKey$=o._hoveredKeySubject$.share(),o}return n(e,t),Object.defineProperty(e.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),e.prototype.setHighlightKey=function(t){this.configure({highlightKey:t})},e.prototype.setMinWidth=function(t){this.configure({minWidth:t})},e.prototype.setMaxWidth=function(t){this.configure({maxWidth:t})},e.prototype.resize=function(){this._renderer.resize(this._container.element)},e.prototype._activate=function(){var t=this;this._configurationSubscription=this._configuration$.subscribe(function(e){t._renderer.setConfiguration(e)}),this._nodeSubscription=this._navigator.stateService.currentNode$.do(function(e){t._container.domRenderer.render$.next({name:t._name,vnode:i.h("div",{},[])}),t._renderer.setNode(e)}).withLatestFrom(this._configuration$).switchMap(function(e){var r=e[0],n=e[1];return o.Observable.combineLatest(r.spatialEdges$,n.distinguishSequence?t._navigator.graphService.cacheSequence$(r.sequenceKey).catch(function(t,e){return console.error("Failed to cache sequence ("+r.sequenceKey+")",t),o.Observable.of(null)}):o.Observable.of(null))}).subscribe(function(e){var r=e[0],n=e[1];t._renderer.setEdges(r,n)}),this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.do(function(e){t._renderer.setRenderCamera(e)}).map(function(e){return t._renderer}).filter(function(t){return t.needsRender}).map(function(e){return{name:t._name,vnode:e.render(t._navigator)}}).subscribe(this._container.domRenderer.render$),this._hoveredKeySubscription=o.Observable.combineLatest([this._container.domRenderer.element$,this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$.startWith(null),this._container.mouseService.mouseUp$.startWith(null)],function(t,e,r,n){return t}).map(function(t){for(var e=t.getElementsByClassName("DirectionsPerspective"),r=0;re?t:e},t}();r.DirectionDOMCalculator=i,r.default=i},{"../../Geo":229}],255:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("virtual-dom"),i=t("../../Component"),o=t("../../Edge"),a=t("../../Geo"),s=function(){function t(t,e){this._isEdge=!1,this._spatial=new a.Spatial,this._calculator=new i.DirectionDOMCalculator(t,e),this._node=null,this._rotation={phi:0,theta:0},this._epsilon=.5*Math.PI/180,this._highlightKey=null,this._distinguishSequence=!1,this._needsRender=!1,this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[],this._stepDirections=[o.EdgeDirection.StepForward,o.EdgeDirection.StepBackward,o.EdgeDirection.StepLeft,o.EdgeDirection.StepRight],this._turnDirections=[o.EdgeDirection.TurnLeft,o.EdgeDirection.TurnRight,o.EdgeDirection.TurnU],this._turnNames={},this._turnNames[o.EdgeDirection.TurnLeft]="TurnLeft",this._turnNames[o.EdgeDirection.TurnRight]="TurnRight",this._turnNames[o.EdgeDirection.TurnU]="TurnAround";var r=!!document.documentMode;this._isEdge=!r&&!!window.StyleMedia}return Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.render=function(t){this._needsRender=!1;var e=this._rotation,r=[],n=[];return this._node.pano?r=r.concat(this._createPanoArrows(t,e)):(r=(r=r.concat(this._createPerspectiveToPanoArrows(t,e))).concat(this._createStepArrows(t,e)),n=n.concat(this._createTurnArrows(t))),this._getContainer(r,n,e)},t.prototype.setEdges=function(t,e){this._setEdges(t,e),this._setNeedsRender()},t.prototype.setNode=function(t){this._node=t,this._clearEdges(),this._setNeedsRender()},t.prototype.setRenderCamera=function(t){var e=t.rotation;Math.abs(e.phi-this._rotation.phi)-1?this._stepEdges.push(c):this._turnDirections.indexOf(i)>-1?this._turnEdges.push(c):c.data.direction===o.EdgeDirection.Pano&&this._panoEdges.push(c)}if(this._distinguishSequence&&null!=e)for(var a=0,s=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);a-1&&(c+="Sequence"),this._highlightKey===e&&(c+="Highlight");var u=n.h("div."+r,{},[]);return n.h("div."+c,s,[u])},t.prototype._createVNodeDisabled=function(t,e,r){return this._createVNode(t,e,r,this._calculator.outerRadius,"DirectionsArrowDisabled","DirectionsCircleDisabled")},t.prototype._createVNode=function(t,e,r,i,o,a,s,c){var u=this._calculator.angleToCoordinates(e-r.phi),h=Math.round(-i*u[1]+.5*this._calculator.containerWidth),l=Math.round(-i*u[0]+.5*this._calculator.containerHeight),p=this._calculator.relativeAngleToCoordiantes(e,r.phi),f=this._calculator.shadowOffset,d="drop-shadow("+-f*p[1]+"px "+f*p[0]+"px 1px rgba(0,0,0,0.8))",m={style:{"-webkit-filter":d,filter:d}},v=n.h("div."+o,m,[]),g=-this._spatial.radToDeg(e-r.phi),y=c?"translate("+h+"px, "+l+"px) rotate("+g+"deg) translateZ(-0.01px)":"translate("+h+"px, "+l+"px) rotate("+g+"deg)",b={attributes:{"data-key":t},onclick:s,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:y,width:this._calculator.stepCircleSizeCss}};return this._sequenceEdgeKeys.indexOf(t)>-1&&(a+="Sequence"),this._highlightKey===t&&(a+="Highlight"),n.h("div."+a,b,[v])},t.prototype._getContainer=function(t,e,r){var i=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",o={oncontextmenu:function(t){t.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:i,width:this._calculator.containerWidthCss}};return n.h("div.DirectionsPerspective",o,e.concat(t))},t}();r.DirectionDOMRenderer=s,r.default=s},{"../../Component":226,"../../Edge":227,"../../Geo":229,"virtual-dom":182}],256:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/operator/catch"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/pairwise"),t("rxjs/add/operator/publish"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/skipWhile"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/takeUntil"),t("rxjs/add/operator/withLatestFrom");var a=t("../../Component"),s=t("../../Render"),c=t("../../Tiles"),u=t("../../Utils"),h=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._imageTileLoader=new c.ImageTileLoader(u.Urls.tileScheme,u.Urls.tileDomain,u.Urls.origin),i._roiCalculator=new c.RegionOfInterestCalculator,i._rendererOperation$=new o.Subject,i._rendererCreator$=new o.Subject,i._rendererDisposer$=new o.Subject,i._renderer$=i._rendererOperation$.scan(function(t,e){return e(t)},null).filter(function(t){return null!=t}).distinctUntilChanged(void 0,function(t){return t.frameId}),i._rendererCreator$.map(function(){return function(t){if(null!=t)throw new Error("Multiple image plane states can not be created at the same time");return new a.ImagePlaneGLRenderer}}).subscribe(i._rendererOperation$),i._rendererDisposer$.map(function(){return function(t){return t.dispose(),null}}).subscribe(i._rendererOperation$),i}return n(e,t),e.prototype._activate=function(){var t=this;this._rendererSubscription=this._renderer$.map(function(e){var r={name:t._name,render:{frameId:e.frameId,needsRender:e.needsRender,render:e.render.bind(e),stage:s.GLRenderStage.Background}};return e.clearNeedsRender(),r}).subscribe(this._container.glRenderer.render$),this._rendererCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(t){return function(e){return e.updateFrame(t),e}}).subscribe(this._rendererOperation$);var e=this._navigator.stateService.currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).combineLatest(this._configuration$).filter(function(t){return!0===t[1].imageTiling}).map(function(t){return t[0]}).withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$).map(function(e){var r=e[0].state,n=e[1],i=e[2],o=r.currentNode,a=r.currentTransform,s=Math.max(i.width,i.height)>1024?1024:512;return new c.TextureProvider(o.key,a.basicWidth,a.basicHeight,s,o.image,t._imageTileLoader,new c.ImageTileStore,n)}).publishReplay(1).refCount();this._textureProviderSubscription=e.subscribe(function(){}),this._setTextureProviderSubscription=e.map(function(t){return function(e){return e.setTextureProvider(t.key,t),e}}).subscribe(this._rendererOperation$),this._abortTextureProviderSubscription=e.pairwise().subscribe(function(t){t[0].abort()});var r=this._container.renderService.renderCameraFrame$.map(function(t){return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf()]}).pairwise().skipWhile(function(t){return t[1][2]-t[0][2]<0||0===t[1][2]}).map(function(t){var e=t[0][0].equals(t[1][0]),r=t[0][1].equals(t[1][1]),n=t[0][2]===t[1][2];return e&&r&&n}).distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._container.renderService.renderCameraFrame$.first()}).withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$);this._setRegionOfInterestSubscription=e.switchMap(function(e){return r.map(function(r){return[t._roiCalculator.computeRegionOfInterest(r[0],r[1],r[2]),e]})}).filter(function(t){return!t[1].disposed}).subscribe(function(t){var e=t[0];t[1].setRegionOfInterest(e)});var n=e.switchMap(function(t){return t.hasTexture$}).startWith(!1).publishReplay(1).refCount();this._hasTextureSubscription=n.subscribe(function(){});var o=this._navigator.stateService.currentNode$.debounceTime(1e3).withLatestFrom(n).filter(function(t){return!t[1]}).map(function(t){return t[0]}).filter(function(t){return t.pano?u.Settings.maxImageSize>u.Settings.basePanoramaSize:u.Settings.maxImageSize>u.Settings.baseImageSize}).switchMap(function(t){var e=t.pano?u.Settings.basePanoramaSize:u.Settings.baseImageSize;return Math.max(t.image.width,t.image.height)>e?i.Observable.empty():t.cacheImage$(u.Settings.maxImageSize).map(function(t){return[t.image,t]}).takeUntil(n.filter(function(t){return t})).catch(function(e,r){return console.error("Failed to fetch high res image ("+t.key+")",e),i.Observable.empty()})}).publish().refCount();this._updateBackgroundSubscription=o.withLatestFrom(e).subscribe(function(t){t[0][1].key!==t[1].key||t[1].disposed||t[1].updateBackground(t[0][0])}),this._updateTextureImageSubscription=o.map(function(t){return function(e){return e.updateTextureImage(t[0],t[1]),e}}).subscribe(this._rendererOperation$)},e.prototype._deactivate=function(){this._rendererDisposer$.next(null),this._abortTextureProviderSubscription.unsubscribe(),this._hasTextureSubscription.unsubscribe(),this._rendererSubscription.unsubscribe(),this._setRegionOfInterestSubscription.unsubscribe(),this._setTextureProviderSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._textureProviderSubscription.unsubscribe(),this._updateBackgroundSubscription.unsubscribe(),this._updateTextureImageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{imageTiling:!1}},e.componentName="imagePlane",e}(a.Component);r.ImagePlaneComponent=h,a.ComponentService.register(h),r.default=h},{"../../Component":226,"../../Render":232,"../../Tiles":235,"../../Utils":236,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publish":71,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/skipWhile":77,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/takeUntil":81,"rxjs/add/operator/withLatestFrom":83}],257:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../../Component"),o=function(){function t(t,e){this._imagePlaneDepth=null!=t?t:200,this._imageSphereRadius=null!=e?e:200}return t.prototype.createMesh=function(t,e){return t.pano?this._createImageSphere(t,e):this._createImagePlane(t,e)},t.prototype._createImageSphere=function(t,e){var r=this._createTexture(t.image),i=this._createSphereMaterialParameters(e,r),o=new n.ShaderMaterial(i);return this._useMesh(e,t)?new n.Mesh(this._getImageSphereGeo(e,t),o):new n.Mesh(this._getFlatImageSphereGeo(e),o)},t.prototype._createImagePlane=function(t,e){var r=this._createTexture(t.image),i=this._createPlaneMaterialParameters(e,r),o=new n.ShaderMaterial(i),a=this._useMesh(e,t)?this._getImagePlaneGeo(e,t):this._getFlatImagePlaneGeo(e);return new n.Mesh(a,o)},t.prototype._createSphereMaterialParameters=function(t,e){var r=t.gpano,o=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2,a=2*Math.PI*(r.CroppedAreaLeftPixels-o)/r.FullPanoWidthPixels,s=2*Math.PI*r.CroppedAreaImageWidthPixels/r.FullPanoWidthPixels,c=(r.FullPanoHeightPixels-r.CroppedAreaImageHeightPixels)/2,u=Math.PI*(c-r.CroppedAreaTopPixels)/r.FullPanoHeightPixels,h=Math.PI*r.CroppedAreaImageHeightPixels/r.FullPanoHeightPixels;return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.equirectangular.fragment,side:n.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},phiLength:{type:"f",value:s},phiShift:{type:"f",value:a},projectorMat:{type:"m4",value:t.rt},projectorTex:{type:"t",value:e},thetaLength:{type:"f",value:h},thetaShift:{type:"f",value:u}},vertexShader:i.ImagePlaneShaders.equirectangular.vertex}},t.prototype._createPlaneMaterialParameters=function(t,e){return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.perspective.fragment,side:n.DoubleSide,transparent:!0,uniforms:{bbox:{type:"v4",value:new n.Vector4(0,0,1,1)},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:t.projectorMatrix()},projectorTex:{type:"t",value:e}},vertexShader:i.ImagePlaneShaders.perspective.vertex}},t.prototype._createTexture=function(t){var e=new n.Texture(t);return e.minFilter=n.LinearFilter,e.needsUpdate=!0,e},t.prototype._useMesh=function(t,e){return e.mesh.vertices.length&&t.hasValidScale},t.prototype._getImageSphereGeo=function(t,e){for(var r=(new n.Matrix4).getInverse(t.srt),i=5*t.scale,o=this._imageSphereRadius*t.scale,a=e.mesh.vertices,s=a.length/3,c=new Float32Array(a.length),u=0;u bbox[0] && y > bbox[1] && x < bbox[2] && y < bbox[3]) {\n baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},t}();r.ImagePlaneShaders=n},{path:22}],261:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/fromEvent"),t("rxjs/add/observable/of"),t("rxjs/add/observable/zip"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom"),t("rxjs/add/operator/zip");var a=t("../../State"),s=t("../../Render"),c=t("../../Utils"),u=t("../../Component"),h=function(){function t(){this._imagePlaneFactory=new u.ImagePlaneFactory,this._imagePlaneScene=new u.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._curtain=1}return Object.defineProperty(t.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"curtain",{get:function(){return this._curtain},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"glNeedsRender",{get:function(){return this._glNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domNeedsRender",{get:function(){return this._domNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sliderVisible",{get:function(){return this._sliderVisible},set:function(t){this._sliderVisible=t,this._domNeedsRender=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return null==this._currentKey||null==this._previousKey||this._currentPano},enumerable:!0,configurable:!0}),t.prototype.update=function(t){this._updateFrameId(t.id);var e=this._updateImagePlanes(t.state);this._domNeedsRender=e||this._domNeedsRender,e=this._updateCurtain(t.state.alpha)||e,this._glNeedsRender=e||this._glNeedsRender},t.prototype.updateTexture=function(t,e){var r=e.key===this._currentKey?this._imagePlaneScene.imagePlanes:e.key===this._previousKey?this._imagePlaneScene.imagePlanesOld:[];if(0!==r.length){this._glNeedsRender=!0;for(var n=0,i=r;nc.Settings.basePanoramaSize:c.Settings.maxImageSize>c.Settings.baseImageSize}).mergeMap(function(t){var e=t.pano?c.Settings.basePanoramaSize:c.Settings.baseImageSize;return Math.max(t.image.width,t.image.height)>e?i.Observable.empty():t.cacheImage$(c.Settings.maxImageSize).map(function(t){return[t.image,t]}).catch(function(e,r){return console.error("Failed to fetch high res slider image ("+t.key+")",e),i.Observable.empty()})}).map(function(t){var e=t[0],r=t[1];return function(t){return t.updateTexture(e,r),t}}).subscribe(this._sliderStateOperation$)},e.prototype._deactivate=function(){var t=this;this._navigator.stateService.state$.first().subscribe(function(e){e===a.State.Waiting&&t._navigator.stateService.traverse()}),this._sliderStateDisposer$.next(null),this._setKeysSubscription.unsubscribe(),this._setSliderVisibleSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this.configure({keys:null}),this._sliderControl.removeEventListener("input",this._moveToHandler),this._sliderControl.removeEventListener("change",this._moveToHandler),this._container.element.removeChild(this._sliderContainer),this._moveToHandler=null,this._sliderControl=null,this._sliderWrapper=null,this._sliderContainer=null},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._catchCacheNode$=function(t){return this._navigator.graphService.cacheNode$(t).catch(function(e,r){return console.error("Failed to cache slider node ("+t+")",e),i.Observable.empty()})},e.prototype._createElement=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n},e.componentName="slider",e}(u.Component);r.SliderComponent=l,u.ComponentService.register(l),r.default=l},{"../../Component":226,"../../Render":232,"../../State":233,"../../Utils":236,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/fromEvent":42,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83,"rxjs/add/operator/zip":84}],262:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!function(t){t[t.Hidden=0]="Hidden",t[t.Loading=1]="Loading",t[t.Visible=2]="Visible"}(r.CoverState||(r.CoverState={}))},{}],263:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./ICoverConfiguration");r.CoverState=n.CoverState},{"./ICoverConfiguration":262}],264:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom");var i=t("../../Component"),o=t("../../Edge"),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._enable=function(){var t=this,e=this._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$});this._keyDownSubscription=this._container.keyboardService.keyDown$.withLatestFrom(e).subscribe(function(e){var r=e[0],n=e[1],i=null;switch(r.keyCode){case 38:i=o.EdgeDirection.Next;break;case 40:i=o.EdgeDirection.Prev;break;default:return}if(r.preventDefault(),r.altKey&&!r.shiftKey&&n.cached)for(var a=0,s=n.edges;ai.lat&&p.latLon.lati.lon&&p.latLon.lon50||a.lerpAltitude(h.id,r,Math.min(1,Math.max(0,1.2-1.2*d/50)))}}),this._renderSubscription=this._navigator.stateService.currentState$.map(function(e){var r=t._markerScene;return{name:t._name,render:{frameId:e.id,needsRender:r.needsRender,render:r.render.bind(r),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$);var l=a.Observable.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).map(function(e){var r=e[0],n=e[1],i=t._container.element,o=t._viewportCoords.canvasPosition(n,i),a=o[0],s=o[1],c=t._viewportCoords.canvasToViewport(a,s,i);return t._markerScene.intersectObjects(c,r.perspective)}).publishReplay(1).refCount(),p=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).map(function(t){return!0}),f=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).map(function(t){return!1}),d=a.Observable.merge(p,f).startWith(!1);this._dragEventSubscription=p.withLatestFrom(l).merge(a.Observable.combineLatest(f,a.Observable.of(null))).startWith([!1,null]).pairwise().subscribe(function(r){var n=r[0],i=r[1],o=i[0],a=o?e.dragstart:e.dragend,s=o?i[1]:n[1],c={marker:t._markerScene.get(s),target:t,type:a};t.fire(a,c)});var m=a.Observable.merge(this._container.mouseService.mouseDown$.map(function(t){return!0}),this._container.mouseService.documentMouseUp$.map(function(t){return!1})).startWith(!1);this._mouseClaimSubscription=a.Observable.combineLatest(this._container.mouseService.active$,l.distinctUntilChanged(),m,d).map(function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return!e&&null!=r&&n||i}).distinctUntilChanged().subscribe(function(e){e?t._container.mouseService.claimMouse(t._name,1):t._container.mouseService.unclaimMouse(t._name)});var v=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).withLatestFrom(l,this._container.renderService.renderCamera$).map(function(e){var r=e[0],n=e[1],i=e[2],o=t._markerScene.get(n),a=t._container.element,s=t._viewportCoords.projectToCanvas(o.geometry.position.toArray(),a,i.perspective),c=s[0],u=s[1],h=t._viewportCoords.canvasPosition(r,a);return[o,[h[0]-c,h[1]-u],i]}).publishReplay(1).refCount();this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).withLatestFrom(v,this._navigator.stateService.reference$,o).subscribe(function(r){var n=r[0],o=r[1],a=o[0],s=o[1],c=o[2],u=r[2],h=r[3];if(t._markerScene.has(a.id)){var l=t._container.element,p=t._viewportCoords.canvasPosition(n,l),f=p[0],d=p[1],m=f-s[0],v=d-s[1],g=t._viewportCoords.canvasToViewport(m,v,l),y=g[0],b=g[1],_=new i.Vector3(y,b,1).unproject(c.perspective).sub(c.perspective.position).normalize(),x=Math.min(t._relativeGroundAltitude/_.z,h.visibleBBoxSize/2-.1);if(!(x<0)){var w=_.clone().multiplyScalar(x).add(c.perspective.position);w.z=c.perspective.position.z+t._relativeGroundAltitude;var S=t._geoCoords.enuToGeodetic(w.x,w.y,w.z,u.lat,u.lon,u.alt),M=S[0],E=S[1];t._markerScene.update(a.id,w.toArray(),{lat:M,lon:E}),t._markerSet.update(a);var T={marker:a,target:t,type:e.changed};t.fire(e.changed,T)}}})},e.prototype._deactivate=function(){this._adjustHeightSubscription.unsubscribe(),this._dragEventSubscription.unsubscribe(),this._markersUpdatedSubscription.unsubscribe(),this._mouseClaimSubscription.unsubscribe(),this._referenceSubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._setChangedSubscription.unsubscribe(),this._updateMarkerSubscription.unsubscribe(),this._markerScene.clear()},e.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}},e.componentName="marker",e.changed="changed",e.dragstart="dragstart",e.dragend="dragend",e}(s.Component);r.MarkerComponent=l,s.ComponentService.register(l),r.default=l},{"../../Component":226,"../../Geo":229,"../../Graph":230,"../../Render":232,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/map":65,three:176,when:223}],270:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t,e){this._needsRender=!1,this._interactiveObjects=[],this._markers={},this._objectMarkers={},this._raycaster=e||new n.Raycaster,this._scene=t||new n.Scene}return Object.defineProperty(t.prototype,"markers",{get:function(){return this._markers},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){t.id in this._markers&&this._dispose(t.id),t.createGeometry(e),this._scene.add(t.geometry),this._markers[t.id]=t;for(var r=0,n=t.getInteractiveObjects();r0&&this._updated$.next(e),t.length>e.length&&this._indexChanged$.next(this)},t.prototype.has=function(t){return t in this._hash},t.prototype.get=function(t){return this.has(t)?this._hash[t].marker:void 0},t.prototype.getAll=function(){return this._index.all().map(function(t){return t.marker})},t.prototype.remove=function(t){for(var e=this._hash,r=this._index,n=!1,i=0,o=t;i0&&0===s[3]?c=-h*s[1]:0===s[1]&&s[3]>0?c=h*s[3]:s[1]>0&&s[3]>0&&(c=h*(s[3]-s[1])/2),s[0]>0&&0===s[2]?u=h*s[0]:0===s[0]&&s[2]>0?u=-h*s[2]:s[0]>0&&s[2]>0&&(u=h*(s[0]-s[2])/2);var l=t._basicRotationThreshold;c=t._spatial.clamp(c,-l,l),u=t._spatial.clamp(u,-l,l),t._navigator.stateService.rotateBasicUnbounded([c,u])}}}})},e.prototype._disable=function(){this._bounceSubscription.unsubscribe()},e.prototype._getConfiguration=function(t){return{}},e}(t("../../Component").HandlerBase);r.BounceHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],276:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n)||this;return o._viewportCoords=i,o}return n(e,t),e.prototype._enable=function(){var t=this;this._zoomSubscription=i.Observable.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.map(function(t){var e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY,shiftKey:t.shiftKey}})).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,a=t._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=t._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.shiftKey?-1:1;t._navigator.stateService.zoomIn(l,h)})},e.prototype._disable=function(){this._zoomSubscription.unsubscribe()},e.prototype._getConfiguration=function(t){return{doubleClickZoom:t}},e}(t("../../Component").HandlerBase);r.DoubleClickZoomHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],277:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=t("rxjs/Observable"),a=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,n)||this;return a._spatial=o,a._viewportCoords=i,a._basicRotationThreshold=.05,a._forceCoeff=.2,a}return n(e,t),e.prototype._enable=function(){var t=this,e=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).map(function(t){return!0}),r=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).map(function(t){return!1});this._activeMouseSubscription=o.Observable.merge(e,r).subscribe(this._container.mouseService.activate$),this._preventDefaultSubscription=o.Observable.merge(e,r).switchMap(function(e){return e?t._container.mouseService.documentMouseMove$:o.Observable.empty()}).merge(this._container.touchService.touchMove$).subscribe(function(t){t.preventDefault()});var n=this._container.touchService.singleTouchDragStart$.map(function(t){return!0}),a=this._container.touchService.singleTouchDragEnd$.map(function(t){return!1});this._activeTouchSubscription=o.Observable.merge(n,a).subscribe(this._container.touchService.activate$),this._rotateBasicSubscription=this._navigator.stateService.currentState$.map(function(t){return t.state.currentNode.fullPano||t.state.nodesAhead<1}).distinctUntilChanged().switchMap(function(e){if(!e)return o.Observable.empty();var r=o.Observable.merge(t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDragStart$),t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDrag$),t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDragEnd$).map(function(t){return null})).pairwise().filter(function(t){return null!=t[0]&&null!=t[1]}),n=o.Observable.merge(t._container.touchService.singleTouchDragStart$,t._container.touchService.singleTouchDrag$,t._container.touchService.singleTouchDragEnd$.map(function(t){return null})).map(function(t){return null!=t&&t.touches.length>0?t.touches[0]:null}).pairwise().filter(function(t){return null!=t[0]&&null!=t[1]});return o.Observable.merge(r,n)}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,this._navigator.stateService.currentCamera$).map(function(e){var r=e[0],n=e[1],o=e[2],a=e[3].clone(),s=r[0],c=r[1],u=c.clientX-s.clientX,h=c.clientY-s.clientY,l=t._container.element,p=t._viewportCoords.canvasPosition(c,l),f=p[0],d=p[1],m=t._viewportCoords.unprojectFromCanvas(f,d,l,n.perspective).sub(n.perspective.position),v=t._viewportCoords.unprojectFromCanvas(f-u,d,l,n.perspective).sub(n.perspective.position),g=t._viewportCoords.unprojectFromCanvas(f,d-h,l,n.perspective).sub(n.perspective.position),y=(u>0?1:-1)*v.angleTo(m),b=(h>0?-1:1)*g.angleTo(m),_=(new i.Quaternion).setFromUnitVectors(a.up,new i.Vector3(0,0,1)),x=_.clone().inverse(),w=new i.Vector3;w.copy(a.lookat).sub(a.position),w.applyQuaternion(_);var S=w.length(),M=Math.atan2(w.y,w.x);M+=y;var E=Math.atan2(Math.sqrt(w.x*w.x+w.y*w.y),w.z);E+=b,E=Math.max(.01,Math.min(Math.PI-.01,E)),w.x=Math.sin(E)*Math.cos(M),w.y=Math.sin(E)*Math.sin(M),w.z=Math.cos(E),w.applyQuaternion(x);var T=(new i.Vector3).copy(a.position).add(w.multiplyScalar(S)),C=o.projectBasic(T.toArray()),O=o.projectBasic(a.lookat.toArray()),P=C[0]-O[0],A=C[1]-O[1];Math.abs(P)>1?P=0:P>.5?P-=1:P<-.5&&(P+=1);var j=t._basicRotationThreshold;if(P=t._spatial.clamp(P,-j,j),A=t._spatial.clamp(A,-j,j),o.fullPano)return[P,A];var R=t._viewportCoords.getPixelDistances(t._container.element,o,n.perspective),L=t._forceCoeff;return R[0]>0&&A<0&&C[1]<.5&&(A/=Math.max(1,L*R[0])),R[1]>0&&P>0&&C[0]>.5&&(P/=Math.max(1,L*R[1])),R[2]>0&&A>0&&C[1]>.5&&(A/=Math.max(1,L*R[2])),R[3]>0&&P<0&&C[0]<.5&&(P/=Math.max(1,L*R[3])),[P,A]}).subscribe(function(e){t._navigator.stateService.rotateBasic(e)})},e.prototype._disable=function(){this._activeMouseSubscription.unsubscribe(),this._activeTouchSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._rotateBasicSubscription.unsubscribe(),this._activeMouseSubscription=null,this._activeTouchSubscription=null,this._preventDefaultSubscription=null,this._rotateBasicSubscription=null},e.prototype._getConfiguration=function(t){return{dragPan:t}},e}(t("../../Component").HandlerBase);r.DragPanHandler=a,r.default=a},{"../../Component":226,"rxjs/Observable":29,three:176}],278:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),t("rxjs/add/observable/merge"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/withLatestFrom");var i=t("../../Component"),o=t("../../Geo"),a=function(t){function e(e,r,n){var a=t.call(this,e,r,n)||this,s=new o.Spatial,c=new o.ViewportCoords;return a._spatial=s,a._viewportCoords=c,a._bounceHandler=new i.BounceHandler(a,r,n,c,s),a._doubleClickZoomHandler=new i.DoubleClickZoomHandler(a,r,n,c),a._dragPanHandler=new i.DragPanHandler(a,r,n,c,s),a._scrollZoomHandler=new i.ScrollZoomHandler(a,r,n,c),a._touchZoomHandler=new i.TouchZoomHandler(a,r,n,c),a}return n(e,t),Object.defineProperty(e.prototype,"doubleClickZoom",{get:function(){return this._doubleClickZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dragPan",{get:function(){return this._dragPanHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollZoom",{get:function(){return this._scrollZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchZoom",{get:function(){return this._touchZoomHandler},enumerable:!0,configurable:!0}),e.prototype._activate=function(){var t=this;this._bounceHandler.enable(),this._configurationSubscription=this._configuration$.subscribe(function(e){e.doubleClickZoom?t._doubleClickZoomHandler.enable():t._doubleClickZoomHandler.disable(),e.dragPan?t._dragPanHandler.enable():t._dragPanHandler.disable(),e.scrollZoom?t._scrollZoomHandler.enable():t._scrollZoomHandler.disable(),e.touchZoom?t._touchZoomHandler.enable():t._touchZoomHandler.disable()}),this._container.mouseService.claimMouse(this._name,0)},e.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name),this._configurationSubscription.unsubscribe(),this._bounceHandler.disable(),this._doubleClickZoomHandler.disable(),this._dragPanHandler.disable(),this._scrollZoomHandler.disable(),this._touchZoomHandler.disable()},e.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:!0,dragPan:!0,scrollZoom:!0,touchZoom:!0}},e.componentName="mouse",e}(i.Component);r.MouseComponent=a,i.ComponentService.register(a),r.default=a},{"../../Component":226,"../../Geo":229,"rxjs/add/observable/merge":44,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/withLatestFrom":83}],279:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n)||this;return o._viewportCoords=i,o}return n(e,t),e.prototype._enable=function(){var t=this;this._preventDefaultSubscription=this._container.mouseService.mouseWheel$.subscribe(function(t){t.preventDefault()}),this._zoomSubscription=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseWheel$).withLatestFrom(this._navigator.stateService.currentState$,function(t,e){return[t,e]}).filter(function(t){var e=t[1].state;return e.currentNode.fullPano||e.nodesAhead<1}).map(function(t){return t[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(t,e,r){return[t,e,r]}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,a=t._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=t._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.deltaY;1===r.deltaMode?l*=40:2===r.deltaMode&&(l*=800);var p=-3*l/t._viewportCoords.containerToCanvas(o)[1];t._navigator.stateService.zoomIn(p,h)})},e.prototype._disable=function(){this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(t){return{scrollZoom:t}},e}(t("../../Component").HandlerBase);r.ScrollZoomHandler=i,r.default=i},{"../../Component":226}],280:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n)||this;return o._viewportCoords=i,o}return n(e,t),e.prototype._enable=function(){var t=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(t){t.originalEvent.preventDefault()});var e=this._container.touchService.pinchStart$.map(function(t){return!0}),r=this._container.touchService.pinchEnd$.map(function(t){return!1});this._activeSubscription=i.Observable.merge(e,r).subscribe(this._container.touchService.activate$),this._zoomSubscription=this._container.touchService.pinch$.withLatestFrom(this._navigator.stateService.currentState$).filter(function(t){var e=t[1].state;return e.currentNode.fullPano||e.nodesAhead<1}).map(function(t){return t[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,a=t._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=t._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=t._viewportCoords.containerToCanvas(o),p=l[0],f=l[1],d=3*r.distanceChange/Math.min(p,f);t._navigator.stateService.zoomIn(d,h)})},e.prototype._disable=function(){this._activeSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(t){return{touchZoom:t}},e}(t("../../Component").HandlerBase);r.TouchZoomHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],281:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./popup/Popup");r.Popup=n.Popup;var i=t("./PopupComponent");r.PopupComponent=i.PopupComponent},{"./PopupComponent":282,"./popup/Popup":283}],282:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject"),a=t("../../Component"),s=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._popups=[],i._added$=new o.Subject,i._popups$=new o.Subject,i}return n(e,t),e.prototype.add=function(t){for(var e=0,r=t;e=0?1:-1)*Math.round(Math.sqrt(.5*Math.pow(h,2))),p={bottom:[0,h],"bottom-left":[-l,l],"bottom-right":[l,l],center:[0,0],left:[-h,0],right:[h,0],top:[0,-h],"top-left":[-l,-l],"top-right":[l,-l]};n=[n[0]+p[a][0],n[1]+p[a][1]]}n=[Math.round(n[0]),Math.round(n[1])];var f={bottom:"translate(-50%,0)","bottom-left":"translate(-100%,0)","bottom-right":"translate(0,0)",center:"translate(-50%,-50%)",left:"translate(-100%,-50%)",right:"translate(0,-50%)",top:"translate(-50%,-100%)","top-left":"translate(-100%,-100%)","top-right":"translate(0,-100%)"},d=this._container.classList;for(var m in f)f.hasOwnProperty(m)&&d.remove("mapillaryjs-popup-float-"+m);d.add("mapillaryjs-popup-float-"+a),this._container.style.transform=f[a]+" translate("+n[0]+"px,"+n[1]+"px)";var v}else this._container.style.visibility="hidden"}},t.prototype._createElement=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n},t.prototype._rectToPixel=function(t,e,r,n,i){if(!e){for(var o=this._container.offsetWidth,a=this._container.offsetHeight,s={bottom:[0,a/2],"bottom-left":[-o/2,a/2],"bottom-right":[o/2,a/2],left:[-o/2,0],right:[o/2,0],top:[0,-a/2],"top-left":[-o/2,-a/2],"top-right":[o/2,-a/2]},c=[0,null,null],u=0,h=["bottom","top","left","right"];u0&&f[0]0&&f[1]c[0]&&(c[0]=_,c[1]=f,c[2]=l)}}if(c[0]>0)return[c[1],c[2]]}var x=this._pointFromRectPosition(t,e);return[this._viewportCoords.basicToCanvasSafe(x[0],x[1],{offsetHeight:n.height,offsetWidth:n.width},i,r.perspective),null!=e?e:"bottom"]},t.prototype._alignmentToPopupAligment=function(t){switch(t){case o.Alignment.Bottom:return"bottom";case o.Alignment.BottomLeft:return"bottom-left";case o.Alignment.BottomRight:return"bottom-right";case o.Alignment.Center:return"center";case o.Alignment.Left:return"left";case o.Alignment.Right:return"right";case o.Alignment.Top:return"top";case o.Alignment.TopLeft:return"top-left";case o.Alignment.TopRight:return"top-right";default:return null}},t.prototype._pixelToFloats=function(t,e,r,n){var i=[];return t[1]e.height-n&&i.push("top"),t[0]e.width-r/2&&i.push("left"),i},t.prototype._pointFromRectPosition=function(t,e){switch(e){case"bottom":return[(t[0]+t[2])/2,t[3]];case"bottom-left":return[t[0],t[3]];case"bottom-right":return[t[2],t[3]];case"center":return[(t[0]+t[2])/2,(t[1]+t[3])/2];case"left":return[t[0],(t[1]+t[3])/2];case"right":return[t[2],(t[1]+t[3])/2];case"top":return[(t[0]+t[2])/2,t[1]];case"top-left":return[t[0],t[1]];case"top-right":return[t[2],t[1]];default:return[(t[0]+t[2])/2,t[3]]}},t}();r.Popup=a,r.default=a},{"../../../Geo":229,"../../../Viewer":237,"rxjs/Subject":34}],284:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/of"),t("rxjs/add/operator/bufferCount"),t("rxjs/add/operator/concat"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/takeUntil"),t("rxjs/add/operator/withLatestFrom");var a=t("../../Component"),s=t("../../Edge"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._nodesAhead=5,i._configurationOperation$=new o.Subject,i._sequenceDOMRenderer=new a.SequenceDOMRenderer(r.element),i._sequenceDOMInteraction=new a.SequenceDOMInteraction,i._containerWidth$=new o.Subject,i._hoveredKeySubject$=new o.Subject,i._hoveredKey$=i._hoveredKeySubject$.share(),i._edgeStatus$=i._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}).publishReplay(1).refCount(),i}return n(e,t),Object.defineProperty(e.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),e.prototype.play=function(){this.configure({playing:!0})},e.prototype.stop=function(){this.configure({playing:!1})},e.prototype.setDirection=function(t){this.configure({direction:t})},e.prototype.setHighlightKey=function(t){this.configure({highlightKey:t})},e.prototype.setMaxWidth=function(t){this.configure({maxWidth:t})},e.prototype.setMinWidth=function(t){this.configure({minWidth:t})},e.prototype.setVisible=function(t){this.configure({visible:t})},e.prototype.resize=function(){var t=this;this._configuration$.first().map(function(e){return t._sequenceDOMRenderer.getContainerWidth(t._container.element,e)}).subscribe(function(e){t._containerWidth$.next(e)})},e.prototype._activate=function(){var t=this;this._renderSubscription=i.Observable.combineLatest(this._edgeStatus$,this._configuration$,this._containerWidth$).map(function(e){var r=e[0],n=e[1],i=e[2],o=t._sequenceDOMRenderer.render(r,n,i,t,t._sequenceDOMInteraction,t._navigator);return{name:t._name,vnode:o}}).subscribe(this._container.domRenderer.render$),this._containerWidthSubscription=this._configuration$.distinctUntilChanged(function(t,e){return t[0]===e[0]&&t[1]===e[1]},function(t){return[t.minWidth,t.maxWidth]}).map(function(e){return t._sequenceDOMRenderer.getContainerWidth(t._container.element,e)}).subscribe(this._containerWidth$),this._configurationSubscription=this._configurationOperation$.scan(function(t,e){return e(t)},{playing:!1}).finally(function(){null!=t._playingSubscription&&(t._navigator.stateService.cutNodes(),t._stop())}).subscribe(function(){}),this._configuration$.map(function(e){return function(r){return e.playing!==r.playing&&(t._navigator.stateService.cutNodes(),e.playing?t._play():t._stop()),r.playing=e.playing,r}}).subscribe(this._configurationOperation$),this._stopSubscription=this._configuration$.switchMap(function(e){var r=e.playing?t._edgeStatus$:i.Observable.empty(),n=i.Observable.of(e.direction);return i.Observable.combineLatest(r,n)}).map(function(t){var e=t[0],r=t[1];if(!e.cached)return!0;for(var n=0,i=e.edges;n-1?t[0].sequenceEdges$:t[0].spatialEdges$).filter(function(t){return t.cached}).zip(i.Observable.of(t[1]),function(t,e){return[t,e]})}).map(function(t){for(var e=t[1],r=0,n=t[0].edges;rn?1:0}),e}).share(),u._tagChanged$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return o.Observable.merge(t.tag.changed$,t.tag.geometryChanged$)})}).share(),u._renderTagGLChanged$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.glObjectsChanged$})}).share(),u._tagInterationInitiated$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$.map(function(t){return t.tag.id})})}).share(),u._tagInteractionAbort$=o.Observable.merge(u._container.mouseService.documentMouseUp$).map(function(t){}).share(),u._activeTag$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$})}).merge(u._tagInteractionAbort$.map(function(){return{offsetX:0,offsetY:0,operation:s.TagOperation.None,tag:null}})).share(),u._createGeometryChanged$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.geometryChanged$:o.Observable.empty()}).share(),u._createGLObjectsChanged$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.glObjectsChanged$:o.Observable.empty()}).share(),u._tagCreated$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.created$:o.Observable.empty()}).share(),u._vertexGeometryCreated$=u._tagCreated$.map(function(t){return t.geometry}).share(),u._pointGeometryCreated$=new a.Subject,u._geometryCreated$=o.Observable.merge(u._vertexGeometryCreated$,u._pointGeometryCreated$).share(),u._basicClick$=u._container.mouseService.staticClick$.withLatestFrom(u._container.renderService.renderCamera$,u._navigator.stateService.currentTransform$,function(t,e,r){return[t,e,r]}).map(function(t){var e=t[0],r=t[1],n=t[2];return u._mouseEventToBasic(e,u._container.element,r,n)}).share(),u._validBasicClick$=u._basicClick$.filter(function(t){var e=t[0],r=t[1];return 0<=e&&e<=1&&0<=r&&r<=1}).share(),u._creatingConfiguration$=u._configuration$.distinctUntilChanged(function(t,e){return t.mode===e.mode},function(t){return{createColor:t.createColor,mode:t.mode}}).publishReplay(1).refCount(),u._creating$=u._creatingConfiguration$.map(function(t){return t.mode!==s.TagMode.Default}).publishReplay(1).refCount(),u._creatingConfiguration$.subscribe(function(t){u.fire(e.modechanged,t.mode)}),u}return n(e,t),e.prototype.add=function(t){var e=this;this._activated?this._navigator.stateService.currentTransform$.first().subscribe(function(r){e._tagSet.add(t,r);var n=t.map(function(t){return e._tagSet.get(t.id)});e._tagScene.add(n)}):this._tagSet.addDeactivated(t)},e.prototype.changeMode=function(t){this.configure({mode:t})},e.prototype.get=function(t){if(this._activated){var e=this._tagSet.get(t);return void 0!==e?e.tag:void 0}return this._tagSet.getDeactivated(t)},e.prototype.getAll=function(){return this.activated?this._tagSet.getAll().map(function(t){return t.tag}):this._tagSet.getAllDeactivated()},e.prototype.getTagIdsAt=function(t){var e=this;return i.promise(function(r,n){e._container.renderService.renderCamera$.first().map(function(r){var n=e._viewportCoords.canvasToViewport(t[0],t[1],e._container.element);return e._tagScene.intersectObjects(n,r.perspective)}).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.has=function(t){return this._activated?this._tagSet.has(t):this._tagSet.hasDeactivated(t)},e.prototype.remove=function(t){this._activated?(this._tagSet.remove(t),this._tagScene.remove(t)):this._tagSet.removeDeactivated(t)},e.prototype.removeAll=function(){this._activated?(this._tagSet.removeAll(),this._tagScene.removeAll()):this._tagSet.removeAllDeactivated()},e.prototype._activate=function(){var t=this;this._preventDefaultSubscription=this._activeTag$.switchMap(function(e){return null!=e.tag?t._container.mouseService.documentMouseMove$:o.Observable.empty()}).subscribe(function(t){t.preventDefault()}),this._geometryCreatedEventSubscription=this._geometryCreated$.subscribe(function(r){t.fire(e.geometrycreated,r)}),this._tagsChangedEventSubscription=this._renderTags$.subscribe(function(r){t.fire(e.tagschanged,t)});var r=this.configuration$.switchMap(function(e){return e.mode!==s.TagMode.Default?t._navigator.stateService.currentTransform$.map(function(t){return null}):o.Observable.empty()}).publishReplay(1).refCount();this._deleteCreatingSubscription=r.skip(1).subscribe(function(){t._tagCreator.delete$.next(null)});var n=this._tagCreator.tag$.switchMap(function(t){return null!=t?t.aborted$.map(function(t){return null}):o.Observable.empty()}),i=this._tagCreated$.map(function(t){return null}),a=this._pointGeometryCreated$.map(function(t){return null});this._stopCreateSubscription=o.Observable.merge(n,i,a).subscribe(function(){t.changeMode(s.TagMode.Default)});var c=o.Observable.combineLatest(this._creatingConfiguration$,r).map(function(t){return t[0]}).publishReplay(1).refCount();this._createSubscription=c.switchMap(function(e){return e.mode===s.TagMode.CreateRect||e.mode===s.TagMode.CreatePolygon?t._validBasicClick$.take(1):o.Observable.empty()}).subscribe(this._tagCreator.create$),this._createPointSubscription=c.switchMap(function(e){return e.mode===s.TagMode.CreatePoint?t._validBasicClick$.take(1):o.Observable.empty()}).map(function(t){return new s.PointGeometry(t)}).subscribe(this._pointGeometryCreated$);var h=o.Observable.merge(this._container.mouseService.mouseMove$,this._container.mouseService.domMouseMove$).share();this._setCreateVertexSubscription=o.Observable.combineLatest(h,this._tagCreator.tag$,this._container.renderService.renderCamera$).filter(function(t){return null!=t[1]}).withLatestFrom(this._navigator.stateService.currentTransform$,function(t,e){return[t[0],t[1],t[2],e]}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=e[3],a=t._mouseEventToBasic(r,t._container.element,i,o);n.geometry instanceof s.RectGeometry?n.geometry.setVertex2d(3,a,o):n.geometry instanceof s.PolygonGeometry&&n.geometry.setVertex2d(n.geometry.polygon.length-2,a,o)}),this._addPointSubscription=c.switchMap(function(e){return e.mode===s.TagMode.CreateRect||e.mode===s.TagMode.CreatePolygon?t._basicClick$.skipUntil(t._validBasicClick$).skip(1):o.Observable.empty()}).withLatestFrom(this._tagCreator.tag$,function(t,e){return[t,e]}).subscribe(function(t){var e=t[0];t[1].addPoint(e)}),this._containerClassListSubscription=this._creating$.subscribe(function(e){e?t._container.element.classList.add("component-tag-create"):t._container.element.classList.remove("component-tag-create")}),this._deleteCreatedSubscription=this._creating$.subscribe(function(e){t._tagCreator.delete$.next(null)}),this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(e){t._tagScene.hasCreateTag()&&t._tagScene.removeCreateTag(),null!=e&&t._tagScene.addCreateTag(e)}),this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(e){t._tagScene.updateCreateTagObjects(e)}),this._claimMouseSubscription=this._tagInterationInitiated$.switchMap(function(e){return h.takeUntil(t._tagInteractionAbort$).take(1)}).subscribe(function(e){t._container.mouseService.claimMouse(t._name,1)}),this._mouseDragSubscription=this._activeTag$.withLatestFrom(h,function(t,e){return[t,e]}).switchMap(function(e){var r=e[0],n=e[1];if(r.operation===s.TagOperation.None)return o.Observable.empty();var i=o.Observable.of(n).concat(t._container.mouseService.filtered$(t._name,t._container.mouseService.domMouseDrag$).filter(function(e){return t._viewportCoords.insideElement(e,t._container.element)}));return o.Observable.combineLatest(i,t._container.renderService.renderCamera$).withLatestFrom(o.Observable.of(r),t._navigator.stateService.currentTransform$,function(t,e,r){return[t[0],t[1],e,r]})}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=e[3];if(i.operation!==s.TagOperation.None){var a=t._mouseEventToBasic(r,t._container.element,n,o,i.offsetX,i.offsetY);i.operation===s.TagOperation.Centroid?i.tag.geometry.setCentroid2d(a,o):i.operation===s.TagOperation.Vertex&&i.tag.geometry.setVertex2d(i.vertexIndex,a,o)}}),this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseDragEnd$).subscribe(function(e){t._container.mouseService.unclaimMouse(t._name)}),this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(e){t._tagScene.updateObjects(e)}),this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(e){t._tagScene.update()}),this._domSubscription=this._renderTags$.startWith([]).do(function(e){t._container.domRenderer.render$.next({name:t._name,vnode:t._tagDomRenderer.clear()})}).combineLatest(this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.startWith(null),this._tagCreator.tag$.merge(this._createGeometryChanged$).startWith(null),function(t,e,r,n,i,o){return[e,r,n,t,i,o]}).map(function(e){return{name:t._name,vnode:t._tagDomRenderer.render(e[3],e[5],e[1],e[0].perspective,e[2])}}).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.map(function(e){var r=t._tagScene;return{name:t._name,render:{frameId:e.id,needsRender:r.needsRender,render:r.render.bind(r),stage:u.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$),this._navigator.stateService.currentTransform$.first().subscribe(function(e){t._tagSet.activate(e),t._tagScene.add(t._tagSet.getAll())})},e.prototype._deactivate=function(){this._tagScene.clear(),this._tagSet.deactivate(),this._tagCreator.delete$.next(null),this._claimMouseSubscription.unsubscribe(),this._mouseDragSubscription.unsubscribe(),this._unclaimMouseSubscription.unsubscribe(),this._updateGLObjectsSubscription.unsubscribe(),this._updateTagSceneSubscription.unsubscribe(),this._stopCreateSubscription.unsubscribe(),this._deleteCreatingSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._createPointSubscription.unsubscribe(),this._setCreateVertexSubscription.unsubscribe(),this._addPointSubscription.unsubscribe(),this._deleteCreatedSubscription.unsubscribe(),this._setGLCreateTagSubscription.unsubscribe(),this._createGLObjectsChangedSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._containerClassListSubscription.unsubscribe(),this._domSubscription.unsubscribe(),this._glSubscription.unsubscribe(),this._geometryCreatedEventSubscription.unsubscribe(),this._tagsChangedEventSubscription.unsubscribe(),this._container.element.classList.remove("component-tag-create")},e.prototype._getDefaultConfiguration=function(){return{createColor:16777215,mode:s.TagMode.Default}},e.prototype._mouseEventToBasic=function(t,e,r,n,i,o){i=null!=i?i:0,o=null!=o?o:0;var a=this._viewportCoords.canvasPosition(t,e),s=a[0],c=a[1];return this._viewportCoords.canvasToBasic(s-i,c-o,e,n,r.perspective)},e.componentName="tag",e.modechanged="modechanged",e.geometrycreated="geometrycreated",e.tagschanged="tagschanged",e}(s.Component);r.TagComponent=h,s.ComponentService.register(h),r.default=h},{"../../Component":226,"../../Geo":229,"../../Render":232,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/empty":40,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/concat":54,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/skip":75,"rxjs/add/operator/skipUntil":76,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/take":80,"rxjs/add/operator/takeUntil":81,"rxjs/add/operator/withLatestFrom":83,when:223}],289:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/withLatestFrom");var i=t("../../Component"),o=function(){function t(t,e){this._component=t,this._navigator=e,this._tagOperation$=new n.Subject,this._create$=new n.Subject,this._delete$=new n.Subject,this._tag$=this._tagOperation$.scan(function(t,e){return e(t)},null).share(),this._create$.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$).map(function(t){var e=t[0],r=t[1],n=t[2];return function(t){if(r.mode===i.TagMode.CreateRect){o=new i.RectGeometry([e[0],e[1],e[0],e[1]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}if(r.mode===i.TagMode.CreatePolygon){var o=new i.PolygonGeometry([[e[0],e[1]],[e[0],e[1]],[e[0],e[1]]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}return null}}).subscribe(this._tagOperation$),this._delete$.map(function(){return function(t){return null}}).subscribe(this._tagOperation$)}return Object.defineProperty(t.prototype,"create$",{get:function(){return this._create$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"delete$",{get:function(){return this._delete$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tag$",{get:function(){return this._tag$},enumerable:!0,configurable:!0}),t}();r.TagCreator=o,r.default=o},{"../../Component":226,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/withLatestFrom":83}],290:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("virtual-dom"),i=function(){function t(){}return t.prototype.render=function(t,e,r,i,o){for(var a=[],s=0,c=t;s1||o<0||o>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].");return r._point=e.slice(),r}return n(e,t),Object.defineProperty(e.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),e.prototype.getCentroid2d=function(){return this._point.slice()},e.prototype.getCentroid3d=function(t){return t.unprojectBasic(this._point,200)},e.prototype.setCentroid2d=function(t,e){var r=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];this._point[0]=r[0],this._point[1]=r[1],this._notifyChanged$.next(this)},e}(i.Geometry);r.PointGeometry=o},{"../../../Component":226}],298:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../../Component"),o=function(t){function e(e,r){var n=t.call(this)||this,o=e.length;if(o<3)throw new i.GeometryTagError("A polygon must have three or more positions.");if(e[0][0]!==e[o-1][0]||e[0][1]!==e[o-1][1])throw new i.GeometryTagError("First and last positions must be equivalent.");n._polygon=[];for(var a=0,s=e;a1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");n._polygon.push(f.slice())}if(n._holes=[],null==r)return n;for(var c=0;c1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");n._holes[c].push(f.slice())}}return n}return n(e,t),Object.defineProperty(e.prototype,"polygon",{get:function(){return this._polygon},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"holes",{get:function(){return this._holes},enumerable:!0,configurable:!0}),e.prototype.addVertex2d=function(t){var e=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];this._polygon.splice(this._polygon.length-1,0,e),this._notifyChanged$.next(this)},e.prototype.getVertex2d=function(t){return this._polygon[t].slice()},e.prototype.removeVertex2d=function(t){if(t<0||t>=this._polygon.length||this._polygon.length<4)throw new i.GeometryTagError("Index for removed vertex must be valid.");if(t>0&&te[3])throw new i.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var n=0,o=e;n1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}return r._rect=e.slice(0,4),r._rect[0]>r._rect[2]&&(r._inverted=!0),r}return n(e,t),Object.defineProperty(e.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),e.prototype.setVertex2d=function(t,e,r){var n=this._rect.slice(),i=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))],o=[];if(0===t?(o[0]=i[0],o[1]=n[1],o[2]=n[2],o[3]=i[1]):1===t?(o[0]=i[0],o[1]=i[1],o[2]=n[2],o[3]=n[3]):2===t?(o[0]=n[0],o[1]=i[1],o[2]=i[0],o[3]=n[3]):3===t&&(o[0]=n[0],o[1]=n[1],o[2]=i[0],o[3]=i[1]),r.gpano){var a=t<2&&i[0]>.75&&n[0]<.25||t>=2&&this._inverted&&i[0]>.75&&n[2]<.25,s=t<2&&this._inverted&&i[0]<.25&&n[0]>.75||t>=2&&i[0]<.25&&n[2]>.75;a||s?this._inverted=!this._inverted:(o[0]-n[0]<-.25&&(o[0]=n[0]),o[2]-n[2]>.25&&(o[2]=n[2])),(!this._inverted&&o[0]>o[2]||this._inverted&&o[0]o[2]&&(o[0]=n[0],o[2]=n[2]);o[1]>o[3]&&(o[1]=n[1],o[3]=n[3]),this._rect[0]=o[0],this._rect[1]=o[1],this._rect[2]=o[2],this._rect[3]=o[3],this._notifyChanged$.next(this)},e.prototype.setCentroid2d=function(t,e){var r=this._rect.slice(),n=r[0],i=this._inverted?r[2]+1:r[2],o=r[1],a=r[3],s=n+(i-n)/2,c=o+(a-o)/2,u=0;if(null!=e.gpano&&e.gpano.CroppedAreaImageWidthPixels===e.gpano.FullPanoWidthPixels)u=this._inverted?t[0]+1-s:t[0]-s;else{var h=-n,l=1-i;u=Math.max(h,Math.min(l,t[0]-s))}var p=-o,f=1-a,d=Math.max(p,Math.min(f,t[1]-c));this._rect[0]=r[0]+u,this._rect[1]=r[1]+d,this._rect[2]=r[2]+u,this._rect[3]=r[3]+d,this._rect[0]<0?(this._rect[0]+=1,this._inverted=!this._inverted):this._rect[0]>1&&(this._rect[0]-=1,this._inverted=!this._inverted),this._rect[2]<0?(this._rect[2]+=1,this._inverted=!this._inverted):this._rect[2]>1&&(this._rect[2]-=1,this._inverted=!this._inverted),this._notifyChanged$.next(this)},e.prototype.getPoints3d=function(t){return this._getPoints2d(t).map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getVertex2d=function(t){return this._rectToVertices2d(this._rect)[t]},e.prototype.getVertex3d=function(t,e){return e.unprojectBasic(this._rectToVertices2d(this._rect)[t],200)},e.prototype.getVertices2d=function(){return this._rectToVertices2d(this._rect)},e.prototype.getVertices3d=function(t){return this._rectToVertices2d(this._rect).map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getCentroid2d=function(){var t=this._rect,e=t[0],r=this._inverted?t[2]+1:t[2],n=t[1];return[e+(r-e)/2,n+(t[3]-n)/2]},e.prototype.getCentroid3d=function(t){var e=this.getCentroid2d();return t.unprojectBasic(e,200)},e.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))},e.prototype.getPoleOfAccessibility3d=function(t){var e=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return t.unprojectBasic(e,200)},e.prototype.getTriangles3d=function(t){return this._triangulate(this._rectToVertices2d(this._rect),this.getVertices3d(t))},e.prototype.validate=function(t){var e=this._rect;return!(!this._inverted&&t[0].25||t[1]4?function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-2),r._created$.next(r)}:s,style:{transform:A=this._canvasToTransform(y)}},b=d.polygon.length>4?"TagCompleter":"TagInteractor";n.push(i.h("div."+b,f,[]))}if(d.polygon.length>3){var _=d.getVertex2d(d.polygon.length-3),x=_[0],w=_[1],S=this._viewportCoords.basicToCanvasSafe(x,w,o,this._transform,t);if(null!=S){f={onclick:function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-3)},style:{transform:A=this._canvasToTransform(S)}};n.push(i.h("div.TagInteractor",f,[]))}}var M=d.polygon.slice();M.splice(-2,2);for(var E=0,T=M;E=1?n._createHoles():[],n._outline=n._tag.lineWidth>=1?n._createOutline():null,n._geometryChangedSubscription=n._tag.geometry.changed$.subscribe(function(t){null!=n._fill&&n._updateFillGeometry(),n._holes.length>0&&n._updateHoleGeometries(),null!=n._outline&&n._updateOulineGeometry()}),n._changedSubscription=n._tag.changed$.subscribe(function(t){var e=!1;null!=n._fill&&n._updateFillMaterial(n._fill.material),null==n._outline?n._tag.lineWidth>=1&&(n._holes=n._createHoles(),n._outline=n._createOutline(),e=!0):(n._updateHoleMaterials(),n._updateOutlineMaterial()),e&&n._glObjectsChanged$.next(n)}),n}return n(e,t),e.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline(),this._changedSubscription.unsubscribe(),this._geometryChangedSubscription.unsubscribe()},e.prototype.getDOMObjects=function(t,e,r){var n=this,i=[],s=this._tag.geometry instanceof a.RectGeometry,c=!this._transform.gpano,u={offsetHeight:r.height,offsetWidth:r.width};if(null!=this._tag.icon&&(s||c)){var h=this._tag.geometry instanceof a.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfAccessibility2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,u,this._transform,e);if(null!=f){var d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})};if(t.loaded){var m=t.getDOMSprite(this._tag.icon,this._tag.iconFloat),v={onclick:function(t){t.stopPropagation(),n._tag.click$.next(n._tag)},onmousedown:d,style:{transform:S="translate("+Math.round(f[0])+"px,"+Math.round(f[1])+"px)"}};i.push(o.h("div.TagSymbol",v,[m]))}}}else if(null!=this._tag.text&&(s||c)){var g=this._tag.geometry instanceof a.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfAccessibility2d(),y=g[0],b=g[1],_=this._viewportCoords.basicToCanvasSafe(y,b,u,this._transform,e);if(null!=_){var x=Math.round(_[0]),w=Math.round(_[1]),S=this._tag.geometry instanceof a.RectGeometry?"translate("+x+"px,"+w+"px)":"translate(-50%, -50%) translate("+x+"px,"+w+"px)",v={onmousedown:d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})},style:{color:this._colorToCss(this._tag.textColor),transform:S},textContent:this._tag.text};i.push(o.h("span.TagSymbol",v,[]))}}if(!this._tag.editable)return i;var M=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof a.RectGeometry){var E=this._tag.geometry.getCentroid2d(),T=E[0],C=E[1],O=this._viewportCoords.basicToCanvasSafe(T,C,u,this._transform,e);if(null!=O){v={onmousedown:d=this._interact(a.TagOperation.Centroid),style:{background:M,transform:S="translate(-50%, -50%) translate("+Math.round(O[0])+"px,"+Math.round(O[1])+"px)"}};i.push(o.h("div.TagMover",v,[]))}}for(var P=this._tag.geometry.getVertices2d(),A=0;A=1&&this._tag.lineOpacity>0,t.opacity=this._tag.lineOpacity,t.transparent=this._tag.lineOpacity<1,t.needsUpdate=!0},e}(a.RenderTag);r.OutlineRenderTag=s},{"../../../Component":226,three:176,"virtual-dom":182}],303:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Subject"),o=t("../../../Component"),a=t("../../../Viewer"),s=function(t){function e(r,n,o){var s=t.call(this,r,n)||this;return o=o||{},s._editable=null!=o.editable&&o.editable,s._fillColor=null==o.fillColor?16777215:o.fillColor,s._fillOpacity=null==o.fillOpacity?0:o.fillOpacity,s._icon=void 0===o.icon?null:o.icon,s._iconFloat=null==o.iconFloat?a.Alignment.Center:o.iconFloat,s._iconIndex=null==o.iconIndex?3:o.iconIndex,s._indicateVertices=null==o.indicateVertices||o.indicateVertices,s._lineColor=null==o.lineColor?16777215:o.lineColor,s._lineOpacity=null==o.lineOpacity?1:o.lineOpacity,s._lineWidth=null==o.lineWidth?1:o.lineWidth,s._text=void 0===o.text?null:o.text,s._textColor=null==o.textColor?16777215:o.textColor,s._click$=new i.Subject,s._click$.subscribe(function(t){s.fire(e.click,s)}),s}return n(e,t),Object.defineProperty(e.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(t){this._editable=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillColor",{get:function(){return this._fillColor},set:function(t){this._fillColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(t){this._fillOpacity=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(t){this._iconFloat=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(t){this._iconIndex=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(t){this._indicateVertices=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineColor",{get:function(){return this._lineColor},set:function(t){this._lineColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(t){this._lineOpacity=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(t){this._textColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),e.prototype.setOptions=function(t){this._editable=null==t.editable?this._editable:t.editable,this._icon=void 0===t.icon?this._icon:t.icon,this._iconFloat=null==t.iconFloat?this._iconFloat:t.iconFloat,this._iconIndex=null==t.iconIndex?this._iconIndex:t.iconIndex,this._indicateVertices=null==t.indicateVertices?this._indicateVertices:t.indicateVertices,this._lineColor=null==t.lineColor?this._lineColor:t.lineColor,this._lineWidth=null==t.lineWidth?this._lineWidth:t.lineWidth,this._fillColor=null==t.fillColor?this._fillColor:t.fillColor,this._fillOpacity=null==t.fillOpacity?this._fillOpacity:t.fillOpacity,this._text=void 0===t.text?this._text:t.text,this._textColor=null==t.textColor?this._textColor:t.textColor,this._notifyChanged$.next(this)},e.click="click",e}(o.Tag);r.OutlineTag=s,r.default=s},{"../../../Component":226,"../../../Viewer":237,"rxjs/Subject":34}],304:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("../../../Geo"),o=function(){function t(t,e,r){this._tag=t,this._transform=e,this._viewportCoords=r||new i.ViewportCoords,this._glObjectsChanged$=new n.Subject,this._interact$=new n.Subject}return Object.defineProperty(t.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"interact$",{get:function(){return this._interact$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tag",{get:function(){return this._tag},enumerable:!0,configurable:!0}),t}();r.RenderTag=o,r.default=o},{"../../../Geo":229,"rxjs/Subject":34}],305:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("../../../Component"),a=t("../../../Viewer"),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.dispose=function(){},e.prototype.getDOMObjects=function(t,e,r){var n=this,s=this._tag,c={offsetHeight:r.height,offsetWidth:r.width},u=[],h=s.geometry.getCentroid2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,c,this._transform,e);if(null!=f){var d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:o.TagOperation.None,tag:s})},m=Math.round(f[0]),v=Math.round(f[1]);if(null!=s.icon){if(t.loaded){var g=t.getDOMSprite(s.icon,a.Alignment.Bottom),y={onmousedown:d,style:{pointerEvents:"all",transform:"translate("+m+"px,"+(v+8)+"px)"}};u.push(i.h("div",y,[g]))}}else if(null!=s.text){var b="translate(-50%,0%) translate("+m+"px,"+(v+8)+"px)",y={onmousedown:d,style:{color:this._colorToCss(s.textColor),transform:b},textContent:s.text};u.push(i.h("span.TagSymbol",y,[]))}var _=this._interact(o.TagOperation.Centroid,s),x=this._colorToCss(s.color),w="translate(-50%,-50%) translate("+m+"px,"+v+"px)";if(s.editable){var S={onmousedown:_,style:{background:x,transform:w}};u.push(i.h("div.TagSpotInteractor",S,[]))}var M={style:{background:x,transform:w}};u.push(i.h("div.TagVertex",M,[]))}return u},e.prototype.getGLObjects=function(){return[]},e.prototype.getRetrievableObjects=function(){return[]},e.prototype._colorToCss=function(t){return"#"+("000000"+t.toString(16)).substr(-6)},e.prototype._interact=function(t,e,r){var n=this;return function(i){var o=i.offsetX-i.target.offsetWidth/2,a=i.offsetY-i.target.offsetHeight/2;n._interact$.next({offsetX:o,offsetY:a,operation:t,tag:e,vertexIndex:r})}},e}(o.RenderTag);r.SpotRenderTag=s},{"../../../Component":226,"../../../Viewer":237,"virtual-dom":182}],306:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e,r,n){var i=t.call(this,e,r)||this;return n=n||{},i._color=null==n.color?16777215:n.color,i._editable=null!=n.editable&&n.editable,i._icon=void 0===n.icon?null:n.icon,i._text=void 0===n.text?null:n.text,i._textColor=null==n.textColor?16777215:n.textColor,i}return n(e,t),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(t){this._editable=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(t){this._textColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),e.prototype.setOptions=function(t){this._color=null==t.color?this._color:t.color,this._editable=null==t.editable?this._editable:t.editable,this._icon=void 0===t.icon?this._icon:t.icon,this._text=void 0===t.text?this._text:t.text,this._textColor=null==t.textColor?this._textColor:t.textColor,this._notifyChanged$.next(this)},e}(t("../../../Component").Tag);r.SpotTag=i,r.default=i},{"../../../Component":226}],307:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/share");var o=function(t){function e(r,n){var o=t.call(this)||this;return o._id=r,o._geometry=n,o._notifyChanged$=new i.Subject,o._notifyChanged$.subscribe(function(t){o.fire(e.changed,o)}),o._geometry.changed$.subscribe(function(t){o.fire(e.geometrychanged,o)}),o}return n(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometryChanged$",{get:function(){var t=this;return this._geometry.changed$.map(function(e){return t}).share()},enumerable:!0,configurable:!0}),e.changed="changed",e.geometrychanged="geometrychanged",e}(t("../../../Utils").EventEmitter);r.Tag=o,r.default=o},{"../../../Utils":236,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/share":74}],308:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t,e,r){this._component=t,this._container=e,this._navigator=r,this._enabled=!1}return Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),t.prototype.enable=function(){!this._enabled&&this._component.activated&&(this._enable(),this._enabled=!0,this._component.configure(this._getConfiguration(!0)))},t.prototype.disable=function(){this._enabled&&(this._disable(),this._enabled=!1,this._component.activated&&this._component.configure(this._getConfiguration(!1)))},t}();r.HandlerBase=n,r.default=n},{}],309:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,null!=e?e:"The argument is not valid.")||this;return r.name="ArgumentMapillaryError",r}return n(e,t),e}(t("./MapillaryError").MapillaryError);r.ArgumentMapillaryError=i,r.default=i},{"./MapillaryError":311}],310:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,e)||this;return r.name="GraphMapillaryError",r}return n(e,t),e}(t("./MapillaryError").MapillaryError);r.GraphMapillaryError=i,r.default=i},{"./MapillaryError":311}],311:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,e)||this;return r.name="MapillaryError",r}return n(e,t),e}(Error);r.MapillaryError=i,r.default=i},{}],312:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t){null!=t?(this._position=(new n.Vector3).fromArray(t.unprojectSfM([0,0],0)),this._lookat=(new n.Vector3).fromArray(t.unprojectSfM([0,0],10)),this._up=t.upVector(),this._focal=this._getFocal(t)):(this._position=new n.Vector3(0,0,0),this._lookat=new n.Vector3(0,0,1),this._up=new n.Vector3(0,-1,0),this._focal=1)}return Object.defineProperty(t.prototype,"position",{get:function(){return this._position},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lookat",{get:function(){return this._lookat},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"up",{get:function(){return this._up},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"focal",{get:function(){return this._focal},set:function(t){this._focal=t},enumerable:!0,configurable:!0}),t.prototype.lerpCameras=function(t,e,r){this._position.subVectors(e.position,t.position).multiplyScalar(r).add(t.position),this._lookat.subVectors(e.lookat,t.lookat).multiplyScalar(r).add(t.lookat),this._up.subVectors(e.up,t.up).multiplyScalar(r).add(t.up),this._focal=(1-r)*t.focal+r*e.focal},t.prototype.copy=function(t){this._position.copy(t.position),this._lookat.copy(t.lookat),this._up.copy(t.up),this._focal=t.focal},t.prototype.clone=function(){var e=new t;return e.position.copy(this._position),e.lookat.copy(this._lookat),e.up.copy(this._up),e.focal=this._focal,e},t.prototype.diff=function(t){var e=this._position.distanceToSquared(t.position),r=this._lookat.distanceToSquared(t.lookat),n=this._up.distanceToSquared(t.up),i=100*Math.abs(this._focal-t.focal);return Math.max(e,r,n,i)},t.prototype._getFocal=function(t){if(null==t.gpano)return t.focal;var e=Math.PI*t.gpano.CroppedAreaImageHeightPixels/t.gpano.FullPanoHeightPixels,r=.5/Math.tan(e/2);return Math.min(1/(2*(Math.sqrt(2)-1)),Math.max(.5,r))},t}();r.Camera=i},{three:176}],313:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._wgs84a=6378137,this._wgs84b=6356752.31424518}return t.prototype.geodeticToEnu=function(t,e,r,n,i,o){var a=this.geodeticToEcef(t,e,r);return this.ecefToEnu(a[0],a[1],a[2],n,i,o)},t.prototype.enuToGeodetic=function(t,e,r,n,i,o){var a=this.enuToEcef(t,e,r,n,i,o);return this.ecefToGeodetic(a[0],a[1],a[2])},t.prototype.ecefToEnu=function(t,e,r,n,i,o){var a=this.geodeticToEcef(n,i,o),s=[t-a[0],e-a[1],r-a[2]];n=n*Math.PI/180,i=i*Math.PI/180;var c=Math.cos(n),u=Math.sin(n),h=Math.cos(i),l=Math.sin(i);return[-l*s[0]+h*s[1],-u*h*s[0]-u*l*s[1]+c*s[2],c*h*s[0]+c*l*s[1]+u*s[2]]},t.prototype.enuToEcef=function(t,e,r,n,i,o){var a=this.geodeticToEcef(n,i,o);n=n*Math.PI/180,i=i*Math.PI/180;var s=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i);return[-h*t-c*u*e+s*u*r+a[0],u*t-c*h*e+s*h*r+a[1],s*e+c*r+a[2]]},t.prototype.geodeticToEcef=function(t,e,r){var n=this._wgs84a,i=this._wgs84b;t=t*Math.PI/180,e=e*Math.PI/180;var o=Math.cos(t),a=Math.sin(t),s=Math.cos(e),c=Math.sin(e),u=n*n,h=i*i,l=1/Math.sqrt(u*o*o+h*a*a),p=(u*l+r)*o;return[p*s,p*c,(h*l+r)*a]},t.prototype.ecefToGeodetic=function(t,e,r){var n=this._wgs84a,i=this._wgs84b,o=n*n,a=i*i,s=o-a,c=Math.sqrt(s/o),u=Math.sqrt(s/a),h=Math.sqrt(t*t+e*e),l=Math.atan2(r*n,h*i),p=Math.sin(l),f=Math.cos(l),d=Math.atan2(e,t),m=Math.atan2(r+u*u*i*p*p*p,h-c*c*n*f*f*f),v=Math.sin(m),g=h/Math.cos(m)-n/Math.sqrt(1-c*c*v*v);return[180*m/Math.PI,180*d/Math.PI,g]},t}();r.GeoCoords=n,r.default=n},{}],314:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(){this._epsilon=1e-9}return t.prototype.azimuthalToBearing=function(t){return-t+Math.PI/2},t.prototype.degToRad=function(t){return Math.PI*t/180},t.prototype.radToDeg=function(t){return 180*t/Math.PI},t.prototype.rotationMatrix=function(t){var e=new n.Vector3(t[0],t[1],t[2]),r=e.length();return r>0&&e.normalize(),(new n.Matrix4).makeRotationAxis(e,r)},t.prototype.rotate=function(t,e){var r=new n.Vector3(t[0],t[1],t[2]),i=this.rotationMatrix(e);return r.applyMatrix4(i),r},t.prototype.opticalCenter=function(t,e){var r=[-t[0],-t[1],-t[2]],n=[-e[0],-e[1],-e[2]];return this.rotate(n,r)},t.prototype.viewingDirection=function(t){var e=[-t[0],-t[1],-t[2]];return this.rotate([0,0,1],e)},t.prototype.wrap=function(t,e,r){if(rr||tr?t-=n:tr?r:t},t.prototype.angleBetweenVector2=function(t,e,r,n){var i=Math.atan2(n,r)-Math.atan2(e,t);return this.wrapAngle(i)},t.prototype.angleDifference=function(t,e){var r=e-t;return this.wrapAngle(r)},t.prototype.relativeRotationAngle=function(t,e){var r=this.rotationMatrix([-t[0],-t[1],-t[2]]),n=this.rotationMatrix(e),i=r.multiply(n).elements;return Math.acos((i[0]+i[5]+i[10]-1)/2)},t.prototype.angleToPlane=function(t,e){var r=(new n.Vector3).fromArray(t),i=r.length();if(i.01&&this._scale<50},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),t.prototype.upVector=function(){var t=this._rt.elements;switch(this._orientation){case 1:return new n.Vector3(-t[1],-t[5],-t[9]);case 3:return new n.Vector3(t[1],t[5],t[9]);case 6:return new n.Vector3(-t[0],-t[4],-t[8]);case 8:return new n.Vector3(t[0],t[4],t[8]);default:return new n.Vector3(-t[1],-t[5],-t[9])}},t.prototype.projectorMatrix=function(){var t=this._normalizedToTextureMatrix(),e=this._focal,r=(new n.Matrix4).set(e,0,0,0,0,e,0,0,0,0,0,0,0,0,1,0);return t.multiply(r),t.multiply(this._rt),t},t.prototype.projectBasic=function(t){var e=this.projectSfM(t);return this._sfmToBasic(e)},t.prototype.unprojectBasic=function(t,e){var r=this._basicToSfm(t);return this.unprojectSfM(r,e)},t.prototype.projectSfM=function(t){var e=new n.Vector4(t[0],t[1],t[2],1);return e.applyMatrix4(this._rt),this._bearingToSfm([e.x,e.y,e.z])},t.prototype.unprojectSfM=function(t,e){var r=this._sfmToBearing(t),i=new n.Vector4(e*r[0],e*r[1],e*r[2],1);return i.applyMatrix4((new n.Matrix4).getInverse(this._rt)),[i.x/i.w,i.y/i.w,i.z/i.w]},t.prototype._sfmToBearing=function(t){if(this._fullPano()){var e=2*t[0]*Math.PI,r=2*-t[1]*Math.PI;return[a=Math.cos(r)*Math.sin(e),s=-Math.sin(r),c=Math.cos(r)*Math.cos(e)]}if(this._gpano){var i=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),o=[t[0]*i+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,t[1]*i+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels],e=2*Math.PI*(o[0]/this.gpano.FullPanoWidthPixels-.5),r=-Math.PI*(o[1]/this.gpano.FullPanoHeightPixels-.5),a=Math.cos(r)*Math.sin(e),s=-Math.sin(r),c=Math.cos(r)*Math.cos(e);return[a,s,c]}var u=new n.Vector3(t[0],t[1],this._focal);return u.normalize(),[u.x,u.y,u.z]},t.prototype._bearingToSfm=function(t){if(this._fullPano()){var e=t[0],r=t[1],n=t[2],i=Math.atan2(e,n),o=Math.atan2(-r,Math.sqrt(e*e+n*n));return[i/(2*Math.PI),-o/(2*Math.PI)]}if(this._gpano){var e=t[0],r=t[1],n=t[2],i=Math.atan2(e,n),o=Math.atan2(-r,Math.sqrt(e*e+n*n)),a=[(i/(2*Math.PI)+.5)*this.gpano.FullPanoWidthPixels,(-o/Math.PI+.5)*this.gpano.FullPanoHeightPixels],s=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels);return[(a[0]-this.gpano.CroppedAreaLeftPixels-this.gpano.CroppedAreaImageWidthPixels/2)/s,(a[1]-this.gpano.CroppedAreaTopPixels-this.gpano.CroppedAreaImageHeightPixels/2)/s]}return t[2]>0?[t[0]*this._focal/t[2],t[1]*this._focal/t[2]]:[t[0]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,t[1]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY]},t.prototype._basicToSfm=function(t){var e,r;switch(this._orientation){case 1:e=t[0],r=t[1];break;case 3:e=1-t[0],r=1-t[1];break;case 6:e=t[1],r=1-t[0];break;case 8:e=1-t[1],r=t[0];break;default:e=t[0],r=t[1]}var n=this._width,i=this._height,o=Math.max(n,i);return[e*n/o-n/o/2,r*i/o-i/o/2]},t.prototype._sfmToBasic=function(t){var e,r,n=this._width,i=this._height,o=Math.max(n,i),a=(t[0]+n/o/2)/n*o,s=(t[1]+i/o/2)/i*o;switch(this._orientation){case 1:e=a,r=s;break;case 3:e=1-a,r=1-s;break;case 6:e=1-s,r=a;break;case 8:e=s,r=1-a;break;default:e=a,r=s}return[e,r]},t.prototype._fullPano=function(){return null!=this.gpano&&0===this.gpano.CroppedAreaLeftPixels&&0===this.gpano.CroppedAreaTopPixels&&this.gpano.CroppedAreaImageWidthPixels===this.gpano.FullPanoWidthPixels&&this.gpano.CroppedAreaImageHeightPixels===this.gpano.FullPanoHeightPixels},t.prototype._getValue=function(t,e){return null!=t&&t>0?t:e},t.prototype._getRt=function(t,e){var r=new n.Vector3(t[0],t[1],t[2]),i=r.length();i>0&&r.normalize();var o=new n.Matrix4;return o.makeRotationAxis(r,i),o.setPosition(new n.Vector3(e[0],e[1],e[2])),o},t.prototype._getSrt=function(t,e){var r=t.clone(),i=r.elements;return i[12]=e*i[12],i[13]=e*i[13],i[14]=e*i[14],r.scale(new n.Vector3(e,e,e)),r},t.prototype._normalizedToTextureMatrix=function(){var t=Math.max(this._width,this._height),e=t/this._width,r=t/this._height;switch(this._orientation){case 1:return(new n.Matrix4).set(e,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1);case 3:return(new n.Matrix4).set(-e,0,0,.5,0,r,0,.5,0,0,1,0,0,0,0,1);case 6:return(new n.Matrix4).set(0,-r,0,.5,-e,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new n.Matrix4).set(0,r,0,.5,e,0,0,.5,0,0,1,0,0,0,0,1);default:return(new n.Matrix4).set(e,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1)}},t}();r.Transform=i},{three:176}],316:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(){this._unprojectDepth=200}return t.prototype.basicToCanvas=function(t,e,r,n,i){var o=n.unprojectBasic([t,e],this._unprojectDepth);return this.projectToCanvas(o,r,i)},t.prototype.basicToCanvasSafe=function(t,e,r,n,i){var o=n.unprojectBasic([t,e],this._unprojectDepth),a=this.worldToCamera(o,i);if(a[2]>0)return null;var s=this.cameraToViewport(a,i),c=s[0],u=s[1];return this.viewportToCanvas(c,u,r)},t.prototype.basicToViewport=function(t,e,r,n){var i=r.unprojectBasic([t,e],this._unprojectDepth);return this.projectToViewport(i,n)},t.prototype.cameraToViewport=function(t,e){var r=(new n.Vector3).fromArray(t).applyMatrix4(e.projectionMatrix);return[r.x,r.y]},t.prototype.canvasPosition=function(t,e){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]},t.prototype.canvasToBasic=function(t,e,r,n,i){var o=this.unprojectFromCanvas(t,e,r,i).toArray();return n.projectBasic(o)},t.prototype.canvasToViewport=function(t,e,r){var n=this.containerToCanvas(r);return[2*t/n[0]-1,1-2*e/n[1]]},t.prototype.containerToCanvas=function(t){return[t.offsetWidth,t.offsetHeight]},t.prototype.getBasicDistances=function(t,e){var r=this.viewportToBasic(-1,1,t,e),n=this.viewportToBasic(1,1,t,e),i=this.viewportToBasic(1,-1,t,e),o=this.viewportToBasic(-1,-1,t,e),a=0,s=0,c=0,u=0;return r[1]<0&&n[1]<0&&(a=r[1]>n[1]?-r[1]:-n[1]),n[0]>1&&i[0]>1&&(s=n[0]1&&o[1]>1&&(c=i[1]r[0]?-o[0]:-r[0]),[a,s,c,u]},t.prototype.getPixelDistances=function(t,e,r){var n=this.viewportToBasic(-1,1,e,r),i=this.viewportToBasic(1,1,e,r),o=this.viewportToBasic(1,-1,e,r),a=this.viewportToBasic(-1,-1,e,r),s=0,c=0,u=0,h=0,l=this.containerToCanvas(t),p=l[0],f=l[1];if(n[1]<0&&i[1]<0){d=n[1]>i[1]?n[0]:i[0];s=(v=this.basicToCanvas(d,0,t,e,r))[1]>0?v[1]:0}if(i[0]>1&&o[0]>1){m=i[0]1&&a[1]>1){var d=o[1]n[0]?a[1]:n[1],v=this.basicToCanvas(0,m,t,e,r);h=v[0]>0?v[0]:0}return[s,c,u,h]},t.prototype.insideElement=function(t,e){var r=e.getBoundingClientRect(),n=r.left+e.clientLeft,i=n+e.clientWidth,o=r.top+e.clientTop,a=o+e.clientHeight;return t.clientX>n&&t.clientXo&&t.clientY"===e||">="===e||"<"===e||"<="===e?this._compileComparisonOp(e,t[1],t[2],!0):"in"===e?this._compileInOp(t[1],t.slice(2)):"!in"===e?this._compileNegation(this._compileInOp(t[1],t.slice(2))):"all"===e?this._compileLogicalOp(t.slice(1),"&&"):"true")+")"},t.prototype._compare=function(t,e){return te?1:0},t.prototype._compileComparisonOp=function(t,e,r,n){var i=this._compilePropertyReference(e),o=JSON.stringify(r);return(n?"typeof "+i+"===typeof "+o+"&&":"")+i+t+o},t.prototype._compileInOp=function(t,e){var r=this._compare;return JSON.stringify(e.sort(r))+".indexOf("+this._compilePropertyReference(t)+")!==-1"},t.prototype._compileLogicalOp=function(t,e){var r=this._compile.bind(this);return t.map(r).join(e)},t.prototype._compileNegation=function(t){return"!("+t+")"},t.prototype._compilePropertyReference=function(t){return"node["+JSON.stringify(t)+"]"},t}();r.FilterCreator=n,r.default=n},{}],318:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rbush"),i=t("rxjs/Subject");t("rxjs/add/observable/from"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/do"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publish");var o=t("../Edge"),a=t("../Error"),s=t("../Graph"),c=function(){function t(t,e,r,a,c,u){this._apiV3=t,this._cachedNodes={},this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._changed$=new i.Subject,this._defaultAlt=2,this._edgeCalculator=null!=a?a:new o.EdgeCalculator,this._filterCreator=null!=c?c:new s.FilterCreator,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=r?r:new s.GraphCalculator,this._configuration=null!=u?u:{maxSequences:50,maxUnusedNodes:100,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=e?e:n(16,[".lat",".lon",".lat",".lon"]),this._nodeIndexTiles={},this._nodeToTile={},this._preStored={},this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._tilePrecision=7,this._tileThreshold=20}return Object.defineProperty(t.prototype,"changed$",{get:function(){return this._changed$},enumerable:!0,configurable:!0}),t.prototype.cacheFill$=function(t){var e=this;if(t in this._cachingFull$)throw new a.GraphMapillaryError("Cannot fill node while caching full ("+t+").");if(!this.hasNode(t))throw new a.GraphMapillaryError("Cannot fill node that does not exist in graph ("+t+").");if(t in this._cachingFill$)return this._cachingFill$[t];var r=this.getNode(t);if(r.full)throw new a.GraphMapillaryError("Cannot fill node that is already full ("+t+").");return this._cachingFill$[t]=this._apiV3.imageByKeyFill$([t]).do(function(n){r.full||e._makeFull(r,n[t]),delete e._cachingFill$[t]}).map(function(t){return e}).finally(function(){t in e._cachingFill$&&delete e._cachingFill$[t],e._changed$.next(e)}).publish().refCount(),this._cachingFill$[t]},t.prototype.cacheFull$=function(t){var e=this;if(t in this._cachingFull$)return this._cachingFull$[t];if(this.hasNode(t))throw new a.GraphMapillaryError("Cannot cache full node that already exist in graph ("+t+").");return this._cachingFull$[t]=this._apiV3.imageByKeyFull$([t]).do(function(r){var n=r[t];if(e.hasNode(t))(i=e.getNode(t)).full||e._makeFull(i,n);else{if(null==n.sequence||null==n.sequence.key)throw new a.GraphMapillaryError("Node has no sequence ("+t+").");var i=new s.Node(n);e._makeFull(i,n);var o=e._graphCalculator.encodeH(i.originalLatLon,e._tilePrecision);e._preStore(o,i),e._setNode(i),delete e._cachingFull$[t]}}).map(function(t){return e}).finally(function(){t in e._cachingFull$&&delete e._cachingFull$[t],e._changed$.next(e)}).publish().refCount(),this._cachingFull$[t]},t.prototype.cacheNodeSequence$=function(t){if(!this.hasNode(t))throw new a.GraphMapillaryError("Cannot cache sequence edges of node that does not exist in graph ("+t+").");var e=this.getNode(t);if(e.sequenceKey in this._sequences)throw new a.GraphMapillaryError("Sequence already cached ("+t+"), ("+e.sequenceKey+").");return this._cacheSequence$(e.sequenceKey)},t.prototype.cacheSequence$=function(t){if(t in this._sequences)throw new a.GraphMapillaryError("Sequence already cached ("+t+")");return this._cacheSequence$(t)},t.prototype.cacheSequenceEdges=function(t){var e=this.getNode(t);if(!(e.sequenceKey in this._sequences))throw new a.GraphMapillaryError("Sequence is not cached ("+t+"), ("+e.sequenceKey+")");var r=this._sequences[e.sequenceKey].sequence,n=this._edgeCalculator.computeSequenceEdges(e,r);e.cacheSequenceEdges(n)},t.prototype.cacheSpatialArea$=function(t){var e=this;if(!this.hasNode(t))throw new a.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+t+").");if(t in this._cachedSpatialEdges)throw new a.GraphMapillaryError("Node already spatially cached ("+t+").");if(!(t in this._requiredSpatialArea))throw new a.GraphMapillaryError("Spatial area not determined ("+t+").");var r=this._requiredSpatialArea[t];if(0===Object.keys(r.cacheNodes).length)throw new a.GraphMapillaryError("Spatial nodes already cached ("+t+").");if(t in this._cachingSpatialArea$)return this._cachingSpatialArea$[t];for(var n=[];r.cacheKeys.length>0;)n.push(r.cacheKeys.splice(0,200));for(var i=n.length,o=[],s=this,c=0,u=n;c-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete e._requiredNodeTiles[t],e._cachedNodeTiles[t]=!0)}).catch(function(i){var o=r.caching.indexOf(n);throw o>-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete e._requiredNodeTiles[t],e._cachedNodeTiles[t]=!0),i}).finally(function(){e._changed$.next(e)}).publish().refCount())}(u[c]);return i},t.prototype.initializeCache=function(t){if(t in this._cachedNodes)throw new a.GraphMapillaryError("Node already in cache ("+t+").");var e=this.getNode(t);e.initializeCache(new s.NodeCache);var r=(new Date).getTime();this._cachedNodes[t]={accessed:r,node:e},this._updateCachedTileAccess(t,r)},t.prototype.isCachingFill=function(t){return t in this._cachingFill$},t.prototype.isCachingFull=function(t){return t in this._cachingFull$},t.prototype.isCachingNodeSequence=function(t){return this.getNode(t).sequenceKey in this._cachingSequences$},t.prototype.isCachingSequence=function(t){return t in this._cachingSequences$},t.prototype.isCachingTiles=function(t){return t in this._requiredNodeTiles&&0===this._requiredNodeTiles[t].cache.length&&this._requiredNodeTiles[t].caching.length>0},t.prototype.hasInitializedCache=function(t){return t in this._cachedNodes},t.prototype.hasNode=function(t){var e=(new Date).getTime();return this._updateCachedNodeAccess(t,e),this._updateCachedTileAccess(t,e),t in this._nodes},t.prototype.hasNodeSequence=function(t){var e=this.getNode(t).sequenceKey,r=e in this._sequences;return r&&(this._sequences[e].accessed=(new Date).getTime()),r},t.prototype.hasSequence=function(t){var e=t in this._sequences;return e&&(this._sequences[t].accessed=(new Date).getTime()),e},t.prototype.hasSpatialArea=function(t){if(!this.hasNode(t))throw new a.GraphMapillaryError("Spatial area nodes cannot be determined if node not in graph ("+t+").");if(t in this._cachedSpatialEdges)return!0;if(t in this._requiredSpatialArea)return 0===Object.keys(this._requiredSpatialArea[t].cacheNodes).length;for(var e=this.getNode(t),r=this._graphCalculator.boundingBoxCorners(e.latLon,this._tileThreshold),n={all:{},cacheKeys:[],cacheNodes:{}},i=0,o=this._nodeIndex.search({maxX:r[1].lat,maxY:r[1].lon,minX:r[0].lat,minY:r[0].lon});i0&&(this._requiredNodeTiles[t]=r)}return 0===r.cache.length&&0===r.caching.length},t.prototype.getNode=function(t){var e=(new Date).getTime();return this._updateCachedNodeAccess(t,e),this._updateCachedTileAccess(t,e),this._nodes[t]},t.prototype.getSequence=function(t){var e=this._sequences[t];return e.accessed=(new Date).getTime(),e.sequence},t.prototype.resetSpatialEdges=function(){for(var t=0,e=Object.keys(this._cachedSpatialEdges);t0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mergeCC",{get:function(){return this._fill.merge_cc},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mergeVersion",{get:function(){return this._fill.merge_version},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._cache.mesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"orientation",{get:function(){return this._fill.orientation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalCA",{get:function(){return this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalLatLon",{get:function(){return this._core.l},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pano",{get:function(){return null!=this._fill.gpano&&null!=this._fill.gpano.FullPanoWidthPixels},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectKey",{get:function(){return null!=this._fill.project?this._fill.project.key:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._fill.c_rotation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this._fill.atomic_scale},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceKey",{get:function(){return this._core.sequence.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges",{get:function(){return this._cache.sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges$",{get:function(){return this._cache.sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges",{get:function(){return this._cache.spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges$",{get:function(){return this._cache.spatialEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"userKey",{get:function(){return this._fill.user.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"username",{get:function(){return this._fill.user.username},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._fill.width},enumerable:!0,configurable:!0}),t.prototype.cacheAssets$=function(){var t=this;return this._cache.cacheAssets$(this.key,this.pano,this.merged).map(function(e){return t})},t.prototype.cacheImage$=function(t){var e=this;return this._cache.cacheImage$(this.key,t).map(function(t){return e})},t.prototype.cacheSequenceEdges=function(t){this._cache.cacheSequenceEdges(t)},t.prototype.cacheSpatialEdges=function(t){this._cache.cacheSpatialEdges(t)},t.prototype.dispose=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null),this._core=null,this._fill=null},t.prototype.initializeCache=function(t){if(null!=this._cache)throw new Error("Node cache already initialized ("+this.key+").");this._cache=t},t.prototype.makeFull=function(t){if(null==t)throw new Error("Fill can not be null.");this._fill=t},t.prototype.resetSequenceEdges=function(){this._cache.resetSequenceEdges()},t.prototype.resetSpatialEdges=function(){this._cache.resetSpatialEdges()},t.prototype.uncache=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null)},t}();r.Node=n,r.default=n},{"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/map":65}],324:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/publishReplay");var o=t("../Graph"),a=t("../Utils"),s=function(){function t(){this._disposed=!1,this._image=null,this._loadStatus={loaded:0,total:0},this._mesh=null,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$=new n.Subject,this._sequenceEdges$=this._sequenceEdgesChanged$.startWith(this._sequenceEdges).publishReplay(1).refCount(),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){}),this._spatialEdgesChanged$=new n.Subject,this._spatialEdges$=this._spatialEdgesChanged$.startWith(this._spatialEdges).publishReplay(1).refCount(),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){}),this._cachingAssets$=null}return Object.defineProperty(t.prototype,"image",{get:function(){return this._image},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadStatus",{get:function(){return this._loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges",{get:function(){return this._sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges$",{get:function(){return this._sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges",{get:function(){return this._spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges$",{get:function(){return this._spatialEdges$},enumerable:!0,configurable:!0}),t.prototype.cacheAssets$=function(t,e,r){var n=this;if(null!=this._cachingAssets$)return this._cachingAssets$;var o=e?a.Settings.basePanoramaSize:a.Settings.baseImageSize;return this._cachingAssets$=i.Observable.combineLatest(this._cacheImage$(t,o),this._cacheMesh$(t,r),function(t,e){return n._loadStatus.loaded=0,n._loadStatus.total=0,e&&(n._mesh=e.object,n._loadStatus.loaded+=e.loaded.loaded,n._loadStatus.total+=e.loaded.total),t&&(n._image=t.object,n._loadStatus.loaded+=t.loaded.loaded,n._loadStatus.total+=t.loaded.total),n}).finally(function(){n._cachingAssets$=null}).publishReplay(1).refCount(),this._cachingAssets$},t.prototype.cacheImage$=function(t,e){var r=this;return null!=this._image&&e<=Math.max(this._image.width,this._image.height)?i.Observable.of(this):this._cacheImage$(t,e).first(function(t){return null!=t.object}).do(function(t){r._disposeImage(),r._image=t.object}).map(function(t){return r})},t.prototype.cacheSequenceEdges=function(t){this._sequenceEdges={cached:!0,edges:t},this._sequenceEdgesChanged$.next(this._sequenceEdges)},t.prototype.cacheSpatialEdges=function(t){this._spatialEdges={cached:!0,edges:t},this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype.dispose=function(){this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges),this._disposed=!0,null!=this._imageRequest&&this._imageRequest.abort(),null!=this._meshRequest&&this._meshRequest.abort()},t.prototype.resetSequenceEdges=function(){this._sequenceEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges)},t.prototype.resetSpatialEdges=function(){this._spatialEdges={cached:!1,edges:[]},this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype._cacheImage$=function(t,e){var r=this;return i.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",a.Urls.thumbnail(t,e),!0),i.responseType="arraybuffer",i.timeout=15e3,i.onload=function(e){if(200!==i.status)return r._imageRequest=null,void n.error(new Error("Failed to fetch image ("+t+"). Status: "+i.status+", "+i.statusText));var o=new Image;o.crossOrigin="Anonymous",o.onload=function(i){if(r._imageRequest=null,r._disposed)return window.URL.revokeObjectURL(o.src),void n.error(new Error("Image load was aborted ("+t+")"));n.next({loaded:{loaded:e.loaded,total:e.total},object:o}),n.complete()},o.onerror=function(e){r._imageRequest=null,n.error(new Error("Failed to load image ("+t+")"))};var a=new Blob([i.response]);o.src=window.URL.createObjectURL(a)},i.onprogress=function(t){r._disposed||n.next({loaded:{loaded:t.loaded,total:t.total},object:null})},i.onerror=function(e){r._imageRequest=null,n.error(new Error("Failed to fetch image ("+t+")"))},i.ontimeout=function(e){r._imageRequest=null,n.error(new Error("Image request timed out ("+t+")"))},i.onabort=function(e){r._imageRequest=null,n.error(new Error("Image request was aborted ("+t+")"))},r._imageRequest=i,i.send(null)})},t.prototype._cacheMesh$=function(t,r){var n=this;return i.Observable.create(function(i){if(!r)return i.next(n._createEmptyMeshLoadStatus()),void i.complete();var s=new XMLHttpRequest;s.open("GET",a.Urls.protoMesh(t),!0),s.responseType="arraybuffer",s.timeout=15e3,s.onload=function(t){if(n._meshRequest=null,!n._disposed){var r=200===s.status?o.MeshReader.read(new e(s.response)):{faces:[],vertices:[]};i.next({loaded:{loaded:t.loaded,total:t.total},object:r}),i.complete()}},s.onprogress=function(t){n._disposed||i.next({loaded:{loaded:t.loaded,total:t.total},object:null})},s.onerror=function(e){n._meshRequest=null,console.error("Failed to cache mesh ("+t+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},s.ontimeout=function(e){n._meshRequest=null,console.error("Mesh request timed out ("+t+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},s.onabort=function(e){n._meshRequest=null,i.error(new Error("Mesh request was aborted ("+t+")"))},n._meshRequest=s,s.send(null)})},t.prototype._createEmptyMeshLoadStatus=function(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}},t.prototype._disposeImage=function(){null!=this._image&&window.URL.revokeObjectURL(this._image.src),this._image=null},t}();r.NodeCache=s,r.default=s}).call(this,t("buffer").Buffer)},{"../Graph":230,"../Utils":236,buffer:7,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/publishReplay":72}],325:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=function(){function t(t){this._key=t.key,this._keys=t.keys}return Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keys",{get:function(){return this._keys},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._key=null,this._keys=null},t.prototype.findNextKey=function(t){var e=n.indexOf(this._keys,t);return e+1>=this._keys.length||-1===e?null:this._keys[e+1]},t.prototype.findPrevKey=function(t){var e=n.indexOf(this._keys,t);return 0===e||-1===e?null:this._keys[e-1]},t}();r.Sequence=i,r.default=i},{underscore:178}],326:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../../Edge"),o=t("../../Error"),a=t("../../Geo"),s=function(){function t(t,e,r){this._spatial=new a.Spatial,this._geoCoords=new a.GeoCoords,this._settings=null!=t?t:new i.EdgeCalculatorSettings,this._directions=null!=e?e:new i.EdgeCalculatorDirections,this._coefficients=null!=r?r:new i.EdgeCalculatorCoefficients}return t.prototype.getPotentialEdges=function(t,e,r){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(!t.merged)return[];for(var i=this._spatial.viewingDirection(t.rotation),a=this._spatial.angleToPlane(i.toArray(),[0,0,1]),s=[],c=0,u=e;cthis._settings.maxDistance&&r.indexOf(h.key)<0)){var d=this._spatial.angleBetweenVector2(i.x,i.y,p.x,p.y),m=this._spatial.angleToPlane(p.toArray(),[0,0,1]),v=this._spatial.viewingDirection(h.rotation),g=this._spatial.angleBetweenVector2(i.x,i.y,v.x,v.y),y=this._spatial.angleToPlane(v.toArray(),[0,0,1])-a,b=this._spatial.relativeRotationAngle(t.rotation,h.rotation),_=this._spatial.angleBetweenVector2(1,0,p.x,p.y),x=null!=h.sequenceKey&&null!=t.sequenceKey&&h.sequenceKey===t.sequenceKey,w=null==h.mergeCC&&null==t.mergeCC||h.mergeCC===t.mergeCC,S=h.userKey===t.userKey,M={capturedAt:h.capturedAt,croppedPano:h.pano&&!h.fullPano,directionChange:g,distance:f,fullPano:h.fullPano,key:h.key,motionChange:d,rotation:b,sameMergeCC:w,sameSequence:x,sameUser:S,sequenceKey:h.sequenceKey,verticalDirectionChange:y,verticalMotion:m,worldMotionAzimuth:_};s.push(M)}}}return s},t.prototype.computeSequenceEdges=function(t,e){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(t.sequenceKey!==e.key)throw new o.ArgumentMapillaryError("Node and sequence does not correspond.");var r=[],n=e.findNextKey(t.key);null!=n&&r.push({data:{direction:i.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:t.key,to:n});var a=e.findPrevKey(t.key);return null!=a&&r.push({data:{direction:i.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:t.key,to:a}),r},t.prototype.computeSimilarEdges=function(t,e){var r=this;if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");for(var n=t.fullPano,a={},s=0,c=e;sthis._settings.similarMaxDirectionChange)continue;v.distance>this._settings.similarMaxDistance||v.sameUser&&Math.abs(v.capturedAt-t.capturedAt)this._settings.stepMaxDirectionChange)){var d=this._spatial.angleDifference(s.motionChange,f.motionChange),m=this._spatial.angleDifference(f.directionChange,d),v=Math.max(Math.abs(d),Math.abs(m));if(!(Math.abs(v)>this._settings.stepMaxDrift)){var g=f.key;if(!s.useFallback||g!==r&&g!==n||(h=f),!(f.distance>this._settings.stepMaxDistance)){d=Math.sqrt(d*d+f.verticalMotion*f.verticalMotion);var y=this._coefficients.stepPreferredDistance*Math.abs(f.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*d/this._settings.stepMaxDrift+this._coefficients.stepRotation*f.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(f.sameSequence?0:1)+this._coefficients.stepMergeCCPenalty*(f.sameMergeCC?0:1);ythis._settings.turnMaxDistance)){var p=a.direction!==i.EdgeDirection.TurnU&&l.distancethis._settings.turnMinRigDirectionChange,f=this._spatial.angleDifference(a.directionChange,l.directionChange),d=void 0;if(p&&l.directionChange*a.directionChange>0&&Math.abs(l.directionChange)this._settings.turnMaxDirectionChange)continue;var m=a.motionChange?this._spatial.angleDifference(a.motionChange,l.motionChange):0;m=Math.sqrt(m*m+l.verticalMotion*l.verticalMotion),d=this._coefficients.turnDistance*l.distance/this._settings.turnMaxDistance+this._coefficients.turnMotion*m/Math.PI+this._coefficients.turnSequencePenalty*(l.sameSequence?0:1)+this._coefficients.turnMergeCCPenalty*(l.sameMergeCC?0:1)}dthis._settings.panoMaxDistance))if(w.fullPano){if(w.distancethis._settings.panoMaxStepTurnChange)){a.push([h.direction,w]);break}}}for(var f=Math.PI/this._settings.panoMaxItems,d=[],m=[],v=0;vf)){for(var M=Number.MAX_VALUE,E=0,T=d;Ef)){for(var F=Number.MAX_VALUE,B=0,U=N;B0&&t.elementWidth>0&&t.elementHeight>0}).map(function(t){var e=t.elementWidth/t.elementHeight,r=t.imageAspect/e,n=0,i=0;return t.renderMode===a.RenderMode.Letterbox?t.imageAspect>e?n=t.elementHeight*(1-1/r)/2:i=t.elementWidth*(1-r)/2:t.imageAspect>e?i=-t.elementWidth*(r-1)/2:n=-t.elementHeight*(1/r-1)/2,{bottom:n,left:i,right:i,top:n}}),this._currentFrame$.filter(function(t){return null!=t.state.currentNode}).distinctUntilChanged(function(t,e){return t===e},function(t){return t.state.currentNode.key}).map(function(t){return t.state.currentTransform.basicAspect}).map(function(t){return function(e){return e.imageAspect=t,e}}).subscribe(this._adaptiveOperation$),this._renderAdaptive$.scan(function(t,e){return null==e.vnode?delete t[e.name]:t[e.name]=e.vnode,t},{}).combineLatest(this._offset$).map(function(t){var e=n.values(t[0]),r=t[1],o={style:{bottom:r.bottom+"px",left:r.left+"px","pointer-events":"none",position:"absolute",right:r.right+"px",top:r.top+"px"}};return{name:"adaptiveDomRenderer",vnode:i.h("div.adaptiveDomRenderer",o,e)}}).subscribe(this._render$),this._vNode$=this._render$.scan(function(t,e){return null==e.vnode?delete t[e.name]:t[e.name]=e.vnode,t},{}).map(function(t){var e=n.values(t);return i.h("div.domRenderer",e)}),this._vPatch$=this._vNode$.scan(function(t,e){return t.vpatch=i.diff(t.vnode,e),t.vnode=e,t},{vnode:i.h("div.domRenderer",[]),vpatch:null}).pluck("vpatch"),this._element$=this._vPatch$.scan(function(t,e){return i.patch(t,e)},s).publishReplay(1).refCount(),this._element$.subscribe(function(){}),this._renderService.size$.map(function(t){return function(e){return e.elementWidth=t.width,e.elementHeight=t.height,e}}).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.map(function(t){return function(e){return e.renderMode=t,e}}).subscribe(this._adaptiveOperation$)}return Object.defineProperty(t.prototype,"element$",{get:function(){return this._element$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderAdaptive$",{get:function(){return this._renderAdaptive$},enumerable:!0,configurable:!0}),t.prototype.clear=function(t){this._renderAdaptive$.next({name:t,vnode:null}),this._render$.next({name:t,vnode:null})},t}();r.DOMRenderer=s,r.default=s},{"../Render":232,"rxjs/Subject":34,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":73,underscore:178,"virtual-dom":182}],332:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Background=0]="Background",t[t.Foreground=1]="Foreground"}(n=r.GLRenderStage||(r.GLRenderStage={})),r.default=n},{}],333:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/startWith");var a=t("../Render"),s=function(){function t(t,e){var r=this;this._renderFrame$=new o.Subject,this._renderCameraOperation$=new o.Subject,this._render$=new o.Subject,this._clear$=new o.Subject,this._renderOperation$=new o.Subject,this._rendererOperation$=new o.Subject,this._eraserOperation$=new o.Subject,this._renderService=e,this._renderer$=this._rendererOperation$.scan(function(t,e){return e(t)},{needsRender:!1,renderer:null}),this._renderCollection$=this._renderOperation$.scan(function(t,e){return e(t)},{}).share(),this._renderCamera$=this._renderCameraOperation$.scan(function(t,e){return e(t)},{frameId:-1,needsRender:!1,perspective:null}),this._eraser$=this._eraserOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},{needsRender:!1}),i.Observable.combineLatest([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],function(t,e,r,n){return{camera:r,eraser:n,renderer:t,renders:Object.keys(e).map(function(t){return e[t]})}}).filter(function(t){for(var e=t.renderer.needsRender||t.camera.needsRender||t.eraser.needsRender,r=t.camera.frameId,n=0,i=t.renders;nr:t1e-9){var i=e.state.currentTransform,o=null!=e.state.previousTransform?e.state.previousTransform:e.state.currentTransform,a=null!=e.state.previousNode?e.state.previousNode:e.state.currentNode;r.currentAspect=i.basicAspect,r.currentPano=e.state.currentNode.pano,r.previousAspect=o.basicAspect,r.previousPano=a.pano,r.alpha=e.state.alpha,r.zoom=e.state.zoom,r.camera.copy(n),r.updatePerspective(n),r.updateRotation(n),r.updateProjection()}r.frameId=e.id}).map(function(t){return t[1]}).publishReplay(1).refCount(),this._renderCamera$=this._renderCameraFrame$.filter(function(t){return t.changed}).publishReplay(1).refCount(),this._bearing$=this._renderCamera$.map(function(t){var e=s._spatial.radToDeg(s._spatial.azimuthalToBearing(t.rotation.phi));return s._spatial.wrap(e,0,360)}).publishReplay(1).refCount(),this._size$.skip(1).map(function(t){return function(e){return e.updateAspect(t.width,t.height),e.updateProjection(),e}}).subscribe(this._renderCameraOperation$),this._renderMode$.skip(1).map(function(t){return function(e){return e.renderMode=t,e.updateProjection(),e}}).subscribe(this._renderCameraOperation$),this._bearing$.subscribe(function(){}),this._renderCameraHolder$.subscribe(function(){}),this._size$.subscribe(function(){}),this._renderMode$.subscribe(function(){}),this._renderCamera$.subscribe(function(){}),this._renderCameraFrame$.subscribe(function(){})}return Object.defineProperty(t.prototype,"bearing$",{get:function(){return this._bearing$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this._element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"resize$",{get:function(){return this._resize$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size$",{get:function(){return this._size$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderMode$",{get:function(){return this._renderMode$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderCameraFrame$",{get:function(){return this._renderCameraFrame$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderCamera$",{get:function(){return this._renderCamera$},enumerable:!0,configurable:!0}),t}();r.RenderService=s,r.default=s},{"../Geo":229,"../Render":232,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/skip":75,"rxjs/add/operator/startWith":78,"rxjs/add/operator/withLatestFrom":83}],337:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Traversing=0]="Traversing",t[t.Waiting=1]="Waiting"}(n=r.State||(r.State={})),r.default=n},{}],338:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../State"),i=t("../Geo"),o=function(){function t(){this._state=new n.TraversingState({alpha:1,camera:new i.Camera,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],zoom:0})}return t.prototype.traverse=function(){this._state=this._state.traverse()},t.prototype.wait=function(){this._state=this._state.wait()},Object.defineProperty(t.prototype,"state",{get:function(){if(this._state instanceof n.TraversingState)return n.State.Traversing;if(this._state instanceof n.WaitingState)return n.State.Waiting;throw new Error("Invalid state")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reference",{get:function(){return this._state.reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._state.alpha},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._state.camera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this._state.zoom},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._state.currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousNode",{get:function(){return this._state.previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera",{get:function(){return this._state.currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform",{get:function(){return this._state.currentTransform},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousTransform",{get:function(){return this._state.previousTransform},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trajectory",{get:function(){return this._state.trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentIndex",{get:function(){return this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastNode",{get:function(){return this._state.trajectory[this._state.trajectory.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodesAhead",{get:function(){return this._state.trajectory.length-1-this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"motionless",{get:function(){return this._state.motionless},enumerable:!0,configurable:!0}),t.prototype.getCenter=function(){return this._state.getCenter()},t.prototype.setCenter=function(t){this._state.setCenter(t)},t.prototype.setZoom=function(t){this._state.setZoom(t)},t.prototype.update=function(t){this._state.update(t)},t.prototype.append=function(t){this._state.append(t)},t.prototype.prepend=function(t){this._state.prepend(t)},t.prototype.remove=function(t){this._state.remove(t)},t.prototype.clear=function(){this._state.clear()},t.prototype.clearPrior=function(){this._state.clearPrior()},t.prototype.cut=function(){this._state.cut()},t.prototype.set=function(t){this._state.set(t)},t.prototype.rotate=function(t){this._state.rotate(t)},t.prototype.rotateBasic=function(t){this._state.rotateBasic(t)},t.prototype.rotateBasicUnbounded=function(t){this._state.rotateBasicUnbounded(t)},t.prototype.rotateToBasic=function(t){this._state.rotateToBasic(t)},t.prototype.move=function(t){this._state.move(t)},t.prototype.moveTo=function(t){this._state.moveTo(t)},t.prototype.zoomIn=function(t,e){this._state.zoomIn(t,e)},t}();r.StateContext=o},{"../Geo":229,"../State":233}],339:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Subject"),o=t("rxjs/util/AnimationFrame");t("rxjs/add/operator/bufferCount"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/do"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/pairwise"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom");var a=t("../State"),s=function(){function t(){var t=this;this._appendNode$=new i.Subject,this._start$=new i.Subject,this._frame$=new i.Subject,this._fpsSampleRate=30,this._contextOperation$=new n.BehaviorSubject(function(t){return t}),this._context$=this._contextOperation$.scan(function(t,e){return e(t)},new a.StateContext).publishReplay(1).refCount(),this._state$=this._context$.map(function(t){return t.state}).distinctUntilChanged().publishReplay(1).refCount(),this._fps$=this._start$.switchMap(function(){return t._frame$.bufferCount(1,t._fpsSampleRate).map(function(t){return(new Date).getTime()}).pairwise().map(function(e){return Math.max(20,1e3*t._fpsSampleRate/(e[1]-e[0]))}).startWith(60)}).share(),this._currentState$=this._frame$.withLatestFrom(this._fps$,this._context$,function(t,e,r){return[t,e,r]}).filter(function(t){return null!=t[2].currentNode}).do(function(t){t[2].update(t[1])}).map(function(t){return{fps:t[1],id:t[0],state:t[2]}}).share(),this._lastState$=this._currentState$.publishReplay(1).refCount();var e=this._currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).publishReplay(1).refCount(),r=new i.Subject;e.subscribe(r),this._currentKey$=new n.BehaviorSubject(null),r.map(function(t){return t.state.currentNode.key}).subscribe(this._currentKey$),this._currentNode$=r.map(function(t){return t.state.currentNode}).publishReplay(1).refCount(),this._currentCamera$=r.map(function(t){return t.state.currentCamera}).publishReplay(1).refCount(),this._currentTransform$=r.map(function(t){return t.state.currentTransform}).publishReplay(1).refCount(),this._reference$=r.map(function(t){return t.state.reference}).distinctUntilChanged(function(t,e){return t.lat===e.lat&&t.lon===e.lon},function(t){return{lat:t.lat,lon:t.lon}}).publishReplay(1).refCount(),this._currentNodeExternal$=e.map(function(t){return t.state.currentNode}).publishReplay(1).refCount(),this._appendNode$.map(function(t){return function(e){return e.append([t]),e}}).subscribe(this._contextOperation$),this._inMotionOperation$=new i.Subject,e.map(function(t){return!0}).subscribe(this._inMotionOperation$),this._inMotionOperation$.distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._currentState$.filter(function(t){return 0===t.state.nodesAhead}).map(function(t){return[t.state.camera.clone(),t.state.zoom]}).pairwise().map(function(t){var e=t[0][0],r=t[1][0],n=t[0][1],i=t[1][1];return e.diff(r)>1e-5||Math.abs(n-i)>1e-5}).first(function(t){return!t})}).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._inTranslationOperation$=new i.Subject,e.map(function(t){return!0}).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._currentState$.filter(function(t){return 0===t.state.nodesAhead}).map(function(t){return t.state.camera.position.clone()}).pairwise().map(function(t){return 0!==t[0].distanceToSquared(t[1])}).first(function(t){return!t})}).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._state$.subscribe(function(){}),this._currentNode$.subscribe(function(){}),this._currentCamera$.subscribe(function(){}),this._currentTransform$.subscribe(function(){}),this._reference$.subscribe(function(){}),this._currentNodeExternal$.subscribe(function(){}),this._lastState$.subscribe(function(){}),this._inMotion$.subscribe(function(){}),this._inTranslation$.subscribe(function(){}),this._frameId=null,this._frameGenerator=new o.RequestAnimationFrameDefinition(window)}return Object.defineProperty(t.prototype,"currentState$",{get:function(){return this._currentState$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode$",{get:function(){return this._currentNode$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentKey$",{get:function(){return this._currentKey$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNodeExternal$",{get:function(){return this._currentNodeExternal$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera$",{get:function(){return this._currentCamera$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform$",{get:function(){return this._currentTransform$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state$",{get:function(){return this._state$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reference$",{get:function(){return this._reference$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inMotion$",{get:function(){return this._inMotion$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inTranslation$",{get:function(){return this._inTranslation$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appendNode$",{get:function(){return this._appendNode$},enumerable:!0,configurable:!0}),t.prototype.traverse=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.traverse()})},t.prototype.wait=function(){this._invokeContextOperation(function(t){t.wait()})},t.prototype.appendNodes=function(t){this._invokeContextOperation(function(e){e.append(t)})},t.prototype.prependNodes=function(t){this._invokeContextOperation(function(e){e.prepend(t)})},t.prototype.removeNodes=function(t){this._invokeContextOperation(function(e){e.remove(t)})},t.prototype.clearNodes=function(){this._invokeContextOperation(function(t){t.clear()})},t.prototype.clearPriorNodes=function(){this._invokeContextOperation(function(t){t.clearPrior()})},t.prototype.cutNodes=function(){this._invokeContextOperation(function(t){t.cut()})},t.prototype.setNodes=function(t){this._invokeContextOperation(function(e){e.set(t)})},t.prototype.rotate=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotate(t)})},t.prototype.rotateBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasic(t)})},t.prototype.rotateBasicUnbounded=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasicUnbounded(t)})},t.prototype.rotateToBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateToBasic(t)})},t.prototype.move=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.move(t)})},t.prototype.moveTo=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.moveTo(t)})},t.prototype.zoomIn=function(t,e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(r){r.zoomIn(t,e)})},t.prototype.getCenter=function(){return this._lastState$.first().map(function(t){return t.state.getCenter()})},t.prototype.getZoom=function(){return this._lastState$.first().map(function(t){return t.state.zoom})},t.prototype.setCenter=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setCenter(t)})},t.prototype.setZoom=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setZoom(t)})},t.prototype.start=function(){null==this._frameId&&(this._start$.next(null),this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId))},t.prototype.stop=function(){null!=this._frameId&&(this._frameGenerator.cancelAnimationFrame(this._frameId),this._frameId=null)},t.prototype._invokeContextOperation=function(t){this._contextOperation$.next(function(e){return t(e),e})},t.prototype._frame=function(t){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)},t}();r.StateService=s},{"../State":233,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/bufferCount":50,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83,"rxjs/util/AnimationFrame":157}],340:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../Error"),i=t("../../Geo"),o=function(){function t(t){this._spatial=new i.Spatial,this._geoCoords=new i.GeoCoords,this._referenceThreshold=.01,this._reference=t.reference,this._alpha=t.alpha,this._camera=t.camera.clone(),this._zoom=t.zoom,this._currentIndex=t.currentIndex,this._trajectory=t.trajectory.slice(),this._trajectoryTransforms=[],this._trajectoryCameras=[];for(var e=0,r=this._trajectory;e0?this._trajectory[this._currentIndex]:null,this._previousNode=this._trajectory.length>1&&this.currentIndex>0?this._trajectory[this._currentIndex-1]:null,this._currentCamera=this._trajectoryCameras.length>0?this._trajectoryCameras[this._currentIndex].clone():new i.Camera,this._previousCamera=this._trajectoryCameras.length>1&&this.currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}return Object.defineProperty(t.prototype,"reference",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._getAlpha()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this._zoom},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trajectory",{get:function(){return this._trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentIndex",{get:function(){return this._currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousNode",{get:function(){return this._previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera",{get:function(){return this._currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform",{get:function(){return this._trajectoryTransforms.length>0?this._trajectoryTransforms[this.currentIndex]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousTransform",{get:function(){return this._trajectoryTransforms.length>1&&this.currentIndex>0?this._trajectoryTransforms[this.currentIndex-1]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"motionless",{get:function(){return this._motionless},enumerable:!0,configurable:!0}),t.prototype.append=function(t){if(t.length<1)throw Error("Trajectory can not be empty");this._currentIndex<0?this.set(t):(this._trajectory=this._trajectory.concat(t),this._appendToTrajectories(t))},t.prototype.prepend=function(t){if(t.length<1)throw Error("Trajectory can not be empty");this._trajectory=t.slice().concat(this._trajectory),this._currentIndex+=t.length,this._setCurrentNode(),this._setReference(this._currentNode)?this._setTrajectories():this._prependToTrajectories(t),this._setCurrentCamera()},t.prototype.remove=function(t){if(t<0)throw Error("n must be a positive integer");if(this._currentIndex-10&&this.remove(this._currentIndex-1)},t.prototype.clear=function(){this.cut(),this._currentIndex>0&&this.remove(this._currentIndex-1)},t.prototype.cut=function(){for(;this._trajectory.length-1>this._currentIndex;)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()},t.prototype.set=function(t){this._setTrajectory(t),this._setCurrentNode(),this._setReference(this._currentNode),this._setTrajectories(),this._setCurrentCamera()},t.prototype.getCenter=function(){return null!=this._currentNode?this.currentTransform.projectBasic(this._camera.lookat.toArray()):[.5,.5]},t.prototype._setCurrent=function(){this._setCurrentNode(),this._setReference(this._currentNode)&&this._setTrajectories(),this._setCurrentCamera()},t.prototype._setCurrentCamera=function(){this._currentCamera=this._trajectoryCameras[this._currentIndex].clone(),this._previousCamera=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()},t.prototype._motionlessTransition=function(){return null!=this._currentNode&&null!=this._previousNode&&!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent())},t.prototype._setReference=function(t){return!(Math.abs(t.latLon.lat-this.reference.lat)0?this._trajectory[this._currentIndex]:null,this._previousNode=this._currentIndex>0?this._trajectory[this._currentIndex-1]:null},t.prototype._setTrajectory=function(t){if(t.length<1)throw new n.ArgumentMapillaryError("Trajectory can not be empty");null!=this._currentNode?(this._trajectory=[this._currentNode].concat(t),this._currentIndex=1):(this._trajectory=t.slice(),this._currentIndex=0)},t.prototype._setTrajectories=function(){this._trajectoryTransforms.length=0,this._trajectoryCameras.length=0,this._appendToTrajectories(this._trajectory)},t.prototype._appendToTrajectories=function(t){for(var e=0,r=t;et?this._phi:0,this._theta=Math.abs(this._theta)>t?this._theta:0},t.prototype.lengthSquared=function(){return this._phi*this._phi+this._theta*this._theta},t.prototype.reset=function(){this._phi=0,this._theta=0},t}(),c=function(t){function e(e){var r=t.call(this,e)||this;return r._adjustCameras(),r._motionless=r._motionlessTransition(),r._baseAlpha=r._alpha,r._animationSpeed=.025,r._unitBezier=new o(.74,.67,.38,.96),r._useBezier=!1,r._rotationDelta=new s(0,0),r._requestedRotationDelta=null,r._basicRotation=[0,0],r._requestedBasicRotation=null,r._requestedBasicRotationUnbounded=null,r._rotationAcceleration=.86,r._rotationIncreaseAlpha=.97,r._rotationDecreaseAlpha=.9,r._rotationThreshold=.001,r._unboundedRotationAlpha=.8,r._desiredZoom=e.zoom,r._minZoom=0,r._maxZoom=3,r._lookatDepth=10,r._desiredLookat=null,r._desiredCenter=null,r}return n(e,t),e.prototype.traverse=function(){throw new Error("Not implemented")},e.prototype.wait=function(){return new a.WaitingState(this)},e.prototype.append=function(e){var r=0===this._trajectory.length;r&&this._resetTransition(),t.prototype.append.call(this,e),r&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.prepend=function(e){var r=0===this._trajectory.length;r&&this._resetTransition(),t.prototype.prepend.call(this,e),r&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.set=function(e){t.prototype.set.call(this,e),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)},e.prototype.move=function(t){throw new Error("Not implemented")},e.prototype.moveTo=function(t){throw new Error("Not implemented")},e.prototype.rotate=function(t){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedBasicRotation=null,null!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+t.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+t.theta):this._requestedRotationDelta=new s(t.phi,t.theta))},e.prototype.rotateBasic=function(t){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,null!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=t[0],this._requestedBasicRotation[1]+=t[1];var e=.05/Math.pow(2,this._zoom);this._requestedBasicRotation[0]=this._spatial.clamp(this._requestedBasicRotation[0],-e,e),this._requestedBasicRotation[1]=this._spatial.clamp(this._requestedBasicRotation[1],-e,e)}else this._requestedBasicRotation=t.slice()},e.prototype.rotateBasicUnbounded=function(t){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=t[0],this._requestedBasicRotationUnbounded[1]+=t[1]):this._requestedBasicRotationUnbounded=t.slice())},e.prototype.rotateToBasic=function(t){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,t[0]=this._spatial.clamp(t[0],0,1),t[1]=this._spatial.clamp(t[1],0,1);var e=this.currentTransform.unprojectBasic(t,this._lookatDepth);this._currentCamera.lookat.fromArray(e)}},e.prototype.zoomIn=function(t,e){if(null!=this._currentNode){this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+t));var r=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray()),n=r[0],o=r[1],a=Math.pow(2,this._zoom),s=Math.pow(2,this._desiredZoom),c=e[0],u=e[1];null!=this.currentTransform.gpano&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels&&(c-n>.5?c-=1:n-c>.5&&(c=1+c));var h=c-a/s*(c-n),l=u-a/s*(u-o),p=this.currentTransform.gpano;this._currentNode.fullPano?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),l=this._spatial.clamp(l+this._basicRotation[1],.05,.95)):null!=p&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),l=this._spatial.clamp(l+this._basicRotation[1],0,1)):(h=this._spatial.clamp(h,0,1),l=this._spatial.clamp(l,0,1)),this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic([h,l],this._lookatDepth))}},e.prototype.setCenter=function(t){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._desiredZoom=this._zoom;var e=[this._spatial.clamp(t[0],0,1),this._spatial.clamp(t[1],0,1)];if(null!=this._currentNode){this._desiredCenter=null;var r=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(e,this._lookatDepth)),n=null!=this.previousTransform?this.previousTransform:this.currentTransform,o=(new i.Vector3).fromArray(n.unprojectBasic(e,this._lookatDepth));this._currentCamera.lookat.copy(r),this._previousCamera.lookat.copy(o)}else this._desiredCenter=e},e.prototype.setZoom=function(t){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._zoom=this._spatial.clamp(t,this._minZoom,this._maxZoom),this._desiredZoom=this._zoom},e.prototype.update=function(t){1===this._alpha&&this._currentIndex+this._alpha0?1:e<0?-1:0;0!==e&&(Math.abs(e)<.002?(this._zoom=this._desiredZoom,null!=this._desiredLookat&&(this._desiredLookat=null)):this._zoom+=r*Math.max(Math.abs(5*t*e),.002))},e.prototype._updateLookat=function(t){if(null!==this._desiredLookat){var e=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(e)<1e-6?(this._currentCamera.lookat.copy(this._desiredLookat),this._desiredLookat=null):this._currentCamera.lookat.lerp(this._desiredLookat,5*t)}},e.prototype._updateRotation=function(){if(null!=this._requestedRotationDelta){var t=this._rotationDelta.lengthSquared();return this._requestedRotationDelta.lengthSquared()>t?this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha):this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha),void(this._requestedRotationDelta=null)}this._rotationDelta.isZero||(this._rotationDelta.multiply(this._rotationAcceleration),this._rotationDelta.threshold(this._rotationThreshold))},e.prototype._updateRotationBasic=function(){if(null!=this._requestedBasicRotation){var t=this._basicRotation[0],e=this._basicRotation[1],r=this._requestedBasicRotation[0],n=this._requestedBasicRotation[1];return Math.abs(r)>Math.abs(t)?this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*t+this._rotationIncreaseAlpha*r:this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*t+this._rotationDecreaseAlpha*r,Math.abs(n)>Math.abs(e)?this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*e+this._rotationIncreaseAlpha*n:this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*e+this._rotationDecreaseAlpha*n,void(this._requestedBasicRotation=null)}if(null!=this._requestedBasicRotationUnbounded){var r=this._requestedBasicRotationUnbounded[0],n=this._requestedBasicRotationUnbounded[1];if(Math.abs(r)>0&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*r),Math.abs(n)>0&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*n),null!=this._desiredLookat){var o=this.currentTransform.projectBasic(this._desiredLookat.toArray());o[0]+=r,o[1]+=n,this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(o,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}0===this._basicRotation[0]&&0===this._basicRotation[1]||(this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0],this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1],Math.abs(this._basicRotation[0])0||this._basicRotation[1]>0)&&(this._basicRotation=[0,0]))},e.prototype._setDesiredCenter=function(){if(null!=this._desiredCenter){var t=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(this._desiredCenter,this._lookatDepth)).sub(this._currentCamera.position);this._currentCamera.lookat.copy(this._currentCamera.position.clone().add(t)),this._previousCamera.lookat.copy(this._previousCamera.position.clone().add(t)),this._desiredCenter=null}},e.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0},e}(a.StateBase);r.TraversingState=c},{"../../State":233,"@mapbox/unitbezier":2,three:176}],342:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../State"),o=function(t){function e(e){var r=t.call(this,e)||this;return r._zoom=0,r._adjustCameras(),r._motionless=r._motionlessTransition(),r}return n(e,t),e.prototype.traverse=function(){return new i.TraversingState(this)},e.prototype.wait=function(){throw new Error("Not implemented")},e.prototype.prepend=function(e){t.prototype.prepend.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.set=function(e){t.prototype.set.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.rotate=function(t){},e.prototype.rotateBasic=function(t){},e.prototype.rotateBasicUnbounded=function(t){},e.prototype.rotateToBasic=function(t){},e.prototype.zoomIn=function(t,e){},e.prototype.move=function(t){this._alpha=Math.max(0,Math.min(1,this._alpha+t))},e.prototype.moveTo=function(t){this._alpha=Math.max(0,Math.min(1,t))},e.prototype.update=function(t){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},e.prototype.setCenter=function(t){},e.prototype.setZoom=function(t){},e.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},e.prototype._setCurrentCamera=function(){t.prototype._setCurrentCamera.call(this),this._adjustCameras()},e.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){t=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(t.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){var t=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(t.clone().add(this._previousCamera.position))}}},e}(i.StateBase);r.WaitingState=o},{"../../State":233}],343:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Observable"),i=function(){function t(t,e,r){this._scheme=t,this._host=e,this._origin=null!=r?"?origin="+r:""}return t.prototype.getTile=function(t,e,r,i,o,a,s){var c="/"+t+"/"+e+","+r+","+i+","+o+"/"+a+","+s+"/0/default.jpg",u=this._scheme+"://"+this._host+c+this._origin,h=null;return[n.Observable.create(function(n){(h=new XMLHttpRequest).open("GET",u,!0),h.responseType="arraybuffer",h.timeout=15e3,h.onload=function(a){if(200===h.status){var s=new Image;s.crossOrigin="Anonymous",s.onload=function(t){n.next(s),n.complete()},s.onerror=function(a){n.error(new Error("Failed to load tile image ("+t+": "+e+","+r+","+i+","+o+")"))};var c=new Blob([h.response]);s.src=window.URL.createObjectURL(c)}else n.error(new Error("Failed to fetch tile ("+t+": "+e+","+r+","+i+","+o+"). Status: "+h.status+", "+h.statusText))},h.onerror=function(a){n.error(new Error("Failed to fetch tile ("+t+": "+e+","+r+","+i+","+o+")"))},h.ontimeout=function(a){n.error(new Error("Tile request timed out ("+t+": "+e+","+r+","+i+","+o+")"))},h.onabort=function(a){n.error(new Error("Tile request was aborted ("+t+": "+e+","+r+","+i+","+o+")"))},h.send(null)}),function(){null!=h&&h.abort()}]},t}();r.ImageTileLoader=i,r.default=i},{"rxjs/Observable":29}],344:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._images={}}return t.prototype.addImage=function(t,e,r){r in this._images||(this._images[r]={}),this._images[r][e]=t},t.prototype.dispose=function(){for(var t=0,e=Object.keys(this._images);te&&(e=i,r=n)}return t[0]+1-t[t.length-1]>e?[t[0],t[t.length-1]]:[t[r+1],t[r]]},t.prototype._clipBoundingBox=function(t){t.minX=Math.max(0,Math.min(1,t.minX)),t.maxX=Math.max(0,Math.min(1,t.maxX)),t.minY=Math.max(0,Math.min(1,t.minY)),t.maxY=Math.max(0,Math.min(1,t.maxY))},t.prototype._sign=function(t){return t>0?1:t<0?-1:0},t}();r.RegionOfInterestCalculator=i,r.default=i},{"../Geo":229}],346:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("rxjs/Subject"),o=function(){function t(t,e,r,n,o,a,s,c){this._disposed=!1,this._key=t,(e<=0||r<=0)&&console.warn("Original image size ("+e+", "+r+") is invalid ("+t+"). Tiles will not be loaded."),this._width=e,this._height=r,this._maxLevel=Math.ceil(Math.log(Math.max(r,e))/Math.log(2)),this._currentLevel=-1,this._tileSize=n,this._updated$=new i.Subject,this._createdSubject$=new i.Subject,this._created$=this._createdSubject$.publishReplay(1).refCount(),this._createdSubscription=this._created$.subscribe(function(){}),this._hasSubject$=new i.Subject,this._has$=this._hasSubject$.startWith(!1).publishReplay(1).refCount(),this._hasSubscription=this._has$.subscribe(function(){}),this._abortFunctions=[],this._tileSubscriptions={},this._renderedCurrentLevelTiles={},this._renderedTiles={},this._background=o,this._camera=null,this._imageTileLoader=a,this._imageTileStore=s,this._renderer=c,this._renderTarget=null,this._roi=null}return Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasTexture$",{get:function(){return this._has$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureUpdated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureCreated$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),t.prototype.abort=function(){for(var t in this._tileSubscriptions)this._tileSubscriptions.hasOwnProperty(t)&&this._tileSubscriptions[t].unsubscribe();this._tileSubscriptions={};for(var e=0,r=this._abortFunctions;ed?1:f/d,v=Math.floor(m*this._width),g=Math.floor(m*this._height);this._renderTarget=new n.WebGLRenderTarget(v,g,{depthBuffer:!1,format:n.RGBFormat,magFilter:n.LinearFilter,minFilter:n.LinearFilter,stencilBuffer:!1}),this._renderToTarget(0,0,this._width,this._height,this._background),this._createdSubject$.next(this._renderTarget.texture),this._hasSubject$.next(!0)}this._fetchTiles(l)}},t.prototype.updateBackground=function(t){this._background=t},t.prototype._fetchTile=function(t,e,r,n,i,o,a,s){var c=this,u=this._imageTileLoader.getTile(this._key,r,n,i,o,a,s),h=u[0],l=u[1];this._abortFunctions.push(l);var p=this._tileKey(t),f=h.subscribe(function(a){c._renderToTarget(r,n,i,o,a),c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),c._setTileRendered(t,c._currentLevel),c._imageTileStore.addImage(a,p,e),c._updated$.next(!0)},function(t){c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),console.error(t)});f.closed||(this._tileSubscriptions[p]=f)},t.prototype._fetchTiles=function(t){for(var e=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=0,n=t;rthis._width?this._width-a:e,u=s+e>this._height?this._height-s:e;if(this._imageTileStore.hasImage(o,this._currentLevel))this._renderToTarget(a,s,c,u,this._imageTileStore.getImage(o,this._currentLevel)),this._setTileRendered(i,this._currentLevel),this._updated$.next(!0);else{var h=Math.floor(c/e*this._tileSize),l=Math.floor(u/e*this._tileSize);this._fetchTile(i,this._currentLevel,a,s,c,u,h,l)}}}},t.prototype._getTileCoords=function(t){var e=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=Math.ceil(this._width/e)-1,n=Math.ceil(this._height/e)-1;return[Math.min(Math.floor(this._width*t[0]/e),r),Math.min(Math.floor(this._height*t[1]/e),n)]},t.prototype._getTiles=function(t,e){var r=[];if(t[0]>e[0]){for(var n=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),i=Math.ceil(this._width/n)-1,o=t[0];o<=i;o++)r.push(o);for(o=0;o<=e[0];o++)r.push(o)}else for(o=t[0];o<=e[0];o++)r.push(o);for(var a=[],s=0,c=r;s=h&&v[0]<=l&&v[1]>=p&&v[1]<=f){var g=this._renderedTiles[i].indexOf(v);this._renderedTiles[i].splice(g,1)}}0===this._renderedTiles[i].length&&delete this._renderedTiles[i]}this._renderedTiles[e].push(t),this._renderedCurrentLevelTiles[this._tileKey(t)]=!0},t.prototype._tileKey=function(t){return t[0]+"-"+t[1]},t}();r.TextureProvider=o,r.default=o},{"rxjs/Subject":34,three:176}],347:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._events={}}return t.prototype.on=function(t,e){this._events[t]=this._events[t]||[],this._events[t].push(e)},t.prototype.off=function(t,e){if(t)if(this._listens(t))delete this._events[t];else{var r=this._events[t].indexOf(e);r>=0&&this._events[t].splice(r,1),this._events[t].length&&delete this._events[t]}else this._events={}},t.prototype.fire=function(t,e){if(this._listens(t))for(var r=0,n=this._events[t];rr&&(r=t[n],e=n);return e}).publishReplay(1).refCount(),this._mouseOwner$.subscribe(function(){})}return Object.defineProperty(t.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentMouseMove$",{get:function(){return this._documentMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentMouseUp$",{get:function(){return this._documentMouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDragStart$",{get:function(){return this._domMouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDrag$",{get:function(){return this._domMouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDragEnd$",{get:function(){return this._domMouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDown$",{get:function(){return this._domMouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseMove$",{get:function(){return this._domMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOwner$",{get:function(){return this._mouseOwner$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDown$",{get:function(){return this._mouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseMove$",{get:function(){return this._mouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseLeave$",{get:function(){return this._mouseLeave$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOut$",{get:function(){return this._mouseOut$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOver$",{get:function(){return this._mouseOver$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseUp$",{get:function(){return this._mouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dblClick$",{get:function(){return this._dblClick$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contextMenu$",{get:function(){return this._consistentContextMenu$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseWheel$",{get:function(){return this._mouseWheel$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDragStart$",{get:function(){return this._mouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDrag$",{get:function(){return this._mouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDragEnd$",{get:function(){return this._mouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"staticClick$",{get:function(){return this._staticClick$},enumerable:!0,configurable:!0}),t.prototype.claimMouse=function(t,e){this._claimMouse$.next({name:t,zindex:e})},t.prototype.unclaimMouse=function(t){this._claimMouse$.next({name:t,zindex:null})},t.prototype.filtered$=function(t,e){return e.withLatestFrom(this.mouseOwner$,function(t,e){return[t,e]}).filter(function(e){return e[1]===t}).map(function(t){return t[0]})},t}();r.MouseService=s,r.default=s},{"../Geo":229,"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/fromEvent":42,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83}],359:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/ReplaySubject");t("rxjs/add/observable/throw"),t("rxjs/add/operator/do"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/mergeMap");var a=t("../API"),s=t("../Graph"),c=t("../Edge"),u=t("../State"),h=t("../Viewer"),l=function(){function t(t,e,r,i,o,c,l,p){this._apiV3=null!=r?r:new a.APIv3(t,e),this._imageLoadingService=null!=o?o:new s.ImageLoadingService,this._graphService=null!=i?i:new s.GraphService(new s.Graph(this.apiV3),this._imageLoadingService),this._loadingService=null!=c?c:new h.LoadingService,this._loadingName="navigator",this._stateService=null!=l?l:new u.StateService,this._cacheService=null!=p?p:new h.CacheService(this._graphService,this._stateService),this._cacheService.start(),this._keyRequested$=new n.BehaviorSubject(null),this._movedToKey$=new n.BehaviorSubject(null),this._request$=null,this._requestSubscription=null,this._nodeRequestSubscription=null}return Object.defineProperty(t.prototype,"apiV3",{get:function(){return this._apiV3},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"graphService",{get:function(){return this._graphService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageLoadingService",{get:function(){return this._imageLoadingService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadingService",{get:function(){return this._loadingService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"movedToKey$",{get:function(){return this._movedToKey$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stateService",{get:function(){return this._stateService},enumerable:!0,configurable:!0}),t.prototype.moveToKey$=function(t){this._abortRequest("to key "+t),this._loadingService.startLoading(this._loadingName);var e=this._moveToKey$(t);return this._makeRequest$(e)},t.prototype.moveDir$=function(t){var e=this;this._abortRequest("in dir "+c.EdgeDirection[t]),this._loadingService.startLoading(this._loadingName);var r=this.stateService.currentNode$.first().mergeMap(function(e){return([c.EdgeDirection.Next,c.EdgeDirection.Prev].indexOf(t)>-1?e.sequenceEdges$:e.spatialEdges$).first().map(function(e){for(var r=0,n=e.edges;r1||i[1]<0||i[1]>1)&&(i=null),i},t.prototype.eventToUnprojection=function(t,e,r,n,i){var o=this._viewportCoords.canvasPosition(t,e);return this.canvasToUnprojection(o,e,r,n,i)},t.prototype.canvasToUnprojection=function(t,e,r,i,o){var a=t[0],s=t[1],c=this._viewportCoords.canvasToViewport(a,s,e),u=c[0],h=c[1],l=new n.Vector3(u,h,1).unproject(r.perspective),p=o.projectBasic(l.toArray());(p[0]<0||p[0]>1||p[1]<0||p[1]>1)&&(p=null);var f=l.clone().sub(r.camera.position).normalize(),d=-2/f.z,m=null;if(d>0&&d<100&&p){var v=f.clone().multiplyScalar(d).add(r.camera.position),g=this._geoCoords.enuToGeodetic(v.x,v.y,v.z,i.lat,i.lon,i.alt).slice(0,2);m={lat:g[0],lon:g[1]}}return{basicPoint:p,latLon:m,pixelPoint:[a,s]}},t}();r.Projection=o,r.default=o},{"../Geo":229,three:176}],362:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("virtual-dom"),o=t("rxjs/Subject");t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var a=t("../Viewer"),s=function(){function t(){}return Object.defineProperty(t.prototype,"json",{set:function(t){this._json=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"image",{set:function(t){this._image=t,this._texture=new n.Texture(this._image),this._texture.minFilter=n.NearestFilter},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return!(!this._image||!this._json)},enumerable:!0,configurable:!0}),t.prototype.getGLSprite=function(t){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");var e=this._json[t];if(!e)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),new n.Object3D;var r=this._texture.clone();r.needsUpdate=!0;var i=this._image.width,o=this._image.height;r.offset.x=e.x/i,r.offset.y=(o-e.y-e.height)/o,r.repeat.x=e.width/i,r.repeat.y=e.height/o;var a=new n.SpriteMaterial({map:r});return new n.Sprite(a)},t.prototype.getDOMSprite=function(t,e){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==e&&(e=a.Alignment.Center);var r=this._json[t];if(!r)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),i.h("div",{},[]);var n=r.y,o=r.x+r.width,s=r.y+r.height,c=r.x,u=-r.x,h=-r.y,l=this._image.height,p=this._image.width;switch(e){case a.Alignment.Bottom:case a.Alignment.Center:case a.Alignment.Top:u-=r.width/2;break;case a.Alignment.BottomLeft:case a.Alignment.Left:case a.Alignment.TopLeft:u-=r.width;break;case a.Alignment.BottomRight:case a.Alignment.Right:case a.Alignment.BottomRight:}switch(e){case a.Alignment.Center:case a.Alignment.Left:case a.Alignment.Right:h-=r.height/2;break;case a.Alignment.Top:case a.Alignment.TopLeft:case a.Alignment.TopRight:h-=r.height;break;case a.Alignment.Bottom:case a.Alignment.BottomLeft:case a.Alignment.BottomRight:}var f=1/r.pixelRatio;n*=f,o*=f,s*=f,c*=f,u*=f,h*=f,l*=f,p*=f;var d={src:this._image.src,style:{clip:"rect("+n+"px, "+o+"px, "+s+"px, "+c+"px)",height:l+"px",left:u+"px",position:"absolute",top:h+"px",width:p+"px"}};return i.h("img",d,[])},t}(),c=function(){function t(t){var e=this;if(this._retina=window.devicePixelRatio>1,this._spriteAtlasOperation$=new o.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},new s).publishReplay(1).refCount(),this._spriteAtlas$.subscribe(function(){}),null!=t){var r=this._retina?"@2x":"",n=new XMLHttpRequest;n.open("GET",t+r+".png",!0),n.responseType="arraybuffer",n.onload=function(){var t=new Image;t.onload=function(){e._spriteAtlasOperation$.next(function(e){return e.image=t,e})};var r=new Blob([n.response]);t.src=window.URL.createObjectURL(r)},n.onerror=function(e){console.error(new Error("Failed to fetch sprite sheet ("+t+r+".png)"))},n.send();var i=new XMLHttpRequest;i.open("GET",t+r+".json",!0),i.responseType="text",i.onload=function(){var t=JSON.parse(i.response);e._spriteAtlasOperation$.next(function(e){return e.json=t,e})},i.onerror=function(e){console.error(new Error("Failed to fetch sheet ("+t+r+".json)"))},i.send()}}return Object.defineProperty(t.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),t}();r.SpriteService=c,r.default=c},{"../Viewer":237,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78,three:176,"virtual-dom":182}],363:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/timer"),t("rxjs/add/operator/bufferWhen"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap");var a=function(){function t(t,e){var r=this;this._canvasContainer=t,this._domContainer=e,this._activeSubject$=new n.BehaviorSubject(!1),this._active$=this._activeSubject$.distinctUntilChanged().publishReplay(1).refCount(),i.Observable.fromEvent(e,"touchmove").subscribe(function(t){t.preventDefault()}),this._touchStart$=i.Observable.fromEvent(t,"touchstart"),this._touchMove$=i.Observable.fromEvent(t,"touchmove"),this._touchEnd$=i.Observable.fromEvent(t,"touchend"),this._touchCancel$=i.Observable.fromEvent(t,"touchcancel");var a=this._touchStart$.filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}).share();this._doubleTap$=a.bufferWhen(function(){return a.first().switchMap(function(t){return i.Observable.timer(300).merge(a).take(1)})}).filter(function(t){return 2===t.length}).map(function(t){return t[t.length-1]}).share(),this._doubleTap$.subscribe(function(t){t.preventDefault()}),this._singleTouchMove$=this._touchMove$.filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}).share();var s=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}),c=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return t.touches.length>=1}),u=i.Observable.merge(this._touchEnd$,this._touchCancel$).filter(function(t){return 0===t.touches.length});this._singleTouchDragStart$=s.mergeMap(function(t){return r._singleTouchMove$.takeUntil(i.Observable.merge(u,c)).take(1)}),this._singleTouchDragEnd$=s.mergeMap(function(t){return i.Observable.merge(u,c).first()}),this._singleTouchDrag$=s.switchMap(function(t){return r._singleTouchMove$.skip(1).takeUntil(i.Observable.merge(c,u))});var h=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=h.filter(function(t){return 2===t.touches.length&&2===t.targetTouches.length}),this._pinchEnd$=h.filter(function(t){return 2!==t.touches.length||2!==t.targetTouches.length}),this._pinchOperation$=new o.Subject,this._pinch$=this._pinchOperation$.scan(function(t,e){return e(t)},{changeX:0,changeY:0,clientX:0,clientY:0,distance:0,distanceChange:0,distanceX:0,distanceY:0,originalEvent:null,pageX:0,pageY:0,screenX:0,screenY:0,touch1:null,touch2:null}),this._touchMove$.filter(function(t){return 2===t.touches.length&&2===t.targetTouches.length}).map(function(t){return function(e){var r=t.touches[0],n=t.touches[1],i=Math.min(r.clientX,n.clientX),o=Math.max(r.clientX,n.clientX),a=Math.min(r.clientY,n.clientY),s=i+(o-i)/2,c=a+(Math.max(r.clientY,n.clientY)-a)/2,u=s+r.pageX-r.clientX,h=c+r.pageY-r.clientY,l=s+r.screenX-r.clientX,p=c+r.screenY-r.clientY,f=Math.abs(r.clientX-n.clientX),d=Math.abs(r.clientY-n.clientY),m=Math.sqrt(f*f+d*d),v=m-e.distance;return{changeX:f-e.distanceX,changeY:d-e.distanceY,clientX:s,clientY:c,distance:m,distanceChange:v,distanceX:f,distanceY:d,originalEvent:t,pageX:u,pageY:h,screenX:l,screenY:p,touch1:r,touch2:n}}}).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.switchMap(function(t){return r._pinch$.skip(1).takeUntil(r._pinchEnd$)})}return Object.defineProperty(t.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doubleTap$",{get:function(){return this._doubleTap$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchStart$",{get:function(){return this._touchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchMove$",{get:function(){return this._touchMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchEnd$",{get:function(){return this._touchEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchCancel$",{get:function(){return this._touchCancel$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDragStart$",{get:function(){return this._singleTouchDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDrag$",{get:function(){return this._singleTouchDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDragEnd$",{get:function(){return this._singleTouchDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchStart$",{get:function(){return this._pinchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchEnd$",{get:function(){return this._pinchEnd$},enumerable:!0,configurable:!0}),t}();r.TouchService=a},{"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/timer":47,"rxjs/add/operator/bufferWhen":51,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79}],364:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("when"),o=t("rxjs/Observable"),a=t("../Viewer"),s=t("../Utils"),c=function(t){function e(e,r,n,i,o){var c=t.call(this)||this;return i=null!=i?i:{},s.Settings.setOptions(i),c._navigator=new a.Navigator(r,o),c._container=new a.Container(e,c._navigator.stateService,i),c._observer=new a.Observer(c,c._navigator,c._container),c._componentController=new a.ComponentController(c._container,c._navigator,c._observer,n,i.component),c}return n(e,t),Object.defineProperty(e.prototype,"isNavigable",{get:function(){return this._componentController.navigable},enumerable:!0,configurable:!0}),e.prototype.activateComponent=function(t){this._componentController.activate(t)},e.prototype.activateCover=function(){this._componentController.activateCover()},e.prototype.deactivateComponent=function(t){this._componentController.deactivate(t)},e.prototype.deactivateCover=function(){this._componentController.deactivateCover()},e.prototype.getBearing=function(){var t=this;return i.promise(function(e,r){t._container.renderService.bearing$.first().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.getCenter=function(){var t=this;return i.promise(function(e,r){t._navigator.stateService.getCenter().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.getComponent=function(t){return this._componentController.get(t)},e.prototype.getContainer=function(){return this._container.element},e.prototype.getZoom=function(){var t=this;return i.promise(function(e,r){t._navigator.stateService.getZoom().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.moveCloseTo=function(t,e){var r=this.isNavigable?this._navigator.moveCloseTo$(t,e):o.Observable.throw(new Error("Calling moveCloseTo is not supported when viewer is not navigable."));return i.promise(function(t,e){r.subscribe(function(e){t(e)},function(t){e(t)})})},e.prototype.moveDir=function(t){var e=this.isNavigable?this._navigator.moveDir$(t):o.Observable.throw(new Error("Calling moveDir is not supported when viewer is not navigable."));return i.promise(function(t,r){e.subscribe(function(e){t(e)},function(t){r(t)})})},e.prototype.moveToKey=function(t){var e=this.isNavigable?this._navigator.moveToKey$(t):o.Observable.throw(new Error("Calling moveToKey is not supported when viewer is not navigable."));return i.promise(function(t,r){e.subscribe(function(e){t(e)},function(t){r(t)})})},e.prototype.projectFromBasic=function(t){var e=this;return i.promise(function(r,n){e._observer.projectBasic$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},e.prototype.setAuthToken=function(t){var e=this.isNavigable?this._navigator.setToken$(t):o.Observable.throw(new Error("Calling setAuthToken is not supported when viewer is not navigable."));return i.promise(function(t,r){e.subscribe(function(){t(void 0)},function(t){r(t)})})},e.prototype.setCenter=function(t){this._navigator.stateService.setCenter(t)},e.prototype.setFilter=function(t){var e=this;return i.promise(function(r,n){e._navigator.setFilter$(t).subscribe(function(){r(void 0)},function(t){n(t)})})},e.prototype.setRenderMode=function(t){this._container.renderService.renderMode$.next(t)},e.prototype.setZoom=function(t){this._navigator.stateService.setZoom(t)},e.prototype.unproject=function(t){var e=this;return i.promise(function(r,n){e._observer.unproject$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.unprojectToBasic=function(t){var e=this;return i.promise(function(r,n){e._observer.unprojectBasic$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.bearingchanged="bearingchanged",e.click="click",e.contextmenu="contextmenu",e.dblclick="dblclick",e.loadingchanged="loadingchanged",e.mousedown="mousedown",e.mousemove="mousemove",e.mouseout="mouseout",e.mouseover="mouseover",e.mouseup="mouseup",e.moveend="moveend",e.movestart="movestart",e.navigablechanged="navigablechanged",e.nodechanged="nodechanged",e.sequenceedgeschanged="sequenceedgeschanged",e.spatialedgeschanged="spatialedgeschanged",e}(s.EventEmitter);r.Viewer=c},{"../Utils":236,"../Viewer":237,"rxjs/Observable":29,when:223}]},{},[231])(231)});