=n)return this;t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;n>o;o++)this[o]=e;else{var a=s.isBuffer(e)?e:H(new s(e,r).toString()),u=a.length;for(o=0;n-t>o;o++)this[o+t]=a[o%u]}return this};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":3,ieee754:178,isarray:182}],8:[function(e,t,n){"use strict";function r(e){var t=e[s];return t||(t=e[s]={}),t}var i=e("individual/one-version"),o="7";i("ev-store",o);var s="__EV_STORE_KEY@"+o;t.exports=r},{"individual/one-version":180}],9:[function(e,t,n){"use strict";function r(e,t){var n;for(n in t)e[n]=t[n];return e}function i(e,t){if(this._jsongUrl=e,"number"==typeof t){var n={timeout:t};t=n}this._config=r({timeout:15e3,headers:{}},t||{})}var o=e("./request"),s=e("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:s,get:function(e){var t="GET",n=this.buildQueryObject(this._jsongUrl,t,{paths:e,method:"get"}),i=r(n,this._config),s=this;return o(t,i,s)},set:function(e){var t="POST",n=this.buildQueryObject(this._jsongUrl,t,{jsonGraph:e,method:"set"}),i=r(n,this._config);i.headers["Content-Type"]="application/x-www-form-urlencoded";var s=this;return o(t,i,s)},call:function(e,t,n,i){t=t||[],n=n||[],i=i||[];var s="POST",a=[];a.push("method=call"),a.push("callPath="+encodeURIComponent(JSON.stringify(e))),a.push("arguments="+encodeURIComponent(JSON.stringify(t))),a.push("pathSuffixes="+encodeURIComponent(JSON.stringify(n))),a.push("paths="+encodeURIComponent(JSON.stringify(i)));var u=this.buildQueryObject(this._jsongUrl,s,a.join("&")),c=r(u,this._config);c.headers["Content-Type"]="application/x-www-form-urlencoded";var h=this;return o(s,c,h)}},i.XMLHttpSource=i,i["default"]=i,t.exports=i},{"./buildQueryObject":10,"./request":13}],10:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r,i=[],o={url:e},s=-1!==e.indexOf("?"),a=s?"&":"?";return"string"==typeof n?i.push(n):(r=Object.keys(n),r.forEach(function(e){var t="object"==typeof n[e]?JSON.stringify(n[e]):n[e];i.push(e+"="+encodeURIComponent(t))})),"GET"===t?o.url+=a+i.join("&"):o.data=i.join("&"),o}},{}],11:[function(e,t,n){(function(e){"use strict";t.exports=function(){var t=new e.XMLHttpRequest;if("withCredentials"in t)return t;if(e.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:{})},{}],12:[function(e,t,n){(function(e){"use strict";t.exports=function(){var t,n,r;if(e.XMLHttpRequest)return new e.XMLHttpRequest;try{for(n=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=0;3>r;r++)try{if(t=n[r],new e.ActiveXObject(t))break}catch(i){}return new e.ActiveXObject(t)}catch(i){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,n){"use strict";function r(){}function i(e,t,n){return r.create(function(r){var i,o,l,p,f,d={method:e||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in t)h.call(t,f)&&(d[f]=t[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=n.onBeforeRequest&&n.onBeforeRequest(d);try{i=d.crossDomain?c():u()}catch(m){r.onError(m)}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=d.withCredentials!==!1,l=d.headers;for(p in l)h.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(v){if("json"!==d.responseType)throw v}i.onreadystatechange=function(e){4===i.readyState&&(o||(o=!0,s(r,i,e)))},i.ontimeout=function(e){o||(o=!0,a(r,i,"timeout error",e))},i.send(d.data)}catch(v){r.onError(v)}return function(){o||4===i.readyState||(o=!0,i.abort())}})}function o(e,t,n){n||(n=new Error(t)),e.onError(n)}function s(e,t,n){var r,i;if(t&&e){i=t.responseType,r="response"in t?t.response:t.responseText;var s=1223===t.status?204:t.status;if(s>=200&&399>=s){try{"json"!==i&&(r=JSON.parse(r||"")),"string"==typeof r&&(r=JSON.parse(r||""))}catch(n){o(e,"invalid json",n)}return e.onNext(r),void e.onCompleted()}return 401===s||403===s||407===s?o(e,r):410===s?o(e,r):408===s||504===s?o(e,r):o(e,r||"Response code "+s)}}function a(e,t,n,r){o(e,n||t.statusText||"request error",r)}var u=e("./getXMLHttpRequest"),c=e("./getCORSRequest"),h=Object.prototype.hasOwnProperty,l=function(){};r.create=function(e){var t=new r;return t.subscribe=function(t,n,r){var i,o;return i="function"==typeof t?{onNext:t,onError:n||l,onCompleted:r||l}:t,o=e(i),"function"==typeof o?{dispose:o}:o},t},t.exports=i},{"./getCORSRequest":11,"./getXMLHttpRequest":12}],14:[function(e,t,n){function r(e,t,n){var r=Object.create(null);if(null!=n){for(var i in n)r[i]=n[i];return r.$type=e,r.value=t,r}return{$type:e,value:t}}var i=e("falcor-path-syntax");t.exports={ref:function(e,t){return r("ref",i.fromPath(e),t)},atom:function(e,t){return r("atom",e,t)},undefined:function(){return r("atom")},error:function(e,t){return r("error",e,t)},pathValue:function(e,t){return{path:i.fromPath(e),value:t}},pathInvalidation:function(e){return{path:i.fromPath(e),invalidated:!0}}}},{"falcor-path-syntax":18}],15:[function(e,t,n){t.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],16:[function(e,t,n){var r={token:"token",dotSeparator:".",commaSeparator:",",openingBracket:"[",closingBracket:"]",openingBrace:"{",closingBrace:"}",escape:"\\",space:" ",colon:":",quote:"quote",unknown:"unknown"};t.exports=r},{}],17:[function(e,t,n){t.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(e,t,n){if(n)throw e+" -- "+t.parseString+" with next token: "+n;throw e+" -- "+t.parseString}}},{}],18:[function(e,t,n){var r=e("./tokenizer"),i=e("./parse-tree/head"),o=e("./RoutedTokens"),s=function(e,t){return i(new r(e,t))};t.exports=s,s.fromPathsOrPathValues=function(e,t){if(!e)return[];for(var n=[],r=0,i=e.length;i>r;r++)"string"==typeof e[r]?n[r]=s(e[r],t):"string"==typeof e[r].path?n[r]={path:s(e[r].path,t),value:e[r].value}:n[r]=e[r];return n},s.fromPath=function(e,t){return e?"string"==typeof e?s(e,t):e:[]},s.RoutedTokens=o},{"./RoutedTokens":15,"./parse-tree/head":19,"./tokenizer":24}],19:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../exceptions"),o=e("./indexer");t.exports=function(e){for(var t=e.next(),n={},s=[];!t.done;){switch(t.type){case r.token:var a=+t.token[0];isNaN(a)||i.throwError(i.invalidIdentifier,e),s[s.length]=t.token;break;case r.dotSeparator:0===s.length&&i.throwError(i.unexpectedToken,e);break;case r.space:break;case r.openingBracket:o(e,t,n,s);break;default:i.throwError(i.unexpectedToken,e)}t=e.next()}return 0===s.length&&i.throwError(i.invalidPath,e),s}},{"./../TokenTypes":16,"./../exceptions":17,"./indexer":20}],20:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../exceptions"),o=i.indexer,s=e("./range"),a=e("./quote"),u=e("./routed");t.exports=function(e,t,n,c){var h=e.next(),l=!1,p=1,f=!1;for(n.indexer=[];!h.done;){switch(h.type){case r.token:case r.quote:n.indexer.length===p&&i.throwError(o.requiresComma,e)}switch(h.type){case r.openingBrace:f=!0,u(e,h,n,c);
-break;case r.token:var d=+h.token;isNaN(d)&&i.throwError(o.needQuotes,e),n.indexer[n.indexer.length]=d;break;case r.dotSeparator:n.indexer.length||i.throwError(o.leadingDot,e),s(e,h,n,c);break;case r.space:break;case r.closingBracket:l=!0;break;case r.quote:a(e,h,n,c);break;case r.openingBracket:i.throwError(o.nested,e);break;case r.commaSeparator:++p;break;default:i.throwError(i.unexpectedToken,e)}if(l)break;h=e.next()}0===n.indexer.length&&i.throwError(o.empty,e),n.indexer.length>1&&f&&i.throwError(o.routedTokens,e),1===n.indexer.length&&(n.indexer=n.indexer[0]),c[c.length]=n.indexer,n.indexer=void 0}},{"./../TokenTypes":16,"./../exceptions":17,"./quote":21,"./range":22,"./routed":23}],21:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../exceptions"),o=i.quote;t.exports=function(e,t,n,s){for(var a=e.next(),u="",c=t.token,h=!1,l=!1;!a.done;){switch(a.type){case r.token:case r.space:case r.dotSeparator:case r.commaSeparator:case r.openingBracket:case r.closingBracket:case r.openingBrace:case r.closingBrace:h&&i.throwError(o.illegalEscape,e),u+=a.token;break;case r.quote:h?(u+=a.token,h=!1):a.token!==c?u+=a.token:l=!0;break;case r.escape:h=!0;break;default:i.throwError(i.unexpectedToken,e)}if(l)break;a=e.next()}0===u.length&&i.throwError(o.empty,e),n.indexer[n.indexer.length]=u}},{"./../TokenTypes":16,"./../exceptions":17}],22:[function(e,t,n){var r=e("./../tokenizer"),i=e("./../TokenTypes"),o=e("./../exceptions");t.exports=function(e,t,n,s){var a,u=e.peek(),c=1,h=!1,l=!0,p=n.indexer.length-1,f=r.toNumber(n.indexer[p]);for(isNaN(f)&&o.throwError(o.range.precedingNaN,e);!h&&!u.done;){switch(u.type){case i.dotSeparator:3===c&&o.throwError(o.unexpectedToken,e),++c,3===c&&(l=!1);break;case i.token:a=r.toNumber(e.next().token),isNaN(a)&&o.throwError(o.range.suceedingNaN,e),h=!0;break;default:h=!0}if(h)break;e.next(),u=e.peek()}n.indexer[p]={from:f,to:l?a:a-1}}},{"./../TokenTypes":16,"./../exceptions":17,"./../tokenizer":24}],23:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../RoutedTokens"),o=e("./../exceptions"),s=o.routed;t.exports=function(e,t,n,a){var u=e.next(),c=!1,h="";switch(u.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(s.invalid,e)}var l=e.next();if(l.type===r.colon&&(c=!0,l=e.next(),l.type!==r.token&&o.throwError(s.invalid,e),h=l.token,l=e.next()),l.type===r.closingBrace){var p={type:u.token,named:c,name:h};n.indexer[n.indexer.length]=p}else o.throwError(s.invalid,e)}},{"./../RoutedTokens":15,"./../TokenTypes":16,"./../exceptions":17}],24:[function(e,t,n){function r(e,t,n){return{token:e,done:n,type:t}}function i(e,t,n){var i,_=!1,b="",x=n?y:g;do{if(i=t+1>=e.length)break;var w=e[t+1];if(void 0===w||-1!==x.indexOf(w)){if(b.length)break;++t;var S;switch(w){case s:S=o.dotSeparator;break;case a:S=o.commaSeparator;break;case u:S=o.openingBracket;break;case c: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}_=r(w,S,!1);break}b+=w,++t}while(!i);return!_&&b.length&&(_=r(b,o.token,!1)),_||(_={done:!0}),{token:_,idx:t}}var o=e("./../TokenTypes"),s=".",a=",",u="[",c="]",h="{",l="}",p=":",f="\\",d='"',m="'",v=" ",g="\\'\"[]., ",y="\\{}'\"[]., :",_=t.exports=function(e,t){this._string=e,this._idx=-1,this._extended=t,this.parseString=""};_.prototype={next:function(){var e=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._idx=e.idx,this._nextToken=!1,this.parseString+=e.token.token,e.token},peek:function(){var e=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._nextToken=e,e.token}},_.toNumber=function(e){return isNaN(+e)?NaN:+e}},{"./../TokenTypes":16}],25:[function(e,t,n){var r=e("./toPaths"),i=e("./toTree");t.exports=function(e){var t=e.reduce(function(e,t){var n=t.length;return e[n]||(e[n]=[]),e[n].push(t),e},{});return Object.keys(t).forEach(function(e){t[e]=i(t[e])}),r(t)}},{"./toPaths":31,"./toTree":32}],26:[function(e,t,n){var r=e("./iterateKeySet");t.exports=function i(e,t,n){for(var o=e,s=!0;s&&nr&&(t.empty=!0)}function i(e,t){t.done=!1;var n=t.isObject=!(!e||"object"!=typeof e);t.isArray=n&&o(e),t.arrayOffset=0}var o=Array.isArray;t.exports=function(e,t){if(void 0===t.isArray&&i(e,t),t.isArray){var n;do{t.loaded&&t.rangeOffset>t.to&&(++t.arrayOffset,t.loaded=!1);var o=t.arrayOffset,s=e.length;if(o>=s){t.done=!0;break}var a=e[t.arrayOffset],u=typeof a;if("object"===u){if(t.loaded||r(a,t),t.empty)continue;n=t.rangeOffset++}else++t.arrayOffset,n=a}while(void 0===n);return n}return t.isObject?(t.loaded||r(e,t),t.rangeOffset>t.to?void(t.done=!0):t.rangeOffset++):(t.done=!0,e)}},{}],29:[function(e,t,n){var r=e("./hasIntersection");t.exports=function(e,t){for(var n=[],i=-1,o=0,s=e.length;s>o;++o){var a=e[o];r(t[a.length],a,0)||(n[++i]=a)}return n}},{"./hasIntersection":26}],30:[function(e,t,n){var r=e("./hasIntersection");t.exports=function(e,t){for(var n=[],i=-1,o=0,s=e.length;s>o;++o)r(t,e[o],0)||(n[++i]=e[o]);return n}},{"./hasIntersection":26}],31:[function(e,t,n){function r(e){return null!==e&&typeof e===p}function i(e,t,n){var r,o,s,a,l,p,f,d,m,v,g,y,_,b,x=c(String(t)),w=Object.create(null),S=[],M=-1,E=0,C=[],T=0;if(a=[],l=-1,n-1>t){for(p=u(e,a);++l0)for(f=o.sets,d=-1,m=f.length,_=a[0];++d1&&a||_;++g1?C[T++]=[a]:C[T++]=a;++l0;++t<=n;){var i=e[t];if(!h(i)){r=!1;break}e[t]=parseInt(i,10)}if(r===!0){e.sort(a);var o=e[0],s=e[n];if(n>=s-o)return{from:o,to:s}}return e}function a(e,t){return e-t}function u(e,t,n){var r=0;for(var i in e)t[r++]=i;return r>1&&t.sort(n),r}function c(e){for(var t=5381,n=-1,r=e.length;++n=0}var l=Array.isArray,p="object";t.exports=function(e){var t,n=[],s=0;for(var a in e)if(h(a)&&r(t=e[a]))for(var u=i(t,0,parseInt(a,10)).sets,c=-1,l=u.length;++c1&&!Array.isArray(r)||0===t&&!Array.isArray(r)&&"string"!==i||1===t&&!Array.isArray(r)&&!x(r))return new a(function(e){e.onError(new Error("Invalid argument"))})}return c.create(this,e)},r.prototype.invalidate=function(){var e,t=-1,n=arguments.length,r=arguments[n-1];for(e=new Array(n);++t0){var n=i.Observable.of(e);return e.get.apply(e,a)["catch"](i.Observable.empty()).concat(n).last().flatMap(function(){return r(t,u)}).filter(function(e){return e})}return i.Observable["return"](e)}if(s>0){var o=a.map(function(e){return u.concat(e)});return t.get.apply(t,o).concat(i.Observable.defer(function(){return r(t,u)})).last().filter(function(e){return e})}return i.Observable.empty()})}},{"falcor-path-syntax":18,"rx/dist/rx":156}],38:[function(e,t,n){var r=e("falcor-path-syntax"),i=e("./../get/getBoundValue"),o=e("./../errors/InvalidModelError"),s=e("./../types/atom");t.exports=function(e){var t=r.fromPath(e);if(!Array.isArray(t))throw new Error("Model#derefSync must be called with an Array path.");var n=i(this,this._path.concat(t),!1),a=n.path,u=n.value,c=n.found;if(c&&void 0!==u&&(u.$type!==s||void 0!==u.value)){if(u.$type)throw new o;return this._clone({_path:a})}}},{"./../errors/InvalidModelError":40,"./../get/getBoundValue":45,"./../types/atom":150,"falcor-path-syntax":18}],39:[function(e,t,n){function r(){this.message=r.message,this.stack=(new Error).stack}r.prototype=new Error,r.prototype.name="BoundJSONGraphModelError",r.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.",t.exports=r},{}],40:[function(e,t,n){function r(e,t){this.message=o,this.stack=(new Error).stack,this.boundPath=e,this.shortedPath=t}var i="InvalidModelError",o="The boundPath of the model is not valid since a value or error was found before the path end.";r.prototype=new Error,r.prototype.name=i,r.message=o,t.exports=r},{}],41:[function(e,t,n){function r(e){this.message="An exception was thrown when making a request.",this.stack=(new Error).stack,this.innerError=e}var i="InvalidSourceError";r.prototype=new Error,r.prototype.name=i,r.is=function(e){return e&&e.name===i},t.exports=r},{}],42:[function(e,t,n){function r(){this.message="The allowed number of retries have been exceeded.",this.stack=(new Error).stack}var i="MaxRetryExceededError";r.prototype=new Error,r.prototype.name=i,r.is=function(e){return e&&e.name===i},t.exports=r},{}],43:[function(e,t,n){function r(e,t,n,r,i,l,p){for(var f,d,m=n,v=i,g=r,y=0;;){if(0===y&&g[c]?(y=v.length,d=g[c]):(f=v[y++],d=m[f]),d){var _=d.$type,b=_&&d.value||d;if(yw;w++)x[w]=v[w];v=x}return[m,v]}var i=e("./../get/util/hardlink"),o=i.create,s=e("./../get/onValue"),a=e("./../get/util/isExpired"),u=e("./../types/ref"),c=e("./../internal/context"),h=e("./../get/util/lru").promote;t.exports=r},{"./../get/onValue":54,"./../get/util/hardlink":58,"./../get/util/isExpired":59,"./../get/util/lru":61,"./../internal/context":65,"./../types/ref":152}],44:[function(e,t,n){var r=e("./../get/getCachePosition"),i=e("./../errors/InvalidModelError"),o=e("./../errors/BoundJSONGraphModelError");t.exports=function(e,t){return function(n,s,a){var u,c,h,l=a[0],p={values:a,optimizedPaths:[]},f=n._root.cache,d=n._path,m=f,v=d.length,g=[];if(v){if(t)return{criticalError:new o};if(m=r(n,d),m.$type)return{criticalError:new i(d,d)};for(u=[],c=0;v>c;++c)u[c]=d[c]}else u=[],v=0;for(c=0,h=s.length;h>c;c++)e(n,f,m,s[c],0,l,p,g,u,v,t);return p}}},{"./../errors/BoundJSONGraphModelError":39,"./../errors/InvalidModelError":40,"./../get/getCachePosition":47}],45:[function(e,t,n){var r=e("./../get/getValueSync"),i=e("./../errors/InvalidModelError");t.exports=function(e,t,n){var o,s,a,u,c,h=t,l=t;for(o=e._boxed,n=e._materialized,s=e._treatErrorsAsValues,e._boxed=!0,e._materialized=void 0===n||n,e._treatErrorsAsValues=!0,a=r(e,h.concat(null),!0),e._boxed=o,e._materialized=n,e._treatErrorsAsValues=s,h=a.optimizedPath,u=a.shorted,c=a.found,a=a.value;h.length&&null===h[h.length-1];)h.pop();if(c&&u)throw new i(l,h);return{path:h,value:a,shorted:u,found:c}}},{"./../errors/InvalidModelError":40,"./../get/getValueSync":49}],46:[function(e,t,n){function r(e){var t,n,r,i={},o=Object.keys(e);for(n=0,r=o.length;r>n;n++)t=o[n],s(t)||(i[t]=e[t]);return i}function i(e,t,n){Object.keys(e).filter(function(t){return!s(t)&&e[t]}).forEach(function(n){var s=e[n],a=t[n];if(a||(a=t[n]={}),s.$type){var u,c=s.value&&"object"==typeof s.value,h=!e[o];return u=c||h?r(s):s.value,void(t[n]=u)}i(s,a,n)})}var o=e("./../internal/model-created"),s=e("./../support/isInternalKey");t.exports=function(e){var t={};return i(e,t),t}},{"./../internal/model-created":69,"./../support/isInternalKey":129}],47:[function(e,t,n){t.exports=function(e,t){for(var n=e._root.cache,r=-1,i=t.length;++rb;){if(h=t[b++],null!==h&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if(p=x.$type,p===u&&void 0===x.value){S=void 0,M=!1,y=v>b;break}if(v>b){if(p===a){if(o(x)){E=!0,S=void 0,M=!1;break}if(f=r(e,m,m,x,x.value),d=f[0],!d){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>b&&!E){for(l=b;v>l;++l)if(null!==t[b]){_=!0;break}for(_?(y=!0,S=void 0):S=x,l=b;v>l;++l)null!==t[l]&&(g[g.length]=t[l])}if(S&&p&&(o(S)?S=void 0:s(e,S)),S&&p===c&&!e._treatErrorsAsValues)throw{path:b===v?t:t.slice(0,b),value:S.value};return S&&e._boxed?S=Boolean(p)&&!n?i(S):S:!S&&e._materialized?S={$type:u}:S&&(S=S.value),{value:S,shorted:y,optimizedPath:g,found:M}}},{"./../get/followReference":43,"./../get/util/clone":57,"./../get/util/isExpired":59,"./../get/util/lru":61,"./../types/atom":150,"./../types/error":151,"./../types/ref":152}],50:[function(e,t,n){var r=e("./../internal/version");t.exports=function(e,t){var n=e._getValueSync({_boxed:!0,_root:e._root,_treatErrorsAsValues:e._treatErrorsAsValues},t,!0).value,i=n&&n[r];return null==i?-1:i}},{"./../internal/version":78}],51:[function(e,t,n){var r=e("./get"),i=e("./walkPath"),o=r(i,!1),s=r(i,!0);t.exports={getValueSync:e("./../get/getValueSync"),getBoundValue:e("./../get/getBoundValue"),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:s}},{"./../get/getBoundValue":45,"./../get/getValueSync":49,"./get":44,"./walkPath":63}],52:[function(e,t,n){var r=e("./../get/util/lru"),i=e("./../get/util/clone"),o=r.promote;t.exports=function(e,t,n,r,s){var a=t.value;s.errors||(s.errors=[]),e._boxed&&(a=i(t)),s.errors.push({path:r.slice(0,n+1),value:a}),o(e,t)}},{"./../get/util/clone":57,"./../get/util/lru":61}],53:[function(e,t,n){function r(e,t,n,r,i,o,s){s.requestedMissingPaths.push(r.slice(0,n).concat(t)),s.optimizedMissingPaths.push(i.slice(0,o).concat(t))}var i=e("./util/support"),o=i.fastCopy;t.exports=function(e,t,n,i,s,a,u){var c;i.requestedMissingPaths||(i.requestedMissingPaths=[],i.optimizedMissingPaths=[]),c=nv;v++)_=p[v],b[_]||(b[_]={}),b=b[_];_=p[v],b[_]=M?{$type:a}:S,l&&n.paths.push(l.slice(0,r))}else if(0===r)n.json=S;else{for(b=n.json,b||(b=n.json={}),v=0;r-1>v;v++)y=l[v],b[y]||(b[y]={}),x=b,w=y,b=b[y];y=l[v],null!==y?b[y]=S:x[w]=S}}}},{"./../internal/model-created":69,"./../types/atom":150,"./../types/error":151,"./../types/ref":152,"./util/clone":57,"./util/lru":61}],55:[function(e,t,n){var r=e("./util/isExpired"),i=e("./util/hardlink"),o=e("./util/lru"),s=i.remove,a=o.splice,u=e("./../types/error"),c=e("./onError"),h=e("./onValue"),l=e("./onMissing"),p=e("./util/isMaterialzed"),f=e("./../internal/invalidated");t.exports=function(e,t,n,i,o,d,m,v,g,y,_){var b=t&&t.$type,x=t&&void 0===t.value;return t&&b?void(r(t)?(t[f]||(a(e,t),s(t)),l(e,n,i,d,m,v,g)):b===u?(_&&(m[i]=null),y||e._treatErrorsAsValues?h(e,t,o,i,d,m,v,g,y,_):c(e,t,i,m,d)):(_&&(m[i]=null),(!x||x&&e._materialized)&&h(e,t,o,i,d,m,v,g,y,_))):void(p(e)?h(e,t,o,i,d,m,v,g,y,_):l(e,n,i,d,m,v,g))}},{"./../internal/invalidated":67,"./../types/error":151,"./onError":52,"./onMissing":53,"./onValue":54,"./util/hardlink":58,"./util/isExpired":59,"./util/isMaterialzed":60,"./util/lru":61}],56:[function(e,t,n){var r=e("falcor-path-syntax");t.exports=function(e){var t=r.fromPath(e);if(Array.isArray(t)===!1)throw new Error("Model#getValueSync must be called with an Array path.");return this._path.length&&(t=this._path.concat(t)),this._syncCheck("getValueSync")&&this._getValueSync(this,t).value}},{"falcor-path-syntax":18}],57:[function(e,t,n){var r=e("./../../internal/prefix");t.exports=function(e){var t,n,i,o=Object.keys(e);for(t={},n=0,i=o.length;i>n;n++){var s=o[n];s[0]!==r&&(t[s]=e[s])}return t}},{"./../../internal/prefix":72}],58:[function(e,t,n){function r(e,t){var n=t[u]||0;t[o+n]=e,t[u]=n+1,e[a]=n,e[s]=t}function i(e){var t=e[s];if(t){for(var n=e[a],r=t[u];r>n;)t[o+n]=t[o+n+1],++n;t[u]=r-1,e[s]=void 0,e[a]=void 0}}var o=e("./../../internal/ref"),s=e("./../../internal/context"),a=e("./../../internal/ref-index"),u=e("./../../internal/refs-length");t.exports={create:r,remove:i}},{"./../../internal/context":65,"./../../internal/ref":75,"./../../internal/ref-index":74,"./../../internal/refs-length":76}],59:[function(e,t,n){var r=e("./../../support/now");t.exports=function(e){var t=void 0===e.$expires&&-1||e.$expires;return-1!==t&&1!==t&&(0===t||ti;r++,i++)o[r]=e[i];return o}function i(e,t){var n,r,i,o=[];for(n=0,r=e.length;r>n;n++)o[n]=e[n];for(i=0,r=t.length;r>i;i++)null!==t[i]&&(o[n++]=t[i]);return o}function o(e,t){var n,r,i,o=[];for(n=0,r=e.length;r>n;n++)o[n]=e[n];for(i=0,r=t.length;r>i;i++)o[n++]=t[i];return o}t.exports={fastCat:o,fastCatSkipNulls:i,fastCopy:r}},{}],63:[function(e,t,n){var r=e("./followReference"),i=e("./onValueType"),o=e("./util/isExpired"),s=e("falcor-path-utils").iterateKeySet,a=e("./../types/ref"),u=e("./util/lru").promote;t.exports=function c(e,t,n,h,l,p,f,d,m,v,g,y){var _=y,b=m;if(!n||n&&n.$type||l===h.length)return void i(e,n,h,l,p,f,d,b,v,g,_);var x,w;x=h[l];var S="object"==typeof x,M=l+1,E=!1,C=x;if(S&&(E={},C=s(x,E)),void 0!==C||!E.done){var T=v+1;do{_=!1;var A;null===C?A=n:(A=n[C],b[v]=C,d[l]=C);var P=b,O=T;if(A){var L=A.$type,R=L&&A.value||A;if(Mw;++w)P[w]=D[w]}}c(e,t,A,h,M,p,f,d,P,O,g,_),E&&!E.done&&(C=s(x,E))}while(E&&!E.done)}}},{"./../types/ref":152,"./followReference":43,"./onValueType":55,"./util/isExpired":59,"./util/lru":61,"falcor-path-utils":27}],64:[function(e,t,n){"use strict";function r(e){return new r.Model(e)}"function"==typeof Promise?r.Promise=Promise:r.Promise=e("promise"),t.exports=r,r.Model=e("./Model")},{"./Model":34,promise:188}],65:[function(e,t,n){t.exports=e("./../internal/prefix")+"context"},{"./../internal/prefix":72}],66:[function(e,t,n){t.exports=e("./../internal/prefix")+"head"},{"./../internal/prefix":72}],67:[function(e,t,n){t.exports=e("./../internal/prefix")+"invalidated"},{"./../internal/prefix":72}],68:[function(e,t,n){t.exports=e("./../internal/prefix")+"key"},{"./../internal/prefix":72}],69:[function(e,t,n){t.exports="$modelCreated"},{}],70:[function(e,t,n){t.exports=e("./../internal/prefix")+"next"},{"./../internal/prefix":72}],71:[function(e,t,n){t.exports=e("./../internal/prefix")+"parent"},{"./../internal/prefix":72}],72:[function(e,t,n){t.exports=String.fromCharCode(30)},{}],73:[function(e,t,n){t.exports=e("./../internal/prefix")+"prev"},{"./../internal/prefix":72}],74:[function(e,t,n){t.exports=e("./../internal/prefix")+"ref-index"},{"./../internal/prefix":72}],75:[function(e,t,n){t.exports=e("./../internal/prefix")+"ref"},{"./../internal/prefix":72}],76:[function(e,t,n){t.exports=e("./../internal/prefix")+"refs-length"},{"./../internal/prefix":72}],77:[function(e,t,n){t.exports=e("./../internal/prefix")+"tail"},{"./../internal/prefix":72}],78:[function(e,t,n){t.exports=e("./../internal/prefix")+"version"},{"./../internal/prefix":72}],79:[function(e,t,n){function r(e,t,n,i,s,a,c,h,l,p){if(!w(e)&&!e.$type)for(var f in e)if(f[0]!==u&&"$"!==f[0]&&y(e,f)){var d=e[f],m=_(d)&&!d.$type,v=o(n,i,s,f,d,m,!1,a,c,h,l,p),b=v[0],x=v[1];b&&(m?r(d,t+1,n,x,b,a,c,h,l,p):C(b,x,f,h)&&E(x,g(b),h,a))}}function i(e,t,n,r,i,s,u,l){if(b(n))return S(n,i,s),[void 0,t];v(s,n);var d=n,m=n.value,g=t;if(n=n[h],null!=n)g=n[c]||t;else{var y=0,_=m.length-1;g=n=t;do{var x=m[y],M=_>y,E=o(t,g,n,x,e,M,!0,r,i,s,u,l);if(n=E[0],w(n))return E;g=E[1]}while(y++<_);if(d[h]!==n){var C=n[f]||0;n[f]=C+1,n[a+C]=d,d[h]=n,d[p]=C}}return[n,g]}function o(e,t,n,r,o,a,u,c,h,l,p,f){for(var m=n.$type;m===d;){var v=i(o,e,n,c,h,l,p,f);if(n=v[0],w(n))return v;t=v[1],m=n&&n.$type}if(void 0!==m)return[n,t];if(null==r){if(a)throw new Error("`null` is not allowed in branch key positions.");n&&(r=n[s])}else t=n,n=t[r];return[n,t];
-}var s=e("./../internal/key"),a=e("./../internal/ref"),u=e("./../internal/prefix"),c=e("./../internal/parent"),h=e("./../internal/context"),l=e("./../internal/version"),p=e("./../internal/ref-index"),f=e("./../internal/refs-length"),d=e("./../types/ref"),m=e("./../get/getBoundValue"),v=e("./../lru/promote"),g=e("./../support/getSize"),y=e("./../support/hasOwn"),_=e("./../support/isObject"),b=e("./../support/isExpired"),x=e("./../support/isFunction"),w=e("./../support/isPrimitive"),S=e("./../support/expireNode"),M=e("./../support/incrementVersion"),E=e("./../support/updateNodeAncestors"),C=e("./../support/removeNodeAndDescendants");t.exports=function(e,t){for(var n=e._root,i=n,o=n.expired,s=M(),a=n._comparator,u=n._errorSelector,h=e._path,p=n.cache,f=h.length?m(e,h).value:p,d=f[c]||p,v=p[l],g=-1,y=t.length;++gd,w=o(e,f,t,y,x,!0,n,r,i);if(t=w[0],_(t))return w;f=w[1]}while(d++=l){var x=e[s];for(g=x;d>=b&&g;)x=x[u],y=g.$size||0,d-=y,_===!0&&h(g,y,e,f),g=x;e[s]=e[u]=g,null==g?e[o]=e[a]=void 0:g[a]=void 0}}},{"./../internal/head":66,"./../internal/key":68,"./../internal/next":70,"./../internal/parent":71,"./../internal/prev":73,"./../internal/tail":77,"./../support/removeNode":140,"./../support/updateNodeAncestors":147}],82:[function(e,t,n){var r=e("./../values/expires-never"),i=e("./../internal/head"),o=e("./../internal/tail"),s=e("./../internal/next"),a=e("./../internal/prev"),u=e("./../support/isObject");t.exports=function(e,t){if(u(t)&&t.$expires!==r){var n=e[i],c=e[o],h=t[s],l=t[a];t!==n&&(null!=h&&"object"==typeof h&&(h[a]=l),null!=l&&"object"==typeof l&&(l[s]=h),h=n,null!=n&&"object"==typeof n&&(n[a]=t),e[i]=e[s]=n=t,n[s]=h,n[a]=void 0),null!=c&&t!==c||(e[o]=e[a]=c=l||t)}return t}},{"./../internal/head":66,"./../internal/next":70,"./../internal/prev":73,"./../internal/tail":77,"./../support/isObject":132,"./../values/expires-never":153}],83:[function(e,t,n){var r=e("./../internal/head"),i=e("./../internal/tail"),o=e("./../internal/next"),s=e("./../internal/prev");t.exports=function(e,t){var n=e[r],a=e[i],u=t[o],c=t[s];null!=u&&"object"==typeof u&&(u[s]=c),null!=c&&"object"==typeof c&&(c[o]=u),t===n&&(e[r]=e[o]=u),t===a&&(e[i]=e[s]=c),t[o]=t[s]=void 0,n=a=u=c=void 0}},{"./../internal/head":66,"./../internal/next":70,"./../internal/prev":73,"./../internal/tail":77}],84:[function(e,t,n){function r(e,t){var n=!1;return function(){if(!n&&!e._disposed){n=!0,e._callbacks[t]=null,e._optimizedPaths[t]=[],e._requestedPaths[t]=[];var r=--e._count;0!==r||e.sent||(e._disposable.dispose(),e.requestQueue.removeRequest(e))}}}function i(e){for(var t=[],n=-1,r=0,i=e.length;i>r;++r)for(var o=e[r],s=0,a=o.length;a>s;++s)t[++n]=o[s];return t}var o=e("./complement"),s=e("./flushGetRequest"),a=0,u=e("./RequestTypes").GetRequest,c=e("./../set/setJSONGraphs"),h=e("./../set/setPathValues"),l=e("./../types/error"),p=[],f=function(e,t){this.sent=!1,this.scheduled=!1,this.requestQueue=t,this.id=++a,this.type=u,this._scheduler=e,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};f.prototype={batch:function(e,t,n){var i=this,o=i._optimizedPaths,a=i._requestedPaths,u=i._callbacks,c=o.length;return o[c]=t,a[c]=e,u[c]=n,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){s(i,o,function(e,t){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(a,e,t);for(var n=0,r=u.length;r>n;++n){var o=u[n];o&&o(e,t)}}})})),r(i,c)},add:function(e,t,n){var i,s,a=this,u=o(e,t,a._pathMap);u?(s=u[2],i=u[1]):(s=e,i=t);var c=!1,h=!1;if(i.lengtho){if(null==c){if(t)return!1;c=a[u]=Object.create(null)}if(this.insertPath(e,t,c,o+1,s)===!1)return!1}else a[u]=(c||0)+1,this.length+=1;l.done||(u=p(h,l))}while(!l.done);return!0},r.prototype.removePath=function(e,t,n,r){var i=n||0,o=r||e.length-1,s=t||this.pathmaps[o+1];if(void 0===s||null===s)return!0;var a,u,c=0,h=e[i],l={};a=p(h,l);do if(u=s[a],void 0!==u&&null!==u){if(o>i){c+=this.removePath(e,u,i+1,o);var f=void 0;for(f in u)break;void 0===f&&delete s[a]}else u=s[a]=(u||1)-1,0===u&&delete s[a],c+=1,this.length-=1;l.done||(a=p(h,l))}while(!l.done);return c},r.prototype.getSourceObserver=function(e){var t=this;return o.create(function(n){n.jsonGraph=n.jsonGraph||n.jsong||n.values||n.value,n.index=t.index,e.onNext(n)},function(t){e.onError(t)},function(){e.onCompleted()})},r.prototype._subscribe=function(e){var t=this,n=this.queue;t.pending=!0;var r=!1,i=new u,o=a.create(function(){r||(r=!0,n&&n._remove(t))}),s=new c(i,o);try{i.setDisposable(this.model._source[this.method](this.getSourceArgs()).subscribe(this.getSourceObserver(e)))}catch(l){throw new h(l)}return s},t.exports=r},{"./../errors/InvalidSourceError":41,"falcor-path-utils":27,"rx/dist/rx":156}],86:[function(e,t,n){function r(e,t){this.total=0,this.model=e,this.requests=[],this.scheduler=t}var i=e("./../request/SetRequest"),o=e("./../internal/prefix"),s=e("./../support/getType"),a=e("./../support/isObject"),u=e("falcor-path-utils");r.prototype.set=function(e){return e.paths=u.collapse(e.paths),i.create(this.model,e)},r.prototype._remove=function(e){var t=this.requests,n=t.indexOf(e);-1!==n&&t.splice(n,1)},r.prototype.distributePaths=function(e,t,n){var r,i,o=this.model,s=-1,a=e.length,u=-1,c=t.length,h=[];e:for(;++s-1;){for(var l=r[n-1],p=i[n-1],f=u[n-1]||(u[n-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){r[n]=m,i[n]=g,n+=1;continue e}h>c&&(l[d]=g)}else l[d]=p[d]}n-=1}return e},t.exports=r},{"./../internal/prefix":72,"./../request/SetRequest":90,"./../support/getType":122,"./../support/isObject":132,"falcor-path-utils":27}],87:[function(e,t,n){function r(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var i=e("./RequestQueue"),o=e("./RequestQueueV2");r.prototype.get=o.prototype.get,r.prototype.removeRequest=o.prototype.removeRequest,r.prototype.set=i.prototype.set,r.prototype.call=i.prototype.call,t.exports=r},{"./RequestQueue":86,"./RequestQueueV2":88}],88:[function(e,t,n){function r(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var i=e("./RequestTypes"),o=e("./GetRequestV2");r.prototype={setScheduler:function(e){this.scheduler=e},get:function(e,t,n){function r(){m||(--l,0===l&&n())}var s,a,u,c=this,h=[],l=0,p=c._requests,f=t,d=e,m=!1;for(s=0,a=p.length;a>s;++s)if(u=p[s],u.type===i.GetRequest){if(u.sent){var v=u.add(d,f,r);v[0]&&(d=v[1],f=v[2],h[h.length]=v[3],++l)}else u.batch(d,f,r),f=[],d=[],++l;if(!f.length)break}if(f.length){u=new o(c.scheduler,c),p[p.length]=u,++l;var g=u.batch(d,f,r);h[h.length]=g}return function(){if(!m&&0!==l){m=!0;for(var e=h.length,t=0;e>t;++t)h[t]()}}},removeRequest:function(e){for(var t=this._requests,n=t.length;--n>=0;)if(t[n].id===e.id){t.splice(n,1);break}}},t.exports=r},{"./GetRequestV2":84,"./RequestTypes":89}],89:[function(e,t,n){t.exports={GetRequest:"GET"}},{}],90:[function(e,t,n){function r(){s.call(this)}var i=e("rx/dist/rx"),o=i.Observer,s=e("./../request/Request"),a=e("./../support/array-map"),u=e("./../set/setJSONGraphs"),c=e("./../set/setPathValues"),h=new Array(0);r.create=function(e,t){var n=new r;return n.model=e,n.jsonGraphEnvelope=t,n},r.prototype=Object.create(s.prototype),r.prototype.constructor=r,r.prototype.method="set",r.prototype.insertPath=function(){return!1},r.prototype.removePath=function(){return 0},r.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},r.prototype.getSourceObserver=function(e){var t=this.model,n=t._path,r=this.jsonGraphEnvelope.paths,i=t._root,l=i.errorSelector,p=i.comparator;return s.prototype.getSourceObserver.call(this,o.create(function(i){t._path=h;var o=u(t,[{paths:r,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],t._path=n,e.onNext(i)},function(i){t._path=h,c(t,a(r,function(e){return{path:e,value:i}}),null,l,p),t._path=n,e.onError(i)},function(){e.onCompleted()}))},t.exports=r},{"./../request/Request":85,"./../set/setJSONGraphs":108,"./../set/setPathValues":110,"./../support/array-map":115,"rx/dist/rx":156}],91:[function(e,t,n){var r=e("falcor-path-utils").hasIntersection,i=e("./../support/array-slice");t.exports=function(e,t,n){for(var o=[],s=[],a=[],u=-1,c=-1,h=!1,l=0,p=t.length;p>l;++l){var f=t[l],d=n[f.length];d&&r(d,f,0)?(!h&&l>0&&(s=i(e,0,l),o=i(t,0,l)),a[++u]=e[l],h=!0):h&&(o[++c]=f,s[c]=e[l])}return h?[a,o,s]:null}},{"./../support/array-slice":116,"falcor-path-utils":27}],92:[function(e,t,n){var r=e("falcor-path-utils"),i=r.toTree,o=r.toPaths;t.exports=function(e,t,n){if(0===e._count)return void e.requestQueue.removeRequest(e);e.sent=!0,e.scheduled=!1;for(var r=e._pathMap,s=Object.keys(t),a=0,u=s.length;u>a;++a)for(var c=t[a],h=0,l=c.length;l>h;++h){var p=c[h],f=p.length;if(r[f]){var d=r[f];d[d.length]=p}else r[f]=[p]}for(var m=Object.keys(r),v=0,g=m.length;g>v;++v){var y=m[v];r[y]=i(r[y])}var _,b=e._collasped=o(r);e.requestQueue.model._source.get(b).subscribe(function(e){_=e},function(e){n(e,_)},function(){n(null,_)})}},{"falcor-path-utils":27}],93:[function(e,t,n){function r(e){a.call(this,e||o)}function i(e){return s.Observable.defer(function(){return e})}function o(e){function t(e){function t(e,t){if(Boolean(t.invalidated))e.invalidations.push(e.localThisPath.concat(t.path));else{var n=t.path,r=t.value;Boolean(r)&&"object"==typeof r&&r.$type===p?e.references.push({path:o(n),value:t.value}):e.values.push({path:o(n),value:t.value})}return e}function n(e){var t=e.values.concat(e.references);return t.length>0?i(_.set.apply(_,t)._toJSONG()).map(function(t){return{results:e,envelope:t}}):a["return"]({results:e,envelope:{jsonGraph:{},paths:[]}})}function r(e){var t,n=e.envelope,r=e.results,c=r.values,h=r.references,l=r.invalidations,p=c.map(u).map(o),f=h.reduce(s,[]),d=g.map(o),m=f.concat(d);return t=m.length>0?i(y.get.apply(y,p.concat(m))._toJSONG()):a["return"](n),t.doAction(function(e){e.invalidated=l})}function s(e,t){var n=t.path;return e.push.apply(e,v.map(function(e){return n.concat(e)})),e}function u(e){return e.path}var c=e&&e.localFn;if("function"==typeof c){var h=e.model,l=h._path,f=c.apply(h,m).reduce(t,{values:[],references:[],invalidations:[],localThisPath:l}).flatMap(n).flatMap(r);return a["return"](f)}return a.empty()}function n(e){function t(e){var t=e.invalidated;return t&&t.length&&y.invalidate.apply(y,t),e}return e&&"object"==typeof e?s.Observable.defer(function(){var t;try{t=e.call(x,m,v,g)}catch(n){t=a["throw"](new h(n))}return t}).map(t):a.empty()}function r(e){return i(_.set(e)).reduce(function(e){return e},null).map(function(){return{invalidated:e.invalidated,paths:e.paths.map(function(e){return e.slice(b.length)})}})}function o(e){return w.concat(e)}var c=this.args,f=this.model,d=l.fromPath(c[0]),m=c[1]||[],v=(c[2]||[]).map(l.fromPath),g=(c[3]||[]).map(l.fromPath),y=f._clone({_path:[]}),_=y.withoutDataSource(),b=f._path,x=b.concat(d),w=x.slice(0,-1),S=i(f.withoutDataSource().get(d)).map(function(e){for(var t=e.json,n=-1,r=d.length;t&&++n0){var h="_"+n+u+"AsJSON",l=t[h];l(t,c)}}return e.onCompleted(),s.empty}var o=e("rx/dist/rx"),s=o.Disposable,a=e("./../response/IdempotentResponse");r.create=a.create,r.prototype=Object.create(a.prototype),r.prototype.method="invalidate",r.prototype.constructor=r,t.exports=r},{"./../response/IdempotentResponse":94,"rx/dist/rx":156}],96:[function(e,t,n){function r(e){this._subscribe=e}function i(e){var t=this.model,n=new this.type;return n.model=t,n.args=this.args,n.outputFormat=e.outputFormat||"AsPathMap",n.isProgressive=e.isProgressive||!1,n.subscribeCount=0,n.subscribeLimit=e.retryLimit||10,n.initialize().invokeSourceRequest(t).ensureCollect(t).subscribe(e)}var o=e("./../"),s=e("rx/dist/rx")&&e("rx/dist/rx.aggregates"),a=s.Observable,u=e("./../support/array-slice"),c=e("./../support/noop"),h={outputFormat:{value:"AsJSONG"}},l={isProgressive:{value:!0}};r.create=function(e,t){var n=new r(i);return n.args=t,n.type=this,n.model=e,n},r.prototype=Object.create(a.prototype),r.prototype.constructor=r,r.prototype._mixin=function(){var e=this,t=u(arguments);return new e.constructor(function(n){return e.subscribe(t.reduce(function(e,t){return Object.create(e,t)},n))})},r.prototype._toJSONG=function(){return this._mixin(h)},r.prototype.progressively=function(){return this._mixin(l)},r.prototype.subscribe=function(e,t,n){var r=e;r&&"object"==typeof r||(r={onNext:e||c,onError:t||c,onCompleted:n||c});var i=this._subscribe(r);switch(typeof i){case"function":return{dispose:i};case"object":return i||{dispose:c};default:return{dispose:c}}},r.prototype.then=function(e,t){var n=this;return new o.Promise(function(e,t){var r,i=!1;n.toArray().subscribe(function(e){r=e.length<=1?e[0]:e},function(e){i=!0,t(e)},function(){i===!1&&e(r)})}).then(e,t)},t.exports=r},{"./../":64,"./../support/array-slice":116,"./../support/noop":137,"rx/dist/rx":156,"rx/dist/rx.aggregates":155}],97:[function(e,t,n){function r(e){f.call(this,e||i)}function i(e){return this.isCompleted?s.call(this,e):o.call(this,e)}function o(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),l.empty;for(var t=[],n=[],r=this.model,i=this.isMaster,o=r._root,c=this.outputFormat,h=o.errorSelector,p=this.method,f=this.groups,d=-1,v=f.length;++d0){var b="_"+p+y+c,x=r[b],w=x(r,_,null,h);n.push.apply(n,w[1]),"PathValues"===y?t.push.apply(t,_.map(a)):"JSONGs"===y?t.push.apply(t,m(_,u)):t.push.apply(t,w[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,s.call(this,e)):void e.onError({method:p,optimizedPaths:n,invokeSourceRequest:!0})}function s(e){var t=new p(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(t=t._toJSONG()),this.isProgressive&&(t=t.progressively()),t.subscribe(e)}function a(e){return e.path}function u(e){return e.paths}var c=e("rx/dist/rx"),h=c.Observable,l=c.Disposable,p=e("./get/GetResponse"),f=e("./../response/IdempotentResponse"),d=e("./../errors/InvalidSourceError"),m=e("./../support/array-flat-map"),v=new Array(0);r.create=f.create,r.prototype=Object.create(f.prototype),r.prototype.method="set",r.prototype.constructor=r,r.prototype.invokeSourceRequest=function(e){var t=this,n=this["catch"](function(r){var i;if(r&&r.invokeSourceRequest===!0){var o={},s=e._path,a=r.optimizedPaths;e._path=v,e._getPathValuesAsJSONG(e._materialize().withoutDataSource(),a,[o]),e._path=s,i=e._request.set(o)["do"](function(e){t.isCompleted=a.length===e.paths.length},function(){t.isCompleted=!0}).materialize().flatMap(function(e){if("C"===e.kind)return h.empty();if("E"===e.kind){var t=e.exception;if(d.is(t))return h["throw"](e.exception)}return n})}else i=h["throw"](r);return i});return new this.constructor(function(e){return n.subscribe(e)})},t.exports=r},{"./../errors/InvalidSourceError":41,"./../response/IdempotentResponse":94,"./../support/array-flat-map":114,"./get/GetResponse":99,"rx/dist/rx":156}],98:[function(e,t,n){var r=function(e){this.disposed=!1,this.currentDisposable=e};r.prototype={dispose:function(){if(!this.disposed&&this.currentDisposable){this.disposed=!0;var e=this.currentDisposable;e.dispose?e.dispose():e()}}},t.exports=r},{}],99:[function(e,t,n){var r=e("./../ModelResponse"),i=e("./checkCacheAndReport"),o=e("./getRequestCycle"),s={dispose:function(){}},a=e("rx/dist/rx").Observable,u=t.exports=function(e,t,n,r){this.model=e,this.currentRemainingPaths=t,this.isJSONGraph=n||!1,this.isProgressive=r||!1};u.prototype=Object.create(a.prototype),u.prototype.subscribe=r.prototype.subscribe,u.prototype.then=r.prototype.then,u.prototype._toJSONG=function(){return new u(this.model,this.currentRemainingPaths,!0,this.isProgressive)},u.prototype.progressively=function(){return new u(this.model,this.currentRemainingPaths,this.isJSONGraph,!0)},u.prototype._subscribe=function(e){var t=[{}],n=[],r=e.isJSONG=this.isJSONGraph,a=this.isProgressive,u=i(this.model,this.currentRemainingPaths,e,a,r,t,n);return u?o(this,this.model,u,e,t,n,1):s}},{"./../ModelResponse":96,"./checkCacheAndReport":100,"./getRequestCycle":101,"rx/dist/rx":156}],100:[function(e,t,n){var r=e("./../../get"),i=r.getWithPathsAsJSONGraph,o=r.getWithPathsAsPathMap;t.exports=function(e,t,n,r,s,a,u){var c;if(c=s?i(e,t,a):o(e,t,a),c.criticalError)return n.onError(c.criticalError),null;var h=c.hasValue,l=!c.requestedMissingPaths||!e._source,p=a[0].json||a[0].jsonGraph;if(c.errors)for(var f=c.errors,d=u.length,m=0,v=f.length;v>m;++m,++d)u[d]=f[m];if(h&&r||p&&l)try{++e._root.syncRefCount,n.onNext(a[0])}catch(g){throw g}finally{--e._root.syncRefCount}return l?(u.length?n.onError(u):n.onCompleted(),null):c}},{"./../../get":51}],101:[function(e,t,n){var r=e("./checkCacheAndReport"),i=e("./../../errors/MaxRetryExceededError"),o=e("./../../get/util/support").fastCat,s=e("./../../lru/collect"),a=e("./../../support/getSize"),u=e("./AssignableDisposable"),c=e("./../../internal/version");t.exports=function h(e,t,n,l,p,f,d){if(10===d)throw new i;var m=t._request,v=n.requestedMissingPaths,g=n.optimizedMissingPaths,y=new u,_=[],b=t._path;if(b.length)for(var x=0,w=v.length;w>x;++x)_[x]=o(b,v[x]);else _=v;var S=m.get(_,g,function(){var n=r(t,v,l,e.isProgressive,e.isJSONGraph,p,f);if(n)y.currentDisposable=h(e,t,n,l,p,f,d+1);else{var i=t._root,o=i.cache,u=o[c];s(i,i.expired,a(o),t._maxSize,t._collectRatio,u)}});return y.currentDisposable=S,y}},{"./../../errors/MaxRetryExceededError":42,"./../../get/util/support":62,"./../../internal/version":78,"./../../lru/collect":81,"./../../support/getSize":120,"./AssignableDisposable":98,"./checkCacheAndReport":100}],102:[function(e,t,n){var r=e("./GetResponse");t.exports=function(e){return new r(this,e)}},{"./GetResponse":99}],103:[function(e,t,n){var r=e("falcor-path-syntax"),i=e("./../ModelResponse"),o=e("./validInput"),s=e("./../../support/validateInput"),a=e("./GetResponse");t.exports=function(){var e=s(arguments,o,"get");if(e!==!0)return new i(function(t){t.onError(e)});var t=r.fromPathsOrPathValues(arguments);return new a(this,t)}},{"./../../support/validateInput":148,"./../ModelResponse":96,"./GetResponse":99,"./validInput":104,"falcor-path-syntax":18}],104:[function(e,t,n){t.exports={path:!0,pathSyntax:!0}},{}],105:[function(e,t,n){function r(){}var i=e("asap"),o=e("rx/dist/rx"),s=o.Disposable;r.prototype.schedule=function(e){return i(e),s.empty},r.prototype.scheduleWithState=function(e,t){var n=this;return i(function(){t(n,e)}),s.empty},t.exports=r},{asap:1,"rx/dist/rx":156}],106:[function(e,t,n){function r(){}var i=e("rx/dist/rx"),o=i.Disposable;r.prototype.schedule=function(e){return e(),o.empty},r.prototype.scheduleWithState=function(e,t){return t(this,e),o.empty},t.exports=r},{"rx/dist/rx":156}],107:[function(e,t,n){function r(e){this.delay=e}var i=e("rx/dist/rx"),o=i.Disposable;r.prototype.schedule=function(e){var t=setTimeout(e,this.delay);return o.create(function(){void 0!==t&&(clearTimeout(t),t=void 0)})},r.prototype.scheduleWithState=function(e,t){var n=this,r=setTimeout(function(){t(n,e)},this.delay);return o.create(function(){void 0!==r&&(clearTimeout(r),r=void 0)})},t.exports=r},{"rx/dist/rx":156}],108:[function(e,t,n){function r(e,t,n,i,s,a,u,c,h,l,p,d,m,v,g,_,b){for(var x={},w=tx,A=o(e,M,t,n,E,r,C,T,!0,i,s,c,p,m,y,_);if(t=A[0],v(t))return s.index=x,A;M=A[1],r=A[2],E=A[3]}while(x++=x)break;l.index=w}}function i(e,t,n,r,i,s,a,c,p,m){var v=n.value;if(i.splice(0,i.length),i.push.apply(i,v),x(n))return i.index=v.length,M(n,a,c),[void 0,t];y(c,n);var g=n,_=t;if(n=n[l],null!=n)_=n[h]||t,i.index=v.length;else{var b=0,w=v.length-1;_=n=t;do{var E=v[b],C=w>b,T=o(t,_,n,E,e,C,!0,r,i,s,a,c,p,m);if(n=T[0],S(n))return i.index=b,T;_=T[1]}while(b++S,T=o(t,w,n,E,e,C,!0,r,i,s,h,f,d,g);if(n=T[0],y(n))return i.index=S,T;w=T[1]}while(S++o&&(o=0),n>0&&o>n&&(o=n);for(var s=new Array(o);++iN)return}if(A&&L&&!P)return d(v(t,n,e,_,M),e,_);if(P||!L){if(P===s&&l(C)&&(n=C(y(b,_),n)),P&&t===n)null==t[i]&&(t=f(t,A,t.value),e=g(e,-t.$size,M,w),t=d(t,e,_,w));else{var D=!0;!A&&O||(D=u(n)-1);return e}},{"./../internal/parent":71,"./../internal/ref":75,"./../internal/refs-length":76,"./../internal/version":78}],147:[function(e,t,n){var r=e("./../internal/key"),i=e("./../internal/version"),o=e("./../internal/parent"),s=e("./../support/removeNode"),a=e("./../support/updateBackReferenceVersions");t.exports=function(e,t,n,u){var c=e;do{var h=c[o],l=c.$size=(c.$size||0)-t;0>=l&&null!=h?s(c,h,c[r],n):c[i]!==u&&a(c,u),c=h}while(c);return e}},{"./../internal/key":68,"./../internal/parent":71,"./../internal/version":78,"./../support/removeNode":140,"./../support/updateBackReferenceVersions":146}],148:[function(e,t,n){var r=Array.isArray,i=e("./../support/isPathValue"),o=e("./../support/isJSONGraphEnvelope"),s=e("./../support/isJSONEnvelope"),a=e("falcor-path-syntax");t.exports=function(e,t,n){for(var u=0,c=e.length;c>u;++u){var h=e[u],l=!1;if(r(h)&&t.path?l=!0:"string"==typeof h&&t.pathSyntax?l=!0:i(h)&&t.pathValue?(h.path=a.fromPath(h.path),l=!0):o(h)&&t.jsonGraph?l=!0:s(h)&&t.json?l=!0:"function"==typeof h&&u+1===c&&t.selector&&(l=!0),!l)return new Error("Unrecognized argument "+typeof h+" ["+String(h)+"] to Model#"+n)}return!0}},{"./../support/isJSONEnvelope":130,"./../support/isJSONGraphEnvelope":131,"./../support/isPathValue":133,"falcor-path-syntax":18}],149:[function(e,t,n){var r=e("falcor-json-graph"),i=r.atom,o=e("./../support/now"),s=e("../values/expires-now"),a=e("./../internal/model-created"),u=50,c=e("./../support/clone"),h=Array.isArray,l=e("./../support/getSize"),p=e("./../support/getExpires");t.exports=function(e,t,n){var r=0,f=e,d=t;if(d?(f=c(f),r=l(f),f.$type=d):(f=i(n),d=f.$type,f[a]=!0),null==n)r=u+1;else if(null==r||0>=r)switch(typeof n){case"object":r=h(n)?u+n.length:u+1;break;case"string":r=u+n.length;break;default:r=u+1}var m=p(f);return"number"==typeof m&&s>m&&(f.$expires=o()+-1*m),f.$size=r,f}},{"../values/expires-now":154,"./../internal/model-created":69,"./../support/clone":117,"./../support/getExpires":119,"./../support/getSize":120,"./../support/now":138,"falcor-json-graph":14}],150:[function(e,t,n){t.exports="atom"},{}],151:[function(e,t,n){t.exports="error"},{}],152:[function(e,t,n){t.exports="ref"},{}],153:[function(e,t,n){t.exports=1},{}],154:[function(e,t,n){t.exports=0},{}],155:[function(t,n,r){(function(i){(function(o){var s={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},a=s[typeof window]&&window||this,u=s[typeof r]&&r&&!r.nodeType&&r,c=s[typeof n]&&n&&!n.nodeType&&n,h=(c&&c.exports===u&&u,s[typeof i]&&i);!h||h.global!==h&&h.window!==h||(a=h),"function"==typeof e&&e.amd?e(["rx"],function(e,t){return o(a,t,e)}):"object"==typeof n&&n&&n.exports===u?n.exports=o(a,n.exports,t("./rx")):a.Rx=o(a,{},a.Rx)}).call(this,function(e,t,n,r){function i(){try{return f.apply(this,arguments)}catch(e){return I.e=e,I}}function o(e){if(!M(e))throw new TypeError("fn must be a function");return f=e,i}function s(e,t,n){return new g(function(r){var i=!1,o=null,s=[];return e.subscribe(function(e){var a,u;try{u=t(e)}catch(c){return void r.onError(c)}if(a=0,i)try{a=n(u,o)}catch(h){return void r.onError(h)}else i=!0,o=u;a>0&&(o=u,s=[]),a>=0&&s.push(e)},function(e){r.onError(e)},function(){r.onNext(s),r.onCompleted()})},e)}function a(e){if(0===e.length)throw new R;return e[0]}function u(e,t,n,r){if(0>t)throw new D;return new g(function(i){var o=t;return e.subscribe(function(e){0===o--&&(i.onNext(e),i.onCompleted())},function(e){i.onError(e)},function(){n?(i.onNext(r),i.onCompleted()):i.onError(new D)})},e)}function c(e,t,n){return new g(function(r){var i=n,o=!1;return e.subscribe(function(e){o?r.onError(new Error("Sequence contains more than one element")):(i=e,o=!0)},function(e){r.onError(e)},function(){o||t?(r.onNext(i),r.onCompleted()):r.onError(new R)})},e)}function h(e,t,n){return new g(function(r){return e.subscribe(function(e){r.onNext(e),r.onCompleted()},function(e){r.onError(e)},function(){t?(r.onNext(n),r.onCompleted()):r.onError(new R)})},e)}function l(e,t,n){return new g(function(r){var i=n,o=!1;return e.subscribe(function(e){i=e,o=!0},function(e){r.onError(e)},function(){o||t?(r.onNext(i),r.onCompleted()):r.onError(new R)})},e)}function p(e,t,n,i){var o=L(t,n,3);return new g(function(t){var n=0;return e.subscribe(function(r){var s;try{s=o(r,n,e)}catch(a){return void t.onError(a)}s?(t.onNext(i?n:r),t.onCompleted()):n++},function(e){t.onError(e)},function(){t.onNext(i?-1:r),t.onCompleted()})},e)}var f,d=n.Observable,m=d.prototype,v=n.CompositeDisposable,g=n.AnonymousObservable,y=n.Disposable.empty,_=(n.internals.isEqual,n.helpers),b=_.not,x=_.defaultComparer,w=_.identity,S=_.defaultSubComparer,M=_.isFunction,E=_.isPromise,C=_.isArrayLike,T=_.isIterable,A=n.internals.inherits,P=d.fromPromise,O=d.from,L=n.internals.bindCallback,R=n.EmptyError,N=n.ObservableBase,D=n.ArgumentOutOfRangeError,I={e:{}};m.aggregate=function(){var e,t,n=!1,r=this;return 2===arguments.length?(n=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new g(function(i){var o,s,a;return r.subscribe(function(r){!a&&(a=!0);try{o?s=e(s,r):(s=n?e(t,r):r,o=!0)}catch(u){return i.onError(u)}},function(e){i.onError(e)},function(){a&&i.onNext(s),!a&&n&&i.onNext(t),!a&&!n&&i.onError(new R),i.onCompleted()})},r)};var k=function(e){function t(t,n,r,i){this.source=t,this.acc=n,this.hasSeed=r,this.seed=i,e.call(this)}function n(e,t){this.o=e,this.acc=t.acc,this.hasSeed=t.hasSeed,this.seed=t.seed,this.hasAccumulation=!1,this.result=null,this.hasValue=!1,this.isStopped=!1}return A(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this))},n.prototype.onNext=function(e){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=o(this.acc)(this.result,e):(this.result=this.hasSeed?o(this.acc)(this.seed,e):e,this.hasAccumulation=!0),this.result===I&&this.o.onError(this.result.e))},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.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())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(N);return m.reduce=function(e){var t=!1;if(2===arguments.length){t=!0;var n=arguments[1]}return new k(this,e,t,n)},m.some=function(e,t){var n=this;return e?n.filter(e,t).some():new g(function(e){return n.subscribe(function(){e.onNext(!0),e.onCompleted()},function(t){e.onError(t)},function(){e.onNext(!1),e.onCompleted()})},n)},m.any=function(){return this.some.apply(this,arguments)},m.isEmpty=function(){return this.any().map(b)},m.every=function(e,t){return this.filter(function(t){return!e(t)},t).some().map(b)},m.all=function(){return this.every.apply(this,arguments)},m.includes=function(e,t){function n(e,t){return 0===e&&0===t||e===t||isNaN(e)&&isNaN(t)}var r=this;return new g(function(i){var o=0,s=+t||0;return Math.abs(s)===1/0&&(s=0),0>s?(i.onNext(!1),i.onCompleted(),y):r.subscribe(function(t){o++>=s&&n(t,e)&&(i.onNext(!0),i.onCompleted())},function(e){i.onError(e)},function(){i.onNext(!1),i.onCompleted()})},this)},m.contains=function(e,t){m.includes(e,t)},m.count=function(e,t){return e?this.filter(e,t).count():this.reduce(function(e){return e+1},0)},m.indexOf=function(e,t){var n=this;return new g(function(r){var i=0,o=+t||0;return Math.abs(o)===1/0&&(o=0),0>o?(r.onNext(-1),r.onCompleted(),y):n.subscribe(function(t){i>=o&&t===e&&(r.onNext(i),r.onCompleted()),i++},function(e){r.onError(e)},function(){r.onNext(-1),r.onCompleted()})},n)},m.sum=function(e,t){return e&&M(e)?this.map(e,t).sum():this.reduce(function(e,t){return e+t},0)},m.minBy=function(e,t){return t||(t=S),s(this,e,function(e,n){return-1*t(e,n)})},m.min=function(e){return this.minBy(w,e).map(function(e){return a(e)})},m.maxBy=function(e,t){return t||(t=S),s(this,e,t)},m.max=function(e){return this.maxBy(w,e).map(function(e){return a(e)})},m.average=function(e,t){return e&&M(e)?this.map(e,t).average():this.reduce(function(e,t){return{sum:e.sum+t,count:e.count+1}},{sum:0,count:0}).map(function(e){if(0===e.count)throw new R;return e.sum/e.count})},m.sequenceEqual=function(e,t){var n=this;return t||(t=x),new g(function(r){var i=!1,o=!1,s=[],a=[],u=n.subscribe(function(e){var n,i;if(a.length>0){i=a.shift();try{n=t(i,e)}catch(u){return void r.onError(u)}n||(r.onNext(!1),r.onCompleted())}else o?(r.onNext(!1),r.onCompleted()):s.push(e)},function(e){r.onError(e)},function(){i=!0,0===s.length&&(a.length>0?(r.onNext(!1),r.onCompleted()):o&&(r.onNext(!0),r.onCompleted()))});(C(e)||T(e))&&(e=O(e)),E(e)&&(e=P(e));var c=e.subscribe(function(e){var n;if(s.length>0){var o=s.shift();try{n=t(o,e)}catch(u){return void r.onError(u)}n||(r.onNext(!1),r.onCompleted())}else i?(r.onNext(!1),r.onCompleted()):a.push(e)},function(e){r.onError(e)},function(){o=!0,0===a.length&&(s.length>0?(r.onNext(!1),r.onCompleted()):i&&(r.onNext(!0),r.onCompleted()))});return new v(u,c)},n)},m.elementAt=function(e){return u(this,e,!1)},m.elementAtOrDefault=function(e,t){return u(this,e,!0,t)},m.single=function(e,t){return e&&M(e)?this.where(e,t).single():c(this,!1)},m.singleOrDefault=function(e,t,n){return e&&M(e)?this.filter(e,n).singleOrDefault(null,t):c(this,!0,t)},m.first=function(e,t){return e?this.where(e,t).first():h(this,!1)},m.firstOrDefault=function(e,t,n){return e?this.where(e).firstOrDefault(null,t):h(this,!0,t)},m.last=function(e,t){return e?this.where(e,t).last():l(this,!1)},m.lastOrDefault=function(e,t,n){return e?this.where(e,n).lastOrDefault(null,t):l(this,!0,t)},m.find=function(e,t){return p(this,e,t,!1)},m.findIndex=function(e,t){return p(this,e,t,!0)},m.toSet=function(){if("undefined"==typeof e.Set)throw new TypeError;var t=this;return new g(function(n){var r=new e.Set;return t.subscribe(function(e){r.add(e)},function(e){n.onError(e)},function(){n.onNext(r),n.onCompleted()})},t)},m.toMap=function(t,n){if("undefined"==typeof e.Map)throw new TypeError;var r=this;return new g(function(i){var o=new e.Map;return r.subscribe(function(e){var r;try{r=t(e)}catch(s){return void i.onError(s)}var a=e;if(n)try{a=n(e)}catch(s){return void i.onError(s)}o.set(r,a)},function(e){i.onError(e)},function(){i.onNext(o),i.onCompleted()})},r)},n})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./rx":156}],156:[function(t,n,r){(function(t,i){(function(o){function a(e){for(var t=[],n=0,r=e.length;r>n;n++)t.push(e[n]);return t}function u(e,t){if(ce&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(fe)){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var i=n.join("\n"+fe+"\n");e.stack=c(i)}}function c(e){for(var t=e.split("\n"),n=[],r=0,i=t.length;i>r;r++){var o=t[r];h(o)||l(o)||!o||n.push(o)}return n.join("\n")}function h(e){var t=f(e);if(!t)return!1;var n=t[0],r=t[1];return n===le&&r>=pe&&Fn>=r}function l(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function p(){if(ce)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=f(n);if(!r)return;return le=r[0],r[1]}}function f(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function d(e){var t=[];if(!Xe(e))return t;qe.nonEnumArgs&&e.length&&Ye(e)&&(e=Je.call(e));var n=qe.enumPrototypes&&"function"==typeof e,r=qe.enumErrorProps&&(e===Ge||e instanceof Error);for(var i in e)n&&"prototype"==i||r&&("message"==i||"name"==i)||t.push(i);if(qe.nonEnumShadows&&e!==ze){var o=e.constructor,s=-1,a=Ae;if(e===(o&&o.prototype))var u=e===He?Fe:e===Ge?Ne:Be.call(e),c=We[u];for(;++s-1:void 0});return n.pop(),r.pop(),f}function _(e,t){for(var n=new Array(e),r=0;e>r;r++)n[r]=t();return n}function b(){try{return Ke.apply(this,arguments)}catch(e){return nt.e=e,nt}}function x(e){if(!ue(e))throw new TypeError("fn must be a function");return Ke=e,b}function w(e){throw e}function S(e,t){this.id=e,this.value=t}function M(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function E(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function C(e){this._s=s}function T(e){this._s=s,this._l=s.length,this._i=0}function A(e){this._a=e}function P(e){this._a=e,this._l=N(e),this._i=0}function O(e){return"number"==typeof e&&Y.isFinite(e)}function L(e){var t,n=e[xe];if(!n&&"string"==typeof e)return t=new C(e),t[xe]();if(!n&&e.length!==o)return t=new A(e),t[xe]();if(!n)throw new TypeError("Object is not iterable");return e[xe]()}function R(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}function N(e){var t=+e.length;return isNaN(t)?0:0!==t&&O(t)?(t=R(t)*Math.floor(Math.abs(t)),0>=t?0:t>tn?tn:t):t}function D(e,t){this.observer=e,this.parent=t}function I(e,t){return yt(e)||(e=wt),new rn(t,e)}function k(e,t){this.observer=e,this.parent=t}function j(e,t){this.observer=e,this.parent=t}function F(e,t){return new Nn(function(n){var r=new pt,i=new ft;return i.setDisposable(r),r.setDisposable(e.subscribe(function(e){n.onNext(e)},function(e){try{var r=t(e)}catch(o){return n.onError(o)}ae(r)&&(r=Yt(r));var s=new pt;i.setDisposable(s),s.setDisposable(r.subscribe(n))},function(e){n.onCompleted(e)})),i},e)}function B(){return!1}function V(e,t){var n=this;return new Nn(function(r){var i=0,o=e.length;return n.subscribe(function(n){if(o>i){var s=e[i++],a=x(t)(n,s);if(a===nt)return r.onError(a.e);r.onNext(a)}else r.onCompleted()},function(e){r.onError(e)},function(){r.onCompleted()})},n)}function B(){return!1}function U(){return[]}function B(){return!1}function G(){return[]}function z(e,t){this.observer=e,this.accumulator=t.accumulator,this.hasSeed=t.hasSeed,this.seed=t.seed,this.hasAccumulation=!1,this.accumulation=null,this.hasValue=!1,this.isStopped=!1}function H(e,t,n){var r=Ce(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i}).concatAll()}function $(e,t,n){for(var r=0,i=e.length;i>r;r++)if(n(e[r],t))return r;return-1}function W(e){this.comparer=e,this.set=[]}function q(e,t,n){var r=Ce(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i}).mergeAll()}var X={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Y=X[typeof window]&&window||this,K=X[typeof r]&&r&&!r.nodeType&&r,Z=X[typeof n]&&n&&!n.nodeType&&n,J=Z&&Z.exports===K&&K,Q=X[typeof i]&&i;!Q||Q.global!==Q&&Q.window!==Q||(Y=Q);var ee={internals:{},config:{Promise:Y.Promise},helpers:{}},te=ee.helpers.noop=function(){},ne=(ee.helpers.notDefined=function(e){return"undefined"==typeof e},ee.helpers.identity=function(e){return e}),re=(ee.helpers.pluck=function(e){return function(t){return t[e]}},ee.helpers.just=function(e){return function(){return e}},ee.helpers.defaultNow=Date.now),ie=ee.helpers.defaultComparer=function(e,t){return Ze(e,t)},oe=ee.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},se=(ee.helpers.defaultKeySerializer=function(e){return e.toString()},ee.helpers.defaultError=function(e){throw e}),ae=ee.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},ue=(ee.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},ee.helpers.not=function(e){return!e},ee.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==Be.call(e)}),e}());ee.config.longStackSupport=!1;var ce=!1;try{throw new Error}catch(he){ce=!!he.stack}var le,pe=p(),fe="From previous event:",de=ee.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};de.prototype=Error.prototype;var me=ee.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};me.prototype=Error.prototype;var ve=ee.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};ve.prototype=Error.prototype;var ge=ee.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};ge.prototype=Error.prototype;var ye=ee.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};ye.prototype=Error.prototype;var _e=ee.helpers.notImplemented=function(){throw new ye},be=ee.helpers.notSupported=function(){throw new ge},xe="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";Y.Set&&"function"==typeof(new Y.Set)["@@iterator"]&&(xe="@@iterator");var we=ee.doneEnumerator={done:!0,value:o},Se=ee.helpers.isIterable=function(e){return e[xe]!==o},Me=ee.helpers.isArrayLike=function(e){return e&&e.length!==o};ee.helpers.iterator=xe;var Ee,Ce=ee.internals.bindCallback=function(e,t,n){if("undefined"==typeof t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},Te=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ae=Te.length,Pe="[object Arguments]",Oe="[object Array]",Le="[object Boolean]",Re="[object Date]",Ne="[object Error]",De="[object Function]",Ie="[object Number]",ke="[object Object]",je="[object RegExp]",Fe="[object String]",Be=Object.prototype.toString,Ve=Object.prototype.hasOwnProperty,Ue=Be.call(arguments)==Pe,Ge=Error.prototype,ze=Object.prototype,He=String.prototype,$e=ze.propertyIsEnumerable;
-try{Ee=!(Be.call(document)==ke&&!({toString:0}+""))}catch(he){Ee=!0}var We={};We[Oe]=We[Re]=We[Ie]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},We[Le]=We[Fe]={constructor:!0,toString:!0,valueOf:!0},We[Ne]=We[De]=We[je]={constructor:!0,toString:!0},We[ke]={constructor:!0};var qe={};!function(){var e=function(){this.x=1},t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments);qe.enumErrorProps=$e.call(Ge,"message")||$e.call(Ge,"name"),qe.enumPrototypes=$e.call(e,"prototype"),qe.nonEnumArgs=0!=n,qe.nonEnumShadows=!/valueOf/.test(t)}(1);var Xe=ee.internals.isObject=function(e){var t=typeof e;return e&&("function"==t||"object"==t)||!1},Ye=function(e){return e&&"object"==typeof e?Be.call(e)==Pe:!1};Ue||(Ye=function(e){return e&&"object"==typeof e?Ve.call(e,"callee"):!1});var Ke,Ze=ee.internals.isEqual=function(e,t){return y(e,t,[],[])},Je=({}.hasOwnProperty,Array.prototype.slice),Qe=this.inherits=ee.internals.inherits=function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n},et=ee.internals.addProperties=function(e){for(var t=[],n=1,r=arguments.length;r>n;n++)t.push(arguments[n]);for(var i=0,o=t.length;o>i;i++){var s=t[i];for(var a in s)e[a]=s[a]}},tt=ee.internals.addRef=function(e,t){return new Nn(function(n){return new ot(t.getDisposable(),e.subscribe(n))})},nt={e:{}};S.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var rt=ee.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},it=rt.prototype;it.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},it.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}}},it.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,n=2*e+2,r=e;if(te;e++)n[e]=arguments[e];for(e=0;t>e;e++)if(!ht(n[e]))throw new TypeError("Not a disposable");this.disposables=n,this.isDisposed=!1,this.length=n.length},st=ot.prototype;st.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},st.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},st.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;e>n;n++)t[n]=this.disposables[n];for(this.disposables=[],this.length=0,n=0;e>n;n++)t[n].dispose()}};var at=ee.Disposable=function(e){this.isDisposed=!1,this.action=e||te};at.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ut=at.create=function(e){return new at(e)},ct=at.empty={dispose:te},ht=at.isDisposable=function(e){return e&&ue(e.dispose)},lt=at.checkDisposed=function(e){if(e.isDisposed)throw new me},pt=ee.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};pt.prototype.getDisposable=function(){return this.current},pt.prototype.setDisposable=function(e){if(this.current)throw new Error("Disposable has already been assigned");var t=this.isDisposed;!t&&(this.current=e),t&&e&&e.dispose()},pt.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var ft=ee.SerialDisposable=function(){this.isDisposed=!1,this.current=null};ft.prototype.getDisposable=function(){return this.current},ft.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e}n&&n.dispose(),t&&e&&e.dispose()},ft.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var dt=ee.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?ct:new e(this)},t}();M.prototype.dispose=function(){this.scheduler.scheduleWithState(this,E)};var mt=ee.internals.ScheduledItem=function(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||oe,this.disposable=new pt};mt.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},mt.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},mt.prototype.isCancelled=function(){return this.disposable.isDisposed},mt.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var vt=ee.Scheduler=function(){function e(e,t,n,r){this.now=e,this._schedule=t,this._scheduleRelative=n,this._scheduleAbsolute=r}function t(e,t){return t(),ct}e.isScheduler=function(t){return t instanceof e};var n=e.prototype;return n.schedule=function(e){return this._schedule(e,t)},n.scheduleWithState=function(e,t){return this._schedule(e,t)},n.scheduleWithRelative=function(e,n){return this._scheduleRelative(n,e,t)},n.scheduleWithRelativeAndState=function(e,t,n){return this._scheduleRelative(e,t,n)},n.scheduleWithAbsolute=function(e,n){return this._scheduleAbsolute(n,e,t)},n.scheduleWithAbsoluteAndState=function(e,t,n){return this._scheduleAbsolute(e,t,n)},e.now=re,e.normalize=function(e){return 0>e&&(e=0),e},e}(),gt=vt.normalize,yt=vt.isScheduler;!function(e){function t(e,t){function n(t){i(t,function(t){var r=!1,i=!1,s=e.scheduleWithState(t,function(e,t){return r?o.remove(s):i=!0,n(t),ct});i||(o.add(s),r=!0)})}var r=t[0],i=t[1],o=new ot;return n(r),o}function n(e,t,n){function r(t){o(t,function(t,i){var o=!1,a=!1,u=e[n](t,i,function(e,t){return o?s.remove(u):a=!0,r(t),ct});a||(s.add(u),o=!0)})}var i=t[0],o=t[1],s=new ot;return r(i),s}function r(e,t){e(function(n){t(e,n)})}e.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,r)},e.scheduleRecursiveWithState=function(e,n){return this.scheduleWithState([e,n],t)},e.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,r)},e.scheduleRecursiveWithRelativeAndState=function(e,t,r){return this._scheduleRelative([e,r],t,function(e,t){return n(e,t,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,r)},e.scheduleRecursiveWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute([e,r],t,function(e,t){return n(e,t,"scheduleWithAbsoluteAndState")})}}(vt.prototype),function(e){vt.prototype.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,t)},vt.prototype.schedulePeriodicWithState=function(e,t,n){if("undefined"==typeof Y.setInterval)throw new ge;t=gt(t);var r=e,i=Y.setInterval(function(){r=n(r)},t);return ut(function(){Y.clearInterval(i)})}}(vt.prototype),function(e){e.catchError=e["catch"]=function(e){return new Ct(this,e)}}(vt.prototype);var _t,bt,xt=(ee.internals.SchedulePeriodicRecursive=function(){function e(e,t){t(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new pt;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,e.bind(this))),t},t}(),vt.immediate=function(){function e(e,t){return t(this,e)}return new vt(re,e,be,be)}()),wt=vt.currentThread=function(){function e(){for(;n.length>0;){var e=n.dequeue();!e.isCancelled()&&e.invoke()}}function t(t,r){var i=new mt(this,t,r,this.now());if(n)n.enqueue(i);else{n=new rt(4),n.enqueue(i);var o=x(e)();if(n=null,o===nt)return w(o.e)}return i.disposable}var n,r=new vt(re,t,be,be);return r.scheduleRequired=function(){return!n},r}(),St=function(){var e,t=te;if(Y.setTimeout)e=Y.setTimeout,t=Y.clearTimeout;else{if(!Y.WScript)throw new ge;e=function(e,t){Y.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),Mt=St.setTimeout,Et=St.clearTimeout;!function(){function e(t){if(s)Mt(function(){e(t)},0);else{var n=o[t];if(n){s=!0;var r=x(n)();if(bt(t),s=!1,r===nt)return w(r.e)}}}function n(){if(!Y.postMessage||Y.importScripts)return!1;var e=!1,t=Y.onmessage;return Y.onmessage=function(){e=!0},Y.postMessage("","*"),Y.onmessage=t,e}function r(t){"string"==typeof t.data&&t.data.substring(0,c.length)===c&&e(t.data.substring(c.length))}var i=1,o={},s=!1;bt=function(e){delete o[e]};var a=RegExp("^"+String(Be).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),u="function"==typeof(u=Q&&J&&Q.setImmediate)&&!a.test(u)&&u;if(ue(u))_t=function(t){var n=i++;return o[n]=t,u(function(){e(n)}),n};else if("undefined"!=typeof t&&"[object process]"==={}.toString.call(t))_t=function(n){var r=i++;return o[r]=n,t.nextTick(function(){e(r)}),r};else if(n()){var c="ms.rx.schedule"+Math.random();Y.addEventListener?Y.addEventListener("message",r,!1):Y.attachEvent?Y.attachEvent("onmessage",r):Y.onmessage=r,_t=function(e){var t=i++;return o[t]=e,Y.postMessage(c+currentId,"*"),t}}else if(Y.MessageChannel){var h=new Y.MessageChannel;h.port1.onmessage=function(t){e(t.data)},_t=function(e){var t=i++;return o[t]=e,h.port2.postMessage(t),t}}else _t="document"in Y&&"onreadystatechange"in Y.document.createElement("script")?function(t){var n=Y.document.createElement("script"),r=i++;return o[r]=t,n.onreadystatechange=function(){e(r),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},Y.document.documentElement.appendChild(n),r}:function(t){var n=i++;return o[n]=t,Mt(function(){e(n)},0),n}}();var Ct=(vt.timeout=vt["default"]=function(){function e(e,t){var n=this,r=new pt,i=_t(function(){!r.isDisposed&&r.setDisposable(t(n,e))});return new ot(r,ut(function(){bt(i)}))}function t(e,t,n){var r=this,i=vt.normalize(t),o=new pt;if(0===i)return r.scheduleWithState(e,n);var s=Mt(function(){!o.isDisposed&&o.setDisposable(n(r,e))},i);return new ot(o,ut(function(){Et(s)}))}function n(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}return new vt(re,e,t,n)}(),function(e){function t(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function n(e,t,n){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(n))}function r(e,t,n){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(n))}function i(i,o){this._scheduler=i,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,e.call(this,this._scheduler.now.bind(this._scheduler),t,n,r)}return Qe(i,e),i.prototype._clone=function(e){return new i(e,this._handler)},i.prototype._wrap=function(e){var t=this;return function(n,r){try{return e(t._getRecursiveWrapper(n),r)}catch(i){if(!t._handler(i))throw i;return ct}}},i.prototype._getRecursiveWrapper=function(e){if(this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},i.prototype.schedulePeriodicWithState=function(e,t,n){var r=this,i=!1,o=new pt;return o.setDisposable(this._scheduler.schedulePeriodicWithState(e,t,function(e){if(i)return null;try{return n(e)}catch(t){if(i=!0,!r._handler(t))throw t;return o.dispose(),null}})),o},i}(vt)),Tt=ee.Notification=function(){function e(e,t,n,r,i,o){this.kind=e,this.value=t,this.exception=n,this._accept=r,this._acceptObservable=i,this.toString=o}return e.prototype.accept=function(e,t,n){return e&&"object"==typeof e?this._acceptObservable(e):this._accept(e,t,n)},e.prototype.toObservable=function(e){var t=this;return yt(e)||(e=xt),new Nn(function(n){return e.scheduleWithState(t,function(e,t){t._acceptObservable(n),"N"===t.kind&&n.onCompleted()})})},e}(),At=Tt.createOnNext=function(){function e(e){return e(this.value)}function t(e){return e.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){return new Tt("N",r,null,e,t,n)}}(),Pt=Tt.createOnError=function(){function e(e,t){return t(this.exception)}function t(e){return e.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){return new Tt("E",null,r,e,t,n)}}(),Ot=Tt.createOnCompleted=function(){function e(e,t,n){return n()}function t(e){return e.onCompleted()}function n(){return"OnCompleted()"}return function(){return new Tt("C",null,null,e,t,n)}}(),Lt=ee.Observer=function(){};Lt.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},Lt.prototype.asObserver=function(){return new It(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Lt.prototype.checked=function(){return new kt(this)};var Rt=Lt.create=function(e,t,n){return e||(e=te),t||(t=se),n||(n=te),new It(e,t,n)};Lt.fromNotifier=function(e,t){return new It(function(n){return e.call(t,At(n))},function(n){return e.call(t,Pt(n))},function(){return e.call(t,Ot())})},Lt.prototype.notifyOn=function(e){return new Ft(e,this)},Lt.prototype.makeSafe=function(e){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,e)};var Nt,Dt=ee.internals.AbstractObserver=function(e){function t(){this.isStopped=!1,e.call(this)}return Qe(t,e),t.prototype.next=_e,t.prototype.error=_e,t.prototype.completed=_e,t.prototype.onNext=function(e){this.isStopped||this.next(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.error(e),!0)},t}(Lt),It=ee.AnonymousObserver=function(e){function t(t,n,r){e.call(this),this._onNext=t,this._onError=n,this._onCompleted=r}return Qe(t,e),t.prototype.next=function(e){this._onNext(e)},t.prototype.error=function(e){this._onError(e)},t.prototype.completed=function(){this._onCompleted()},t}(Dt),kt=function(e){function t(t){e.call(this),this._observer=t,this._state=0}Qe(t,e);var n=t.prototype;return n.onNext=function(e){this.checkAccess();var t=x(this._observer.onNext).call(this._observer,e);this._state=0,t===nt&&w(t.e)},n.onError=function(e){this.checkAccess();var t=x(this._observer.onError).call(this._observer,e);this._state=2,t===nt&&w(t.e)},n.onCompleted=function(){this.checkAccess();var e=x(this._observer.onCompleted).call(this._observer);this._state=2,e===nt&&w(e.e)},n.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)},t}(Lt),jt=ee.internals.ScheduledObserver=function(e){function t(t,n){e.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ft}return Qe(t,e),t.prototype.next=function(e){var t=this;this.queue.push(function(){t.observer.onNext(e)})},t.prototype.error=function(e){var t=this;this.queue.push(function(){t.observer.onError(e)})},t.prototype.completed=function(){var e=this;this.queue.push(function(){e.observer.onCompleted()})},t.prototype.ensureActive=function(){var e=!1,t=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var n;if(!(t.queue.length>0))return void(t.isAcquired=!1);n=t.queue.shift();try{n()}catch(r){throw t.queue=[],t.hasFaulted=!0,r}e()}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}(Dt),Ft=function(e){function t(t,n,r){e.call(this,t,n),this._cancel=r}return Qe(t,e),t.prototype.next=function(t){e.prototype.next.call(this,t),this.ensureActive()},t.prototype.error=function(t){e.prototype.error.call(this,t),this.ensureActive()},t.prototype.completed=function(){e.prototype.completed.call(this),this.ensureActive()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},t}(jt),Bt=ee.Observable=function(){function e(e){if(ee.config.longStackSupport&&ce){try{throw new Error}catch(t){this.stack=t.stack.substring(t.stack.indexOf("\n")+1)}var n=this;this._subscribe=function(t){var r=t.onError.bind(t);return t.onError=function(e){u(e,n),r(e)},e.call(n,t)}}else this._subscribe=e}return Nt=e.prototype,Nt.subscribe=Nt.forEach=function(e,t,n){return this._subscribe("object"==typeof e?e:Rt(e,t,n))},Nt.subscribeOnNext=function(e,t){return this._subscribe(Rt("undefined"!=typeof t?function(n){e.call(t,n)}:e))},Nt.subscribeOnError=function(e,t){return this._subscribe(Rt(null,"undefined"!=typeof t?function(n){e.call(t,n)}:e))},Nt.subscribeOnCompleted=function(e,t){return this._subscribe(Rt(null,null,"undefined"!=typeof t?function(){e.call(t)}:e))},e}(),Vt=ee.ObservableBase=function(e){function t(e){return e&&ue(e.dispose)?e:ue(e)?ut(e):ct}function n(e,n){var r=n[0],i=n[1],o=x(i.subscribeCore).call(i,r);return o!==nt||r.fail(nt.e)?void r.setDisposable(t(o)):w(nt.e)}function r(e){var t=new Dn(e),r=[t,this];return wt.scheduleRequired()?wt.scheduleWithState(r,n):n(null,r),t}function i(){e.call(this,r)}return Qe(i,e),i.prototype.subscribeCore=_e,i}(Bt),Ut=ee.internals.Enumerable=function(){},Gt=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t,n){this.o=e,this.s=t,this.e=n,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){var t,r=new ft,i=xt.scheduleRecursiveWithState(this.sources[xe](),function(i,o){if(!t){var s=x(i.next).call(i);if(s===nt)return e.onError(s.e);if(s.done)return e.onCompleted();var a=s.value;ae(a)&&(a=Yt(a));var u=new pt;r.setDisposable(u),u.setDisposable(a.subscribe(new n(e,o,i)))}});return new ot(r,i,ut(function(){t=!0}))},n.prototype.onNext=function(e){this.isStopped||this.o.onNext(e)},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Ut.prototype.concat=function(){return new Gt(this)};var zt=function(e){function t(t){this.sources=t,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t,n=this.sources[xe](),r=new ft,i=xt.scheduleRecursiveWithState(null,function(i,o){if(!t){var s=x(n.next).call(n);if(s===nt)return e.onError(s.e);if(s.done)return null!==i?e.onError(i):e.onCompleted();var a=s.value;ae(a)&&(a=Yt(a));var u=new pt;r.setDisposable(u),u.setDisposable(a.subscribe(function(t){e.onNext(t)},o,function(){e.onCompleted()}))}});return new ot(r,i,ut(function(){t=!0}))},t}(Vt);Ut.prototype.catchError=function(){return new zt(this)},Ut.prototype.catchErrorWhen=function(e){var t=this;return new Nn(function(n){var r,i,o=new kn,s=new kn,a=e(o),u=a.subscribe(s),c=t[xe](),h=new ft,l=xt.scheduleRecursive(function(e){if(!r){var t=x(c.next).call(c);if(t===nt)return n.onError(t.e);if(t.done)return void(i?n.onError(i):n.onCompleted());var a=t.value;ae(a)&&(a=Yt(a));var u=new pt,l=new pt;h.setDisposable(new ot(l,u)),u.setDisposable(a.subscribe(function(e){n.onNext(e)},function(t){l.setDisposable(s.subscribe(e,function(e){n.onError(e)},function(){n.onCompleted()})),o.onNext(t)},function(){n.onCompleted()}))}});return new ot(u,h,l,ut(function(){r=!0}))})};var Ht=function(e){function t(e,t){this.v=e,this.c=null==t?-1:t}function n(e){this.v=e.v,this.l=e.c}return Qe(t,e),t.prototype[xe]=function(){return new n(this)},n.prototype.next=function(){return 0===this.l?we:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(Ut),$t=Ut.repeat=function(e,t){return new Ht(e,t)},Wt=function(e){function t(e,t,n){this.s=e,this.fn=t?Ce(t,n,3):null}function n(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return Qe(t,e),t.prototype[xe]=function(){return new n(this)},n.prototype.next=function(){return++this.ie?(t.onNext(n[e]),i(e+1)):t.onCompleted()}var t=this.observer,n=this.parent.args,r=n.length;return this.parent.scheduler.scheduleRecursiveWithState(0,e)};var on=Bt.fromArray=function(e,t){return yt(t)||(t=wt),new rn(e,t)};Bt.generate=function(e,t,n,r,i){return yt(i)||(i=wt),new Nn(function(o){var s=!0;return i.scheduleRecursiveWithState(e,function(e,i){var a,u;try{s?s=!1:e=n(e),a=t(e),a&&(u=r(e))}catch(c){return o.onError(c)}a?(o.onNext(u),i(e)):o.onCompleted()})})};var sn=function(e){function t(){e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){return ct},t}(Vt),an=Bt.never=function(){return new sn};Bt.of=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return new rn(t,wt)},Bt.ofWithScheduler=function(e){for(var t=arguments.length,n=new Array(t-1),r=1;t>r;r++)n[r-1]=arguments[r];return new rn(n,e)};var un=function(e){function t(t,n){this.obj=t,this.keys=Object.keys(t),this.scheduler=n,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new k(e,this);return t.run()},t}(Vt);k.prototype.run=function(){function e(e,o){if(i>e){var s=r[e];t.onNext([s,n[s]]),o(e+1)}else t.onCompleted()}var t=this.observer,n=this.parent.obj,r=this.parent.keys,i=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},Bt.pairs=function(e,t){return t||(t=wt),new un(e,t)};var cn=function(e){function t(t,n,r){this.start=t,this.rangeCount=n,this.scheduler=r,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new hn(e,this);return t.run()},t}(Vt),hn=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){function e(e,i){n>e?(r.onNext(t+e),i(e+1)):r.onCompleted()}var t=this.parent.start,n=this.parent.rangeCount,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},e}();Bt.range=function(e,t,n){return yt(n)||(n=wt),new cn(e,t,n)};var ln=function(e){function t(t,n,r){this.value=t,this.repeatCount=null==n?-1:n,this.scheduler=r,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new j(e,this);return t.run()},t}(Vt);j.prototype.run=function(){function e(e,r){return(-1===e||e>0)&&(t.onNext(n),e>0&&e--),0===e?t.onCompleted():void r(e)}var t=this.observer,n=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,e)},Bt.repeat=function(e,t,n){return yt(n)||(n=wt),new ln(e,t,n)};var pn=function(e){function t(t,n){this.value=t,this.scheduler=n,e.call(this)}function n(e,t){this.observer=e,this.parent=t}function r(e,t){var n=t[0],r=t[1];r.onNext(n),r.onCompleted()}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new n(e,this);return t.run()},n.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],r)},t}(Vt),fn=(Bt["return"]=Bt.just=Bt.returnValue=function(e,t){return yt(t)||(t=xt),new pn(e,t)},function(e){function t(t,n){this.error=t,this.scheduler=n,e.call(this)}function n(e,t){this.o=e,this.p=t}function r(e,t){var n=t[0],r=t[1];r.onError(n)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new n(e,this);return t.run()},n.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],r)},t}(Vt)),dn=Bt["throw"]=Bt.throwError=Bt.throwException=function(e,t){return yt(t)||(t=xt),new fn(e,t)};Bt.using=function(e,t){return new Nn(function(n){var r,i,o=ct;try{r=e(),r&&(o=r),i=t(r)}catch(s){return new ot(dn(s).subscribe(n),o)}return new ot(i.subscribe(n),o)})},Nt.amb=function(e){var t=this;return new Nn(function(n){function r(){o||(o=s,c.dispose())}function i(){o||(o=a,u.dispose())}var o,s="L",a="R",u=new pt,c=new pt;return ae(e)&&(e=Yt(e)),u.setDisposable(t.subscribe(function(e){r(),o===s&&n.onNext(e)},function(e){r(),o===s&&n.onError(e)},function(){r(),o===s&&n.onCompleted()})),c.setDisposable(e.subscribe(function(e){i(),o===a&&n.onNext(e)},function(e){i(),o===a&&n.onError(e)},function(){i(),o===a&&n.onCompleted()})),new ot(u,c)})},Bt.amb=function(){function e(e,t){return e.amb(t)}var t=an(),n=[];if(Array.isArray(arguments[0]))n=arguments[0];else for(var r=0,i=arguments.length;i>r;r++)n.push(arguments[r]);for(var r=0,i=n.length;i>r;r++)t=e(t,n[r]);return t},Nt["catch"]=Nt.catchError=Nt.catchException=function(e){return"function"==typeof e?F(this,e):mn([this,e])};var mn=Bt.catchError=Bt["catch"]=Bt.catchException=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return qt(e).catchError()};Nt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),vn.apply(this,t)};var vn=Bt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Nn(function(e){function n(t){if(a[t]=!0,u||(u=a.every(ne))){try{var n=r.apply(null,h)}catch(i){return e.onError(i)}e.onNext(n)}else c.filter(function(e,n){return n!==t}).every(ne)&&e.onCompleted()}function i(t){c[t]=!0,c.every(ne)&&e.onCompleted()}for(var o=t.length,s=function(){return!1},a=_(o,s),u=!1,c=_(o,s),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(r){var o=t[r],s=new pt;ae(o)&&(o=Yt(o)),s.setDisposable(o.subscribe(function(e){h[r]=e,n(r)},function(t){e.onError(t)},function(){i(r)})),l[r]=s}(p);return new ot(l)},this)};Nt.concat=function(){for(var e=[],t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return e.unshift(this),yn.apply(null,e)};var gn=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){this.sources=e,this.o=t}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new n(this.sources,e);return t.run()},n.prototype.run=function(){var e,t=new ft,n=this.sources,r=n.length,i=this.o,o=xt.scheduleRecursiveWithState(0,function(o,s){if(!e){if(o===r)return i.onCompleted();var a=n[o];ae(a)&&(a=Yt(a));var u=new pt;t.setDisposable(u),u.setDisposable(a.subscribe(function(e){i.onNext(e)},function(e){i.onError(e)},function(){s(o+1)}))}});return new ot(t,o,ut(function(){e=!0}))},t}(Vt),yn=Bt.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,n=arguments.length;n>t;t++)e[t]=arguments[t]}return new gn(e)};Nt.concatAll=Nt.concatObservable=function(){return this.merge(1)};var _n=function(e){function t(t,n){this.source=t,this.maxConcurrent=n,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new ot;return t.add(this.source.subscribe(new bn(e,this.maxConcurrent,t))),t},t}(Vt),bn=function(){function e(e,t,n){this.o=e,this.max=t,this.g=n,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function t(e,t){this.parent=e,this.sad=t,this.isStopped=!1}return e.prototype.handleSubscribe=function(e){var n=new pt;this.g.add(n),ae(e)&&(e=Yt(e)),n.setDisposable(e.subscribe(new t(this,n)))},e.prototype.onNext=function(e){this.isStopped||(this.activeCount0?e.handleSubscribe(e.q.shift()):(e.activeCount--,e.done&&0===e.activeCount&&e.o.onCompleted())}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();Nt.merge=function(e){return"number"!=typeof e?xn(this,e):new _n(this,e)};var xn=Bt.merge=function(){var e,t,n=[],r=arguments.length;if(arguments[0])if(yt(arguments[0]))for(e=arguments[0],t=1;r>t;t++)n.push(arguments[t]);else for(e=xt,t=0;r>t;t++)n.push(arguments[t]);else for(e=xt,t=1;r>t;t++)n.push(arguments[t]);return Array.isArray(n[0])&&(n=n[0]),I(e,n).mergeAll()},wn=ee.CompositeError=function(e){this.name="NotImplementedError",this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};wn.prototype=Error.prototype,Bt.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}var r=I(null,e);return new Nn(function(e){function t(){0===s.length?e.onCompleted():1===s.length?e.onError(s[0]):e.onError(new wn(s))}var n=new ot,i=new pt,o=!1,s=[];return n.add(i),i.setDisposable(r.subscribe(function(r){var i=new pt;n.add(i),ae(r)&&(r=Yt(r)),i.setDisposable(r.subscribe(function(t){e.onNext(t)},function(e){s.push(e),n.remove(i),o&&1===n.length&&t()},function(){n.remove(i),o&&1===n.length&&t()}))},function(e){s.push(e),o=!0,1===n.length&&t()},function(){o=!0,1===n.length&&t()})),n})};var Sn=function(e){function t(t){this.source=t,e.call(this)}function n(e,t){this.o=e,this.g=t,this.isStopped=!1,this.done=!1}function r(e,t,n){this.parent=e,this.g=t,this.sad=n,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new ot,r=new pt;return t.add(r),r.setDisposable(this.source.subscribe(new n(e,t))),t},n.prototype.onNext=function(e){if(!this.isStopped){var t=new pt;this.g.add(t),ae(e)&&(e=Yt(e)),t.setDisposable(e.subscribe(new r(this,this.g,t)))}},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},r.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},r.prototype.onCompleted=function(){if(!this.isStopped){var e=this.parent;this.isStopped=!0,e.g.remove(this.sad),e.done&&1===e.g.length&&e.o.onCompleted()}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},t}(Vt);Nt.mergeAll=Nt.mergeObservable=function(){return new Sn(this)},Nt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return Mn([this,e])};var Mn=Bt.onErrorResumeNext=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return new Nn(function(t){var n=0,r=new ft,i=xt.scheduleRecursive(function(i){var o,s;nn;n++)t[n]=arguments[n];var r=t.pop(),i=this;return Array.isArray(t[0])&&(t=t[0]),new Nn(function(e){for(var n=t.length,o=_(n,B),s=!1,a=new Array(n),u=new Array(n+1),c=0;n>c;c++)!function(n){var r=t[n],i=new pt;ae(r)&&(r=Yt(r)),i.setDisposable(r.subscribe(function(e){a[n]=e,o[n]=!0,s=o.every(ne)},function(t){e.onError(t)},te)),u[n]=i}(c);var h=new pt;return h.setDisposable(i.subscribe(function(t){var n=[t].concat(a);if(s){var i=x(r).apply(null,n);return i===nt?e.onError(i.e):void e.onNext(i)}},function(t){e.onError(t)},function(){e.onCompleted()})),u[n]=h,new ot(u)},this)},Nt.zip=function(){if(Array.isArray(arguments[0]))return V.apply(this,arguments);for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t.pop();return t.unshift(r),new Nn(function(e){for(var n=t.length,o=_(n,U),s=_(n,B),a=new Array(n),u=0;n>u;u++)!function(n){var u=t[n],c=new pt;ae(u)&&(u=Yt(u)),c.setDisposable(u.subscribe(function(t){if(o[n].push(t),o.every(function(e){return e.length>0})){var a=o.map(function(e){return e.shift()}),u=x(i).apply(r,a);if(u===nt)return e.onError(u.e);e.onNext(u)}else s.filter(function(e,t){return t!==n}).every(ne)&&e.onCompleted()},function(t){e.onError(t)},function(){s[n]=!0,s.every(ne)&&e.onCompleted()})),a[n]=c}(u);return new ot(a)},r)},Bt.zip=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=t.shift();return r.zip.apply(r,t)},Bt.zipArray=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new Nn(function(t){for(var n=e.length,r=_(n,G),i=_(n,B),o=new Array(n),s=0;n>s;s++)!function(n){o[n]=new pt,o[n].setDisposable(e[n].subscribe(function(e){if(r[n].push(e),r.every(function(e){return e.length>0})){var o=r.map(function(e){return e.shift()});t.onNext(o)}else if(i.filter(function(e,t){return t!==n}).every(ne))return t.onCompleted()},function(e){t.onError(e)},function(){i[n]=!0,i.every(ne)&&t.onCompleted()}))}(s);return new ot(o)})},Nt.asObservable=function(){var e=this;return new Nn(function(t){return e.subscribe(t)},e)},Nt.bufferWithCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).selectMany(function(e){return e.toArray()}).where(function(e){return e.length>0})},Nt.dematerialize=function(){var e=this;return new Nn(function(t){return e.subscribe(function(e){return e.accept(t)},function(e){t.onError(e)},function(){t.onCompleted()})},this)},Nt.distinctUntilChanged=function(e,t){var n=this;return t||(t=ie),new Nn(function(r){var i,o=!1;return n.subscribe(function(n){var s=n;if(e&&(s=x(e)(n),s===nt))return r.onError(s.e);if(o){var a=x(t)(i,s);if(a===nt)return r.onError(a.e)}o&&a||(o=!0,i=s,r.onNext(n))},function(e){r.onError(e)},function(){r.onCompleted()})},this)};var Tn=function(e){function t(t,n,r,i){this.source=t,this.t=!n||ue(n)?Rt(n||te,r||te,i||te):n,e.call(this)}function n(e,t){this.o=e,this.t=t,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.t))},n.prototype.onNext=function(e){if(!this.isStopped){var t=x(this.t.onNext).call(this.t,e);t===nt&&this.o.onError(t.e),this.o.onNext(e)}},n.prototype.onError=function(e){if(!this.isStopped){this.isStopped=!0;var t=x(this.t.onError).call(this.t,e);if(t===nt)return this.o.onError(t.e);this.o.onError(e)}},n.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=x(this.t.onCompleted).call(this.t);if(e===nt)return this.o.onError(e.e);this.o.onCompleted()}},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt["do"]=Nt.tap=Nt.doAction=function(e,t,n){return new Tn(this,e,t,n)},Nt.doOnNext=Nt.tapOnNext=function(e,t){return this.tap("undefined"!=typeof t?function(n){e.call(t,n)}:e)},Nt.doOnError=Nt.tapOnError=function(e,t){return this.tap(te,"undefined"!=typeof t?function(n){e.call(t,n)}:e)},Nt.doOnCompleted=Nt.tapOnCompleted=function(e,t){return this.tap(te,null,"undefined"!=typeof t?function(){e.call(t)}:e)},Nt["finally"]=Nt.ensure=function(e){var t=this;return new Nn(function(n){var r;try{r=t.subscribe(n)}catch(i){throw e(),i}return ut(function(){try{r.dispose()}catch(t){throw t}finally{e()}})},this)},Nt.finallyAction=function(e){return this.ensure(e)};var An=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},n.prototype.onNext=te,n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},t}(Vt);Nt.ignoreElements=function(){return new An(this)},Nt.materialize=function(){var e=this;return new Nn(function(t){return e.subscribe(function(e){t.onNext(At(e))},function(e){t.onNext(Pt(e)),t.onCompleted()},function(){t.onNext(Ot()),t.onCompleted()})},e)},Nt.repeat=function(e){return $t(this,e).concat()},Nt.retry=function(e){return $t(this,e).catchError()},Nt.retryWhen=function(e){return $t(this).catchErrorWhen(e)};var Pn=function(e){function t(t,n,r,i){this.source=t,this.accumulator=n,this.hasSeed=r,this.seed=i,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new z(e,this))},t}(Vt);z.prototype.onNext=function(e){if(!this.isStopped){!this.hasValue&&(this.hasValue=!0);try{this.hasAccumulation?this.accumulation=this.accumulator(this.accumulation,e):(this.accumulation=this.hasSeed?this.accumulator(this.seed,e):e,this.hasAccumulation=!0)}catch(t){return this.observer.onError(t)}this.observer.onNext(this.accumulation)}},z.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},z.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},z.prototype.dispose=function(){this.isStopped=!0},z.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},Nt.scan=function(){var e,t,n=!1;return 2===arguments.length?(n=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new Pn(this,t,n,e)},Nt.skipLast=function(e){if(0>e)throw new ve;var t=this;return new Nn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&n.onNext(r.shift())},function(e){n.onError(e)},function(){n.onCompleted()})},t)},Nt.startWith=function(){var e,t=0;arguments.length&&yt(arguments[0])?(e=arguments[0],t=1):e=xt;for(var n=[],r=t,i=arguments.length;i>r;r++)n.push(arguments[r]);return qt([on(n,e),this]).concat()},Nt.takeLast=function(e){if(0>e)throw new ve;var t=this;return new Nn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},function(e){n.onError(e)},function(){for(;r.length>0;)n.onNext(r.shift());n.onCompleted()})},t)},Nt.takeLastBuffer=function(e){var t=this;return new Nn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},function(e){n.onError(e)},function(){n.onNext(r),n.onCompleted()})},t)},Nt.windowWithCount=function(e,t){var n=this;if(+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new ve;if(null==t&&(t=e),+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new ve;return new Nn(function(r){function i(){var e=new kn;u.push(e),r.onNext(tt(e,s))}var o=new pt,s=new dt(o),a=0,u=[];return i(),o.setDisposable(n.subscribe(function(n){for(var r=0,o=u.length;o>r;r++)u[r].onNext(n);var s=a-e+1;s>=0&&s%t===0&&u.shift().onCompleted(),++a%t===0&&i()},function(e){for(;u.length>0;)u.shift().onError(e);r.onError(e)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),s},n)},Nt.selectConcat=Nt.concatMap=function(e,t,n){return ue(e)&&ue(t)?this.concatMap(function(n,r){var i=e(n,r);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i.map(function(e,i){return t(n,e,r,i)})}):ue(e)?H(this,e,n):H(this,function(){return e})},Nt.concatMapObserver=Nt.selectConcatObserver=function(e,t,n,r){var i=this,o=Ce(e,r,2),s=Ce(t,r,1),a=Ce(n,r,0);return new Nn(function(e){var t=0;return i.subscribe(function(n){var r;try{r=o(n,t++)}catch(i){return void e.onError(i)}ae(r)&&(r=Yt(r)),e.onNext(r)},function(t){var n;try{n=s(t)}catch(r){return void e.onError(r)}ae(n)&&(n=Yt(n)),e.onNext(n),e.onCompleted()},function(){var t;try{t=a()}catch(n){return void e.onError(n)}ae(t)&&(t=Yt(t)),e.onNext(t),e.onCompleted()})},this).concatAll()},Nt.defaultIfEmpty=function(e){var t=this;return e===o&&(e=null),new Nn(function(n){var r=!1;return t.subscribe(function(e){r=!0,n.onNext(e)},function(e){n.onError(e)},function(){!r&&n.onNext(e),n.onCompleted()})},t)},W.prototype.push=function(e){var t=-1===$(this.set,e,this.comparer);return t&&this.set.push(e),t},Nt.distinct=function(e,t){var n=this;return t||(t=ie),new Nn(function(r){var i=new W(t);return n.subscribe(function(t){var n=t;if(e)try{n=e(t)}catch(o){return void r.onError(o)}i.push(n)&&r.onNext(t)},function(e){r.onError(e)},function(){r.onCompleted()})},this)};var On=function(e){function t(t,n,r){this.source=t,this.selector=Ce(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return e.call(this,t.selector(n,r,i),r,i)}}function r(e,t,n){this.o=e,this.selector=t,this.source=n,this.i=0,this.isStopped=!1}return Qe(t,e),t.prototype.internalMap=function(e,r){return new t(this.source,n(e,this),r)},t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.selector,this))},r.prototype.onNext=function(e){if(!this.isStopped){var t=x(this.selector)(e,this.i++,this.source);return t===nt?this.o.onError(t.e):void this.o.onNext(t)}},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.map=Nt.select=function(e,t){var n="function"==typeof e?e:function(){return e};return this instanceof On?this.internalMap(n,t):new On(this,n,t)},Nt.pluck=function(){var e=arguments,t=arguments.length;if(0===t)throw new Error("List of properties cannot be empty.");return this.map(function(n){for(var r=n,i=0;t>i;i++){var s=r[e[i]];if("undefined"==typeof s)return o;r=s}return r})},Nt.flatMapObserver=Nt.selectManyObserver=function(e,t,n,r){var i=this;return new Nn(function(o){var s=0;return i.subscribe(function(t){var n;try{n=e.call(r,t,s++)}catch(i){return void o.onError(i)}ae(n)&&(n=Yt(n)),o.onNext(n)},function(e){var n;try{n=t.call(r,e)}catch(i){return void o.onError(i)}ae(n)&&(n=Yt(n)),o.onNext(n),o.onCompleted()},function(){var e;try{e=n.call(r)}catch(t){return void o.onError(t)}ae(e)&&(e=Yt(e)),o.onNext(e),o.onCompleted()})},i).mergeAll()},Nt.selectMany=Nt.flatMap=function(e,t,n){return ue(e)&&ue(t)?this.flatMap(function(n,r){var i=e(n,r);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i.map(function(e,i){return t(n,e,r,i)})},n):ue(e)?q(this,e,n):q(this,function(){return e})},Nt.selectSwitch=Nt.flatMapLatest=Nt.switchMap=function(e,t){return this.select(e,t).switchLatest()};var Ln=function(e){function t(t,n){this.source=t,this.skipCount=n,e.call(this)}function n(e,t){this.c=t,this.r=t,this.o=e,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.skipCount))},n.prototype.onNext=function(e){this.isStopped||(this.r<=0?this.o.onNext(e):this.r--)},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.skip=function(e){if(0>e)throw new ve;return new Ln(this,e)},Nt.skipWhile=function(e,t){var n=this,r=Ce(e,t,3);return new Nn(function(e){var t=0,i=!1;return n.subscribe(function(o){if(!i)try{i=!r(o,t++,n)}catch(s){return void e.onError(s)}i&&e.onNext(o)},function(t){e.onError(t)},function(){e.onCompleted()})},n)},Nt.take=function(e,t){if(0>e)throw new ve;if(0===e)return Jt(t);var n=this;return new Nn(function(t){var r=e;return n.subscribe(function(e){r-- >0&&(t.onNext(e),0>=r&&t.onCompleted())},function(e){t.onError(e)},function(){t.onCompleted()})},n)},Nt.takeWhile=function(e,t){var n=this,r=Ce(e,t,3);return new Nn(function(e){var t=0,i=!0;return n.subscribe(function(o){if(i){try{i=r(o,t++,n)}catch(s){return void e.onError(s)}i?e.onNext(o):e.onCompleted()}},function(t){e.onError(t)},function(){e.onCompleted()})},n)};var Rn=function(e){function t(t,n,r){this.source=t,this.predicate=Ce(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return t.predicate(n,r,i)&&e.call(this,n,r,i)}}function r(e,t,n){this.o=e,this.predicate=t,this.source=n,this.i=0,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.predicate,this))},t.prototype.internalFilter=function(e,r){return new t(this.source,n(e,this),r)},r.prototype.onNext=function(e){if(!this.isStopped){var t=x(this.predicate)(e,this.i++,this.source);return t===nt?this.o.onError(t.e):void(t&&this.o.onNext(e))}},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.filter=Nt.where=function(e,t){return this instanceof Rn?this.internalFilter(e,t):new Rn(this,e,t)},Nt.transduce=function(e){function t(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}var n=this;return new Nn(function(r){var i=e(t(r));return n.subscribe(function(e){try{i["@@transducer/step"](r,e)}catch(t){r.onError(t)}},function(e){r.onError(e)},function(){i["@@transducer/result"](r)})},n)};var Nn=ee.AnonymousObservable=function(e){function t(e){return e&&ue(e.dispose)?e:ue(e)?ut(e):ct}function n(e,n){var r=n[0],i=n[1],o=x(i)(r);return o!==nt||r.fail(nt.e)?void r.setDisposable(t(o)):w(nt.e)}function r(t,r){function i(e){var r=new Dn(e),i=[r,t];return wt.scheduleRequired()?wt.scheduleWithState(i,n):n(null,i),r}this.source=r,e.call(this,i)}return Qe(r,e),r}(Bt),Dn=function(e){function t(t){e.call(this),this.observer=t,this.m=new pt}Qe(t,e);var n=t.prototype;return n.next=function(e){var t=x(this.observer.onNext).call(this.observer,e);t===nt&&(this.dispose(),w(t.e))},n.error=function(e){var t=x(this.observer.onError).call(this.observer,e);this.dispose(),t===nt&&w(t.e)},n.completed=function(){var e=x(this.observer.onCompleted).call(this.observer);this.dispose(),e===nt&&w(e.e)},n.setDisposable=function(e){this.m.setDisposable(e)},n.getDisposable=function(){return this.m.getDisposable()},n.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}(Dt),In=function(e,t){this.subject=e,this.observer=t};In.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var e=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(e,1),this.observer=null}};var kn=ee.Subject=function(e){function t(e){return lt(this),this.isStopped?this.hasError?(e.onError(this.error),ct):(e.onCompleted(),ct):(this.observers.push(e),new In(this,e))}function n(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Qe(n,e),et(n.prototype,Lt.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(lt(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=a(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(lt(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(lt(this),!this.isStopped)for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(e,t){return new jn(e,t)},n}(Bt),jn=(ee.AsyncSubject=function(e){function t(e){return lt(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),ct):(this.observers.push(e),new In(this,e))}function n(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Qe(n,e),et(n.prototype,Lt,{hasObservers:function(){return lt(this),this.observers.length>0},onCompleted:function(){var e,t;if(lt(this),!this.isStopped){this.isStopped=!0;var n=a(this.observers),t=n.length;if(this.hasValue)for(e=0;t>e;e++){var r=n[e];r.onNext(this.value),r.onCompleted()}else for(e=0;t>e;e++)n[e].onCompleted();this.observers.length=0}},onError:function(e){if(lt(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){lt(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Bt),ee.AnonymousSubject=function(e){function t(e){return this.observable.subscribe(e)}function n(n,r){this.observer=n,this.observable=r,e.call(this,t)}return Qe(n,e),et(n.prototype,Lt.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),n}(Bt));"function"==typeof e&&"object"==typeof e.amd&&e.amd?(Y.Rx=ee,e(function(){return ee})):K&&Z?J?(Z.exports=ee).Rx=ee:K.Rx=ee:Y.Rx=ee;var Fn=p()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:6}],157:[function(e,t,n){(function(n){var r="undefined"!=typeof n?n:"undefined"!=typeof window?window:{},i=e("min-document");if("undefined"!=typeof document)t.exports=document;else{var o=r["__GLOBAL_DOCUMENT_CACHE@4"];o||(o=r["__GLOBAL_DOCUMENT_CACHE@4"]=i),t.exports=o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":4}],158:[function(e,t,n){var r=e("./lib");t.exports={Graph:r.Graph,json:e("./lib/json"),alg:e("./lib/alg"),version:r.version}},{"./lib":174,"./lib/alg":165,"./lib/json":175}],159:[function(e,t,n){function r(e){function t(o){i.has(r,o)||(r[o]=!0,n.push(o),i.each(e.successors(o),t),i.each(e.predecessors(o),t))}var n,r={},o=[];return i.each(e.nodes(),function(e){n=[],t(e),n.length&&o.push(n)}),o}var i=e("../lodash");t.exports=r},{"../lodash":176}],160:[function(e,t,n){function r(e,t,n){o.isArray(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),s=[],a={};return o.each(t,function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);i(e,t,"post"===n,a,r,s)}),s}function i(e,t,n,r,s,a){o.has(r,t)||(r[t]=!0,n||a.push(t),o.each(s(t),function(t){i(e,t,n,r,s,a)}),n&&a.push(t))}var o=e("../lodash");t.exports=r},{"../lodash":176}],161:[function(e,t,n){function r(e,t,n){return o.transform(e.nodes(),function(r,o){r[o]=i(e,o,t,n)},{})}var i=e("./dijkstra"),o=e("../lodash");t.exports=r},{"../lodash":176,"./dijkstra":162}],162:[function(e,t,n){function r(e,t,n,r){return i(e,String(t),n||a,r||function(t){return e.outEdges(t)})}function i(e,t,n,r){var i,o,a={},u=new s,c=function(e){var t=e.v!==i?e.v:e.w,r=a[t],s=n(e),c=o.distance+s;if(0>s)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+s);c0&&(i=u.removeMin(),o=a[i],o.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(c);return a}var o=e("../lodash"),s=e("../data/priority-queue");t.exports=r;var a=o.constant(1)},{"../data/priority-queue":172,"../lodash":176}],163:[function(e,t,n){function r(e){return i.filter(o(e),function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}var i=e("../lodash"),o=e("./tarjan");t.exports=r},{"../lodash":176,"./tarjan":170}],164:[function(e,t,n){function r(e,t,n){return i(e,t||s,n||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:Number.POSITIVE_INFINITY})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,o=t(n);r[e][i]={distance:o,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[e],i=t[n],s=o[n],a=r.distance+i.distance;ao&&(u[n]=r,c.decrease(n,o))}}var r,a=new o,u={},c=new s;if(0===e.nodeCount())return a;i.each(e.nodes(),function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)}),c.decrease(e.nodes()[0],0);for(var h=!1;c.size()>0;){if(r=c.removeMin(),i.has(u,r))a.setEdge(r,u[r]);else{if(h)throw new Error("Input graph is not connected: "+e);h=!0}e.nodeEdges(r).forEach(n)}return a}var i=e("../lodash"),o=e("../graph"),s=e("../data/priority-queue");t.exports=r},{"../data/priority-queue":172,"../graph":173,"../lodash":176}],170:[function(e,t,n){function r(e){function t(a){var u=o[a]={onStack:!0,lowlink:n,index:n++};if(r.push(a),e.successors(a).forEach(function(e){i.has(o,e)?o[e].onStack&&(u.lowlink=Math.min(u.lowlink,o[e].index)):(t(e),u.lowlink=Math.min(u.lowlink,o[e].lowlink))}),u.lowlink===u.index){var c,h=[];do c=r.pop(),o[c].onStack=!1,h.push(c);while(a!==c);s.push(h)}}var n=0,r=[],o={},s=[];return e.nodes().forEach(function(e){i.has(o,e)||t(e)}),s}var i=e("../lodash");t.exports=r},{"../lodash":176}],171:[function(e,t,n){function r(e){function t(a){if(o.has(r,a))throw new i;o.has(n,a)||(r[a]=!0,n[a]=!0,o.each(e.predecessors(a),t),delete r[a],s.push(a))}var n={},r={},s=[];if(o.each(e.sinks(),t),o.size(n)!==e.nodeCount())throw new i;return s}function i(){}var o=e("../lodash");t.exports=r,r.CycleException=i},{"../lodash":176}],172:[function(e,t,n){function r(){this._arr=[],this._keyIndices={}}var i=e("../lodash");t.exports=r,r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(e){return e.key})},r.prototype.has=function(e){return i.has(this._keyIndices,e)},r.prototype.priority=function(e){var t=this._keyIndices[e];return void 0!==t?this._arr[t].priority:void 0},r.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(e,t){var n=this._keyIndices;if(e=String(e),!i.has(n,e)){var r=this._arr,o=r.length;return n[e]=o,r.push({key:e,priority:t}),this._decrease(o),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},r.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)},r.prototype._heapify=function(e){var t=this._arr,n=2*e,r=n+1,i=e;n>1,!(n[t].priorityo){var s=i;i=o,o=s}return i+p+o+p+(c.isUndefined(r)?h:r)}function a(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var s=i;i=o,o=s}var a={v:i,w:o};return r&&(a.name=r),a}function u(e,t){return s(e,t.v,t.w,t.name)}var c=e("./lodash");t.exports=r;var h="\x00",l="\x00",p="";r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(e){return this._label=e,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(e){return c.isFunction(e)||(e=c.constant(e)),this._defaultNodeLabelFn=e,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return c.keys(this._nodes)},r.prototype.sources=function(){return c.filter(this.nodes(),function(e){return c.isEmpty(this._in[e])},this)},r.prototype.sinks=function(){return c.filter(this.nodes(),function(e){return c.isEmpty(this._out[e])},this)},r.prototype.setNodes=function(e,t){var n=arguments;return c.each(e,function(e){n.length>1?this.setNode(e,t):this.setNode(e)},this),this},r.prototype.setNode=function(e,t){return c.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=l,this._children[e]={},this._children[l][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},r.prototype.node=function(e){return this._nodes[e]},r.prototype.hasNode=function(e){return c.has(this._nodes,e)},r.prototype.removeNode=function(e){var t=this;if(c.has(this._nodes,e)){var n=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],c.each(this.children(e),function(e){this.setParent(e)},this),delete this._children[e]),c.each(c.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],c.each(c.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},r.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(c.isUndefined(t))t=l;else{t+="";for(var n=t;!c.isUndefined(n);n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},r.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},r.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==l)return t}},r.prototype.children=function(e){if(c.isUndefined(e)&&(e=l),this._isCompound){var t=this._children[e];if(t)return c.keys(t)}else{if(e===l)return this.nodes();if(this.hasNode(e))return[]}},r.prototype.predecessors=function(e){var t=this._preds[e];return t?c.keys(t):void 0},r.prototype.successors=function(e){var t=this._sucs[e];return t?c.keys(t):void 0},r.prototype.neighbors=function(e){var t=this.predecessors(e);return t?c.union(t,this.successors(e)):void 0},r.prototype.filterNodes=function(e){function t(e){var o=r.parent(e);return void 0===o||n.hasNode(o)?(i[e]=o,o):o in i?i[o]:t(o)}var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),c.each(this._nodes,function(t,r){e(r)&&n.setNode(r,t)},this),c.each(this._edgeObjs,function(e){n.hasNode(e.v)&&n.hasNode(e.w)&&n.setEdge(e,this.edge(e))},this);var r=this,i={};return this._isCompound&&c.each(n.nodes(),function(e){n.setParent(e,t(e))}),n},r.prototype.setDefaultEdgeLabel=function(e){return c.isFunction(e)||(e=c.constant(e)),this._defaultEdgeLabelFn=e,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return c.values(this._edgeObjs)},r.prototype.setPath=function(e,t){var n=this,r=arguments;return c.reduce(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this},r.prototype.setEdge=function(){var e,t,n,r,o=!1,u=arguments[0];"object"==typeof u&&null!==u&&"v"in u?(e=u.v,t=u.w,n=u.name,2===arguments.length&&(r=arguments[1],o=!0)):(e=u,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],o=!0)),e=""+e,t=""+t,c.isUndefined(n)||(n=""+n);var h=s(this._isDirected,e,t,n);if(c.has(this._edgeLabels,h))return o&&(this._edgeLabels[h]=r),this;if(!c.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[h]=o?r:this._defaultEdgeLabelFn(e,t,n);var l=a(this._isDirected,e,t,n);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[h]=l,i(this._preds[t],e),i(this._sucs[e],t),this._in[t][h]=l,this._out[e][h]=l,this._edgeCount++,this},r.prototype.edge=function(e,t,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,e,t,n);return this._edgeLabels[r]},r.prototype.hasEdge=function(e,t,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,e,t,n);return c.has(this._edgeLabels,r)},r.prototype.removeEdge=function(e,t,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},r.prototype.inEdges=function(e,t){var n=this._in[e];if(n){var r=c.values(n);return t?c.filter(r,function(e){return e.v===t}):r}},r.prototype.outEdges=function(e,t){var n=this._out[e];if(n){var r=c.values(n);return t?c.filter(r,function(e){return e.w===t}):r}},r.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);return n?n.concat(this.outEdges(e,t)):void 0}},{"./lodash":176}],174:[function(e,t,n){t.exports={Graph:e("./graph"),version:e("./version")}},{"./graph":173,"./version":177}],175:[function(e,t,n){function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:o(e)};return a.isUndefined(e.graph())||(t.value=a.clone(e.graph())),t}function i(e){return a.map(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),i={v:t};return a.isUndefined(n)||(i.value=n),a.isUndefined(r)||(i.parent=r),i})}function o(e){return a.map(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return a.isUndefined(t.name)||(r.name=t.name),a.isUndefined(n)||(r.value=n),r})}function s(e){var t=new u(e.options).setGraph(e.value);return a.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),a.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var a=e("./lodash"),u=e("./graph");t.exports={write:r,read:s}},{"./graph":173,"./lodash":176}],176:[function(e,t,n){var r;if("function"==typeof e)try{r=e("lodash")}catch(i){}r||(r=window._),t.exports=r},{lodash:184}],177:[function(e,t,n){t.exports="2.1.0"},{}],178:[function(e,t,n){n.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,h=-7,l=n?i-1:0,p=n?-1:1,f=e[t+l];for(l+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+e[t+l],l+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+e[t+l],l+=p,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,d=r?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?p/u:p*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(s=s<0;e[n+f]=255&s,f+=d,s/=256,c-=8);e[n+f-d]|=128*m}},{}],179:[function(e,t,n){(function(e){"use strict";function n(e,t){return e in r?r[e]:(r[e]=t,t)}var r="undefined"!=typeof window?window:"undefined"!=typeof e?e:{};t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],180:[function(e,t,n){"use strict";function r(e,t,n){var r="__INDIVIDUAL_ONE_VERSION_"+e,o=r+"_ENFORCE_SINGLETON",s=i(o,t);if(s!==t)throw new Error("Can only have one copy of "+e+".\nYou already have version "+s+" installed.\nThis means you cannot install version "+t);return i(r,n)}var i=e("./index.js");t.exports=r},{"./index.js":179}],181:[function(e,t,n){"use strict";t.exports=function(e){return"object"==typeof e&&null!==e}},{}],182:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],183:[function(t,n,r){"use strict";var i={};i.base32="0123456789bcdefghjkmnpqrstuvwxyz",i.encode=function(e,t,n){if("undefined"==typeof n){for(var r=1;12>=r;r++){var o=i.encode(e,t,r),s=i.decode(o);if(s.lat==e&&s.lon==t)return o}n=12}if(e=Number(e),t=Number(t),n=Number(n),isNaN(e)||isNaN(t)||isNaN(n))throw new Error("Invalid geohash");for(var a=0,u=0,c=!0,h="",l=-90,p=90,f=-180,d=180;h.lengthm?(a=2*a+1,f=m):(a=2*a,d=m)}else{var v=(l+p)/2;e>v?(a=2*a+1,l=v):(a=2*a,p=v)}c=!c,5==++u&&(h+=i.base32.charAt(a),u=0,a=0)}return h},i.decode=function(e){var t=i.bounds(e),n=t.sw.lat,r=t.sw.lon,o=t.ne.lat,s=t.ne.lon,a=(n+o)/2,u=(r+s)/2;return a=a.toFixed(Math.floor(2-Math.log(o-n)/Math.LN10)),u=u.toFixed(Math.floor(2-Math.log(s-r)/Math.LN10)),{lat:Number(a),lon:Number(u)}},i.bounds=function(e){if(0===e.length)throw new Error("Invalid geohash");e=e.toLowerCase();for(var t=!0,n=-90,r=90,o=-180,s=180,a=0;a=0;h--){var l=c>>h&1;if(t){var p=(o+s)/2;1==l?o=p:s=p}else{var f=(n+r)/2;1==l?n=f:r=f}t=!t}}var d={sw:{lat:n,lon:o},ne:{lat:r,lon:s}};return d},i.adjacent=function(e,t){if(e=e.toLowerCase(),t=t.toLowerCase(),0===e.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(t))throw new Error("Invalid direction");var n={n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]},r={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]},o=e.slice(-1),s=e.slice(0,-1),a=e.length%2;return-1!=r[t][a].indexOf(o)&&""!==s&&(s=i.adjacent(s,t)),s+i.base32.charAt(n[t][a].indexOf(o))},i.neighbours=function(e){return{n:i.adjacent(e,"n"),ne:i.adjacent(i.adjacent(e,"n"),"e"),e:i.adjacent(e,"e"),se:i.adjacent(i.adjacent(e,"s"),"e"),s:i.adjacent(e,"s"),sw:i.adjacent(i.adjacent(e,"s"),"w"),w:i.adjacent(e,"w"),nw:i.adjacent(i.adjacent(e,"n"),"w")}},"undefined"!=typeof n&&n.exports&&(n.exports=i),"function"==typeof e&&e.amd&&e([],function(){return i})},{}],184:[function(t,n,r){(function(t){(function(){function i(e,t){if(e!==t){var n=null===e,r=e===C,i=e===e,o=null===t,s=t===C,a=t===t;if(e>t&&!o||!i||n&&!s&&a||r&&a)return 1;if(t>e&&!n||!a||o&&!r&&i||s&&i)return-1}return 0}function o(e,t,n){for(var r=e.length,i=n?r:-1;n?i--:++i-1;);return n}function h(e,t){for(var n=e.length;n--&&t.indexOf(e.charAt(n))>-1;);return n}function l(e,t){return i(e.criteria,t.criteria)||e.index-t.index}function p(e,t,n){for(var r=-1,o=e.criteria,s=t.criteria,a=o.length,u=n.length;++r=u)return c;var h=n[r];return c*("asc"===h||h===!0?1:-1)}}return e.index-t.index}function f(e){return $e[e]}function d(e){return We[e]}function m(e,t,n){return t?e=Ye[e]:n&&(e=Ke[e]),"\\"+e}function v(e){return"\\"+Ke[e]}function g(e,t,n){for(var r=e.length,i=t+(n?0:-1);n?i--:++i=e&&e>=9&&13>=e||32==e||160==e||5760==e||6158==e||e>=8192&&(8202>=e||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function b(e,t){for(var n=-1,r=e.length,i=-1,o=[];++nt,i=n?e.length:0,o=Wn(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=r?a:s-1,h=this.__iteratees__,l=h.length,p=0,f=Ss(u,this.__takeCount__);if(!n||U>i||i==u&&f==u)return nn(r&&n?e.reverse():e,this.__actions__);var d=[];e:for(;u--&&f>p;){c+=t;for(var m=-1,v=e[c];++m=U?mn(t):null,c=t.length;u&&(o=Ze,a=!1,t=u);e:for(;++in&&(n=-n>i?0:i+n),r=r===C||r>i?i:+r||0,0>r&&(r+=i),i=n>r?0:r>>>0,n>>>=0;i>n;)e[n++]=t;return e}function Tt(e,t){var n=[];return ks(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function At(e,t,n,r){var i;return n(e,function(e,n,o){return t(e,n,o)?(i=r?n:e,!1):void 0}),i}function Pt(e,t,n,r){r||(r=[]);for(var i=-1,o=e.length;++ir;)e=e[t[r++]];return r&&r==i?e:C}}function It(e,t,n,r,i,o){return e===t?!0:null==e||null==t||!Di(e)&&!y(t)?e!==e&&t!==t:kt(e,t,It,n,r,i,o)}function kt(e,t,n,r,i,o,s){var a=Pa(e),u=Pa(t),c=q,h=q;a||(c=rs.call(e),c==W?c=ee:c!=ee&&(a=zi(e))),u||(h=rs.call(t),h==W?h=ee:h!=ee&&(u=zi(t)));var l=c==ee,p=h==ee,f=c==h;if(f&&!a&&!l)return Bn(e,t,c);if(!i){var d=l&&ts.call(e,"__wrapped__"),m=p&&ts.call(t,"__wrapped__");if(d||m)return n(d?e.value():e,m?t.value():t,r,i,o,s)}if(!f)return!1;o||(o=[]),s||(s=[]);for(var v=o.length;v--;)if(o[v]==e)return s[v]==t;o.push(e),s.push(t);var g=(a?Fn:Vn)(e,t,n,r,i,o,s);return o.pop(),s.pop(),g}function jt(e,t,n){var r=t.length,i=r,o=!n;if(null==e)return!i;for(e=lr(e);r--;){var s=t[r];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++rt&&(t=-t>i?0:i+t),n=n===C||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Uo(i);++r=U,u=a?mn():null,c=[];u?(r=Ze,o=!1):(a=!1,u=t?[]:c);e:for(;++n=i){for(;i>r;){var o=r+i>>>1,s=e[o];(n?t>=s:t>s)&&null!==s?r=o+1:i=o}return i}return on(e,t,Ao,n)}function on(e,t,n,r){t=n(t);for(var i=0,o=e?e.length:0,s=t!==t,a=null===t,u=t===C;o>i;){var c=ys((i+o)/2),h=n(e[c]),l=h!==C,p=h===h;if(s)var f=p||r;else f=a?p&&l&&(r||null!=h):u?p&&(r||l):null==h?!1:r?t>=h:t>h;f?i=c+1:o=c}return Ss(o,Os)}function sn(e,t,n){if("function"!=typeof e)return Ao;if(t===C)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)};case 5:return function(n,r,i,o,s){return e.call(t,n,r,i,o,s)}}return function(){return e.apply(t,arguments)}}function an(e){var t=new ss(e.byteLength),n=new ds(t);return n.set(new ds(e)),t}function un(e,t,n){for(var r=n.length,i=-1,o=ws(e.length-r,0),s=-1,a=t.length,u=Uo(a+o);++s2?n[i-2]:C,s=i>2?n[2]:C,a=i>1?n[i-1]:C;for("function"==typeof o?(o=sn(o,a,5),i-=2):(o="function"==typeof a?a:C,i-=o?1:0),s&&Qn(n[0],n[1],s)&&(o=3>i?C:o,i=1);++r-1?n[s]:C}return At(n,r,e)}}function wn(e){return function(t,n,r){return t&&t.length?(n=Un(n,r,3),o(t,n,e)):-1}}function Sn(e){return function(t,n,r){return n=Un(n,r,3),At(t,n,e,!0)}}function Mn(e){return function(){for(var t,n=arguments.length,i=e?n:-1,o=0,s=Uo(n);e?i--:++i=U)return t.plant(r).value();for(var i=0,o=n?s[i].apply(this,e):r;++iy){var M=a?et(a):C,E=ws(c-y,0),T=d?S:C,O=d?C:S,L=d?x:C,R=d?C:x;t|=d?N:D,t&=~(d?D:N),m||(t&=~(A|P));var I=[e,t,n,L,T,R,O,M,u,E],k=Rn.apply(C,I);return tr(e)&&zs(k,I),k.placeholder=w,k}}var j=p?n:this,F=f?j[e]:e;return a&&(x=ur(x,a)),l&&u=t||!bs(t))return"";var i=t-r;return n=null==n?" ":n+"",go(n,vs(i/n.length)).slice(0,i)}function Dn(e,t,n,r){function i(){for(var t=-1,a=arguments.length,u=-1,c=r.length,h=Uo(c+a);++uu))return!1;for(;++a-1&&e%1==0&&t>e}function Qn(e,t,n){if(!Di(n))return!1;var r=typeof t;if("number"==r?Zn(n)&&Jn(t,n.length):"string"==r&&t in n){var i=n[t];return e===e?e===i:i!==i}return!1}function er(e,t){var n=typeof e;if("string"==n&&Ce.test(e)||"number"==n)return!0;if(Pa(e))return!1;var r=!Ee.test(e);return r||null!=t&&e in lr(t)}function tr(e){var n=Gn(e);if(!(n in _.prototype))return!1;var r=t[n];if(e===r)return!0;var i=Us(r);return!!i&&e===i[0]}function nr(e){return"number"==typeof e&&e>-1&&e%1==0&&Rs>=e}function rr(e){return e===e&&!Di(e)}function ir(e,t){var n=e[1],r=t[1],i=n|r,o=I>i,s=r==I&&n==L||r==I&&n==k&&e[7].length<=t[8]||r==(I|k)&&n==L;if(!o&&!s)return e;r&A&&(e[2]=t[2],i|=n&A?0:O);var a=t[3];if(a){var u=e[3];e[3]=u?un(u,a,t[4]):et(a),e[4]=u?b(e[3],$):et(t[4])}return a=t[5],a&&(u=e[5],e[5]=u?cn(u,a,t[6]):et(a),e[6]=u?b(e[5],$):et(t[6])),a=t[7],a&&(e[7]=et(a)),r&I&&(e[8]=null==e[8]?t[8]:Ss(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function or(e,t){return e===C?t:Oa(e,t,or)}function sr(e,t){e=lr(e);for(var n=-1,r=t.length,i={};++nr;)s[++o]=Xt(e,r,r+=t);return s}function mr(e){for(var t=-1,n=e?e.length:0,r=-1,i=[];++tt?0:t)):[]}function gr(e,t,n){var r=e?e.length:0;return r?((n?Qn(e,t,n):null==t)&&(t=1),t=r-(+t||0),Xt(e,0,0>t?0:t)):[]}function yr(e,t,n){return e&&e.length?tn(e,Un(t,n,3),!0,!0):[]}function _r(e,t,n){return e&&e.length?tn(e,Un(t,n,3),!0):[]}function br(e,t,n,r){var i=e?e.length:0;return i?(n&&"number"!=typeof n&&Qn(e,t,n)&&(n=0,r=i),Ct(e,t,n,r)):[]}function xr(e){return e?e[0]:C}function wr(e,t,n){var r=e?e.length:0;return n&&Qn(e,t,n)&&(t=!1),r?Pt(e,t):[]}function Sr(e){var t=e?e.length:0;return t?Pt(e,!0):[]}function Mr(e,t,n){var r=e?e.length:0;if(!r)return-1;if("number"==typeof n)n=0>n?ws(r+n,0):n;else if(n){var i=rn(e,t);return r>i&&(t===t?t===e[i]:e[i]!==e[i])?i:-1}return s(e,t,n||0)}function Er(e){return gr(e,1)}function Cr(e){var t=e?e.length:0;return t?e[t-1]:C}function Tr(e,t,n){var r=e?e.length:0;if(!r)return-1;var i=r;if("number"==typeof n)i=(0>n?ws(r+n,0):Ss(n||0,r-1))+1;else if(n){i=rn(e,t,!0)-1;var o=e[i];return(t===t?t===o:o!==o)?i:-1}if(t!==t)return g(e,i,!0);for(;i--;)if(e[i]===t)return i;return-1}function Ar(){var e=arguments,t=e[0];if(!t||!t.length)return t;for(var n=0,r=zn(),i=e.length;++n-1;)fs.call(t,o,1);return t}function Pr(e,t,n){var r=[];if(!e||!e.length)return r;var i=-1,o=[],s=e.length;for(t=Un(t,n,3);++it?0:t)):[]}function Nr(e,t,n){var r=e?e.length:0;return r?((n?Qn(e,t,n):null==t)&&(t=1),t=r-(+t||0),Xt(e,0>t?0:t)):[]}function Dr(e,t,n){return e&&e.length?tn(e,Un(t,n,3),!1,!0):[]}function Ir(e,t,n){return e&&e.length?tn(e,Un(t,n,3)):[]}function kr(e,t,n,r){var i=e?e.length:0;if(!i)return[];null!=t&&"boolean"!=typeof t&&(r=n,n=Qn(e,t,r)?C:t,t=!1);var o=Un();return null==n&&o===bt||(n=o(n,r,3)),t&&zn()==s?x(e,n):Qt(e,n)}function jr(e){if(!e||!e.length)return[];var t=-1,n=0;e=at(e,function(e){return Zn(e)?(n=ws(e.length,n),!0):void 0});for(var r=Uo(n);++tn?ws(i+n,0):n||0,"string"==typeof e||!Pa(e)&&Gi(e)?i>=n&&e.indexOf(t,n)>-1:!!i&&zn(e,t,n)>-1}function ei(e,t,n){var r=Pa(e)?ut:Ft;return t=Un(t,n,3),r(e,t)}function ti(e,t){return ei(e,Do(t))}function ni(e,t,n){var r=Pa(e)?at:Tt;return t=Un(t,n,3),r(e,function(e,n,r){return!t(e,n,r)})}function ri(e,t,n){if(n?Qn(e,t,n):null==t){e=hr(e);var r=e.length;return r>0?e[Wt(0,r-1)]:C}var i=-1,o=qi(e),r=o.length,s=r-1;for(t=Ss(0>t?0:+t||0,r);++i0&&(n=t.apply(this,arguments)),1>=e&&(t=C),n}}function fi(e,t,n){function r(){f&&as(f),c&&as(c),m=0,c=f=d=C}function i(t,n){n&&as(n),c=f=d=C,t&&(m=ma(),h=e.apply(p,u),f||c||(u=p=C))}function o(){var e=t-(ma()-l);0>=e||e>t?i(d,c):f=ps(o,e)}function s(){i(g,f)}function a(){if(u=arguments,l=ma(),p=this,d=g&&(f||!y),v===!1)var n=y&&!f;else{c||y||(m=l);var r=v-(l-m),i=0>=r||r>v;i?(c&&(c=as(c)),m=l,h=e.apply(p,u)):c||(c=ps(s,r))}return i&&f?f=as(f):f||t===v||(f=ps(o,t)),n&&(i=!0,h=e.apply(p,u)),!i||f||c||(u=p=C),h}var u,c,h,l,p,f,d,m=0,v=!1,g=!0;if("function"!=typeof e)throw new Ko(H);if(t=0>t?0:+t||0,n===!0){var y=!0;g=!1}else Di(n)&&(y=!!n.leading,v="maxWait"in n&&ws(+n.maxWait||0,t),g="trailing"in n?!!n.trailing:g);return a.cancel=r,a}function di(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new Ko(H);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new di.Cache,n}function mi(e){if("function"!=typeof e)throw new Ko(H);return function(){return!e.apply(this,arguments)}}function vi(e){return pi(2,e)}function gi(e,t){if("function"!=typeof e)throw new Ko(H);return t=ws(t===C?e.length-1:+t||0,0),function(){for(var n=arguments,r=-1,i=ws(n.length-t,0),o=Uo(i);++rt}function Mi(e,t){return e>=t}function Ei(e){return y(e)&&Zn(e)&&ts.call(e,"callee")&&!hs.call(e,"callee")}function Ci(e){return e===!0||e===!1||y(e)&&rs.call(e)==X}function Ti(e){return y(e)&&rs.call(e)==Y}function Ai(e){return!!e&&1===e.nodeType&&y(e)&&!Vi(e)}function Pi(e){return null==e?!0:Zn(e)&&(Pa(e)||Gi(e)||Ei(e)||y(e)&&Ni(e.splice))?!e.length:!Va(e).length}function Oi(e,t,n,r){n="function"==typeof n?sn(n,r,3):C;var i=n?n(e,t):C;return i===C?It(e,t,n):!!i}function Li(e){return y(e)&&"string"==typeof e.message&&rs.call(e)==K}function Ri(e){return"number"==typeof e&&bs(e)}function Ni(e){return Di(e)&&rs.call(e)==Z}function Di(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ii(e,t,n,r){return n="function"==typeof n?sn(n,r,3):C,jt(e,Hn(t),n)}function ki(e){return Bi(e)&&e!=+e}function ji(e){return null==e?!1:Ni(e)?os.test(es.call(e)):y(e)&&Ie.test(e)}function Fi(e){return null===e}function Bi(e){return"number"==typeof e||y(e)&&rs.call(e)==Q}function Vi(e){var t;if(!y(e)||rs.call(e)!=ee||Ei(e)||!ts.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var n;return Ot(e,function(e,t){n=t}),n===C||ts.call(e,n)}function Ui(e){return Di(e)&&rs.call(e)==te}function Gi(e){return"string"==typeof e||y(e)&&rs.call(e)==re}function zi(e){return y(e)&&nr(e.length)&&!!ze[rs.call(e)]}function Hi(e){return e===C}function $i(e,t){return t>e}function Wi(e,t){return t>=e}function qi(e){var t=e?Gs(e):0;return nr(t)?t?et(e):[]:oo(e)}function Xi(e){return _t(e,eo(e))}function Yi(e,t,n){var r=Is(e);return n&&Qn(e,t,n)&&(t=C),t?gt(r,t):r}function Ki(e){return Nt(e,eo(e))}function Zi(e,t,n){var r=null==e?C:Dt(e,pr(t),t+"");return r===C?n:r}function Ji(e,t){if(null==e)return!1;var n=ts.call(e,t);if(!n&&!er(t)){if(t=pr(t),e=1==t.length?e:Dt(e,Xt(t,0,-1)),null==e)return!1;t=Cr(t),n=ts.call(e,t)}return n||nr(e.length)&&Jn(t,e.length)&&(Pa(e)||Ei(e))}function Qi(e,t,n){n&&Qn(e,t,n)&&(t=C);for(var r=-1,i=Va(e),o=i.length,s={};++r0;++r=Ss(t,n)&&en?0:+n||0,r),n-=t.length,n>=0&&e.indexOf(t,n)==n}function po(e){return e=u(e),e&&xe.test(e)?e.replace(_e,d):e}function fo(e){return e=u(e),e&&Pe.test(e)?e.replace(Ae,m):e||"(?:)"}function mo(e,t,n){e=u(e),t=+t;var r=e.length;if(r>=t||!bs(t))return e;var i=(t-r)/2,o=ys(i),s=vs(i);return n=Nn("",s,n),n.slice(0,o)+e+n}function vo(e,t,n){return(n?Qn(e,t,n):null==t)?t=0:t&&(t=+t),e=bo(e),Es(e,t||(De.test(e)?16:10))}function go(e,t){var n="";if(e=u(e),t=+t,1>t||!e||!bs(t))return n;do t%2&&(n+=e),t=ys(t/2),e+=e;while(t);return n}function yo(e,t,n){return e=u(e),n=null==n?0:Ss(0>n?0:+n||0,e.length),e.lastIndexOf(t,n)==n}function _o(e,n,r){var i=t.templateSettings;r&&Qn(e,n,r)&&(n=r=C),e=u(e),n=vt(gt({},r||n),i,mt);var o,s,a=vt(gt({},n.imports),i.imports,mt),c=Va(a),h=en(a,c),l=0,p=n.interpolate||Fe,f="__p += '",d=Xo((n.escape||Fe).source+"|"+p.source+"|"+(p===Me?Re:Fe).source+"|"+(n.evaluate||Fe).source+"|$","g"),m="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++Ge+"]")+"\n";e.replace(d,function(t,n,r,i,a,u){return r||(r=i),f+=e.slice(l,u).replace(Be,v),n&&(o=!0,f+="' +\n__e("+n+") +\n'"),a&&(s=!0,f+="';\n"+a+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+t.length,t}),f+="';\n";var g=n.variable;g||(f="with (obj) {\n"+f+"\n}\n"),f=(s?f.replace(me,""):f).replace(ve,"$1").replace(ge,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var y=Za(function(){return Ho(c,m+"return "+f).apply(C,h)});if(y.source=f,Li(y))throw y;return y}function bo(e,t,n){var r=e;return(e=u(e))?(n?Qn(r,t,n):null==t)?e.slice(w(e),S(e)+1):(t+="",e.slice(c(e,t),h(e,t)+1)):e}function xo(e,t,n){var r=e;return e=u(e),e?(n?Qn(r,t,n):null==t)?e.slice(w(e)):e.slice(c(e,t+"")):e}function wo(e,t,n){var r=e;return e=u(e),e?(n?Qn(r,t,n):null==t)?e.slice(0,S(e)+1):e.slice(0,h(e,t+"")+1):e}function So(e,t,n){n&&Qn(e,t,n)&&(t=C);var r=j,i=F;if(null!=t)if(Di(t)){var o="separator"in t?t.separator:o;r="length"in t?+t.length||0:r,i="omission"in t?u(t.omission):i}else r=+t||0;if(e=u(e),r>=e.length)return e;var s=r-i.length;if(1>s)return i;var a=e.slice(0,s);if(null==o)return a+i;if(Ui(o)){if(e.slice(s).search(o)){var c,h,l=e.slice(0,s);for(o.global||(o=Xo(o.source,(Ne.exec(o)||"")+"g")),o.lastIndex=0;c=o.exec(l);)h=c.index;a=a.slice(0,null==h?s:h)}}else if(e.indexOf(o,s)!=s){var p=a.lastIndexOf(o);p>-1&&(a=a.slice(0,p))}return a+i}function Mo(e){return e=u(e),e&&be.test(e)?e.replace(ye,M):e}function Eo(e,t,n){return n&&Qn(e,t,n)&&(t=C),e=u(e),e.match(t||Ve)||[]}function Co(e,t,n){return n&&Qn(e,t,n)&&(t=C),y(e)?Po(e):bt(e,t)}function To(e){return function(){return e}}function Ao(e){return e}function Po(e){return Bt(xt(e,!0))}function Oo(e,t){return Vt(e,xt(t,!0))}function Lo(e,t,n){if(null==n){var r=Di(t),i=r?Va(t):C,o=i&&i.length?Nt(t,i):C;(o?o.length:r)||(o=!1,n=t,t=e,e=this)}o||(o=Nt(t,Va(t)));var s=!0,a=-1,u=Ni(e),c=o.length;n===!1?s=!1:Di(n)&&"chain"in n&&(s=n.chain);for(;++ae||!bs(e))return[];var r=-1,i=Uo(Ss(e,Ps));for(t=sn(t,n,1);++rr?i[r]=t(r):t(r);return i}function Fo(e){var t=++ns;return u(e)+t}function Bo(e,t){return(+e||0)+(+t||0)}function Vo(e,t,n){return n&&Qn(e,t,n)&&(t=C),t=Un(t,n,3),1==t.length?ft(Pa(e)?e:hr(e),t):Jt(e,t)}e=e?it.defaults(rt.Object(),e,it.pick(rt,Ue)):rt;var Uo=e.Array,Go=e.Date,zo=e.Error,Ho=e.Function,$o=e.Math,Wo=e.Number,qo=e.Object,Xo=e.RegExp,Yo=e.String,Ko=e.TypeError,Zo=Uo.prototype,Jo=qo.prototype,Qo=Yo.prototype,es=Ho.prototype.toString,ts=Jo.hasOwnProperty,ns=0,rs=Jo.toString,is=rt._,os=Xo("^"+es.call(ts).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ss=e.ArrayBuffer,as=e.clearTimeout,us=e.parseFloat,cs=$o.pow,hs=Jo.propertyIsEnumerable,ls=$n(e,"Set"),ps=e.setTimeout,fs=Zo.splice,ds=e.Uint8Array,ms=$n(e,"WeakMap"),vs=$o.ceil,gs=$n(qo,"create"),ys=$o.floor,_s=$n(Uo,"isArray"),bs=e.isFinite,xs=$n(qo,"keys"),ws=$o.max,Ss=$o.min,Ms=$n(Go,"now"),Es=e.parseInt,Cs=$o.random,Ts=Wo.NEGATIVE_INFINITY,As=Wo.POSITIVE_INFINITY,Ps=4294967295,Os=Ps-1,Ls=Ps>>>1,Rs=9007199254740991,Ns=ms&&new ms,Ds={};t.support={};t.templateSettings={escape:we,evaluate:Se,interpolate:Me,variable:"",imports:{_:t}};var Is=function(){function e(){}return function(t){if(Di(t)){e.prototype=t;var n=new e;e.prototype=C}return n||{}}}(),ks=pn(Lt),js=pn(Rt,!0),Fs=fn(),Bs=fn(!0),Vs=Ns?function(e,t){return Ns.set(e,t),e}:Ao,Us=Ns?function(e){return Ns.get(e)}:No,Gs=zt("length"),zs=function(){var e=0,t=0;return function(n,r){var i=ma(),o=V-(i-t);if(t=i,o>0){if(++e>=B)return n}else e=0;return Vs(n,r)}}(),Hs=gi(function(e,t){return y(e)&&Zn(e)?St(e,Pt(t,!1,!0)):[]}),$s=wn(),Ws=wn(!0),qs=gi(function(e){for(var t=e.length,n=t,r=Uo(l),i=zn(),o=i==s,a=[];n--;){var u=e[n]=Zn(u=e[n])?u:[];r[n]=o&&u.length>=120?mn(n&&u):null}var c=e[0],h=-1,l=c?c.length:0,p=r[0];e:for(;++h2?e[t-2]:C,r=t>1?e[t-1]:C;return t>2&&"function"==typeof n?t-=2:(n=t>1&&"function"==typeof r?(--t,r):C,r=C),e.length=t,Fr(e,n,r)}),ta=gi(function(e){return e=Pt(e),this.thru(function(t){return Qe(Pa(t)?t:[lr(t)],e)})}),na=gi(function(e,t){return yt(e,Pt(t))}),ra=hn(function(e,t,n){ts.call(e,n)?++e[n]:e[n]=1}),ia=xn(ks),oa=xn(js,!0),sa=En(tt,ks),aa=En(nt,js),ua=hn(function(e,t,n){ts.call(e,n)?e[n].push(t):e[n]=[t]}),ca=hn(function(e,t,n){e[n]=t}),ha=gi(function(e,t,n){var r=-1,i="function"==typeof t,o=er(t),s=Zn(e)?Uo(e.length):[];return ks(e,function(e){var a=i?t:o&&null!=e?e[t]:C;s[++r]=a?a.apply(e,n):Kn(e,t,n)}),s}),la=hn(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),pa=Ln(ht,ks),fa=Ln(lt,js),da=gi(function(e,t){if(null==e)return[];var n=t[2];return n&&Qn(t[0],t[1],n)&&(t.length=1),Zt(e,Pt(t),[])}),ma=Ms||function(){return(new Go).getTime()},va=gi(function(e,t,n){var r=A;if(n.length){var i=b(n,va.placeholder);r|=N}return jn(e,r,t,n,i)}),ga=gi(function(e,t){t=t.length?Pt(t):Ki(e);for(var n=-1,r=t.length;++n0||0>t)?new _(n):(0>e?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==C&&(t=+t||0,n=0>t?n.dropRight(-t):n.take(t-e)),n)},_.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},_.prototype.toArray=function(){return this.take(As)},Lt(_.prototype,function(e,n){var i=/^(?:filter|map|reject)|While$/.test(n),o=/^(?:first|last)$/.test(n),s=t[o?"take"+("last"==n?"Right":""):n];s&&(t.prototype[n]=function(){var t=o?[1]:arguments,n=this.__chain__,a=this.__wrapped__,u=!!this.__actions__.length,c=a instanceof _,h=t[0],l=c||Pa(a);l&&i&&"function"==typeof h&&1!=h.length&&(c=l=!1);var p=function(e){return o&&n?s(e,1)[0]:s.apply(C,ct([e],t))},f={func:zr,args:[p],thisArg:C},d=c&&!u;if(o&&!n)return d?(a=a.clone(),a.__actions__.push(f),e.call(a)):s.call(C,this.value())[0];if(!o&&l){a=d?a:new _(this);var m=e.apply(a,t);return m.__actions__.push(f),new r(m,n)}return this.thru(p)})}),tt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var n=(/^(?:replace|split)$/.test(e)?Qo:Zo)[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:join|pop|replace|shift)$/.test(e);t.prototype[e]=function(){var e=arguments;return i&&!this.__chain__?n.apply(this.value(),e):this[r](function(t){return n.apply(t,e)})}}),Lt(_.prototype,function(e,n){var r=t[n];if(r){var i=r.name,o=Ds[i]||(Ds[i]=[]);o.push({name:n,func:r})}}),Ds[Rn(C,P).name]=[{name:"wrapper",func:C}],_.prototype.clone=J,_.prototype.reverse=ne,_.prototype.value=ie,t.prototype.chain=Hr,t.prototype.commit=$r,t.prototype.concat=ta,t.prototype.plant=Wr,t.prototype.reverse=qr,t.prototype.toString=Xr,t.prototype.run=t.prototype.toJSON=t.prototype.valueOf=t.prototype.value=Yr,t.prototype.collect=t.prototype.map,t.prototype.head=t.prototype.first,t.prototype.select=t.prototype.filter,t.prototype.tail=t.prototype.rest,t}var C,T="3.10.1",A=1,P=2,O=4,L=8,R=16,N=32,D=64,I=128,k=256,j=30,F="...",B=150,V=16,U=200,G=1,z=2,H="Expected a function",$="__lodash_placeholder__",W="[object Arguments]",q="[object Array]",X="[object Boolean]",Y="[object Date]",K="[object Error]",Z="[object Function]",J="[object Map]",Q="[object Number]",ee="[object Object]",te="[object RegExp]",ne="[object Set]",re="[object String]",ie="[object WeakMap]",oe="[object ArrayBuffer]",se="[object Float32Array]",ae="[object Float64Array]",ue="[object Int8Array]",ce="[object Int16Array]",he="[object Int32Array]",le="[object Uint8Array]",pe="[object Uint8ClampedArray]",fe="[object Uint16Array]",de="[object Uint32Array]",me=/\b__p \+= '';/g,ve=/\b(__p \+=) '' \+/g,ge=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ye=/&(?:amp|lt|gt|quot|#39|#96);/g,_e=/[&<>"'`]/g,be=RegExp(ye.source),xe=RegExp(_e.source),we=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Me=/<%=([\s\S]+?)%>/g,Ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,Ce=/^\w*$/,Te=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,Ae=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,Pe=RegExp(Ae.source),Oe=/[\u0300-\u036f\ufe20-\ufe23]/g,Le=/\\(\\)?/g,Re=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ne=/\w*$/,De=/^0[xX]/,Ie=/^\[object .+?Constructor\]$/,ke=/^\d+$/,je=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Fe=/($^)/,Be=/['\n\r\u2028\u2029\\]/g,Ve=function(){var e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",t="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(e+"+(?="+e+t+")|"+e+"?"+t+"|"+e+"+|[0-9]+","g")}(),Ue=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],Ge=-1,ze={};ze[se]=ze[ae]=ze[ue]=ze[ce]=ze[he]=ze[le]=ze[pe]=ze[fe]=ze[de]=!0,ze[W]=ze[q]=ze[oe]=ze[X]=ze[Y]=ze[K]=ze[Z]=ze[J]=ze[Q]=ze[ee]=ze[te]=ze[ne]=ze[re]=ze[ie]=!1;var He={};He[W]=He[q]=He[oe]=He[X]=He[Y]=He[se]=He[ae]=He[ue]=He[ce]=He[he]=He[Q]=He[ee]=He[te]=He[re]=He[le]=He[pe]=He[fe]=He[de]=!0,He[K]=He[Z]=He[J]=He[ne]=He[ie]=!1;var $e={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},We={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qe={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Xe={"function":!0,object:!0},Ye={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ze=Xe[typeof r]&&r&&!r.nodeType&&r,Je=Xe[typeof n]&&n&&!n.nodeType&&n,Qe=Ze&&Je&&"object"==typeof t&&t&&t.Object&&t,et=Xe[typeof self]&&self&&self.Object&&self,tt=Xe[typeof window]&&window&&window.Object&&window,nt=Je&&Je.exports===Ze&&Ze,rt=Qe||tt!==(this&&this.window)&&tt||et||this,it=E();"function"==typeof e&&"object"==typeof e.amd&&e.amd?(rt._=it,e(function(){return it})):Ze&&Je?nt?(Je.exports=it)._=it:Ze._=it:rt._=it}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],185:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,i="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),o="/"===s(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),o=r(t.split("/")),s=Math.min(i.length,o.length),a=s,u=0;s>u;u++)if(i[u]!==o[u]){a=u;break}for(var c=[],u=a;ut&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:6}],186:[function(e,t,n){"use strict";function r(e){var t;e&&e.length&&(t=e,e=t.length);var n=new Uint8Array(e||0);return t&&n.set(t),n.readUInt32LE=o.readUInt32LE,n.writeUInt32LE=o.writeUInt32LE,n.readInt32LE=o.readInt32LE,n.writeInt32LE=o.writeInt32LE,n.readFloatLE=o.readFloatLE,n.writeFloatLE=o.writeFloatLE,n.readDoubleLE=o.readDoubleLE,n.writeDoubleLE=o.writeDoubleLE,n.toString=o.toString,n.write=o.write,n.slice=o.slice,n.copy=o.copy,n._isBuffer=!0,n}function i(e){for(var t,n,r=e.length,i=[],o=0;r>o;o++){if(t=e.charCodeAt(o),t>55295&&57344>t){if(!n){t>56319||o+1===r?i.push(239,191,189):n=t;continue}if(56320>t){i.push(239,191,189),n=t;continue}t=n-55296<<10|t-56320|65536,n=null}else n&&(i.push(239,191,189),n=null);128>t?i.push(t):2048>t?i.push(t>>6|192,63&t|128):65536>t?i.push(t>>12|224,t>>6&63|128,63&t|128):i.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}return i}t.exports=r;var o,s,a,u=e("ieee754");o={readUInt32LE:function(e){return(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},writeUInt32LE:function(e,t){this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24},readInt32LE:function(e){return(this[e]|this[e+1]<<8|this[e+2]<<16)+(this[e+3]<<24)},readFloatLE:function(e){return u.read(this,e,!0,23,4)},readDoubleLE:function(e){return u.read(this,e,!0,52,8)},writeFloatLE:function(e,t){return u.write(this,e,t,!0,23,4)},writeDoubleLE:function(e,t){return u.write(this,e,t,!0,52,8)},toString:function(e,t,n){var r="",i="";t=t||0,n=Math.min(this.length,n||this.length);for(var o=t;n>o;o++){var s=this[o];127>=s?(r+=decodeURIComponent(i)+String.fromCharCode(s),i=""):i+="%"+s.toString(16)}return r+=decodeURIComponent(i)},write:function(e,t){for(var n=e===s?a:i(e),r=0;r>3,o=this.pos;e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=this.buf.readUInt32LE(this.pos);return this.pos+=4,e},readSFixed32:function(){var e=this.buf.readInt32LE(this.pos);return this.pos+=4,e},readFixed64:function(){var e=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*d;return this.pos+=8,e},readSFixed64:function(){var e=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*d;return this.pos+=8,e},readFloat:function(){var e=this.buf.readFloatLE(this.pos);return this.pos+=4,e},readDouble:function(){var e=this.buf.readDoubleLE(this.pos);return this.pos+=8,e},readVarint:function(){var e,t,n,r,i,o,s=this.buf;if(n=s[this.pos++],128>n)return n;if(n=127&n,r=s[this.pos++],128>r)return n|r<<7;if(r=(127&r)<<7,i=s[this.pos++],128>i)return n|r|i<<14;if(i=(127&i)<<14,o=s[this.pos++],128>o)return n|r|i|o<<21;if(e=n|r|i|(127&o)<<21,t=s[this.pos++],e+=268435456*(127&t),128>t)return e;if(t=s[this.pos++],e+=34359738368*(127&t),128>t)return e;if(t=s[this.pos++],e+=4398046511104*(127&t),128>t)return e;if(t=s[this.pos++],e+=562949953421312*(127&t),128>t)return e;if(t=s[this.pos++],e+=72057594037927940*(127&t),128>t)return e;if(t=s[this.pos++],e+=0x8000000000000000*(127&t),128>t)return e;throw new Error("Expected varint not more than 10 bytes")},readVarint64:function(){var e=this.pos,t=this.readVarint();if(v>t)return t;for(var n=this.pos-2;255===this.buf[n];)n--;e>n&&(n=e),t=0;for(var r=0;n-e+1>r;r++){var i=127&~this.buf[e+r];t+=4>r?i<<7*r:i*Math.pow(2,7*r)}return-t-1},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.buf.toString("utf8",this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.slice(this.pos,e);return this.pos=e,t},readPackedVarint:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos127;);else if(t===r.Bytes)this.pos=this.readVarint()+this.pos;else if(t===r.Fixed32)this.pos+=4;else{if(t!==r.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t=e)this.realloc(1),this.buf[this.pos++]=e;else if(16383>=e)this.realloc(2),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127;else if(2097151>=e)this.realloc(3),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127|128,this.buf[this.pos++]=e>>>14&127;else if(268435455>=e)this.realloc(4),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127|128,this.buf[this.pos++]=e>>>14&127|128,this.buf[this.pos++]=e>>>21&127;else{for(var t=this.pos;e>=128;)this.realloc(1),this.buf[this.pos++]=255&e|128,e/=128;if(this.realloc(1),this.buf[this.pos++]=0|e,this.pos-t>10)throw new Error("Given varint doesn't fit into 10 bytes")}},writeSVarint:function(e){this.writeVarint(0>e?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e);var t=f.byteLength(e);this.writeVarint(t),this.realloc(t),this.buf.write(e,this.pos),this.pos+=t},writeFloat:function(e){this.realloc(4),this.buf.writeFloatLE(e,this.pos),this.pos+=4},writeDouble:function(e){this.realloc(8),this.buf.writeDoubleLE(e,this.pos),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;t>n;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n,i=127>=r?1:16383>=r?2:2097151>=r?3:268435455>=r?4:Math.ceil(Math.log(r)/(7*Math.LN2));if(i>1){this.realloc(i-1);for(var o=this.pos-1;o>=n;o--)this.buf[o+i-1]=this.buf[o]}this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,r.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){this.writeMessage(e,i,t)},writePackedSVarint:function(e,t){this.writeMessage(e,o,t)},writePackedBoolean:function(e,t){this.writeMessage(e,u,t)},writePackedFloat:function(e,t){this.writeMessage(e,s,t)},writePackedDouble:function(e,t){this.writeMessage(e,a,t)},writePackedFixed32:function(e,t){this.writeMessage(e,c,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,h,t)},writePackedFixed64:function(e,t){this.writeMessage(e,l,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,p,t)},writeBytesField:function(e,t){this.writeTag(e,r.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,r.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,r.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,r.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,r.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,r.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,r.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,r.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,r.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,r.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":186}],188:[function(e,t,n){"use strict";t.exports=e("./lib")},{"./lib":193}],189:[function(e,t,n){"use strict";function r(){}function i(e){try{return e.then}catch(t){return v=t,g}}function o(e,t){try{return e(t)}catch(n){return v=n,g}}function s(e,t,n){try{e(t,n)}catch(r){return v=r,g}}function a(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._37=0,this._12=null,this._59=[],e!==r&&d(e,this)}function u(e,t,n){return new e.constructor(function(i,o){var s=new a(r);s.then(i,o),c(e,new f(t,n,s))})}function c(e,t){for(;3===e._37;)e=e._12;return 0===e._37?void e._59.push(t):void m(function(){var n=1===e._37?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._37?h(t.promise,e._12):l(t.promise,e._12));var r=o(n,e._12);r===g?l(t.promise,v):h(t.promise,r)})}function h(e,t){if(t===e)return l(e,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var n=i(t);if(n===g)return l(e,v);if(n===e.then&&t instanceof a)return e._37=3,e._12=t,void p(e);if("function"==typeof n)return void d(n.bind(t),e)}e._37=1,e._12=t,p(e)}function l(e,t){e._37=2,e._12=t,p(e)}function p(e){for(var t=0;t0?t:0);return new r(function(t,r){i.push(function(e,n){e?r(e):t(n)});var o=e.apply(n,i);!o||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then||t(o)})}},r.nodeify=function(e){return function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof t[t.length-1]?t.pop():null,o=this;try{return e.apply(this,arguments).nodeify(n,o)}catch(s){if(null===n||"undefined"==typeof n)return new r(function(e,t){t(s)});i(function(){n.call(o,s)})}}},r.prototype.nodeify=function(e,t){return"function"!=typeof e?this:void this.then(function(n){i(function(){e.call(t,null,n)})},function(n){i(function(){e.call(t,n)})})}},{"./core.js":189,asap:1}],195:[function(t,n,r){!function(){"use strict";function t(e,n){return this instanceof t?(this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),n&&this._initFormat(n),void this.clear()):new t(e,n)}function r(e,t){e.bbox=i(e,0,e.children.length,t)}function i(e,t,n,r){for(var i,a=o(),u=t;n>u;u++)i=e.children[u],s(a,e.leaf?r(i):i.bbox);return a}function o(){return[1/0,1/0,-(1/0),-(1/0)]}function s(e,t){return e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3]),e}function a(e,t){return e.bbox[0]-t.bbox[0]}function u(e,t){return e.bbox[1]-t.bbox[1]}function c(e){return(e[2]-e[0])*(e[3]-e[1])}function h(e){return e[2]-e[0]+(e[3]-e[1])}function l(e,t){return(Math.max(t[2],e[2])-Math.min(t[0],e[0]))*(Math.max(t[3],e[3])-Math.min(t[1],e[1]))}function p(e,t){var n=Math.max(e[0],t[0]),r=Math.max(e[1],t[1]),i=Math.min(e[2],t[2]),o=Math.min(e[3],t[3]);return Math.max(0,i-n)*Math.max(0,o-r)}function f(e,t){return e[0]<=t[0]&&e[1]<=t[1]&&t[2]<=e[2]&&t[3]<=e[3]}function d(e,t){return t[0]<=e[2]&&t[1]<=e[3]&&t[2]>=e[0]&&t[3]>=e[1]}function m(e,t,n,r,i){for(var o,s=[t,n];s.length;)n=s.pop(),t=s.pop(),r>=n-t||(o=t+Math.ceil((n-t)/r/2)*r,v(e,t,n,o,i),s.push(t,o,o,n))}function v(e,t,n,r,i){for(var o,s,a,u,c,h,l,p,f;n>t;){for(n-t>600&&(o=n-t+1,s=r-t+1,a=Math.log(o),u=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*u*(o-u)/o)*(0>s-o/2?-1:1),h=Math.max(t,Math.floor(r-s*u/o+c)),l=Math.min(n,Math.floor(r+(o-s)*u/o+c)),v(e,h,l,r,i)),p=e[r],s=t,f=n,g(e,t,r),i(e[n],p)>0&&g(e,t,n);f>s;){for(g(e,s,f),s++,f--;i(e[s],p)<0;)s++;for(;i(e[f],p)>0;)f--}0===i(e[t],p)?g(e,t,f):(f++,g(e,f,n)),r>=f&&(t=f+1),f>=r&&(n=f-1)}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}t.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,n=[],r=this.toBBox;if(!d(e,t.bbox))return n;for(var i,o,s,a,u=[];t;){for(i=0,o=t.children.length;o>i;i++)s=t.children[i],a=t.leaf?r(s):s.bbox,d(e,a)&&(t.leaf?n.push(s):f(e,a)?this._all(s,n):u.push(s));t=u.pop()}return n},collides:function(e){var t=this.data,n=this.toBBox;if(!d(e,t.bbox))return!1;for(var r,i,o,s,a=[];t;){for(r=0,i=t.children.length;i>r;r++)if(o=t.children[r],s=t.leaf?n(o):o.bbox,d(e,s)){if(t.leaf||f(e,s))return!0;a.push(o)}t=a.pop()}return!1},load:function(e){if(!e||!e.length)return this;if(e.lengtht;t++)this.insert(e[t]);return this}var r=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height=s)return o={children:e.slice(t,n+1),height:1,bbox:null,leaf:!0},r(o,this.toBBox),o;i||(i=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,i-1))),o={children:[],height:i,bbox:null,leaf:!1};var u,c,h,l,p=Math.ceil(s/a),f=p*Math.ceil(Math.sqrt(a));for(m(e,t,n,f,this.compareMinX),u=t;n>=u;u+=f)for(h=Math.min(u+f-1,n),m(e,u,h,p,this.compareMinY),c=u;h>=c;c+=p)l=Math.min(c+p-1,h),o.children.push(this._build(e,c,l,i-1));return r(o,this.toBBox),o},_chooseSubtree:function(e,t,n,r){for(var i,o,s,a,u,h,p,f;;){if(r.push(t),t.leaf||r.length-1===n)break;for(p=f=1/0,i=0,o=t.children.length;o>i;i++)s=t.children[i],u=c(s.bbox),h=l(e,s.bbox)-u,f>h?(f=h,p=p>u?u:p,a=s):h===f&&p>u&&(p=u,a=s);t=a}return t},_insert:function(e,t,n){var r=this.toBBox,i=n?e.bbox:r(e),o=[],a=this._chooseSubtree(i,this.data,t,o);for(a.children.push(e),s(a.bbox,i);t>=0&&o[t].children.length>this._maxEntries;)this._split(o,t),t--;this._adjustParentBBoxes(i,o,t)},_split:function(e,t){var n=e[t],i=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,i);var s=this._chooseSplitIndex(n,o,i),a={children:n.children.splice(s,n.children.length-s),height:n.height,bbox:null,leaf:!1};n.leaf&&(a.leaf=!0),r(n,this.toBBox),r(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)},_splitRoot:function(e,t){this.data={children:[e,t],height:e.height+1,bbox:null,leaf:!1},r(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,n){var r,o,s,a,u,h,l,f;for(h=l=1/0,r=t;n-t>=r;r++)o=i(e,0,r,this.toBBox),s=i(e,r,n,this.toBBox),a=p(o,s),u=c(o)+c(s),h>a?(h=a,f=r,l=l>u?u:l):a===h&&l>u&&(l=u,f=r);return f},_chooseSplitAxis:function(e,t,n){var r=e.leaf?this.compareMinX:a,i=e.leaf?this.compareMinY:u,o=this._allDistMargin(e,t,n,r),s=this._allDistMargin(e,t,n,i);s>o&&e.children.sort(r)},_allDistMargin:function(e,t,n,r){e.children.sort(r);var o,a,u=this.toBBox,c=i(e,0,t,u),l=i(e,n-t,n,u),p=h(c)+h(l);for(o=t;n-t>o;o++)a=e.children[o],s(c,e.leaf?u(a):a.bbox),p+=h(c);for(o=n-t-1;o>=t;o--)a=e.children[o],s(l,e.leaf?u(a):a.bbox),p+=h(l);return p},_adjustParentBBoxes:function(e,t,n){for(var r=n;r>=0;r--)s(t[r].bbox,e)},_condense:function(e){for(var t,n=e.length-1;n>=0;n--)0===e[n].children.length?n>0?(t=e[n-1].children,t.splice(t.indexOf(e[n]),1)):this.clear():r(e[n],this.toBBox)},_initFormat:function(e){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this.toBBox=new Function("a","return [a"+e.join(", a")+"];")}},"function"==typeof e&&e.amd?e("rbush",function(){return t}):"undefined"!=typeof n?n.exports=t:"undefined"!=typeof self?self.rbush=t:window.rbush=t}()},{}],196:[function(t,n,r){!function(e,t){"use strict";var n;e(function(e){function r(e,t){var n,r,i,o;if(n=e,i={},t){for(r in t)o=new RegExp("\\{"+r+"\\}"),o.test(n)?n=n.replace(o,encodeURIComponent(t[r]),"g"):i[r]=t[r];for(r in i)n+=-1===n.indexOf("?")?"?":"&",n+=encodeURIComponent(r),null!==i[r]&&void 0!==i[r]&&(n+="=",n+=encodeURIComponent(i[r]))}return n}function i(e,t){return 0===e.indexOf(t)}function o(e,t){return this instanceof o?void(e instanceof o?(this._template=e.template,this._params=s({},this._params,t)):(this._template=(e||"").toString(),this._params=t||{})):new o(e,t)}var s,a,u,c,h;return s=e("./util/mixin"),u=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?(\/[^?#]*)?(\?[^#]*)?(#\S*)?/i,c=/^([a-z][a-z0-9\-\+\.]*:\/\/|\/)/i,h=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?\//i,o.prototype={append:function(e,t){return new o(this._template+e,s({},this._params,t))},fullyQualify:function(){if(!t)return this;if(this.isFullyQualified())return this;var e=this._template;return i(e,"//")?e=a.protocol+e:i(e,"/")?e=a.origin+e:this.isAbsolute()||(e=a.origin+a.pathname.substring(0,a.pathname.lastIndexOf("/")+1)),-1===e.indexOf("/",8)&&(e+="/"),new o(e,this._params)},isAbsolute:function(){return c.test(this.build())},isFullyQualified:function(){return h.test(this.build())},isCrossOrigin:function(){if(!a)return!0;var e=this.parts();return e.protocol!==a.protocol||e.hostname!==a.hostname||e.port!==a.port},parts:function(){var e,t;return e=this.fullyQualify().build().match(u),t={href:e[0],protocol:e[1],host:e[3]||"",hostname:e[4]||"",port:e[6],pathname:e[7]||"",search:e[8]||"",hash:e[9]||""},t.origin=t.protocol+"//"+t.host,t.port=t.port||("https:"===t.protocol?"443":"http:"===t.protocol?"80":""),t},build:function(e){return r(this._template,s({},this._params,e))},toString:function(){return this.build()}},a=t?new o(t.href).parts():n,o})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)},"undefined"!=typeof window?window.location:void 0)},{"./util/mixin":214}],197:[function(t,n,r){!function(e){"use strict";e(function(e){var t=e("./client/default"),n=e("./client/xhr");return t.setPlatformDefaultClient(n),t})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./client/default":199,"./client/xhr":200}],198:[function(t,n,r){!function(e){"use strict";e(function(){return function(e,t){return t&&(e.skip=function(){return t}),e.wrap=function(t,n){return t(e,n)},e.chain=function(){return"undefined"!=typeof console&&console.log("rest.js: client.chain() is deprecated, use client.wrap() instead"),e.wrap.apply(this,arguments)},e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],199:[function(t,n,r){!function(e){"use strict";var t;e(function(e){function n(){return i.apply(t,arguments)}var r,i,o;return r=e("../client"),n.setDefaultClient=function(e){i=e},n.getDefaultClient=function(){return i},n.resetDefaultClient=function(){i=o},n.setPlatformDefaultClient=function(e){if(o)throw new Error("Unable to redefine platformDefaultClient");i=o=e},r(n)})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../client":198}],200:[function(t,n,r){!function(e,t){"use strict";e(function(e){function n(e){var t={};return e?(e.trim().split(c).forEach(function(e){var n,r,i;n=e.indexOf(":"),r=s(e.substring(0,n).trim()),i=e.substring(n+1).trim(),t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i}),t):t}function r(e,t){return Object.keys(t||{}).forEach(function(n){if(t.hasOwnProperty(n)&&n in e)try{e[n]=t[n]}catch(r){}}),e}var i,o,s,a,u,c;return i=e("when"),o=e("../UrlBuilder"),s=e("../util/normalizeHeaderName"),a=e("../util/responsePromise"),u=e("../client"),c=/[\r|\n]+/,u(function(e){return a.promise(function(i,s){var a,u,c,h,l,p,f,d;if(e="string"==typeof e?{path:e}:e||{},f={request:e},e.canceled)return f.error="precanceled",void s(f);if(l=e.entity,e.method=e.method||(l?"POST":"GET"),u=e.method,c=f.url=new o(e.path||"",e.params).build(),d=e.engine||t.XMLHttpRequest,!d)return void s({request:e,url:c,error:"xhr-not-available"});try{a=f.raw=new d,r(a,e.mixin),a.open(u,c,!0),r(a,e.mixin),h=e.headers;for(p in h)"Content-Type"===p&&"multipart/form-data"===h[p]||a.setRequestHeader(p,h[p]);e.canceled=!1,e.cancel=function(){e.canceled=!0,a.abort(),s(f)},a.onreadystatechange=function(){e.canceled||a.readyState===(d.DONE||4)&&(f.status={code:a.status,text:a.statusText},f.headers=n(a.getAllResponseHeaders()),f.entity=a.responseText,f.status.code>0?i(f):setTimeout(function(){i(f)},0))};try{a.onerror=function(){f.error="loaderror",s(f)}}catch(m){}a.send(l)}catch(m){f.error="loaderror",s(f)}})})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)},"undefined"!=typeof window?window:void 0)},{"../UrlBuilder":196,"../client":198,"../util/normalizeHeaderName":215,"../util/responsePromise":216,when:267}],201:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e){return e}function n(e){return e}function r(e){return e}function i(e){return l.promise(function(t,n){e.forEach(function(e){l(e,t,n)})})}function o(e){return this instanceof o?void u(this,e):new o(e)}function s(e){var s,u,p,f;return e=e||{},s=e.init||t,u=e.request||n,p=e.success||e.response||r,f=e.error||function(){return l((e.response||r).apply(this,arguments),l.reject,l.reject)},function(t,n){function r(e){var s,a;return s={},a={arguments:Array.prototype.slice.call(arguments),client:r},e="string"==typeof e?{path:e}:e||{},e.originator=e.originator||r,c(u.call(s,e,n,a),function(e){var r,u,c;return c=t,e instanceof o&&(u=e.abort,c=e.client||c,r=e.response,e=e.request),r=r||l(e,function(e){return l(c(e),function(e){return p.call(s,e,n,a)},function(e){return f.call(s,e,n,a)})}),u?i([r,u]):r},function(t){return l.reject({request:e,error:t})})}return"object"==typeof t&&(n=t),"function"!=typeof t&&(t=e.client||a),n=s(n||{}),h(r,t)}}var a,u,c,h,l;return a=e("./client/default"),u=e("./util/mixin"),c=e("./util/responsePromise"),h=e("./client"),l=e("when"),s.ComplexRequest=o,s})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./client":198,"./client/default":199,"./util/mixin":214,"./util/responsePromise":216,when:267}],202:[function(t,n,r){!function(e){"use strict";e(function(e){var t,n,r,i,o;return t=e("../interceptor"),n=e("../mime"),r=e("../mime/registry"),o=e("when"),i={read:function(e){return e},write:function(e){return e}},t({init:function(e){return e.registry=e.registry||r,e},request:function(e,t){var r,s;return s=e.headers||(e.headers={}),r=n.parse(s["Content-Type"]=s["Content-Type"]||t.mime||"text/plain"),s.Accept=s.Accept||t.accept||r.raw+", application/json;q=0.8, text/plain;q=0.5, */*;q=0.2","entity"in e?t.registry.lookup(r).otherwise(function(){if(t.permissive)return i;throw"mime-unknown"}).then(function(n){var i=t.client||e.originator;return o.attempt(n.write,e.entity,{client:i,request:e,mime:r,registry:t.registry}).otherwise(function(){throw"mime-serialization"}).then(function(t){return e.entity=t,e})}):e},response:function(e,t){if(!(e.headers&&e.headers["Content-Type"]&&e.entity))return e;var r=n.parse(e.headers["Content-Type"]);return t.registry.lookup(r).otherwise(function(){return i}).then(function(n){var i=t.client||e.request&&e.request.originator;return o.attempt(n.read,e.entity,{client:i,response:e,mime:r,registry:t.registry}).otherwise(function(t){throw e.error="mime-deserialization",e.cause=t,e}).then(function(t){return e.entity=t,e})})}})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../interceptor":201,"../mime":205,"../mime/registry":206,when:267}],203:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t){return 0===e.indexOf(t)}function n(e,t){return e.lastIndexOf(t)+t.length===e.length}var r,i;return r=e("../interceptor"),i=e("../UrlBuilder"),r({request:function(e,r){var o;return r.prefix&&!new i(e.path).isFullyQualified()&&(o=r.prefix,e.path&&(n(o,"/")||t(e.path,"/")||(o+="/"),o+=e.path),e.path=o),e}})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../UrlBuilder":196,"../interceptor":201}],204:[function(t,n,r){!function(e){"use strict";e(function(e){var t,n,r;return t=e("../interceptor"),n=e("../util/uriTemplate"),r=e("../util/mixin"),t({init:function(e){return e.params=e.params||{},e.template=e.template||"",e},request:function(e,t){var i,o;return i=e.path||t.template,o=r({},e.params,t.params),e.path=n.expand(i,o),delete e.params,e}})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../interceptor":201,"../util/mixin":214,"../util/uriTemplate":218}],205:[function(t,n,r){!function(e){"use strict";var t;e(function(){function e(e){var n,r;return n=e.split(";"),r=n[0].trim().split("+"),{raw:e,type:r[0],suffix:r[1]?"+"+r[1]:"",params:n.slice(1).reduce(function(e,n){return n=n.split("="),e[n[0].trim()]=n[1]?n[1].trim():t,e},{})}}return{parse:e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],206:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e){this.lookup=function(t){var i;return i="string"==typeof t?n.parse(t):t,e[i.raw]?e[i.raw]:e[i.type+i.suffix]?e[i.type+i.suffix]:e[i.type]?e[i.type]:e[i.suffix]?e[i.suffix]:r.reject(new Error('Unable to locate converter for mime "'+i.raw+'"'))},this.delegate=function(e){return{read:function(){var t=arguments;return this.lookup(e).then(function(e){return e.read.apply(this,t)}.bind(this))}.bind(this),write:function(){var t=arguments;return this.lookup(e).then(function(e){return e.write.apply(this,t)}.bind(this))}.bind(this)}},this.register=function(t,n){return e[t]=r(n),e[t]},this.child=function(){return new t(Object.create(e))}}var n,r,i;return n=e("../mime"),r=e("when"),i=new t({}),i.register("application/hal",e("./type/application/hal")),i.register("application/json",e("./type/application/json")),i.register("application/x-www-form-urlencoded",e("./type/application/x-www-form-urlencoded")),i.register("multipart/form-data",e("./type/multipart/form-data")),i.register("text/plain",e("./type/text/plain")),i.register("+json",i.delegate("application/json")),i})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../mime":205,"./type/application/hal":207,"./type/application/json":208,"./type/application/x-www-form-urlencoded":209,"./type/multipart/form-data":210,"./type/text/plain":211,when:267}],207:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!1,writeable:!0})}var n,r,i,o,s,a;return n=e("../../../interceptor/pathPrefix"),r=e("../../../interceptor/template"),i=e("../../../util/find"),o=e("../../../util/lazyPromise"),s=e("../../../util/responsePromise"),a=e("when"),{read:function(e,u){function c(e,t){(t&&l&&l.warn||l.log)&&(l.warn||l.log).call(l,"Relationship '"+e+"' is deprecated, see "+t)}var h,l;return u=u||{},h=u.client,l=u.console||l,u.registry.lookup(u.mime.suffix).then(function(l){return a(l.read(e,u)).then(function(e){return i.findProperties(e,"_embedded",function(e,n,r){
-Object.keys(e).forEach(function(r){if(!(r in n)){var i=s({entity:e[r]});t(n,r,i)}}),t(n,r,e)}),i.findProperties(e,"_links",function(e,i,a){Object.keys(e).forEach(function(n){var a=e[n];n in i||t(i,n,s.make(o(function(){return a.deprecation&&c(n,a.deprecation),a.templated===!0?r(h)({path:a.href}):h({path:a.href})})))}),t(i,a,e),t(i,"clientFor",function(t,i){var o=e[t];if(!o)throw new Error("Unknown relationship: "+t);return o.deprecation&&c(t,o.deprecation),o.templated===!0?r(i||h,{template:o.href}):n(i||h,{prefix:o.href})}),t(i,"requestFor",function(e,t,n){var r=this.clientFor(e,n);return r(t)})}),e})})},write:function(e,t){return t.registry.lookup(t.mime.suffix).then(function(n){return n.write(e,t)})}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../../../interceptor/pathPrefix":203,"../../../interceptor/template":204,"../../../util/find":212,"../../../util/lazyPromise":213,"../../../util/responsePromise":216,when:267}],208:[function(t,n,r){!function(e){"use strict";e(function(){function e(t,n){return{read:function(e){return JSON.parse(e,t)},write:function(e){return JSON.stringify(e,n)},extend:e}}return e()})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],209:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){return e=encodeURIComponent(e),e.replace(r,"+")}function t(e){return e=e.replace(i," "),decodeURIComponent(e)}function n(t,r,i){return Array.isArray(i)?i.forEach(function(e){t=n(t,r,e)}):(t.length>0&&(t+="&"),t+=e(r),void 0!==i&&null!==i&&(t+="="+e(i))),t}var r,i;return r=/%20/g,i=/\+/g,{read:function(e){var n={};return e.split("&").forEach(function(e){var r,i,o;r=e.split("="),i=t(r[0]),o=2===r.length?t(r[1]):null,i in n?(Array.isArray(n[i])||(n[i]=[n[i]]),n[i].push(o)):n[i]=o}),n},write:function(e){var t="";return Object.keys(e).forEach(function(r){t=n(t,r,e[r])}),t}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],210:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){return e&&1===e.nodeType&&"FORM"===e.tagName}function t(e){var t,n=new FormData;for(var r in e)e.hasOwnProperty(r)&&(t=e[r],t instanceof File?n.append(r,t,t.name):t instanceof Blob?n.append(r,t):n.append(r,String(t)));return n}return{write:function(n){if("undefined"==typeof FormData)throw new Error("The multipart/form-data mime serializer requires FormData support");if(n instanceof FormData)return n;if(e(n))return new FormData(n);if("object"==typeof n&&null!==n)return t(n);throw new Error("Unable to create FormData from object "+n)}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],211:[function(t,n,r){!function(e){"use strict";e(function(){return{read:function(e){return e},write:function(e){return e.toString()}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],212:[function(t,n,r){!function(e){"use strict";e(function(){return{findProperties:function e(t,n,r){"object"==typeof t&&null!==t&&(n in t&&r(t[n],t,n),Object.keys(t).forEach(function(i){e(t[i],n,r)}))}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],213:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e){var t,r,i,o,s;return t=n.defer(),r=!1,i=t.resolver,o=t.promise,s=o.then,o.then=function(){return r||(r=!0,n.attempt(e).then(i.resolve,i.reject)),s.apply(o,arguments)},o}var n;return n=e("when"),t})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{when:267}],214:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){var n,r,i,o;for(e||(e={}),n=1,r=arguments.length;r>n;n+=1){i=arguments[n];for(o in i)o in e&&(e[o]===i[o]||o in t&&t[o]===i[o])||(e[o]=i[o])}return e}var t={};return e})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],215:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){return e.toLowerCase().split("-").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}).join("-")}return e})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],216:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t){return e.then(function(e){return e&&e[t]},function(e){return c.reject(e&&e[t])})}function n(){return t(this,"entity")}function r(){return t(t(this,"status"),"code")}function i(){return t(this,"headers")}function o(e){return e=h(e),t(this.headers(),e)}function s(e){return e=[].concat(e),a(c.reduce(e,function(e,t){if("string"==typeof t&&(t={rel:t}),"function"!=typeof e.entity.clientFor)throw new Error("Hypermedia response expected");var n=e.entity.clientFor(t.rel);return n({params:t.params})},this))}function a(e){return e.status=r,e.headers=i,e.header=o,e.entity=n,e.follow=s,e}function u(){return a(c.apply(c,arguments))}var c=e("when"),h=e("./normalizeHeaderName");return u.make=a,u.reject=function(e){return a(c.reject(e))},u.promise=function(e){return a(c.promise(e))},u})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./normalizeHeaderName":215,when:267}],217:[function(t,n,r){!function(e){"use strict";e(function(){function e(e,t){if("string"!=typeof e)throw new Error("String required for URL encoding");return e.split("").map(function(e){if(t.hasOwnProperty(e))return e;var n=e.charCodeAt(0);if(127>=n){var r=n.toString(16).toUpperCase();return"%"+(r.length%2===1?"0":"")+r}return encodeURIComponent(e).toUpperCase()}).join("")}function t(t){return t=t||r.unreserved,function(n){return e(n,t)}}function n(e){return decodeURIComponent(e)}var r;return r=function(){var e={alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",digit:"0123456789"};return e.genDelims=":/?#[]@",e.subDelims="!$&'()*+,;=",e.reserved=e.genDelims+e.subDelims,e.unreserved=e.alpha+e.digit+"-._~",e.url=e.reserved+e.unreserved,e.scheme=e.alpha+e.digit+"+-.",e.userinfo=e.unreserved+e.subDelims+":",e.host=e.unreserved+e.subDelims,e.port=e.digit,e.pchar=e.unreserved+e.subDelims+":@",e.segment=e.pchar,e.path=e.segment+"/",e.query=e.pchar+"/?",e.fragment=e.pchar+"/?",Object.keys(e).reduce(function(t,n){return t[n]=e[n].split("").reduce(function(e,t){return e[t]=!0,e},{}),t},{})}(),{decode:n,encode:t(),encodeURL:t(r.url),encodeScheme:t(r.scheme),encodeUserInfo:t(r.userinfo),encodeHost:t(r.host),encodePort:t(r.port),encodePathSegment:t(r.segment),encodePath:t(r.path),encodeQuery:t(r.query),encodeFragment:t(r.fragment)}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],218:[function(t,n,r){!function(e){"use strict";var t;e(function(e){function n(e,n,r){return n.split(",").reduce(function(n,i){var s,u;if(s={},"*"===i.slice(-1)&&(i=i.slice(0,-1),s.explode=!0),a.test(i)){var c=a.exec(i);i=c[1],s.maxLength=parseInt(c[2])}return i=o.decode(i),u=r[i],u===t||null===u?n:(Array.isArray(u)?n+=u.reduce(function(t,n){return t.length?(t+=s.explode?e.separator:",",e.named&&s.explode&&(t+=e.encoder(i),t+=n.length?"=":e.empty)):(t+=e.first,e.named&&(t+=e.encoder(i),t+=n.length?"=":e.empty)),t+=e.encoder(n)},""):"object"==typeof u?n+=Object.keys(u).reduce(function(t,n){return t.length?t+=s.explode?e.separator:",":(t+=e.first,e.named&&!s.explode&&(t+=e.encoder(i),t+=u[n].length?"=":e.empty)),t+=e.encoder(n),t+=s.explode?"=":",",t+=e.encoder(u[n])},""):(u=String(u),s.maxLength&&(u=u.slice(0,s.maxLength)),n+=n.length?e.separator:e.first,e.named&&(n+=e.encoder(i),n+=u.length?"=":e.empty),n+=e.encoder(u)),n)},"")}function r(e,t){var r;if(r=s[e.slice(0,1)],r?e=e.slice(1):r=s[""],r.reserved)throw new Error("Reserved expression operations are not supported");return n(r,e,t)}function i(e,t){var n,i,o;for(o="",i=0;;){if(n=e.indexOf("{",i),-1===n){o+=e.slice(i);break}o+=e.slice(i,n),i=e.indexOf("}",n)+1,o+=r(e.slice(n+1,i-1),t)}return o}var o,s,a;return o=e("./uriEncoder"),a=/^([^:]*):([0-9]+)$/,s={"":{first:"",separator:",",named:!1,empty:"",encoder:o.encode},"+":{first:"",separator:",",named:!1,empty:"",encoder:o.encodeURL},"#":{first:"#",separator:",",named:!1,empty:"",encoder:o.encodeURL},".":{first:".",separator:".",named:!1,empty:"",encoder:o.encode},"/":{first:"/",separator:"/",named:!1,empty:"",encoder:o.encode},";":{first:";",separator:";",named:!0,empty:"",encoder:o.encode},"?":{first:"?",separator:"&",named:!0,empty:"=",encoder:o.encode},"&":{first:"&",separator:"&",named:!0,empty:"=",encoder:o.encode},"=":{reserved:!0},",":{reserved:!0},"!":{reserved:!0},"@":{reserved:!0},"|":{reserved:!0}},{expand:i}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./uriEncoder":217}],219:[function(t,n,r){(function(t,i){(function(o){function s(e){return e&&e.Object===Object?e:null}function a(e){for(var t=[],n=0,r=e.length;r>n;n++)t.push(e[n]);return t}function u(e){return function(){try{return e.apply(this,arguments)}catch(t){return nt.e=t,nt}}}function c(e){throw e}function h(e,t){if(it&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(ut)){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var i=n.join("\n"+ut+"\n");e.stack=l(i)}}function l(e){for(var t=e.split("\n"),n=[],r=0,i=t.length;i>r;r++){var o=t[r];p(o)||f(o)||!o||n.push(o)}return n.join("\n")}function p(e){var t=m(e);if(!t)return!1;var n=t[0],r=t[1];return n===st&&r>=at&&Fs>=r}function f(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function d(){if(it)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=m(n);if(!r)return;return st=r[0],r[1]}}function m(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function v(e,t,n,r,i,s){var a=Yt(e),u=a.length,c=Yt(t),h=c.length;if(u!==h&&!r)return!1;for(var l,p=u;p--;)if(l=a[p],!(r?l in t:Wt.call(t,l)))return!1;for(var f=r;++p-1&&e%1===0&&Xt>=e}function b(e){return y(e)&&_(e.length)&&!!Ht[qt.call(e)]}function x(e,t){for(var n=-1,r=e.length;++nu))return!1;for(;++ar;r++)n[r]=t();return n}function C(e,t){this.id=e,this.value=t}function T(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function A(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function P(e){this._s=e,this.isDisposed=!1}function O(e){this._s=e}function L(e){this._s=e,this._l=e.length,this._i=0}function R(e){this._a=e}function N(e){this._a=e,this._l=j(e),this._i=0}function D(e){return"number"==typeof e&&We.isFinite(e)}function I(e){var t,n=e[mt];if(!n&&"string"==typeof e)return t=new O(e),t[mt]();if(!n&&e.length!==o)return t=new R(e),t[mt]();if(!n)throw new TypeError("Object is not iterable");return e[mt]()}function k(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}function j(e){var t=+e.length;return isNaN(t)?0:0!==t&&D(t)?(t=k(t)*Math.floor(Math.abs(t)),0>=t?0:t>gr?gr:t):t}function F(e,t){return xn(e)||(e=An),new _r(t,e)}function B(e,t){this.observer=e,this.parent=t}function V(e,t){return e.amb(t)}function U(){return!1}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function U(){return!1}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function U(){return!1}function z(){return[]}function U(){return!1}function z(){return[]}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function H(e){return function(t){return e.subscribe(t)}}function $(e){return e.toArray()}function W(e){return e.length>0}function q(e){return{"@@iterator":function(){return{next:function(){return{done:!1,value:e}}}}}}function q(e){return{"@@iterator":function(){return{next:function(){return{done:!1,value:e}}}}}}function X(e,t,n){var r=_t(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return et(i)&&(i=cr(i)),(yt(i)||gt(i))&&(i=yr(i)),i}).concatAll()}function Y(e,t,n){for(var r=0,i=e.length;i>r;r++)if(n(e[r],t))return r;return-1}function K(e){this.comparer=e,this.set=[]}function Z(e,t){return function(n){for(var r=n,i=0;t>i;i++){var s=r[e[i]];if("undefined"==typeof s)return o;r=s}return r}}function J(e){if(0===e.length)throw new ct;return e[0]}function Q(e,t,n,r){var i=_t(t,n,3);return new Ps(function(t){return e.subscribe(new po(t,e,i,r))},e)}function ee(e){return e?Kn.isObservable(e)?e:et(e)?Kn.fromPromise(e):oe(e)||ie(e)?wo.call(this,e):tt(e)?re.call(this,e):yt(e)||gt(e)?te.call(this,e):se(e)?ne.call(this,e):e:e}function te(e){return Kn.from(e).concatMap(function(e){return Kn.isObservable(e)||se(e)?ee.call(null,e):qe.Observable.just(e)}).toArray()}function ne(e){function t(e,t){n[t]=o,i.push(e.map(function(e){n[t]=e}))}for(var n=new e.constructor,r=Object.keys(e),i=[],s=0,a=r.length;a>s;s++){var u=r[s],c=ee.call(this,e[u]);c&&Kn.isObservable(c)?t(c,u):n[u]=e[u]}return Kn.forkJoin.apply(Kn,i).map(function(){return n})}function re(e){var t=this;return new Ps(function(n){e.call(t,function(){var e=arguments[0],t=arguments[1];if(e)return n.onError(e);if(arguments.length>2){for(var r=[],i=1,o=arguments.length;o>i;i++)r.push(arguments[i]);t=r}n.onNext(t),n.onCompleted()})})}function ie(e){return tt(e.next)&&tt(e["throw"])}function oe(e){var t=e.constructor;return t?"GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName?!0:ie(t.prototype):!1}function se(e){return Object==e.constructor}function ae(e,t,n,r){var i=new Ds;return r.push(ue(i,t,n)),e.apply(t,r),i.asObservable()}function ue(e,t,n){return function(){for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];if(tt(n)){if(i=rt(n).apply(t,i),i===nt)return e.onError(i.e);e.onNext(i)}else i.length<=1?e.onNext(i[0]):e.onNext(i);e.onCompleted()}}function ce(e,t,n,r){var i=new Ds;return r.push(he(i,t,n)),e.apply(t,r),i.asObservable()}function he(e,t,n){return function(){var r=arguments[0];if(r)return e.onError(r);for(var i=arguments.length,o=[],s=1;i>s;s++)o[s-1]=arguments[s];if(tt(n)){var o=rt(n).apply(t,o);if(o===nt)return e.onError(o.e);e.onNext(o)}else o.length<=1?e.onNext(o[0]):e.onNext(o);e.onCompleted()}}function le(e){return We.StaticNodeList?e instanceof We.StaticNodeList||e instanceof We.NodeList:"[object NodeList]"===Object.prototype.toString.call(e)}function pe(e,t,n){this._e=e,this._n=t,this._fn=n,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function fe(e,t,n){var r=new on,i=Object.prototype.toString.call(e);if(le(e)||"[object HTMLCollection]"===i)for(var o=0,s=e.length;s>o;o++)r.add(fe(e.item(o),t,n));else e&&r.add(new pe(e,t,n));return r}function de(e,t,n){return new Ps(function(r){function i(e,t){if(c[t]=e,s[t]=!0,a||(a=s.every(Ye))){if(o)return r.onError(o);var i=rt(n).apply(null,c);if(i===nt)return r.onError(i.e);r.onNext(i)}u&&c[1]&&r.onCompleted()}var o,s=[!1,!1],a=!1,u=!1,c=new Array(2);return new mn(e.subscribe(function(e){i(e,0)},function(e){c[1]?r.onError(e):o=e},function(){u=!0,c[1]&&r.onCompleted()}),t.subscribe(function(e){i(e,1)},function(e){r.onError(e)},function(){u=!0,i(!0,1)}))},e)}function $(e){return e.toArray()}function me(e,t){return e.groupJoin(this,t,mr,function(e,t){return t})}function ve(e){var t=this;return new Ps(function(n){var r=new Ns,i=new on,o=new gn(i);return n.onNext(tn(r,o)),i.add(t.subscribe(function(e){r.onNext(e)},function(e){r.onError(e),n.onError(e)},function(){r.onCompleted(),n.onCompleted()})),et(e)&&(e=cr(e)),i.add(e.subscribe(function(e){r.onCompleted(),r=new Ns,n.onNext(tn(r,o))},function(e){r.onError(e),n.onError(e)},function(){r.onCompleted(),n.onCompleted()})),o},t)}function ge(e){var t=this;return new Ps(function(n){function r(){var t;try{t=e()}catch(o){return void n.onError(o)}et(t)&&(t=cr(t));var u=new fn;i.setDisposable(u),u.setDisposable(t.take(1).subscribe(Xe,function(e){a.onError(e),n.onError(e)},function(){a.onCompleted(),a=new Ns,n.onNext(tn(a,s)),r()}))}var i=new dn,o=new on(i),s=new gn(o),a=new Ns;return n.onNext(tn(a,s)),o.add(t.subscribe(function(e){a.onNext(e)},function(e){a.onError(e),n.onError(e)},function(){a.onCompleted(),n.onCompleted()})),r(),s},t)}function ye(e,t){return new Bo(e,t)}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function _e(e){this.patterns=e}function be(e,t){this.expression=e,this.selector=t}function xe(e){return function(t){e.onError(t)}}function we(e,t){return function(){var n=rt(e.selector).apply(e,arguments);return n===nt?t.onError(n.e):void t.onNext(n)}}function Se(e,t,n){var r=e.get(t);if(!r){var i=new qo(t,n);return e.set(t,i),i}return r}function Me(e,t,n){this.joinObserverArray=e,this.onNext=t,this.onCompleted=n,this.joinObservers=new Wo;for(var r=0,i=this.joinObserverArray.length;i>r;r++){var o=this.joinObserverArray[r];this.joinObservers.set(o,o)}}function Ee(e,t){return new Xo(e,t)}function Ce(e,t,n){return new Ps(function(r){var i=e,o=bn(t);return n.scheduleRecursiveFuture(0,i,function(e,t){if(o>0){var s=n.now();i=new Date(i.getTime()+o),i.getTime()<=s&&(i=new Date(s+o))}r.onNext(e),t(e+1,new Date(i))})})}function Te(e,t,n){return e===t?new Ps(function(e){return n.schedulePeriodic(0,t,function(t){return e.onNext(t),t+1})}):pr(function(){return Ce(new Date(n.now()+e),t,n)})}function Ae(e,t,n){return new Ps(function(r){var i,o=!1,s=new dn,a=null,u=[],c=!1;return i=e.materialize().timestamp(n).subscribe(function(e){var i,h;"E"===e.value.kind?(u=[],u.push(e),a=e.value.error,h=!c):(u.push({value:e.value,timestamp:e.timestamp+t}),h=!o,o=!0),h&&(null!==a?r.onError(a):(i=new fn,s.setDisposable(i),i.setDisposable(n.scheduleRecursiveFuture(null,t,function(e,t){var i,s,h,l;if(null===a){c=!0;do h=null,u.length>0&&u[0].timestamp-n.now()<=0&&(h=u.shift().value),null!==h&&h.accept(r);while(null!==h);l=!1,s=0,u.length>0?(l=!0,s=Math.max(0,u[0].timestamp-n.now())):o=!1,i=a,c=!1,null!==i?r.onError(i):l&&t(null,s)}}))))}),new mn(i,s)},e)}function Pe(e,t,n){return pr(function(){return Ae(e,t-n.now(),n)})}function Oe(e,t,n){var r,i;return tt(t)?i=t:(r=t,i=n),new Ps(function(t){function n(){u.setDisposable(e.subscribe(function(e){var n=rt(i)(e);if(n===nt)return t.onError(n.e);var r=new fn;s.add(r),r.setDisposable(n.subscribe(function(){t.onNext(e),s.remove(r),o()},function(e){t.onError(e)},function(){t.onNext(e),s.remove(r),o()}))},function(e){t.onError(e)},function(){a=!0,u.dispose(),o()}))}function o(){a&&0===s.length&&t.onCompleted()}var s=new on,a=!1,u=new dn;return r?u.setDisposable(r.subscribe(n,function(e){t.onError(e)},n)):n(),new mn(u,s)},e)}function Le(e,t){return new Ps(function(n){var r,i=!1,o=new dn,s=0,a=e.subscribe(function(e){var a=rt(t)(e);if(a===nt)return n.onError(a.e);et(a)&&(a=cr(a)),i=!0,r=e,s++;var u=s,c=new fn;o.setDisposable(c),c.setDisposable(a.subscribe(function(){i&&s===u&&n.onNext(r),i=!1,c.dispose()},function(e){n.onError(e)},function(){i&&s===u&&n.onNext(r),i=!1,c.dispose()}))},function(e){o.dispose(),n.onError(e),i=!1,s++},function(){o.dispose(),i&&n.onNext(r),n.onCompleted(),i=!1,s++});return new mn(a,o)},e)}function $(e){return e.toArray()}function $(e){return e.toArray()}function Re(e,t,n,r){return tt(t)&&(r=n,n=t,t=Mr()),Kn.isObservable(r)||(r=Or(new os)),new Ps(function(i){function o(e){function t(){return l=n===h}var n=h,o=new fn;u.setDisposable(o),o.setDisposable(e.subscribe(function(){t()&&a.setDisposable(r.subscribe(i)),o.dispose()},function(e){t()&&i.onError(e)},function(){t()&&a.setDisposable(r.subscribe(i))}))}function s(){var e=!l;return e&&h++,e}var a=new dn,u=new dn,c=new fn;a.setDisposable(c);var h=0,l=!1;return o(t),c.setDisposable(e.subscribe(function(e){if(s()){i.onNext(e);var t=rt(n)(e);if(t===nt)return i.onError(t.e);o(et(t)?cr(t):t)}},function(e){s()&&i.onError(e)},function(){s()&&i.onCompleted()})),new mn(a,u)},e)}function Ne(e,t,n,r){return xn(n)&&(r=n,n=Or(new os)),n instanceof Error&&(n=Or(n)),xn(r)||(r=Nn),Kn.isObservable(n)||(n=Or(new os)),new Ps(function(i){function o(){var e=s;h.setDisposable(r.scheduleFuture(null,t,function(){c=s===e,c&&(et(n)&&(n=cr(n)),u.setDisposable(n.subscribe(i)))}))}var s=0,a=new fn,u=new dn,c=!1,h=new dn;return u.setDisposable(a),o(),a.setDisposable(e.subscribe(function(e){c||(s++,i.onNext(e),o())},function(e){c||(s++,i.onError(e))},function(){c||(s++,i.onCompleted())})),new mn(u,h)},e)}function De(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}function Ie(e){this.predicate=e}function ke(e){this.predicate=e}function je(e,t){var n=this;this.scheduler=e,this.messages=t,this.subscriptions=[],this.observers=[];for(var r=0,i=this.messages.length;i>r;r++){var o=this.messages[r],s=o.value;!function(t){e.scheduleAbsolute(null,o.time,function(){for(var e=n.observers.slice(0),r=0,i=e.length;i>r;r++)t.accept(e[r]);return cn})}(s)}}var Fe={"function":!0,object:!0},Be=Fe[typeof r]&&r&&!r.nodeType?r:null,Ve=Fe[typeof n]&&n&&!n.nodeType?n:null,Ue=s(Be&&Ve&&"object"==typeof i&&i),Ge=s(Fe[typeof self]&&self),ze=s(Fe[typeof window]&&window),He=Ve&&Ve.exports===Be?Be:null,$e=s(Fe[typeof this]&&this),We=Ue||ze!==($e&&$e.window)&&ze||Ge||$e||Function("return this")(),qe={internals:{},config:{Promise:We.Promise},helpers:{}},Xe=qe.helpers.noop=function(){},Ye=qe.helpers.identity=function(e){return e},Ke=qe.helpers.defaultNow=Date.now,Ze=qe.helpers.defaultComparer=function(e,t){return Jt(e,t)},Je=qe.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},Qe=(qe.helpers.defaultKeySerializer=function(e){return e.toString()},qe.helpers.defaultError=function(e){throw e}),et=qe.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},tt=qe.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==toString.call(e)}),e}(),nt={e:{}},rt=qe.internals.tryCatch=function(e){if(!tt(e))throw new TypeError("fn must be a function");return u(e)};qe.config.longStackSupport=!1;var it=!1,ot=rt(function(){throw new Error})();it=!!ot.e&&!!ot.e.stack;var st,at=d(),ut="From previous event:",ct=qe.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};ct.prototype=Object.create(Error.prototype),ct.prototype.name="EmptyError";var ht=qe.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};ht.prototype=Object.create(Error.prototype),ht.prototype.name="ObjectDisposedError";var lt=qe.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};lt.prototype=Object.create(Error.prototype),lt.prototype.name="ArgumentOutOfRangeError";var pt=qe.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};pt.prototype=Object.create(Error.prototype),pt.prototype.name="NotSupportedError";var ft=qe.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};ft.prototype=Object.create(Error.prototype),ft.prototype.name="NotImplementedError";var dt=qe.helpers.notImplemented=function(){throw new ft},mt=(qe.helpers.notSupported=function(){throw new pt},"function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_");We.Set&&"function"==typeof(new We.Set)["@@iterator"]&&(mt="@@iterator");var vt=qe.doneEnumerator={done:!0,value:o},gt=qe.helpers.isIterable=function(e){return e&&e[mt]!==o},yt=qe.helpers.isArrayLike=function(e){return e&&e.length!==o};qe.helpers.iterator=mt;var _t=qe.internals.bindCallback=function(e,t,n){if("undefined"==typeof t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},bt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],xt=(bt.length,"[object Arguments]"),wt="[object Array]",St="[object Boolean]",Mt="[object Date]",Et="[object Error]",Ct="[object Function]",Tt="[object Map]",At="[object Number]",Pt="[object Object]",Ot="[object RegExp]",Lt="[object Set]",Rt="[object String]",Nt="[object WeakMap]",Dt="[object ArrayBuffer]",It="[object Float32Array]",kt="[object Float64Array]",jt="[object Int8Array]",Ft="[object Int16Array]",Bt="[object Int32Array]",Vt="[object Uint8Array]",Ut="[object Uint8ClampedArray]",Gt="[object Uint16Array]",zt="[object Uint32Array]",Ht={};Ht[It]=Ht[kt]=Ht[jt]=Ht[Ft]=Ht[Bt]=Ht[Vt]=Ht[Ut]=Ht[Gt]=Ht[zt]=!0,Ht[xt]=Ht[wt]=Ht[Dt]=Ht[St]=Ht[Mt]=Ht[Et]=Ht[Ct]=Ht[Tt]=Ht[At]=Ht[Pt]=Ht[Ot]=Ht[Lt]=Ht[Rt]=Ht[Nt]=!1;var $t=Object.prototype,Wt=$t.hasOwnProperty,qt=$t.toString,Xt=Math.pow(2,53)-1,Yt=Object.keys||function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=n.length;return function(i){if("object"!=typeof i&&("function"!=typeof i||null===i))throw new TypeError("Object.keys called on non-object");var o,s,a=[];for(o in i)e.call(i,o)&&a.push(o);if(t)for(s=0;r>s;s++)e.call(i,n[s])&&a.push(n[s]);return a}}(),se=qe.internals.isObject=function(e){var t=typeof e;return!!e&&("object"===t||"function"===t)},Kt=function(){try{Object({toString:0}+"")}catch(e){return function(){return!1}}return function(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}}(),Zt=Array.isArray||function(e){return y(e)&&_(e.length)&&qt.call(e)===wt},Jt=qe.internals.isEqual=function(e,t){return M(e,t)},Qt=({}.hasOwnProperty,Array.prototype.slice,qe.internals.inherits=function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}),en=qe.internals.addProperties=function(e){for(var t=[],n=1,r=arguments.length;r>n;n++)t.push(arguments[n]);for(var i=0,o=t.length;o>i;i++){var s=t[i];for(var a in s)e[a]=s[a]}},tn=qe.internals.addRef=function(e,t){return new Ps(function(n){return new mn(t.getDisposable(),e.subscribe(n))})};C.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var nn=qe.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},rn=nn.prototype;rn.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},rn.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}}},rn.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,n=2*e+2,r=e;if(te;e++)n[e]=arguments[e];this.disposables=n,this.isDisposed=!1,this.length=n.length},sn=on.prototype;sn.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},sn.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},sn.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;e>n;n++)t[n]=this.disposables[n];for(this.disposables=[],this.length=0,n=0;e>n;n++)t[n].dispose()}};var an=qe.Disposable=function(e){this.isDisposed=!1,this.action=e||Xe};an.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var un=an.create=function(e){return new an(e)},cn=an.empty={dispose:Xe},hn=an.isDisposable=function(e){return e&&tt(e.dispose)},ln=an.checkDisposed=function(e){if(e.isDisposed)throw new ht},pn=an._fixup=function(e){return hn(e)?e:cn},fn=qe.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};fn.prototype.getDisposable=function(){return this.current},fn.prototype.setDisposable=function(e){if(this.current)throw new Error("Disposable has already been assigned");var t=this.isDisposed;!t&&(this.current=e),t&&e&&e.dispose()},fn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null,e&&e.dispose()}};var dn=qe.SerialDisposable=function(){this.isDisposed=!1,this.current=null};dn.prototype.getDisposable=function(){return this.current},dn.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e}n&&n.dispose(),t&&e&&e.dispose()},dn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var mn=qe.BinaryDisposable=function(e,t){this._first=e,this._second=t,this.isDisposed=!1};mn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this._first;this._first=null,e&&e.dispose();var t=this._second;this._second=null,t&&t.dispose()}};var vn=qe.NAryDisposable=function(e){this._disposables=e,this.isDisposed=!1};vn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=0,t=this._disposables.length;t>e;e++)this._disposables[e].dispose();this._disposables.length=0}};var gn=qe.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?cn:new e(this)},t}();T.prototype.dispose=function(){this.scheduler.schedule(this,A)};var yn=qe.internals.ScheduledItem=function(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||Je,this.disposable=new fn};yn.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},yn.prototype.compareTo=function(e){
-return this.comparer(this.dueTime,e.dueTime)},yn.prototype.isCancelled=function(){return this.disposable.isDisposed},yn.prototype.invokeCore=function(){return pn(this.action(this.scheduler,this.state))};var _n=qe.Scheduler=function(){function e(){}e.isScheduler=function(t){return t instanceof e};var t=e.prototype;return t.schedule=function(e,t){throw new ft},t.scheduleFuture=function(t,n,r){var i=n;return i instanceof Date&&(i-=this.now()),i=e.normalize(i),0===i?this.schedule(t,r):this._scheduleFuture(t,i,r)},t._scheduleFuture=function(e,t,n){throw new ft},e.now=Ke,e.prototype.now=Ke,e.normalize=function(e){return 0>e&&(e=0),e},e}(),bn=_n.normalize,xn=_n.isScheduler;!function(e){function t(e,t){function n(t){function r(e,t){return s?o.remove(u):a=!0,i(t,n),cn}var s=!1,a=!1,u=e.schedule(t,r);a||(o.add(u),s=!0)}var r=t[0],i=t[1],o=new on;return i(r,n),o}function n(e,t){function n(t,r){function s(e,t){return a?o.remove(c):u=!0,i(t,n),cn}var a=!1,u=!1,c=e.scheduleFuture(t,r,s);u||(o.add(c),a=!0)}var r=t[0],i=t[1],o=new on;return i(r,n),o}e.scheduleRecursive=function(e,n){return this.schedule([e,n],t)},e.scheduleRecursiveFuture=function(e,t,r){return this.scheduleFuture([e,r],t,n)}}(_n.prototype),function(e){e.schedulePeriodic=function(e,t,n){if("undefined"==typeof We.setInterval)throw new pt;t=bn(t);var r=e,i=We.setInterval(function(){r=n(r)},t);return un(function(){We.clearInterval(i)})}}(_n.prototype),function(e){e.catchError=e["catch"]=function(e){return new Dn(this,e)}}(_n.prototype);var wn,Sn,Mn=qe.internals.SchedulePeriodicRecursive=function(){function e(e){return function(t,n){n(0,e._period);var r=rt(e._action)(e._state);r===nt&&(e._cancel.dispose(),c(r.e)),e._state=r}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new fn;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,e(this))),t},t}(),En=function(e){function t(){e.call(this)}return Qt(t,e),t.prototype.schedule=function(e,t){return pn(t(this,e))},t}(_n),Cn=_n.immediate=new En,Tn=function(e){function t(){for(;r.length>0;){var e=r.dequeue();!e.isCancelled()&&e.invoke()}}function n(){e.call(this)}var r;return Qt(n,e),n.prototype.schedule=function(e,n){var i=new yn(this,e,n,this.now());if(r)r.enqueue(i);else{r=new nn(4),r.enqueue(i);var o=rt(t)();r=null,o===nt&&c(o.e)}return i.disposable},n.prototype.scheduleRequired=function(){return!r},n}(_n),An=_n.currentThread=new Tn,Pn=function(){var e,t=Xe;if(We.setTimeout)e=We.setTimeout,t=We.clearTimeout;else{if(!We.WScript)throw new pt;e=function(e,t){We.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),On=Pn.setTimeout,Ln=Pn.clearTimeout;!function(){function e(t){if(o)On(function(){e(t)},0);else{var n=i[t];if(n){o=!0;var r=rt(n)();Sn(t),o=!1,r===nt&&c(r.e)}}}function n(){if(!We.postMessage||We.importScripts)return!1;var e=!1,t=We.onmessage;return We.onmessage=function(){e=!0},We.postMessage("","*"),We.onmessage=t,e}var r=1,i={},o=!1;Sn=function(e){delete i[e]};var s=new RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),a="function"==typeof(a=Ue&&He&&Ue.setImmediate)&&!s.test(a)&&a;if(tt(a))wn=function(t){var n=r++;return i[n]=t,a(function(){e(n)}),n};else if("undefined"!=typeof t&&"[object process]"==={}.toString.call(t))wn=function(n){var o=r++;return i[o]=n,t.nextTick(function(){e(o)}),o};else if(n()){var u="ms.rx.schedule"+Math.random(),h=function(t){"string"==typeof t.data&&t.data.substring(0,u.length)===u&&e(t.data.substring(u.length))};We.addEventListener("message",h,!1),wn=function(e){var t=r++;return i[t]=e,We.postMessage(u+t,"*"),t}}else if(We.MessageChannel){var l=new We.MessageChannel;l.port1.onmessage=function(t){e(t.data)},wn=function(e){var t=r++;return i[t]=e,l.port2.postMessage(t),t}}else wn="document"in We&&"onreadystatechange"in We.document.createElement("script")?function(t){var n=We.document.createElement("script"),o=r++;return i[o]=t,n.onreadystatechange=function(){e(o),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},We.document.documentElement.appendChild(n),o}:function(t){var n=r++;return i[n]=t,On(function(){e(n)},0),n}}();var Rn=function(e){function t(){e.call(this)}function n(e,t,n,r){return function(){e.setDisposable(an._fixup(t(n,r)))}}function r(e){this._id=e,this.isDisposed=!1}function i(e){this._id=e,this.isDisposed=!1}function o(e,t,n){return function(){t(e,n)}}return Qt(t,e),r.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Sn(this._id))},i.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Ln(this._id))},t.prototype.schedule=function(e,t){var i=new fn,o=wn(n(i,t,this,e));return new mn(i,new r(o))},t.prototype._scheduleFuture=function(e,t,r){if(0===t)return this.schedule(e,r);var o=new fn,s=On(n(o,r,this,e),t);return new mn(o,new i(s))},t.prototype.scheduleLongRunning=function(e,t){var n=un(Xe);return wn(o(e,t,n)),n},t}(_n),Nn=_n["default"]=_n.async=new Rn,Dn=function(e){function t(t,n){this._scheduler=t,this._handler=n,this._recursiveOriginal=null,this._recursiveWrapper=null,e.call(this)}return Qt(t,e),t.prototype.schedule=function(e,t){return this._scheduler.schedule(e,this._wrap(t))},t.prototype._scheduleFuture=function(e,t,n){return this._scheduler.schedule(e,t,this._wrap(n))},t.prototype.now=function(){return this._scheduler.now()},t.prototype._clone=function(e){return new t(e,this._handler)},t.prototype._wrap=function(e){var t=this;return function(n,r){var i=rt(e)(t._getRecursiveWrapper(n),r);return i===nt?(t._handler(i.e)||c(i.e),cn):pn(i)}},t.prototype._getRecursiveWrapper=function(e){if(this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},t.prototype.schedulePeriodic=function(e,t,n){var r=this,i=!1,o=new fn;return o.setDisposable(this._scheduler.schedulePeriodic(e,t,function(e){if(i)return null;var t=rt(n)(e);return t===nt?(i=!0,r._handler(t.e)||c(t.e),o.dispose(),null):t})),o},t}(_n),In=qe.Notification=function(){function e(){}return e.prototype._accept=function(e,t,n){throw new ft},e.prototype._acceptObserver=function(e,t,n){throw new ft},e.prototype.accept=function(e,t,n){return e&&"object"==typeof e?this._acceptObserver(e):this._accept(e,t,n)},e.prototype.toObservable=function(e){var t=this;return xn(e)||(e=Cn),new Ps(function(n){return e.schedule(t,function(e,t){t._acceptObserver(n),"N"===t.kind&&n.onCompleted()})})},e}(),kn=function(e){function t(e){this.value=e,this.kind="N"}return Qt(t,e),t.prototype._accept=function(e){return e(this.value)},t.prototype._acceptObserver=function(e){return e.onNext(this.value)},t.prototype.toString=function(){return"OnNext("+this.value+")"},t}(In),jn=function(e){function t(e){this.error=e,this.kind="E"}return Qt(t,e),t.prototype._accept=function(e,t){return t(this.error)},t.prototype._acceptObserver=function(e){return e.onError(this.error)},t.prototype.toString=function(){return"OnError("+this.error+")"},t}(In),Fn=function(e){function t(){this.kind="C"}return Qt(t,e),t.prototype._accept=function(e,t,n){return n()},t.prototype._acceptObserver=function(e){return e.onCompleted()},t.prototype.toString=function(){return"OnCompleted()"},t}(In),Bn=In.createOnNext=function(e){return new kn(e)},Vn=In.createOnError=function(e){return new jn(e)},Un=In.createOnCompleted=function(){return new Fn},Gn=qe.Observer=function(){};Gn.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},Gn.prototype.asObserver=function(){var e=this;return new Wn(function(t){e.onNext(t)},function(t){e.onError(t)},function(){e.onCompleted()})},Gn.prototype.checked=function(){return new qn(this)};var zn=Gn.create=function(e,t,n){return e||(e=Xe),t||(t=Qe),n||(n=Xe),new Wn(e,t,n)};Gn.fromNotifier=function(e,t){var n=_t(e,t,1);return new Wn(function(e){return n(Bn(e))},function(e){return n(Vn(e))},function(){return n(Un())})},Gn.prototype.notifyOn=function(e){return new Yn(e,this)},Gn.prototype.makeSafe=function(e){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,e)};var Hn,$n=qe.internals.AbstractObserver=function(e){function t(){this.isStopped=!1}return Qt(t,e),t.prototype.next=dt,t.prototype.error=dt,t.prototype.completed=dt,t.prototype.onNext=function(e){!this.isStopped&&this.next(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.error(e),!0)},t}(Gn),Wn=qe.AnonymousObserver=function(e){function t(t,n,r){e.call(this),this._onNext=t,this._onError=n,this._onCompleted=r}return Qt(t,e),t.prototype.next=function(e){this._onNext(e)},t.prototype.error=function(e){this._onError(e)},t.prototype.completed=function(){this._onCompleted()},t}($n),qn=function(e){function t(t){e.call(this),this._observer=t,this._state=0}Qt(t,e);var n=t.prototype;return n.onNext=function(e){this.checkAccess();var t=rt(this._observer.onNext).call(this._observer,e);this._state=0,t===nt&&c(t.e)},n.onError=function(e){this.checkAccess();var t=rt(this._observer.onError).call(this._observer,e);this._state=2,t===nt&&c(t.e)},n.onCompleted=function(){this.checkAccess();var e=rt(this._observer.onCompleted).call(this._observer);this._state=2,e===nt&&c(e.e)},n.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)},t}(Gn),Xn=qe.internals.ScheduledObserver=function(e){function t(t,n){e.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new dn}function n(e,t){return function(){e.onNext(t)}}function r(e,t){return function(){e.onError(t)}}function i(e){return function(){e.onCompleted()}}function o(e,t){var n;if(!(e.queue.length>0))return void(e.isAcquired=!1);n=e.queue.shift();var r=rt(n)();return r===nt?(e.queue=[],e.hasFaulted=!0,c(r.e)):void t(e)}return Qt(t,e),t.prototype.next=function(e){this.queue.push(n(this.observer,e))},t.prototype.error=function(e){this.queue.push(r(this.observer,e))},t.prototype.completed=function(){this.queue.push(i(this.observer))},t.prototype.ensureActive=function(){var e=!1;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(this,o))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}($n),Yn=function(e){function t(t,n,r){e.call(this,t,n),this._cancel=r}return Qt(t,e),t.prototype.next=function(t){e.prototype.next.call(this,t),this.ensureActive()},t.prototype.error=function(t){e.prototype.error.call(this,t),this.ensureActive()},t.prototype.completed=function(){e.prototype.completed.call(this),this.ensureActive()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},t}(Xn),Kn=qe.Observable=function(){function e(e,t){return function(n){var r=n.onError;return n.onError=function(t){h(t,e),r.call(n,t)},t.call(e,n)}}function t(){if(qe.config.longStackSupport&&it){var t=this._subscribe,n=rt(c)(new Error).e;this.stack=n.stack.substring(n.stack.indexOf("\n")+1),this._subscribe=e(this,t)}}return Hn=t.prototype,t.isObservable=function(e){return e&&tt(e.subscribe)},Hn.subscribe=Hn.forEach=function(e,t,n){return this._subscribe("object"==typeof e?e:zn(e,t,n))},Hn.subscribeOnNext=function(e,t){return this._subscribe(zn("undefined"!=typeof t?function(n){e.call(t,n)}:e))},Hn.subscribeOnError=function(e,t){return this._subscribe(zn(null,"undefined"!=typeof t?function(n){e.call(t,n)}:e))},Hn.subscribeOnCompleted=function(e,t){return this._subscribe(zn(null,null,"undefined"!=typeof t?function(){e.call(t)}:e))},t}(),Zn=qe.ObservableBase=function(e){function t(e){return e&&tt(e.dispose)?e:tt(e)?un(e):cn}function n(e,n){var r=n[0],i=n[1],o=rt(i.subscribeCore).call(i,r);o!==nt||r.fail(nt.e)||c(nt.e),r.setDisposable(t(o))}function r(){e.call(this)}return Qt(r,e),r.prototype._subscribe=function(e){var t=new Os(e),r=[t,this];return An.scheduleRequired()?An.schedule(r,n):n(null,r),t},r.prototype.subscribeCore=dt,r}(Kn),Jn=qe.FlatMapObservable=function(e){function t(t,n,r,i){this.resultSelector=tt(r)?r:null,this.selector=_t(tt(n)?n:function(){return n},i,3),this.source=t,e.call(this)}function n(e,t,n,r){this.i=0,this.selector=t,this.resultSelector=n,this.source=r,this.o=e,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.selector,this.resultSelector,this))},Qt(n,$n),n.prototype._wrapResult=function(e,t,n){return this.resultSelector?e.map(function(e,r){return this.resultSelector(t,e,n,r)},this):e},n.prototype.next=function(e){var t=this.i++,n=rt(this.selector)(e,t,this.source);return n===nt?this.o.onError(n.e):(et(n)&&(n=cr(n)),(yt(n)||gt(n))&&(n=Kn.from(n)),void this.o.onNext(this._wrapResult(n,e,t)))},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.o.onCompleted()},t}(Zn),Qn=qe.internals.Enumerable=function(){};P.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.isDisposed=!0)};var er=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(!e.isDisposed){var n=rt(e.e.next).call(e.e);if(n===nt)return e.o.onError(n.e);if(n.done)return e.o.onCompleted();var i=n.value;et(i)&&(i=cr(i));var o=new fn;e.subscription.setDisposable(o),o.setDisposable(i.subscribe(new r(e,t)))}}function r(e,t){this._state=e,this._recurse=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r={isDisposed:!1,o:e,subscription:t,e:this.sources[mt]()},i=An.scheduleRecursive(r,n);return new vn([t,i,new P(r)])},Qt(r,$n),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.o.onError(e)},r.prototype.completed=function(){this._recurse(this._state)},t}(Zn);Qn.prototype.concat=function(){return new er(this)};var tr=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(!e.isDisposed){var n=rt(e.e.next).call(e.e);if(n===nt)return e.o.onError(n.e);if(n.done)return null!==e.lastError?e.o.onError(e.lastError):e.o.onCompleted();var i=n.value;et(i)&&(i=cr(i));var o=new fn;e.subscription.setDisposable(o),o.setDisposable(i.subscribe(new r(e,t)))}}function r(e,t){this._state=e,this._recurse=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r={isDisposed:!1,e:this.sources[mt](),subscription:t,lastError:null,o:e},i=An.scheduleRecursive(r,n);return new vn([t,i,new P(r)])},Qt(r,$n),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.lastError=e,this._recurse(this._state)},r.prototype.completed=function(){this._state.o.onCompleted()},t}(Zn);Qn.prototype.catchError=function(){return new tr(this)};var nr=function(e){function t(e,t){this.v=e,this.c=null==t?-1:t}function n(e){this.v=e.v,this.l=e.c}return Qt(t,e),t.prototype[mt]=function(){return new n(this)},n.prototype.next=function(){return 0===this.l?vt:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(Qn),rr=Qn.repeat=function(e,t){return new nr(e,t)},ir=function(e){function t(e,t,n){this.s=e,this.fn=t?_t(t,n,3):null}function n(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return Qt(t,e),t.prototype[mt]=function(){return new n(this)},n.prototype.next=function(){return++this.ir?(e.onNext(t[r]),i(r+1)):e.onCompleted()}}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._scheduler.scheduleRecursive(0,n(e,this._args))},t}(Zn),br=Kn.fromArray=function(e,t){return xn(t)||(t=An),new _r(e,t)},xr=function(e){function t(t,n,r,i,o){this._initialState=t,this._cndFn=n,this._itrFn=r,this._resFn=i,this._s=o,e.call(this)}function n(e,t){if(e.first)e.first=!1;else if(e.newState=rt(e.self._itrFn)(e.newState),e.newState===nt)return e.o.onError(e.newState.e);var n=rt(e.self._cndFn)(e.newState);if(n===nt)return e.o.onError(n.e);if(n){var r=rt(e.self._resFn)(e.newState);if(r===nt)return e.o.onError(r.e);e.o.onNext(r),t(e)}else e.o.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,self:this,first:!0,newState:this._initialState};return this._s.scheduleRecursive(t,n)},t}(Zn);Kn.generate=function(e,t,n,r,i){return xn(i)||(i=An),new xr(e,t,n,r,i)},Kn.of=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return new _r(t,An)},Kn.ofWithScheduler=function(e){for(var t=arguments.length,n=new Array(t-1),r=1;t>r;r++)n[r-1]=arguments[r];return new _r(n,e)},Kn.ofArrayChanges=function(e){if(!Array.isArray(e))throw new TypeError("Array.observe only accepts arrays.");if("function"!=typeof Array.observe&&"function"!=typeof Array.unobserve)throw new TypeError("Array.observe is not supported on your platform");return new Ps(function(t){function n(e){for(var n=0,r=e.length;r>n;n++)t.onNext(e[n])}return Array.observe(e,n),function(){Array.unobserve(e,n)}})},Kn.ofObjectChanges=function(e){if(null==e)throw new TypeError("object must not be null or undefined.");if("function"!=typeof Object.observe&&"function"!=typeof Object.unobserve)throw new TypeError("Object.observe is not supported on your platform");return new Ps(function(t){function n(e){for(var n=0,r=e.length;r>n;n++)t.onNext(e[n])}return Object.observe(e,n),function(){Object.unobserve(e,n)}})};var wr=function(e){function t(){e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return cn},t}(Zn),Sr=new wr,Mr=Kn.never=function(){return Sr},Er=function(e){function t(t,n){this._o=t,this._keys=Object.keys(t),this._scheduler=n,e.call(this)}function n(e,t,n){return function(r,i){if(rr?(n.onNext(e+r),i(r+1)):n.onCompleted()}}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.scheduler.scheduleRecursive(0,n(this.start,this.rangeCount,e))},t}(Zn);Kn.range=function(e,t,n){return xn(n)||(n=An),new Cr(e,t,n)};var Tr=function(e){function t(t,n,r){this.value=t,this.repeatCount=null==n?-1:n,this.scheduler=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new B(e,this);return t.run()},t}(Zn);B.prototype.run=function(){function e(e,r){return(-1===e||e>0)&&(t.onNext(n),e>0&&e--),0===e?t.onCompleted():void r(e)}var t=this.observer,n=this.parent.value;return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount,e)},Kn.repeat=function(e,t,n){return xn(n)||(n=An),new Tr(e,t,n)};var Ar=function(e){function t(t,n){this._value=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];return r.onNext(n),r.onCompleted(),cn}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=[this._value,e];return this._scheduler===Cn?n(null,t):this._scheduler.schedule(t,n)},t}(Zn),Pr=(Kn["return"]=Kn.just=function(e,t){return xn(t)||(t=Cn),new Ar(e,t)},function(e){function t(t,n){this._error=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];return r.onError(n),cn}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=[this._error,e];return this._scheduler===Cn?n(null,t):this._scheduler.schedule(t,n)},t}(Zn)),Or=Kn["throw"]=function(e,t){return xn(t)||(t=Cn),new Pr(e,t)},Lr=function(e){function t(t,n){this._resFn=t,this._obsFn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=cn,n=rt(this._resFn)();if(n===nt)return new mn(Or(n.e).subscribe(e),t);n&&(t=n);var r=rt(this._obsFn)(n);return r===nt?new mn(Or(r.e).subscribe(e),t):new mn(r.subscribe(e),t)},t}(Zn);Kn.using=function(e,t){return new Lr(e,t)},Hn.amb=function(e){var t=this;return new Ps(function(n){function r(){o||(o=s,c.dispose())}function i(){o||(o=a,u.dispose())}var o,s="L",a="R",u=new fn,c=new fn;et(e)&&(e=cr(e));var h=zn(function(e){r(),o===s&&n.onNext(e)},function(e){r(),o===s&&n.onError(e)},function(){r(),o===s&&n.onCompleted()}),l=zn(function(e){i(),o===a&&n.onNext(e)},function(e){i(),o===a&&n.onError(e)},function(){i(),o===a&&n.onCompleted()});return u.setDisposable(t.subscribe(h)),c.setDisposable(e.subscribe(l)),new mn(u,c)})},Kn.amb=function(){var e,t=Mr();if(Array.isArray(arguments[0]))e=arguments[0];else{var n=arguments.length;e=new Array(e);for(var r=0;n>r;r++)e[r]=arguments[r]}for(var r=0,n=e.length;n>r;r++)t=V(t,e[r]);return t};var Rr=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn,n=new dn;return n.setDisposable(t),t.setDisposable(this.source.subscribe(new Nr(e,n,this._fn))),n},t}(Zn),Nr=function(e){function t(t,n,r){this._o=t,this._s=n,this._fn=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._o.onNext(e)},t.prototype.completed=function(){return this._o.onCompleted()},t.prototype.error=function(e){var t=rt(this._fn)(e);if(t===nt)return this._o.onError(t.e);et(t)&&(t=cr(t));var n=new fn;this._s.setDisposable(n),n.setDisposable(t.subscribe(this._o))},t}($n);Hn["catch"]=function(e){return tt(e)?new Rr(this,e):Dr([this,e])};var Dr=Kn["catch"]=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return or(e).catchError()};Hn.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),jr.apply(this,t)};var Ir=function(e){function t(t,n){this._params=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this._params.length,n=new Array(t),r={hasValue:E(t,U),hasValueAll:!1,isDone:E(t,U),values:new Array(t)},i=0;t>i;i++){var o=this._params[i],s=new fn;n[i]=s,et(o)&&(o=cr(o)),s.setDisposable(o.subscribe(new kr(e,i,this._cb,r)))}return new vn(n)},t}(Zn),kr=function(e){function t(t,n,r,i){this._o=t,this._i=n,this._cb=r,this._state=i,e.call(this)}function n(e){return function(t,n){return n!==e}}return Qt(t,e),t.prototype.next=function(e){if(this._state.values[this._i]=e,this._state.hasValue[this._i]=!0,this._state.hasValueAll||(this._state.hasValueAll=this._state.hasValue.every(Ye))){var t=rt(this._cb).apply(null,this._state.values);if(t===nt)return this._o.onError(t.e);this._o.onNext(t)}else this._state.isDone.filter(n(this._i)).every(Ye)&&this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._state.isDone[this._i]=!0,this._state.isDone.every(Ye)&&this._o.onCompleted()},t}($n),jr=Kn.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;return Array.isArray(t[0])&&(t=t[0]),new Ir(t,r)};Hn.concat=function(){for(var e=[],t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return e.unshift(this),Vr.apply(null,e)};var Fr=function(e){function t(t,n){this._s=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.o.onNext(e)},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.i++,this._fn(this._s)},t}($n),Br=function(e){function t(t){this._sources=t,e.call(this)}function n(e,t){if(!e.disposable.isDisposed){if(e.i===e.sources.length)return e.o.onCompleted();var n=e.sources[e.i];et(n)&&(n=cr(n));var r=new fn;e.subscription.setDisposable(r),r.setDisposable(n.subscribe(new Fr(e,t)))}}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r=un(Xe),i={o:e,i:0,subscription:t,disposable:r,sources:this._sources},o=Cn.scheduleRecursive(i,n);return new vn([t,r,o])},t}(Zn),Vr=Kn.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,n=arguments.length;n>t;t++)e[t]=arguments[t]}return new Br(e)};Hn.concatAll=function(){return this.merge(1)};var Ur=function(e){function t(t,n){this.source=t,this.maxConcurrent=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new on;return t.add(this.source.subscribe(new Gr(e,this.maxConcurrent,t))),t},t}(Zn),Gr=function(e){function t(t,n,r){this.o=t,this.max=n,this.g=r,this.done=!1,this.q=[],this.activeCount=0,e.call(this)}function n(t,n){this.parent=t,this.sad=n,e.call(this)}return Qt(t,e),t.prototype.handleSubscribe=function(e){var t=new fn;this.g.add(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new n(this,t)))},t.prototype.next=function(e){this.activeCount0?this.parent.handleSubscribe(this.parent.q.shift()):(this.parent.activeCount--,this.parent.done&&0===this.parent.activeCount&&this.parent.o.onCompleted())},t}($n);Hn.merge=function(e){return"number"!=typeof e?zr(this,e):new Ur(this,e)};var zr=Kn.merge=function(){var e,t,n=[],r=arguments.length;if(arguments[0])if(xn(arguments[0]))for(e=arguments[0],t=1;r>t;t++)n.push(arguments[t]);else for(e=Cn,t=0;r>t;t++)n.push(arguments[t]);else for(e=Cn,t=1;r>t;t++)n.push(arguments[t]);return Array.isArray(n[0])&&(n=n[0]),F(e,n).mergeAll()},Hr=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new on,n=new fn;return t.add(n),n.setDisposable(this.source.subscribe(new $r(e,t))),t},t}(Zn),$r=function(e){function t(t,n){this.o=t,this.g=n,this.done=!1,e.call(this)}function n(t,n){this.parent=t,this.sad=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=new fn;this.g.add(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new n(this,t)))},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.done=!0,1===this.g.length&&this.o.onCompleted()},Qt(n,e),n.prototype.next=function(e){this.parent.o.onNext(e)},n.prototype.error=function(e){this.parent.o.onError(e)},n.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.done&&1===this.parent.g.length&&this.parent.o.onCompleted()},t}($n);Hn.mergeAll=function(){return new Hr(this)};var Wr=qe.CompositeError=function(e){this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};Wr.prototype=Object.create(Error.prototype),Wr.prototype.name="CompositeError";var qr=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new on,n=new fn,r={isStopped:!1,errors:[],o:e};return t.add(n),n.setDisposable(this.source.subscribe(new Xr(t,r))),t},t}(Zn),Xr=function(e){function t(t,n){this._group=t,this._state=n,e.call(this)}function n(e,t){0===t.length?e.onCompleted():1===t.length?e.onError(t[0]):e.onError(new Wr(t))}function r(t,n,r){this._inner=t,this._group=n,this._state=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=new fn;this._group.add(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new r(t,this._group,this._state)))},t.prototype.error=function(e){this._state.errors.push(e),this._state.isStopped=!0,1===this._group.length&&n(this._state.o,this._state.errors)},t.prototype.completed=function(){this._state.isStopped=!0,1===this._group.length&&n(this._state.o,this._state.errors)},Qt(r,e),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.errors.push(e),this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&n(this._state.o,this._state.errors)},r.prototype.completed=function(){this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&n(this._state.o,this._state.errors)},t}($n);Kn.mergeDelayError=function(){
-var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}var r=F(null,e);return new qr(r)},Hn.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return Zr([this,e])};var Yr=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(e.posn;n++)e[n]=arguments[n]}return new Yr(e)},Jr=function(e){function t(t,n){this._s=t,this._o=et(n)?cr(n):n,this._open=!1,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn;t.setDisposable(this._s.subscribe(new Qr(e,this))),et(this._o)&&(this._o=cr(this._o));var n=new fn;return n.setDisposable(this._o.subscribe(new ei(e,this,n))),new mn(t,n)},t}(Zn),Qr=function(e){function t(t,n){this._o=t,this._p=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._p._open&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=function(){this._p._open&&this._o.onCompleted()},t}($n),ei=function(e){function t(t,n,r){this._o=t,this._p=n,this._r=r,e.call(this)}return Qt(t,e),t.prototype.next=function(){this._p._open=!0,this._r.dispose()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=function(){this._r.dispose()},t}($n);Hn.skipUntil=function(e){return new Jr(this,e)};var ti=function(e){function t(t){this.source=t,e.call(this)}function n(e,t){this.o=e,this.inner=t,this.stopped=!1,this.latest=0,this.hasLatest=!1,$n.call(this)}function r(e,t){this.parent=e,this.id=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r=this.source.subscribe(new n(e,t));return new mn(r,t)},Qt(n,$n),n.prototype.next=function(e){var t=new fn,n=++this.latest;this.hasLatest=!0,this.inner.setDisposable(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new r(this,n)))},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.stopped=!0,!this.hasLatest&&this.o.onCompleted()},Qt(r,$n),r.prototype.next=function(e){this.parent.latest===this.id&&this.parent.o.onNext(e)},r.prototype.error=function(e){this.parent.latest===this.id&&this.parent.o.onError(e)},r.prototype.completed=function(){this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.stopped&&this.parent.o.onCompleted())},t}(Zn);Hn["switch"]=Hn.switchLatest=function(){return new ti(this)};var ni=function(e){function t(t,n){this.source=t,this.other=et(n)?cr(n):n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this.source.subscribe(e),this.other.subscribe(new ri(e)))},t}(Zn),ri=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(){this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=Xe,t}($n);Hn.takeUntil=function(e){return new ni(this,e)};var ii=function(e){function t(t,n,r){this._s=t,this._ss=n,this._cb=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this._ss.length,n={hasValue:E(t,U),hasValueAll:!1,values:new Array(t)},r=this._ss.length,i=new Array(r+1),o=0;r>o;o++){var s=this._ss[o],a=new fn;et(s)&&(s=cr(s)),a.setDisposable(s.subscribe(new oi(e,o,n))),i[o]=a}var u=new fn;return u.setDisposable(this._s.subscribe(new si(e,this._cb,n))),i[r]=u,new vn(i)},t}(Zn),oi=function(e){function t(t,n,r){this._o=t,this._i=n,this._state=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._state.values[this._i]=e,this._state.hasValue[this._i]=!0,this._state.hasValueAll=this._state.hasValue.every(Ye)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=Xe,t}($n),si=function(e){function t(t,n,r){this._o=t,this._cb=n,this._state=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=[e].concat(this._state.values);if(this._state.hasValueAll){var n=rt(this._cb).apply(null,t);return n===nt?this._o.onError(n.e):void this._o.onNext(n)}},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.withLatestFrom=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;return Array.isArray(t[0])&&(t=t[0]),new ii(this,t,r)};var ai=function(e){function t(t,n){this._s=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this._s.length,n=new Array(t),r=E(t,U),i=E(t,z),o=0;t>o;o++){var s=this._s[o],a=new fn;n[o]=a,et(s)&&(s=cr(s)),a.setDisposable(s.subscribe(new ui(e,o,this,i,r)))}return new vn(n)},t}(Zn),ui=function(e){function t(t,n,r,i,o){this._o=t,this._i=n,this._p=r,this._q=i,this._d=o,e.call(this)}function n(e){return e.length>0}function r(e){return e.shift()}function i(e){return function(t,n){return n!==e}}return Qt(t,e),t.prototype.next=function(e){if(this._q[this._i].push(e),this._q.every(n)){var t=this._q.map(r),o=rt(this._p._cb).apply(null,t);if(o===nt)return this._o.onError(o.e);this._o.onNext(o)}else this._d.filter(i(this._i)).every(Ye)&&this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._d[this._i]=!0,this._d.every(Ye)&&this._o.onCompleted()},t}($n);Hn.zip=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;Array.isArray(t[0])&&(t=t[0]);var i=this;return t.unshift(i),new ai(t,r)},Kn.zip=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];Array.isArray(t[0])&&(t=tt(t[1])?t[0].concat(t[1]):t[0]);var r=t.shift();return r.zip.apply(r,t)};var ci=function(e){function t(t,n){this.sources=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this.sources,n=t.length,r=new Array(n),i={q:E(n,z),done:E(n,U),cb:this._cb,o:e},o=0;n>o;o++)!function(e){var n=t[e],o=new fn;(yt(n)||gt(n))&&(n=yr(n)),r[e]=o,o.setDisposable(n.subscribe(new hi(i,e)))}(o);return new vn(r)},t}(Zn),hi=function(e){function t(t,n){this._s=t,this._i=n,e.call(this)}function n(e){return e.length>0}function r(e){return e.shift()}function i(e){return function(t,n){return n!==e}}return Qt(t,e),t.prototype.next=function(e){if(this._s.q[this._i].push(e),this._s.q.every(n)){var t=this._s.q.map(r),o=rt(this._s.cb).apply(null,t);if(o===nt)return this._s.o.onError(o.e);this._s.o.onNext(o)}else this._s.done.filter(i(this._i)).every(Ye)&&this._s.o.onCompleted()},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.done[this._i]=!0,this._s.done.every(Ye)&&this._s.o.onCompleted()},t}($n);Hn.zipIterable=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G,i=this;return t.unshift(i),new ci(t,r)},Hn.asObservable=function(){return new Ps(H(this),this)},Hn.bufferWithCount=Hn.bufferCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).flatMap($).filter(W)};var li=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new pi(e))},t}(Zn),pi=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(e){e.accept(this._o)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.dematerialize=function(){return new li(this)};var fi=function(e){function t(t,n,r){this.source=t,this.keyFn=n,this.comparer=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new di(e,this.keyFn,this.comparer))},t}(Zn),di=function(e){function t(t,n,r){this.o=t,this.keyFn=n,this.comparer=r,this.hasCurrentKey=!1,this.currentKey=null,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t,n=e;return tt(this.keyFn)&&(n=rt(this.keyFn)(e),n===nt)?this.o.onError(n.e):this.hasCurrentKey&&(t=rt(this.comparer)(this.currentKey,n),t===nt)?this.o.onError(t.e):void(this.hasCurrentKey&&t||(this.hasCurrentKey=!0,this.currentKey=n,this.o.onNext(e)))},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.o.onCompleted()},t}($n);Hn.distinctUntilChanged=function(e,t){return t||(t=Ze),new fi(this,e,t)};var mi=function(e){function t(t,n,r,i){this.source=t,this._oN=n,this._oE=r,this._oC=i,e.call(this)}function n(e,t){this.o=e,this.t=!t._oN||tt(t._oN)?zn(t._oN||Xe,t._oE||Xe,t._oC||Xe):t._oN,this.isStopped=!1,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this))},Qt(n,$n),n.prototype.next=function(e){var t=rt(this.t.onNext).call(this.t,e);t===nt&&this.o.onError(t.e),this.o.onNext(e)},n.prototype.error=function(e){var t=rt(this.t.onError).call(this.t,e);return t===nt?this.o.onError(t.e):void this.o.onError(e)},n.prototype.completed=function(){var e=rt(this.t.onCompleted).call(this.t);return e===nt?this.o.onError(e.e):void this.o.onCompleted()},t}(Zn);Hn["do"]=Hn.tap=Hn.doAction=function(e,t,n){return new mi(this,e,t,n)},Hn.doOnNext=Hn.tapOnNext=function(e,t){return this.tap("undefined"!=typeof t?function(n){e.call(t,n)}:e)},Hn.doOnError=Hn.tapOnError=function(e,t){return this.tap(Xe,"undefined"!=typeof t?function(n){e.call(t,n)}:e)},Hn.doOnCompleted=Hn.tapOnCompleted=function(e,t){return this.tap(Xe,null,"undefined"!=typeof t?function(){e.call(t)}:e)};var vi=function(e){function t(t,n,r){this.source=t,this._fn=_t(n,r,0),e.call(this)}function n(e,t){this.isDisposed=!1,this._s=e,this._fn=t}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=rt(this.source.subscribe).call(this.source,e);return t===nt&&(this._fn(),c(t.e)),new n(t,this._fn)},n.prototype.dispose=function(){if(!this.isDisposed){var e=rt(this._s.dispose).call(this._s);this._fn(),e===nt&&c(e.e)}},t}(Zn);Hn["finally"]=function(e,t){return new vi(this,e,t)};var gi=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.isStopped=!1}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},n.prototype.onNext=Xe,n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},t}(Zn);Hn.ignoreElements=function(){return new gi(this)};var yi=function(e){function t(t,n){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new _i(e))},t}(Zn),_i=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._o.onNext(Bn(e))},t.prototype.error=function(e){this._o.onNext(Vn(e)),this._o.onCompleted()},t.prototype.completed=function(){this._o.onNext(Un()),this._o.onCompleted()},t}($n);Hn.materialize=function(){return new yi(this)},Hn.repeat=function(e){return rr(this,e).concat()},Hn.retry=function(e){return rr(this,e).catchError()};var bi=function(e){function t(e){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,e.isDisposed=!0)}}}function n(t,n){this.source=t,this._notifier=n,e.call(this)}return Qt(n,e),n.prototype.subscribeCore=function(e){var n,r=new Ns,i=new Ns,o=this._notifier(r),s=o.subscribe(i),a=this.source["@@iterator"](),u={isDisposed:!1},c=new dn,h=An.scheduleRecursive(null,function(t,o){if(!u.isDisposed){var s=a.next();if(s.done)return void(n?e.onError(n):e.onCompleted());var h=s.value;et(h)&&(h=cr(h));var l=new fn,p=new fn;c.setDisposable(new mn(p,l)),l.setDisposable(h.subscribe(function(t){e.onNext(t)},function(t){p.setDisposable(i.subscribe(o,function(t){e.onError(t)},function(){e.onCompleted()})),r.onNext(t),l.dispose()},function(){e.onCompleted()}))}});return new vn([s,c,h,t(u)])},n}(Zn);Hn.retryWhen=function(e){return new bi(q(this),e)};var xi=function(e){function t(e){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,e.isDisposed=!0)}}}function n(t,n){this.source=t,this._notifier=n,e.call(this)}return Qt(n,e),n.prototype.subscribeCore=function(e){var n,r=new Ns,i=new Ns,o=this._notifier(r),s=o.subscribe(i),a=this.source["@@iterator"](),u={isDisposed:!1},c=new dn,h=An.scheduleRecursive(null,function(t,o){if(!u.isDisposed){var s=a.next();if(s.done)return void(n?e.onError(n):e.onCompleted());var h=s.value;et(h)&&(h=cr(h));var l=new fn,p=new fn;c.setDisposable(new mn(p,l)),l.setDisposable(h.subscribe(function(t){e.onNext(t)},function(t){e.onError(t)},function(){p.setDisposable(i.subscribe(o,function(t){e.onError(t)},function(){e.onCompleted()})),r.onNext(null),l.dispose()}))}});return new vn([s,c,h,t(u)])},n}(Zn);Hn.repeatWhen=function(e){return new xi(q(this),e)};var wi=function(e){function t(t,n,r,i){this.source=t,this.accumulator=n,this.hasSeed=r,this.seed=i,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Si(e,this))},t}(Zn),Si=function(e){function t(t,n){this._o=t,this._p=n,this._fn=n.accumulator,this._hs=n.hasSeed,this._s=n.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){return!this._hv&&(this._hv=!0),this._ha?this._a=rt(this._fn)(this._a,e,this._i,this._p):(this._a=this._hs?rt(this._fn)(this._s,e,this._i,this._p):e,this._ha=!0),this._a===nt?this._o.onError(this._a.e):(this._o.onNext(this._a),void this._i++)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){!this._hv&&this._hs&&this._o.onNext(this._s),this._o.onCompleted()},t}($n);Hn.scan=function(){var e,t=!1,n=arguments[0];return 2===arguments.length&&(t=!0,e=arguments[1]),new wi(this,n,t,e)};var Mi=function(e){function t(t,n){this.source=t,this._c=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Ei(e,this._c))},t}(Zn),Ei=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._o.onNext(this._q.shift())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipLast=function(e){if(0>e)throw new lt;return new Mi(this,e)},Hn.startWith=function(){var e,t=0;arguments.length&&xn(arguments[0])?(e=arguments[0],t=1):e=Cn;for(var n=[],r=t,i=arguments.length;i>r;r++)n.push(arguments[r]);return Vr.apply(null,[br(n,e),this])};var Ci=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._q.shift()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){for(;this._q.length>0;)this._o.onNext(this._q.shift());this._o.onCompleted()},t}($n);Hn.takeLast=function(e){if(0>e)throw new lt;var t=this;return new Ps(function(n){return t.subscribe(new Ci(n,e))},t)};var Ti=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._q.shift()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},t}($n);Hn.takeLastBuffer=function(e){if(0>e)throw new lt;var t=this;return new Ps(function(n){return t.subscribe(new Ti(n,e))},t)},Hn.windowWithCount=Hn.windowCount=function(e,t){var n=this;if(+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new lt;if(null==t&&(t=e),+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new lt;return new Ps(function(r){function i(){var e=new Ns;u.push(e),r.onNext(tn(e,s))}var o=new fn,s=new gn(o),a=0,u=[];return i(),o.setDisposable(n.subscribe(function(n){for(var r=0,o=u.length;o>r;r++)u[r].onNext(n);var s=a-e+1;s>=0&&s%t===0&&u.shift().onCompleted(),++a%t===0&&i()},function(e){for(;u.length>0;)u.shift().onError(e);r.onError(e)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),s},n)},Hn.selectConcat=Hn.concatMap=function(e,t,n){return tt(e)&&tt(t)?this.concatMap(function(n,r){var i=e(n,r);return et(i)&&(i=cr(i)),(yt(i)||gt(i))&&(i=yr(i)),i.map(function(e,i){return t(n,e,r,i)})}):tt(e)?X(this,e,n):X(this,function(){return e})},Hn.concatMapObserver=Hn.selectConcatObserver=function(e,t,n,r){var i=this,o=_t(e,r,2),s=_t(t,r,1),a=_t(n,r,0);return new Ps(function(e){var t=0;return i.subscribe(function(n){var r;try{r=o(n,t++)}catch(i){return void e.onError(i)}et(r)&&(r=cr(r)),e.onNext(r)},function(t){var n;try{n=s(t)}catch(r){return void e.onError(r)}et(n)&&(n=cr(n)),e.onNext(n),e.onCompleted()},function(){var t;try{t=a()}catch(n){return void e.onError(n)}et(t)&&(t=cr(t)),e.onNext(t),e.onCompleted()})},this).concatAll()};var Ai=function(e){function t(t,n){this._o=t,this._d=n,this._f=!1,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._f=!0,this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},t}($n);Hn.defaultIfEmpty=function(e){var t=this;return e===o&&(e=null),new Ps(function(n){return t.subscribe(new Ai(n,e))},t)},K.prototype.push=function(e){var t=-1===Y(this.set,e,this.comparer);return t&&this.set.push(e),t};var Pi=function(e){function t(t,n,r){this.source=t,this._keyFn=n,this._cmpFn=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Oi(e,this._keyFn,this._cmpFn))},t}(Zn),Oi=function(e){function t(t,n,r){this._o=t,this._keyFn=n,this._h=new K(r),e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=e;return tt(this._keyFn)&&(t=rt(this._keyFn)(e),t===nt)?this._o.onError(t.e):void(this._h.push(t)&&this._o.onNext(e))},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.distinct=function(e,t){return t||(t=Ze),new Pi(this,e,t)},Hn.groupBy=function(e,t){return this.groupByUntil(e,t,Mr)},Hn.groupByUntil=function(e,t,n){var r=this;return new Ps(function(i){var s=new Wo,a=new on,u=new gn(a),c=function(e){return function(t){t.onError(e)}};return a.add(r.subscribe(function(r){var h=rt(e)(r);if(h===nt)return s.forEach(c(h.e)),i.onError(h.e);var l=!1,p=s.get(h);if(p===o&&(p=new Ns,s.set(h,p),l=!0),l){var f=new Rs(h,p,u),d=new Rs(h,p),m=rt(n)(d);if(m===nt)return s.forEach(c(m.e)),i.onError(m.e);i.onNext(f);var v=new fn;a.add(v),v.setDisposable(m.take(1).subscribe(Xe,function(e){s.forEach(c(e)),i.onError(e)},function(){s["delete"](h)&&p.onCompleted(),a.remove(v)}))}var g=r;return tt(t)&&(g=rt(t)(r),g===nt)?(s.forEach(c(g.e)),i.onError(g.e)):void p.onNext(g)},function(e){s.forEach(c(e)),i.onError(e)},function(){s.forEach(function(e){e.onCompleted()}),i.onCompleted()})),u},r)};var Li=function(e){function t(t,n,r){this.source=t,this.selector=_t(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return e.call(this,t.selector(n,r,i),r,i)}}function r(e,t,n){this.o=e,this.selector=t,this.source=n,this.i=0,$n.call(this)}return Qt(t,e),t.prototype.internalMap=function(e,r){return new t(this.source,n(e,this),r)},t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.selector,this))},Qt(r,$n),r.prototype.next=function(e){var t=rt(this.selector)(e,this.i++,this.source);return t===nt?this.o.onError(t.e):void this.o.onNext(t)},r.prototype.error=function(e){this.o.onError(e)},r.prototype.completed=function(){this.o.onCompleted()},t}(Zn);Hn.map=Hn.select=function(e,t){var n="function"==typeof e?e:function(){return e};return this instanceof Li?this.internalMap(n,t):new Li(this,n,t)},Hn.pluck=function(){var e=arguments.length,t=new Array(e);if(0===e)throw new Error("List of properties cannot be empty.");for(var n=0;e>n;n++)t[n]=arguments[n];return this.map(Z(t,e))},Hn.flatMap=Hn.selectMany=Hn.mergeMap=function(e,t,n){return new Jn(this,e,t,n).mergeAll()},Hn.flatMapObserver=Hn.selectManyObserver=function(e,t,n,r){var i=this;return new Ps(function(o){var s=0;return i.subscribe(function(t){var n;try{n=e.call(r,t,s++)}catch(i){return void o.onError(i)}et(n)&&(n=cr(n)),o.onNext(n)},function(e){var n;try{n=t.call(r,e)}catch(i){return void o.onError(i)}et(n)&&(n=cr(n)),o.onNext(n),o.onCompleted()},function(){var e;try{e=n.call(r)}catch(t){return void o.onError(t)}et(e)&&(e=cr(e)),o.onNext(e),o.onCompleted()})},i).mergeAll()},Hn.flatMapLatest=Hn.switchMap=function(e,t,n){return new Jn(this,e,t,n).switchLatest()};var Ri=function(e){function t(t,n){this.source=t,this._count=n,e.call(this)}function n(e,t){this._o=e,this._r=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this._count))},Qt(n,$n),n.prototype.next=function(e){this._r<=0?this._o.onNext(e):this._r--},n.prototype.error=function(e){this._o.onError(e)},n.prototype.completed=function(){this._o.onCompleted()},t}(Zn);Hn.skip=function(e){if(0>e)throw new lt;return new Ri(this,e)};var Ni=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Di(e,this))},t}(Zn),Di=function(e){function t(t,n){this._o=t,this._p=n,this._i=0,this._r=!1,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(!this._r){var t=rt(this._p._fn)(e,this._i++,this._p);if(t===nt)return this._o.onError(t.e);this._r=!t}this._r&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipWhile=function(e,t){var n=_t(e,t,3);return new Ni(this,n)};var Ii=function(e){function t(t,n){this.source=t,this._count=n,e.call(this)}function n(e,t){this._o=e,this._c=t,this._r=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this._count))},Qt(n,$n),n.prototype.next=function(e){this._r-- >0&&(this._o.onNext(e),this._r<=0&&this._o.onCompleted())},n.prototype.error=function(e){this._o.onError(e)},n.prototype.completed=function(){this._o.onCompleted()},t}(Zn);Hn.take=function(e,t){if(0>e)throw new lt;return 0===e?mr(t):new Ii(this,e)};var ki=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new ji(e,this))},t}(Zn),ji=function(e){function t(t,n){this._o=t,this._p=n,this._i=0,this._r=!0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){return this._r&&(this._r=rt(this._p._fn)(e,this._i++,this._p),this._r===nt)?this._o.onError(this._r.e):void(this._r?this._o.onNext(e):this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.takeWhile=function(e,t){var n=_t(e,t,3);return new ki(this,n)};var Fi=function(e){function t(t,n,r){this.source=t,this.predicate=_t(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return t.predicate(n,r,i)&&e.call(this,n,r,i)}}function r(e,t,n){this.o=e,this.predicate=t,this.source=n,this.i=0,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.predicate,this))},t.prototype.internalFilter=function(e,r){return new t(this.source,n(e,this),r)},Qt(r,$n),r.prototype.next=function(e){var t=rt(this.predicate)(e,this.i++,this.source);return t===nt?this.o.onError(t.e):void(t&&this.o.onNext(e))},r.prototype.error=function(e){this.o.onError(e)},r.prototype.completed=function(){this.o.onCompleted()},t}(Zn);Hn.filter=Hn.where=function(e,t){return this instanceof Fi?this.internalFilter(e,t):new Fi(this,e,t)};var Bi=function(e){function t(t,n,r){this.source=t,this._k=n,this._c=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Vi(e,this._k,this._c))},t}(Zn),Vi=function(e){function t(t,n,r){this._o=t,this._k=n,this._c=r,this._v=null,this._hv=!1,this._l=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._k)(e);if(t===nt)return this._o.onError(t.e);var n=0;if(this._hv){if(n=rt(this._c)(t,this._v),n===nt)return this._o.onError(n.e)}else this._hv=!0,this._v=t;n>0&&(this._v=t,this._l=[]),n>=0&&this._l.push(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._l),this._o.onCompleted()},t}($n),Ui=function(e){function t(t,n,r,i){this.source=t,this.accumulator=n,this.hasSeed=r,this.seed=i,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Gi(e,this))},t}(Zn),Gi=function(e){function t(t,n){this._o=t,this._p=n,this._fn=n.accumulator,this._hs=n.hasSeed,this._s=n.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){return!this._hv&&(this._hv=!0),this._ha?this._a=rt(this._fn)(this._a,e,this._i,this._p):(this._a=this._hs?rt(this._fn)(this._s,e,this._i,this._p):e,this._ha=!0),this._a===nt?this._o.onError(this._a.e):void this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv&&this._o.onNext(this._a),!this._hv&&this._hs&&this._o.onNext(this._s),!this._hv&&!this._hs&&this._o.onError(new ct),this._o.onCompleted()},t}($n);Hn.reduce=function(){var e,t=!1,n=arguments[0];return 2===arguments.length&&(t=!0,e=arguments[1]),new Ui(this,n,t,e)};var zi=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Hi(e,this._fn,this.source))},t}(Zn),Hi=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._fn)(e,this._i++,this._s);return t===nt?this._o.onError(t.e):void(Boolean(t)&&(this._o.onNext(!0),this._o.onCompleted()))},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},t}($n);Hn.some=function(e,t){var n=_t(e,t,3);return new zi(this,n)};var $i=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Wi(e))},t}(Zn),Wi=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(){this._o.onNext(!1),this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},t}($n);Hn.isEmpty=function(){return new $i(this)};var qi=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Xi(e,this._fn,this.source))},t}(Zn),Xi=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._fn)(e,this._i++,this._s);return t===nt?this._o.onError(t.e):void(Boolean(t)||(this._o.onNext(!1),this._o.onCompleted()))},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},t}($n);Hn.every=function(e,t){var n=_t(e,t,3);return new qi(this,n)};var Yi=function(e){function t(t,n,r){var i=+r||0;Math.abs(i)===1/0&&(i=0),this.source=t,this._elem=n,this._n=i,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._n<0?(e.onNext(!1),e.onCompleted(),cn):this.source.subscribe(new Ki(e,this._elem,this._n))},t}(Zn),Ki=function(e){function t(t,n,r){this._o=t,this._elem=n,this._n=r,this._i=0,e.call(this)}function n(e,t){return 0===e&&0===t||e===t||isNaN(e)&&isNaN(t)}return Qt(t,e),t.prototype.next=function(e){this._i++>=this._n&&n(e,this._elem)&&(this._o.onNext(!0),this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},t}($n);Hn.includes=function(e,t){return new Yi(this,e,t)};var Zi=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Ji(e,this._fn,this.source))},t}(Zn),Ji=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,this._c=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._fn){var t=rt(this._fn)(e,this._i++,this._s);if(t===nt)return this._o.onError(t.e);Boolean(t)&&this._c++}else this._c++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},t}($n);Hn.count=function(e,t){var n=_t(e,t,3);return new Zi(this,n)};var Qi=function(e){function t(t,n,r){this.source=t,this._e=n,this._n=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._n<0?(e.onNext(-1),e.onCompleted(),cn):this.source.subscribe(new eo(e,this._e,this._n))},t}(Zn),eo=function(e){function t(t,n,r){this._o=t,this._e=n,this._n=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._i>=this._n&&e===this._e&&(this._o.onNext(this._i),this._o.onCompleted()),this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(-1),this._o.onCompleted()},t}($n);Hn.indexOf=function(e,t){var n=+t||0;return Math.abs(n)===1/0&&(n=0),new Qi(this,e,n)};var to=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new no(e,this._fn,this.source))},t}(Zn),no=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,this._c=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._fn){var t=rt(this._fn)(e,this._i++,this._s);if(t===nt)return this._o.onError(t.e);this._c+=t}else this._c+=e},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},t}($n);Hn.sum=function(e,t){var n=_t(e,t,3);return new to(this,n)},Hn.minBy=function(e,t){return t||(t=Je),new Bi(this,e,function(e,n){return-1*t(e,n)})},Hn.min=function(e){return this.minBy(Ye,e).map(J)},Hn.maxBy=function(e,t){return t||(t=Je),new Bi(this,e,t)},Hn.max=function(e){return this.maxBy(Ye,e).map(J)};var ro=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new io(e,this._fn,this.source))},t}(Zn),io=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._c=0,this._t=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._fn){var t=rt(this._fn)(e,this._c++,this._s);if(t===nt)return this._o.onError(t.e);this._t+=t}else this._c++,this._t+=e},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){return 0===this._c?this._o.onError(new ct):(this._o.onNext(this._t/this._c),void this._o.onCompleted())},t}($n);Hn.average=function(e,t){var n,r=this;return tt(e)&&(n=_t(e,t,3)),new ro(r,n)},Hn.sequenceEqual=function(e,t){var n=this;return t||(t=Ze),new Ps(function(r){var i=!1,o=!1,s=[],a=[],u=n.subscribe(function(e){if(a.length>0){var n=a.shift(),i=rt(t)(n,e);if(i===nt)return r.onError(i.e);i||(r.onNext(!1),r.onCompleted())}else o?(r.onNext(!1),r.onCompleted()):s.push(e)},function(e){r.onError(e)},function(){i=!0,0===s.length&&(a.length>0?(r.onNext(!1),r.onCompleted()):o&&(r.onNext(!0),r.onCompleted()));
-});(yt(e)||gt(e))&&(e=yr(e)),et(e)&&(e=cr(e));var c=e.subscribe(function(e){if(s.length>0){var n=s.shift(),o=rt(t)(n,e);if(o===nt)return r.onError(o.e);o||(r.onNext(!1),r.onCompleted())}else i?(r.onNext(!1),r.onCompleted()):a.push(e)},function(e){r.onError(e)},function(){o=!0,0===a.length&&(s.length>0?(r.onNext(!1),r.onCompleted()):i&&(r.onNext(!0),r.onCompleted()))});return new mn(u,c)},n)};var oo=function(e){function t(t,n,r){this.source=t,this._i=n,this._d=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new so(e,this._i,this._d))},t}(Zn),so=function(e){function t(t,n,r){this._o=t,this._i=n,this._d=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){0===this._i--&&(this._o.onNext(e),this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._d===o?this._o.onError(new lt):(this._o.onNext(this._d),this._o.onCompleted())},t}($n);Hn.elementAt=function(e,t){if(0>e)throw new lt;return new oo(this,e,t)};var ao=function(e){function t(t,n,r){this._o=t,this._obj=n,this._s=r,this._i=0,this._hv=!1,this._v=null,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=!1;if(this._obj.predicate){var n=rt(this._obj.predicate)(e,this._i++,this._s);if(n===nt)return this._o.onError(n.e);Boolean(n)&&(t=!0)}else this._obj.predicate||(t=!0);if(t){if(this._hv)return this._o.onError(new Error("Sequence contains more than one matching element"));this._hv=!0,this._v=e}},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===o?this._o.onError(new ct):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},t}($n);Hn.single=function(e,t){var n={},r=this;if(n="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},tt(n.predicate)){var i=n.predicate;n.predicate=_t(i,n.thisArg,3)}return new Ps(function(e){return r.subscribe(new ao(e,n,r))},r)};var uo=function(e){function t(t,n){this.source=t,this._obj=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new co(e,this._obj,this.source))},t}(Zn),co=function(e){function t(t,n,r){this._o=t,this._obj=n,this._s=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._obj.predicate){var t=rt(this._obj.predicate)(e,this._i++,this._s);if(t===nt)return this._o.onError(t.e);Boolean(t)&&(this._o.onNext(e),this._o.onCompleted())}else this._obj.predicate||(this._o.onNext(e),this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._obj.defaultValue===o?this._o.onError(new ct):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},t}($n);Hn.first=function(){var e={};if(e="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},tt(e.predicate)){var t=e.predicate;e.predicate=_t(t,e.thisArg,3)}return new uo(this,e)};var ho=function(e){function t(t,n){this.source=t,this._obj=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new lo(e,this._obj,this.source))},t}(Zn),lo=function(e){function t(t,n,r){this._o=t,this._obj=n,this._s=r,this._i=0,this._hv=!1,this._v=null,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=!1;if(this._obj.predicate){var n=rt(this._obj.predicate)(e,this._i++,this._s);if(n===nt)return this._o.onError(n.e);Boolean(n)&&(t=!0)}else this._obj.predicate||(t=!0);t&&(this._hv=!0,this._v=e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===o?this._o.onError(new ct):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},t}($n);Hn.last=function(){var e={};if(e="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},tt(e.predicate)){var t=e.predicate;e.predicate=_t(t,e.thisArg,3)}return new ho(this,e)};var po=function(e){function t(t,n,r,i){this._o=t,this._s=n,this._cb=r,this._y=i,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._cb)(e,this._i,this._s);return t===nt?this._o.onError(t.e):void(t?(this._o.onNext(this._y?this._i:e),this._o.onCompleted()):this._i++)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._y&&this._o.onNext(-1),this._o.onCompleted()},t}($n);Hn.find=function(e,t){return Q(this,e,t,!1)},Hn.findIndex=function(e,t){return Q(this,e,t,!0)};var fo=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new mo(e))},t}(Zn),mo=function(e){function t(t){this._o=t,this._s=new We.Set,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.add(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._s),this._o.onCompleted()},t}($n);Hn.toSet=function(){if("undefined"==typeof We.Set)throw new TypeError;return new fo(this)};var vo=function(e){function t(t,n,r){this.source=t,this._k=n,this._e=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new go(e,this._k,this._e))},t}(Zn),go=function(e){function t(t,n,r){this._o=t,this._k=n,this._e=r,this._m=new We.Map,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._k)(e);if(t===nt)return this._o.onError(t.e);var n=e;return this._e&&(n=rt(this._e)(e),n===nt)?this._o.onError(n.e):void this._m.set(t,n)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._m),this._o.onCompleted()},t}($n);Hn.toMap=function(e,t){if("undefined"==typeof We.Map)throw new TypeError;return new vo(this,e,t)};var yo=function(e){function t(t,n,r){this.source=t,this._b=n,this._e=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new _o(e,this._b,this._e))},t}(Zn),_o=function(e){function t(t,n,r){this._o=t,this._b=n,this._e=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._i>=this._b&&(this._e===this._i?this._o.onCompleted():this._o.onNext(e)),this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.slice=function(e,t){var n=e||0;if(0>n)throw new qe.ArgumentOutOfRangeError;if("number"==typeof t&&n>t)throw new qe.ArgumentOutOfRangeError;return new yo(this,n,t)};var bo=function(e){function t(t,n,r){this.source=t,this._e=n,this._n=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._n<0?(e.onNext(-1),e.onCompleted(),cn):this.source.subscribe(new xo(e,this._e,this._n))},t}(Zn),xo=function(e){function t(t,n,r){this._o=t,this._e=n,this._n=r,this._v=0,this._hv=!1,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._i>=this._n&&e===this._e&&(this._hv=!0,this._v=this._i),this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv?this._o.onNext(this._v):this._o.onNext(-1),this._o.onCompleted()},t}($n);Hn.lastIndexOf=function(e,t){var n=+t||0;return Math.abs(n)===1/0&&(n=0),new bo(this,e,n)},Kn.wrap=function(e){function t(){return Kn.spawn.call(this,e.apply(this,arguments))}return t.__generatorFunction__=e,t};var wo=Kn.spawn=function(){for(var e=arguments[0],t=this,n=[],r=1,i=arguments.length;i>r;r++)n.push(arguments[r]);return new Ps(function(r){function i(t){var n=rt(e.next).call(e,t);return n===nt?r.onError(n.e):void s(n)}function o(t){var n=rt(e.next).call(e,t);return n===nt?r.onError(n.e):void s(n)}function s(e){if(e.done)return r.onNext(e.value),void r.onCompleted();var n=ee.call(t,e.value),s=null,u=!1;Kn.isObservable(n)?a.add(n.subscribe(function(e){u=!0,s=e},o,function(){u&&i(s)})):o(new TypeError("type not supported"))}var a=new on;return tt(e)&&(e=e.apply(t,n)),e&&tt(e.next)?(i(),a):(r.onNext(e),r.onCompleted())})};Kn.start=function(e,t,n){return So(e,t,n)()};var So=Kn.toAsync=function(e,t,n){return xn(n)||(n=Nn),function(){var r=arguments,i=new Ds;return n.schedule(null,function(){var n;try{n=e.apply(t,r)}catch(o){return void i.onError(o)}i.onNext(n),i.onCompleted()}),i.asObservable()}};Kn.fromCallback=function(e,t,n){return function(){"undefined"==typeof t&&(t=this);for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];return ae(e,t,n,i)}},Kn.fromNodeCallback=function(e,t,n){return function(){"undefined"==typeof t&&(t=this);for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];return ce(e,t,n,i)}},pe.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},qe.config.useNativeEvents=!1;var Mo=function(e){function t(t,n,r){this._el=t,this._n=n,this._fn=r,e.call(this)}function n(e,t){return function(){var n=arguments[0];return tt(t)&&(n=rt(t).apply(null,arguments),n===nt)?e.onError(n.e):void e.onNext(n)}}return Qt(t,e),t.prototype.subscribeCore=function(e){return fe(this._el,this._n,n(e,this._fn))},t}(Zn);Kn.fromEvent=function(e,t,n){return e.addListener?Co(function(n){e.addListener(t,n)},function(n){e.removeListener(t,n)},n):qe.config.useNativeEvents||"function"!=typeof e.on||"function"!=typeof e.off?new Mo(e,t,n).publish().refCount():Co(function(n){e.on(t,n)},function(n){e.off(t,n)},n)};var Eo=function(e){function t(t,n,r){this._add=t,this._del=n,this._fn=r,e.call(this)}function n(e,t){return function(){var n=arguments[0];return tt(t)&&(n=rt(t).apply(null,arguments),n===nt)?e.onError(n.e):void e.onNext(n)}}function r(e,t,n){this._del=e,this._fn=t,this._ret=n,this.isDisposed=!1}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=n(e,this._fn),i=this._add(t);return new r(this._del,t,i)},r.prototype.dispose=function(){this.isDisposed||(tt(this._del)&&this._del(this._fn,this._ret),this.isDisposed=!0)},t}(Zn),Co=Kn.fromEventPattern=function(e,t,n){return new Eo(e,t,n).publish().refCount()};Kn.startAsync=function(e){var t=rt(e)();return t===nt?Or(t.e):cr(t)};var To=function(e){function t(t,n){this.source=t,this.controller=new Ns,this.paused=!0,n&&n.subscribe?this.pauser=this.controller.merge(n):this.pauser=this.controller,e.call(this)}return Qt(t,e),t.prototype._subscribe=function(e){var t=this.source.publish(),n=t.subscribe(e),r=cn,i=this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function(e){e?r=t.connect():(r.dispose(),r=cn)});return new vn([n,r,i])},t.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},t.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},t}(Kn);Hn.pausable=function(e){return new To(this,e)};var Ao=function(e){function t(t,n){this.source=t,this.controller=new Ns,this.paused=!0,n&&n.subscribe?this.pauser=this.controller.merge(n):this.pauser=this.controller,e.call(this)}return Qt(t,e),t.prototype._subscribe=function(e){function t(){for(;r.length>0;)e.onNext(r.shift())}var n,r=[],i=de(this.source,this.pauser.startWith(!this.paused).distinctUntilChanged(),function(e,t){return{data:e,shouldFire:t}}).subscribe(function(i){n!==o&&i.shouldFire!==n?(n=i.shouldFire,i.shouldFire&&t()):(n=i.shouldFire,i.shouldFire?e.onNext(i.data):r.push(i.data))},function(n){t(),e.onError(n)},function(){t(),e.onCompleted()});return i},t.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},t.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},t}(Kn);Hn.pausableBuffered=function(e){return new Ao(this,e)};var Po=function(e){function t(t,n,r){e.call(this),this.subject=new Oo(n,r),this.source=t.multicast(this.subject).refCount()}return Qt(t,e),t.prototype._subscribe=function(e){return this.source.subscribe(e)},t.prototype.request=function(e){return this.subject.request(null==e?-1:e)},t}(Kn),Oo=function(e){function t(t,n){null==t&&(t=!0),e.call(this),this.subject=new Ns,this.enableQueue=t,this.queue=t?[]:null,this.requestedCount=0,this.requestedDisposable=null,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=n||An}return Qt(t,e),en(t.prototype,Gn,{_subscribe:function(e){return this.subject.subscribe(e)},onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(In.createOnCompleted()):(this.subject.onCompleted(),this.disposeCurrentRequest())},onError:function(e){this.hasFailed=!0,this.error=e,this.enableQueue&&0!==this.queue.length?this.queue.push(In.createOnError(e)):(this.subject.onError(e),this.disposeCurrentRequest())},onNext:function(e){this.requestedCount<=0?this.enableQueue&&this.queue.push(In.createOnNext(e)):(0===this.requestedCount--&&this.disposeCurrentRequest(),this.subject.onNext(e))},_processRequest:function(e){if(this.enableQueue)for(;this.queue.length>0&&(e>0||"N"!==this.queue[0].kind);){var t=this.queue.shift();t.accept(this.subject),"N"===t.kind?e--:(this.disposeCurrentRequest(),this.queue=[])}return e},request:function(e){this.disposeCurrentRequest();var t=this;return this.requestedDisposable=this.scheduler.schedule(e,function(e,n){var r=t._processRequest(n),i=t.hasCompleted||t.hasFailed;return!i&&r>0?(t.requestedCount=r,un(function(){t.requestedCount=0})):void 0}),this.requestedDisposable},disposeCurrentRequest:function(){this.requestedDisposable&&(this.requestedDisposable.dispose(),this.requestedDisposable=null)}}),t}(Kn);Hn.controlled=function(e,t){return e&&xn(e)&&(t=e,e=!0),null==e&&(e=!0),new Po(this,e,t)};var Lo=function(e){function t(t){e.call(this),this.source=t}function n(e,t){return t.source.request(1)}Qt(t,e),t.prototype._subscribe=function(e){return this.subscription=this.source.subscribe(new r(e,this,this.subscription)),new mn(this.subscription,Nn.schedule(this,n))};var r=function(e){function t(t,n,r){e.call(this),this.observer=t,this.observable=n,this.cancel=r,this.scheduleDisposable=null}function n(e,t){return t.observable.source.request(1)}return Qt(t,e),t.prototype.completed=function(){this.observer.onCompleted(),this.dispose()},t.prototype.error=function(e){this.observer.onError(e),this.dispose()},t.prototype.next=function(e){this.observer.onNext(e),this.scheduleDisposable=Nn.schedule(this,n)},t.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),this.scheduleDisposable&&(this.scheduleDisposable.dispose(),this.scheduleDisposable=null),e.prototype.dispose.call(this)},t}($n);return t}(Kn);Po.prototype.stopAndWait=function(){return new Lo(this)};var Ro=function(e){function t(t,n){e.call(this),this.source=t,this.windowSize=n}function n(e,t){return t.source.request(t.windowSize)}Qt(t,e),t.prototype._subscribe=function(e){return this.subscription=this.source.subscribe(new r(e,this,this.subscription)),new mn(this.subscription,Nn.schedule(this,n))};var r=function(e){function t(t,n,r){this.observer=t,this.observable=n,this.cancel=r,this.received=0,this.scheduleDisposable=null,e.call(this)}function n(e,t){return t.observable.source.request(t.observable.windowSize)}return Qt(t,e),t.prototype.completed=function(){this.observer.onCompleted(),this.dispose()},t.prototype.error=function(e){this.observer.onError(e),this.dispose()},t.prototype.next=function(e){this.observer.onNext(e),this.received=++this.received%this.observable.windowSize,0===this.received&&(this.scheduleDisposable=Nn.schedule(this,n))},t.prototype.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),this.scheduleDisposable&&(this.scheduleDisposable.dispose(),this.scheduleDisposable=null),e.prototype.dispose.call(this)},t}($n);return t}(Kn);Po.prototype.windowed=function(e){return new Ro(this,e)},Hn.pipe=function(e){function t(){n.resume()}var n=this.pausableBuffered();return e.addListener("drain",t),n.subscribe(function(t){!e.write(t)&&n.pause()},function(t){e.emit("error",t)},function(){!e._isStdio&&e.end(),e.removeListener("drain",t)}),n.resume(),e};var No=function(e){function t(t,n,r){this.source=t,this._fn1=n,this._fn2=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=this.source.multicast(this._fn1());return new mn(this._fn2(t).subscribe(e),t.connect())},t}(Zn);Hn.multicast=function(e,t){return tt(e)?new No(this,e,t):new ko(this,e)},Hn.publish=function(e){return e&&tt(e)?this.multicast(function(){return new Ns},e):this.multicast(new Ns)},Hn.share=function(){return this.publish().refCount()},Hn.publishLast=function(e){return e&&tt(e)?this.multicast(function(){return new Ds},e):this.multicast(new Ds)},Hn.publishValue=function(e,t){return 2===arguments.length?this.multicast(function(){return new Is(t)},e):this.multicast(new Is(e))},Hn.shareValue=function(e){return this.publishValue(e).refCount()},Hn.replay=function(e,t,n,r){return e&&tt(e)?this.multicast(function(){return new ks(t,n,r)},e):this.multicast(new ks(t,n,r))},Hn.shareReplay=function(e,t,n){return this.replay(null,e,t,n).refCount()};var Do=function(e,t){this._s=e,this._o=t};Do.prototype.dispose=function(){if(!this._s.isDisposed&&null!==this._o){var e=this._s.observers.indexOf(this._o);this._s.observers.splice(e,1),this._o=null}};var Io=function(e){function t(t){this.source=t,this._count=0,this._connectableSubscription=null,e.call(this)}function n(e,t){this._p=e,this._s=t,this.isDisposed=!1}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=this.source.subscribe(e);return 1===++this._count&&(this._connectableSubscription=this.source.connect()),new n(this,t)},n.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.dispose(),0===--this._p._count&&this._p._connectableSubscription.dispose())},t}(Zn),ko=qe.ConnectableObservable=function(e){function t(t,n){this.source=t,this._connection=null,this._source=t.asObservable(),this._subject=n,e.call(this)}function n(e,t){this._p=e,this._s=t}return Qt(t,e),n.prototype.dispose=function(){this._s&&(this._s.dispose(),this._s=null,this._p._connection=null)},t.prototype.connect=function(){if(!this._connection){if(this._subject.isStopped)return cn;var e=this._source.subscribe(this._subject);this._connection=new n(this,e)}return this._connection},t.prototype._subscribe=function(e){return this._subject.subscribe(e)},t.prototype.refCount=function(){return new Io(this)},t}(Kn);Hn.singleInstance=function(){function e(){return r||(r=!0,t=n["finally"](function(){r=!1}).publish().refCount()),t}var t,n=this,r=!1;return new Ps(function(t){return e().subscribe(t)})},Hn.join=function(e,t,n,r){var i=this;return new Ps(function(o){var s=new on,a=!1,u=!1,c=0,h=0,l=new Wo,p=new Wo,f=function(e){o.onError(e)};return s.add(i.subscribe(function(e){var n=c++,i=new fn;l.set(n,e),s.add(i);var u=rt(t)(e);return u===nt?o.onError(u.e):(i.setDisposable(u.take(1).subscribe(Xe,f,function(){l["delete"](n)&&0===l.size&&a&&o.onCompleted(),s.remove(i)})),void p.forEach(function(t){var n=rt(r)(e,t);return n===nt?o.onError(n.e):void o.onNext(n)}))},f,function(){a=!0,(u||0===l.size)&&o.onCompleted()})),s.add(e.subscribe(function(e){var t=h++,i=new fn;p.set(t,e),s.add(i);var a=rt(n)(e);return a===nt?o.onError(a.e):(i.setDisposable(a.take(1).subscribe(Xe,f,function(){p["delete"](t)&&0===p.size&&u&&o.onCompleted(),s.remove(i)})),void l.forEach(function(t){var n=rt(r)(t,e);return n===nt?o.onError(n.e):void o.onNext(n)}))},f,function(){u=!0,(a||0===p.size)&&o.onCompleted()})),s},i)},Hn.groupJoin=function(e,t,n,r){var i=this;return new Ps(function(o){function s(e){}var a=new on,u=new gn(a),c=new Wo,h=new Wo,l=0,p=0,s=function(e){return function(t){t.onError(e)}};return a.add(i.subscribe(function(e){var n=new Ns,i=l++;c.set(i,n);var p=rt(r)(e,tn(n,u));if(p===nt)return c.forEach(s(p.e)),o.onError(p.e);o.onNext(p),h.forEach(function(e){n.onNext(e)});var f=new fn;a.add(f);var d=rt(t)(e);return d===nt?(c.forEach(s(d.e)),o.onError(d.e)):void f.setDisposable(d.take(1).subscribe(Xe,function(e){c.forEach(s(e)),o.onError(e)},function(){c["delete"](i)&&n.onCompleted(),a.remove(f)}))},function(e){c.forEach(s(e)),o.onError(e)},function(){o.onCompleted()})),a.add(e.subscribe(function(e){var t=p++;h.set(t,e);var r=new fn;a.add(r);var i=rt(n)(e);return i===nt?(c.forEach(s(i.e)),o.onError(i.e)):(r.setDisposable(i.take(1).subscribe(Xe,function(e){c.forEach(s(e)),o.onError(e)},function(){h["delete"](t),a.remove(r)})),void c.forEach(function(t){t.onNext(e)}))},function(e){c.forEach(s(e)),o.onError(e)})),u},i)},Hn.buffer=function(){return this.window.apply(this,arguments).flatMap($)},Hn.window=function(e,t){return 1===arguments.length&&"function"!=typeof arguments[0]?ve.call(this,e):"function"==typeof e?ge.call(this,e):me.call(this,e,t)};var jo=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Fo(e))},t}(Zn),Fo=function(e){function t(t){this._o=t,this._p=null,this._hp=!1,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._hp?this._o.onNext([this._p,e]):this._hp=!0,this._p=e},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.pairwise=function(){return new jo(this)},Hn.partition=function(e,t){var n=_t(e,t,3);return[this.filter(e,t),this.filter(function(e,t,r){return!n(e,t,r)})]};var Bo=function(e){function t(e,t){this.c=e,this.s=t}return Qt(t,e),t.prototype[mt]=function(){var e=this;return{next:function(){return e.c()?{done:!1,value:e.s}:{done:!0,value:void 0}}}},t}(Qn);Hn.letBind=Hn.let=function(e){return e(this)},Kn["if"]=function(e,t,n){return pr(function(){return n||(n=mr()),et(t)&&(t=cr(t)),et(n)&&(n=cr(n)),"function"==typeof n.now&&(n=mr(n)),e()?t:n})},Kn["for"]=Kn.forIn=function(e,t,n){return or(e,t,n).concat()};var Vo=Kn["while"]=Kn.whileDo=function(e,t){return et(t)&&(t=cr(t)),ye(e,t).concat()};Hn.doWhile=function(e){return Vr([this,Vo(e,this)])},Kn["case"]=function(e,t,n){return pr(function(){et(n)&&(n=cr(n)),n||(n=mr()),xn(n)&&(n=mr(n));var r=t[e()];return et(r)&&(r=cr(r)),r||n})};var Uo=function(e){function t(t,n,r){this.source=t,this._fn=n,this._scheduler=r,e.call(this)}function n(e,t){var n,r=e[0],i=e[1];if(!(r.q.length>0))return void(r.isAcquired=!1);n=r.q.shift();var o=new fn;r.d.add(o),o.setDisposable(n.subscribe(new Go(r,i,o))),t([r,i])}return Qt(t,e),t.prototype._ensureActive=function(e){var t=!1;e.q.length>0&&(t=!e.isAcquired,e.isAcquired=!0),t&&e.m.setDisposable(this._scheduler.scheduleRecursive([e,this],n))},t.prototype.subscribeCore=function(e){var t=new dn,n=new on(t),r={q:[],m:t,d:n,activeCount:0,isAcquired:!1,o:e};return r.q.push(this.source),r.activeCount++,this._ensureActive(r),n},t}(Zn),Go=function(e){function t(t,n,r){this._s=t,this._p=n,this._m1=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.o.onNext(e);var t=rt(this._p._fn)(e);return t===nt?this._s.o.onError(t.e):(this._s.q.push(t),this._s.activeCount++,void this._p._ensureActive(this._s))},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.d.remove(this._m1),this._s.activeCount--,0===this._s.activeCount&&this._s.o.onCompleted()},t}($n);Hn.expand=function(e,t){return xn(t)||(t=An),new Uo(this,e,t)};var zo=function(e){function t(t,n){this._sources=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){if(0===this._sources.length)return e.onCompleted(),cn;for(var t=this._sources.length,n={finished:!1,hasResults:new Array(t),hasCompleted:new Array(t),results:new Array(t)},r=new on,i=0,o=this._sources.length;o>i;i++){var s=this._sources[i];et(s)&&(s=cr(s)),r.add(s.subscribe(new Ho(e,n,i,this._cb,r)))}return r},t}(Zn),Ho=function(e){function t(t,n,r,i,o){this._o=t,this._s=n,this._i=r,this._cb=i,this._subs=o,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.finished||(this._s.hasResults[this._i]=!0,this._s.results[this._i]=e)},t.prototype.error=function(e){this._s.finished=!0,this._o.onError(e),this._subs.dispose()},t.prototype.completed=function(){if(!this._s.finished){if(!this._s.hasResults[this._i])return this._o.onCompleted();this._s.hasCompleted[this._i]=!0;for(var e=0;en;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;return Array.isArray(t[0])&&(t=t[0]),new zo(t,r)},Hn.forkJoin=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Kn.forkJoin.apply(null,t)},Hn.manySelect=Hn.extend=function(e,t){xn(t)||(t=qe.Scheduler.immediate);var n=this;return pr(function(){var r;return n.map(function(e){var t=new $o(e);return r&&r.onNext(e),r=t,t}).tap(Xe,function(e){r&&r.onError(e)},function(){r&&r.onCompleted()}).observeOn(t).map(e)},n)};var $o=function(e){function t(t){e.call(this),this.head=t,this.tail=new Ds}return Qt(t,e),en(t.prototype,Gn,{_subscribe:function(e){var t=new on;return t.add(An.schedule(this,function(n,r){e.onNext(r.head),t.add(r.tail.mergeAll().subscribe(e))})),t},onCompleted:function(){this.onNext(Kn.empty())},onError:function(e){this.onNext(Kn["throw"](e))},onNext:function(e){this.tail.onNext(e),this.tail.onCompleted()}}),t}(Kn),Wo=We.Map||function(){function e(){this.size=0,this._values=[],this._keys=[]}return e.prototype["delete"]=function(e){var t=this._keys.indexOf(e);return-1===t?!1:(this._values.splice(t,1),this._keys.splice(t,1),this.size--,!0)},e.prototype.get=function(e){var t=this._keys.indexOf(e);return-1===t?o:this._values[t]},e.prototype.set=function(e,t){var n=this._keys.indexOf(e);return-1===n?(this._keys.push(e),this._values.push(t),this.size++):this._values[n]=t,this},e.prototype.forEach=function(e,t){for(var n=0;no;o++)r.push(Se(e,this.expression.patterns[o],i));var a=new Me(r,we(this,t),function(){for(var e=0,t=r.length;t>e;e++)r[e].removeActivePlan(a);n(a)});for(o=0,s=r.length;s>o;o++)r[o].addActivePlan(a);return a},Me.prototype.dequeue=function(){this.joinObservers.forEach(function(e){e.queue.shift()})},Me.prototype.match=function(){var e,t,n=!0;for(e=0,t=this.joinObserverArray.length;t>e;e++)if(0===this.joinObserverArray[e].queue.length){n=!1;break}if(n){var r=[],i=!1;for(e=0,t=this.joinObserverArray.length;t>e;e++)r.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(i=!0);if(i)this.onCompleted();else{this.dequeue();var o=[];for(e=0,t=r.length;en;n++)t[n].match()}},n.error=Xe,n.completed=Xe,n.addActivePlan=function(e){this.activePlans.push(e)},n.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},n.removeActivePlan=function(e){this.activePlans.splice(this.activePlans.indexOf(e),1),0===this.activePlans.length&&this.dispose()},n.dispose=function(){e.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},t}($n);Hn.and=function(e){return new _e([this,e])},Hn.thenDo=function(e){return new _e([this]).thenDo(e)},Kn.when=function(){var e,t=arguments.length;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new Ps(function(t){var n=[],r=new Wo,i=zn(function(e){t.onNext(e)},function(e){r.forEach(function(t){t.onError(e)}),t.onError(e)},function(e){t.onCompleted()});try{for(var o=0,s=e.length;s>o;o++)n.push(e[o].activate(r,i,function(e){var r=n.indexOf(e);n.splice(r,1),0===n.length&&t.onCompleted()}))}catch(a){return Or(a).subscribe(t)}var u=new on;return r.forEach(function(e){e.subscribe(),u.add(e)}),u})};var Xo=function(e){function t(t,n){this._dt=t,this._s=n,e.call(this)}function n(e,t){t.onNext(0),t.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._s.scheduleFuture(e,this._dt,n)},t}(Zn),Yo=Kn.interval=function(e,t){return Te(e,e,xn(t)?t:Nn)};Kn.timer=function(e,t,n){var r;return xn(n)||(n=Nn),null!=t&&"number"==typeof t?r=t:xn(t)&&(n=t),(e instanceof Date||"number"==typeof e)&&r===o?Ee(e,n):e instanceof Date&&r!==o?Ce(e,t,n):Te(e,r,n)},Hn.delay=function(){var e=arguments[0];if("number"==typeof e||e instanceof Date){var t=e,n=arguments[1];return xn(n)||(n=Nn),t instanceof Date?Pe(this,t,n):Ae(this,t,n)}if(Kn.isObservable(e)||tt(e))return Oe(this,e,arguments[1]);throw new Error("Invalid arguments")};var Ko=function(e){function t(t,n,r){xn(r)||(r=Nn),this.source=t,this._dt=n,this._s=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn;return new mn(this.source.subscribe(new Zo(e,this._dt,this._s,t)),t)},t}(Zn),Zo=function(e){function t(t,n,r,i){this._o=t,this._d=n,this._scheduler=r,this._c=i,this._v=null,this._hv=!1,this._id=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._hv=!0,this._v=e;var t=++this._id,n=new fn;this._c.setDisposable(n),n.setDisposable(this._scheduler.scheduleFuture(this,this._d,function(n,r){r._hv&&r._id===t&&r._o.onNext(e),r._hv=!1}))},t.prototype.error=function(e){this._c.dispose(),this._o.onError(e),this._hv=!1,this._id++},t.prototype.completed=function(){this._c.dispose(),this._hv&&this._o.onNext(this._v),this._o.onCompleted(),this._hv=!1,this._id++},t}($n);Hn.debounce=function(){if(tt(arguments[0]))return Le(this,arguments[0]);if("number"==typeof arguments[0])return new Ko(this,arguments[0],arguments[1]);throw new Error("Invalid arguments")},Hn.windowWithTime=Hn.windowTime=function(e,t,n){var r,i=this;return null==t&&(r=e),xn(n)||(n=Nn),"number"==typeof t?r=t:xn(t)&&(r=e,n=t),new Ps(function(t){function o(){var e=new fn,i=!1,s=!1;l.setDisposable(e),c===u?(i=!0,s=!0):u>c?i=!0:s=!0;var f=i?c:u,d=f-p;p=f,i&&(c+=r),s&&(u+=r),e.setDisposable(n.scheduleFuture(null,d,function(){if(s){var e=new Ns;h.push(e),t.onNext(tn(e,a))}i&&h.shift().onCompleted(),o()}))}var s,a,u=r,c=e,h=[],l=new dn,p=0;return s=new on(l),a=new gn(s),h.push(new Ns),t.onNext(tn(h[0],a)),o(),s.add(i.subscribe(function(e){for(var t=0,n=h.length;n>t;t++)h[t].onNext(e)},function(e){for(var n=0,r=h.length;r>n;n++)h[n].onError(e);t.onError(e)},function(){for(var e=0,n=h.length;n>e;e++)h[e].onCompleted();t.onCompleted()})),a},i)},Hn.windowWithTimeOrCount=Hn.windowTimeOrCount=function(e,t,n){var r=this;return xn(n)||(n=Nn),new Ps(function(i){function o(t){var r=new fn;s.setDisposable(r),r.setDisposable(n.scheduleFuture(null,e,function(){if(t===h){c=0;var e=++h;l.onCompleted(),l=new Ns,i.onNext(tn(l,u)),o(e)}}))}var s=new dn,a=new on(s),u=new gn(a),c=0,h=0,l=new Ns;return i.onNext(tn(l,u)),o(0),a.add(r.subscribe(function(e){var n=0,r=!1;l.onNext(e),++c===t&&(r=!0,c=0,n=++h,l.onCompleted(),l=new Ns,i.onNext(tn(l,u))),r&&o(n)},function(e){l.onError(e),i.onError(e)},function(){l.onCompleted(),i.onCompleted()})),u},r)},Hn.bufferWithTime=Hn.bufferTime=function(e,t,n){return this.windowWithTime(e,t,n).flatMap($)},Hn.bufferWithTimeOrCount=Hn.bufferTimeOrCount=function(e,t,n){return this.windowWithTimeOrCount(e,t,n).flatMap($)};var Jo=function(e){function t(t,n){this.source=t,this._s=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Qo(e,this._s))},t}(Zn),Qo=function(e){function t(t,n){this._o=t,this._s=n,this._l=n.now(),e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=this._s.now(),n=t-this._l;this._l=t,this._o.onNext({
-value:e,interval:n})},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.timeInterval=function(e){return xn(e)||(e=Nn),new Jo(this,e)};var es=function(e){function t(t,n){this.source=t,this._s=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new ts(e,this._s))},t}(Zn),ts=function(e){function t(t,n){this._o=t,this._s=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._o.onNext({value:e,timestamp:this._s.now()})},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.timestamp=function(e){return xn(e)||(e=Nn),new es(this,e)};var ns=function(e){function t(t,n){this.source=t,this._sampler=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,atEnd:!1,value:null,hasValue:!1,sourceSubscription:new fn};return t.sourceSubscription.setDisposable(this.source.subscribe(new is(t))),new mn(t.sourceSubscription,this._sampler.subscribe(new rs(t)))},t}(Zn),rs=function(e){function t(t){this._s=t,e.call(this)}return Qt(t,e),t.prototype._handleMessage=function(){this._s.hasValue&&(this._s.hasValue=!1,this._s.o.onNext(this._s.value)),this._s.atEnd&&this._s.o.onCompleted()},t.prototype.next=function(){this._handleMessage()},t.prototype.error=function(e){this._s.onError(e)},t.prototype.completed=function(){this._handleMessage()},t}($n),is=function(e){function t(t){this._s=t,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.hasValue=!0,this._s.value=e},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.atEnd=!0,this._s.sourceSubscription.dispose()},t}($n);Hn.sample=function(e,t){return xn(t)||(t=Nn),"number"==typeof e?new ns(this,Yo(e,t)):new ns(this,e)};var os=qe.TimeoutError=function(e){this.message=e||"Timeout has occurred",this.name="TimeoutError",Error.call(this)};os.prototype=Object.create(Error.prototype),Hn.timeout=function(){var e=arguments[0];if(e instanceof Date||"number"==typeof e)return Ne(this,e,arguments[1],arguments[2]);if(Kn.isObservable(e)||tt(e))return Re(this,e,arguments[1],arguments[2]);throw new Error("Invalid arguments")};var ss=function(e){function t(t,n,r,i,o,s){this._state=t,this._cndFn=n,this._itrFn=r,this._resFn=i,this._timeFn=o,this._s=s,e.call(this)}function n(e,t){if(e.hasResult&&e.o.onNext(e.result),e.first)e.first=!1;else if(e.newState=rt(e.self._itrFn)(e.newState),e.newState===nt)return e.o.onError(e.newState.e);if(e.hasResult=rt(e.self._cndFn)(e.newState),e.hasResult===nt)return e.o.onError(e.hasResult.e);if(e.hasResult){if(e.result=rt(e.self._resFn)(e.newState),e.result===nt)return e.o.onError(e.result.e);var n=rt(e.self._timeFn)(e.newState);if(n===nt)return e.o.onError(n.e);t(e,n)}else e.o.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(t,new Date(this._s.now()),n)},t}(Zn);Kn.generateWithAbsoluteTime=function(e,t,n,r,i,o){return xn(o)||(o=Nn),new ss(e,t,n,r,i,o)};var as=function(e){function t(t,n,r,i,o,s){this._state=t,this._cndFn=n,this._itrFn=r,this._resFn=i,this._timeFn=o,this._s=s,e.call(this)}function n(e,t){if(e.hasResult&&e.o.onNext(e.result),e.first)e.first=!1;else if(e.newState=rt(e.self._itrFn)(e.newState),e.newState===nt)return e.o.onError(e.newState.e);if(e.hasResult=rt(e.self._cndFn)(e.newState),e.hasResult===nt)return e.o.onError(e.hasResult.e);if(e.hasResult){if(e.result=rt(e.self._resFn)(e.newState),e.result===nt)return e.o.onError(e.result.e);var n=rt(e.self._timeFn)(e.newState);if(n===nt)return e.o.onError(n.e);t(e,n)}else e.o.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(t,0,n)},t}(Zn);Kn.generateWithRelativeTime=function(e,t,n,r,i,o){return xn(o)||(o=Nn),new as(e,t,n,r,i,o)};var us=function(e){function t(t,n,r){this.source=t,this._dt=n,this._s=r,e.call(this)}function n(e,t){var n=t[0],r=t[1],i=t[2];i.setDisposable(n.subscribe(r))}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn;return t.setDisposable(this._s.scheduleFuture([this.source,e,t],this._dt,n)),t},t}(Zn);Hn.delaySubscription=function(e,t){return xn(t)||(t=Nn),new us(this,e,t)};var cs=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new hs(e,this))},t}(Zn),hs=function(e){function t(t,n){this._o=t,this._s=n._s,this._d=n._d,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=this._s.now();for(this._q.push({interval:t,value:e});this._q.length>0&&t-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){for(var e=this._s.now();this._q.length>0&&e-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value);this._o.onCompleted()},t}($n);Hn.skipLastWithTime=function(e,t){return xn(t)||(t=Nn),new cs(this,e,t)};var ls=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new ps(e,this._d,this._s))},t}(Zn),ps=function(e){function t(t,n,r){this._o=t,this._d=n,this._s=r,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=this._s.now();for(this._q.push({interval:t,value:e});this._q.length>0&&t-this._q[0].interval>=this._d;)this._q.shift()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){for(var e=this._s.now();this._q.length>0;){var t=this._q.shift();e-t.interval<=this._d&&this._o.onNext(t.value)}this._o.onCompleted()},t}($n);Hn.takeLastWithTime=function(e,t){return xn(t)||(t=Nn),new ls(this,e,t)},Hn.takeLastBufferWithTime=function(e,t){var n=this;return xn(t)||(t=Nn),new Ps(function(r){var i=[];return n.subscribe(function(n){var r=t.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=e;)i.shift()},function(e){r.onError(e)},function(){for(var n=t.now(),o=[];i.length>0;){var s=i.shift();n-s.interval<=e&&o.push(s.value)}r.onNext(o),r.onCompleted()})},n)};var fs=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,e.call(this)}function n(e,t){t.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this._s.scheduleFuture(e,this._d,n),this.source.subscribe(e))},t}(Zn);Hn.takeWithTime=function(e,t){return xn(t)||(t=Nn),new fs(this,e,t)};var ds=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,this._open=!1,e.call(this)}function n(e,t){t._open=!0}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this._s.scheduleFuture(this,this._d,n),this.source.subscribe(new ms(e,this)))},t}(Zn),ms=function(e){function t(t,n){this._o=t,this._p=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._p._open&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipWithTime=function(e,t){return xn(t)||(t=Nn),new ds(this,e,t)};var vs=function(e){function t(t,n,r){this.source=t,this._st=n,this._s=r,e.call(this)}function n(e,t){t._open=!0}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._open=!1,new mn(this._s.scheduleFuture(this,this._st,n),this.source.subscribe(new gs(e,this)))},t}(Zn),gs=function(e){function t(t,n){this._o=t,this._p=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._p._open&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipUntilWithTime=function(e,t){return xn(t)||(t=Nn),new vs(this,e,t)},Hn.takeUntilWithTime=function(e,t){xn(t)||(t=Nn);var n=this;return new Ps(function(r){return new mn(t.scheduleFuture(r,e,function(e,t){t.onCompleted()}),n.subscribe(r))},n)},Hn.throttle=function(e,t){xn(t)||(t=Nn);var n=+e||0;if(0>=n)throw new RangeError("windowDuration cannot be less or equal zero.");var r=this;return new Ps(function(e){var i=0;return r.subscribe(function(r){var o=t.now();(0===i||o-i>=n)&&(i=o,e.onNext(r))},function(t){e.onError(t)},function(){e.onCompleted()})},r)};var ys=function(e){function t(t,n){this._o=t,this._xform=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._xform["@@transducer/step"]).call(this._xform,this._o,e);t===nt&&this._o.onError(t.e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._xform["@@transducer/result"](this._o)},t}($n);Hn.transduce=function(e){var t=this;return new Ps(function(n){var r=e(De(n));return t.subscribe(new ys(n,r))},t)};var _s=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn,n=new on,r={hasCurrent:!1,isStopped:!1,o:e,g:n};return n.add(t),t.setDisposable(this.source.subscribe(new bs(r))),n},t}(Zn),bs=function(e){function t(t){this._s=t,e.call(this)}function n(t,n){this._s=t,this._i=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(!this._s.hasCurrent){this._s.hasCurrent=!0,et(e)&&(e=cr(e));var t=new fn;this._s.g.add(t),t.setDisposable(e.subscribe(new n(this._s,t)))}},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.isStopped=!0,!this._s.hasCurrent&&1===this._s.g.length&&this._s.o.onCompleted()},Qt(n,e),n.prototype.next=function(e){this._s.o.onNext(e)},n.prototype.error=function(e){this._s.o.onError(e)},n.prototype.completed=function(){this._s.g.remove(this._i),this._s.hasCurrent=!1,this._s.isStopped&&1===this._s.g.length&&this._s.o.onCompleted()},t}($n);Hn.switchFirst=function(){return new _s(this)},Hn.flatMapFirst=Hn.exhaustMap=function(e,t,n){return new Jn(this,e,t,n).switchFirst()},Hn.flatMapWithMaxConcurrent=Hn.flatMapMaxConcurrent=function(e,t,n,r){return new Jn(this,t,n,r).merge(e)};var xs=qe.VirtualTimeScheduler=function(e){function t(t,n){this.clock=t,this.comparer=n,this.isEnabled=!1,this.queue=new nn(1024),e.call(this)}Qt(t,e);var n=t.prototype;return n.now=function(){return this.toAbsoluteTime(this.clock)},n.schedule=function(e,t){return this.scheduleAbsolute(e,this.clock,t)},n.scheduleFuture=function(e,t,n){var r=t instanceof Date?this.toRelativeTime(t-this.now()):this.toRelativeTime(t);return this.scheduleRelative(e,r,n)},n.add=dt,n.toAbsoluteTime=dt,n.toRelativeTime=dt,n.schedulePeriodic=function(e,t,n){var r=new Mn(this,e,t,n);return r.start()},n.scheduleRelative=function(e,t,n){var r=this.add(this.clock,t);return this.scheduleAbsolute(e,r,n)},n.start=function(){if(!this.isEnabled){this.isEnabled=!0;do{var e=this.getNext();null!==e?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1}while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(e){var t=this.comparer(this.clock,e);if(this.comparer(this.clock,e)>0)throw new lt;if(0!==t&&!this.isEnabled){this.isEnabled=!0;do{var n=this.getNext();null!==n&&this.comparer(n.dueTime,e)<=0?(this.comparer(n.dueTime,this.clock)>0&&(this.clock=n.dueTime),n.invoke()):this.isEnabled=!1}while(this.isEnabled);this.clock=e}},n.advanceBy=function(e){var t=this.add(this.clock,e),n=this.comparer(this.clock,t);if(n>0)throw new lt;0!==n&&this.advanceTo(t)},n.sleep=function(e){var t=this.add(this.clock,e);if(this.comparer(this.clock,t)>=0)throw new lt;this.clock=t},n.getNext=function(){for(;this.queue.length>0;){var e=this.queue.peek();if(!e.isCancelled())return e;this.queue.dequeue()}return null},n.scheduleAbsolute=function(e,t,n){function r(e,t){return i.queue.remove(o),n(e,t)}var i=this,o=new yn(this,e,r,t,this.comparer);return this.queue.enqueue(o),o.disposable},t}(_n);qe.HistoricalScheduler=function(e){function t(t,n){var r=null==t?0:t,i=n||Je;e.call(this,r,i)}Qt(t,e);var n=t.prototype;return n.add=function(e,t){return e+t},n.toAbsoluteTime=function(e){return new Date(e).getTime()},n.toRelativeTime=function(e){return e},t}(qe.VirtualTimeScheduler),Ie.prototype.equals=function(e){return e===this?!0:null==e?!1:"N"!==e.kind?!1:this.predicate(e.value)},ke.prototype.equals=function(e){return e===this?!0:null==e?!1:"E"!==e.kind?!1:this.predicate(e.error)};var ws=qe.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(e,t){return"function"==typeof t?new Ss(e,new Ie(t)):new Ss(e,In.createOnNext(t))},onError:function(e,t){return"function"==typeof t?new Ss(e,new ke(t)):new Ss(e,In.createOnError(t))},onCompleted:function(e){return new Ss(e,In.createOnCompleted())},subscribe:function(e,t){return new Ms(e,t)}},Ss=qe.Recorded=function(e,t,n){this.time=e,this.value=t,this.comparer=n||Ze};Ss.prototype.equals=function(e){return this.time===e.time&&this.comparer(this.value,e.value)},Ss.prototype.toString=function(){return this.value.toString()+"@"+this.time};var Ms=qe.Subscription=function(e,t){this.subscribe=e,this.unsubscribe=t||Number.MAX_VALUE};Ms.prototype.equals=function(e){return this.subscribe===e.subscribe&&this.unsubscribe===e.unsubscribe},Ms.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var Es=qe.MockDisposable=function(e){this.scheduler=e,this.disposes=[],this.disposes.push(this.scheduler.clock)};Es.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var Cs=function(e){function t(t){e.call(this),this.scheduler=t,this.messages=[]}Qt(t,e);var n=t.prototype;return n.onNext=function(e){this.messages.push(new Ss(this.scheduler.clock,In.createOnNext(e)))},n.onError=function(e){this.messages.push(new Ss(this.scheduler.clock,In.createOnError(e)))},n.onCompleted=function(){this.messages.push(new Ss(this.scheduler.clock,In.createOnCompleted()))},t}(Gn);je.prototype.then=function(e,t){var n=this;this.subscriptions.push(new Ms(this.scheduler.clock));var r,i=this.subscriptions.length-1,s=qe.Observer.create(function(t){var a=e(t);if(a&&"function"==typeof a.then)r=a;else{var u=n.scheduler.clock;r=new je(n.scheduler,[qe.ReactiveTest.onNext(u,o),qe.ReactiveTest.onCompleted(u)])}var c=n.observers.indexOf(s);n.observers.splice(c,1),n.subscriptions[i]=new Ms(n.subscriptions[i].subscribe,n.scheduler.clock)},function(e){t(e);var r=n.observers.indexOf(s);n.observers.splice(r,1),n.subscriptions[i]=new Ms(n.subscriptions[i].subscribe,n.scheduler.clock)});return this.observers.push(s),r||new je(this.scheduler,this.messages)};var Ts=function(e){function t(t,n){e.call(this);var r,i,o=this;this.scheduler=t,this.messages=n,this.subscriptions=[],this.observers=[];for(var s=0,a=this.messages.length;a>s;s++)r=this.messages[s],i=r.value,function(e){t.scheduleAbsolute(null,r.time,function(){for(var t=o.observers.slice(0),n=0,r=t.length;r>n;n++)e.accept(t[n]);return cn})}(i)}return Qt(t,e),t.prototype._subscribe=function(e){var t=this;this.observers.push(e),this.subscriptions.push(new Ms(this.scheduler.clock));var n=this.subscriptions.length-1;return un(function(){var r=t.observers.indexOf(e);t.observers.splice(r,1),t.subscriptions[n]=new Ms(t.subscriptions[n].subscribe,t.scheduler.clock)})},t}(Kn),As=function(e){function t(t,n){e.call(this),this.scheduler=t,this.messages=n,this.subscriptions=[]}return Qt(t,e),t.prototype._subscribe=function(e){var t,n,r=this;this.subscriptions.push(new Ms(this.scheduler.clock));for(var i=this.subscriptions.length-1,o=new on,s=0,a=this.messages.length;a>s;s++)t=this.messages[s],n=t.value,function(n){o.add(r.scheduler.scheduleRelative(null,t.time,function(){return n.accept(e),cn}))}(n);return un(function(){r.subscriptions[i]=new Ms(r.subscriptions[i].subscribe,r.scheduler.clock),o.dispose()})},t}(Kn);qe.TestScheduler=function(e){function t(e,t){return e>t?1:t>e?-1:0}function n(){e.call(this,0,t)}return Qt(n,e),n.prototype.scheduleAbsolute=function(t,n,r){return n<=this.clock&&(n=this.clock+1),e.prototype.scheduleAbsolute.call(this,t,n,r)},n.prototype.add=function(e,t){return e+t},n.prototype.toAbsoluteTime=function(e){return new Date(e).getTime()},n.prototype.toRelativeTime=function(e){return e},n.prototype.startScheduler=function(e,t){t||(t={}),null==t.created&&(t.created=ws.created),null==t.subscribed&&(t.subscribed=ws.subscribed),null==t.disposed&&(t.disposed=ws.disposed);var n,r,i=this.createObserver();return this.scheduleAbsolute(null,t.created,function(){return n=e(),cn}),this.scheduleAbsolute(null,t.subscribed,function(){return r=n.subscribe(i),cn}),this.scheduleAbsolute(null,t.disposed,function(){return r.dispose(),cn}),this.start(),i},n.prototype.createHotObservable=function(){var e,t=arguments.length;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new Ts(this,e)},n.prototype.createColdObservable=function(){var e,t=arguments.length;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new As(this,e)},n.prototype.createResolvedPromise=function(e,t){return new je(this,[qe.ReactiveTest.onNext(e,t),qe.ReactiveTest.onCompleted(e)])},n.prototype.createRejectedPromise=function(e,t){return new je(this,[qe.ReactiveTest.onError(e,t)])},n.prototype.createObserver=function(){return new Cs(this)},n}(xs);var Ps=qe.AnonymousObservable=function(e){function t(e){return e&&tt(e.dispose)?e:tt(e)?un(e):cn}function n(e,n){var r=n[0],i=n[1],o=rt(i.__subscribe).call(i,r);o!==nt||r.fail(nt.e)||c(nt.e),r.setDisposable(t(o))}function r(t,n){this.source=n,this.__subscribe=t,e.call(this)}return Qt(r,e),r.prototype._subscribe=function(e){var t=new Os(e),r=[t,this];return An.scheduleRequired()?An.schedule(r,n):n(null,r),t},r}(Kn),Os=function(e){function t(t){e.call(this),this.observer=t,this.m=new fn}Qt(t,e);var n=t.prototype;return n.next=function(e){var t=rt(this.observer.onNext).call(this.observer,e);t===nt&&(this.dispose(),c(t.e))},n.error=function(e){var t=rt(this.observer.onError).call(this.observer,e);this.dispose(),t===nt&&c(t.e)},n.completed=function(){var e=rt(this.observer.onCompleted).call(this.observer);this.dispose(),e===nt&&c(e.e)},n.setDisposable=function(e){this.m.setDisposable(e)},n.getDisposable=function(){return this.m.getDisposable()},n.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}($n),Ls=function(e){function t(t,n){this._m=t,this._u=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this._m.getDisposable(),this._u.subscribe(e))},t}(Zn),Rs=function(e){function t(t,n,r){e.call(this),this.key=t,this.underlyingObservable=r?new Ls(r,n):n}return Qt(t,e),t.prototype._subscribe=function(e){return this.underlyingObservable.subscribe(e)},t}(Kn),Ns=qe.Subject=function(e){function t(){e.call(this),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return ln(this),this.isStopped?this.hasError?(e.onError(this.error),cn):(e.onCompleted(),cn):(this.observers.push(e),new Do(this,e))},hasObservers:function(){return ln(this),this.observers.length>0},onCompleted:function(){if(ln(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=a(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(ln(this),!this.isStopped)for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),t.create=function(e,t){return new js(e,t)},t}(Kn),Ds=qe.AsyncSubject=function(e){function t(){e.call(this),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return ln(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),cn):(this.observers.push(e),new Do(this,e))},hasObservers:function(){return ln(this),this.observers.length>0},onCompleted:function(){var e,t;if(ln(this),!this.isStopped){this.isStopped=!0;var n=a(this.observers),t=n.length;if(this.hasValue)for(e=0;t>e;e++){var r=n[e];r.onNext(this.value),r.onCompleted()}else for(e=0;t>e;e++)n[e].onCompleted();this.observers.length=0}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){ln(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.error=null,this.value=null}}),t}(Kn),Is=qe.BehaviorSubject=function(e){function t(t){e.call(this),this.value=t,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return ln(this),this.isStopped?(this.hasError?e.onError(this.error):e.onCompleted(),cn):(this.observers.push(e),e.onNext(this.value),new Do(this,e))},getValue:function(){return ln(this),this.hasError&&c(this.error),this.value},hasObservers:function(){return ln(this),this.observers.length>0},onCompleted:function(){if(ln(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=a(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(ln(this),!this.isStopped){this.value=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onNext(e)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.error=null}}),t}(Kn),ks=qe.ReplaySubject=function(e){function t(e,t){return un(function(){t.dispose(),!e.isDisposed&&e.observers.splice(e.observers.indexOf(t),1)})}function n(t,n,i){this.bufferSize=null==t?r:t,this.windowSize=null==n?r:n,this.scheduler=i||An,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,e.call(this)}var r=Math.pow(2,53)-1;return Qt(n,e),en(n.prototype,Gn.prototype,{_subscribe:function(e){ln(this);var n=new Xn(this.scheduler,e),r=t(this,n);this._trim(this.scheduler.now()),this.observers.push(n);for(var i=0,o=this.q.length;o>i;i++)n.onNext(this.q[i].value);return this.hasError?n.onError(this.error):this.isStopped&&n.onCompleted(),n.ensureActive(),r},hasObservers:function(){return ln(this),this.observers.length>0},_trim:function(e){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&e-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(e){if(ln(this),!this.isStopped){var t=this.scheduler.now();this.q.push({interval:t,value:e}),this._trim(t);for(var n=0,r=a(this.observers),i=r.length;i>n;n++){var o=r[n];o.onNext(e),o.ensureActive()}}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;var t=this.scheduler.now();this._trim(t);for(var n=0,r=a(this.observers),i=r.length;i>n;n++){var o=r[n];o.onError(e),o.ensureActive()}this.observers.length=0}},onCompleted:function(){if(ln(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var t=0,n=a(this.observers),r=n.length;r>t;t++){var i=n[t];i.onCompleted(),i.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),n}(Kn),js=qe.AnonymousSubject=function(e){function t(t,n){this.observer=t,this.observable=n,e.call(this)}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return this.observable.subscribe(e)},onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),t}(Kn);qe.Pauser=function(e){function t(){e.call(this)}return Qt(t,e),t.prototype.pause=function(){this.onNext(!1)},t.prototype.resume=function(){this.onNext(!0)},t}(Ns),"function"==typeof e&&"object"==typeof e.amd&&e.amd?(We.Rx=qe,e(function(){return qe})):Be&&Ve?He?(Ve.exports=qe).Rx=qe:Be.Rx=qe:We.Rx=qe;var Fs=d()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:6}],220:[function(t,n,r){var i={REVISION:"76"};"function"==typeof e&&e.amd?e("three",i):"undefined"!=typeof r&&"undefined"!=typeof n&&(n.exports=i),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1,r=arguments.length;n!==r;++n){var i=arguments[n];if(void 0!==i&&null!==i)for(var i=Object(i),o=Object.keys(i),s=0,a=o.length;s!==a;++s){var u=o[s],c=Object.getOwnPropertyDescriptor(i,u);void 0!==c&&c.enumerable&&(t[u]=i[u])}}return t}}),i.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},i.CullFaceNone=0,i.CullFaceBack=1,i.CullFaceFront=2,i.CullFaceFrontBack=3,i.FrontFaceDirectionCW=0,i.FrontFaceDirectionCCW=1,i.BasicShadowMap=0,i.PCFShadowMap=1,i.PCFSoftShadowMap=2,i.FrontSide=0,i.BackSide=1,i.DoubleSide=2,i.FlatShading=1,i.SmoothShading=2,i.NoColors=0,i.FaceColors=1,i.VertexColors=2,i.NoBlending=0,i.NormalBlending=1,i.AdditiveBlending=2,i.SubtractiveBlending=3,i.MultiplyBlending=4,i.CustomBlending=5,i.AddEquation=100,i.SubtractEquation=101,i.ReverseSubtractEquation=102,i.MinEquation=103,i.MaxEquation=104,i.ZeroFactor=200,i.OneFactor=201,i.SrcColorFactor=202,i.OneMinusSrcColorFactor=203,i.SrcAlphaFactor=204,i.OneMinusSrcAlphaFactor=205,i.DstAlphaFactor=206,i.OneMinusDstAlphaFactor=207,i.DstColorFactor=208,i.OneMinusDstColorFactor=209,i.SrcAlphaSaturateFactor=210,i.NeverDepth=0,i.AlwaysDepth=1,i.LessDepth=2,i.LessEqualDepth=3,i.EqualDepth=4,i.GreaterEqualDepth=5,i.GreaterDepth=6,i.NotEqualDepth=7,i.MultiplyOperation=0,i.MixOperation=1,i.AddOperation=2,i.NoToneMapping=0,i.LinearToneMapping=1,i.ReinhardToneMapping=2,i.Uncharted2ToneMapping=3,i.CineonToneMapping=4,i.UVMapping=300,i.CubeReflectionMapping=301,i.CubeRefractionMapping=302,i.EquirectangularReflectionMapping=303,i.EquirectangularRefractionMapping=304,i.SphericalReflectionMapping=305,i.CubeUVReflectionMapping=306,i.CubeUVRefractionMapping=307,i.RepeatWrapping=1e3,i.ClampToEdgeWrapping=1001,i.MirroredRepeatWrapping=1002,i.NearestFilter=1003,i.NearestMipMapNearestFilter=1004,i.NearestMipMapLinearFilter=1005,i.LinearFilter=1006,i.LinearMipMapNearestFilter=1007,i.LinearMipMapLinearFilter=1008,i.UnsignedByteType=1009,i.ByteType=1010,i.ShortType=1011,i.UnsignedShortType=1012,i.IntType=1013,i.UnsignedIntType=1014,i.FloatType=1015,i.HalfFloatType=1025,i.UnsignedShort4444Type=1016,i.UnsignedShort5551Type=1017,i.UnsignedShort565Type=1018,i.AlphaFormat=1019,i.RGBFormat=1020,i.RGBAFormat=1021,i.LuminanceFormat=1022,i.LuminanceAlphaFormat=1023,i.RGBEFormat=i.RGBAFormat,i.DepthFormat=1026,i.RGB_S3TC_DXT1_Format=2001,i.RGBA_S3TC_DXT1_Format=2002,i.RGBA_S3TC_DXT3_Format=2003,i.RGBA_S3TC_DXT5_Format=2004,i.RGB_PVRTC_4BPPV1_Format=2100,i.RGB_PVRTC_2BPPV1_Format=2101,i.RGBA_PVRTC_4BPPV1_Format=2102,i.RGBA_PVRTC_2BPPV1_Format=2103,i.RGB_ETC1_Format=2151,i.LoopOnce=2200,i.LoopRepeat=2201,i.LoopPingPong=2202,i.InterpolateDiscrete=2300,i.InterpolateLinear=2301,i.InterpolateSmooth=2302,i.ZeroCurvatureEnding=2400,i.ZeroSlopeEnding=2401,i.WrapAroundEnding=2402,i.TrianglesDrawMode=0,i.TriangleStripDrawMode=1,i.TriangleFanDrawMode=2,i.LinearEncoding=3e3,i.sRGBEncoding=3001,i.GammaEncoding=3007,i.RGBEEncoding=3002,i.LogLuvEncoding=3003,i.RGBM7Encoding=3004,i.RGBM16Encoding=3005,i.RGBDEncoding=3006,i.BasicDepthPacking=3200,i.RGBADepthPacking=3201,i.Color=function(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},i.Color.prototype={constructor:i.Color,r:1,g:1,b:1,set:function(e){return e instanceof i.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.b=this.g=this.r=e},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?e+6*(t-e)*n:.5>n?t:2/3>n?e+6*(t-e)*(2/3-n):e}return function(t,n,r){return t=i.Math.euclideanModulo(t,1),n=i.Math.clamp(n,0,1),r=i.Math.clamp(r,0,1),0===n?this.r=this.g=this.b=r:(n=.5>=r?r*(1+n):r+n-r*n,r=2*r-n,this.r=e(r,n,t+1/3),this.g=e(r,n,t),this.b=e(r,n,t-1/3)),this}}(),setStyle:function(e){function t(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r=n[2];switch(n[1]){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){var r=parseFloat(n[1])/360,o=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(r,o,s)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){if(n=n[1],r=n.length,3===r)return this.r=parseInt(n.charAt(0)+n.charAt(0),16)/255,this.g=parseInt(n.charAt(1)+n.charAt(1),16)/255,this.b=parseInt(n.charAt(2)+n.charAt(2),16)/255,this;if(6===r)return this.r=parseInt(n.charAt(0)+n.charAt(1),16)/255,this.g=parseInt(n.charAt(2)+n.charAt(3),16)/255,this.b=parseInt(n.charAt(4)+n.charAt(5),16)/255,this}return e&&00?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e=e||{h:0,s:0,l:0};var t,n=this.r,r=this.g,i=this.b,o=Math.max(n,r,i),s=Math.min(n,r,i),a=(s+o)/2;if(s===o)s=t=0;else{var u=o-s,s=.5>=a?u/(o+s):u/(2-o-s);switch(o){case n:t=(r-i)/u+(i>r?6:0);break;case r:t=(i-n)/u+2;break;case i:t=(n-r)/u+4}t/=6}return e.h=t,e.s=s,e.l=a,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){var r=this.getHSL();return r.h+=e,r.s+=t,r.l+=n,this.setHSL(r.h,r.s,r.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,
-this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},i.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,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},i.Quaternion=function(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1},i.Quaternion.prototype={constructor:i.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1==e instanceof i.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=Math.cos(e._x/2),r=Math.cos(e._y/2),o=Math.cos(e._z/2),s=Math.sin(e._x/2),a=Math.sin(e._y/2),u=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(this._x=s*r*o+n*a*u,this._y=n*a*o-s*r*u,this._z=n*r*u+s*a*o,this._w=n*r*o-s*a*u):"YXZ"===c?(this._x=s*r*o+n*a*u,this._y=n*a*o-s*r*u,this._z=n*r*u-s*a*o,this._w=n*r*o+s*a*u):"ZXY"===c?(this._x=s*r*o-n*a*u,this._y=n*a*o+s*r*u,this._z=n*r*u+s*a*o,this._w=n*r*o-s*a*u):"ZYX"===c?(this._x=s*r*o-n*a*u,this._y=n*a*o+s*r*u,this._z=n*r*u-s*a*o,this._w=n*r*o+s*a*u):"YZX"===c?(this._x=s*r*o+n*a*u,this._y=n*a*o+s*r*u,this._z=n*r*u-s*a*o,this._w=n*r*o-s*a*u):"XZY"===c&&(this._x=s*r*o-n*a*u,this._y=n*a*o-s*r*u,this._z=n*r*u+s*a*o,this._w=n*r*o+s*a*u),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0];e=t[4];var r=t[8],i=t[1],o=t[5],s=t[9],a=t[2],u=t[6],t=t[10],c=n+o+t;return c>0?(n=.5/Math.sqrt(c+1),this._w=.25/n,this._x=(u-s)*n,this._y=(r-a)*n,this._z=(i-e)*n):n>o&&n>t?(n=2*Math.sqrt(1+n-o-t),this._w=(u-s)/n,this._x=.25*n,this._y=(e+i)/n,this._z=(r+a)/n):o>t?(n=2*Math.sqrt(1+o-n-t),this._w=(r-a)/n,this._x=(e+i)/n,this._y=.25*n,this._z=(s+u)/n):(n=2*Math.sqrt(1+t-n-o),this._w=(i-e)/n,this._x=(r+a)/n,this._y=(s+u)/n,this._z=.25*n),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(n,r){return void 0===e&&(e=new i.Vector3),t=n.dot(r)+1,1e-6>t?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,o=e._w,s=t._x,a=t._y,u=t._z,c=t._w;return this._x=n*c+o*s+r*u-i*a,this._y=r*c+o*a+i*s-n*u,this._z=i*c+o*u+n*a-r*s,this._w=o*c-n*s-r*a-i*u,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,o=this._w,s=o*e._w+n*e._x+r*e._y+i*e._z;if(0>s?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var a=Math.sqrt(1-s*s);if(.001>Math.abs(a))return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var u=Math.atan2(a,s),s=Math.sin((1-t)*u)/a,a=Math.sin(t*u)/a;return this._w=o*s+this._w*a,this._x=n*s+this._x*a,this._y=r*s+this._y*a,this._z=i*s+this._z*a,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(i.Quaternion,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,o,s){var a=n[r+0],u=n[r+1],c=n[r+2];n=n[r+3],r=i[o+0];var h=i[o+1],l=i[o+2];if(i=i[o+3],n!==i||a!==r||u!==h||c!==l){o=1-s;var p=a*r+u*h+c*l+n*i,f=p>=0?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),f*=s,a=a*o+r*f,u=u*o+h*f,c=c*o+l*f,n=n*o+i*f,o===1-s&&(s=1/Math.sqrt(a*a+u*u+c*c+n*n),a*=s,u*=s,c*=s,n*=s)}e[t]=a,e[t+1]=u,e[t+2]=c,e[t+3]=n}}),i.Vector2=function(e,t){this.x=e||0,this.y=t||0},i.Vector2.prototype={constructor:i.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):this.y=this.x=0,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new i.Vector2,t=new i.Vector2),e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n),this},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(e){return this.x*e.x+this.y*e.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())},angle:function(){var e=Math.atan2(this.y,this.x);return 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;return e=this.y-e.y,t*t+e*e},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}},i.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},i.Vector3.prototype={constructor:i.Vector3,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):this.z=this.y=this.x=0,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return!1==t instanceof i.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,n)),this}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[3]*n+e[6]*r,this.y=e[1]*t+e[4]*n+e[7]*r,this.z=e[2]*t+e[5]*n+e[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r+e[12],this.y=e[1]*t+e[5]*n+e[9]*r+e[13],this.z=e[2]*t+e[6]*n+e[10]*r+e[14],this},applyProjection:function(e){var t=this.x,n=this.y,r=this.z;e=e.elements;var i=1/(e[3]*t+e[7]*n+e[11]*r+e[15]);return this.x=(e[0]*t+e[4]*n+e[8]*r+e[12])*i,this.y=(e[1]*t+e[5]*n+e[9]*r+e[13])*i,this.z=(e[2]*t+e[6]*n+e[10]*r+e[14])*i,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,s=e.z;e=e.w;var a=e*t+o*r-s*n,u=e*n+s*t-i*r,c=e*r+i*n-o*t,t=-i*t-o*n-s*r;return this.x=a*e+t*-i+u*-s-c*-o,this.y=u*e+t*-o+c*-i-a*-s,this.z=c*e+t*-s+a*-o-u*-i,this},project:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r,this.y=e[1]*t+e[5]*n+e[9]*r,this.z=e[2]*t+e[6]*n+e[10]*r,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new i.Vector3,t=new i.Vector3),e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n),this},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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var n=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-n*e.z,this.z=n*e.y-r*e.x,this},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,o=t.x,s=t.y,a=t.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this},projectOnVector:function(){var e,t;return function(n){return void 0===e&&(e=new i.Vector3),e.copy(n).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){return e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq()),Math.acos(i.Math.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return e=this.z-e.z,t*t+n*n+e*e},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length();return e=this.setFromMatrixColumn(e,2).length(),this.x=t,this.y=n,this.z=e,this},setFromMatrixColumn:function(e,t){return"number"==typeof e&&(console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."),t=e=t),this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},i.Vector4=function(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1},i.Vector4.prototype={constructor:i.Vector4,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.w=this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r+e[12]*i,this.y=e[1]*t+e[5]*n+e[9]*r+e[13]*i,this.z=e[2]*t+e[6]*n+e[10]*r+e[14]*i,this.w=e[3]*t+e[7]*n+e[11]*r+e[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.z=this.y=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r;e=e.elements;var i=e[0];r=e[4];var o=e[8],s=e[1],a=e[5],u=e[9];n=e[2],t=e[6];var c=e[10];return.01>Math.abs(r-s)&&.01>Math.abs(o-n)&&.01>Math.abs(u-t)?.1>Math.abs(r+s)&&.1>Math.abs(o+n)&&.1>Math.abs(u+t)&&.1>Math.abs(i+a+c-3)?(this.set(1,0,0,0),this):(e=Math.PI,i=(i+1)/2,a=(a+1)/2,c=(c+1)/2,r=(r+s)/4,o=(o+n)/4,u=(u+t)/4,i>a&&i>c?.01>i?(t=0,r=n=.707106781):(t=Math.sqrt(i),n=r/t,r=o/t):a>c?.01>a?(t=.707106781,n=0,r=.707106781):(n=Math.sqrt(a),t=r/n,r=u/n):.01>c?(n=t=.707106781,r=0):(r=Math.sqrt(c),t=o/r,n=u/r),this.set(t,n,r,e),this):(e=Math.sqrt((t-u)*(t-u)+(o-n)*(o-n)+(s-r)*(s-r)),.001>Math.abs(e)&&(e=1),this.x=(t-u)/e,this.y=(o-n)/e,this.z=(s-r)/e,this.w=Math.acos((i+a+c-1)/2),this)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new i.Vector4,t=new i.Vector4),e.set(n,n,n,n),t.set(r,r,r,r),this.clamp(e,t)}}(),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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},i.Euler=function(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||i.Euler.DefaultOrder},i.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),i.Euler.DefaultOrder="XYZ",i.Euler.prototype={constructor:i.Euler,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=i.Math.clamp,o=e.elements;e=o[0];var s=o[4],a=o[8],u=o[1],c=o[5],h=o[9],l=o[2],p=o[6],o=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(r(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,o),this._z=Math.atan2(-s,e)):(this._x=Math.atan2(p,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(a,o),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-l,e),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(-l,o),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,e))):"ZYX"===t?(this._y=Math.asin(-r(l,-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(p,o),this._z=Math.atan2(u,e)):(this._x=0,this._z=Math.atan2(-s,c))):"YZX"===t?(this._z=Math.asin(r(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-l,e)):(this._x=0,this._y=Math.atan2(a,o))):"XZY"===t?(this._z=Math.asin(-r(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,e)):(this._x=Math.atan2(-h,o),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,r),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new i.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new i.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},i.Line3=function(e,t){this.start=void 0!==e?e:new i.Vector3,this.end=void 0!==t?t:new i.Vector3},i.Line3.prototype={constructor:i.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){return(e||new i.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new i.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var n=t||new i.Vector3;return this.delta(n).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new i.Vector3,t=new i.Vector3;return function(n,r){e.subVectors(n,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),o=t.dot(e)/o;return r&&(o=i.Math.clamp(o,0,1)),o}}(),closestPointToPoint:function(e,t,n){return e=this.closestPointToPointParameter(e,t),n=n||new i.Vector3,this.delta(n).multiplyScalar(e).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},i.Box2=function(e,t){this.min=void 0!==e?e:new i.Vector2(1/0,1/0),this.max=void 0!==t?t:new i.Vector2(-(1/0),-(1/0))},i.Box2.prototype={constructor:i.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;n>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector2;return function(t,n){var r=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.xthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new i.Vector2).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new i.Vector2).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector2;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max);
-}},i.Box3=function(e,t){this.min=void 0!==e?e:new i.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new i.Vector3(-(1/0),-(1/0),-(1/0))},i.Box3.prototype={constructor:i.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-(1/0),o=-(1/0),s=-(1/0),a=0,u=e.length;u>a;a+=3){var c=e[a],h=e[a+1],l=e[a+2];t>c&&(t=c),n>h&&(n=h),r>l&&(r=l),c>i&&(i=c),h>o&&(o=h),l>s&&(s=l)}this.min.set(t,n,r),this.max.set(i,o,s)},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;n>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector3;return function(t,n){var r=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),setFromObject:function(){var e=new i.Vector3;return function(t){var n=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var r=t.geometry;if(void 0!==r)if(r instanceof i.Geometry)for(var o=r.vertices,r=0,s=o.length;s>r;r++)e.copy(o[r]),e.applyMatrix4(t.matrixWorld),n.expandByPoint(e);else if(r instanceof i.BufferGeometry&&void 0!==r.attributes.position)for(o=r.attributes.position.array,r=0,s=o.length;s>r;r+=3)e.fromArray(o,r),e.applyMatrix4(t.matrixWorld),n.expandByPoint(e)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.xthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new i.Vector3).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,n;return 0=e.constant},clampPoint:function(e,t){return(t||new i.Vector3).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new i.Vector3;return function(t){return t=t||new i.Sphere,t.center=this.center(),t.radius=.5*this.size(e).length(),t}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},i.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0o;o+=3,n+=3)e.fromArray(t,n),e.applyMatrix3(this),e.toArray(t,n);return t}}(),applyToBuffer:function(){var e;return function(t,n,r){void 0===e&&(e=new i.Vector3),void 0===n&&(n=0),void 0===r&&(r=t.length/t.itemSize);for(var o=0;r>o;o++,n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],u=e[7],e=e[8];return t*o*e-t*s*u-n*i*e+n*s*a+r*i*u-r*o*a},getInverse:function(e,t){e instanceof i.Matrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=e.elements,r=this.elements,o=n[0],s=n[1],a=n[2],u=n[3],c=n[4],h=n[5],l=n[6],p=n[7],n=n[8],f=n*c-h*p,d=h*l-n*u,m=p*u-c*l,v=o*f+s*d+a*m;if(0===v){if(t)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return r[0]=f,r[1]=a*p-n*s,r[2]=h*s-a*c,r[3]=d,r[4]=n*o-a*l,r[5]=a*u-h*o,r[6]=m,r[7]=s*l-p*o,r[8]=c*o-s*u,this.multiplyScalar(1/v)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},i.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0o;o+=3,n+=3)e.fromArray(t,n),e.applyMatrix4(this),e.toArray(t,n);return t}}(),applyToBuffer:function(){var e;return function(t,n,r){void 0===e&&(e=new i.Vector3),void 0===n&&(n=0),void 0===r&&(r=t.length/t.itemSize);for(var o=0;r>o;o++,n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],s=e[5],a=e[9],u=e[13],c=e[2],h=e[6],l=e[10],p=e[14];return e[3]*(+i*a*h-r*u*h-i*s*l+n*u*l+r*s*p-n*a*p)+e[7]*(+t*a*p-t*u*l+i*o*l-r*o*p+r*u*c-i*a*c)+e[11]*(+t*u*h-t*s*p-i*o*h+n*o*p+i*s*c-n*u*c)+e[15]*(-r*s*c-t*a*h+t*s*l+r*o*h-n*o*l+n*a*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getPosition:function(){var e;return function(){return void 0===e&&(e=new i.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var n=this.elements,r=e.elements,i=r[0],o=r[1],s=r[2],a=r[3],u=r[4],c=r[5],h=r[6],l=r[7],p=r[8],f=r[9],d=r[10],m=r[11],v=r[12],g=r[13],y=r[14],r=r[15],_=f*y*l-g*d*l+g*h*m-c*y*m-f*h*r+c*d*r,b=v*d*l-p*y*l-v*h*m+u*y*m+p*h*r-u*d*r,x=p*g*l-v*f*l+v*c*m-u*g*m-p*c*r+u*f*r,w=v*f*h-p*g*h-v*c*d+u*g*d+p*c*y-u*f*y,S=i*_+o*b+s*x+a*w;if(0===S){if(t)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return n[0]=_,n[1]=g*d*a-f*y*a-g*s*m+o*y*m+f*s*r-o*d*r,n[2]=c*y*a-g*h*a+g*s*l-o*y*l-c*s*r+o*h*r,n[3]=f*h*a-c*d*a-f*s*l+o*d*l+c*s*m-o*h*m,n[4]=b,n[5]=p*y*a-v*d*a+v*s*m-i*y*m-p*s*r+i*d*r,n[6]=v*h*a-u*y*a-v*s*l+i*y*l+u*s*r-i*h*r,n[7]=u*d*a-p*h*a+p*s*l-i*d*l-u*s*m+i*h*m,n[8]=x,n[9]=v*f*a-p*g*a-v*o*m+i*g*m+p*o*r-i*f*r,n[10]=u*g*a-v*c*a+v*o*l-i*g*l-u*o*r+i*c*r,n[11]=p*c*a-u*f*a-p*o*l+i*f*l+u*o*m-i*c*m,n[12]=w,n[13]=p*g*s-v*f*s+v*o*d-i*g*d-p*o*y+i*f*y,n[14]=v*c*s-u*g*s-v*o*h+i*g*h+u*o*y-i*c*y,n[15]=u*f*s-p*c*s+p*o*h-i*f*h-u*o*d+i*c*d,this.multiplyScalar(1/S)},scale:function(e){var t=this.elements,n=e.x,r=e.y;return e=e.z,t[0]*=n,t[4]*=r,t[8]*=e,t[1]*=n,t[5]*=r,t[9]*=e,t[2]*=n,t[6]*=r,t[10]*=e,t[3]*=n,t[7]*=r,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,s=e.y,a=e.z,u=i*o,c=i*s;return this.set(u*o+n,u*s-r*a,u*a+r*s,0,u*s+r*a,c*s+n,c*a-r*o,0,u*a-r*s,c*a+r*o,i*a*a+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},compose:function(e,t,n){return this.makeRotationFromQuaternion(t),this.scale(n),this.setPosition(e),this},decompose:function(){var e,t;return function(n,r,o){void 0===e&&(e=new i.Vector3),void 0===t&&(t=new i.Matrix4);var s=this.elements,a=e.set(s[0],s[1],s[2]).length(),u=e.set(s[4],s[5],s[6]).length(),c=e.set(s[8],s[9],s[10]).length();0>this.determinant()&&(a=-a),n.x=s[12],n.y=s[13],n.z=s[14],t.elements.set(this.elements),n=1/a;var s=1/u,h=1/c;return t.elements[0]*=n,t.elements[1]*=n,t.elements[2]*=n,t.elements[4]*=s,t.elements[5]*=s,t.elements[6]*=s,t.elements[8]*=h,t.elements[9]*=h,t.elements[10]*=h,r.setFromRotationMatrix(t),o.x=a,o.y=u,o.z=c,this}}(),makeFrustum:function(e,t,n,r,i,o){var s=this.elements;return s[0]=2*i/(t-e),s[4]=0,s[8]=(t+e)/(t-e),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},makePerspective:function(e,t,n,r){e=n*Math.tan(i.Math.DEG2RAD*e*.5);var o=-e;return this.makeFrustum(o*t,e*t,o,e,n,r)},makeOrthographic:function(e,t,n,r,i,o){var s=this.elements,a=1/(t-e),u=1/(n-r),c=1/(o-i);return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-((t+e)*a),s[1]=0,s[5]=2*u,s[9]=0,s[13]=-((n+r)*u),s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-((o+i)*c),s[3]=0,s[7]=0,s[11]=0,s[15]=1,this},equals:function(e){var t=this.elements;e=e.elements;for(var n=0;16>n;n++)if(t[n]!==e[n])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},i.Ray=function(e,t){this.origin=void 0!==e?e:new i.Vector3,this.direction=void 0!==t?t:new i.Vector3},i.Ray.prototype={constructor:i.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new i.Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){this.direction.copy(e).sub(this.origin).normalize()},recast:function(){var e=new i.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var n=t||new i.Vector3;n.subVectors(e,this.origin);var r=n.dot(this.direction);return 0>r?n.copy(this.origin):n.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new i.Vector3;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return 0>n?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Vector3;return function(r,i,o,s){e.copy(r).add(i).multiplyScalar(.5),t.copy(i).sub(r).normalize(),n.copy(this.origin).sub(e);var a,u=.5*r.distanceTo(i),c=-this.direction.dot(t),h=n.dot(this.direction),l=-n.dot(t),p=n.lengthSq(),f=Math.abs(1-c*c);return f>0?(r=c*l-h,i=c*h-l,a=u*f,r>=0?i>=-a?a>=i?(u=1/f,r*=u,i*=u,c=r*(r+c*i+2*h)+i*(c*r+i+2*l)+p):(i=u,r=Math.max(0,-(c*i+h)),c=-r*r+i*(i+2*l)+p):(i=-u,r=Math.max(0,-(c*i+h)),c=-r*r+i*(i+2*l)+p):-a>=i?(r=Math.max(0,-(-c*u+h)),i=r>0?-u:Math.min(Math.max(-u,-l),u),c=-r*r+i*(i+2*l)+p):a>=i?(r=0,i=Math.min(Math.max(-u,-l),u),c=i*(i+2*l)+p):(r=Math.max(0,-(c*u+h)),i=r>0?u:Math.min(Math.max(-u,-l),u),c=-r*r+i*(i+2*l)+p)):(i=c>0?-u:u,r=Math.max(0,-(c*i+h)),c=-r*r+i*(i+2*l)+p),o&&o.copy(this.direction).multiplyScalar(r).add(this.origin),s&&s.copy(t).multiplyScalar(i).add(e),c}}(),intersectSphere:function(){var e=new i.Vector3;return function(t,n){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),i=e.dot(e)-r*r,o=t.radius*t.radius;return i>o?null:(o=Math.sqrt(o-i),i=r-o,r+=o,0>i&&0>r?null:0>i?this.at(r,n):this.at(i,n))}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);return 0===t?0===e.distanceToPoint(this.origin)?0:null:(e=-(this.origin.dot(e.normal)+e.constant)/t,e>=0?e:null)},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||0>e.normal.dot(this.direction)*t},intersectBox:function(e,t){var n,r,i,o,s;r=1/this.direction.x,o=1/this.direction.y,s=1/this.direction.z;var a=this.origin;return r>=0?(n=(e.min.x-a.x)*r,r*=e.max.x-a.x):(n=(e.max.x-a.x)*r,r*=e.min.x-a.x),o>=0?(i=(e.min.y-a.y)*o,o*=e.max.y-a.y):(i=(e.max.y-a.y)*o,o*=e.min.y-a.y),n>o||i>r?null:((i>n||n!==n)&&(n=i),(r>o||r!==r)&&(r=o),s>=0?(i=(e.min.z-a.z)*s,s*=e.max.z-a.z):(i=(e.max.z-a.z)*s,s*=e.min.z-a.z),n>s||i>r?null:((i>n||n!==n)&&(n=i),(r>s||r!==r)&&(r=s),0>r?null:this.at(n>=0?n:r,t)))},intersectsBox:function(){var e=new i.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Vector3,r=new i.Vector3;return function(i,o,s,a,u){if(t.subVectors(o,i),n.subVectors(s,i),r.crossVectors(t,n),o=this.direction.dot(r),o>0){if(a)return null;a=1}else{if(!(0>o))return null;a=-1,o=-o}return e.subVectors(this.origin,i),i=a*this.direction.dot(n.crossVectors(e,n)),0>i?null:(s=a*this.direction.dot(t.cross(e)),0>s||i+s>o?null:(i=-a*e.dot(r),0>i?null:this.at(i/o,u)))}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},i.Sphere=function(e,t){this.center=void 0!==e?e:new i.Vector3,this.radius=void 0!==t?t:0},i.Sphere.prototype={constructor:i.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new i.Box3;return function(t,n){var r=this.center;void 0!==n?r.copy(n):e.setFromPoints(t).center(r);for(var i=0,o=0,s=t.length;s>o;o++)i=Math.max(i,r.distanceToSquared(t[o]));return this.radius=Math.sqrt(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e),r=t||new i.Vector3;return r.copy(e),n>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){return e=e||new i.Box3,e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},i.Frustum=function(e,t,n,r,o,s){this.planes=[void 0!==e?e:new i.Plane,void 0!==t?t:new i.Plane,void 0!==n?n:new i.Plane,void 0!==r?r:new i.Plane,void 0!==o?o:new i.Plane,void 0!==s?s:new i.Plane]},i.Frustum.prototype={constructor:i.Frustum,set:function(e,t,n,r,i,o){var s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;6>n;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements;e=n[0];var r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],u=n[6],c=n[7],h=n[8],l=n[9],p=n[10],f=n[11],d=n[12],m=n[13],v=n[14],n=n[15];return t[0].setComponents(o-e,c-s,f-h,n-d).normalize(),t[1].setComponents(o+e,c+s,f+h,n+d).normalize(),t[2].setComponents(o+r,c+a,f+l,n+m).normalize(),t[3].setComponents(o-r,c-a,f-l,n-m).normalize(),t[4].setComponents(o-i,c-u,f-p,n-v).normalize(),t[5].setComponents(o+i,c+u,f+p,n+v).normalize(),this},intersectsObject:function(){var e=new i.Sphere;return function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),e.copy(n.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){var t=this.planes,n=e.center;e=-e.radius;for(var r=0;6>r;r++)if(t[r].distanceToPoint(n)i;i++){var o=r[i];e.x=0s&&0>o)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;6>n;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}},i.Plane=function(e,t){this.normal=void 0!==e?e:new i.Vector3(1,0,0),this.constant=void 0!==t?t:0},i.Plane.prototype={constructor:i.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new i.Vector3,t=new i.Vector3;return function(n,r,i){return r=e.subVectors(i,r).cross(t.subVectors(n,r)).normalize(),this.setFromNormalAndCoplanarPoint(r,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var n=this.distanceToPoint(e);return(t||new i.Vector3).copy(this.normal).multiplyScalar(n)},intersectLine:function(){var e=new i.Vector3;return function(t,n){var r=n||new i.Vector3,o=t.delta(e),s=this.normal.dot(o);return 0!==s?(s=-(t.start.dot(this.normal)+this.constant)/s,0>s||s>1?void 0:r.copy(o).multiplyScalar(s).add(t.start)):0===this.distanceToPoint(t.start)?r.copy(t.start):void 0}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start);return e=this.distanceToPoint(e.end),0>t&&e>0||0>e&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new i.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new i.Vector3,t=new i.Matrix3;return function(n,r){var i=this.coplanarPoint(e).applyMatrix4(n),o=r||t.getNormalMatrix(n),o=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(o),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},i.Spherical=function(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this},i.Spherical.prototype={constructor:i.Spherical,set:function(e,t,n){this.radius=e,this.phi=t,this.theta=n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius.copy(e.radius),this.phi.copy(e.phi),this.theta.copy(e.theta),this},makeSafe:function(){this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi))},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(i.Math.clamp(e.y/this.radius,-1,1))),this}},i.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=Array(36),r=0;return function(){for(var i=0;36>i;i++)8===i||13===i||18===i||23===i?n[i]="-":14===i?n[i]="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,n[i]=t[19===i?3&e|8:e]);return n.join("")}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},smoothstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*i.Math.DEG2RAD},radToDeg:function(e){return e*i.Math.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},i.Spline=function(e){function t(e,t,n,r,i,o,s){return e=.5*(n-e),r=.5*(r-t),(2*(t-n)+e+r)*s+(-3*(t-n)-2*e-r)*o+e*i+t}this.points=e;var n,r,o,s,a,u,c,h,l,p=[],f={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;tthis.points.length-2?this.points.length-1:r+1,p[3]=r>this.points.length-3?this.points.length-1:r+2,u=this.points[p[0]],c=this.points[p[1]],h=this.points[p[2]],l=this.points[p[3]],s=o*o,a=o*s,f.x=t(u.x,c.x,h.x,l.x,o,s,a),f.y=t(u.y,c.y,h.y,l.y,o,s,a),f.z=t(u.z,c.z,h.z,l.z,o,s,a),f},this.getControlPointsArray=function(){var e,t,n=this.points.length,r=[];for(e=0;n>e;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(e){var t,n,r,o=t=t=0,s=new i.Vector3,a=new i.Vector3,u=[],c=0;for(u[0]=0,e||(e=100),n=this.points.length*e,s.copy(this.points[0]),e=1;n>e;e++)t=e/n,r=this.getPoint(t),a.copy(r),c+=a.distanceTo(s),s.copy(r),t*=this.points.length-1,t=Math.floor(t),t!==o&&(u[t]=c,o=t);return u[u.length]=c,{chunks:u,total:c}},this.reparametrizeByArcLength=function(e){var t,n,r,o,s,a,u=[],c=new i.Vector3,h=this.getLength();for(u.push(c.copy(this.points[0]).clone()),t=1;tn;n++)r=o+1/a*n*(s-o),r=this.getPoint(r),u.push(c.copy(r).clone());u.push(c.copy(this.points[t]).clone())}this.points=u}},i.Triangle=function(e,t,n){this.a=void 0!==e?e:new i.Vector3,this.b=void 0!==t?t:new i.Vector3,this.c=void 0!==n?n:new i.Vector3},i.Triangle.normal=function(){var e=new i.Vector3;return function(t,n,r,o){return o=o||new i.Vector3,o.subVectors(r,n),e.subVectors(t,n),o.cross(e),t=o.lengthSq(),t>0?o.multiplyScalar(1/Math.sqrt(t)):o.set(0,0,0)}}(),i.Triangle.barycoordFromPoint=function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Vector3;return function(r,o,s,a,u){e.subVectors(a,o),t.subVectors(s,o),n.subVectors(r,o),r=e.dot(e),o=e.dot(t),s=e.dot(n);var c=t.dot(t);a=t.dot(n);var h=r*c-o*o;return u=u||new i.Vector3,0===h?u.set(-2,-1,-1):(h=1/h,c=(c*s-o*a)*h,r=(r*a-o*s)*h,u.set(1-c-r,r,c))}}(),i.Triangle.containsPoint=function(){var e=new i.Vector3;return function(t,n,r,o){return t=i.Triangle.barycoordFromPoint(t,n,r,o,e),0<=t.x&&0<=t.y&&1>=t.x+t.y}}(),i.Triangle.prototype={constructor:i.Triangle,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this;
-},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new i.Vector3,t=new i.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new i.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return i.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new i.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return i.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return i.Triangle.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,n,r;return function(o,s){void 0===e&&(e=new i.Plane,t=[new i.Line3,new i.Line3,new i.Line3],n=new i.Vector3,r=new i.Vector3);var a=s||new i.Vector3,u=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(o,n),!0===this.containsPoint(n))a.copy(n);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var c=0;ch&&(u=h,a.copy(r))}}return a}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},i.Interpolant=function(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n},i.Interpolant.prototype={constructor:i.Interpolant,evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{n:{r:if(!(r>e)){for(var o=n+2;;){if(void 0===r){if(i>e)break r;return this._cachedIndex=n=t.length,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],r>e)break t}r=t.length;break n}if(e>=i)break e;for(o=t[1],o>e&&(n=2,i=o),o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}r=n,n=0}for(;r>n;)i=n+r>>>1,ei;i++)n[i]=t[i];for(i=0;r>i;i++)n[i].call(this,e)}}}},i.Layers=function(){this.mask=1},i.Layers.prototype={constructor:i.Layers,set:function(e){this.mask=1<i;i++)n(e[i],t,r,!0)}}e.Raycaster=function(t,n,r,i){this.ray=new e.Ray(t,n),this.near=r||0,this.far=i||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}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,n){n instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(n).sub(this.ray.origin).normalize()):n instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,r){var i=[];return n(e,this,i,r),i.sort(t),i},intersectObjects:function(e,r){var i=[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var o=0,s=e.length;s>o;o++)n(e[o],this,i,r);return i.sort(t),i}}}(i),i.Object3D=function(){Object.defineProperty(this,"id",{value:i.Object3DIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.Object3D.DefaultUp.clone();var e=new i.Vector3,t=new i.Euler,n=new i.Quaternion,r=new i.Vector3(1,1,1);t.onChange(function(){n.setFromEuler(t,!1)}),n.onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:r},modelViewMatrix:{value:new i.Matrix4},normalMatrix:{value:new i.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new i.Matrix4,this.matrixWorld=new i.Matrix4,this.matrixAutoUpdate=i.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new i.Layers,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},i.Object3D.DefaultUp=new i.Vector3(0,1,0),i.Object3D.DefaultMatrixAutoUpdate=!0,i.Object3D.prototype={constructor:i.Object3D,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new i.Quaternion;return function(t,n){return e.setFromAxisAngle(t,n),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new i.Vector3;return function(t,n){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(n)),this}}(),translateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new i.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new i.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(1n;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return e=e||new i.Vector3,this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new i.Vector3,t=new i.Vector3;return function(n){return n=n||new i.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldRotation:function(){var e=new i.Quaternion;return function(t){return t=t||new i.Euler,this.getWorldQuaternion(e),t.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new i.Vector3,t=new i.Quaternion;return function(n){return n=n||new i.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new i.Quaternion;return function(t){return t=t||new i.Vector3,this.getWorldQuaternion(e),t.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;r>n;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;r>n;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==e||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,n=this.children.length;n>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t,n=[];for(t in e){var r=e[t];delete r.metadata,n.push(r)}return n}var n=void 0===e||""===e,r={};n&&(e={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),i.material=this.material.uuid),0t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;n>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},i.BufferAttribute=function(e,t,n){this.uuid=i.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0,this.normalized=!0===n},i.BufferAttribute.prototype={constructor:i.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;i>r;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),s=new i.Color),t[n++]=s.r,t[n++]=s.g,t[n++]=s.b}return this},copyIndicesArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;i>r;r++){var o=e[r];t[n++]=o.a,t[n++]=o.b,t[n++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),s=new i.Vector2),t[n++]=s.x,t[n++]=s.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),s=new i.Vector3),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),s=new i.Vector4),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z,t[n++]=s.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},clone:function(){return(new this.constructor).copy(this)}},i.Int8Attribute=function(e,t){return new i.BufferAttribute(new Int8Array(e),t)},i.Uint8Attribute=function(e,t){return new i.BufferAttribute(new Uint8Array(e),t)},i.Uint8ClampedAttribute=function(e,t){return new i.BufferAttribute(new Uint8ClampedArray(e),t)},i.Int16Attribute=function(e,t){return new i.BufferAttribute(new Int16Array(e),t)},i.Uint16Attribute=function(e,t){return new i.BufferAttribute(new Uint16Array(e),t)},i.Int32Attribute=function(e,t){return new i.BufferAttribute(new Int32Array(e),t)},i.Uint32Attribute=function(e,t){return new i.BufferAttribute(new Uint32Array(e),t)},i.Float32Attribute=function(e,t){return new i.BufferAttribute(new Float32Array(e),t)},i.Float64Attribute=function(e,t){return new i.BufferAttribute(new Float64Array(e),t)},i.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new i.BufferAttribute(e,t).setDynamic(!0)},i.InstancedBufferAttribute=function(e,t,n){i.BufferAttribute.call(this,e,t),this.meshPerAttribute=n||1},i.InstancedBufferAttribute.prototype=Object.create(i.BufferAttribute.prototype),i.InstancedBufferAttribute.prototype.constructor=i.InstancedBufferAttribute,i.InstancedBufferAttribute.prototype.copy=function(e){return i.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBuffer=function(e,t){this.uuid=i.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},i.InterleavedBuffer.prototype={constructor:i.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;i>r;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},i.InstancedInterleavedBuffer=function(e,t,n){i.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=n||1},i.InstancedInterleavedBuffer.prototype=Object.create(i.InterleavedBuffer.prototype),i.InstancedInterleavedBuffer.prototype.constructor=i.InstancedInterleavedBuffer,i.InstancedInterleavedBuffer.prototype.copy=function(e){return i.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBufferAttribute=function(e,t,n){this.uuid=i.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=n},i.InterleavedBufferAttribute.prototype={constructor:i.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}},i.Geometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},i.Geometry.prototype={constructor:i.Geometry,applyMatrix:function(e){for(var t=(new i.Matrix3).getNormalMatrix(e),n=0,r=this.vertices.length;r>n;n++)this.vertices[n].applyMatrix4(e);for(n=0,r=this.faces.length;r>n;n++){e=this.faces[n],e.normal.applyMatrix3(t).normalize();for(var o=0,s=e.vertexNormals.length;s>o;o++)e.vertexNormals[o].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,r,o){var s=void 0!==a?[l[e].clone(),l[t].clone(),l[r].clone()]:[],d=void 0!==u?[n.colors[e].clone(),n.colors[t].clone(),n.colors[r].clone()]:[];o=new i.Face3(e,t,r,s,d,o),n.faces.push(o),void 0!==c&&n.faceVertexUvs[0].push([p[e].clone(),p[t].clone(),p[r].clone()]),void 0!==h&&n.faceVertexUvs[1].push([f[e].clone(),f[t].clone(),f[r].clone()])}var n=this,r=null!==e.index?e.index.array:void 0,o=e.attributes,s=o.position.array,a=void 0!==o.normal?o.normal.array:void 0,u=void 0!==o.color?o.color.array:void 0,c=void 0!==o.uv?o.uv.array:void 0,h=void 0!==o.uv2?o.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var l=[],p=[],f=[],d=o=0;od;d+=3)t(r[d],r[d+1],r[d+2],m.materialIndex);else for(o=0;on;n++){var o=this.faces[n],s=this.vertices[o.a],a=this.vertices[o.b];e.subVectors(this.vertices[o.c],a),t.subVectors(s,a),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,n,r;for(r=Array(this.vertices.length),t=0,n=this.vertices.length;n>t;t++)r[t]=new i.Vector3;if(e){var o,s,a,u=new i.Vector3,c=new i.Vector3;for(e=0,t=this.faces.length;t>e;e++)n=this.faces[e],o=this.vertices[n.a],s=this.vertices[n.b],a=this.vertices[n.c],u.subVectors(a,s),c.subVectors(o,s),u.cross(c),r[n.a].add(u),r[n.b].add(u),r[n.c].add(u)}else for(e=0,t=this.faces.length;t>e;e++)n=this.faces[e],r[n.a].add(n.normal),r[n.b].add(n.normal),r[n.c].add(n.normal);for(t=0,n=this.vertices.length;n>t;t++)r[t].normalize();for(e=0,t=this.faces.length;t>e;e++)n=this.faces[e],o=n.vertexNormals,3===o.length?(o[0].copy(r[n.a]),o[1].copy(r[n.b]),o[2].copy(r[n.c])):(o[0]=r[n.a].clone(),o[1]=r[n.b].clone(),o[2]=r[n.c].clone());0n;n++)for(o=this.faces[n],o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),e=0,t=o.vertexNormals.length;t>e;e++)o.__originalVertexNormals[e]?o.__originalVertexNormals[e].copy(o.vertexNormals[e]):o.__originalVertexNormals[e]=o.vertexNormals[e].clone();var s=new i.Geometry;for(s.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[],o=this.morphNormals[e].faceNormals;var a,u,c=this.morphNormals[e].vertexNormals;for(n=0,r=this.faces.length;r>n;n++)a=new i.Vector3,u={a:new i.Vector3,b:new i.Vector3,c:new i.Vector3},o.push(a),c.push(u)}for(c=this.morphNormals[e],s.vertices=this.morphTargets[e].vertices,s.computeFaceNormals(),s.computeVertexNormals(),n=0,r=this.faces.length;r>n;n++)o=this.faces[n],a=c.faceNormals[n],u=c.vertexNormals[n],a.copy(o.normal),u.a.copy(o.vertexNormals[0]),u.b.copy(o.vertexNormals[1]),u.c.copy(o.vertexNormals[2])}for(n=0,r=this.faces.length;r>n;n++)o=this.faces[n],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,n=0,r=t.length;r>n;n++)n>0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new i.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!1==e instanceof i.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);else{var r,o=this.vertices.length,s=this.vertices,a=e.vertices,u=this.faces,c=e.faces,h=this.faceVertexUvs[0];e=e.faceVertexUvs[0],void 0===n&&(n=0),void 0!==t&&(r=(new i.Matrix3).getNormalMatrix(t));for(var l=0,p=a.length;p>l;l++){var f=a[l].clone();void 0!==t&&f.applyMatrix4(t),s.push(f)}for(l=0,p=c.length;p>l;l++){var d,a=c[l],m=a.vertexNormals,v=a.vertexColors,f=new i.Face3(a.a+o,a.b+o,a.c+o);for(f.normal.copy(a.normal),void 0!==r&&f.normal.applyMatrix3(r).normalize(),t=0,s=m.length;s>t;t++)d=m[t].clone(),void 0!==r&&d.applyMatrix3(r).normalize(),f.vertexNormals.push(d);for(f.color.copy(a.color),t=0,s=v.length;s>t;t++)d=v[t],f.vertexColors.push(d.clone());f.materialIndex=a.materialIndex+n,u.push(f)}for(l=0,p=e.length;p>l;l++)if(n=e[l],r=[],void 0!==n){for(t=0,s=n.length;s>t;t++)r.push(n[t].clone());h.push(r)}}},mergeMesh:function(e){!1==e instanceof i.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,n,r={},i=[],o=[],s=Math.pow(10,4);for(t=0,n=this.vertices.length;n>t;t++)e=this.vertices[t],e=Math.round(e.x*s)+"_"+Math.round(e.y*s)+"_"+Math.round(e.z*s),void 0===r[e]?(r[e]=t,i.push(this.vertices[t]),o[t]=i.length-1):o[t]=o[r[e]];for(r=[],t=0,n=this.faces.length;n>t;t++)for(s=this.faces[t],s.a=o[s.a],s.b=o[s.b],s.c=o[s.c],s=[s.a,s.b,s.c],e=0;3>e;e++)if(s[e]===s[(e+1)%3]){r.push(t);break}for(t=r.length-1;t>=0;t--)for(s=r[t],this.faces.splice(s,1),o=0,n=this.faceVertexUvs.length;n>o;o++)this.faceVertexUvs[o].splice(s,1);return t=this.vertices.length-i.length,this.vertices=i,t},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;t>n;n++)e[n]._id=n;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var r,i,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];for(o&&o.length===t&&(r=[]),s&&s.length===t&&(i=[]),n=0;t>n;n++){var a=e[n]._id;r&&r.push(o[a]),i&&i.push(s[a])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){function e(e,t,n){return n?e|1<n;n++)this.vertices.push(t[n].clone());for(t=e.faces,n=0,r=t.length;r>n;n++)this.faces.push(t[n].clone());for(n=0,r=e.faceVertexUvs.length;r>n;n++){t=e.faceVertexUvs[n],void 0===this.faceVertexUvs[n]&&(this.faceVertexUvs[n]=[]);for(var i=0,o=t.length;o>i;i++){for(var s=t[i],a=[],u=0,c=s.length;c>u;u++)a.push(s[u].clone());this.faceVertexUvs[n].push(a)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.Geometry.prototype),i.GeometryIdCount=0,i.DirectGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},i.DirectGeometry.prototype={constructor:i.DirectGeometry,computeBoundingBox:i.Geometry.prototype.computeBoundingBox,computeBoundingSphere:i.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){var t,n,r=[];e=e.faces;for(var i=0;i0){t=[];for(var h=0;c>h;h++)t[h]=[];this.morphTargets.position=t}var l,p=e.morphNormals,f=p.length;if(f>0){for(l=[],h=0;f>h;h++)l[h]=[];this.morphTargets.normal=l}for(var d=e.skinIndices,m=e.skinWeights,v=d.length===r.length,g=m.length===r.length,h=0;h_;_++){var b=u[_].vertices;t[_].push(b[y.a],b[y.b],b[y.c])}for(_=0;f>_;_++)b=p[_].vertexNormals[h],l[_].push(b.a,b.b,b.c);v&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.DirectGeometry.prototype),i.BufferGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.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}},i.BufferGeometry.prototype={constructor:i.BufferGeometry,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t,n){if(!1==t instanceof i.BufferAttribute&&!1==t instanceof i.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new i.BufferAttribute(t,n));else{if("index"!==e)return this.attributes[e]=t,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)}},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;return void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0),t=this.attributes.normal,void 0!==t&&((new i.Matrix3).getNormalMatrix(e).applyToVector3Array(t.array),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof i.Points||e instanceof i.Line){e=new i.Float32Attribute(3*t.vertices.length,3);var n=new i.Float32Attribute(3*t.colors.length,3);this.addAttribute("position",e.copyVector3sArray(t.vertices)),this.addAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length&&(e=new i.Float32Attribute(t.lineDistances.length,1),this.addAttribute("lineDistance",e.copyArray(t.lineDistances))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof i.Mesh&&t instanceof i.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof i.Mesh){var n=t.__directGeometry;if(void 0===n)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}return!0===t.verticesNeedUpdate&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(t.vertices),n.needsUpdate=!0),t.verticesNeedUpdate=!1),!0===t.normalsNeedUpdate&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(t.normals),n.needsUpdate=!0),t.normalsNeedUpdate=!1),!0===t.colorsNeedUpdate&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(t.colors),n.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(t.uvs),n.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(t.lineDistances),n.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new i.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);this.addAttribute("position",new i.BufferAttribute(t,3).copyVector3sArray(e.vertices)),0o;o++){var a=r[o],u=new i.Float32Attribute(3*a.length,3);t.push(u.copyVector3sArray(a))}this.morphAttributes[n]=t}return 0s;s+=3)t.fromArray(n,s),o=Math.max(o,r.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,n=this.groups;if(t.position){var r=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new i.BufferAttribute(new Float32Array(r.length),3));else for(var o=t.normal.array,s=0,a=o.length;a>s;s++)o[s]=0;var u,c,h,o=t.normal.array,l=new i.Vector3,p=new i.Vector3,f=new i.Vector3,d=new i.Vector3,m=new i.Vector3;if(e){e=e.array,0===n.length&&this.addGroup(0,e.length);for(var v=0,g=n.length;g>v;++v)for(s=n[v],a=s.start,u=s.count,s=a,a+=u;a>s;s+=3)u=3*e[s+0],c=3*e[s+1],h=3*e[s+2],l.fromArray(r,u),p.fromArray(r,c),f.fromArray(r,h),d.subVectors(f,p),m.subVectors(l,p),d.cross(m),o[u]+=d.x,o[u+1]+=d.y,o[u+2]+=d.z,o[c]+=d.x,o[c+1]+=d.y,o[c+2]+=d.z,o[h]+=d.x,o[h+1]+=d.y,o[h+2]+=d.z}else for(s=0,a=r.length;a>s;s+=9)l.fromArray(r,s),p.fromArray(r,s+3),f.fromArray(r,s+6),d.subVectors(f,p),m.subVectors(l,p),d.cross(m),o[s]=d.x,o[s+1]=d.y,o[s+2]=d.z,o[s+3]=d.x,o[s+4]=d.y,o[s+5]=d.z,o[s+6]=d.x,o[s+7]=d.y,o[s+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!1!=e instanceof i.BufferGeometry){void 0===t&&(t=0);var n,r=this.attributes;for(n in r)if(void 0!==e.attributes[n])for(var o=r[n].array,s=e.attributes[n],a=s.array,u=0,s=s.itemSize*t;ui;i+=3)e=r[i],t=r[i+1],n=r[i+2],e=1/Math.sqrt(e*e+t*t+n*n),r[i]*=e,r[i+1]*=e,r[i+2]*=e},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e,t=new i.BufferGeometry,n=this.index.array,r=this.attributes;for(e in r){for(var o=r[e],s=o.array,o=o.itemSize,a=new s.constructor(n.length*o),u=0,c=0,h=0,l=n.length;l>h;h++)for(var u=n[h]*o,p=0;o>p;p++)a[c++]=s[u++];t.addAttribute(e,new i.BufferAttribute(a,o))}return t},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t,n=this.parameters;for(t in n)void 0!==n[t]&&(e[t]=n[t]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(n=Array.prototype.slice.call(r.array),e.data.index={type:r.array.constructor.name,array:n}),r=this.attributes;for(t in r){var i=r[t],n=Array.prototype.slice.call(i.array);e.data.attributes[t]={itemSize:i.itemSize,type:i.array.constructor.name,array:n,normalized:i.normalized}}return t=this.groups,0n;n++){var r=e[n];this.addGroup(r.start,r.count,r.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.BufferGeometry.prototype),i.BufferGeometry.MaxIndex=65535,i.InstancedBufferGeometry=function(){i.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},i.InstancedBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.InstancedBufferGeometry.prototype.constructor=i.InstancedBufferGeometry,i.InstancedBufferGeometry.prototype.addGroup=function(e,t,n){this.groups.push({start:e,count:t,instances:n})},i.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var n,t=e.attributes;for(n in t)this.addAttribute(n,t[n].clone());for(e=e.groups,n=0,t=e.length;t>n;n++){var r=e[n];this.addGroup(r.start,r.count,r.instances)}return this},i.EventDispatcher.prototype.apply(i.InstancedBufferGeometry.prototype),i.Uniform=function(e,t){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=t),this.value=e,this.dynamic=!1},i.Uniform.prototype={constructor:i.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},i.AnimationClip=function(e,t,n){this.name=e||i.Math.generateUUID(),this.tracks=n,this.duration=void 0!==t?t:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},i.AnimationClip.prototype={constructor:i.AnimationClip,resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t)var r=this.tracks[t],e=Math.max(e,r.times[r.times.length-1]);this.duration=e},trim:function(){for(var e=0;ea;a++){var u=[],c=[];u.push((a+o-1)%o,a,(a+1)%o),c.push(0,1,0);var h=i.AnimationUtils.getKeyframeOrder(u),u=i.AnimationUtils.sortedArray(u,1,h),c=i.AnimationUtils.sortedArray(c,1,h);r||0!==u[0]||(u.push(o),c.push(c[0])),s.push(new i.NumberKeyframeTrack(".morphTargetInfluences["+t[a].name+"]",u,c).scale(1/n))}return new i.AnimationClip(e,-1,s)},findByName:function(e,t){for(var n=0;ns;s++){var u=e[s],c=u.name.match(o);if(c&&1t||0===n)return;this._startTime=null,t*=n}if(t*=this._updateTimeScale(e),n=this._updateTime(t),e=this._updateWeight(e),e>0){t=this._interpolants;for(var i=this._propertyBindings,o=0,s=t.length;o!==s;++o)t[o].evaluate(n),i[o].accumulate(r,e)}},_updateWeight:function(e){var t=0;if(this.enabled){var t=this.weight,n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0],t=t*r;e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){var t=this.timeScale,n=this._timeScaleInterpolant;if(null!==n){var r=n.evaluate(e)[0],t=t*r;e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.pause=!0:this.timeScale=t)}}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,r=this.loop,o=this._loopCount,s=!1;switch(r){case i.LoopOnce:if(-1===o&&(this.loopCount=0,this._setEndings(!0,!0,!1)),t>=n)t=n;else{if(!(0>t))break;t=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1});break;case i.LoopPingPong:s=!0;case i.LoopRepeat:if(-1===o&&(e>0?(o=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),t>=n||0>t){var a=Math.floor(t/n),t=t-n*a,o=o+Math.abs(a),u=this.repetitions-o;if(0>u){this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});break}0===u?(e=0>e,this._setEndings(e,!e,s)):this._setEndings(!1,!1,s),this._loopCount=o,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}if(r===i.LoopPingPong&&1===(1&o))return this.time=t,n-t}return this.time=t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=i.ZeroSlopeEnding,r.endingEnd=i.ZeroSlopeEnding):(r.endingStart=e?this.zeroSlopeAtStart?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:i.WrapAroundEnding,r.endingEnd=t?this.zeroSlopeAtEnd?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:i.WrapAroundEnding)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=r._lendControlInterpolant()),r=o.parameterPositions,o=o.sampleValues,r[0]=i,o[0]=t,r[1]=i+e,o[1]=n,this}},Object.assign(i.AnimationMixer.prototype,{_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,o=r.length,s=e._propertyBindings,a=e._interpolants,u=n.uuid,c=this._bindingsByRootAndName,h=c[u];for(void 0===h&&(h={},c[u]=h),c=0;c!==o;++c){var l=r[c],p=l.name,f=h[p];if(void 0===f){if(f=s[c],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,u,p));continue}f=new i.PropertyMixer(i.PropertyBinding.create(n,p,t&&t._propertyBindings[c].binding.parsedPath),l.ValueTypeName,l.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,u,p)}s[c]=f,a[c].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.name,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){return e=e._cacheIndex,null!==e&&ed){var v=t[d],g=--r,m=t[g];for(o[m.uuid]=d,t[d]=m,o[f]=g,t[g]=p,f=0,m=c;f!==m;++f){var y=u[f],_=y[d];y[d]=y[g],void 0===_&&(_=new i.PropertyBinding(p,s[f],a[f])),y[g]=_}}else t[d]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=r},remove:function(e){for(var t=this._objects,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,o=i.length,s=0,a=arguments.length;s!==a;++s){var u=arguments[s],c=u.uuid,h=r[c];if(void 0!==h&&h>=n){var l=n++,p=t[l];for(r[p.uuid]=h,t[h]=p,r[c]=l,t[l]=u,u=0,c=o;u!==c;++u){var p=i[u],f=p[h];p[h]=p[l],p[l]=f}}}this.nCachedObjects_=n},uncache:function(e){
-for(var t=this._objects,n=t.length,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,s=o.length,a=0,u=arguments.length;a!==u;++a){var c=arguments[a].uuid,h=i[c];if(void 0!==h)if(delete i[c],r>h){var c=--r,l=t[c],p=--n,f=t[p];for(i[l.uuid]=h,t[h]=l,i[f.uuid]=c,t[c]=f,t.pop(),l=0,f=s;l!==f;++l){var d=o[l],m=d[p];d[h]=d[c],d[c]=m,d.pop()}}else for(p=--n,f=t[p],i[f.uuid]=h,t[h]=f,t.pop(),l=0,f=s;l!==f;++l)d=o[l],d[h]=d[p],d.pop()}this.nCachedObjects_=r},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],o=this._bindings;if(void 0!==r)return o[r];var s=this._paths,a=this._parsedPaths,u=this._objects,c=this.nCachedObjects_,h=Array(u.length),r=o.length;for(n[e]=r,s.push(e),a.push(t),o.push(h),n=c,r=u.length;n!==r;++n)h[n]=new i.PropertyBinding(u[n],e,t);return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];t[e[s]]=n,o[n]=a,o.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}},i.AnimationUtils={arraySlice:function(e,t,n){return i.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=Array(t),r=0;r!==t;++r)n[r]=r;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),o=0,s=0;s!==r;++o)for(var a=n[o]*t,u=0;u!==t;++u)i[s++]=e[a+u];return i},flattenJSON:function(e,t,n,r){for(var i=1,o=e[0];void 0!==o&&void 0===o[r];)o=e[i++];if(void 0!==o){var s=o[r];if(void 0!==s)if(Array.isArray(s)){do s=o[r],void 0!==s&&(t.push(o.time),n.push.apply(n,s)),o=e[i++];while(void 0!==o)}else if(void 0!==s.toArray){do s=o[r],void 0!==s&&(t.push(o.time),s.toArray(n,n.length)),o=e[i++];while(void 0!==o)}else do s=o[r],void 0!==s&&(t.push(o.time),n.push(s)),o=e[i++];while(void 0!==o)}}},i.KeyframeTrack=function(e,t,n,r){if(void 0===e)throw Error("track name is undefined");if(void 0===t||0===t.length)throw Error("no keyframes in track named "+e);this.name=e,this.times=i.AnimationUtils.convertArray(t,this.TimeBufferType),this.values=i.AnimationUtils.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()},i.KeyframeTrack.prototype={constructor:i.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(e){return new i.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new i.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new i.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t=void 0;switch(e){case i.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case i.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case i.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){if(t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw Error(t);this.setInterpolation(this.DefaultInterpolation)}console.warn(t)}else this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return i.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return i.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return i.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,o=0,s=r-1;o!==r&&n[o]t;)--s;return++s,0===o&&s===r||(o>=s&&(s=Math.max(s,1),o=s-1),r=this.getValueSize(),this.times=i.AnimationUtils.arraySlice(n,o,s),this.values=i.AnimationUtils.arraySlice(this.values,o*r,s*r)),this},validate:function(){var e=!0,t=this.getValueSize();0!==t-Math.floor(t)&&(console.error("invalid value size in track",this),e=!1);var n=this.times,t=this.values,r=n.length;0===r&&(console.error("track is empty",this),e=!1);for(var o=null,s=0;s!==r;s++){var a=n[s];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,s,a),e=!1;break}if(null!==o&&o>a){console.error("out of order keys",this,s,a,o),e=!1;break}o=a}if(void 0!==t&&i.AnimationUtils.isTypedArray(t))for(s=0,n=t.length;s!==n;++s)if(r=t[s],isNaN(r)){console.error("value is not a valid number",this,s,r),e=!1;break}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=1,o=1,s=e.length-1;s>=o;++o){var a=!1,u=e[o];if(u!==e[o+1]&&(1!==o||u!==u[0]))for(var c=o*n,h=c-n,l=c+n,u=0;u!==n;++u){var p=t[c+u];if(p!==t[h+u]||p!==t[l+u]){a=!0;break}}if(a){if(o!==r)for(e[r]=e[o],a=o*n,c=r*n,u=0;u!==n;++u)t[c+u]=t[a+u];++r}}return r!==e.length&&(this.times=i.AnimationUtils.arraySlice(e,0,r),this.values=i.AnimationUtils.arraySlice(t,0,r*n)),this}},Object.assign(i.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw Error("track type undefined, can not parse");var t=i.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){console.warn("legacy JSON format detected, converting");var n=[],r=[];i.AnimationUtils.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t=e.constructor;if(void 0!==t.toJSON)t=t.toJSON(e);else{var t={name:e.name,times:i.AnimationUtils.convertArray(e.times,Array),values:i.AnimationUtils.convertArray(e.values,Array)},n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return i.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return i.VectorKeyframeTrack;case"color":return i.ColorKeyframeTrack;case"quaternion":return i.QuaternionKeyframeTrack;case"bool":case"boolean":return i.BooleanKeyframeTrack;case"string":return i.StringKeyframeTrack}throw Error("Unsupported typeName: "+e)}}),i.PropertyBinding=function(e,t,n){this.path=t,this.parsedPath=n||i.PropertyBinding.parseTrackName(t),this.node=i.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},i.PropertyBinding.prototype={constructor:i.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,o=t.propertyIndex;if(e||(this.node=e=i.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var s=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);for(e=e.skeleton.bones,n=0;nr&&this._mixBufferRegion(n,e,3*t,1-r,t);for(var r=t,o=t+t;r!==o;++r)if(n[r]!==n[r+t]){i.setValue(n,e);break}},saveOriginalState:function(){var e=this.buffer,t=this.valueSize,n=3*t;this.binding.getValue(e,n);for(var r=t;r!==n;++r)e[r]=e[n+r%t];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(e,t,n,r,i){if(r>=.5)for(r=0;r!==i;++r)e[t+r]=e[n+r]},_slerp:function(e,t,n,r,o){i.Quaternion.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var o=1-r,s=0;s!==i;++s){var a=t+s;e[a]=e[a]*o+e[n+s]*r}}},i.BooleanKeyframeTrack=function(e,t,n){i.KeyframeTrack.call(this,e,t,n)},i.BooleanKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:i.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.ColorKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.ColorKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.ColorKeyframeTrack,ValueTypeName:"color"}),i.NumberKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.NumberKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.NumberKeyframeTrack,ValueTypeName:"number"}),i.QuaternionKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new i.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),i.StringKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.StringKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:i.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.VectorKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.VectorKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.VectorKeyframeTrack,ValueTypeName:"vector"}),i.Audio=function(e){i.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},i.Audio.prototype=Object.create(i.Object3D.prototype),i.Audio.prototype.constructor=i.Audio,i.Audio.prototype.getOutput=function(){return this.gain},i.Audio.prototype.setNodeSource=function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},i.Audio.prototype.setBuffer=function(e){return this.source.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},i.Audio.prototype.play=function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,this.connect()}},i.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)},i.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)},i.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},i.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},i.Audio.prototype.getFilter=function(){return this.filter},i.Audio.prototype.setFilter=function(e){void 0===e&&(e=null),!0===this.isPlaying?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},i.Audio.prototype.setPlaybackRate=function(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))},i.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},i.Audio.prototype.onEnded=function(){this.isPlaying=!1},i.Audio.prototype.setLoop=function(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=e},i.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},i.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},i.Audio.prototype.getVolume=function(){return this.gain.gain.value},i.AudioAnalyser=function(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)},i.AudioAnalyser.prototype={constructor:i.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},Object.defineProperty(i,"AudioContext",{get:function(){var e;return function(){return void 0===e&&(e=new(window.AudioContext||window.webkitAudioContext)),e}}()}),i.PositionalAudio=function(e){i.Audio.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},i.PositionalAudio.prototype=Object.create(i.Audio.prototype),i.PositionalAudio.prototype.constructor=i.PositionalAudio,i.PositionalAudio.prototype.getOutput=function(){return this.panner},i.PositionalAudio.prototype.setRefDistance=function(e){this.panner.refDistance=e},i.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},i.PositionalAudio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},i.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},i.PositionalAudio.prototype.setDistanceModel=function(e){this.panner.distanceModel=e},i.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},i.PositionalAudio.prototype.setMaxDistance=function(e){this.panner.maxDistance=e},i.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},i.PositionalAudio.prototype.updateMatrixWorld=function(){var e=new i.Vector3;return function(t){i.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),i.AudioListener=function(){i.Object3D.call(this),this.type="AudioListener",this.context=i.AudioContext,this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},i.AudioListener.prototype=Object.create(i.Object3D.prototype),i.AudioListener.prototype.constructor=i.AudioListener,i.AudioListener.prototype.getInput=function(){return this.gain},i.AudioListener.prototype.removeFilter=function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},i.AudioListener.prototype.setFilter=function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},i.AudioListener.prototype.getFilter=function(){return this.filter},i.AudioListener.prototype.setMasterVolume=function(e){this.gain.gain.value=e},i.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},i.AudioListener.prototype.updateMatrixWorld=function(){var e=new i.Vector3,t=new i.Quaternion,n=new i.Vector3,r=new i.Vector3;return function(o){i.Object3D.prototype.updateMatrixWorld.call(this,o),o=this.context.listener;var s=this.up;this.matrixWorld.decompose(e,t,n),r.set(0,0,-1).applyQuaternion(t),o.setPosition(e.x,e.y,e.z),o.setOrientation(r.x,r.y,r.z,s.x,s.y,s.z)}}(),i.Camera=function(){i.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new i.Matrix4,this.projectionMatrix=new i.Matrix4},i.Camera.prototype=Object.create(i.Object3D.prototype),i.Camera.prototype.constructor=i.Camera,i.Camera.prototype.getWorldDirection=function(){var e=new i.Quaternion;return function(t){return t=t||new i.Vector3,this.getWorldQuaternion(e),t.set(0,0,-1).applyQuaternion(e)}}(),i.Camera.prototype.lookAt=function(){var e=new i.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),i.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},i.Camera.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},i.CubeCamera=function(e,t,n){i.Object3D.call(this),this.type="CubeCamera";var r=new i.PerspectiveCamera(90,1,e,t);r.up.set(0,-1,0),r.lookAt(new i.Vector3(1,0,0)),this.add(r);var o=new i.PerspectiveCamera(90,1,e,t);o.up.set(0,-1,0),o.lookAt(new i.Vector3(-1,0,0)),this.add(o);var s=new i.PerspectiveCamera(90,1,e,t);s.up.set(0,0,1),s.lookAt(new i.Vector3(0,1,0)),this.add(s);var a=new i.PerspectiveCamera(90,1,e,t);a.up.set(0,0,-1),a.lookAt(new i.Vector3(0,-1,0)),this.add(a);var u=new i.PerspectiveCamera(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new i.Vector3(0,0,1)),this.add(u);var c=new i.PerspectiveCamera(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new i.Vector3(0,0,-1)),this.add(c),this.renderTarget=new i.WebGLRenderTargetCube(n,n,{format:i.RGBFormat,magFilter:i.LinearFilter,minFilter:i.LinearFilter}),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,i=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,r,n),n.activeCubeFace=1,e.render(t,o,n),n.activeCubeFace=2,e.render(t,s,n),n.activeCubeFace=3,e.render(t,a,n),n.activeCubeFace=4,e.render(t,u,n),n.texture.generateMipmaps=i,n.activeCubeFace=5,e.render(t,c,n),e.setRenderTarget(null)}},i.CubeCamera.prototype=Object.create(i.Object3D.prototype),i.CubeCamera.prototype.constructor=i.CubeCamera,i.OrthographicCamera=function(e,t,n,r,o,s){i.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=void 0!==o?o:.1,this.far=void 0!==s?s:2e3,this.updateProjectionMatrix()},i.OrthographicCamera.prototype=Object.create(i.Camera.prototype),i.OrthographicCamera.prototype.constructor=i.OrthographicCamera,i.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(n-e,n+e,r+t,r-t,this.near,this.far)},i.OrthographicCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},i.OrthographicCamera.prototype.toJSON=function(e){return e=i.Object3D.prototype.toJSON.call(this,e),e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,e},i.PerspectiveCamera=function(e,t,n,r){i.Camera.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()},i.PerspectiveCamera.prototype=Object.create(i.Camera.prototype),i.PerspectiveCamera.prototype.constructor=i.PerspectiveCamera,i.PerspectiveCamera.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},i.PerspectiveCamera.prototype.setFocalLength=function(e){e=.5*this.getFilmHeight()/e,this.fov=2*i.Math.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.getFocalLength=function(){var e=Math.tan(.5*i.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},i.PerspectiveCamera.prototype.getEffectiveFOV=function(){return 2*i.Math.RAD2DEG*Math.atan(Math.tan(.5*i.Math.DEG2RAD*this.fov)/this.zoom)},i.PerspectiveCamera.prototype.getFilmWidth=function(){return this.filmGauge*Math.min(this.aspect,1)},i.PerspectiveCamera.prototype.getFilmHeight=function(){return this.filmGauge/Math.max(this.aspect,1)},i.PerspectiveCamera.prototype.setViewOffset=function(e,t,n,r,i,o){this.aspect=e/t,this.view={fullWidth:e,fullHeight:t,offsetX:n,offsetY:r,width:i,height:o},this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=this.near,t=e*Math.tan(.5*i.Math.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,o=-.5*r,s=this.view;if(null!==s)var a=s.fullWidth,u=s.fullHeight,o=o+s.offsetX*r/a,t=t-s.offsetY*n/u,r=s.width/a*r,n=s.height/u*n;s=this.filmOffset,0!==s&&(o+=e*s/this.getFilmWidth()),this.projectionMatrix.makeFrustum(o,o+r,t-n,t,e,this.far)},i.PerspectiveCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},i.PerspectiveCamera.prototype.toJSON=function(e){return e=i.Object3D.prototype.toJSON.call(this,e),e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e},i.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new i.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new i.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},i.StereoCamera.prototype={constructor:i.StereoCamera,update:function(){var e,t,n,r,o,s=new i.Matrix4,a=new i.Matrix4;return function(u){if(e!==u.focus||t!==u.fov||n!==u.aspect*this.aspect||r!==u.near||o!==u.far){e=u.focus,t=u.fov,n=u.aspect*this.aspect,r=u.near,o=u.far;var c,h,l=u.projectionMatrix.clone(),p=.032*r/e,f=r*Math.tan(i.Math.DEG2RAD*t*.5);a.elements[12]=-.032,s.elements[12]=.032,c=-f*n+p,h=f*n+p,l.elements[0]=2*r/(h-c),l.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(l),c=-f*n-p,h=f*n-p,l.elements[0]=2*r/(h-c),l.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(u.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(u.matrixWorld).multiply(s)}}()},i.Light=function(e,t){i.Object3D.call(this),this.type="Light",this.color=new i.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},i.Light.prototype=Object.create(i.Object3D.prototype),i.Light.prototype.constructor=i.Light,i.Light.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},i.Light.prototype.toJSON=function(e){return e=i.Object3D.prototype.toJSON.call(this,e),e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),e},i.LightShadow=function(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new i.Vector2(512,512),this.map=null,this.matrix=new i.Matrix4},i.LightShadow.prototype={constructor:i.LightShadow,copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},i.AmbientLight=function(e,t){i.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},i.AmbientLight.prototype=Object.create(i.Light.prototype),i.AmbientLight.prototype.constructor=i.AmbientLight,i.DirectionalLight=function(e,t){i.Light.call(this,e,t),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.shadow=new i.DirectionalLightShadow},i.DirectionalLight.prototype=Object.create(i.Light.prototype),i.DirectionalLight.prototype.constructor=i.DirectionalLight,i.DirectionalLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.DirectionalLightShadow=function(e){i.LightShadow.call(this,new i.OrthographicCamera(-5,5,5,-5,.5,500))},i.DirectionalLightShadow.prototype=Object.create(i.LightShadow.prototype),i.DirectionalLightShadow.prototype.constructor=i.DirectionalLightShadow,i.HemisphereLight=function(e,t,n){i.Light.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new i.Color(t)},i.HemisphereLight.prototype=Object.create(i.Light.prototype),i.HemisphereLight.prototype.constructor=i.HemisphereLight,i.HemisphereLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this},i.PointLight=function(e,t,n,r){i.Light.call(this,e,t),this.type="PointLight",this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new i.LightShadow(new i.PerspectiveCamera(90,1,.5,500))},i.PointLight.prototype=Object.create(i.Light.prototype),i.PointLight.prototype.constructor=i.PointLight,Object.defineProperty(i.PointLight.prototype,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI);
-}}),i.PointLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},i.SpotLight=function(e,t,n,r,o,s){i.Light.call(this,e,t),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==o?o:0,this.decay=void 0!==s?s:1,this.shadow=new i.SpotLightShadow},i.SpotLight.prototype=Object.create(i.Light.prototype),i.SpotLight.prototype.constructor=i.SpotLight,Object.defineProperty(i.SpotLight.prototype,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),i.SpotLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.SpotLightShadow=function(){i.LightShadow.call(this,new i.PerspectiveCamera(50,1,.5,500))},i.SpotLightShadow.prototype=Object.create(i.LightShadow.prototype),i.SpotLightShadow.prototype.constructor=i.SpotLightShadow,i.SpotLightShadow.prototype.update=function(e){var t=2*i.Math.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height;e=e.distance||500;var r=this.camera;t===r.fov&&n===r.aspect&&e===r.far||(r.fov=t,r.aspect=n,r.far=e,r.updateProjectionMatrix())},i.AudioLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.AudioLoader.prototype={constructor:i.AudioLoader,load:function(e,t,n,r){var o=new i.XHRLoader(this.manager);o.setResponseType("arraybuffer"),o.load(e,function(e){i.AudioContext.decodeAudioData(e,function(e){t(e)})},n,r)}},i.Cache={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){return!1!==this.enabled?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},i.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},i.Loader.prototype={constructor:i.Loader,crossOrigin:void 0,extractUrlBase:function(e){return e=e.split("/"),1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(e,t,n){for(var r=[],i=0;ih.opacity&&(h.transparent=!0),n.setTextures(c),n.parse(h)}}()},i.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;r>n;n+=2){var i=t[n+1];if(t[n].test(e))return i}return null}},i.XHRLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.XHRLoader.prototype={constructor:i.XHRLoader,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e);var o=this,s=i.Cache.get(e);if(void 0!==s)return t&&setTimeout(function(){t(s)},0),s;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",e,!0),a.addEventListener("load",function(n){var s=n.target.response;i.Cache.add(e,s),200===this.status?(t&&t(s),o.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(s),o.manager.itemEnd(e)):(r&&r(n),o.manager.itemError(e))},!1),void 0!==n&&a.addEventListener("progress",function(e){n(e)},!1),a.addEventListener("error",function(t){r&&r(t),o.manager.itemError(e)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),o.manager.itemStart(e),a},setPath:function(e){this.path=e},setResponseType:function(e){this.responseType=e},setWithCredentials:function(e){this.withCredentials=e}},i.FontLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.FontLoader.prototype={constructor:i.FontLoader,load:function(e,t,n,r){new i.XHRLoader(this.manager).load(e,function(e){t(new i.Font(JSON.parse(e.substring(65,e.length-2))))},n,r)}},i.ImageLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.ImageLoader.prototype={constructor:i.ImageLoader,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e);var o=this,s=i.Cache.get(e);if(void 0!==s)return o.manager.itemStart(e),t?setTimeout(function(){t(s),o.manager.itemEnd(e)},0):o.manager.itemEnd(e),s;var a=document.createElement("img");return a.addEventListener("load",function(n){i.Cache.add(e,this),t&&t(this),o.manager.itemEnd(e)},!1),void 0!==n&&a.addEventListener("progress",function(e){n(e)},!1),a.addEventListener("error",function(t){r&&r(t),o.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),o.manager.itemStart(e),a.src=e,a},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:i.DefaultLoadingManager,this.withCredentials=!1},i.JSONLoader.prototype={constructor:i.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(e,t,n,r){var o=this,s=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:i.Loader.prototype.extractUrlBase(e),a=new i.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(e,function(n){n=JSON.parse(n);var r=n.metadata;if(void 0!==r&&(r=r.type,void 0!==r)){if("object"===r.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===r.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}n=o.parse(n,s),t(n.geometry,n.materials)},n,r)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){var n=new i.Geometry,r=void 0!==e.scale?1/e.scale:1;return function(t){var r,o,s,a,u,c,h,l,p,f,d,m,v,g=e.faces;c=e.vertices;var y=e.normals,_=e.colors,b=0;if(void 0!==e.uvs){for(r=0;rr;r++)n.faceVertexUvs[r]=[]}for(a=0,u=c.length;u>a;)r=new i.Vector3,r.x=c[a++]*t,r.y=c[a++]*t,r.z=c[a++]*t,n.vertices.push(r);for(a=0,u=g.length;u>a;)if(t=g[a++],p=1&t,s=2&t,r=8&t,h=16&t,f=32&t,c=64&t,t&=128,p){if(p=new i.Face3,p.a=g[a],p.b=g[a+1],p.c=g[a+3],d=new i.Face3,d.a=g[a+1],d.b=g[a+2],d.c=g[a+3],a+=4,s&&(s=g[a++],p.materialIndex=s,d.materialIndex=s),s=n.faces.length,r)for(r=0;b>r;r++)for(m=e.uvs[r],n.faceVertexUvs[r][s]=[],n.faceVertexUvs[r][s+1]=[],o=0;4>o;o++)l=g[a++],v=m[2*l],l=m[2*l+1],v=new i.Vector2(v,l),2!==o&&n.faceVertexUvs[r][s].push(v),0!==o&&n.faceVertexUvs[r][s+1].push(v);if(h&&(h=3*g[a++],p.normal.set(y[h++],y[h++],y[h]),d.normal.copy(p.normal)),f)for(r=0;4>r;r++)h=3*g[a++],f=new i.Vector3(y[h++],y[h++],y[h]),2!==r&&p.vertexNormals.push(f),0!==r&&d.vertexNormals.push(f);if(c&&(c=g[a++],c=_[c],p.color.setHex(c),d.color.setHex(c)),t)for(r=0;4>r;r++)c=g[a++],c=_[c],2!==r&&p.vertexColors.push(new i.Color(c)),0!==r&&d.vertexColors.push(new i.Color(c));n.faces.push(p),n.faces.push(d)}else{if(p=new i.Face3,p.a=g[a++],p.b=g[a++],p.c=g[a++],s&&(s=g[a++],p.materialIndex=s),s=n.faces.length,r)for(r=0;b>r;r++)for(m=e.uvs[r],n.faceVertexUvs[r][s]=[],o=0;3>o;o++)l=g[a++],v=m[2*l],l=m[2*l+1],v=new i.Vector2(v,l),n.faceVertexUvs[r][s].push(v);if(h&&(h=3*g[a++],p.normal.set(y[h++],y[h++],y[h])),f)for(r=0;3>r;r++)h=3*g[a++],f=new i.Vector3(y[h++],y[h++],y[h]),p.vertexNormals.push(f);if(c&&(c=g[a++],p.color.setHex(_[c])),t)for(r=0;3>r;r++)c=g[a++],p.vertexColors.push(new i.Color(_[c]));n.faces.push(p)}}(r),function(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,o=e.skinWeights.length;o>r;r+=t)n.skinWeights.push(new i.Vector4(e.skinWeights[r],t>1?e.skinWeights[r+1]:0,t>2?e.skinWeights[r+2]:0,t>3?e.skinWeights[r+3]:0));if(e.skinIndices)for(r=0,o=e.skinIndices.length;o>r;r+=t)n.skinIndices.push(new i.Vector4(e.skinIndices[r],t>1?e.skinIndices[r+1]:0,t>2?e.skinIndices[r+2]:0,t>3?e.skinIndices[r+3]:0));n.bones=e.bones,n.bones&&0r;r++){n.morphTargets[r]={},n.morphTargets[r].name=e.morphTargets[r].name,n.morphTargets[r].vertices=[];for(var s=n.morphTargets[r].vertices,a=e.morphTargets[r].vertices,u=0,c=a.length;c>u;u+=3){var h=new i.Vector3;h.x=a[u]*t,h.y=a[u+1]*t,h.z=a[u+2]*t,s.push(h)}}if(void 0!==e.morphColors&&0r;r++)t[r].color.fromArray(s,3*r)}(r),function(){var t=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var o=0;on;n++)t.materials.push(this.parse(e.materials[n]));return t}},i.ObjectLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this.texturePath=""},i.ObjectLoader.prototype={constructor:i.ObjectLoader,load:function(e,t,n,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var o=this;new i.XHRLoader(o.manager).load(e,function(e){o.parse(JSON.parse(e),t)},n,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),r=this.parseImages(e.images,function(){void 0!==t&&t(i)}),r=this.parseTextures(e.textures,r),r=this.parseMaterials(e.materials,r),i=this.parseObject(e.object,n,r);return e.animations&&(i.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0===t||t(i),i},parseGeometries:function(e){var t={};if(void 0!==e)for(var n=new i.JSONLoader,r=new i.BufferGeometryLoader,o=0,s=e.length;s>o;o++){var a,u=e[o];switch(u.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new i[u.type](u.width,u.height,u.widthSegments,u.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new i[u.type](u.width,u.height,u.depth,u.widthSegments,u.heightSegments,u.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new i[u.type](u.radius,u.segments,u.thetaStart,u.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new i[u.type](u.radiusTop,u.radiusBottom,u.height,u.radialSegments,u.heightSegments,u.openEnded,u.thetaStart,u.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new i[u.type](u.radius,u.widthSegments,u.heightSegments,u.phiStart,u.phiLength,u.thetaStart,u.thetaLength);break;case"DodecahedronGeometry":a=new i.DodecahedronGeometry(u.radius,u.detail);break;case"IcosahedronGeometry":a=new i.IcosahedronGeometry(u.radius,u.detail);break;case"OctahedronGeometry":a=new i.OctahedronGeometry(u.radius,u.detail);break;case"TetrahedronGeometry":a=new i.TetrahedronGeometry(u.radius,u.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new i[u.type](u.innerRadius,u.outerRadius,u.thetaSegments,u.phiSegments,u.thetaStart,u.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new i[u.type](u.radius,u.tube,u.radialSegments,u.tubularSegments,u.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new i[u.type](u.radius,u.tube,u.tubularSegments,u.radialSegments,u.p,u.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new i[u.type](u.points,u.segments,u.phiStart,u.phiLength);break;case"BufferGeometry":a=r.parse(u);break;case"Geometry":a=n.parse(u.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+u.type+'"');continue}a.uuid=u.uuid,void 0!==u.name&&(a.name=u.name),t[u.uuid]=a}return t},parseMaterials:function(e,t){var n={};if(void 0!==e){var r=new i.MaterialLoader;r.setTextures(t);for(var o=0,s=e.length;s>o;o++){var a=r.parse(e[o]);n[a.uuid]=a}}return n},parseAnimations:function(e){for(var t=[],n=0;ns;s++){var c=e[s],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:r.texturePath+c.url;o[c.uuid]=n(h)}}return o},parseTextures:function(e,t){function n(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),i[e])}var r={};if(void 0!==e)for(var o=0,s=e.length;s>o;o++){var a=e[o];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var u=new i.Texture(t[a.image]);u.needsUpdate=!0,u.uuid=a.uuid,void 0!==a.name&&(u.name=a.name),void 0!==a.mapping&&(u.mapping=n(a.mapping)),void 0!==a.offset&&(u.offset=new i.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(u.repeat=new i.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(u.minFilter=n(a.minFilter)),void 0!==a.magFilter&&(u.magFilter=n(a.magFilter)),void 0!==a.anisotropy&&(u.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(u.wrapS=n(a.wrap[0]),u.wrapT=n(a.wrap[1])),r[a.uuid]=u}return r},parseObject:function(){var e=new i.Matrix4;return function(t,n,r){function o(e){return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),n[e]}function s(e){return void 0!==e?(void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e]):void 0}var a;switch(t.type){case"Scene":a=new i.Scene;break;case"PerspectiveCamera":a=new i.PerspectiveCamera(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(a.focus=t.focus),void 0!==t.zoom&&(a.zoom=t.zoom),void 0!==t.filmGauge&&(a.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(a.filmOffset=t.filmOffset),void 0!==t.view&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new i.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":a=new i.AmbientLight(t.color,t.intensity);break;case"DirectionalLight":a=new i.DirectionalLight(t.color,t.intensity);break;case"PointLight":a=new i.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":a=new i.SpotLight(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new i.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":a=o(t.geometry);var u=s(t.material);a=a.bones&&0l;++l)o(l);else c.load(e,function(e){if(e=s._parser(e,!0),e.isCubemap)for(var n=e.mipmaps.length/e.mipmapCount,r=0;n>r;r++){a[r]={mipmaps:[]};for(var o=0;othis.opacity&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),0r;r++){var o=n[r].toJSON(e);delete o.metadata,t.materials.push(o)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;te.x||1e.x?0:1;break;case i.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(0>e.y||1e.y?0:1;break;case i.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},i.EventDispatcher.prototype.apply(i.Texture.prototype),i.TextureIdCount=0,i.DepthTexture=function(e,t,n,r,o,s,a,u,c){i.Texture.call(this,null,r,o,s,a,u,i.DepthFormat,n,c),this.image={width:e,height:t},this.type=void 0!==n?n:i.UnsignedShortType,this.magFilter=void 0!==a?a:i.NearestFilter,this.minFilter=void 0!==u?u:i.NearestFilter,this.generateMipmaps=this.flipY=!1},i.DepthTexture.prototype=Object.create(i.Texture.prototype),i.DepthTexture.prototype.constructor=i.DepthTexture,i.CanvasTexture=function(e,t,n,r,o,s,a,u,c){i.Texture.call(this,e,t,n,r,o,s,a,u,c),this.needsUpdate=!0},i.CanvasTexture.prototype=Object.create(i.Texture.prototype),i.CanvasTexture.prototype.constructor=i.CanvasTexture,i.CubeTexture=function(e,t,n,r,o,s,a,u,c,h){e=void 0!==e?e:[],t=void 0!==t?t:i.CubeReflectionMapping,i.Texture.call(this,e,t,n,r,o,s,a,u,c,h),this.flipY=!1},i.CubeTexture.prototype=Object.create(i.Texture.prototype),i.CubeTexture.prototype.constructor=i.CubeTexture,Object.defineProperty(i.CubeTexture.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),i.CompressedTexture=function(e,t,n,r,o,s,a,u,c,h,l,p){i.Texture.call(this,null,s,a,u,c,h,r,o,l,p),this.image={width:t,height:n},this.mipmaps=e,this.generateMipmaps=this.flipY=!1},i.CompressedTexture.prototype=Object.create(i.Texture.prototype),i.CompressedTexture.prototype.constructor=i.CompressedTexture,i.DataTexture=function(e,t,n,r,o,s,a,u,c,h,l,p){i.Texture.call(this,null,s,a,u,c,h,r,o,l,p),this.image={data:e,width:t,height:n},this.magFilter=void 0!==c?c:i.NearestFilter,this.minFilter=void 0!==h?h:i.NearestFilter,this.generateMipmaps=this.flipY=!1},i.DataTexture.prototype=Object.create(i.Texture.prototype),i.DataTexture.prototype.constructor=i.DataTexture,i.VideoTexture=function(e,t,n,r,o,s,a,u,c){function h(){requestAnimationFrame(h),e.readyState>=e.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}i.Texture.call(this,e,t,n,r,o,s,a,u,c),this.generateMipmaps=!1;var l=this;h()},i.VideoTexture.prototype=Object.create(i.Texture.prototype),i.VideoTexture.prototype.constructor=i.VideoTexture,i.Group=function(){i.Object3D.call(this),this.type="Group"},i.Group.prototype=Object.create(i.Object3D.prototype),i.Group.prototype.constructor=i.Group,i.Points=function(e,t){i.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.PointsMaterial({color:16777215*Math.random()})},i.Points.prototype=Object.create(i.Object3D.prototype),i.Points.prototype.constructor=i.Points,i.Points.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,n=new i.Sphere;return function(r,o){function s(e,n){var i=t.distanceSqToPoint(e);if(l>i){var s=t.closestPointToPoint(e);s.applyMatrix4(c);var u=r.ray.origin.distanceTo(s);ur.far||o.push({distance:u,distanceToRay:Math.sqrt(i),point:s.clone(),index:n,face:null,object:a})}}var a=this,u=this.geometry,c=this.matrixWorld,h=r.params.Points.threshold;if(null===u.boundingSphere&&u.computeBoundingSphere(),n.copy(u.boundingSphere),n.applyMatrix4(c),!1!==r.ray.intersectsSphere(n)){e.getInverse(c),t.copy(r.ray).applyMatrix4(e);var h=h/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,h=new i.Vector3;if(u instanceof i.BufferGeometry){var p=u.index,u=u.attributes.position.array;if(null!==p)for(var f=p.array,p=0,d=f.length;d>p;p++){var m=f[p];h.fromArray(u,3*m),s(h,m)}else for(p=0,f=u.length/3;f>p;p++)h.fromArray(u,3*p),s(h,p)}else for(h=u.vertices,p=0,f=h.length;f>p;p++)s(h[p],p)}}}(),i.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Line=function(e,t,n){return 1===n?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new i.LineSegments(e,t)):(i.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new i.Geometry,void(this.material=void 0!==t?t:new i.LineBasicMaterial({color:16777215*Math.random()})))},i.Line.prototype=Object.create(i.Object3D.prototype),i.Line.prototype.constructor=i.Line,i.Line.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,n=new i.Sphere;return function(r,o){var s=r.linePrecision,s=s*s,a=this.geometry,u=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),n.copy(a.boundingSphere),n.applyMatrix4(u),!1!==r.ray.intersectsSphere(n)){e.getInverse(u),t.copy(r.ray).applyMatrix4(e);var c=new i.Vector3,h=new i.Vector3,u=new i.Vector3,l=new i.Vector3,p=this instanceof i.LineSegments?2:1;if(a instanceof i.BufferGeometry){var f=a.index,d=a.attributes.position.array;if(null!==f)for(var f=f.array,a=0,m=f.length-1;m>a;a+=p){var v=f[a+1];c.fromArray(d,3*f[a]),h.fromArray(d,3*v),v=t.distanceSqToSegment(c,h,l,u),v>s||(l.applyMatrix4(this.matrixWorld),v=r.ray.origin.distanceTo(l),vr.far||o.push({distance:v,point:u.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,m=d.length/3-1;m>a;a+=p)c.fromArray(d,3*a),h.fromArray(d,3*a+3),v=t.distanceSqToSegment(c,h,l,u),v>s||(l.applyMatrix4(this.matrixWorld),v=r.ray.origin.distanceTo(l),vr.far||o.push({distance:v,point:u.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a instanceof i.Geometry)for(c=a.vertices,h=c.length,a=0;h-1>a;a+=p)v=t.distanceSqToSegment(c[a],c[a+1],l,u),v>s||(l.applyMatrix4(this.matrixWorld),v=r.ray.origin.distanceTo(l),vr.far||o.push({distance:v,point:u.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),i.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.LineStrip=0,i.LinePieces=1,i.LineSegments=function(e,t){i.Line.call(this,e,t),this.type="LineSegments"},i.LineSegments.prototype=Object.create(i.Line.prototype),i.LineSegments.prototype.constructor=i.LineSegments,i.Mesh=function(e,t){i.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=i.TrianglesDrawMode,this.updateMorphTargets()},i.Mesh.prototype=Object.create(i.Object3D.prototype),i.Mesh.prototype.constructor=i.Mesh,i.Mesh.prototype.setDrawMode=function(e){this.drawMode=e},i.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},i.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},i.Mesh.prototype.raycast=function(){function e(e,t,n,r,o,s,a){return i.Triangle.barycoordFromPoint(e,t,n,r,v),o.multiplyScalar(v.x),s.multiplyScalar(v.y),a.multiplyScalar(v.z),o.add(s).add(a),o.clone()}function t(e,t,n,r,o,s,a){var u=e.material;return null===(u.side===i.BackSide?n.intersectTriangle(s,o,r,!0,a):n.intersectTriangle(r,o,s,u.side!==i.DoubleSide,a))?null:(y.copy(a),y.applyMatrix4(e.matrixWorld),n=t.ray.origin.distanceTo(y),nt.far?null:{distance:n,point:y.clone(),object:e})}function n(n,r,o,s,h,l,p,v){return a.fromArray(s,3*l),u.fromArray(s,3*p),c.fromArray(s,3*v),(n=t(n,r,o,a,u,c,g))&&(h&&(f.fromArray(h,2*l),d.fromArray(h,2*p),m.fromArray(h,2*v),n.uv=e(g,a,u,c,f,d,m)),n.face=new i.Face3(l,p,v,i.Triangle.normal(a,u,c)),n.faceIndex=l),n}var r=new i.Matrix4,o=new i.Ray,s=new i.Sphere,a=new i.Vector3,u=new i.Vector3,c=new i.Vector3,h=new i.Vector3,l=new i.Vector3,p=new i.Vector3,f=new i.Vector2,d=new i.Vector2,m=new i.Vector2,v=new i.Vector3,g=new i.Vector3,y=new i.Vector3;return function(v,y){var _=this.geometry,b=this.material,x=this.matrixWorld;if(void 0!==b&&(null===_.boundingSphere&&_.computeBoundingSphere(),s.copy(_.boundingSphere),s.applyMatrix4(x),!1!==v.ray.intersectsSphere(s)&&(r.getInverse(x),o.copy(v.ray).applyMatrix4(r),null===_.boundingBox||!1!==o.intersectsBox(_.boundingBox)))){var w,S;if(_ instanceof i.BufferGeometry){var M,E,b=_.index,x=_.attributes,_=x.position.array;if(void 0!==x.uv&&(w=x.uv.array),null!==b)for(var x=b.array,C=0,T=x.length;T>C;C+=3)b=x[C],M=x[C+1],E=x[C+2],(S=n(this,v,o,_,w,b,M,E))&&(S.faceIndex=Math.floor(C/3),y.push(S));else for(C=0,T=_.length;T>C;C+=9)b=C/3,M=b+1,E=b+2,(S=n(this,v,o,_,w,b,M,E))&&(S.index=b,y.push(S))}else if(_ instanceof i.Geometry){var A,P,x=b instanceof i.MultiMaterial,C=!0===x?b.materials:null,T=_.vertices;M=_.faces,E=_.faceVertexUvs[0],0O;O++){var R=M[O];if(S=!0===x?C[R.materialIndex]:b,void 0!==S){if(E=T[R.a],A=T[R.b],P=T[R.c],!0===S.morphTargets){S=_.morphTargets;var N=this.morphTargetInfluences;a.set(0,0,0),u.set(0,0,0),c.set(0,0,0);for(var D=0,I=S.length;I>D;D++){var k=N[D];if(0!==k){var j=S[D].vertices;a.addScaledVector(h.subVectors(j[R.a],E),k),u.addScaledVector(l.subVectors(j[R.b],A),k),c.addScaledVector(p.subVectors(j[R.c],P),k)}}a.add(E),u.add(A),c.add(P),E=a,A=u,P=c}(S=t(this,v,o,E,A,P,g))&&(w&&(N=w[O],f.copy(N[0]),d.copy(N[1]),m.copy(N[2]),S.uv=e(g,E,A,P,f,d,m)),S.face=R,S.faceIndex=O,y.push(S))}}}}}}(),i.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Bone=function(e){i.Object3D.call(this),this.type="Bone",this.skin=e},i.Bone.prototype=Object.create(i.Object3D.prototype),i.Bone.prototype.constructor=i.Bone,i.Bone.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},i.Skeleton=function(e,t,n){if(this.useVertexTexture=void 0!==n?n:!0,this.identityMatrix=new i.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture?(e=Math.sqrt(4*this.bones.length),e=i.Math.nextPowerOfTwo(Math.ceil(e)),this.boneTextureHeight=this.boneTextureWidth=e=Math.max(e,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new i.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,i.RGBAFormat,i.FloatType)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],t=0,e=this.bones.length;e>t;t++)this.boneInverses.push(new i.Matrix4)},i.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var n=new i.Matrix4;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},i.Skeleton.prototype.pose=function(){for(var e,t=0,n=this.bones.length;n>t;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;n>t;t++)(e=this.bones[t])&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},i.Skeleton.prototype.update=function(){var e=new i.Matrix4;return function(){for(var t=0,n=this.bones.length;n>t;t++)e.multiplyMatrices(this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix,this.boneInverses[t]),e.toArray(this.boneMatrices,16*t);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),i.Skeleton.prototype.clone=function(){return new i.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},i.SkinnedMesh=function(e,t,n){if(i.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new i.Matrix4,this.bindMatrixInverse=new i.Matrix4,e=[],this.geometry&&void 0!==this.geometry.bones){for(var r,o=0,s=this.geometry.bones.length;s>o;++o)r=this.geometry.bones[o],t=new i.Bone(this),e.push(t),t.name=r.name,t.position.fromArray(r.pos),t.quaternion.fromArray(r.rotq),void 0!==r.scl&&t.scale.fromArray(r.scl);for(o=0,s=this.geometry.bones.length;s>o;++o)r=this.geometry.bones[o],-1!==r.parent&&null!==r.parent&&void 0!==e[r.parent]?e[r.parent].add(e[o]):this.add(e[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new i.Skeleton(e,void 0,n),this.matrixWorld)},i.SkinnedMesh.prototype=Object.create(i.Mesh.prototype),i.SkinnedMesh.prototype.constructor=i.SkinnedMesh,i.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},i.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},i.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof i.Geometry)for(var e=0;en&&!(ei&&n>=r[i].distance;i++)r[i-1].object.visible=!1,r[i].object.visible=!0;for(;o>i;i++)r[i].object.visible=!1}}}(),i.LOD.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e,!1),e=e.levels;for(var t=0,n=e.length;n>t;t++){var r=e[t];this.addLevel(r.object.clone(),r.distance)}return this},i.LOD.prototype.toJSON=function(e){e=i.Object3D.prototype.toJSON.call(this,e),e.object.levels=[];for(var t=this.levels,n=0,r=t.length;r>n;n++){var o=t[n];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e},i.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),n=new Float32Array([0,0,1,0,1,1,0,1]),r=new i.BufferGeometry;return r.setIndex(new i.BufferAttribute(e,1)),r.addAttribute("position",new i.BufferAttribute(t,3)),r.addAttribute("uv",new i.BufferAttribute(n,2)),function(e){i.Object3D.call(this),this.type="Sprite",this.geometry=r,this.material=void 0!==e?e:new i.SpriteMaterial}}(),i.Sprite.prototype=Object.create(i.Object3D.prototype),i.Sprite.prototype.constructor=i.Sprite,i.Sprite.prototype.raycast=function(){var e=new i.Vector3;return function(t,n){e.setFromMatrixPosition(this.matrixWorld);var r=t.ray.distanceSqToPoint(e);r>this.scale.x*this.scale.y/4||n.push({distance:Math.sqrt(r),point:this.position,face:null,object:this})}}(),i.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},i.Particle=i.Sprite,i.LensFlare=function(e,t,n,r,o){i.Object3D.call(this),this.lensFlares=[],this.positionScreen=new i.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,r,o)},i.LensFlare.prototype=Object.create(i.Object3D.prototype),i.LensFlare.prototype.constructor=i.LensFlare,i.LensFlare.prototype.add=function(e,t,n,r,o,s){void 0===t&&(t=-1),void 0===n&&(n=0),void 0===s&&(s=1),void 0===o&&(o=new i.Color(16777215)),void 0===r&&(r=i.NormalBlending),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:e,size:t,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:s,color:o,blending:r})},i.LensFlare.prototype.updateLensFlares=function(){var e,t,n=this.lensFlares.length,r=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(e=0;n>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+r*t.distance,t.y=this.positionScreen.y+i*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},i.LensFlare.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,n=e.lensFlares.length;n>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},i.Scene=function(){i.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},i.Scene.prototype=Object.create(i.Object3D.prototype),i.Scene.prototype.constructor=i.Scene,i.Scene.prototype.copy=function(e,t){return i.Object3D.prototype.copy.call(this,e,t),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},i.Fog=function(e,t,n){this.name="",this.color=new i.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3},i.Fog.prototype.clone=function(){return new i.Fog(this.color.getHex(),this.near,this.far)},i.FogExp2=function(e,t){this.name="",this.color=new i.Color(e),this.density=void 0!==t?t:25e-5},i.FogExp2.prototype.clone=function(){return new i.FogExp2(this.color.getHex(),this.density)},i.ShaderChunk={},i.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",i.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif\n",i.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",i.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( PHYSICAL )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif\n",i.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",i.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",i.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",i.ShaderChunk.bsdfs="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n return any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n if( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n return distanceFalloff * maxDistanceCutoffFactor;\n#else\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n }\n return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return 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 float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return 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 vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",i.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n",i.ShaderChunk.clipping_planes_fragment="#if NUM_CLIPPING_PLANES > 0\n for ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n vec4 plane = clippingPlanes[ i ];\n if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n }\n#endif\n",i.ShaderChunk.clipping_planes_pars_fragment="#if NUM_CLIPPING_PLANES > 0\n #if ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n #endif\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",i.ShaderChunk.clipping_planes_pars_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n#endif\n",i.ShaderChunk.clipping_planes_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n vViewPosition = - mvPosition.xyz;\n#endif\n",i.ShaderChunk.color_fragment="#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",i.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif\n",i.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",i.ShaderChunk.color_vertex="#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",i.ShaderChunk.common="#define PI 3.14159265359\n#define PI2 6.28318530718\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 const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",i.ShaderChunk.cube_uv_reflection_fragment="#ifdef ENVMAP_TYPE_CUBE_UV\nconst float cubeUV_textureSize = 1024.0;\nint getFaceFromDirection(vec3 direction) {\n vec3 absDirection = abs(direction);\n int face = -1;\n if( absDirection.x > absDirection.z ) {\n if(absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0 : 3;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n else {\n if(absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2 : 5;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n return face;\n}\nfloat cubeUV_maxLods1 = log2(cubeUV_textureSize*0.25) - 1.0;\nfloat cubeUV_rangeClamp = exp2((6.0 - 1.0) * 2.0);\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n float dxRoughness = dFdx(roughness);\n float dyRoughness = dFdy(roughness);\n vec3 dx = dFdx( vec * scale * dxRoughness );\n vec3 dy = dFdy( vec * scale * dyRoughness );\n float d = max( dot( dx, dx ), dot( dy, dy ) );\n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\nfloat cubeUV_maxLods2 = log2(cubeUV_textureSize*0.25) - 2.0;\nconst float cubeUV_rcpTextureSize = 1.0 / cubeUV_textureSize;\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n float powScale = exp2_packed.x * exp2_packed.y;\n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 r;\n vec2 offset;\n int face = getFaceFromDirection(direction);\n float rcpPowScale = 1.0 / powScale;\n if( face == 0) {\n r = vec3(direction.x, -direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 1) {\n r = vec3(direction.y, direction.x, direction.z);\n offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 2) {\n r = vec3(direction.z, direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 3) {\n r = vec3(direction.x, direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else if( face == 4) {\n r = vec3(direction.y, direction.x, -direction.z);\n offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else {\n r = vec3(direction.z, -direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n r = normalize(r);\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n vec2 base = offset + vec2( texelOffset );\n return base + s * ( scale - 2.0 * texelOffset );\n}\nfloat cubeUV_maxLods3 = log2(cubeUV_textureSize*0.25) - 3.0;\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n float roughnessVal = roughness* cubeUV_maxLods3;\n float r1 = floor(roughnessVal);\n float r2 = r1 + 1.0;\n float t = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n float s = mipInfo.y;\n float level0 = mipInfo.x;\n float level1 = level0 + 1.0;\n level1 = level1 > 5.0 ? 5.0 : level1;\n level0 += min( floor( s + 0.5 ), 5.0 );\n vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n vec4 result = mix(color10, color20, t);\n return vec4(result.rgb, 1.0);\n}\n#endif\n",i.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n objectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",i.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",i.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif\n",i.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",i.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif\n",i.ShaderChunk.encodings_pars_fragment="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return 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 return 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 return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return 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 vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return 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 float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",i.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",i.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n envColor = envMapTexelToLinear( envColor );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif\n",i.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n uniform float reflectivity;\n uniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n #if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n varying vec3 vWorldPosition;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif\n",i.ShaderChunk.envmap_pars_vertex="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif\n",i.ShaderChunk.envmap_vertex="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif\n",i.ShaderChunk.fog_fragment="#ifdef USE_FOG\n #ifdef USE_LOGDEPTHBUF_EXT\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n #else\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n #endif\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",i.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n uniform vec3 fogColor;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",i.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",i.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",i.ShaderChunk.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 vLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n#endif\n",i.ShaderChunk.lights_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n if ( testLightInRange( lightDistance, pointLight.distance ) ) {\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n vec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n #else\n vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n",
-i.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",i.ShaderChunk.lights_phong_pars_fragment="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)\n",i.ShaderChunk.lights_physical_fragment="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.16 * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#endif\n",i.ShaderChunk.lights_physical_pars_fragment="struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n #ifndef STANDARD\n #endif\n};\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",i.ShaderChunk.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 PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #endif\n #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n irradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n #endif\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n RE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",i.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",i.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n#endif\n",i.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n uniform float logDepthBufFC;\n#endif",i.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n #endif\n#endif\n",i.ShaderChunk.map_fragment="#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif\n",i.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n",i.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",i.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n#endif\n",i.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.r;\n#endif\n",i.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",i.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",i.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif",i.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n #endif\n#endif\n",i.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #endif\n#endif\n#ifdef USE_NORMALMAP\n normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",i.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n }\n#endif\n",i.ShaderChunk.packing="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nvec4 packDepthToRGBA( const in float value ) {\n const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n vec4 res = mod( value * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n res -= res.xxyz * bit_mask;\n return res;\n}\nfloat unpackRGBAToDepth( const in vec4 rgba ) {\n const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n return dot( rgba, bitSh );\n}\nfloat viewZToOrthoDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat OrthoDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",i.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",i.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n vec4 mvPosition = modelViewMatrix * skinned;\n#else\n vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",i.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.r;\n#endif\n",i.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",i.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n const vec2 offset = vec2( 0.0, 1.0 );\n vec2 texelSize = vec2( 1.0 ) / size;\n vec2 centroidUV = floor( uv * size + 0.5 ) / size;\n float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n vec2 f = fract( uv * size + 0.5 );\n float a = mix( lb, lt, f.y );\n float b = mix( rb, rt, f.y );\n float c = mix( a, b, f.x );\n return c;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return 1.0;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif\n",i.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n#endif\n",i.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #endif\n#endif\n",i.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #endif\n return shadow;\n}\n",i.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",i.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif\n",i.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n#endif\n",i.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",i.ShaderChunk.specularmap_fragment="float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",i.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",i.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",i.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return 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 color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",i.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif",i.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",i.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = uv2;\n#endif",i.ShaderChunk.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 varying vec2 vUv;\n#endif",i.ShaderChunk.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 varying vec2 vUv;\n uniform vec4 offsetRepeat;\n#endif\n",i.ShaderChunk.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 vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",i.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n #ifdef USE_SKINNING\n vec4 worldPosition = modelMatrix * skinned;\n #else\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n#endif\n",i.UniformsUtils={merge:function(e){for(var t={},n=0;n\n#include \n#include \nvoid main() {\n #include \n gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n #include \n}\n",i.ShaderChunk.cube_vert="varying vec3 vWorldPosition;\n#include \n#include \n#include \nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include \n #include \n #include \n #include \n}\n",i.ShaderChunk.depth_frag="#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n #endif\n}\n",i.ShaderChunk.depth_vert="#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}\n",i.ShaderChunk.distanceRGBA_frag="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n #include \n gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",i.ShaderChunk.distanceRGBA_vert="varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition;\n}\n",
-i.ShaderChunk.equirect_frag="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \nvoid main() {\n #include \n vec3 direction = normalize( vWorldPosition );\n vec2 sampleUV;\n sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n}\n",i.ShaderChunk.equirect_vert="varying vec3 vWorldPosition;\n#include \n#include \n#include \nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include \n #include \n #include \n #include \n}\n",i.ShaderChunk.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 #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include \n #include \n #include \n #include \n}\n",i.ShaderChunk.linedashed_vert="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n}\n",i.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include